%% Create Parking Lot Containing Multiple Space Types
% Create a parking lot that contains a mixture of parking spaces, no-parking areas, and accessible spaces.
% Define the parking space to use in the parking lot. Use the default settings. Plot the space.

space = parkingSpace;
plot(space,Origin="off")

% Define the no-parking areas to use in the parking lot. Specify a color of white and a width that is one meter less than the width of the default parking space. Plot the space.

noSpace = parkingSpace(Type="NoParking",Width=(space.Width - 1),MarkingColor="White");
plot(noSpace,Origin="off")

% Define the accessible parking space to use in the parking lot. Specify a width that is one meter more than the width of the default parking space. Plot the space.

accessibleSpace = parkingSpace(Type="Accessible",Width=(space.Width + 1));
plot(accessibleSpace,Origin="off")

%
% Create a driving scenario containing a parking lot with a nonrectangular layout. Plot the parking lot and display the edge numbers along which you can add parking spaces.

scenario = drivingScenario;
vertices = [0 0; 32 -10.5; 32 -50.5; 25 -57.5; 0 -57.5];
lot = parkingLot(scenario,vertices);
plot(scenario,ParkingLotEdges="on")

%
% Insert default parking spaces along the first three edges of the parking lot. To avoid overlapping parking spaces, make these adjustments to the insertions:
% Along edge 1, insert only 10 spaces.
% Along edge 2, offset the spaces by 5 meters from the first vertex of the edge.
% Along edge 3, offset the spaces by 3 meters from the first vertex of the edge.

numSpaces = 10;
insertParkingSpaces(lot,space,numSpaces,Edge=1)
insertParkingSpaces(lot,space,Edge=2,Offset=5)
insertParkingSpaces(lot,space,Edge=3,Offset=3)

%
% In the center of the parking lot, insert a 2-by-10 grid of parking spaces containing 8 columns of default spaces, 1 column of no-parking areas, and 1 column of accessible spaces.

insertParkingSpaces(lot,[space noSpace accessibleSpace],[8 1 1],Position=[12 -18],Rows=2)

% Copyright 2021 The MathWorks, Inc.