Hello,
Is it possible to get a FittingLineInScreen added to the IconValueStyle that would work the same way as the TextStyle for line features? I’m adding highway shields to the roads in my app and often times users are zoomed in pretty tight to an area and without this feature the shield might not appear on the highway depending where the label point is in relation to the current extent. Thanks,
Chad
Fitting line in screen for IconValueStyle
I think I answered my own question. If you create a custom class that inherits from the IconValueStyle there is a protected property called FittingLineInScreen. If you set that to true then the icons will always appear. This does bring up something else though that I’ve seen previously. If you’re using Multiple tile type the icons will appear in every tile. I can set it to single tile type to fix it, but it would be nice to have the line layer match the other layers that are using multiple tiles. Thanks,
Chad
Hi Chad,
Great to hear that you figured it out, if you have any more question, please feel free to let us know.
Best Regards
Summer
Something else I’m seeing is if I adjust the X or Y offset of the TextStyle of a IconValueItem it moves both the icon and the icon label text. Is it possible to just move the text and have the icon stay put? Thanks,
Chad
Hi Chad,
Would you please override IconValueStyle.DrawCore() with following code:
DrawCore()
{
IEnumerable<IconValueItem> iconItems = IconValueItems.Where(item => feature.ColumnValues[columnName] == item.FieldValue);
foreach (IconValueItem item in iconItems)
{
PointStyle pointStyle = new PointStyle(item.GetIconImage());
pointStyle.PointType = PointType.Bitmap;
pointStyle.Draw(new Collection<Feature>() { feature }, canvas, labelsInThisLayer, labelsInAllLayers);
item.TextStyle.Draw(new Collection<Feature>() {feature}, canvas, labelsInThisLayer, labelsInAllLayers);
}
}
Hope it helps
Summer