Пример #1
0
        public SurfaceWindow1()
        {
            try
            {
                InitializeComponent();
                AddWindowAvailabilityHandlers();
            }
            catch (NullReferenceException i)
            {
                MessageBoxResult result = MessageBox.Show("InitError", i.Message);
            }
            // Add handlers for window availability events

            GMPolygon = new GISMapPolygon(this);

            MyMapMode = "ArialWithLabels";
            myMap.Children.Add(PushPinLayer);   // add the polygon layer to the map
            myMap.Children.Add(PolygonLayer);
            GISInkCanvas.DefaultDrawingAttributes.Color = Colors.Red;
            GISInkCanvas.GotTouchCapture += new EventHandler <TouchEventArgs>(GISInkCanvas_TouchDown);
            GISInkCanvas.DefaultDrawingAttributes.Height = 15;
            GISInkCanvas.DefaultDrawingAttributes.Width  = 15;
            InkLayer.Children.Add(GISInkCanvas);


            myMap.Focus();


            StartFSWatcher();
        }
Пример #2
0
        //used for plotting the points for drawing a polygon.
        public void AddPoint(Location MapPointLocation, SurfaceWindow1 mapwindow)
        {
            if (AddPolyPoint)
            {
                GISMapPoint GMPoint = new GISMapPoint();
                GMPoint.PointLocation = MapPointLocation;
                mapwindow.PolyPointLayer.AddChild(GMPoint.pointrect, MapPointLocation);
                MapPoints.Add(GMPoint);
                GMPoint.pointrect.TouchDown += new EventHandler <TouchEventArgs>(Point_TouchDown);
            }

            if (SelectedPoint != null)
            {
                GISMapPolygon.FindPoint(SelectedPoint, mapwindow);
            }
        }
Пример #3
0
        /*
         * this is where we tried to make it so that a selected point is able to be moved. but we only want the points that are connected to a SelectedPolygon to move
         * which leads us to the commented out methods and errors in the Polygon_TouchDown part and the AddPoint part.
         */

        internal static void MovePoint(GISMapPoint GMPoint, GISMapPolygon Polygon, GISMapPoint SelectedPoint, SurfaceWindow1 mapwindow)
        {
            GMPoint.PointLocation = SelectedPoint.PointLocation;
            Polygon.AddPolygon(mapwindow);
        }
Пример #4
0
 /*
  * this is where we tried to make it so that a selected point is able to be moved. but we only want the points that are connected to a SelectedPolygon to move
  * which leads us to the commented out methods and errors in the Polygon_TouchDown part and the AddPoint part.
  */
 internal static void MovePoint(GISMapPoint GMPoint, GISMapPolygon Polygon, GISMapPoint SelectedPoint, SurfaceWindow1 mapwindow)
 {
     GMPoint.PointLocation = SelectedPoint.PointLocation;
     Polygon.AddPolygon(mapwindow);
 }
        public SurfaceWindow1()
        {
            try
            {
                InitializeComponent();
                AddWindowAvailabilityHandlers();
            }
            catch (NullReferenceException i)
            {
                MessageBoxResult result = MessageBox.Show("InitError", i.Message);
            }
            // Add handlers for window availability events

            GMPolygon = new GISMapPolygon(this);

            MyMapMode = "ArialWithLabels";
            myMap.Children.Add(PushPinLayer);   // add the polygon layer to the map
            myMap.Children.Add(PolygonLayer);
            GISInkCanvas.DefaultDrawingAttributes.Color = Colors.Red;
            GISInkCanvas.GotTouchCapture+=new EventHandler<TouchEventArgs>(GISInkCanvas_TouchDown);
            GISInkCanvas.DefaultDrawingAttributes.Height = 15;
            GISInkCanvas.DefaultDrawingAttributes.Width = 15;
            InkLayer.Children.Add(GISInkCanvas);

            myMap.Focus();

            StartFSWatcher();
        }
