protected override async void OnClick() { if (MapView.Active == null) { return; } // find a 3d symbol var spi = Project.Current.GetItems <StyleProjectItem>().First(s => s.Name == "ArcGIS 3D"); if (spi == null) { return; } bool result = await QueuedTask.Run(() => { var style_item = spi.SearchSymbols(StyleItemType.MeshSymbol, "").FirstOrDefault(si => si.Key == "White (use textures) with Edges_Material Color_12"); var symbol = style_item?.Symbol as CIMMeshSymbol; if (symbol == null) { return(false); } // get the multipatch shape var origMultipatch = MyMultipatchBuilder.CreateTriangleMultipatchGeometry(); // move it in the z direction var newMultipatch = GeometryEngine.Instance.Move(origMultipatch, 0, 0, 10) as Multipatch; CIMMultiPatchGraphic graphic = new CIMMultiPatchGraphic() { MultiPatch = newMultipatch, Symbol = symbol.MakeSymbolReference() }; MapView.Active.AddOverlay(graphic); // or just use // MapView.Active.AddOverlay(newMultipatch, symbol.MakeSymbolReference()); return(true); }); }
internal static void UpdateOverlay(Multipatch multiPatch) { if (_symRef == null) { _symRef = GetDefaultMeshSymbolAsync().Result; } MultiPatch = multiPatch; var multiPatchGraphic = new CIMMultiPatchGraphic() { MultiPatch = multiPatch, Symbol = _symRef }; if (_screenGraphic != null) { _screenGraphic.Dispose(); } _screenGraphic = MapView.Active.AddOverlay(multiPatchGraphic); }
internal static void AddOverlay(Geometry geom, CIMSymbolReference symRef) { var mapView = MapView.Active; if (mapView == null) { return; } if (geom is Multipatch) { var cimMpGraphic = new CIMMultiPatchGraphic { MultiPatch = geom as Multipatch, Symbol = symRef, Transparency = 64 }; _graphics.Add(mapView.AddOverlay(cimMpGraphic)); } else { _graphics.Add(mapView.AddOverlay(geom, symRef)); } }
internal static void AddOrUpdateOverlay(Geometry geom, CIMSymbolReference symRef) { var mapView = Module1.CurrentMapView; if (mapView == null) { return; } ClearGraphics(mapView); if (!_graphic.ContainsKey(mapView)) { _graphic.Add(mapView, mapView.AddOverlay(geom, symRef)); return; } if (_graphic[mapView] == null) { if (geom is Multipatch) { var cimMpGraphic = new CIMMultiPatchGraphic { MultiPatch = geom as Multipatch, Symbol = symRef, Transparency = 64 }; _graphic[mapView] = mapView.AddOverlay(geom, symRef); } else { _graphic[mapView] = mapView.AddOverlay(geom, symRef); } } else { mapView.UpdateOverlay(_graphic[mapView], geom, symRef); } }