/// <summary> /// 移除线图元 /// </summary> /// <param name="element">要移除的线图元</param> /// <param name="layer">图元所在的图层</param> /// <returns></returns> public bool RemoveElement(IMFElement element, ILayer layer) { GlobeGraphicsLayerClass graphicLayer = layer as GlobeGraphicsLayerClass; if (graphicLayer == null) { return(false); } Line_ArcGlobe line = element as Line_ArcGlobe; if (line == null) { return(false); } if (line.Rasterize) //判断图元是否栅格化,栅格化之后删不掉图元,所以要先不栅格化 { line.Rasterize = false; } Dosomething((Action) delegate() { graphicLayer.DeleteElement(line);//删除线图元 }, true); return(true); }
public void ConstructLayer(string name) { IGlobeGraphicsLayer globeGraphicsLayer = new GlobeGraphicsLayerClass(); ILayer layer = globeGraphicsLayer as ILayer; layer.Name = name; _scene.AddLayer(layer, true); }
public void AddNewGraphicsLayer() { // 创建graphics layer 并添加到控件上 IGraphicsContainer globeGraphicsLayer = new GlobeGraphicsLayerClass(); ILayer layer = (ILayer)globeGraphicsLayer; layer.Name = "Add mine layer"; axMapControl.AddLayer(layer); int index = GetIndexNumberFromLayerName(axMapControl.ActiveView, layer.Name.ToString()); }
/// <summary> /// 添加图层 /// </summary> /// <param name="layerName"></param> public bool AddLayer(string layerName) { lock (layerDic) { if (layerDic.ContainsKey(layerName)) { return(false); } ILayer graphcisLayer = null; Dosomething((Action) delegate() { graphcisLayer = new GlobeGraphicsLayerClass(); graphcisLayer.Name = layerName; globeControl.Globe.AddLayerType(graphcisLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped); }, true); layerDic.Add(layerName, graphcisLayer); return(true); } }