Shapefile selection

Modules

 Shapefile spatial index
 
 Validation
 

Functions

bool Shapefile.get_ShapeSelected (int shapeIndex)
 Gets the state of selection for the specified shape. More...
 
bool Shapefile.GetClosestVertex (double x, double y, double maxDistance, out int shapeIndex, out int pointIndex, out double distance)
 Gets the vertex closest to the specified point. More...
 
bool Shapefile.GetRelatedShapes (int referenceIndex, tkSpatialRelation relation, ref object resultArray)
 Gets shapes which are located at specified spatial relation to reference shape. More...
 
bool Shapefile.GetRelatedShapes2 (Shape referenceShape, tkSpatialRelation relation, ref object resultArray)
 Gets shapes which are located at specified spatial relation to reference shape. More...
 
void Shapefile.InvertSelection ()
 Inverts selection of the shapefile, i.e. selection state of every shape is changed to the opposite value. More...
 
void Shapefile.SelectAll ()
 Selects all the shapes in the shapefile More...
 
void Shapefile.SelectNone ()
 Clears selection from all shapes. More...
 
bool Shapefile.SelectShapes (Extents boundBox, double tolerance, SelectMode selectMode, ref object result)
 Returns an array with indices of shapes which are located inside specified bounds. More...
 
void Shapefile.set_ShapeSelected (int shapeIndex, bool pVal)
 Selects or deselects the specified shape. The _DMapEvents.SelectionChanged event is not fired. More...
 

Properties

int Shapefile.NumSelected [get]
 Gets the number of selected shapes in the shapefile. More...
 
bool Shapefile.Selectable [get, set]
 Gets or sets a value indicating whether this shapefile will be selectable by the cmSelection and cmSelectByPolygon tool. More...
 
tkSelectionAppearance Shapefile.SelectionAppearance [get, set]
 Gets or sets the way shapefile selection will be displayed. More...
 
uint Shapefile.SelectionColor [get, set]
 The colour of the selected shapes. More...
 
ShapeDrawingOptions Shapefile.SelectionDrawingOptions [get, set]
 The drawing options used for visualization of the selected shapes. More...
 
byte Shapefile.SelectionTransparency [get, set]
 Gets or sets the value which defines the transparency of the selection. Values from 0 (transparent) to 255(opaque) are applicable. More...
 

Detailed Description

Here is a list of properties and methods for managing shapefile selection. This module is a part of the documentation of the Shapefile class.

Historically, using the cmSelection and cmSelectByPolygon tools, you would specify a LayerHandle in the ChooseLayer map event to indicate which single layer you were selecting shapes from. Starting in v5.0, you can select from multiple layers concurrently by setting the 'Selectable' property of each layer you would like to select shapes from. If the LayerHandle returned from the ChooseLayer event is left unspecified (-1), then instead, all layers having the 'Selectable' property = TRUE will be selectable by the tool.

dot_inline_dotgraph_31.png

Graph description

Function Documentation

◆ get_ShapeSelected()

bool Shapefile.get_ShapeSelected ( int  shapeIndex)

Gets the state of selection for the specified shape.

Parameters
shapeIndexThe index of shape
Returns
True in case the shape is selected and false otherwise.
New API 4.8:
Added in version 4.8

◆ GetClosestVertex()

bool Shapefile.GetClosestVertex ( double  x,
double  y,
double  maxDistance,
out int  shapeIndex,
out int  pointIndex,
out double  distance 
)

Gets the vertex closest to the specified point.

Parameters
xX coordinate of the point to search from.
yY coordinate of the point to search from.
maxDistanceMaximum distance to search. Use 0 to search at any distance. Passing the max distance can improve performance.
shapeIndexIndex of shape to which closest vertex belongs.
pointIndexIndex of closest vertex within shape.
distanceThe distance to the closest vertex.
Returns
True if the vertex was found within specified distance and false otherwise.
New API 4.9.0:
Added in version 4.9.0

◆ GetRelatedShapes()

bool Shapefile.GetRelatedShapes ( int  referenceIndex,
tkSpatialRelation  relation,
ref object  resultArray 
)

