Planar shape vector

`s = mapshape()`

s = mapshape(x,y)

s = mapshape(x,y,Name,Value)

s = mapshape(structArray)

s = mapshape(x,y,structArray)

A mapshape vector is an object that represents planar vector features with either point, line, or polygon topology. The features consist of X and Y coordinates and associated attributes. If these attributes vary spatially they are termed Vertex properties. These elements of the mapshape vector are coupled such that the length of the X and Y coordinate property values are always equal in length to any additional dynamic Vertex properties. Attributes which only pertain to the overall feature (point, line, polygon) are termed Feature properties. Feature properties are not linked to the auto-sizing mechanism of the Vertex properties. Both of the property types can be dynamically added to a mapshape vector using the standard dot notation.

A mapshape vector is always a column vector.

constructs
an empty mapshape vector, `s`

= mapshape()`s`

, with the following
default property settings.

s = 0x1 mapshape vector with properties: Collection properties: Geometry: 'line' Metadata: [1x1 struct] Vertex properties: X: [] Y: []

For an additional example see: Construct a Default mapshape Vector and Set and Add Properties

constructs
a mapshape vector and sets the `s`

= mapshape(`x`

,`y`

)`X`

and `Y`

property
values equal to vectors `x`

and `y`

. `x`

and `y`

may
be either numeric vectors of class single or double, or cell arrays
containing numeric vectors of class single or double. For an example,
see Construct a mapshape Vector Specifying x and y Values.

constructs
a mapshape vector from the input `s`

= mapshape(`x`

,`y`

,`Name`

,`Value`

)`x`

and `y`

vectors,
and then adds dynamic properties to the mapshape vector using the `Name`

, `Value`

argument
pairs.

If

`Value`

is in a cell array containing numeric, logical or cell array of character vectors, then this property is designated as a Vertex property. Otherwise, this property is designated as a Feature property.If the specified

`Name`

is`Metadata`

and the corresponding`Value`

is a scalar structure, then`Value`

is copied to the`Metadata`

property. Otherwise, an error is issued.

For an example, see: Construct a mapshape vector Specifying a Name-Value Pair.

constructs
a `s`

= mapshape(`structArray`

)`mapshape`

vector from the fields of the structure
array, `structArray`

.

If

`structArray`

is a scalar structure which contains the field`Metadata`

and the field value is a scalar structure, then the`Metadata`

field is copied to the`Metadata`

property. If`structArray`

is a scalar structure and the`Metadata`

field is present and is not a scalar structure, then an error is issued. If`structArray`

is not scalar then the`Metadata`

field is ignored.Other fields of

`structArray`

are assigned to`s`

and become dynamic properties. Field values in`structArray`

that are not numeric, character vectors, logical, or cell arrays of numeric, logical, or character vectors values are ignored.

For an example, see Construct a mapshape Vector from a Structure Array.

constructs
a new `s`

= mapshape(`x`

,`y`

,`structArray`

)`mapshape`

vector and sets the `X`

and `Y`

properties
equal to the numeric vectors, `x`

and `y`

,
and sets the field values of struct `structArray`

as
dynamic properties.

If

`structArray`

is a scalar structure and contains the field`Metadata`

, and the field value is a scalar structure, then it is copied to the`Metadata`

property value. Otherwise, an error is issued if the`Metadata`

field is not a structure, or ignored if`structArray`

is not scalar.

For an example, see Construct a mapshape Vector Using Cell Arrays and Structures to Define Multiple Features and Properties.

append | Append features to `mapshape` vector |

cat | Concatenate mapshape vectors |

disp | Display mapshape vector |

fieldnames | Dynamic properties of mapshape vector |

isempty | True if mapshape vector is empty |

isfield | True if dynamic property exists |

isprop | True if property exists |

length | Number of elements in mapshape vector |

properties | Properties of a mapshape vector |

rmfield | Remove dynamic property from mapshape vector |

rmprop | Remove properties from mapshape vector |

size | Size of `mapshape` vector |

struct | Convert mapshape vector to scalar structure |

vertcat | Vertical concatenation for mapshape vectors |

Value. To learn how value classes affect
copy operations, see Copying Objects in
the MATLAB^{®} documentation.

The following examples show how to build a mapshape vector by dynamically adding a single features after construction using dot (.) notation.

The following extended example adds multiple features that are both Vertex and Feature properties. It also demonstrates property behaviors when vector lengths are either changed or set to [ ].

This example uses the Name-Value constructor to build a mapshape vector and define two dynamic features.

Construct a mapshape Vector Specifying Several Name-Value Pairs

The mapshape vector can be indexed like any MATLAB vector. You can access any element of the vector to obtain a specific feature. The following example demonstrates this behavior.

Construct a mapshape vector Containing Multiple Features and Indexing Behaviors

This example builds a mapshape vector from a structure array; adds a Metadata property and demonstrates selective indexing behavior.

The following example shows a variety of indexing behaviors.

If either

`X`

or`Y`

is set to [ ], then both coordinate properties are set to [ ] and all dynamic Vertex or Feature properties are removed.If a Vertex or Feature property is set to [ ], then it is removed from the object.

Was this topic helpful?