private void Clear()
        {
            if (_rPoint != null)
            {
                d3.ObjectManager.DeleteObject(_rPoint.Guid);
                _rPoint = null;
            }
            if (_particleEffect != null)
            {
                d3.ObjectManager.DeleteObject(_particleEffect.Guid);
                _particleEffect = null;
            }

            if (this._drawTool != null)
            {
                this._drawTool.Close();
            }
            _isStartAnlyse = false;
            _isPause       = false;
            foreach (Guid guid in this._renderObjs)
            {
                d3.ObjectManager.DeleteObject(guid);
            }
            this._renderObjs.Clear();
            this.timer1.Stop();
        }
        private void Clear()
        {
            if (this._drawTool != null)
            {
                this._drawTool.Close();
            }
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            foreach (Guid guid in this._listRGuid)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(guid);
            }
            this._listRGuid.Clear();
            if (_rPoint != null)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(_rPoint.Guid);
                _rPoint = null;
            }
            if (_particleEffect != null)
            {
                app.Current3DMapControl.ObjectManager.DeleteObject(_particleEffect.Guid);
                _particleEffect = null;
            }
        }
Exemple #3
0
        private void AxRenderControl_RcMouseDragSelect(IPickResultCollection PickResults, gviModKeyMask Mask)
        {
            if (PickResults != null)
            {
                int         i = 0;
                IPickResult t = null;
                while ((t = PickResults.Get(i)) != null)
                {
                    if (t.Type == gviObjectType.gviObjectRenderPoint)
                    {
                        IRenderPoint temp = ((IRenderPointPickResult)t).Point;
                    }

                    if (t.Type == gviObjectType.gviObject3DTileLayer)
                    {
                        I3DTileLayer temp = ((I3DTileLayerPickResult)t).TileLayer;
                    }

                    if (t.Type == gviObjectType.gviObjectRenderModelPoint)
                    {
                        IRenderModelPoint temp = ((IRenderModelPointPickResult)t).ModelPoint;
                    }
                }
            }
        }
Exemple #4
0
 private void SetInteractNormal()
 {
     axRenderControl1.InteractMode = i3dInteractMode.i3dInteractNormal;
     UnHightlightObj();
     selectedPoint    = null;
     selectedPolyline = null;
 }
Exemple #5
0
        private bool _3DControl_RcMouseMove(object sender, Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseMoveEvent e)
        {
            IPoint      pt;
            IPickResult prTemp = this._3DControl.Camera.ScreenToWorld(e.x, e.y, out pt);

            if (pt != null)
            {
                if (_rPoint != null)
                {
                    this._objectManager.DeleteObject(_rPoint.Guid);
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
                    _rPoint = null;
                }
                _rPoint = this._objectManager.CreateRenderPoint(pt, this._simplePointSymbol, this._rootID);
            }
            if (prTemp != null && prTemp.Type == gviObjectType.gviObjectFeatureLayer)
            {
                if (this._hoverFL != null && this._hoverFL != this._curSelectedFL && this._curSelectedID != this._hoverID)
                {
                    this._hoverFL.UnhighlightFeature(this._hoverID);
                }

                IFeatureLayerPickResult pr = prTemp as IFeatureLayerPickResult;
                pr.FeatureLayer.HighlightFeature(pr.FeatureId, this._hightlightColor);
                this._hoverFL = pr.FeatureLayer;
                this._hoverID = pr.FeatureId;
            }
            return(false);
        }
Exemple #6
0
        /// <summary>
        /// 重置
        /// </summary>
        /// <remarks>不再使用时调用</remarks>
        public virtual void Reset()
        {
            if (_StartRenderPoint != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_StartRenderPoint.Guid);
                _StartRenderPoint = null;
            }
            if (_EndRenderPoint != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_EndRenderPoint.Guid);
                _EndRenderPoint = null;
            }
            if (_RenderPolygon != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_RenderPolygon.Guid);
                _RenderPolygon = null;
            }
            if (_TableLabel != null)
            {
                _AxRenderControl.ObjectManager.DeleteObject(_TableLabel.Guid);
                _TableLabel = null;
            }

            return;
        }
Exemple #7
0
 public override void Close()
 {
     if (_rPoint != null)
     {
         this._objectManager.DeleteObject(_rPoint.Guid);
         System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
         _rPoint = null;
     }
     if (_rPolyline != null)
     {
         this._3DControl.ObjectManager.DeleteObject(_rPolyline.Guid);
         _rPolyline = null;
     }
     if (_label != null)
     {
         this._3DControl.ObjectManager.DeleteObject(_label.Guid);
         _label = null;
     }
     if (_rPolygon != null)
     {
         this._3DControl.ObjectManager.DeleteObject(_rPolygon.Guid);
         _rPolygon = null;
     }
     this._3DControl.HighlightHelper.VisibleMask = 0;
     this._3DControl.HighlightHelper.SetRegion(null);
 }
        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);
        }
