Hi,
is there any way how to set up TextStyle Mask property, to mask out parts of underlying line shape as depicted on picture?
Thank you
Martin
Hi,
is there any way how to set up TextStyle Mask property, to mask out parts of underlying line shape as depicted on picture?
Thank you
Martin
Hi Martin,
With the latest beta version 14.0.0-beta002, you can accomplish something like following:
The general idea is to render it twice. First render the transparent mask using ColorMapping, then the label
It still shows the border of the mask
below is the code, the data streets.shp comes from the HowDoI sample.
… …
thinkGeoCloudVectorMapsOverlay.Opacity = 0.2d;
mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay);
// this layer draws the roads and transparent mask
ShapeFileFeatureLayer streetsLayer = new ShapeFileFeatureLayer(@"./Data/Shapefile/Streets.shp");
streetsLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);
var lineStyle = new LineStyle(new GeoPen(GeoBrushes.DimGray, 6), new GeoPen(GeoBrushes.WhiteSmoke, 4));
var textStyle = new TextStyle(“FULL_NAME”, new GeoFont(“Segoe UI”, 15, DrawingFontStyles.Regular), new GeoSolidBrush(GeoColors.Yellow))
{
SplineType = SplineType.StandardSplining,
DrawingLevel = DrawingLevel.LevelOne,
Mask = new AreaStyle(GeoBrushes.Red) { DrawingLevel = DrawingLevel.LevelFour } // set up a mask and set its Drawinglevel above the label
};
streetsLayer.ColorMappings.Add(GeoColors.Red, GeoColors.Transparent); // Use ColorMapping to convert the Mask to Transparent
streetsLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = lineStyle;
streetsLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = textStyle;
streetsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
// this layer draws the label
ShapeFileFeatureLayer streetsLayer2 = new ShapeFileFeatureLayer(@"./Data/Shapefile/Streets.shp");
streetsLayer2.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);
var textStyle2 = new TextStyle(“FULL_NAME”, new GeoFont(“Segoe UI”, 15, DrawingFontStyles.Regular), new GeoSolidBrush(GeoColors.Yellow))
{
SplineType = SplineType.StandardSplining,
};
streetsLayer2.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = textStyle2;
streetsLayer2.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
var layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(streetsLayer);
layerOverlay.Layers.Add(streetsLayer2);
Let me know if it doesn’t work for you.
Thanks,
Ben