Exemplo n.º 1
0
        public override void OnDblClick()
        {
            IGeometry pGeometry;

            if (m_newBezierCurveFeedback != null)
            {
                m_newBezierCurveFeedback.AddPoint(fPoint);
            }
            pGeometry = m_newBezierCurveFeedback.Stop();
            IActiveView pActiveView = m_hookHelper.ActiveView;

            m_newBezierCurveFeedback = null;
            IPolyline polyline = new PolylineClass();

            polyline = (IPolyline)pGeometry;
            //polyline = DataEditCommon.PDFX(polyline, "Bezier");
            IPointCollection pointCollection = (IPointCollection)polyline;

            if (pointCollection.PointCount < 4)
            {
                MessageBox.Show("¹Ø¼üµã²»ÄÜСÓÚ3¸ö£¡");
                return;
            }
            //DrawFeatureByShape(m_pCurrentLayer, pGeometry);
            CollapsePillarsEntering form = new CollapsePillarsEntering(pointCollection);

            form.ShowDialog();
        }
Exemplo n.º 2
0
        public override void OnDblClick()
        {
            IGeometry pGeometry;

            pGeometry = m_newBezierCurveFeedback.Stop();
            IActiveView pActiveView = m_hookHelper.ActiveView;

            m_newBezierCurveFeedback = null;
            IFeatureLayer pFeatureLayer = m_pCurrentLayer as IFeatureLayer;
            IPolyline     polyline      = new PolylineClass();

            polyline = (IPolyline)pGeometry;
            IFeature pFeature = DataEditCommon.CreateUndoRedoFeature(pFeatureLayer, polyline);

            m_hookHelper.FocusMap.SelectFeature(pFeatureLayer, pFeature);
            m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewBackground, null, null);
        }
Exemplo n.º 3
0
        //更新m_pBezierCurveFeed
        public void UpdataBezierCurveFeed(IMapControl2 MapControl, ref IArray pUndoArray)
        {
            if (m_pBezierCurveFeed != null)
            {
                m_pBezierCurveFeed.Stop();
            }

            m_pActiveView.PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null);
            m_pActiveView.ScreenDisplay.UpdateWindow();

            m_pBezierCurveFeed.Start((IPoint)m_pUndoArray.get_Element(0));
            CommonFunction.DrawPointSMSSquareSymbol(MapControl, (IPoint)pUndoArray.get_Element(0));
            for (int i = 0; i < pUndoArray.Count; i++)
            {
                m_pBezierCurveFeed.AddPoint((IPoint)pUndoArray.get_Element(i));
                CommonFunction.DrawPointSMSSquareSymbol(MapControl, (IPoint)pUndoArray.get_Element(i));
            }
        }
Exemplo n.º 4
0
        private void EndDrawBezierCurve()
        {
            IGeometry        pGeom = null;
            IPolyline        pPolyline;
            IPolygon         pPolygon;
            IPointCollection pPointCollection;

            if (m_bInUse)
            {
                switch (((IFeatureLayer)m_CurrentLayer).FeatureClass.ShapeType)
                {
                case  esriGeometryType.esriGeometryPolyline:
                    m_pBezierCurveFeed = (INewBezierCurveFeedback)m_pFeedback;
                    m_pFeedback.MoveTo((IPoint)m_pUndoArray.get_Element(m_pUndoArray.Count - 1));;
                    pPolyline = m_pBezierCurveFeed.Stop();

                    ((ITopologicalOperator)pPolyline).Simplify();

                    pPointCollection = (IPointCollection)pPolyline;
                    if (pPointCollection.PointCount < 2)
                    {
                        MessageBox.Show("线上必须有两个点!");
                    }
                    else
                    {
                        pGeom = (IGeometry)pPointCollection;
                    }
                    break;

                case  esriGeometryType.esriGeometryPolygon:
                    m_pBezierCurveFeed = (INewBezierCurveFeedback)m_pFeedback;
                    m_pBezierCurveFeed.AddPoint((IPoint)m_pUndoArray.get_Element(0));
                    pPolyline = m_pBezierCurveFeed.Stop();
                    pPolygon  = CommonFunction.PolylineToPolygon((IPolyline)pPolyline);

                    ((ITopologicalOperator)pPolygon).Simplify();

                    pPointCollection = (IPointCollection)pPolygon;
                    pGeom            = (IGeometry)pPointCollection;

                    if (pPointCollection.PointCount < 3)
                    {
                        MessageBox.Show("面上必须有三个点!");
                    }
                    else
                    {
                        pGeom = (IGeometry)pPointCollection;
                    }
                    break;

                default:
                    break;
                }                //end switch

                m_pEnvelope = pGeom.Envelope;
                if (m_pEnvelope != null && !m_pEnvelope.IsEmpty)
                {
                    m_pEnvelope.Expand(10, 10, false);
                }
                ;

                CommonFunction.CreateFeature(m_App.Workbench, pGeom, m_FocusMap, m_CurrentLayer);
            }

            Reset();            //复位

            m_bInUse = false;
        }