public void Polygon_TouchDown(object sender, TouchEventArgs e)
        {
            MapPolygon TouchPolygon = sender as MapPolygon;    // The polygon that was actually touched.

            if (TouchPolygon.Equals(SelectedPolygon))          // if it's the same as 'selectedpolygon' then it's already selected
            {
                surfacewindow.MapPolygon.DeselectAll();        // deselect the polygon
            }
            else
            {
                //SelectedPolygon.Equals(TouchPolygon);

                surfacewindow.MapPolygon.DeselectAll();        // clear out the selection

                UpdateColors(TouchPolygon);                    // color the new polygon


                surfacewindow.MapPolygon.GMPoint.AddPolyPoint = true;       // set the draw point mode to true

                foreach (Location MapPoints in TouchPolygon.Locations)      // step through the points in the selected polygon
                {
                    surfacewindow.MapPolygon.GMPoint.AddPoint(MapPoints);   // draw the point from the polygon on the map
                }

                surfacewindow.MapPolygon.GMPoint.AddPolyPoint = false; // turn off the point drawing.

                SelectedPolygon = TouchPolygon;                        // make the new polygon the selected polygon.
            }
        }
示例#2
0
 private void UpdateColors(MapPolygon Polygon)
 {
     for (int i = 0; i < MapPolygons.Count; i++)
     {
         MapPolygon test = MapPolygons[i] as MapPolygon;
         if (Polygon.Equals(MapPolygons[i]) && Polygon != null)
         {
             test.Stroke = new SolidColorBrush(Colors.Wheat);
             test.Fill   = new SolidColorBrush(Colors.Blue);
         }
         else // not the selected polygon... reset it's color
         {
             test.Stroke = new SolidColorBrush(Colors.Gold);
             test.Fill   = new SolidColorBrush(Colors.Maroon);
         }
     }
 }
示例#3
0
        public void Polygon_TouchDown(object sender, TouchEventArgs e)
        {
            MapPolygon TouchPolygon = sender as MapPolygon;

            if (TouchPolygon.Equals(SelectedPolygon))
            {
                DeselectAll();
            }
            else
            {
                SelectedPolygon = TouchPolygon;
                UpdateColors(TouchPolygon);

                /*
                 * this is the if statement where we are trying to make it so that when a polygon is selected it redraws its points so that the points, in the future,
                 * the points and polygons can be edited.
                 * right now the idea is that the foreach loop takes the locations of the SelectedPolygons points and redraws the points using the locations from the SelectedPolygon.
                 * See GISMapPoints Class under AddPoints Method.
                 */

                //if (TouchPolygon.Equals(SelectedPolygon))
                //{
                //    foreach (Location TempLocation in SelectedPolygon.Locations)
                //    {
                //        GMPoint.AddPoint(TempLocation, mapwindow);
                //    }
                //}

                int pointCounter = 1;

                foreach (Location p in TouchPolygon.Locations)
                {
                    pointCounter++;
                }
            }
        }
        private void UpdateColors(MapPolygon Polygon)
        {
            for (int i = 0; i < MapPolygons.Count; i++)
            {

                MapPolygon test = MapPolygons[i] as MapPolygon;
                if (Polygon.Equals(MapPolygons[i]) && Polygon != null)
                {
                    test.Stroke = new SolidColorBrush(Colors.Wheat);
                    test.Fill = new SolidColorBrush(Colors.Blue);
                }
                else // not the selected polygon... reset it's color
                {
                    test.Stroke = new SolidColorBrush(Colors.Gold);
                    test.Fill = new SolidColorBrush(Colors.Maroon);
                }
            }
        }