Hi Savy,
There are a coup of ways to accomplish the 1# and 3# questions. But first you need some definitions on each state to identify the region, and have an “offset table” for each region.
Then Create a OffsetInmemoryLayer inherent from InmemoryFeatureLayer .
public class OffsetInmemoryLayer : InMemoryFeatureLayer
{
private double xOffset = 0;
private double yOffset = 0;
private GeoCollection<Feature> originalFeatures = null ;
public OffsetInmemoryLayer(double xOffset, double yOffset)
{
this.xOffset = xOffset;
this.yOffset = yOffset;
originalFeatures = new GeoCollection<Feature>();
}
protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)
{
originalFeatures.Clear();
foreach (Feature feature in InternalFeatures)
{
originalFeatures.Add(feature);
}
InternalFeatures.Clear();
foreach (Feature feature in originalFeatures)
{
// TODO do the offset here
InternalFeatures.Add(feature);
}
base.DrawCore(canvas, labelsInAllLayers);
}
}
I have an idea for the 2# question, but the logic may be a little bit complicate.
You can create your own TextStyle inherents from TextStyle and overwrite the DrawCore method. In the override method, calculate the Area of the Text to see it is out of the state or not. If it is then try to make it smaller. if it is still out of the state, add some offsets on the label and draw a line or arrow point to it.
Thanks,
Lee