Esempio n. 1
0
        //构造偏移点法
        private void button7_Click(object sender, EventArgs e)
        {
            delFeature("point");
            IPoint[] points = new IPoint[4];
            for (int i = 0; i < 4; i++)
            {
                points[i] = new PointClass();
            }
            points[0].PutCoords(0, 0);
            points[1].PutCoords(10, 0);
            points[2].PutCoords(20, 0);
            points[3].PutCoords(30, 0);
            IPointCollection polyline      = new Polyline();
            IGeometryBridge  geometryBride = new GeometryEnvironmentClass();

            geometryBride.AddPoints(polyline as IPointCollection4, ref points);
            IConstructPoint constructionPointRight = new PointClass();
            IConstructPoint constructionPointLeft  = new PointClass();

            constructionPointRight.ConstructOffset(polyline as ICurve, esriSegmentExtension.esriNoExtension, 15, false, 5);
            IPoint outPutPoint1 = constructionPointRight as IPoint;

            constructionPointLeft.ConstructOffset(polyline as ICurve, esriSegmentExtension.esriNoExtension, 1, false, -5);
            IPoint outPutPoint2 = constructionPointLeft as IPoint;

            addFeature("point", points[0]);
            addFeature("point", points[1]);
            addFeature("point", points[2]);
            addFeature("point", points[3]);
            addFeature("point", outPutPoint1);
            addFeature("point", outPutPoint2);
            axMapControl1.Refresh();
        }
Esempio n. 2
0
        private void queryPointsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IPoint point1 = new PointClass();

            point1.PutCoords(10, 10);
            IPoint point2 = new PointClass();

            point2.PutCoords(20, 20);
            IPoint[] inputPointArray = new IPoint[2];
            inputPointArray[0] = point1;
            inputPointArray[1] = point2;
            IPointCollection4 pointCollection = new MultipointClass();
            IGeometryBridge   geometryBridge  = new GeometryEnvironmentClass();

            geometryBridge.AddPoints(pointCollection, ref inputPointArray);

            int index = 0;

            IPoint[] outputPointArray = new IPoint[2];
            for (int i = 0; i < outputPointArray.Length; i++)
            {
                outputPointArray[i] = new PointClass();
            }
            pointCollection.QueryPoint(0, outputPointArray[0]);
            //geometryBridge.QueryPoints(pointCollection, index, ref outputPointArray);
            for (int i = 0; i < outputPointArray.Length; i++)
            {
                IPoint currentPoint = outputPointArray[i];
                if (currentPoint.IsEmpty == true)
                {
                    System.Windows.Forms.MessageBox.Show("Current point = null");
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("X = " + currentPoint.X + ", Y = " + currentPoint.Y);
                }
            }
        }