Пример #1
0
        private void GetPolygonOfArea_MultiPatch(List <Core.Data.Polygon> polygons, IndexRecord rec)
        {
            //NOTE: at this point we ignore the type (outer ring, inner ring
            //this is not correct and should be implemented correctly
            //suggestion: Add a property Exclude to Framework.Data.Polygon

            _shpFileStream.Position = rec.Offset + 8 + 36; //skip bounding box and shapetype
            int numberOfPolygons = GetInt32(_shpFileStream, true);
            int numberOfPoints   = GetInt32(_shpFileStream, true);

            int[] pointIndexFirstPointPerPolygon = new int[numberOfPolygons];
            int[] partsTypePerPolygon            = new int[numberOfPolygons];
            for (int i = 0; i < numberOfPolygons; i++)
            {
                pointIndexFirstPointPerPolygon[i] = GetInt32(_shpFileStream, true);
            }
            for (int i = 0; i < numberOfPolygons; i++)
            {
                partsTypePerPolygon[i] = GetInt32(_shpFileStream, true);
            }
            for (int i = 0; i < numberOfPolygons; i++)
            {
                Core.Data.Polygon pg = new Core.Data.Polygon();
                int pointCount;
                if (i < numberOfPolygons - 1)
                {
                    pointCount = pointIndexFirstPointPerPolygon[i + 1] - pointIndexFirstPointPerPolygon[i];
                }
                else
                {
                    pointCount = numberOfPoints - pointIndexFirstPointPerPolygon[i];
                }
                for (int p = 0; p < pointCount; p++)
                {
                    double x = GetDouble(_shpFileStream, true);
                    double y = GetDouble(_shpFileStream, true);
                    if (_coordType == CoordType.DutchGrid)
                    {
                        pg.AddLocation(Utils.Calculus.LocationFromRD(x, y));
                    }
                    else
                    {
                        pg.AddLocation(new Core.Data.Location(y, x));
                    }
                }
                polygons.Add(pg);
            }
        }
Пример #2
0
        private void GetPolygonOfArea_Polygon(List <Core.Data.Polygon> polygons, IndexRecord rec)
        {
            _shpFileStream.Position = rec.Offset + 8 + 36; //skip bounding box and shapetype
            int numberOfPolygons = GetInt32(_shpFileStream, true);
            int numberOfPoints   = GetInt32(_shpFileStream, true);

            int[] pointIndexFirstPointPerPolygon = new int[numberOfPolygons];
            for (int i = 0; i < numberOfPolygons; i++)
            {
                pointIndexFirstPointPerPolygon[i] = GetInt32(_shpFileStream, true);
            }
            for (int i = 0; i < numberOfPolygons; i++)
            {
                Core.Data.Polygon pg = new Core.Data.Polygon();
                int pointCount;
                if (i < numberOfPolygons - 1)
                {
                    pointCount = pointIndexFirstPointPerPolygon[i + 1] - pointIndexFirstPointPerPolygon[i];
                }
                else
                {
                    pointCount = numberOfPoints - pointIndexFirstPointPerPolygon[i];
                }
                for (int p = 0; p < pointCount; p++)
                {
                    double x = GetDouble(_shpFileStream, true);
                    double y = GetDouble(_shpFileStream, true);
                    if (_coordType == CoordType.DutchGrid)
                    {
                        pg.AddLocation(Utils.Calculus.LocationFromRD(x, y));
                    }
                    else
                    {
                        pg.AddLocation(new Core.Data.Location(y, x));
                    }
                }
                polygons.Add(pg);
            }
        }
Пример #3
0
        private void GetPolygonOfArea_MultiPatch(List<Core.Data.Polygon> polygons, IndexRecord rec)
        {
            //NOTE: at this point we ignore the type (outer ring, inner ring
            //this is not correct and should be implemented correctly
            //suggestion: Add a property Exclude to Framework.Data.Polygon

            _shpFileStream.Position = rec.Offset + 8 + 36; //skip bounding box and shapetype
            int numberOfPolygons = GetInt32(_shpFileStream, true);
            int numberOfPoints = GetInt32(_shpFileStream, true);
            int[] pointIndexFirstPointPerPolygon = new int[numberOfPolygons];
            int[] partsTypePerPolygon = new int[numberOfPolygons];
            for (int i = 0; i < numberOfPolygons; i++)
            {
                pointIndexFirstPointPerPolygon[i] = GetInt32(_shpFileStream, true);
            }
            for (int i = 0; i < numberOfPolygons; i++)
            {
                partsTypePerPolygon[i] = GetInt32(_shpFileStream, true);
            }
            for (int i = 0; i < numberOfPolygons; i++)
            {
                Core.Data.Polygon pg = new Core.Data.Polygon();
                int pointCount;
                if (i < numberOfPolygons - 1)
                {
                    pointCount = pointIndexFirstPointPerPolygon[i + 1] - pointIndexFirstPointPerPolygon[i];
                }
                else
                {
                    pointCount = numberOfPoints - pointIndexFirstPointPerPolygon[i];
                }
                for (int p = 0; p < pointCount; p++)
                {
                    double x = GetDouble(_shpFileStream, true);
                    double y = GetDouble(_shpFileStream, true);
                    if (_coordType == CoordType.DutchGrid)
                    {
                        pg.AddLocation(Utils.Calculus.LocationFromRD(x, y));
                    }
                    else
                    {
                        pg.AddLocation(new Core.Data.Location(y, x));
                    }
                }
                polygons.Add(pg);
            }
        }
Пример #4
0
 private void GetPolygonOfArea_Polygon(List<Core.Data.Polygon> polygons, IndexRecord rec)
 {
     _shpFileStream.Position = rec.Offset + 8 + 36; //skip bounding box and shapetype
     int numberOfPolygons = GetInt32(_shpFileStream, true);
     int numberOfPoints = GetInt32(_shpFileStream, true);
     int[] pointIndexFirstPointPerPolygon = new int[numberOfPolygons];
     for (int i = 0; i < numberOfPolygons; i++)
     {
         pointIndexFirstPointPerPolygon[i] = GetInt32(_shpFileStream, true);
     }
     for (int i = 0; i < numberOfPolygons; i++)
     {
         Core.Data.Polygon pg = new Core.Data.Polygon();
         int pointCount;
         if (i < numberOfPolygons - 1)
         {
             pointCount = pointIndexFirstPointPerPolygon[i + 1] - pointIndexFirstPointPerPolygon[i];
         }
         else
         {
             pointCount = numberOfPoints - pointIndexFirstPointPerPolygon[i];
         }
         for (int p = 0; p < pointCount; p++)
         {
             double x = GetDouble(_shpFileStream, true);
             double y = GetDouble(_shpFileStream, true);
             if (_coordType == CoordType.DutchGrid)
             {
                 pg.AddLocation(Utils.Calculus.LocationFromRD(x,y));
             }
             else
             {
                 pg.AddLocation(new Core.Data.Location(y, x));
             }
         }
         polygons.Add(pg);
     }
 }