Exemplo n.º 1
0
        public List <SafeZone> ParseTube()
        {
            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(nameOfFile);
            XmlElement xRoot = xDoc.DocumentElement;

            XmlNode currentNode = null;

            //currentNode = GetNode(xRoot, "fme:featureMember");
            foreach (XmlNode bigNode in xRoot.ChildNodes)
            {
                if (bigNode.Name == "fme:featureMember")
                {
                    currentNode = bigNode;
                    currentNode = currentNode.FirstChild;
                    currentNode = GetNode(currentNode, "fme:surfaceProperty");
                    currentNode = GetNode(currentNode, "gml:Surface");
                    currentNode = GetNode(currentNode, "gml:patches");
                    currentNode = GetNode(currentNode, "gml:PolygonPatch");
                    currentNode = GetNode(currentNode, "gml:exterior");
                    currentNode = GetNode(currentNode, "gml:LinearRing");
                    currentNode = GetNode(currentNode, "gml:posList");

                    string        beforeParsing = currentNode.InnerText;
                    List <string> strList       = beforeParsing.Split(' ').ToList();

                    int      i        = 0;
                    SafeZone safeZone = new SafeZone();

                    double x = -1;
                    double y = -1;
                    foreach (string str in strList)
                    {
                        if (i++ % 2 == 0)
                        {
                            x = Convert.ToDouble(str);
                        }
                        else
                        {
                            y = Convert.ToDouble(str);
                        }

                        if (x > 0 && y > 0)
                        {
                            Dot dot = new Dot(i, x, y, safeZone);
                            dot.Lat  = x;
                            dot.Long = y;
                            safeZone.AddDot(dot);
                            x = -1;
                            y = -1;
                        }
                    }

                    safeZones.Add(safeZone);
                }
            }
            return(safeZones);
        }
Exemplo n.º 2
0
 public void Check(SafeZone sz, Parcel pl)
 {
     foreach (Line ln in sz.GetLines())
     {
         foreach (Line tn in pl.GetLines())
         {
             if (CheckLine(ln, tn))
             {
                 pl.isCrossed = true;
                 break;
             }
         }
     }
 }
Exemplo n.º 3
0
        public void showSafeZone(GMapControl gMapCon, Color clr, SafeZone sz)
        {
            GMapOverlay        polygons = new GMapOverlay("polygons");
            List <PointLatLng> points   = new List <PointLatLng>();

            foreach (Dot dt in sz.dots)
            {
                points.Add(new PointLatLng(dt.x, dt.y));
            }

            GMapPolygon polygon = new GMapPolygon(points, "safeZone");

            polygon.Fill   = new SolidBrush(Color.FromArgb(50, clr));
            polygon.Stroke = new Pen(clr, 1);
            polygons.Polygons.Add(polygon);
            polygon.IsHitTestVisible = true;
            gMapCon.Overlays.Add(polygons);
        }