Ejemplo n.º 1
0
        /// <summary>
        /// Insers part to polygon based on given rectange
        /// </summary>
        private void InsertPart(MapWinGIS.Shape shp, double xMin, double xMax, double yMin, double yMax)
        {
            int numParts = shp.NumParts;

            shp.InsertPart(shp.numPoints, ref numParts);

            // to left
            int index = shp.numPoints;

            MapWinGIS.Point pnt = new MapWinGIS.Point();
            pnt.x = xMin; pnt.y = yMax;
            shp.InsertPoint(pnt, ref index); index++;

            pnt   = new MapWinGIS.Point();
            pnt.x = xMax; pnt.y = yMax;
            shp.InsertPoint(pnt, ref index); index++;

            pnt   = new MapWinGIS.Point();
            pnt.x = xMax; pnt.y = yMin;
            shp.InsertPoint(pnt, ref index); index++;

            pnt   = new MapWinGIS.Point();
            pnt.x = xMin; pnt.y = yMin;
            shp.InsertPoint(pnt, ref index); index++;

            pnt   = new MapWinGIS.Point();
            pnt.x = xMin; pnt.y = yMax;
            shp.InsertPoint(pnt, ref index); index++;

            if (!shp.get_PartIsClockWise(0))
            {
                bool val = shp.ReversePointsOrder(0);
                if (!val)
                {
                    System.Diagnostics.Debug.Print("CCW");
                }
            }

            if (!shp.get_PartIsClockWise(0))
            {
                System.Diagnostics.Debug.Print("CCW");
            }
        }