private bool OnLocation() { if (d3 == null) { return(false); } bool bX = double.TryParse(this.te_X.Text, out x); bool bY = double.TryParse(this.te_Y.Text, out y); if (!bX || !bY) { return(false); } IVector3 vect = null; IEulerAngle angle = null; d3.Camera.GetCamera(out vect, out angle); if (d3.Terrain.IsRegistered) { double z = d3.Terrain.GetElevation(x, y, Gvitech.CityMaker.RenderControl.gviGetElevationType.gviGetElevationFromDatabase); vect.Set(x, y, z); } else { vect.Set(x, y, vect.Z); } IImagePointSymbol imagePointSymbol = new ImagePointSymbolClass(); imagePointSymbol.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\Location.png"); imagePointSymbol.Size = SystemInfo.Instance.SymbolSize; imagePointSymbol.Alignment = gviPivotAlignment.gviPivotAlignBottomCenter; IPoint pt = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pt.SetCoords(vect.X, vect.Y, vect.Z, 0, 0); IRenderPoint renderPoint = d3.ObjectManager.CreateRenderPoint(pt, imagePointSymbol, d3.ProjectTree.RootID); renderPoint.MaxVisibleDistance = 10000000000.0; ITextSymbol textSymbol = new TextSymbolClass(); textSymbol.TextAttribute = new TextAttributeClass { TextColor = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16), TextSize = SystemInfo.Instance.TextSize }; textSymbol.PivotAlignment = gviPivotAlignment.gviPivotAlignTopCenter; ILabel label = d3.ObjectManager.CreateLabel(d3.ProjectTree.RootID); label.Position = pt; label.MaxVisibleDistance = 10000000000.0; label.TextSymbol = textSymbol; label.Text = this.te_X.Text + "," + this.te_Y.Text; this.listRender.Add(renderPoint); this.listRender.Add(label); d3.Camera.LookAt(vect, 500, angle); return(true); }
private IGeometrySymbol GetGeometrySymbol(string GeoType, XmlNode symbolNode) { IGeometrySymbol result = null; if (GeoType != null) { if (!(GeoType == "ModelPoint")) { if (!(GeoType == "PointCloud")) { if (!(GeoType == "SimplePoint")) { if (!(GeoType == "ImagePoint")) { if (!(GeoType == "Polyline")) { if (GeoType == "Polygon") { result = new SurfaceSymbolClass { Color = uint.Parse(symbolNode.Attributes["FillColor"].Value), EnableLight = bool.Parse(symbolNode.Attributes["EnableLight"].Value), BoundarySymbol = { Color = uint.Parse(symbolNode.Attributes["Color"].Value), Width = float.Parse(symbolNode.Attributes["Width"].Value), ImageName = symbolNode.Attributes["ImageName"].Value } }; } } else { ICurveSymbol curveSymbol = new CurveSymbolClass(); curveSymbol.Color = uint.Parse(symbolNode.Attributes["Color"].Value); curveSymbol.Width = float.Parse(symbolNode.Attributes["Width"].Value); curveSymbol.ImageName = symbolNode.Attributes["ImageName"].Value; if (symbolNode.Attributes["RepeatLength"] != null) { curveSymbol.RepeatLength = float.Parse(symbolNode.Attributes["RepeatLength"].Value); } result = curveSymbol; } } else { result = new ImagePointSymbolClass { Size = int.Parse(symbolNode.Attributes["Size"].Value), Alignment = (gviPivotAlignment)System.Enum.Parse(typeof(gviPivotAlignment), symbolNode.Attributes["Alignment"].Value), ImageName = Path.Combine(System.Windows.Forms.Application.StartupPath + @"\..\Image\" + symbolNode.Attributes["ImageName"].Value) }; } } else { result = new SimplePointSymbolClass { Size = int.Parse(symbolNode.Attributes["Size"].Value), Alignment = (gviPivotAlignment)System.Enum.Parse(typeof(gviPivotAlignment), symbolNode.Attributes["Alignment"].Value), FillColor = uint.Parse(symbolNode.Attributes["FillColor"].Value), Style = (gviSimplePointStyle)System.Enum.Parse(typeof(gviSimplePointStyle), symbolNode.Attributes["Style"].Value) }; } } else { result = new PointCloudSymbolClass { Color = uint.Parse(symbolNode.Attributes["Color"].Value), EnableColor = symbolNode.Attributes["EnableColor"].Value.ToLower() == "true", Size = int.Parse(symbolNode.Attributes["Size"].Value) }; } } else { IModelPointSymbol modelPointSymbol = new ModelPointSymbolClass(); modelPointSymbol.Color = uint.Parse(symbolNode.Attributes["Color"].Value); modelPointSymbol.EnableColor = (symbolNode.Attributes["EnableColor"].Value.ToLower() == "true"); XmlAttribute xmlAttribute = symbolNode.Attributes["EnableTexture"]; if (xmlAttribute != null) { modelPointSymbol.EnableTexture = (xmlAttribute.Value.ToLower() == "true"); } result = modelPointSymbol; } } return(result); }