Gets shapes which are located at specified spatial relation to reference shape.

Parameters
referenceIndexIndex of reference shape.
relationSpatial relation. Isn't implemented for Disjoint.
resultArrayThe array of indices of the found shapes (int[])
Returns
True if at least one related shape was found.
New API 4.9.0:
Added in version 4.9.0

◆ GetRelatedShapes2()

bool Shapefile.GetRelatedShapes2 ( Shape  referenceShape,
tkSpatialRelation  relation,
ref object  resultArray 
)

Gets shapes which are located at specified spatial relation to reference shape.

Parameters
referenceShapeReference shape.
relationSpatial relation. Isn't implemented for Disjoint.
resultArrayThe array of indices of the found shapes (int[])
Returns
True if at least one related shape was found.
New API 4.9.0:
Added in version 4.9.0

◆ InvertSelection()

void Shapefile.InvertSelection ( )

Inverts selection of the shapefile, i.e. selection state of every shape is changed to the opposite value.

See also
Shapefile.get_ShapeSelected
New API 4.8:
Added in version 4.8

◆ SelectAll()

void Shapefile.SelectAll ( )

Selects all the shapes in the shapefile

New API 4.8:
Added in version 4.8

◆ SelectNone()

void Shapefile.SelectNone ( )

Clears selection from all shapes.

New API 4.8:
Added in version 4.8
Examples
EditAttributes.cs, and SelectBox.cs.

◆ SelectShapes()

bool Shapefile.SelectShapes ( Extents  boundBox,
double  tolerance,
SelectMode  selectMode,
ref object  result 
)

Returns an array with indices of shapes which are located inside specified bounds.

This method doesn't change the state of selection or visualization of shapes.

Parameters
boundBoxThe bounding rectangular to select shapes within.
toleranceThe value of tolerance.
selectModeSelection mode.
resultAn output array of long type with the indices of the shapes.
Returns
True in case at least one shape is within bounds and false otherwise.
Examples
EditAttributes.cs, RemoveShape.cs, and SelectBox.cs.

◆ set_ShapeSelected()

void Shapefile.set_ShapeSelected ( int  shapeIndex,
bool  pVal 
)

Selects or deselects the specified shape. The _DMapEvents.SelectionChanged event is not fired.

Parameters
shapeIndexThe index of shape to be selected.
pValA value which indicates whether a shape should be selected.
New API 4.8:
Added in version 4.8
Examples
EditAttributes.cs, and SelectBox.cs.

Properties

◆ NumSelected

int Shapefile.NumSelected
get

Gets the number of selected shapes in the shapefile.

See also
Shapefile.get_ShapeSelected
New API 4.8:
Added in version 4.8

◆ Selectable

bool Shapefile.Selectable
getset

Gets or sets a value indicating whether this shapefile will be selectable by the cmSelection and cmSelectByPolygon tool.

This property allows for multiple shapefiles to be concurrently selectable. If only selecting from one layer, you can still use the ChooseLayer map event to specify the selectable layer.

See also
AxMap.CursorMode
New API 5.0:
Added in version 5.0.0

◆ SelectionAppearance

tkSelectionAppearance Shapefile.SelectionAppearance
getset

Gets or sets the way shapefile selection will be displayed.

See MapWinGIS.tkSelectionAppearance for the details.

New API 4.8:
Added in version 4.8

◆ SelectionColor

uint Shapefile.SelectionColor
getset

The colour of the selected shapes.

It is used when SelectionAppearance is set to saSelectionColor.

New API 4.8:
Added in version 4.8

◆ SelectionDrawingOptions

ShapeDrawingOptions Shapefile.SelectionDrawingOptions
getset

The drawing options used for visualization of the selected shapes.

It is used when SelectionAppearance is set to saDrawingOptions.

New API 4.8:
Added in version 4.8

◆ SelectionTransparency

byte Shapefile.SelectionTransparency
getset

Gets or sets the value which defines the transparency of the selection. Values from 0 (transparent) to 255(opaque) are applicable.

New API 4.8:
Added in version 4.8