Hello everybody,
I use the following code in my MS-Access/Vba GIS application to clear a selection:
I use index creation on several places in my code.
Is there a workaround?
Thanks and regards
I use the following code in my MS-Access/Vba GIS application to clear a selection:
Public Sub clearSelection()
' Selection zurücksetzen
Dim objShape As MapWinGIS.Shapefile
Dim objOptions As MapWinGIS.ShapeDrawingOptions
Dim lngLayerHandle As Long
Dim varShapeIDs As Variant
Dim lngShapeIndex As Long
Dim i As Long
' get handle of active layer
lngLayerHandle = colLayers(Me.lstProject.SelectedItem.Key).layerHandle
' create layerobject
Set objShape = Me.mapMain.GetObject(lngLayerHandle)
' create index on the first column
REM this line produces an out of stack space error with large files
objShape.Categories.Generate 0, ctUniqueValues, 0
' get selected items
objShape.SelectShapes Me.mapMain.Extents, 0, INTERSECTION, varShapeIDs
objShape.Categories.ApplyExpressions
' iterate over selected items
For i = 0 To UBound(varShapeIDs)
' get shapeindex of current item
lngShapeIndex = objShape.ShapeCategory(varShapeIDs(i))
' reset fill color
objShape.Categories.Item(lngShapeIndex).DrawingOptions.fillColor = _
colLayers(Me.lstProject.SelectedItem.Key).fillColor
Next i
Me.mapMain.Redraw
End Sub
If the shapefile has a large number of Elements, in one case nearly 46,000 elements, the line:objShape.Categories.Generate 0, ctUniqueValues, 0
leads to an error (28 - out of stack space). I use index creation on several places in my code.
Is there a workaround?
Thanks and regards