ThinkGeo.com    |     Documentation    |     Premium Support

Unable to place/display different features at same point

Hi,

I am trying to place the following features at same point… but unable to do it.
I am using TextStyle for adding the features using fontname having different features. I am differentiating each feature based on the value…

In different positions I can place it. Please help.

I am using following code to display features…
InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
layer.Open();
layer.Columns.Add(new FeatureSourceColumn(“Flight”));
layer.Close();

        InMemoryFeatureLayer layer2 = new InMemoryFeatureLayer();
        layer2.Open();
        layer2.Columns.Add(new FeatureSourceColumn("Background"));
        layer2.Close();

TextStyle ts = new TextStyle(“Flight”, new GeoFont(“Aircraft_b”, 48, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.FromArgb(255, 30, 144, 255)));
ts.RotationAngle = 300;
layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(ts);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

        Feature ft = new Feature(new PointShape(10, 10));
        
        ft.ColumnValues.Add("Flight", "A");
        layer.InternalFeatures.Add(ft);

        
        TextStyle ts2 = new TextStyle("Background", new GeoFont("Aircraft_b", 48, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.FromArgb(150, 255, 99, 71)));
        layer2.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(ts2);
        layer2.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

       
        Feature ft2 = new Feature(new PointShape(10, 10));
        ft2.ColumnValues.Add("Background", "D");
        layer2.InternalFeatures.Add(ft2);

LayerOverlay overlay = new LayerOverlay();

        overlay.Layers.Add("Layer", layer);
        overlay.Layers.Add("Layer2", layer2);

wfMap.Overlays.Add(“Overlay”, overlay);
wfMap.CurrentExtent = new RectangleShape(-180, 90, 180, -90);
wfMap.Refresh();

Thanks,
Ashok

Hi Ashok,

Do you want to place all the features level by level in same position, or you want to dynamic modify the point style for same point shape?

If you want to place all features in just same position, you should want to build many feature layers, which contains same point shape, and they have different styles.

If you want to dynamic modify the style with same point, you can reset the style and refresh the layer.

Regards,

Don

Hi don,

The above issue is working fine… But I am getting one problem that whenever zoomout, the features are merging into single and displayed as single feature.

please observe following snapshots.

With normal zoom level
1.

  1. If Zoom out

I applied DuplicateRule to Text style. Even though its not working.
ts.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels;

Please check the issue and solution for this ASAP

Thanks,
Ashok

Hi Ashok,

You should want to add this line:
ts.OverlappingRule = LabelOverlappingRule.AllowOverlapping;

Regards,
Don

Hi Don,

Thank you. Its working well now…

Cool!! Anything else please let us know.

Regards,
Johnny