예제 #1
0
        private static RegionInternal ConvertOSMMultyPolToInternal(OSMRegionExternalMultyPolygon OSMMP)
        {
            var polygons = OSMMP.geojson.coordinates.Select(
                polygon => polygon.Select(outline =>
                                          outline.Select(coordList => ListToPoint(
                                                             coordList)).ToList()).ToList()).ToList();

            var regInternal = new RegionInternal(OSMMP.display_name, polygons);

            return(regInternal);
        }
예제 #2
0
        private static RegionInternal ConvertOSMPolToInternal(OSMRegionExternalPolygon OSMP)
        {
            var polygon = OSMP.geojson.coordinates.Select(outline =>
                                                          outline.Select(coordList => ListToPoint(
                                                                             coordList)).ToList()).ToList();

            List <List <List <PointF> > > polygons = new List <List <List <PointF> > >()
            {
                polygon
            };


            var regInternal = new RegionInternal(OSMP.display_name, polygons);

            return(regInternal);
        }
예제 #3
0
        public static RegionInternal ProcessMessage(string msg)
        {
            RegionInternal result;
            var            RegList = JsonConvert.DeserializeObject <IList <OSMTypeOnly> >(msg);
            var            RegType = RegList[0].geojson.type;

            if (RegType == "Polygon")
            {
                result = ConvertOSMPolToInternal(JsonConvert.DeserializeObject <IList <OSMRegionExternalPolygon> >(msg)[0]);
            }
            else if (RegType == "MultiPolygon")
            {
                result = ConvertOSMMultyPolToInternal(JsonConvert.DeserializeObject <IList <OSMRegionExternalMultyPolygon> >(msg)[0]);
            }
            else
            {
                result = new RegionInternal();
            }

            return(result);
        }