Exemplo n.º 1
0
        public void drawPoint(IEnumerable <Point> points, PointType type = PointType.Image)
        {
            foreach (Point p in points)
            {
                Point tmp_p = (Point)GeometryTransform.TransformGeometry(p, LayerTools.Wgs84toGoogleMercator.MathTransform, geofactory);
                switch (type)
                {
                case PointType.Image:
                {
                    markerProvider.Geometries.Add(tmp_p);
                    break;
                }

                case PointType.GreenPoint:
                {
                    greenPointProvider.Geometries.Add(tmp_p);
                    break;
                }

                case PointType.RedPoint:
                {
                    redPointProvider.Geometries.Add(tmp_p);
                    break;
                }
                }
                // include(tmp_p);
            }
            RefreshMap();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 缩放视图以使e占全图的50%
        /// </summary>
        /// <param name="e"></param>
        private void include(Edge e)
        {
            Envelope box     = mbMap.Map.Envelope;
            Envelope edgeBox = GeometryTransform.TransformBox(e.GetBox(), LayerTools.Wgs84toGoogleMercator.MathTransform);

            include(edgeBox);
        }
Exemplo n.º 3
0
 private void drawPoint(Point p)
 {
     p = (Point)GeometryTransform.TransformGeometry(p, LayerTools.Wgs84toGoogleMercator.MathTransform, geofactory);
     markerProvider.Geometries.Add(p);
     // include(p);
     RefreshMap();
 }
Exemplo n.º 4
0
 private void drawStdLine(LineString line)
 {
     line = (LineString)GeometryTransform.TransformGeometry(line, LayerTools.Wgs84toGoogleMercator.MathTransform, geofactory);
     stdOutputProvider.Geometries.Add(line);
     stdOutputProvider.Geometries.Add(line.EndPoint);
     include(line);
     RefreshMap();
 }
Exemplo n.º 5
0
        private void mbMap_MouseMove(Coordinate worldPos, MouseEventArgs imagePos)
        {
            Point p = new Point(worldPos);

            p = GeometryTransform.TransformGeometry(p, LayerTools.GoogleMercatorToWgs84.MathTransform, geofactory) as Point;
            lbPosition.Text = String.Format("X:{0:#.000000}\nY: {1:#.000000}", p.X, p.Y);
            //lbPosition.Text = String.Format("X:{0}\nY:{1}", worldPos.X, worldPos.Y);
        }
Exemplo n.º 6
0
        public void drawStdLine(long edgeId)
        {
            Edge       e    = graph.Edges[edgeId];
            LineString line = (LineString)GeometryTransform.TransformGeometry(e.ToLineString(), LayerTools.Wgs84toGoogleMercator.MathTransform, geofactory);

            stdOutputProvider.Geometries.Add(line);
            stdOutputProvider.Geometries.Add(line.EndPoint);
            include(e);
            RefreshMap();
        }
Exemplo n.º 7
0
        private void mbMap_GeometryDefined(IGeometry geometry)
        {
            double length = 0;

            if (geometry.GetType() == typeof(LineString) && ruler)
            {
                geometry = GeometryTransform.TransformGeometry(geometry, LayerTools.GoogleMercatorToWgs84.MathTransform, geofactory);
                length   = LayerTools.GetLength(geometry as LineString);
                MessageBox.Show("Length:" + length + "m.");
                ruler = false;
            }
            else
            {
                outputProvider.Geometries.Add(geometry);
            }
            mbMap.ActiveTool = MapBox.Tools.Pan;
            RefreshMap();
        }
Exemplo n.º 8
0
 public void drawMBR(IEnumerable <MBR> mbrs)
 {
     foreach (var mbr in mbrs)
     {
         Coordinate[] coords = new Coordinate[5] {
             mbr.TopLeft.ToCoordinate(),
                  mbr.TopRight.ToCoordinate(),
                  mbr.BottomRight.ToCoordinate(),
                  mbr.BottomLeft.ToCoordinate(),
                  mbr.TopLeft.ToCoordinate()
         };
         LinearRing ring = new LinearRing(coords);
         ring = (LinearRing)GeometryTransform.TransformLinearRing(ring,
                                                                  LayerTools.Wgs84toGoogleMercator.MathTransform, geofactory);
         outputProvider.Geometries.Add(ring);
     }
     mbMap.Refresh();
 }
Exemplo n.º 9
0
        private void miSaveGeo_Click(object sender, EventArgs e)
        {
            string fileName = Path.Combine(Constants.DATA_DIR, "beijingTrjPart",
                                           "stat", "parkingRegion.txt");
            StreamWriter sw = new StreamWriter(fileName);

            foreach (var geo in outputProvider.Geometries)
            {
                List <string> points = new List <string>();
                foreach (var coor in geo.Coordinates)
                {
                    Point point = (Point)GeometryTransform.TransformGeometry(new Point(coor),
                                                                             LayerTools.GoogleMercatorToWgs84.MathTransform, geofactory);
                    points.Add(string.Format("{0},{1}", point.Y, point.X));
                }
                sw.WriteLine(String.Join(",", points.ToArray()));
            }
            sw.Close();
        }