ShapeLayerPointColor does not draw colored point

Feb 6, 2012 at 2:56 PM

Hi,

I've downloaded the latest ocx version (4.8.6) and implemented it in a small GIS-viewer, with selection possibilities. I reused some code I created for a previous tryout I created with the 4.7 version.

When I select a point shape by clicking on it (the map_mouse down event fires the selectshapes sub), that point should recolor to light-blue, but nothing happens. Below my VB-code to add the selected items. Do I miss something? In the 4.7 version this method worked as a charm.

I also tried the Axmap.set_shapepointcolor, but that didn't work either.

Thanks in advance for your answer.

Koen

 

    Private selectedItems As New List(Of Integer)
    Private Sub SelectShapes(ByVal Extent As Extents)
        Dim sf As Shapefile
        Dim shapeID() As Integer
        For i As Integer = 0 To Me.Legend.Layers.Count
            If Me.GetLayerType(i) = eLayerType.PointShapefile Then
                sf = CType(Me.Legend.Map.GetObject(i), Shapefile)
                If sf.SelectShapes(Extent, 0.0, MapWinGIS.SelectMode.INTERSECTION, shapeID) = True Then
                    For j As Integer = 0 To sf.NumFields - 1
                        For k As Integer = 0 To shapeID.Length - 1
                            Dim val As Integer = CInt(sf.CellValue(j, shapeID(k)))
                            If sf.Field(j).Name = "TEST" Then
                                If Me.selectedItems.Contains(val) = True Then
                                    Me.Legend.Map.ShapePointColor(i, shapeID(k)) = Me.Legend.Map.ShapeLayerPointColor(i)
                                    Me.selectedItems.Remove(val)
                                Else
                                    Me.Legend.Map.ShapePointColor(i, shapeID(k)) = CUInt(RGB(0, 255, 255))
                                    Me.selectedItems.Add(val)
                                End If
                            End If
                         Next
                    Next
                End If
            End If
        Next
    End Sub

 

Coordinator
Feb 7, 2012 at 2:42 PM

You need a different class now.

It is something like sf.SelectionDrawingOptions().

We're working very hard to get the new documentation up. It will also include some sample code.

--
Paul

Feb 11, 2012 at 7:27 AM

Hi Paul,

I found your method and created the code below, which seems to work as expected. Thanks for pointing me into the right direction.

Cheers, Koen

 

'On loading my shapefile into the map, I set the drawing properties of the point shapefile
Private Sub SetShapefileProperties(sf As Shapefile, color As UInteger)
    'Default settings
    sf.DefaultDrawingOptions.PointType = tkPointSymbolType.ptSymbolStandard
    sf.DefaultDrawingOptions.PointShape = tkPointShapeType.ptShapeCircle
    sf.DefaultDrawingOptions.PointSize = 8
    sf.DefaultDrawingOptions.FillColor = color

    'Selection settings
    sf.SelectionAppearance = tkSelectionAppearance.saSelectionColor
    sf.SelectionColor = CInt(RGB(0, 255, 255)) 'light blue
End Sub

'This is my selection method
Private Sub SelectShapes(ByVal Extent As Extents)
    Dim sf As Shapefile
    Dim shapeID() As Integer
    For i As Integer = 0 To Me.Legend.Layers.Count
        If Me.GetLayerType(i) = eLayerType.PointShapefile Then
            sf = CType(Me.Legend.Map.GetObject(i), Shapefile)
            If sf.SelectShapes(Extent, 0.0, MapWinGIS.SelectMode.INTERSECTION, shapeID) = True Then
                For Each k In shapeID
                    If sf.ShapeSelected(k) = True Then
                        sf.ShapeSelected(k) = False
                    Else
                        sf.ShapeSelected(k) = True
                    End If
                Next
            End If
        End If
    Next
    Me.Legend.Map.Redraw()
End Sub

Coordinator
Feb 13, 2012 at 8:14 AM

Thanks Koen for letting us know.