public static TextStyleBuilder GetDefaultTextStyle() { var textStyleBuilder = new TextStyleBuilder(); textStyleBuilder.Color = new Carto.Graphics.Color(255, 0, 0, 255); textStyleBuilder.OrientationMode = BillboardOrientation.BillboardOrientationFaceCamera; return(textStyleBuilder); }
public static void AddText2(LocalVectorDataSource source, Projection projection) { TextStyleBuilder builder = new TextStyleBuilder(); builder.OrientationMode = BillboardOrientation.BillboardOrientationFaceCamera; MapPos position = projection.FromWgs84(new MapPos(24.633216, 59.426869)); Text popup = new Text(position, builder.BuildStyle(), "Face camera ground text"); popup.SetMetaDataElement("ClickText", new Variant("Text nr 2")); source.Add(popup); }
public static void AddText3(LocalVectorDataSource source, Projection projection) { TextStyleBuilder builder = new TextStyleBuilder(); builder.FontSize = 22; builder.OrientationMode = BillboardOrientation.BillboardOrientationGround; MapPos position = projection.FromWgs84(new MapPos(24.646457, 59.420839)); Text popup = new Text(position, builder.BuildStyle(), "Ground text"); popup.SetMetaDataElement("ClickText", new Variant("Text nr 3")); source.Add(popup); }
public static void AddText1(LocalVectorDataSource source, Projection projection) { // Create text style TextStyleBuilder builder = new TextStyleBuilder(); builder.Color = new Color(255, 0, 0, 255); // Red builder.OrientationMode = BillboardOrientation.BillboardOrientationFaceCamera; // This enables higher resolution texts for retina devices, but consumes more memory and is slower builder.ScaleWithDPI = false; // Add text MapPos position = projection.FromWgs84(new MapPos(24.653302, 59.422269)); Text popup = new Text(position, builder.BuildStyle(), "Face camera text"); popup.SetMetaDataElement("ClickText", new Variant("Text nr 1")); source.Add(popup); }
public static async void AddMarkerToPosition(this MapView map, MapPos position) { await ThreadPool.RunAsync(delegate { // Initialize a local vector data source Projection projection = map.Options.BaseProjection; LocalVectorDataSource datasource = new LocalVectorDataSource(projection); // Initialize a vector layer with the previous data source VectorLayer layer = new VectorLayer(datasource); // Add layer to map map.Layers.Add(layer); MarkerStyleBuilder builder = new MarkerStyleBuilder(); builder.Size = 20; builder.Color = new Carto.Graphics.Color(0, 255, 0, 255); MarkerStyle style = builder.BuildStyle(); // Create marker and add it to the source Marker marker = new Marker(position, style); // Add text element to same location TextStyleBuilder MyStyleBuilder = new TextStyleBuilder { OrientationMode = BillboardOrientation.BillboardOrientationGround, FontSize = 12.0f, CausesOverlap = false, Color = new Carto.Graphics.Color(255, 0, 0, 255), ScalingMode = BillboardScaling.BillboardScalingWorldSize, Flippable = false, HideIfOverlapped = false, RenderScale = 8.0f }; Text text = new Text(position, MyStyleBuilder.BuildStyle(), "TEXT"); datasource.Add(marker); datasource.Add(text); }); }