public static void DeleteAllElementsByName(object object_0, string string_0) { if (object_0 is IScenePlugin) { IGraphicsContainer3D graphicsContainer3D = (object_0 as IScenePlugin).Scene.BasicGraphicsLayer as IGraphicsContainer3D; graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name.ToLower() == string_0.ToLower()) { graphicsContainer3D.DeleteElement(elementProperties as IElement); graphicsContainer3D.Reset(); } } if (graphicsContainer3D.ElementCount > 0) { if (string_0 == "") { graphicsContainer3D.DeleteAllElements(); } else { graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name.ToLower() == string_0.ToLower()) { graphicsContainer3D.DeleteElement(elementProperties as IElement); graphicsContainer3D.Reset(); } } } } } else if (object_0 is IGraphicsContainer3D) { IGraphicsContainer3D graphicsContainer3D = object_0 as IGraphicsContainer3D; if (graphicsContainer3D.ElementCount > 0) { if (string_0 == "") { graphicsContainer3D.DeleteAllElements(); } else { graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name.ToLower() == string_0.ToLower()) { graphicsContainer3D.DeleteElement(elementProperties as IElement); graphicsContainer3D.Reset(); } } } } } }
/// <summary> /// 处理要素数据,触发事件 /// </summary> /// <param name="pLayerName"></param> /// <param name="pFeature"></param> public void HandlerFeatureData(string pLayerName, IFeature pFeature) { //清空原有的图形选择 IGraphicsContainer3D graphicsContainer3D = (IGraphicsContainer3D)GISMapApplication.Instance.Scene.BasicGraphicsLayer; if (element != null) { graphicsContainer3D.DeleteElement(element); } object info = FeatureIdentity.GetFeatureInfo(pLayerName, pFeature); //给小区地图赋上名称 switch (pLayerName) { case LayerNames.GSM900Cell: case LayerNames.GSM1800Cell: { if (info is string) { AddCellNameOnMap(info.ToString(), pFeature.Shape); } break; } } if (FeatureClick != null) { FeatureClick(this, new FeatureClickEventArgs(pLayerName, info)); } }
public static void RemoveGroupElement(IGroupElement igroupElement_0, ISceneGraph isceneGraph_0) { if (igroupElement_0.ElementCount > 0) { igroupElement_0.ClearElements(); IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D; graphicsContainer3D.DeleteElement(igroupElement_0 as IElement); } }
/// <summary> /// 删除所有名称为name 的 element /// </summary> public static void DeleteElement(IGraphicsContainer3D pGC, string name) { IElement pElement = null; pElement = GetElementByName(pGC, name); while (pElement != null) { pGC.DeleteElement(pElement); pElement = GetElementByName(pGC, name); } }
/// <summary> /// 删除名称包含在names中的所有element /// </summary> public static void DeleteElement(IGraphicsContainer3D pGC, string[] names) { string name; for (int i = 0; i < names.Length; i++) { name = names[i]; IElement pElement = null; pElement = GetElementByName(pGC, name); while (pElement != null) { pGC.DeleteElement(pElement); pElement = GetElementByName(pGC, name); } } }
/// <summary> /// 删除指定名称的 Element 张琪 20110628 /// </summary> /// <param name="pScene"></param> /// <param name="sName"></param> public static void DeleteAllElementsWithName(IScene pScene, string sName) { IElement pElement; IGraphicsContainer3D pGCon3D = pScene.BasicGraphicsLayer as IGraphicsContainer3D; if (pGCon3D.ElementCount > 0) { pGCon3D.Reset(); pElement = pGCon3D.Next() as IElement; while (pElement != null) { IElementProperties pElemProps = pElement as IElementProperties; if (pElemProps.Name == sName) { pGCon3D.DeleteElement(pElement); pGCon3D.Reset(); } pElement = pGCon3D.Next() as IElement; } } }
public void RemoveElement(int index) { IGraphicsContainer3D graphicsContainer3D = _layer as IGraphicsContainer3D; graphicsContainer3D.DeleteElement(this[index]); }
public static void AddFlyByGraphic(ISceneGraph isceneGraph_0, IGeometry igeometry_0, FlyByUtils.FlyByElementType flyByElementType_0, System.Drawing.Color color_0, System.Drawing.Color color_1, System.Drawing.Color color_2, System.Drawing.Color color_3, bool bool_0) { if (!igeometry_0.IsEmpty) { IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D; if (!FlyByUtils.LayerIsExist(isceneGraph_0.Scene, graphicsContainer3D as ILayer)) { isceneGraph_0.Scene.AddLayer(graphicsContainer3D as ILayer, true); } switch (flyByElementType_0) { case FlyByUtils.FlyByElementType.FLYBY_PATH: if (FlyByUtils.pPathElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem); } break; case FlyByUtils.FlyByElementType.FLYBY_OBSERVER: if (FlyByUtils.pObserverElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem); } break; case FlyByUtils.FlyByElementType.FLYBY_TARGET: if (FlyByUtils.pTargetElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem); } break; } ISymbol flyBySymbol = FlyByUtils.GetFlyBySymbol(color_0, color_1, color_2, color_3, flyByElementType_0); IElement element; switch (igeometry_0.GeometryType) { case esriGeometryType.esriGeometryPoint: { element = new MarkerElement(); IMarkerElement markerElement = element as IMarkerElement; markerElement.Symbol = (flyBySymbol as IMarkerSymbol); break; } case esriGeometryType.esriGeometryMultipoint: return; case esriGeometryType.esriGeometryPolyline: { element = new LineElement(); ILineElement lineElement = element as ILineElement; lineElement.Symbol = (flyBySymbol as ILineSymbol); break; } default: return; } switch (flyByElementType_0) { case FlyByUtils.FlyByElementType.FLYBY_ANCHORS: { IElementProperties elementProperties = element as IElementProperties; elementProperties.Name = "SceneFlyBy.AnchorPoint"; break; } case FlyByUtils.FlyByElementType.FLYBY_PATH: FlyByUtils.pPathElem = element; break; case FlyByUtils.FlyByElementType.FLYBY_OBSERVER: FlyByUtils.pObserverElem = element; break; case FlyByUtils.FlyByElementType.FLYBY_TARGET: FlyByUtils.pTargetElem = element; break; case FlyByUtils.FlyByElementType.FLYBY_STATIC: { IElementProperties elementProperties = element as IElementProperties; elementProperties.Name = "SceneFlyBy.StaticLoc"; break; } } element.Geometry = igeometry_0; graphicsContainer3D.AddElement(element); if (bool_0) { isceneGraph_0.RefreshViewers(); } } }
public static void DeleteFlyByElement(ISceneGraph isceneGraph_0, FlyByUtils.FlyByElementType flyByElementType_0, bool bool_0) { IGraphicsLayer basicGraphicsLayer = isceneGraph_0.Scene.BasicGraphicsLayer; IGraphicsContainer3D graphicsContainer3D = basicGraphicsLayer as IGraphicsContainer3D; switch (flyByElementType_0) { case FlyByUtils.FlyByElementType.FLYBY_PATH: if (FlyByUtils.pPathElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem); } break; case FlyByUtils.FlyByElementType.FLYBY_OBSERVER: if (FlyByUtils.pObserverElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem); } break; case FlyByUtils.FlyByElementType.FLYBY_TARGET: if (FlyByUtils.pTargetElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem); } break; case FlyByUtils.FlyByElementType.FLYBY_STATIC: graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name == "SceneFlyBy.StaticLoc") { graphicsContainer3D.DeleteElement(elementProperties as IElement); break; } } break; case FlyByUtils.FlyByElementType.FLYBY_BACKDROP: graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name == "_BACKDROP_") { graphicsContainer3D.DeleteElement(elementProperties as IElement); break; } } break; case FlyByUtils.FlyByElementType.FLYBY_ALL: if (FlyByUtils.pPathElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem); } if (FlyByUtils.pObserverElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem); } if (FlyByUtils.pTargetElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem); } graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name == "_BACKDROP_" || elementProperties.Name == "SceneFlyBy.AnchorPoint" || elementProperties.Name == "SceneFlyBy.StaticLoc") { graphicsContainer3D.DeleteElement(elementProperties as IElement); graphicsContainer3D.Reset(); } } break; } if (bool_0) { isceneGraph_0.RefreshViewers(); } }