Basically each asset can have up to 8 different layers and can be named different. The layers are pulled from a database column.
addLayer(asset, mapControl, layerName, GeoColor.SimpleColors.Blue); is called for each asset layer
public static void addLayer(Asset asset, Map mapControl, String layerName, GeoColor linePenColor)
{
String name = ConvertToLayerName(asset.AssetDescription, layerName);
// Define the line pen.
GeoPen linePen = new GeoPen(linePenColor, 4);
linePen.SetLineCap(DrawingLineCap.Round, DrawingLineCap.Round, GeoDashCap.Round);
// Define the outer pen
GeoPen outerPen = new GeoPen(GeoColor.StandardColors.Black, 6);
outerPen.SetLineCap(DrawingLineCap.Round, DrawingLineCap.Round, GeoDashCap.Round);
// Define the center pen.
GeoPen centerPen = new GeoPen(new GeoHatchBrush(GeoHatchStyle.Percent25, GeoColor.StandardColors.Black));
centerPen.SetLineCap(DrawingLineCap.Round, DrawingLineCap.Round, GeoDashCap.Round);
InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
layer.Name = name;
layer.ZoomLevelSet.ZoomLevel01.IsActive = true;
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
layer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(outerPen, linePen, centerPen);
LayerOverlay vehicleOverlay = new LayerOverlay(name);
vehicleOverlay.IsBaseOverlay = false;
vehicleOverlay.IsVisibleInOverlaySwitcher = true;
if (!mapControl.CustomOverlays.Contains(vehicleOverlay.Name))
{
mapControl.CustomOverlays.Add(vehicleOverlay);
}
if (!vehicleOverlay.Layers.Contains(layer.Name))
{
vehicleOverlay.Layers.Add(layer.Name, layer);
}
}
public static String ConvertToLayerName(String assetDescription, String layerName)
{
String name = assetDescription + " - " + layerName;
return name;
}
Once the layers are added all I do is add line segements to the internal features.
Nothing comes up on the map with the space in the layerName like stated in previous post.