MapWinGIS:Shapefile SelectShapes
From MapWindow GIS
SelectShapes
Gets all shapes in the shapefile that lie within the specified bounding box.
See also Extents and SelectMode
VB.NET Usage
Function SelectShapes(BoundBox As MapWinGIS.Extents, Optional Tolerance As Double, Optional SelectMode As MapWinGIS.SelectMode, Optional ByRef result As Object) As Boolean
Parameters
|
BoundBox | The bounding box used to determine which shapes in the shapefile to return as selected. The bounds must be in projected map units. |
| Tolerance | Optional. This is used to extend the boundaries of the specified bounding box to allow shapes not otherwise selected to be considered within the bounding box. The default value is 0.0. |
| SelectMode | Optional. Determines whether shapes must be completely enclosed by the bounding box or just intersected by the bounding box to be considered selected. The default is MapWinGIS.SelectMode.INTERSECTION. |
| result | Optional, reference parameter. An array of shape indexes of shapes in the shapefile that have been selected. |
| ReturnValue | A boolean value representing whether any shapes in the shapefile have been selected or not. |
Sample Code
Private Sub ShapefileSelectShapes()
Dim sf As New MapWinGIS.Shapefile()
Dim extents As New MapWinGIS.Extents()
Dim top As Integer, bottom As Integer, left As Integer, right As Integer, result() As Integer
Dim success As Boolean
'Set the value of the bounds to use for the bounding box in projected map coordinates
top = 300
bottom = 100
left = 100
right = 300
'Set the extents using the bounding box coordinates
extents.SetBounds(left, bottom, 0, right, top, 0)
'Get the shapes that are completely contained in the bounding box in the result array
success = sf.SelectShapes(extents, 0.0, MapWinGIS.SelectMode.INCLUSION, result)
End Sub
VB 6 Usage
Function SelectShapes(BoundBox As Extents, Optional Tolerance As Double, Optional SelectMode As SelectMode, Optional ByRef result As Object) As Boolean
Parameters
|
BoundBox | The bounding box used to determine which shapes in the shapefile to return as selected. The bounds must be in projected map units. |
| Tolerance | Optional. This is used to extend the boundaries of the specified bounding box to allow shapes not otherwise selected to be considered within the bounding box. The default value is 0.0. |
| SelectMode | Optional. Determines whether shapes must be completely enclosed by the bounding box or just intersected by the bounding box to be considered selected. The default is MapWinGIS.SelectMode.INTERSECTION. |
| result | Optional, reference parameter. An array of shape indexes of shapes in the shapefile that have been selected. |
| ReturnValue | A boolean value representing whether any shapes in the shapefile have been selected or not. |
Sample Code
Private Sub ShapefileSelectShapes()
Dim sf As New MapWinGIS.Shapefile
Dim extents As New MapWinGIS.extents
Dim top As Long, bottom As Long, left As Long, right As Long, result() As Long
Dim success As Boolean
'Set the value of the bounds to use for the bounding box in projected map coordinates
top = 300
bottom = 100
left = 100
right = 300
'Set the extents using the bounding box coordinates
extents.SetBounds left, bottom, 0, right, top, 0
'Get the shapes that are completely contained in the bounding box in the result array
success = sf.SelectShapes(extents, 0, MapWinGIS.SelectMode.INCLUSION, result)
End Sub
