Exemple #9
0
 private void _3DControl_RcMouseClickSelect(object sender, _IRenderControlEvents_RcMouseClickSelectEvent e)
 {
     try
     {
         if (e.intersectPoint != null)
         {
             IPoint pt1 = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
             pt1.X = e.intersectPoint.X;
             pt1.Y = e.intersectPoint.Y;
             pt1.Z = e.intersectPoint.Z;
             if (e.eventSender == gviMouseSelectMode.gviMouseSelectClick)
             {
                 if (!this._isStarted)
                 {
                     this.Close();
                     if (this._onStartDraw != null)
                     {
                         this._onStartDraw();
                     }
                     this._polyline  = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;
                     this._rPolyline = this._objectManager.CreateRenderPolyline(this._polyline, this._curveSymbol, this._rootID);
                     this._polyline.AppendPoint(pt1);
                     IPoint pt2 = pt1.Clone() as IPoint;
                     pt2.X += 0.000001;
                     this._polyline.AppendPoint(pt2);
                     this._isStarted  = true;
                     this._isFinished = false;
                 }
                 else
                 {
                     this._polyline.AppendPoint(pt1);
                 }
             }
             else if (e.eventSender == gviMouseSelectMode.gviMouseSelectMove)
             {
                 if (_rPoint != null)
                 {
                     this._objectManager.DeleteObject(_rPoint.Guid);
                     System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
                     _rPoint = null;
                 }
                 _rPoint = this._objectManager.CreateRenderPoint(pt1, this._simplePointSymbol, this._rootID);
                 if (this._isStarted)
                 {
                     this._polyline.UpdatePoint(this._polyline.PointCount - 1, pt1);
                     this._rPolyline.SetFdeGeometry(this._polyline);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
Exemple #10
0
 private void clearDeep()
 {
     this.axRenderControl1.FeatureManager.UnhighlightAll();
     txtLocationNames.Text = "";
     routeSolver.ClearLocations();
     routeSolver.LocationSearchTolerance = double.Parse(txtSearchTolerance.Text);
     if (renderPoint != null)
     {
         this.axRenderControl1.ObjectManager.DeleteObject(renderPoint.Guid);
         renderPoint = null;
     }
 }
Exemple #11
0
        public static void TestDrawPoint(double offX, double offY, double offZ, double x, double y, double z, IPointSymbol pSymbol)
        {
            IPoint point = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);

            point.X = offX + x;
            point.Y = offY + y;
            point.Z = offZ + z;
            IRenderPoint item = Ocx.ObjectManager.CreateRenderPoint(point, pSymbol, Ocx.ProjectTree.RootID);

            item.MaxVisibleDistance = maxVisibleDis;
            tmpList.Add(item);
        }
Exemple #12
0
 public override void Close()
 {
     if (_rPoint != null)
     {
         this._objectManager.DeleteObject(_rPoint.Guid);
         System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
         _rPoint = null;
     }
     if (_rPointRes != null)
     {
         this._objectManager.DeleteObject(_rPointRes.Guid);
         System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPointRes);
         _rPointRes = null;
     }
 }
Exemple #13
0
        //private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        //{
        //    dsManager.DeleteNetworkDataset("newNetworkDataset");
        //}

        private void btnSelectLocation_Click(object sender, System.EventArgs e)
        {
            clear();
            clearDeep();

            #region 我在这(两点间最优路径)
            if (((Button)sender).Name == "btnImHere")
            {
                this.axRenderControl1.Camera.GetCamera2(out fdepoint, out ang);
                try
                {
                    INetworkLocation location = new NetworkLocation();
                    location.Position = fdepoint;
                    routeSolver.AddLocation(location);
                }
                catch (COMException ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }

                if (txtLocationNames.Text == "")
                {
                    txtLocationNames.Text = "I'm Here!";
                }
                else
                {
                    txtLocationNames.Text = txtLocationNames.Text + Environment.NewLine + "I'm Here!";
                }
                IImagePointSymbol ips = new ImagePointSymbol();
                ips.ImageName = "#(i)";
                ips.Size      = 50;
                renderPoint   = this.axRenderControl1.ObjectManager.CreateRenderPoint(fdepoint, ips, rootId);
                renderPoint.MaxVisibleDistance = 10000;
                MessageBox.Show("请选择您想去的终点");
            }
            #endregion

            // 注册控件拾取事件
            this.axRenderControl1.RcMouseClickSelect -= new _IRenderControlEvents_RcMouseClickSelectEventHandler(axRenderControl1_RcMouseClickSelect);

            this.axRenderControl1.RcMouseClickSelect += new _IRenderControlEvents_RcMouseClickSelectEventHandler(axRenderControl1_RcMouseClickSelect);

            this.axRenderControl1.InteractMode          = gviInteractMode.gviInteractSelect;
            this.axRenderControl1.MouseSelectObjectMask = gviMouseSelectObjectMask.gviSelectFeatureLayer;
            this.axRenderControl1.MouseSelectMode       = gviMouseSelectMode.gviMouseSelectClick;
        }
        private void CreateRenderPoint(IPoint point)
        {
            if (gfactory == null)
            {
                gfactory = new GeometryFactory();
            }

            fde_point            = (IPoint)gfactory.CreateGeometry(i3dGeometryType.i3dGeometryPoint, i3dVertexAttribute.i3dVertexAttributeZ);
            fde_point.SpatialCRS = crs;
            fde_point.SetCoords(point.X, point.Y, point.Z, 0, 0);

            pointSymbol           = new SimplePointSymbolClass();
            pointSymbol.FillColor = 0xff0000ff;
            pointSymbol.Size      = 10;
            rpoint = _axRenderControl.ObjectManager.CreateRenderPoint(fde_point, pointSymbol);

            _axRenderControl.Camera.FlyToObject(rpoint.Guid, i3dActionCode.i3dActionFlyTo);
        }
 public override void Close()
 {
     if (_rPoint != null)
     {
         this._objectManager.DeleteObject(_rPoint.Guid);
         System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
         _rPoint = null;
     }
     if (_polygon != null)
     {
         System.Runtime.InteropServices.Marshal.ReleaseComObject(_polygon);
         _polygon = null;
     }
     if (_rPolygon != null)
     {
         this._3DControl.ObjectManager.DeleteObject(_rPolygon.Guid);
         _rPolygon = null;
     }
 }
Exemple #16
0
        private void AxRenderControl_MouseClick(IPickResult IPickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender)
        {
            if (IPickResult != null)
            {
                if (IPickResult.Type == gviObjectType.gviObjectRenderPoint)
                {
                    IRenderPoint temp = ((IRenderPointPickResult)IPickResult).Point;
                }

                if (IPickResult.Type == gviObjectType.gviObject3DTileLayer)
                {
                    I3DTileLayer temp = ((I3DTileLayerPickResult)IPickResult).TileLayer;
                }

                if (IPickResult.Type == gviObjectType.gviObjectRenderModelPoint)
                {
                    IRenderModelPoint temp = ((IRenderModelPointPickResult)IPickResult).ModelPoint;
                }
            }
        }
Exemple #17
0
        private void AxRenderControl1_RcMouseClickSelect(object sender, Axi3dRenderEngine._IRenderControlEvents_RcMouseClickSelectEvent e)
        {
            UnHightlightObj();
            ResetSelectedObj();

            var pickResult = e.pickResult;

            if (pickResult.Type == i3dObjectType.i3dObjectRenderPolyline)
            {
                var flpr = pickResult as IRenderPolylinePickResult;
                selectedPolyline = flpr.Polyline;
                selectedPolyline.Highlight(0xFFFF0000);
                prePolyline = selectedPolyline;
            }
            else if (pickResult.Type == i3dObjectType.i3dObjectRenderPoint)
            {
                var res = pickResult as IRenderPointPickResult;
                selectedPoint = res.Point;
                selectedPoint.Highlight(0xFFFF0000);
                prePoint = selectedPoint;
            }
        }
Exemple #18
0
        /// <summary>
        /// 绘制点
        /// </summary>
        /// <param name="x">X值</param>
        /// <param name="y">Y值</param>
        /// <param name="z">Z值</param>
        private void DrawTopPoint(double x, double y, double z)
        {
            if (_TopPoint == null)
            {
                IGeometryFactory geometryFactory = new GeometryFactory();
                _TopPoint = geometryFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
            }

            _TopPoint.SetCoords(x, y, z, 0, 0);

            if (_EndRenderPoint == null)
            {
                _EndRenderPoint = _AxRenderControl.ObjectManager.CreateRenderPoint(_TopPoint, _PointSymbol, rootId);
                _EndRenderPoint.MaxVisibleDistance = double.MaxValue;
                _EndRenderPoint.MinVisiblePixels   = 1;
            }
            else
            {
                _EndRenderPoint.SetFdeGeometry(_TopPoint);
            }

            _EndRenderPoint.VisibleMask = gviViewportMask.gviViewAllNormalView;
        }
Exemple #19
0
 public override void Close()
 {
     try
     {
         if (_rPoint != null)
         {
             this._objectManager.DeleteObject(_rPoint.Guid);
             System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
             _rPoint = null;
         }
         if (this._curSelectedFL != null)
         {
             this._curSelectedFL.UnhighlightFeature(this._curSelectedID);
         }
         if (this._hoverFL != null)
         {
             this._hoverFL.UnhighlightFeature(this._hoverID);
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemple #20
0
        private void btnCreatePoint_Click(object sender, EventArgs e)
        {
            _geoEditor.FinishEdit();   //用于当拾取到基准面时,或者没有正常右键结束连续调用Start时

            if (gfactory == null)
            {
                gfactory = new GeometryFactory();
            }

            fde_point = (IPoint)gfactory.CreateGeometry(gviGeometryType.gviGeometryPoint,
                                                        gviVertexAttribute.gviVertexAttributeZ);
            fde_point.SetCoords(0, 0, 0, 0, 0);
            ISimplePointSymbol pointSymbol = new SimplePointSymbol();

            pointSymbol.Size = 10;
            rpoint           = this.axRenderControl1.ObjectManager.CreateRenderPoint(fde_point, pointSymbol, rootId);

            resultCode = _geoEditor.StartEditRenderGeometry(rpoint, gviGeoEditType.gviGeoEditCreator);
            if (!resultCode)
            {
                MessageBox.Show(this.axRenderControl1.GetLastError().ToString());
            }
        }
Exemple #21
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.Controls.EditorButton btn = e.Button;
            switch (btn.Caption)
            {
            case "定位":
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                int focusedRowHandle = this.gridView1.FocusedRowHandle;
                if (focusedRowHandle == -1)
                {
                    return;
                }
                DataRow dr = this.gridView1.GetDataRow(focusedRowHandle);
                if (dr["geo"] != null && dr["Name"] != null && dr["fcName"] != null)
                {
                    ISurfaceSymbol ss = new SurfaceSymbolClass();
                    ss.Color = 0xcc00ff00;
                    ICurveSymbol cs = new CurveSymbolClass();
                    cs.Color          = 0xff00ff00;
                    cs.Width          = -5;
                    ss.BoundarySymbol = cs;
                    ISimplePointSymbol ps = new SimplePointSymbol();
                    ps.Size      = SystemInfo.Instance.SymbolSize;
                    ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                    IGeometry objGeo = dr["geo"] as IGeometry;
                    IPoint    pt     = null;
                    if (objGeo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                    {
                        double         x         = 0;
                        double         y         = 0;
                        double         z         = 0;
                        IMultiPolyline mPolyline = objGeo as IMultiPolyline;
                        for (int m = 0; m < mPolyline.GeometryCount; m++)
                        {
                            IPolyline polyline = mPolyline.GetPolyline(m);
                            IPoint    pttemp   = polyline.Midpoint;
                            x += pttemp.X;
                            y += pttemp.Y;
                            z += pttemp.Z;
                        }
                        x    = x / mPolyline.GeometryCount;
                        y    = y / mPolyline.GeometryCount;
                        z    = z / mPolyline.GeometryCount;
                        pt   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = x;
                        pt.Y = y;
                        pt.Z = z;
                        IRenderMultiPolyline rMPolyline = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolyline(mPolyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                        rMPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rMPolyline.Glow(8000);
                        this._listRender.Add(rMPolyline.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                    {
                        double        x        = 0;
                        double        y        = 0;
                        double        z        = 0;
                        IMultiPolygon mPolygon = objGeo as IMultiPolygon;
                        for (int m = 0; m < mPolygon.GeometryCount; m++)
                        {
                            IPolygon polygon = mPolygon.GetPolygon(m);
                            IPoint   pttemp  = polygon.Centroid;
                            x += pttemp.X;
                            y += pttemp.Y;
                            z += pttemp.Z;
                        }
                        x    = x / mPolygon.GeometryCount;
                        y    = y / mPolygon.GeometryCount;
                        z    = z / mPolygon.GeometryCount;
                        pt   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = x;
                        pt.Y = y;
                        pt.Z = z;
                        IRenderMultiPolygon rMPolygon = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(mPolygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                        rMPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rMPolygon.Glow(8000);
                        this._listRender.Add(rMPolygon.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPolyline)
                    {
                        IPolyline polyline = objGeo as IPolyline;
                        pt = polyline.Midpoint;
                        IRenderPolyline rPolyline = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                        rPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rPolyline.Glow(8000);
                        this._listRender.Add(rPolyline.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPoint)
                    {
                        IPoint point = objGeo as IPoint;
                        pt = point;
                        IRenderPoint rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(point, ps, app.Current3DMapControl.ProjectTree.RootID);
                        rPoint.Glow(8000);
                        this._listRender.Add(rPoint.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPolygon)
                    {
                        IPolygon polygon = objGeo as IPolygon;
                        pt = polygon.Centroid;
                        IRenderPolygon rPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                        rPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rPolygon.Glow(8000);
                        this._listRender.Add(rPolygon.Guid);
                    }
                    else
                    {
                        return;
                    }

                    ITableLabel tl = DrawTool.CreateTableLabel1(1);
                    tl.TitleText = dr["fcName"].ToString();
                    tl.SetRecord(0, 0, dr["Name"].ToString());
                    tl.Position = pt;

                    this._listRender.Add(tl.Guid);

                    app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                }
                break;
            }
        }
Exemple #22
0
        private void GetData()
        {
            if (this.cbLayer.SelectedItem == null)
            {
                return;
            }
            DF3DFeatureClass dffc = this.cbLayer.SelectedItem as DF3DFeatureClass;

            if (dffc == null)
            {
                return;
            }
            IFeatureClass fc = dffc.GetFeatureClass();

            if (fc == null)
            {
                return;
            }

            if (_num > _count || _count == 0)
            {
                return;
            }

            ISpatialFilter filter = this._filter;

            filter.ResultBeginIndex = _num - 1;
            filter.ResultLimit      = 1;
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                cursor = fc.Search(filter, false);
                if ((row = cursor.NextRow()) != null)
                {
                    #region 定位
                    int             geoindex = row.FieldIndex("Geometry");
                    DF3DApplication app      = DF3DApplication.Application;
                    if (geoindex != -1 && !row.IsNull(geoindex) && app != null && app.Current3DMapControl != null)
                    {
                        ISurfaceSymbol ss = new SurfaceSymbolClass();
                        ss.Color = 0xcc00ff00;
                        ICurveSymbol cs = new CurveSymbolClass();
                        cs.Color          = 0xff00ff00;
                        cs.Width          = -5;
                        ss.BoundarySymbol = cs;
                        ISimplePointSymbol ps = new SimplePointSymbol();
                        ps.Size      = SystemInfo.Instance.SymbolSize;
                        ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                        IGeometry geo  = row.GetValue(geoindex) as IGeometry;
                        IPoint    ptTL = null;
                        if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                        {
                            double         x         = 0;
                            double         y         = 0;
                            double         z         = 0;
                            IMultiPolyline mPolyline = geo as IMultiPolyline;
                            for (int m = 0; m < mPolyline.GeometryCount; m++)
                            {
                                IPolyline polyline = mPolyline.GetPolyline(m);
                                IPoint    pttemp   = polyline.Midpoint;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolyline.GeometryCount;
                            y      = y / mPolyline.GeometryCount;
                            z      = z / mPolyline.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolyline rMPolyline = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolyline(mPolyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                        {
                            double        x        = 0;
                            double        y        = 0;
                            double        z        = 0;
                            IMultiPolygon mPolygon = geo as IMultiPolygon;
                            for (int m = 0; m < mPolygon.GeometryCount; m++)
                            {
                                IPolygon polygon = mPolygon.GetPolygon(m);
                                IPoint   pttemp  = polygon.Centroid;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolygon.GeometryCount;
                            y      = y / mPolygon.GeometryCount;
                            z      = z / mPolygon.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolygon rMPolygon = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(mPolygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolyline)
                        {
                            IPolyline polyline = geo as IPolyline;
                            ptTL = polyline.Midpoint;
                            IRenderPolyline rPolyline = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPoint)
                        {
                            IPoint point = geo as IPoint;
                            ptTL = point;
                            IRenderPoint rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(point, ps, app.Current3DMapControl.ProjectTree.RootID);
                            rPoint.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPoint.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPoint.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolygon)
                        {
                            IPolygon polygon = geo as IPolygon;
                            ptTL = polygon.Centroid;
                            IRenderPolygon rPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryModelPoint)
                        {
                            ptTL = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            IModelPoint mp = geo as IModelPoint;
                            ptTL.X = mp.X;
                            ptTL.Y = mp.Y;
                            ptTL.Z = mp.Z;
                            IModelPointSymbol mps = new ModelPointSymbol();
                            mps.SetResourceDataSet(fc.FeatureDataSet);
                            IRenderGeometry render = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(mp, mps, app.Current3DMapControl.ProjectTree.RootID);
                            render.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(render.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(render.Guid, gviActionCode.gviActionJump);
                        }
                        if (ptTL != null)
                        {
                            ITableLabel tl = DrawTool.CreateTableLabel1(1);
                            tl.TitleText = "属性查询";
                            tl.SetRecord(0, 0, dffc.ToString());
                            if (ptTL != null)
                            {
                                tl.Position = ptTL;
                            }
                            app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                            app.Current3DMapControl.ObjectManager.DelayDelete(tl.Guid, 8000);
                        }
                    }
                    #endregion
                    FacilityClass facc = dffc.GetFacilityClass();
                    if (facc == null)
                    {
                        IFieldInfoCollection fiCol = fc.GetFields();
                        for (int i = 0; i < fiCol.Count; i++)
                        {
                            IFieldInfo fi  = fiCol.Get(i);
                            object     obj = row.GetValue(i);
                            string     str = "";
                            switch (fi.FieldType)
                            {
                            case gviFieldType.gviFieldBlob:
                            case gviFieldType.gviFieldUnknown:
                            case gviFieldType.gviFieldGeometry:
                                continue;

                            case gviFieldType.gviFieldFloat:
                            case gviFieldType.gviFieldDouble:
                                double d;
                                if (double.TryParse(obj.ToString(), out d))
                                {
                                    str = d.ToString("0.00");
                                }
                                break;

                            default:
                                str = obj.ToString();
                                break;
                            }
                            DataRow dr = this._dtShow.NewRow();
                            dr["Property"] = string.IsNullOrEmpty(fi.Alias) ? fi.Name : fi.Alias;
                            dr["Value"]    = str;
                            this._dtShow.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        List <DFDataConfig.Class.FieldInfo> facFields = facc.FieldInfoCollection;
                        if (facFields != null)
                        {
                            foreach (DFDataConfig.Class.FieldInfo facField in facFields)
                            {
                                if (!facField.CanQuery)
                                {
                                    continue;
                                }
                                int index = row.FieldIndex(facField.Name);
                                if (index != -1 && !row.IsNull(index))
                                {
                                    object     obj  = row.GetValue(index);
                                    string     str  = "";
                                    IFieldInfo fiFC = row.Fields.Get(index);
                                    switch (fiFC.FieldType)
                                    {
                                    case gviFieldType.gviFieldBlob:
                                    case gviFieldType.gviFieldUnknown:
                                    case gviFieldType.gviFieldGeometry:
                                        continue;

                                    case gviFieldType.gviFieldFloat:
                                    case gviFieldType.gviFieldDouble:
                                        double d;
                                        if (double.TryParse(obj.ToString(), out d))
                                        {
                                            str = d.ToString("0.00");
                                        }
                                        break;

                                    default:
                                        str = obj.ToString();
                                        break;
                                    }
                                    DataRow dr = this._dtShow.NewRow();
                                    dr["Property"] = facField.ToString();
                                    dr["Value"]    = str;
                                    this._dtShow.Rows.Add(dr);
                                }
                            }
                        }
                    }
                }
            }
            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;
                }
            }
        }
Exemple #23
0
 private void ResetSelectedObj()
 {
     selectedPoint    = null;
     selectedPolyline = null;
 }
        private void _3DControl_RcMouseClickSelect(object sender, _IRenderControlEvents_RcMouseClickSelectEvent e)
        {
            try
            {
                if (e.intersectPoint != null)
                {
                    IPoint pt1 = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
                    pt1.X = e.intersectPoint.X;
                    pt1.Y = e.intersectPoint.Y;
                    pt1.Z = e.intersectPoint.Z;
                    if (e.eventSender == gviMouseSelectMode.gviMouseSelectClick)
                    {
                        if (!this._isStarted)
                        {
                            this.Close();
                            if (this._onStartDraw != null)
                            {
                                this._onStartDraw();
                            }
                            this._polygon = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon;
                            this._polygon.ExteriorRing.AppendPoint(pt1);
                            IPoint pt2 = pt1.Clone() as IPoint;
                            pt2.X += 0.015;
                            this._polygon.ExteriorRing.AppendPoint(pt2);

                            ISurfaceSymbol ss = new SurfaceSymbolClass();
                            ss.Color = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                            ICurveSymbol cs = new CurveSymbolClass();
                            cs.Color              = Convert.ToUInt32(SystemInfo.Instance.LineColor, 16);
                            ss.BoundarySymbol     = cs;
                            _rPolygon             = this._3DControl.ObjectManager.CreateRenderPolygon(this._polygon, ss, this._3DControl.ProjectTree.RootID);
                            _rPolygon.HeightStyle = this._heightStyle;
                            //this._polygon.ExteriorRing.Close();
                            this._isStarted  = true;
                            this._isFinished = false;
                        }
                        else
                        {
                            this._polygon.ExteriorRing.AppendPoint(pt1);
                            this._polygon.ExteriorRing.Close();
                            this._rPolygon.SetFdeGeometry(this._polygon);
                        }
                    }
                    else if (e.eventSender == gviMouseSelectMode.gviMouseSelectMove)
                    {
                        if (_rPoint != null)
                        {
                            this._objectManager.DeleteObject(_rPoint.Guid);
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
                            _rPoint = null;
                        }
                        _rPoint = this._objectManager.CreateRenderPoint(pt1, this._simplePointSymbol, this._rootID);
                        if (this._isStarted)
                        {
                            this._polygon.ExteriorRing.UpdatePoint(this._polygon.ExteriorRing.PointCount - 1, pt1);
                            this._rPolygon.SetFdeGeometry(this._polygon);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Exemple #25
0
        void axRenderControl1_RcMouseClickSelect(object sender, Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseClickSelectEvent e)
        {
            if (e.pickResult.Type == gviObjectType.gviObjectLabel)
            {
                ILabelPickResult tlpr = e.pickResult as ILabelPickResult;
                gviObjectType    type = tlpr.Type;
                ILabel           fl   = tlpr.Label;
                MessageBox.Show("拾取到" + type + "类型,内容为" + fl.Text);
            }
            else if (e.pickResult.Type == gviObjectType.gviObjectRenderModelPoint)
            {
                IRenderModelPointPickResult tlpr = e.pickResult as IRenderModelPointPickResult;
                gviObjectType     type           = tlpr.Type;
                IRenderModelPoint fl             = tlpr.ModelPoint;
                MessageBox.Show("拾取到" + type + "类型,模型名称为" + fl.ModelName);
            }
            else if (e.pickResult.Type == gviObjectType.gviObjectRenderPoint)
            {
                IRenderPointPickResult tlpr = e.pickResult as IRenderPointPickResult;
                gviObjectType          type = tlpr.Type;
                IRenderPoint           fl   = tlpr.Point;
                MessageBox.Show("拾取到" + type + "类型,大小为" + fl.Symbol.Size);
            }
            else if (e.pickResult.Type == gviObjectType.gviObjectRenderPolyline)
            {
                IRenderPolylinePickResult tlpr = e.pickResult as IRenderPolylinePickResult;
                gviObjectType             type = tlpr.Type;
                IRenderPolyline           fl   = tlpr.Polyline;
                MessageBox.Show("拾取到" + type + "类型,GUID为" + fl.Guid);
            }
            else if (e.pickResult.Type == gviObjectType.gviObjectRenderPolygon)
            {
                IRenderPolygonPickResult tlpr = e.pickResult as IRenderPolygonPickResult;
                gviObjectType            type = tlpr.Type;
                IRenderPolygon           fl   = tlpr.Polygon;
                MessageBox.Show("拾取到" + type + "类型,GUID为" + fl.Guid);
            }
            else if (e.pickResult.Type == gviObjectType.gviObjectRenderPOI)
            {
                IRenderPOIPickResult tlpr = e.pickResult as IRenderPOIPickResult;
                gviObjectType        type = tlpr.Type;
                IRenderPOI           fl   = tlpr.POI;
                MessageBox.Show("拾取到" + type + "类型,名称为" + ((IPOI)fl.GetFdeGeometry()).Name);
            }
            else if (e.pickResult.Type == gviObjectType.gviObjectReferencePlane)
            {
                //ta = new TextAttribute();
                ta.TextSize = Convert.ToInt32(this.toolstripFontSize.Text.ToString());
                //  ta.TextColor = olec;
                IImage image     = null;
                IModel model     = null;
                string imageName = "";
                this.axRenderControl1.Utility.CreateFixedBillboard(label.Text, 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 GeometryFactoryClass();
                }
                fde_modelpoint = gfactory.CreateGeometry(gviGeometryType.gviGeometryModelPoint,
                                                         gviVertexAttribute.gviVertexAttributeZ) as IModelPoint;
                fde_modelpoint.SetCoords(e.intersectPoint.X, e.intersectPoint.Y, e.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(e.intersectPoint.Position, 100, angle);
            }
        }
        private void OnFinishedDraw()
        {
            if (this._drawTool != null && this._drawTool.GeoType == DrawType.SelectOne &&
                this._drawTool.GetSelectFeatureLayerPickResult() != null && this._drawTool.GetSelectPoint() != null)
            {
                try
                {
                    IFeatureLayer fl = this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer;
                    if (fl == null)
                    {
                        return;
                    }
                    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;
                    }
                    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 = d3.ObjectManager.CreateRenderPoint(intersectPoint, ips, d3.ProjectTree.RootID);
                    _rPoint.MinVisibleDistance = 499;
                    _rPoint.MaxVisibleDistance = 99999;

                    _particleEffect = d3.ObjectManager.CreateParticleEffect(d3.ProjectTree.RootID);
                    MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fl.FeatureClassId.ToString());
                    if (mc != null)
                    {
                        this.teCarrierType.Text = mc.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();
                }
                catch (Exception ex)
                {
                }
                finally
                {
                }
            }
        }
Exemple #27
0
        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;
                }
            }
        }
Exemple #28
0
        private void _3DControl_RcMouseClickSelect(object sender, Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseClickSelectEvent e)
        {
            try
            {
                if (e.intersectPoint != null)
                {
                    IPoint pt1 = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
                    pt1.X = e.intersectPoint.X;
                    pt1.Y = e.intersectPoint.Y;
                    pt1.Z = e.intersectPoint.Z;
                    if (e.eventSender == gviMouseSelectMode.gviMouseSelectClick)
                    {
                        if (!this._isStarted)
                        {
                            this.Close();
                            if (this._onStartDraw != null)
                            {
                                this._onStartDraw();
                            }
                            if (_polyline != null)
                            {
                                _polyline = null;
                            }
                            startPoint = pt1;
                            double radius = 0.0000001;
                            this._geo             = (startPoint as ITopologicalOperator2D).Buffer2D(radius, gviBufferStyle.gviBufferCapround);
                            _rPolygon             = this._3DControl.ObjectManager.CreateRenderPolygon(this._geo as IPolygon, this._surfaceSymbol, this._rootID);
                            _rPolygon.HeightStyle = this._heightStyle;

                            this._3DControl.HighlightHelper.SetRegion(this._geo);
                            this._3DControl.HighlightHelper.VisibleMask = 1;

                            _polyline = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;
                            _polyline.AppendPoint(pt1);
                            IPoint pt2 = pt1.Clone() as IPoint;
                            pt2.X += 0.000001;
                            _polyline.AppendPoint(pt2);
                            _rPolyline      = this._3DControl.ObjectManager.CreateRenderPolyline(_polyline, this._curveSymbol, this._3DControl.ProjectTree.RootID);
                            _label          = this._3DControl.ObjectManager.CreateLabel(this._3DControl.ProjectTree.RootID);
                            _label.Position = _polyline.Midpoint;
                            _label.Text     = _polyline.Length.ToString("0.00") + " 米";
                            ITextSymbol   ts = new TextSymbolClass();
                            TextAttribute ta = new TextAttribute();
                            ta.TextColor      = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16);
                            ta.TextSize       = SystemInfo.Instance.TextSize;
                            ts.TextAttribute  = ta;
                            _label.TextSymbol = ts;
                            this._isStarted   = true;
                            this._isFinished  = false;
                        }
                        else
                        {
                            //this.End();
                            this._isStarted  = false;
                            this._isFinished = true;

                            _polyline.UpdatePoint(1, pt1);
                            _rPolyline.SetFdeGeometry(_polyline);

                            _label.Position = _polyline.Midpoint;
                            _label.Text     = _polyline.Length.ToString("0.00") + " 米";


                            double radius = Math.Sqrt((startPoint.X - pt1.X) * (startPoint.X - pt1.X)
                                                      + (startPoint.Y - pt1.Y) * (startPoint.Y - pt1.Y) + (startPoint.Z - pt1.Z) * (startPoint.Z - pt1.Z));
                            this._geo = (startPoint as ITopologicalOperator2D).Buffer2D(radius, gviBufferStyle.gviBufferCapround);
                            _rPolygon.SetFdeGeometry(this._geo);
                            this._3DControl.HighlightHelper.SetRegion(this._geo);
                            this._geo = this._geo.Clone2(gviVertexAttribute.gviVertexAttributeNone);
                            if (this._onFinishedDraw != null)
                            {
                                this._onFinishedDraw();
                            }
                        }
                    }
                    else if (e.eventSender == gviMouseSelectMode.gviMouseSelectMove)
                    {
                        if (_rPoint != null)
                        {
                            this._objectManager.DeleteObject(_rPoint.Guid);
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
                            _rPoint = null;
                        }
                        _rPoint = this._objectManager.CreateRenderPoint(pt1, this._simplePointSymbol, this._rootID);
                        if (this._isStarted)
                        {
                            _polyline.UpdatePoint(1, pt1);
                            _rPolyline.SetFdeGeometry(_polyline);

                            _label.Position = _polyline.Midpoint;
                            _label.Text     = _polyline.Length.ToString("0.00") + " 米";

                            double radius = Math.Sqrt((startPoint.X - pt1.X) * (startPoint.X - pt1.X)
                                                      + (startPoint.Y - pt1.Y) * (startPoint.Y - pt1.Y) + (startPoint.Z - pt1.Z) * (startPoint.Z - pt1.Z));
                            this._geo = (startPoint as ITopologicalOperator2D).Buffer2D(radius, gviBufferStyle.gviBufferCapround);
                            _rPolygon.SetFdeGeometry(this._geo);
                            this._3DControl.HighlightHelper.SetRegion(this._geo);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Exemple #29
0
        void axRenderControl1_RcMouseClickSelect_Edit(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender)
        {
            this.axRenderControl1.FeatureManager.UnhighlightAll();

            // 置空
            currentGeometry = null;
            _buffer         = null;
            _featureLayer   = null;

            if (PickResult != null)
            {
                switch (PickResult.Type)
                {
                case gviObjectType.gviObjectFeatureLayer:
                {
                    IFeatureLayerPickResult flpr = PickResult as IFeatureLayerPickResult;
                    int fid = flpr.FeatureId;
                    //加载多FeatureClass时要每次重新获取
                    _featureClass = (IFeatureClass)fcGUIDMap[flpr.FeatureLayer.FeatureClassId];
                    _featureLayer = flpr.FeatureLayer;

                    IFdeCursor cursor = null;
                    try
                    {
                        _buffer = _featureClass.CreateRowBuffer();
                        QueryFilter filter = new QueryFilter();
                        //filter.AddSubField("oid");  //注意:StartEditFeatureGeometry里必须传入一个完整的rowbuffer,所以这里不能限定字段
                        filter.WhereClause = "oid =" + fid;
                        cursor             = _featureClass.Search(filter, false);
                        IRowBuffer row = null;
                        if ((row = cursor.NextRow()) != null)
                        {
                            _buffer = row as IRowBuffer;
                            int pos = _buffer.FieldIndex("Geometry");
                            oldfdeGeometry = _buffer.GetValue(pos) as IGeometry;
                        }
                    }
                    catch (COMException ex)
                    {
                        System.Diagnostics.Trace.WriteLine(ex.Message);
                    }
                    finally
                    {
                    }

                    this.axRenderControl1.FeatureManager.HighlightFeature(_featureClass, fid, System.Drawing.Color.Yellow);
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderModelPoint:
                {
                    IRenderModelPointPickResult flpr = PickResult as IRenderModelPointPickResult;
                    rmodelpoint     = flpr.ModelPoint;
                    currentGeometry = rmodelpoint;
                    oldfdeGeometry  = rmodelpoint.GetFdeGeometry();
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderPoint:
                {
                    IRenderPointPickResult flpr = PickResult as IRenderPointPickResult;
                    rpoint          = flpr.Point;
                    currentGeometry = rpoint;
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderPolyline:
                {
                    IRenderPolylinePickResult flpr = PickResult as IRenderPolylinePickResult;
                    rpolyline       = flpr.Polyline;
                    currentGeometry = rpolyline;
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderPolygon:
                {
                    IRenderPolygonPickResult flpr = PickResult as IRenderPolygonPickResult;
                    rpolygon        = flpr.Polygon;
                    currentGeometry = rpolygon;
                    EditGeometry();
                }
                break;
                }
            }
        }
Exemple #30
0
        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 != "PipeNode")
                {
                    XtraMessageBox.Show("您选中的不是管点设施,请选择管点设施。", "提示");
                    return;
                }
                DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fl.FeatureClassId.ToString());
                if (dffc == null || dffc.GetFeatureClass() == null)
                {
                    return;
                }
                IFeatureClass fc = dffc.GetFeatureClass();
                if (this._bFinished)
                {
                    Clear();
                    this._startFCGuid = fc.Guid.ToString();
                    this._startOid    = featureId;
                    this._bFinished   = false;

                    ILabel label = app.Current3DMapControl.ObjectManager.CreateLabel(app.Current3DMapControl.ProjectTree.RootID);
                    label.Text = "起点";
                    ITextSymbol ts = new TextSymbol();
                    ts.TextAttribute.TextSize  = SystemInfo.Instance.TextSize;
                    ts.TextAttribute.TextColor = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16);
                    label.TextSymbol           = ts;
                    label.Position             = this._drawTool.GetSelectPoint();
                    this._listRGuid.Add(label.Guid);
                }
                else
                {
                    if (this._startFCGuid == fc.Guid.ToString() && this._startOid == featureId)
                    {
                        XtraMessageBox.Show("您选中的是同一个管点设施。", "提示");
                        return;
                    }
                    this._bFinished = true;
                    ILabel label = app.Current3DMapControl.ObjectManager.CreateLabel(app.Current3DMapControl.ProjectTree.RootID);
                    label.Text = "终点";
                    ITextSymbol ts = new TextSymbol();
                    ts.TextAttribute.TextSize  = SystemInfo.Instance.TextSize;
                    ts.TextAttribute.TextColor = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16);
                    label.TextSymbol           = ts;
                    label.Position             = this._drawTool.GetSelectPoint();
                    this._listRGuid.Add(label.Guid);
                    if (this._startFCGuid != fc.Guid.ToString())
                    {
                        XtraMessageBox.Show("您选中的不是同一类管点设施。", "提示");
                        return;
                    }
                    else
                    {
                        WaitForm.Start("正在分析...", "请稍后");
                        FacClassReg reg = FacilityInfoService.GetFacClassRegByFeatureClassID(fc.Guid.ToString());
                        if (reg == null)
                        {
                            return;
                        }
                        TopoClass tc = FacilityInfoService.GetTopoClassByFacClassCode(reg.FacClassCode);
                        if (tc == null)
                        {
                            return;
                        }
                        TopoNetwork net = tc.GetNetwork();
                        if (net == null)
                        {
                            XtraMessageBox.Show("构建拓扑网络失败!", "提示");
                            return;
                        }
                        else
                        {
                            string        startId = this._startFCGuid + "_" + this._startOid.ToString();
                            string        endId   = fc.Guid.ToString() + "_" + featureId.ToString();
                            List <string> path;
                            double        shortestLength = net.SPFA(startId, endId, out path);
                            if ((shortestLength > 0.0 && shortestLength != double.MaxValue) || (path != null && path.Count > 0))
                            {
                                List <IPoint> listPt = new List <IPoint>();
                                foreach (string nodeId in path)
                                {
                                    int              index    = nodeId.LastIndexOf("_");
                                    string           fcguid   = nodeId.Substring(0, index);
                                    string           oid      = nodeId.Substring(index + 1, nodeId.Length - index - 1);
                                    DF3DFeatureClass dffcTemp = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fcguid);
                                    if (dffcTemp == null || dffcTemp.GetFeatureClass() == null)
                                    {
                                        continue;
                                    }
                                    if (dffcTemp.GetFacilityClassName() != "PipeNode")
                                    {
                                        continue;
                                    }
                                    IQueryFilter filter = new QueryFilter();
                                    filter.WhereClause = "oid = " + oid;
                                    filter.SubFields   = "oid,Shape";
                                    IRowBuffer row    = null;
                                    IFdeCursor cursor = null;
                                    try
                                    {
                                        cursor = dffcTemp.GetFeatureClass().Search(filter, false);
                                        while ((row = cursor.NextRow()) != null)
                                        {
                                            if (!row.IsNull(1) && (row.GetValue(1) is IGeometry))
                                            {
                                                IGeometry geo = row.GetValue(1) as IGeometry;
                                                switch (geo.GeometryType)
                                                {
                                                case gviGeometryType.gviGeometryPoint:
                                                    IPoint pt = geo as IPoint;
                                                    pt.Z = pt.Z + 1;
                                                    listPt.Add(pt);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    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;
                                        }
                                    }
                                }
                                IPolyline polyline = (new GeometryFactory()).CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;
                                foreach (IPoint pt in listPt)
                                {
                                    ISimplePointSymbol ps = new SimplePointSymbol();
                                    ps.Size      = 5;
                                    ps.Style     = gviSimplePointStyle.gviSimplePointCircle;
                                    ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                                    IRenderPoint rp = app.Current3DMapControl.ObjectManager.CreateRenderPoint(pt, ps, app.Current3DMapControl.ProjectTree.RootID);
                                    rp.Glow(5000);
                                    polyline.AppendPoint(pt);
                                    this._listRGuid.Add(rp.Guid);
                                }
                                ICurveSymbol cs = new CurveSymbol();
                                cs.Color = Convert.ToUInt32(SystemInfo.Instance.LineColor, 16);
                                cs.Width = -5;
                                IRenderPolyline rpl = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                                rpl.Glow(5000);
                                this._listRGuid.Add(rpl.Guid);
                            }
                            else
                            {
                                XtraMessageBox.Show("两点不连通!", "提示");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("分析出错!", "提示");
            }
            finally
            {
                WaitForm.Stop();
            }
        }