public void Init() { try { this.cmbLayer.Properties.Items.Clear(); List <DF3DFeatureClass> list = DF3DFeatureClassManager.Instance.GetAllFeatureClass(); if (list != null) { foreach (DF3DFeatureClass dffc in list) { FacilityClass fac = dffc.GetFacilityClass(); if (fac != null && (fac.Name == "PipeLine" || fac.Name == "PipeNode" || fac.Name == "PipeBuild" || fac.Name == "PipeBuild1")) { break; } IBaseLayer treelayer = dffc.GetTreeLayer(); if (treelayer != null && treelayer.Visible == false) { continue; } this.cmbLayer.Properties.Items.Add(dffc); } } } catch (Exception ex) { } }
private void FrmNormalConditionQuery_Load(object sender, EventArgs e) { try { this.cmbLayer.Properties.Items.Clear(); this.lbcCondition.SelectedIndex = 0; oper = " = "; List <DF3DFeatureClass> list = DF3DFeatureClassManager.Instance.GetAllFeatureClass(); if (list != null) { foreach (DF3DFeatureClass dffc in list) { FacilityClass fac = dffc.GetFacilityClass(); if (fac != null && (fac.Name == "PipeLine" || fac.Name == "PipeNode" || fac.Name == "PipeBuild" || fac.Name == "PipeBuild1")) { break; } IBaseLayer treelayer = dffc.GetTreeLayer(); if (treelayer != null && treelayer.Visible == false) { continue; } this.cmbLayer.Properties.Items.Add(dffc); } } } catch (Exception ex) { } }
private void Layer3DTreePad_OnLayerDoubleClick(IBaseLayer layer) { if (layer is DF3DData.Tree.ICamera) { (layer as DF3DData.Tree.ICamera).FlyTo(); } }
public override void Run(object sender, System.EventArgs e) { try { DF3DApplication app = (DF3DApplication)this.Hook; if (app == null || app.Workbench == null) { return; } app.Workbench.BarPerformClick("CancelSelection"); ComboBoxEdit cbEdit = sender as ComboBoxEdit; CboItem item = cbEdit.SelectedItem as CboItem; CommonUtils.Instance().SetCurEditLayer(item == null ? null : item.Value); app.Workbench.UpdateMenu(); if (item != null && item.Value != null) { IBaseLayer layer = item.Value.GetTreeLayer(); if (layer != null) { layer.Visible = true; } else { IFeatureLayer fl = item.Value.GetFeatureLayer(); if (fl != null) { fl.VisibleMask = gviViewportMask.gviViewAllNormalView; } } } } catch (Exception ex) { } }
private void SetBaseLayer(IBaseLayer baseLayer) { if (_baseLayerViewer != null) { _baseLayerViewer.Enabled = baseLayer != null; _baseLayerViewer.SetBaseLayer(baseLayer); } }
private void SetBaseLayer(IBaseLayer baseLayer) { if (_baseLayerViewer != null) { _baseLayerViewer.Enabled = baseLayer != null; _baseLayerViewer.SetBaseLayer(baseLayer); } }
private void Initialize() { _registeredBaseLayers = new List<IBaseLayer>(); IBaseLayer v_emptyBaseLayer = new EmptyBaseLayer(); _registeredBaseLayers.Add(v_emptyBaseLayer); _registeredBaseLayers.Add(new ZXYBaseLayer("http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png", "OSM (Mapnik)", true, true)); BaseLayers = _registeredBaseLayers; _baseLayer = v_emptyBaseLayer; }
private void Initialize() { _registeredBaseLayers = new List <IBaseLayer>(); IBaseLayer v_emptyBaseLayer = new EmptyBaseLayer(); _registeredBaseLayers.Add(v_emptyBaseLayer); _registeredBaseLayers.Add(new ZXYBaseLayer("http://{c}.tile.openstreetmap.org/{z}/{x}/{y}.png", "OSM (Mapnik)", true, true)); BaseLayers = _registeredBaseLayers; _baseLayer = v_emptyBaseLayer; }
private void logicBaseTree1_OnHitTest(MouseButtons button, int x, int y, IBaseLayer layer) { if (layer is TreeNodeFacilityClass) { TreeNodeFacilityClass tn = layer as TreeNodeFacilityClass; if (layer.CustomValue is FacilityClass) { this.ucFieldManage1.SetData(layer.CustomValue as FacilityClass); } } }
public virtual void Add(IBaseLayer layer) { if (layer != null) { this.Add2(layer); if (base.LogicTree != null) { base.LogicTree.ExportXML(null); } } }
public override void Run(object sender, System.EventArgs e) { try { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } //Terrain地形 Layer3DTreePad pad = UCService.GetContent(typeof(Layer3DTreePad)) as Layer3DTreePad; if (pad != null) { List <IBaseLayer> list1 = pad.GetRootLayers(); if (list1 != null) { foreach (IBaseLayer layer in list1) { if (layer is TreeNodeTerrain) { layer.Visible = true; break; } } } } else { if (app.Current3DMapControl.Terrain != null && app.Current3DMapControl.Terrain.IsRegistered) { app.Current3DMapControl.Terrain.VisibleMask = gviViewportMask.gviViewAllNormalView; } } //地形模型 List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName("DX3DMODEL"); if (list != null) { foreach (DF3DFeatureClass dffc in list) { IBaseLayer bl = dffc.GetTreeLayer(); if (bl != null) { bl.Visible = true; } } } app.Workbench.UpdateMenu(); } catch (Exception ex) { } }
private void RecurSaveData(TreeNodeLogicGroup parentLayer, XmlDocument document, XmlNode parentNode) { if (parentLayer == null || parentNode == null) { return; } for (int i = 0; i < parentLayer.GetLayerCount(); i++) { IBaseLayer layer = parentLayer.GetLayerByIndex(i); if (!(layer is TreeNodeLogicGroup) && !(layer is TreeNodeMajorClass)) { continue; } if (layer is TreeNodeLogicGroup) { TreeNodeLogicGroup treenode = layer as TreeNodeLogicGroup; if (!(treenode.CustomValue is LogicGroup)) { continue; } LogicGroup lg = treenode.CustomValue as LogicGroup; XmlElement element = document.CreateElement("LogicGroup"); element.SetAttribute("name", lg.Name); element.SetAttribute("alias", lg.Alias); XmlNode lgNode = parentNode.AppendChild(element); RecurSaveData(treenode, document, lgNode); } if (layer is TreeNodeMajorClass) { TreeNodeMajorClass treenode = layer as TreeNodeMajorClass; if (treenode.CustomValue is MajorClass) { MajorClass mc = treenode.CustomValue as MajorClass; XmlElement element = document.CreateElement("MajorClass"); element.SetAttribute("name", mc.Name); element.SetAttribute("alias", mc.Alias); element.SetAttribute("classifyfield", mc.ClassifyField); element.SetAttribute("fc2D", mc.Fc2D); element.SetAttribute("fc3D", mc.Fc3D); XmlNode mcNode = parentNode.AppendChild(element); foreach (SubClass sc in mc.SubClasses) { XmlElement ele1 = document.CreateElement("SubClass"); ele1.SetAttribute("name", sc.Name); ele1.SetAttribute("groupid", sc.GroupId.ToString()); mcNode.AppendChild(ele1); } } } } }
void IBaseLayerViewer.SetBaseLayer(IBaseLayer baseLayer) { if (baseLayer == null) { return; } else if (_baseLayer == null || _baseLayer.Name != baseLayer.Name) { _baseLayer = baseLayer; if (_IBaseLayerViewer.Enabled) { this.Reload(); } } }
private void LayerCheckOnOffControl(IBaseLayer layer) { if (layer is TreeNodeComLayer) { TreeNodeComLayer node = layer as TreeNodeComLayer; node.CheckOn = node.Visible; List <IBaseLayer> childNodes = node.SelectAllSubLayers(); if (childNodes.Count > 0) { foreach (IBaseLayer cn in childNodes) { LayerCheckOnOffControl(cn); } } } else if (layer is TreeNodeLogicGroup2D) { TreeNodeLogicGroup2D lg = layer as TreeNodeLogicGroup2D; List <IBaseLayer> listBL = lg.SelectAllSubLayers(); if (listBL.Count > 0) { foreach (IBaseLayer bl in listBL) { LayerCheckOnOffControl(bl); } } } else if (layer is TreeNodeMajorClass2D) { TreeNodeMajorClass2D node = layer as TreeNodeMajorClass2D; node.CheckOn = node.Visible; List <IBaseLayer> childNodes = node.SelectAllSubLayers(); if (childNodes.Count > 0) { foreach (IBaseLayer cn in childNodes) { LayerCheckOnOffControl(cn); } } } else if (layer is TreeNodeSubClass2D) { TreeNodeSubClass2D node = layer as TreeNodeSubClass2D; node.CheckOn = node.Visible; } }
public override void Run(object sender, System.EventArgs e) { try { if (DF3DApplication.Application == null || DF3DApplication.Application.Current3DMapControl == null) { return; } d3 = DF3DApplication.Application.Current3DMapControl; if (!d3.Terrain.IsRegistered) { return; } Map3DCommandManager.Push(this); d3.Terrain.DemAvailable = true; DF3DApplication.Application.Workbench.UpdateMenu(); List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName("DX3DMODEL"); if (list != null) { dict = new Dictionary <IBaseLayer, bool>(); foreach (DF3DFeatureClass dffc in list) { IBaseLayer bl = dffc.GetTreeLayer(); dict[bl] = bl.Visible; if (bl != null) { bl.Visible = false; } } } this._uPanel = new UIDockPanel("开挖分析", "开挖分析", this.Location, this._width, this._height); this._dockPanel = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right); this._dockPanel.Visibility = DockVisibility.Visible; this._dockPanel.FloatSize = new System.Drawing.Size(this._width, this._height); this._dockPanel.Width = this._width; this._dockPanel.Height = this._height; this._uc = new UCEarthworkCalculation(); this._uc.Dock = System.Windows.Forms.DockStyle.Fill; this._uPanel.RegisterEvent(new PanelClose(this.Close)); this._dockPanel.Controls.Add(this._uc); } catch (Exception ex) { LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace); } }
private void SetMutex() { lock (this.lockOb) { if ((this._isMutexLayer && this._visible) && (this.Parent != null)) { IBaseLayer layerByIndex = null; int layerCount = this.Parent.GetLayerCount(); for (int i = 0; i < layerCount; i++) { layerByIndex = this.Parent.GetLayerByIndex(i); if ((!this.ID.Equals(layerByIndex.ID) && layerByIndex.IsMutexLayer) && layerByIndex.Visible) { layerByIndex.Visible = false; } } } } }
public virtual IBaseLayer OpenLayer(string dataPath) { IBaseLayer baseLayer = null; Dataset dataset = OpenDataset(dataPath); if (dataset != null) { baseLayer = new RasterLayer(dataset); } else { DataSource dataSource = OpenDataSource(dataPath); if (dataSource != null) { if (dataSource.GetLayerCount() > 0) { wkbGeometryType wkbGeometryType = wkbGeometryType.wkbNone; using (Layer layer = dataSource.GetLayerByIndex(0)) { wkbGeometryType = layer.GetGeomType(); } switch (wkbGeometryType) { case wkbGeometryType.wkbPoint: baseLayer = new PointLayer(dataSource); break; case wkbGeometryType.wkbLineString: baseLayer = new LineLayer(dataSource); break; case wkbGeometryType.wkbPolygon: baseLayer = new PolygonLayer(dataSource); break; } } } } return(baseLayer); }
public override void Run(object sender, System.EventArgs e) { if (DF3DApplication.Application == null || DF3DApplication.Application.Current3DMapControl == null) { return; } d3 = DF3DApplication.Application.Current3DMapControl; if (!d3.Terrain.IsRegistered) { return; } Map3DCommandManager.Push(this); d3.Terrain.DemAvailable = true; DF3DApplication.Application.Workbench.UpdateMenu(); List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName("DX3DMODEL"); if (list != null) { dict = new Dictionary <IBaseLayer, bool>(); foreach (DF3DFeatureClass dffc in list) { IBaseLayer bl = dffc.GetTreeLayer(); dict[bl] = bl.Visible; if (bl != null) { bl.Visible = false; } } } DF3DApplication.Application.Workbench.SetStatusInfo("请绘制挖洞区域"); this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Polygon); if (this._drawTool != null) { this._drawTool.OnStartDraw += new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Start(); } }
public void Add(IBaseLayer layer, int index) { if (layer != null) { if (this._layerMap.ContainsKey(layer.ID)) { XtraMessageBox.Show(StringParser.Parse("${res:TipText_该图层已经存在}")); } else { TreeListNode node = base._ownNode.TreeList.AppendNode(new object[] { layer.Name }, base._ownNode); if (node != null) { if (index < this.GetLayerCount()) { base.OwnNode.TreeList.SetNodeIndex(node, index); } layer.OwnNode = node; layer.Parent = this; node.Checked = layer.Visible; this._layerMap.Add(layer.ID, layer); layer.LogicTree = base.LogicTree; this.Expanded = false; } else { XtraMessageBox.Show("图层创建失败", "提示"); return; } layer.Activate(); this._childLayer.Add(layer); if (base.LogicTree != null) { base.LogicTree.ExportXML(null); } } } }
private void logicBaseTree1_OnHitTest(MouseButtons button, int x, int y, IBaseLayer layer) { currentLayer = layer; if (layer is TreeNodeLogicGroup && layer.CustomValue is LogicGroup) { LogicGroup lg = layer.CustomValue as LogicGroup; this.teName.Text = lg.Name; this.teAlias.Text = lg.Alias; this.layoutControlItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } else if (layer is TreeNodeMajorClass && layer.CustomValue is MajorClass) { MajorClass mc = layer.CustomValue as MajorClass; this.teName.Text = mc.Name; this.teAlias.Text = mc.Alias; this.teClassifyField.Text = mc.ClassifyField; this.layoutControlItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; this.layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; this.layoutControlItem6.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } }
public virtual void Delete(IBaseLayer layer) { if (layer != null) { if (!this._layerMap.ContainsKey(layer.ID)) { XtraMessageBox.Show(StringParser.Parse("${res:TipText_不存在该图层}")); } else { if ((base.OwnNode != null) && (layer.OwnNode != null)) { base.OwnNode.Nodes.Remove(layer.OwnNode); if (base.LogicTree != null) { base.LogicTree.ExportXML(null); } } this._layerMap.Remove(layer.ID); this._childLayer.Remove(layer); } } }
private void WriteXML(TreeListNode node, XmlWriter xw) { IBaseLayer tag = null; if (node.Tag != null) { tag = node.Tag as IBaseLayer; if (tag != null) { xw.WriteStartElement(tag.GetType().Name); xw.WriteAttributeString("Name", tag.Name); xw.WriteAttributeString("Guid", tag.ID); if (node.Nodes.Count > 0) { foreach (TreeListNode node2 in node.Nodes) { this.WriteXML(node2, xw); } } xw.WriteEndElement(); } } }
public virtual void Add2(IBaseLayer layer) { if (layer != null) { if (this.ExistLayer(layer.ID)) { throw new Exception(StringParser.Parse("${res:TipText_该图层已存在}")); } TreeListNode node = base._ownNode.TreeList.AppendNode(new object[] { layer.Name, layer }, base._ownNode); if (node == null) { throw new Exception("图层创建失败"); } layer.OwnNode = node; layer.Parent = this; node.Checked = layer.Visible; this._layerMap.Add(layer.ID, layer); layer.LogicTree = base.LogicTree; layer.CustomValue = layer.CustomValue; layer.Activate(); this._childLayer.Add(layer); } }
public void SetTreeLayer(IBaseLayer bl) { this.treeLayer = bl; }
void IBaseLayerViewer.SetBaseLayer(IBaseLayer baseLayer) { if (baseLayer == null) return; else if (_baseLayer == null || _baseLayer.Name != baseLayer.Name) { _baseLayer = baseLayer; if (_IBaseLayerViewer.Enabled) { this.Reload(); } } }
public GeoBitmap DownloadTile(int zoom, int x, int y, IBaseLayer baseLayer) { Uri uri = new Uri(baseLayer.GetTileUrl(zoom, x, y)); GeoBitmap geoBmp = new GeoBitmap() { OriginUri = uri.ToString() }; try { TileIndex index = new TileIndex(x, y, zoom); Bitmap tileImg = null; tileImg = GetTileFromCache(index, baseLayer.Name); if (tileImg != null) { geoBmp.Origin = TileOrigin.Memory; } else { tileImg = GetTileFromDisc(index, baseLayer.Name); if (tileImg != null) { geoBmp.Origin = TileOrigin.Disk; SaveTileToCache(tileImg, index, baseLayer.Name); } } if (tileImg == null) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Timeout = 500; request.UserAgent = USER_AGENT; //IWebProxy webProxy = WebRequest.DefaultWebProxy; //webProxy.Credentials = CredentialCache.DefaultNetworkCredentials; //request.Proxy = webProxy; try { using (WebResponse response = request.GetResponse()) using (Stream stream = response.GetResponseStream()) { tileImg = (Bitmap)Bitmap.FromStream(stream); } } catch (WebException webEx) { Trace.TraceWarning("Unable to download image at " + uri.ToString() + ": " + webEx.Message); tileImg = new Bitmap(256, 256); using (Graphics g = Graphics.FromImage(tileImg)) { g.Clear(Color.LightGray); g.DrawRectangle(Pens.Red, 0, 0, 255, 255); g.DrawLine(Pens.Red, 1, 1, 255, 255); } geoBmp.Exception = webEx; } finally { geoBmp.Origin = TileOrigin.Download; if (geoBmp.Exception == null) { SaveTileToDisc(tileImg, index, baseLayer.Name); SaveTileToCache(tileImg, index, baseLayer.Name); } } } geoBmp.Bitmap = tileImg; // what are X,Y coords for images int xPos, yPos = 0; double lat, lon = 0; double lat2, lon2 = 0; BingMapsTileSystem.TileXYToPixelXY(x, y, out xPos, out yPos); BingMapsTileSystem.PixelXYToLatLong(xPos, yPos, zoom, out lat, out lon); BingMapsTileSystem.PixelXYToLatLong(xPos + 256, yPos + 256, zoom, out lat2, out lon2); geoBmp.BBox = new BoundingBox(lon, lon2, lat2, lat); geoBmp.Index = new TileIndex(x, y, zoom); } catch (Exception ex) { geoBmp.Exception = ex; Trace.TraceWarning("Unable to load base layer at " + uri.ToString() + ": " + ex.Message); } return geoBmp; }
private void Layer2DTreePad_OnLayerCheckedStateChangedByMouseClick(IBaseLayer layer) { LayerCheckOnOffControl(layer); }
private void logicBaseTree1_OnLayerDoubleClick(IBaseLayer layer) { }
public GeoBitmap DownloadTile(int zoom, int x, int y, IBaseLayer baseLayer) { Uri uri = new Uri(baseLayer.GetTileUrl(zoom, x, y)); GeoBitmap geoBmp = new GeoBitmap() { OriginUri = uri.ToString() }; try { TileIndex index = new TileIndex(x, y, zoom); Bitmap tileImg = null; tileImg = GetTileFromCache(index, baseLayer.Name); if (tileImg != null) { geoBmp.Origin = TileOrigin.Memory; } else { tileImg = GetTileFromDisc(index, baseLayer.Name); if (tileImg != null) { geoBmp.Origin = TileOrigin.Disk; SaveTileToCache(tileImg, index, baseLayer.Name); } } if (tileImg == null) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Timeout = 500; request.UserAgent = USER_AGENT; //IWebProxy webProxy = WebRequest.DefaultWebProxy; //webProxy.Credentials = CredentialCache.DefaultNetworkCredentials; //request.Proxy = webProxy; try { using (WebResponse response = request.GetResponse()) using (Stream stream = response.GetResponseStream()) { tileImg = (Bitmap)Bitmap.FromStream(stream); } } catch (WebException webEx) { Trace.TraceWarning("Unable to download image at " + uri.ToString() + ": " + webEx.Message); tileImg = new Bitmap(256, 256); using (Graphics g = Graphics.FromImage(tileImg)) { g.Clear(Color.LightGray); g.DrawRectangle(Pens.Red, 0, 0, 255, 255); g.DrawLine(Pens.Red, 1, 1, 255, 255); } geoBmp.Exception = webEx; } finally { geoBmp.Origin = TileOrigin.Download; if (geoBmp.Exception == null) { SaveTileToDisc(tileImg, index, baseLayer.Name); SaveTileToCache(tileImg, index, baseLayer.Name); } } } geoBmp.Bitmap = tileImg; // what are X,Y coords for images int xPos, yPos = 0; double lat, lon = 0; double lat2, lon2 = 0; BingMapsTileSystem.TileXYToPixelXY(x, y, out xPos, out yPos); BingMapsTileSystem.PixelXYToLatLong(xPos, yPos, zoom, out lat, out lon); BingMapsTileSystem.PixelXYToLatLong(xPos + 256, yPos + 256, zoom, out lat2, out lon2); geoBmp.BBox = new BoundingBox(lon, lon2, lat2, lat); geoBmp.Index = new TileIndex(x, y, zoom); } catch (Exception ex) { geoBmp.Exception = ex; Trace.TraceWarning("Unable to load base layer at " + uri.ToString() + ": " + ex.Message); } return(geoBmp); }
private void Layer3DPanTreePad_OnLayerDoubleClick(IBaseLayer layer) { }