private void dataGridView1_MouseDoubleClick(object sender, MouseEventArgs e) { int featureId = int.Parse((sender as DataGridView).CurrentRow.Cells[0].Value.ToString()); IFeatureClass curFeatureClass = null; foreach (IFeatureClass fc in fcMap.Keys) { curFeatureClass = fc; IRowBuffer fdeRow = curFeatureClass.GetRow(featureId); if (fdeRow != null) { int nPos = fdeRow.FieldIndex("Geometry"); if (nPos != -1 && !fdeRow.IsNull(nPos)) { IPOI mp = fdeRow.GetValue(nPos) as IPOI; // 从库中读取值 IPoint pos = new GeometryFactory().CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pos.Position = mp.Position; pos.SpatialCRS = mp.SpatialCRS; IEulerAngle angle = new EulerAngle(); angle.Heading = 0; angle.Tilt = -60; angle.Roll = 0; this.axRenderControl1.Camera.LookAt2(pos, 3000, angle); this.axRenderControl1.FeatureManager.UnhighlightAll(); this.axRenderControl1.FeatureManager.HighlightFeature(curFeatureClass, int.Parse(fdeRow.GetValue(0).ToString()), System.Drawing.Color.Yellow); mp.ImageName = (strMediaPath + @"\png\lan.png"); IRenderPOI rpoi = this.axRenderControl1.ObjectManager.CreateRenderPOI(mp); rpoi.Highlight(System.Drawing.Color.Red); this.axRenderControl1.ObjectManager.DelayDelete(rpoi.Guid, 60000); } } } }
/// <summary> /// 创建POI /// </summary> /// <returns></returns> IRenderPOI createPOI() { IPOI poi = (IPOI) new GeometryFactory().CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ); poi.SetCoords(3.3, 4.4, 5.5, 0, 0); poi.SpatialCRS = (SpatialCRS) new CRSFactory().CreateFromWKID(2463); poi.ImageName = "poi.png"; poi.Name = "POI_01"; poi.Size = 10; return(axRenderControl.ObjectManager.CreateRenderPOI(poi)); }
public AdmnController(IUser userService, IDomain domainService, IWebContent webContentService, IWebPages webPagesService, IECommerce ecommerceService, IPOI poiService, ITemplate templateService, IPortfolio portfolioService, IGallery galleryService) : base(domainService) { this.UserService = userService; this.DomainService = domainService; this.WebContentService = webContentService; this.WebPagesService = webPagesService; this.ECommerceService = ecommerceService; this.POIService = poiService; this.TemplateService = templateService; this.PortfolioService = portfolioService; this.GalleryService = galleryService; }
void axRenderControl1_RcMouseClickSelect(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender) { if (PickResult.Type == gviObjectType.gviObjectLabel) { ILabelPickResult tlpr = PickResult as ILabelPickResult; gviObjectType type = tlpr.Type; ILabel fl = tlpr.Label; MessageBox.Show("拾取到" + type + "类型,内容为" + fl.Text); } else if (PickResult.Type == gviObjectType.gviObjectRenderModelPoint) { IRenderModelPointPickResult tlpr = PickResult as IRenderModelPointPickResult; gviObjectType type = tlpr.Type; IRenderModelPoint fl = tlpr.ModelPoint; MessageBox.Show("拾取到" + type + "类型,模型名称为" + fl.ModelName); } else if (PickResult.Type == gviObjectType.gviObjectRenderPoint) { IRenderPointPickResult tlpr = PickResult as IRenderPointPickResult; gviObjectType type = tlpr.Type; IRenderPoint fl = tlpr.Point; MessageBox.Show("拾取到" + type + "类型,大小为" + fl.Symbol.Size); } else if (PickResult.Type == gviObjectType.gviObjectRenderPolyline) { IRenderPolylinePickResult tlpr = PickResult as IRenderPolylinePickResult; gviObjectType type = tlpr.Type; IRenderPolyline fl = tlpr.Polyline; MessageBox.Show("拾取到" + type + "类型,GUID为" + fl.Guid); } else if (PickResult.Type == gviObjectType.gviObjectRenderPolygon) { IRenderPolygonPickResult tlpr = PickResult as IRenderPolygonPickResult; gviObjectType type = tlpr.Type; IRenderPolygon fl = tlpr.Polygon; MessageBox.Show("拾取到" + type + "类型,GUID为" + fl.Guid); } else if (PickResult.Type == gviObjectType.gviObjectRenderPOI) { IRenderPOIPickResult tlpr = PickResult as IRenderPOIPickResult; gviObjectType type = tlpr.Type; IRenderPOI fl = tlpr.POI; MessageBox.Show("拾取到" + type + "类型,名称为" + ((IPOI)fl.GetFdeGeometry()).Name); } else if (PickResult.Type == gviObjectType.gviObjectTerrainRegularPolygon) { ITerrainRegularPolygonPickResult regPolygonPick = PickResult as ITerrainRegularPolygonPickResult; gviObjectType type = regPolygonPick.Type; ITerrainRegularPolygon regPolygon = regPolygonPick.TerrainRegularPolygon; MessageBox.Show("拾取到" + type + "类型,geometryCount为" + regPolygon.GetFdeGeometry().GeometryType); } else if (PickResult.Type == gviObjectType.gviObjectTerrainArrow) { ITerrainArrowPickResult arrowPickResult = PickResult as ITerrainArrowPickResult; gviObjectType type = arrowPickResult.Type; ITerrainArrow arrow = arrowPickResult.TerrainArrow; MessageBox.Show("拾取到" + type + "类型,geometryType" + arrow.GetFdeGeometry().GeometryType); } else if (PickResult.Type == gviObjectType.gviObjectReferencePlane) { switch (this.toolStripComboBoxObjectManager.Text) { case "CreateLabel": { label = this.axRenderControl1.ObjectManager.CreateLabel(rootId); label.Text = "我是testlabel"; label.Position = IntersectPoint; textSymbol = new TextSymbol(); textAttribute = new TextAttribute(); textAttribute.TextColor = System.Drawing.Color.Yellow; textAttribute.TextSize = 20; textAttribute.Underline = true; textAttribute.Font = "楷体"; textSymbol.TextAttribute = textAttribute; textSymbol.VerticalOffset = 10; textSymbol.DrawLine = true; textSymbol.MarginColor = System.Drawing.Color.Yellow; label.TextSymbol = textSymbol; this.axRenderControl1.Camera.FlyToObject(label.Guid, gviActionCode.gviActionFlyTo); } break; case "CreateRenderModelPoint": { if (gfactory == null) { gfactory = new GeometryFactory(); } string tmpOSGPath = (strMediaPath + @"\osg\Buildings\Apartment\Apartment.osg"); fde_modelpoint = gfactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint; fde_modelpoint.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0); fde_modelpoint.ModelName = tmpOSGPath; rmodelpoint = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(fde_modelpoint, null, rootId); rmodelpoint.MaxVisibleDistance = double.MaxValue; rmodelpoint.MinVisiblePixels = 0; rmodelpoint.ShowOutline = checkShowOutline.Checked; IEulerAngle angle = new EulerAngle(); angle.Set(0, -20, 0); this.axRenderControl1.Camera.LookAt(IntersectPoint.Position, 100, angle); } break; case "CreateRenderPoint": { if (gfactory == null) { gfactory = new GeometryFactory(); } fde_point = (IPoint)gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ); fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0); pointSymbol = new SimplePointSymbol(); pointSymbol.FillColor = System.Drawing.Color.Red; pointSymbol.Size = 10; rpoint = this.axRenderControl1.ObjectManager.CreateRenderPoint(fde_point, pointSymbol, rootId); rpoint.ShowOutline = checkShowOutline.Checked; this.axRenderControl1.Camera.FlyToObject(rpoint.Guid, gviActionCode.gviActionFlyTo); } break; case "CreateRenderPolyline": { if (gfactory == null) { gfactory = new GeometryFactory(); } fde_polyline = (IPolyline)gfactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ); fde_point = (IPoint)gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ); fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0); fde_polyline.AppendPoint(fde_point); fde_point.SetCoords(IntersectPoint.X + 20, IntersectPoint.Y, IntersectPoint.Z, 0, 0); fde_polyline.AppendPoint(fde_point); fde_point.SetCoords(IntersectPoint.X + 20, IntersectPoint.Y + 20, IntersectPoint.Z, 0, 0); fde_polyline.AppendPoint(fde_point); fde_point.SetCoords(IntersectPoint.X + 20, IntersectPoint.Y + 20, IntersectPoint.Z + 20, 0, 0); fde_polyline.AppendPoint(fde_point); lineSymbol = new CurveSymbol(); lineSymbol.Color = System.Drawing.Color.Red; // 紫红色 rpolyline = this.axRenderControl1.ObjectManager.CreateRenderPolyline(fde_polyline, lineSymbol, rootId); rpolyline.ShowOutline = checkShowOutline.Checked; this.axRenderControl1.Camera.FlyToObject(rpolyline.Guid, gviActionCode.gviActionFlyTo); } break; case "CreateRenderPolygon": { if (gfactory == null) { gfactory = new GeometryFactory(); } fde_polygon = (IPolygon)gfactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ); fde_point = (IPoint)gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ); fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0); fde_polygon.ExteriorRing.AppendPoint(fde_point); fde_point.SetCoords(IntersectPoint.X + 10, IntersectPoint.Y, IntersectPoint.Z, 0, 0); fde_polygon.ExteriorRing.AppendPoint(fde_point); fde_point.SetCoords(IntersectPoint.X + 10, IntersectPoint.Y + 10, IntersectPoint.Z, 0, 0); fde_polygon.ExteriorRing.AppendPoint(fde_point); fde_point.SetCoords(IntersectPoint.X, IntersectPoint.Y + 10, IntersectPoint.Z, 0, 0); fde_polygon.ExteriorRing.AppendPoint(fde_point); surfaceSymbol = new SurfaceSymbol(); surfaceSymbol.Color = System.Drawing.Color.Blue; // 蓝色 rpolygon = this.axRenderControl1.ObjectManager.CreateRenderPolygon(fde_polygon, surfaceSymbol, rootId); rpolygon.ShowOutline = checkShowOutline.Checked; this.axRenderControl1.Camera.FlyToObject(rpolygon.Guid, gviActionCode.gviActionFlyTo); } break; case "CreateRenderPOI": { if (gfactory == null) { gfactory = new GeometryFactory(); } fde_poi = (IPOI)gfactory.CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ); fde_poi.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0); fde_poi.ImageName = "#(1)"; fde_poi.Name = (++poiCount).ToString(); fde_poi.Size = 50; rpoi = this.axRenderControl1.ObjectManager.CreateRenderPOI(fde_poi); rpoi.ShowOutline = checkShowOutline.Checked; this.axRenderControl1.Camera.FlyToObject(rpoi.Guid, gviActionCode.gviActionFlyTo); } break; case "CreateFixedBillboard": { TextAttribute ta = new TextAttribute(); ta.TextSize = 10; ta.TextColor = System.Drawing.Color.Yellow; IImage image = null; IModel model = null; string imageName = ""; this.axRenderControl1.Utility.CreateFixedBillboard("I'm fixed billboard!", ta, 50, 100, true, out model, out image, out imageName); this.axRenderControl1.ObjectManager.AddModel("fixedModel", model); this.axRenderControl1.ObjectManager.AddImage(imageName, image); if (gfactory == null) { gfactory = new GeometryFactory(); } fde_modelpoint = gfactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint, gviVertexAttribute.gviVertexAttributeZ) as IModelPoint; fde_modelpoint.SetCoords(IntersectPoint.X, IntersectPoint.Y, IntersectPoint.Z, 0, 0); fde_modelpoint.ModelName = "fixedModel"; rmodelpoint = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(fde_modelpoint, null, rootId); rmodelpoint.MaxVisibleDistance = double.MaxValue; rmodelpoint.MinVisiblePixels = 0; rmodelpoint.ShowOutline = checkShowOutline.Checked; IEulerAngle angle = new EulerAngle(); angle.Set(0, -20, 0); this.axRenderControl1.Camera.LookAt(IntersectPoint.Position, 100, angle); } break; case "CreateRegularPolygon": { IPosition pos = new Position(); pos.X = IntersectPoint.X; pos.Y = IntersectPoint.Y; pos.Altitude = IntersectPoint.Z; ITerrainRegularPolygon regPolygon = this.axRenderControl1.ObjectManager.CreateRegularPolygon(pos, 10, 10, System.Drawing.Color.Red, System.Drawing.Color.White, rootId); this.axRenderControl1.Camera.FlyToObject(regPolygon.Guid, gviActionCode.gviActionFlyTo); } break; case "CreateArrow": { IPosition pos = new Position(); pos.X = IntersectPoint.X; pos.Y = IntersectPoint.Y; pos.Altitude = IntersectPoint.Z; ITerrainArrow regArrow = this.axRenderControl1.ObjectManager.CreateArrow(pos, 30, 4, System.Drawing.Color.Red, System.Drawing.Color.White, rootId); this.axRenderControl1.Camera.FlyToObject(regArrow.Guid, gviActionCode.gviActionFlyTo); } break; } } }
public MKDSItemPointLineRenderGroup(IPOI ItemPoints, IPAT ItemPointPaths, Color LineColor) { this.ItemPoints = ItemPoints; this.ItemPointPaths = ItemPointPaths; this.LineColor = LineColor; }
private void CircleQuery() { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } WaitForm.Start("正在搜索...", "请稍后"); try { FacilityClass fac = FacilityClassManager.Instance.GetFacilityClassByName("PipeNode"); if (fac == null) { return; } DFDataConfig.Class.FieldInfo field = fac.GetFieldInfoBySystemName("Additional"); if (field == null) { return; } ISpatialFilter filter = new SpatialFilterClass(); filter.SubFields = "oid,Geometry,FootPrint"; string configFH = Config.GetConfigValue("FireHydrantName"); string fireHydrantName = "'" + configFH + "'"; filter.WhereClause = field.Name + " in (" + fireHydrantName + ")"; filter.Geometry = this._drawTool.GetGeo().Clone2(gviVertexAttribute.gviVertexAttributeNone); filter.GeometryField = "FootPrint"; filter.SpatialRel = gviSpatialRel.gviSpatialRelContains; List <DF3DFeatureClass> list = DF3DFeatureClassManager.Instance.GetFeatureClassByFacilityClassName("PipeNode"); if (list == null) { return; } foreach (DF3DFeatureClass dffc in list) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fc.GuidString); if (mc != null && mc.Name != "GS") { continue; } IFdeCursor cursor = null; IRowBuffer row = null; try { cursor = fc.Search(filter, false); while ((row = cursor.NextRow()) != null) { if (!row.IsNull(1)) { IGeometry geo = row.GetValue(1) as IGeometry; switch (geo.GeometryType) { case gviGeometryType.gviGeometryPoint: IPoint pt = geo as IPoint; IPOI poi = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ) as IPOI; poi.X = pt.X; poi.Y = pt.Y; poi.Z = pt.Z + 2; poi.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\fireHydrant.png"); poi.Size = SystemInfo.Instance.SymbolSize; poi.ShowName = false; IRenderPOI rpoi = app.Current3DMapControl.ObjectManager.CreateRenderPOI(poi); this._listRGuid.Add(rpoi.Guid); continue; case gviGeometryType.gviGeometryModelPoint: IModelPoint pt1 = geo as IModelPoint; IPOI poi1 = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ) as IPOI; poi1.X = pt1.X; poi1.Y = pt1.Y; poi1.Z = pt1.Z + 2; poi1.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\fireHydrant.png"); poi1.Size = SystemInfo.Instance.SymbolSize; poi1.ShowName = false; IRenderPOI rpoi1 = app.Current3DMapControl.ObjectManager.CreateRenderPOI(poi1); this._listRGuid.Add(rpoi1.Guid); continue; } } } } catch (Exception ex) { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } } } catch (Exception ex) { } finally { WaitForm.Stop(); } }
private void ClickQuery() { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } try { IFeatureLayer fl = this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer; if (fl == null) { return; } int featureId = this._drawTool.GetSelectFeatureLayerPickResult().FeatureId; FacilityClass facc = Dictionary3DTable.Instance.GetFacilityClassByDFFeatureClassID(fl.FeatureClassId.ToString()); if (facc == null || facc.Name != "PipeLine") { XtraMessageBox.Show("您选中的不是管线设施,请选择管线设施。", "提示"); return; } DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fl.FeatureClassId.ToString()); if (dffc == null || dffc.GetFeatureClass() == null) { return; } IFeatureClass fc = dffc.GetFeatureClass(); IImagePointSymbol ips = new ImagePointSymbol(); ips.Size = SystemInfo.Instance.SymbolSize; ips.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\accidentPoint.png"); IPoint intersectPoint = this._drawTool.GetSelectPoint(); _rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(intersectPoint, ips, app.Current3DMapControl.ProjectTree.RootID); _rPoint.MinVisibleDistance = 499; _rPoint.MaxVisibleDistance = 99999; _particleEffect = app.Current3DMapControl.ObjectManager.CreateParticleEffect(app.Current3DMapControl.ProjectTree.RootID); MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fl.FeatureClassId.ToString()); if (mc != null && (mc.Name == "PS" || mc.Name == "GS")) { _particleEffect.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\ParticleEffect\\water.png"); _particleEffect.ParticleBillboardType = gviParticleBillboardType.gviParticleBillboardOrientedMoveDirection; //_particleEffect.setTextureTileRange(8, 8, 63, 63); _particleEffect.EmissionMinRate = 1600; _particleEffect.EmissionMaxRate = 1300; _particleEffect.EmissionMinAngle = 0; _particleEffect.EmissionMaxAngle = 0.025 * Math.PI; // 改成一个圆 _particleEffect.EmissionMinMoveSpeed = 25; _particleEffect.EmissionMaxMoveSpeed = 30; _particleEffect.EmissionMinRotationSpeed = 0; _particleEffect.EmissionMaxRotationSpeed = 0; _particleEffect.ParticleMinLifeTime = 4.5; _particleEffect.ParticleMaxLifeTime = 5.5; _particleEffect.EmissionMinParticleSize = 0.2; _particleEffect.EmissionMaxParticleSize = 0.25; _particleEffect.EmissionMinScaleSpeed = 0; _particleEffect.EmissionMaxScaleSpeed = 0; _particleEffect.ParticleBirthColor = 0xffffffff; _particleEffect.ParticleDeathColor = 0x00ffffff; _particleEffect.VerticalAcceleration = 5; _particleEffect.Damping = 0.5; _particleEffect.WindAcceleration = 0; _particleEffect.WindDirection = 0; IEulerAngle v3t = new EulerAngle(); v3t.Set(90, 45, 0); _particleEffect.EmissionDirectionEulerAngle = v3t; } else { _particleEffect.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\ParticleEffect\\smoke1.png"); _particleEffect.ParticleBillboardType = gviParticleBillboardType.gviParticleBillboardOrientedCamera; _particleEffect.SetTextureTileRange(8, 8, 63, 63); // 58,58位置的图有问题 _particleEffect.EmissionMinRate = 20; _particleEffect.EmissionMaxRate = 30; _particleEffect.EmissionMinAngle = 0; _particleEffect.EmissionMaxAngle = 3.14 * 2.0; // 改成一个圆 _particleEffect.EmissionMinMoveSpeed = 0; _particleEffect.EmissionMaxMoveSpeed = 1; _particleEffect.EmissionMinRotationSpeed = -1; _particleEffect.EmissionMaxRotationSpeed = 1; _particleEffect.ParticleMinLifeTime = 10; _particleEffect.ParticleMaxLifeTime = 12; _particleEffect.EmissionMinParticleSize = 0.75; _particleEffect.EmissionMaxParticleSize = 0.9; _particleEffect.EmissionMinScaleSpeed = 1.5; _particleEffect.EmissionMaxScaleSpeed = 1.85; _particleEffect.ParticleBirthColor = 0xffffffff; _particleEffect.ParticleDeathColor = 0x00ffffff; _particleEffect.VerticalAcceleration = -2; _particleEffect.Damping = 0; _particleEffect.WindAcceleration = 0; _particleEffect.WindDirection = 0; } _particleEffect.MinVisibleDistance = 0; _particleEffect.MaxVisibleDistance = 500; _particleEffect.Start(-1); IPoint pttemp = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint; IVector3 v3 = new Vector3(); v3.Set(intersectPoint.X, intersectPoint.Y, intersectPoint.Z); pttemp.Position = v3; _particleEffect.SetCircleEmitter(pttemp, 0); this._drawTool.End(); WaitForm.Start("正在分析...", "请稍后"); string res = GetValveClosed(fl.FeatureClassId.ToString(), featureId.ToString()); JObject json = JObject.Parse(res); if (json["res"] != null) { string resstr = json["res"].ToString(); if (resstr == "false") { XtraMessageBox.Show("分析出错", "提示"); return; } else { string msgstr = json["msg"].ToString(); if (json["count"] == null) { XtraMessageBox.Show(msgstr, "提示"); return; } int count = int.Parse(json["count"].ToString()); double totalx = 0.0; double totaly = 0.0; double totalz = 0.0; #region 渲染搜索到的阀门 if (json["preValveIds"] != null) { string preValveIds = json["preValveIds"].ToString(); string[] arr = preValveIds.Split(';'); foreach (string item in arr) { int index = item.LastIndexOf("_"); string fcguid = item.Substring(0, index); string oid = item.Substring(index + 1, item.Length - index - 1); DF3DFeatureClass dffc1 = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fcguid); if (dffc != null) { IFeatureClass fc1 = dffc1.GetFeatureClass(); if (fc1 != null) { IFdeCursor cursor = null; IRowBuffer row = null; try { IQueryFilter filter = new QueryFilter(); filter.WhereClause = "oid=" + oid; filter.SubFields = "oid,Shape"; cursor = fc1.Search(filter, false); row = cursor.NextRow(); if (row != null && !row.IsNull(1)) { object obj = row.GetValue(1); if (obj is IGeometry) { IGeometry geo = obj as IGeometry; switch (geo.GeometryType) { case gviGeometryType.gviGeometryPoint: IPoint pt = geo as IPoint; IPOI poi = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ) as IPOI; poi.X = pt.X; poi.Y = pt.Y; poi.Z = pt.Z + 2; totalx += poi.X; totaly += poi.Y; totalz += poi.Z; poi.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\valvePre.png"); poi.Size = SystemInfo.Instance.SymbolSize; poi.ShowName = false; IRenderPOI rpoi = app.Current3DMapControl.ObjectManager.CreateRenderPOI(poi); this._listRGuid.Add(rpoi.Guid); continue; } } } } catch (Exception ex) { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } } } } } if (json["nextValveIds"] != null) { string nextValveIds = json["nextValveIds"].ToString(); string[] arr = nextValveIds.Split(';'); foreach (string item in arr) { int index = item.LastIndexOf("_"); string fcguid = item.Substring(0, index); string oid = item.Substring(index + 1, item.Length - index - 1); DF3DFeatureClass dffc1 = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fcguid); if (dffc != null) { IFeatureClass fc1 = dffc1.GetFeatureClass(); if (fc1 != null) { IFdeCursor cursor = null; IRowBuffer row = null; try { IQueryFilter filter = new QueryFilter(); filter.WhereClause = "oid=" + oid; filter.SubFields = "oid,Shape"; cursor = fc1.Search(filter, false); row = cursor.NextRow(); if (row != null && !row.IsNull(1)) { object obj = row.GetValue(1); if (obj is IGeometry) { IGeometry geo = obj as IGeometry; switch (geo.GeometryType) { case gviGeometryType.gviGeometryPoint: IPoint pt = geo as IPoint; IPOI poi = (new GeometryFactoryClass()).CreateGeometry(gviGeometryType.gviGeometryPOI, gviVertexAttribute.gviVertexAttributeZ) as IPOI; poi.X = pt.X; poi.Y = pt.Y; poi.Z = pt.Z + 2; totalx += poi.X; totaly += poi.Y; totalz += poi.Z; poi.ImageName = Path.Combine(Application.StartupPath, "..\\Resource\\Images\\POI\\valveNext.png"); poi.Size = SystemInfo.Instance.SymbolSize; poi.ShowName = false; IRenderPOI rpoi = app.Current3DMapControl.ObjectManager.CreateRenderPOI(poi); this._listRGuid.Add(rpoi.Guid); continue; } } } } catch (Exception ex) { } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } } } } } #endregion // 定位 IVector3 vect; IEulerAngle ang; app.Current3DMapControl.Camera.GetCamera(out vect, out ang); vect.Set(totalx / count, totaly / count, totalz / count + 600.0); ang.Set(ang.Heading, -90, ang.Roll); app.Current3DMapControl.Camera.SetCamera(vect, ang, gviSetCameraFlags.gviSetCameraNoFlags); } } else { XtraMessageBox.Show("分析出错", "提示"); return; } } catch (Exception ex) { } finally { WaitForm.Stop(); } }