Пример #6
0
        public void WriteXMLData(string Filename, Location Center, double ZoomLevel, GISMapPolygon IO_MapPolygons)
        {
            XmlDocument xmlDoc      = new XmlDocument();
            XmlNode     GISDataNode = xmlDoc.CreateElement("GISData");

            xmlDoc.AppendChild(GISDataNode);

            XmlNode      ImageNode          = xmlDoc.CreateElement("GISImage");
            XmlAttribute ImageFileAttribute = xmlDoc.CreateAttribute("file");

            ImageFileAttribute.Value = Filename + ".png";
            ImageNode.Attributes.Append(ImageFileAttribute);

            XmlNode      LocationNode     = xmlDoc.CreateElement("MapLoc");
            XmlAttribute MapLatAttribute  = xmlDoc.CreateAttribute("lat");
            XmlAttribute MapLongAttribute = xmlDoc.CreateAttribute("long");
            XmlAttribute MapCameraLevel   = xmlDoc.CreateAttribute("alt");

            MapLatAttribute.Value  = Center.Latitude.ToString();
            MapLongAttribute.Value = Center.Longitude.ToString();
            MapCameraLevel.Value   = ZoomLevel.ToString();


            XmlNode PolyNode = xmlDoc.CreateElement("Polygons");

            foreach (MapPolygon MapPoly in IO_MapPolygons.MapPolygons)
            {
                XmlNode      PolygonNode = xmlDoc.CreateElement("Polygon");
                XmlAttribute PolyName    = xmlDoc.CreateAttribute("name");
                PolyName.Value = MapPoly.Name;
                PolygonNode.Attributes.Append(PolyName);

                foreach (Location Point in MapPoly.Locations)
                {
                    XmlElement   PolyPoint = xmlDoc.CreateElement("Point");
                    XmlAttribute PointLat  = xmlDoc.CreateAttribute("lat");
                    XmlAttribute PointLong = xmlDoc.CreateAttribute("long");
                    PointLat.Value  = Point.Latitude.ToString();
                    PointLong.Value = Point.Longitude.ToString();

                    PolyPoint.Attributes.Append(PointLat);
                    PolyPoint.Attributes.Append(PointLong);

                    PolygonNode.AppendChild(PolyPoint);
                }
                PolyNode.AppendChild(PolygonNode);
            }

            LocationNode.Attributes.Append(MapLatAttribute);
            LocationNode.Attributes.Append(MapLongAttribute);
            LocationNode.Attributes.Append(MapCameraLevel);

            GISDataNode.AppendChild(LocationNode);
            GISDataNode.AppendChild(ImageNode);
            GISDataNode.AppendChild(PolyNode);


            try
            {
                xmlDoc.Save(Filename + ".xml");
            }
            catch
            {
                MessageBoxResult result = MessageBox.Show("XMLWriteError", "XML Write Error");
            }
        }
Пример #7
0
        public void WriteXMLData(string Filename, Location Center, double ZoomLevel, GISMapPolygon IO_MapPolygons)
        {
            XmlDocument xmlDoc = new XmlDocument();
            XmlNode GISDataNode = xmlDoc.CreateElement("GISData");
            xmlDoc.AppendChild(GISDataNode);

            XmlNode ImageNode = xmlDoc.CreateElement("GISImage");
            XmlAttribute ImageFileAttribute = xmlDoc.CreateAttribute("file");
            ImageFileAttribute.Value = Filename + ".png";
            ImageNode.Attributes.Append(ImageFileAttribute);

            XmlNode LocationNode = xmlDoc.CreateElement("MapLoc");
            XmlAttribute MapLatAttribute = xmlDoc.CreateAttribute("lat");
            XmlAttribute MapLongAttribute = xmlDoc.CreateAttribute("long");
            XmlAttribute MapCameraLevel = xmlDoc.CreateAttribute("alt");

            MapLatAttribute.Value = Center.Latitude.ToString();
            MapLongAttribute.Value = Center.Longitude.ToString();
            MapCameraLevel.Value = ZoomLevel.ToString();

            XmlNode PolyNode = xmlDoc.CreateElement("Polygons");

            foreach (MapPolygon MapPoly in IO_MapPolygons.MapPolygons)
            {

                XmlNode PolygonNode = xmlDoc.CreateElement("Polygon");
                XmlAttribute PolyName = xmlDoc.CreateAttribute("name");
                PolyName.Value = MapPoly.Name;
                PolygonNode.Attributes.Append(PolyName);

                foreach (Location Point in MapPoly.Locations)
                {
                    XmlElement PolyPoint = xmlDoc.CreateElement("Point");
                    XmlAttribute PointLat = xmlDoc.CreateAttribute("lat");
                    XmlAttribute PointLong = xmlDoc.CreateAttribute("long");
                    PointLat.Value = Point.Latitude.ToString();
                    PointLong.Value = Point.Longitude.ToString();

                    PolyPoint.Attributes.Append(PointLat);
                    PolyPoint.Attributes.Append(PointLong);

                    PolygonNode.AppendChild(PolyPoint);
                }
                PolyNode.AppendChild(PolygonNode);
            }

            LocationNode.Attributes.Append(MapLatAttribute);
            LocationNode.Attributes.Append(MapLongAttribute);
            LocationNode.Attributes.Append(MapCameraLevel);

            GISDataNode.AppendChild(LocationNode);
            GISDataNode.AppendChild(ImageNode);
            GISDataNode.AppendChild(PolyNode);

            try
            {
                xmlDoc.Save(Filename + ".xml");
            }
            catch
            {
                MessageBoxResult result = MessageBox.Show("XMLWriteError", "XML Write Error");
            }
        }