In the GSA I have defined a cell with 2 annotations. To place these 2 annotations, I have adapted the sub "PlacePolygonAndAnnotation" from the example/demo vba. As a result the 2 annotations are placed on the cell, so placed with the same origin. However, I want to offset the annotations so that one label is displayed above the cell and one below. However, I can't find the right place in the code where I can define this.
This is my code:
Dim oCellOp As New xft.PlacePointOp Dim promptText As String ' --- initialize operation specific properties --- xft.PropMgr.InitializeOperationProperties "BERG", "placing"
' --- set up common properties to be used throughout current command --- xft.CmdMgr.SetProperty "placementFeature", "Berg" xft.CmdMgr.SetProperty "placementAlias", "Berg" xft.CmdMgr.SetProperty "featureOps", featureOps xft.CmdMgr.SetProperty "toolSettingsName", toolSettingsName xft.CmdMgr.SetProperty "placementGroup", "placement" ' --- set the current command name --- xft.CmdMgr.CommandPrompt = cmdPrompt
' --- First the root cell feature --- Dim oCell As New xft.feature oCell.Name = "Berg" oCell.Alias = "Berg" oCell.Group = "placement" oCell.GeometryType = GEOMETRYTYPE_Cell oCell.InitializeProperties "placing" ' --- Second the annotation sub-feature --- Dim oAnnotation As New xft.feature oAnnotation.Name = "BergText" oAnnotation.Alias = "BergText" oAnnotation.Group = "annotation" oAnnotation.GeometryType = GEOMETRYTYPE_Text ' Add Annotation to root feature before Annotation initializing properties oCell.AddSubFeature oAnnotation oAnnotation.InitializeProperties "placing" Dim oAnnotationOrigin As New xft.InputPoint oAnnotationOrigin.SetElementBasedType PointType_Range_CC, oCell Dim oAnnotationTextParams As New xft.TextParams oAnnotationTextParams.SetOrigin oAnnotationOrigin oAnnotation.SetTextParams oAnnotationTextParams '-------------------------------------------------------------- ' --- Third the annotation2 sub-feature --- Dim oAnnotation2 As New xft.feature oAnnotation2.Name = "BergZahl" oAnnotation2.Alias = "BergZahl" oAnnotation2.Group = "annotation" oAnnotation2.GeometryType = GEOMETRYTYPE_Text ' Add Annotation to root feature before Annotation initializing properties oCell.AddSubFeature oAnnotation2 oAnnotation2.InitializeProperties "placing" Dim oAnnotationOrigin2 As New xft.InputPoint oAnnotationOrigin2.SetElementBasedType PointType_Origin, oCell Dim oAnnotationTextParams2 As New xft.TextParams oAnnotationTextParams2.SetOrigin oAnnotationOrigin oAnnotation2.SetTextParams oAnnotationTextParams2
' --- set up the placement operation --- promptText = GetPromptText(leaderFeatureAlias, "MSGKEY_PointOrigin", DefaultPrompt_POINT_Origin) oCellOp.SetDataPointPrompt pointOpPromptTypeOriginPoint, promptText oCellOp.SetToolSettingsByOpAndName featureOps, toolSettingsName oCellOp.AddFeatureToGenerate oCell oCellOp.AddFeatureToGenerate oAnnotation oCellOp.AddFeatureToGenerate oAnnotation2
' --- start the placement --- xft.CmdMgr.StartPlacePointOperation oCellOp, New clsPlacePointOp
I am grateful for any tip.
Alex
I am working with OpenCities Map Advanced Connect Edition Update 7Version 10.07.01.09
Several of the developers were looking at this and offered the following (untested). Let us know if you can try it what the results are:
...look at InputPoint::AddOffset. Try annotation origins at top and bottom of cell range(PointType_Range_CT, PointType_Range_CB) and then offset from there.
Dim oAnnotationOrigin As New xft.InputPoint oAnnotationOrigin.SetElementBasedType PointType_Range_CT, oCell
Dim oInputValue As New InputValue
oInputValue.SetTypeAndValue ValueType_VALUE, "1.0"
oAnnotationOrigin.AddOffset pointOffsetType_Y, oInputValue
Answer Verified By: alxtbntl
Thank you very much for the help. It worked.
I have one more question. Now the annotations should be freely placeable, i.e. after the cell is set I want to place the annotations individually by cursor. What do I have to write instead of the definition of the Annotation.origin?
I asked our Development team what can be done and they offered this:
User would need to sequentially start a PlacePoint operation for each annotation to place individually by cursor. So in the IPlacementEvents_OnFinished for the cell placement, they could start the first annotation placement operation. See sub PlaceAnnotation in xfmStdOpsLib project module Library for example annotation placement. In the IPlacementEvents_OnFinished for the first annotation placement, they could start the second annotation placement operation. In the IPlacementEvents_OnFinished for the second annotation placement, write the root feature for the cell which would also write the two annotation sub-features.