Unable to Rotate Point Features Placed using Font Files


#1

Hi Team, Thanks for the new version release.
We have requested(MWGIS-123) the individual rotate option for point feature symbology (PointType = tkPointSymbolType.ptSymbolFontCharacter). As per the new release this was fixed. We have downloaded and tested.
As per my understanding, ShapeDrawingOptions have a property like PointRotation. Using this property we can set the angle to all the points at a time, but we requested to set the rotation value based on the shape file attribute field for individual shapes(like ESRI environment).
Could you please help me on this if any solution or if this was not available in the current version please add this as improvement. This option is very helpful to everyone.

Thank you
Regards,
Sample


#2

Yes, what you’re asking can be done. I admit it is not as straightforward as the ESRI implementation, but I had to do the very same thing, and I used Shapefile Categories. I had to create a category for each shape in the table, but in my case, there are never more than about 10. I’m not sure of the overhead involved if you have 1000’s of shapes… Following is a snippet of old VB6 code.

' we will assume count is small enough to create category for each shape
For i = 0 To pLayer.NumShapes - 1
    EntityID = CLng(pLayer.CellValue(pLayer.FieldIndexByName("EntityID"), i))
    Dim cat As ShapefileCategory
    Set cat = .Categories.Add(EntityID)
    cat.ValueType = cvExpression
    ' category is uniquely identified by the EntityID
    cat.Expression = "[EntityID] = " & EntityID
    With cat
        With .DrawingOptions
            ' is there an assigned icon?
            Dim IconFile As String
            IconFile = pLayer.CellValue(pLayer.FieldIndexByName("Filename"), i)
            If Len(IconFile) = 0 Then
                ' no icon, we need a small placeholder
                .SetDefaultPointSymbol dpsSquare
                .PointSize = 2
            Else
                .PointType = ptSymbolPicture
                .AlignPictureByBottom = False
                ' load specific picture for this Entity
                .Picture = LoadImage(IconFile, True, True)
                ' set rotation for this Entity
                .PointRotation = CDbl(pLayer.CellValue(pLayer.FieldIndexByName("Rotation"), i)
            End If
        End With
    End With
Next i

I should mention the weakness of this method is that you have to effectively redefine the categories as shapes are added or removed from the shapefile. Because of this, I would consider an enhancement that lets you more simply assign the rotation by field value, as ESRI does, without having to create distinct categories.

I hope this helps. Let me know if you need more clarification or if it would help to have sample code in another language.

Regards.
Jerry.


#3

Thank you for your response and code snippet.
In my case, We have to load 1000’s of shapes on map. so the above solution implements the application is hang/crash at applying the category.
Please consider the above request as an enhancement.
I need one more help for point(Font) size. Is there any option for point(Font) size change based on zoom level like shapefile.labels.ScaleLabel option. By using this option we can fix the size of point in fixed scale and we can visible(change) the size based on the zooming level.

Regards,
P. Rama Krishna


#4

Hello @ramkiponnam

Since I now have a better understanding of your request, and since MWGIS-123 has been closed with the new release, I will create a new Jira Issue to describe your enhancement request, and I will relate it back to MWGIS-123.

Regarding the second half of your question, options for Font sizing, I don’t understand what you’re asking.

Right now, if you specify a Font size (e.g. 12) and leave Labels.ScaleLabels with the default value of False, the labels for that layer will stay the same size, independent of the zoom level. And if you instead set Labels.ScaleLabels = True, the labels will be 12 points at your initial zoom level, get smaller as you zoom out, and larger as you zoom in. Is there some other behavior you are looking for?

Respectfully,
Jerry.


#5

New feature request has been added, MWGIS-140


#6

Thanks for raising enhancement request @jerryfaust.

We are requesting similar scalelabel functionality for shapes(ptSymbolFontCharacter) also. As of now we can scale the only labels based on zoomlevels using Labels.ScaleLabels=True.

Please let me know if you required any further information.

Regards,
P. Rama Krishna