コード例 #1
0
ファイル: PolygonMapper.cs プロジェクト: lzaslav/ISOv4Plugin
        //Version 3 defines a multipolygon by a single PLN with multiple exterior linestrings and interior rings in order below their exterior
        private ISOPolygon ExportVersion3Polygon(List <Polygon> adaptPolygons, ISOPolygonType polygonType)
        {
            ISOPolygon isoPolygon = new ISOPolygon(TaskDataMapper.Version);

            if ((int)polygonType < 9)
            {
                isoPolygon.PolygonType = polygonType;
            }
            else
            {
                isoPolygon.PolygonType = ISOPolygonType.Other; //Version 3 stops at 8/Other
            }

            isoPolygon.PolygonDesignator = adaptPolygons.First().Id.ToString();
            LineStringMapper lsgMapper = new LineStringMapper(TaskDataMapper);

            isoPolygon.LineStrings = new List <ISOLineString>();
            foreach (Polygon adaptPolygon in adaptPolygons)
            {
                if (adaptPolygon.ExteriorRing != null)
                {
                    isoPolygon.LineStrings.Add(lsgMapper.ExportLinearRing(adaptPolygon.ExteriorRing, ISOLineStringType.PolygonExterior));
                }
                if (adaptPolygon.InteriorRings != null)
                {
                    foreach (LinearRing interiorRing in adaptPolygon.InteriorRings)
                    {
                        isoPolygon.LineStrings.Add(lsgMapper.ExportLinearRing(interiorRing, ISOLineStringType.PolygonInterior));
                    }
                }
            }
            return(isoPolygon);
        }
コード例 #2
0
ファイル: PolygonMapper.cs プロジェクト: ysykhmd/ISOv4Plugin
        public ISOPolygon ExportPolygon(Polygon adaptPolygon, ISOPolygonType polygonType)
        {
            ISOPolygon ISOPolygon = new ISOPolygon();

            ISOPolygon.PolygonType       = polygonType;
            ISOPolygon.PolygonDesignator = adaptPolygon.Id.ToString();

            LineStringMapper lsgMapper = new LineStringMapper(TaskDataMapper);

            ISOPolygon.LineStrings = new List <ISOLineString>();
            ISOPolygon.LineStrings.Add(lsgMapper.ExportLinearRing(adaptPolygon.ExteriorRing, ISOLineStringType.PolygonExterior));
            foreach (LinearRing interiorRing in adaptPolygon.InteriorRings)
            {
                ISOPolygon.LineStrings.Add(lsgMapper.ExportLinearRing(interiorRing, ISOLineStringType.PolygonInterior));
            }

            return(ISOPolygon);
        }