/// <summary> /// 隐藏 /// </summary> /// <param name="isVisible"></param> public void SetVisible(bool isVisible) { if (this.isVisible == isVisible) { return; } ILayer layer = mapFactory.GetLayerByName(this.BelongLayer.LayerName); CompositeGraphicsLayerClass graphLayer = layer as CompositeGraphicsLayerClass; if (graphLayer == null) { return; } Dosomething((Action)(delegate { if (isVisible)//显示 { graphLayer.AddElement(this, 1); } else { graphLayer.DeleteElement(this); } Update(); }), true); this.isVisible = isVisible; }
/// <summary> /// 显示隐藏 /// </summary> /// <param name="isVisible"></param> public void SetVisible(bool isVisible) { if (this.isVisible == isVisible) { return; } ILayer layer = factoryArcMap.GetLayerByName(belongLayer.LayerName); CompositeGraphicsLayerClass graphLayer = layer as CompositeGraphicsLayerClass; this.isVisible = isVisible; if (isVisible)//显示 { this.Dosomething((Action) delegate() { graphLayer.AddElement(this, 1); }, true); } else { this.Dosomething((Action) delegate() { graphLayer.DeleteElement(this); }, true); } Update(); this.isVisible = isVisible; }
/// <summary> /// 移除图元 /// </summary> /// <param name="element">要移除的圆图元</param> /// <param name="layer">图元的所在图层</param> /// <returns></returns> public bool RemoveElement(Core.Interface.IMFElement element, ILayer layer) { if (element == null) { return(true); } CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass; if (graphicLayer == null) { return(true); } CircleElementClass circleElement = element as CircleElementClass; graphicLayer.DeleteElement(circleElement); return(true); }
/// <summary> /// 移除图元 /// </summary> /// <param name="element">要移除的图元</param> /// <param name="layer">图元所在的图层</param> /// <returns></returns> public bool RemoveElement(Core.Interface.IElement element, ESRI.ArcGIS.Carto.ILayer layer) { if (element == null) { return(true); } CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass; if (graphicLayer == null) { return(true); } PictureElementClass pictureElement = element as PictureElementClass; graphicLayer.DeleteElement(pictureElement); return(true); }
/// <summary> /// 显示隐藏 /// </summary> /// <param name="isVisible"></param> public void SetVisible(bool isVisible) { if (this.isVisible == isVisible) { return; } ILayer layer = mapFactory.GetLayerByName(belongLayer.LayerName); CompositeGraphicsLayerClass graphLayer = layer as CompositeGraphicsLayerClass; this.isVisible = isVisible; if (isVisible)//显示 { graphLayer.AddElement(this, 1); } else { graphLayer.DeleteElement(this); } Update(); }
/// <summary> /// 删除图元 /// </summary> /// <param name="element">要移除的线图元</param> /// <param name="layer">图元所在的图层</param> /// <returns></returns> public bool RemoveElement(Core.Interface.IMFElement element, ILayer layer) { CompositeGraphicsLayerClass graphicLayer = layer as CompositeGraphicsLayerClass; if (graphicLayer == null) { return(false); } Line_ArcMap line = element as Line_ArcMap; if (line == null) { return(false); } graphicLayer.DeleteElement(line);//删除线图元 return(true); }