Esempio 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();
        }
Esempio n. 2
0
 private void drawPoint(Point p)
 {
     p = (Point)GeometryTransform.TransformGeometry(p, LayerTools.Wgs84toGoogleMercator.MathTransform, geofactory);
     markerProvider.Geometries.Add(p);
     // include(p);
     RefreshMap();
 }
Esempio n. 3
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();
 }
Esempio n. 4
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);
        }
Esempio n. 5
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();
        }
Esempio n. 6
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();
        }
Esempio n. 7
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();
        }