Hello,
I have a layer with several text items (labels) set using point shapes (internal features). The DefaultTextStyle includes a mask around the text. We want each label visible, so overlapping is allowed. What we have noticed with the overlapping is that, while the mask of a label covers the mask of the label below it, the text of both labels show, making them unreadable. Is there a way for a for the text item and/or mask to block out any other items it might be on top of?
Attached is a shot of the text overlapping, and also the mask blocking out the mask below it.
Thanks,
Dib
Overlapping Text with Mask
Hi Dib,
Thanks for your post, would you please try fowlloing code:
DefaultTextStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping;
If the problem still exist, would you please upload the "shot"
if you have any more question , please feel free to let us know.
Best Regards
Summer
Summer,
I have used NoOverlapping, but we are not happy with the results, since we allow the user to move the labels around if they wish.
You can see how, on the left, the higher mask covers the border of the lower mask. On the right, however, the actual text shows through, and is unreadable.
Hi Dib,
Thanks for your further information, attached sample could provide a basic idea for the walkaround, would you please try it? if you have any more question , please feel free to let us know.
Best Regards
Summer
Post_11360.txt (2.72 KB)
Summer,
That is working more nicely, thanks.
Three more questions related to what we are doing:
1. The text at a point draws to the right of the point. Is there a way to have it draw to the left? Please keep in mind that this is being done in the EditOverlay layer, so that the points/text can be moved by the user, so it can only be done in a single layer. Didn’t know if there was any way to set that for a specific feature within the InternalFeatures.
2. Is there a way to get the points of the four corners of the mask surrounding the text. I want to draw a line connecting the closest point of the text, and the point it is referring to, but getting the BoundingBox of the feature, which is a pointshape, returns the box around the pointshape, not including the text.
3. While the labels move nicely with that code sample, the pointshapes they originate from do not. Is there a way to get them to move along with their text labels?
Thanks again,
Dib
Hi Dib
Thanks for your input, attached is the same code which could provide a basic idea on achieving these three functionalities, wouldyou please try it?
if you have any more question , please feel free to let us know.
Best Regards
Summer
Post_11360-2.txt (2.72 KB)
Summer,
Thanks for the info. I have it working pretty well now, but there is still one question I was hoping you could answer:
Is there a way to get the points of the four corners of the mask surrounding the text. I want to draw a line connecting the closest point of the text, and the point it is referring to, but getting the BoundingBox of the feature, which is a pointshape, returns the box around the pointshape, not including the text.
Thanks,
Dib
Hi Dib
Thanks for your query, attached sample should work, would you please try it?
if you have any more question , please feel free to let us know.
Best Regards
Summer
Post11360.txt (4.4 KB)
Ok, getting closer. I am saving off the labelingCandidates to work with, and using them to draw the lines. However, my point to connect them to is in lat/lon, i.e. -35 lon, 15 lat, and the LC points are much larger, where an X value can be something like 1057.3, and Y might be 401.5531. How can I translate the values to be on the same scale?
Hi Dib,
Actually the labelingCandidates are in screen coordinate rather world coodinate, you could use
PointShape lowerRightPoint = ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, (float)a[counter].ScreenArea.OuterRing.GetBoundingBox().UpperRightPoint.X, (float)a[counter].ScreenArea.OuterRing.GetBoundingBox().UpperRightPoint.Y, canvas.Width, canvas.Height);
In
“protected override void DrawCore()”
to get the LowerRightPoint of labelingCandiate’s world lowerRightPoint coordinate.
And using similar method to get upperleftPoint and so on.
Hope it helps
Summer