Ejemplo n.º 1
0
        private static VectorItem CreateVector(GeoGeometryRecord record)
        {
            VectorItem vector;

            switch (record.Geometry.Type)
            {
            case GeoGeometryType.Point:
            case GeoGeometryType.MultiPoint:
                vector = new C1.Win.Map.VectorPlacemark();
                break;

            case GeoGeometryType.Polygon:
            case GeoGeometryType.MultiPolygon:
                vector = new VectorPolygon();
                break;

            case GeoGeometryType.LineString:
            case GeoGeometryType.MultiLineString:
                vector = new VectorPolyline();
                break;

            default:
                return(null);
            }

            vector.GeometryData = WkCoder.ToBase64String(record.Geometry, WkCoder.WkbByteOrder.LittleEndian);
            return(vector);
        }
Ejemplo n.º 2
0
        private C1.Win.Map.VectorPolyline CreateRoute(City startCity, City stopCity)
        {
            var line = new C1.Win.Map.VectorPolyline
            {
                Geometry = new GeoLineString(new[]
                {
                    new GeoPoint(startCity.longitude, startCity.latitude),
                    new GeoPoint(stopCity.longitude, stopCity.latitude)
                })
            };

            return(line);
        }
Ejemplo n.º 3
0
        private void CreateGrids()
        {
            var layer = new VectorLayer {
                LabelVisibility = LabelVisibility.Visible, Track = false
            };

            c1Map1.Layers.Add(layer);

            layer.LabelStyle.ForeColor = Color.DarkGray;
            layer.Style.Stroke.Color   = Color.DarkGray;
            layer.Style.Stroke.Style   = DashStyle.Dash;
            layer.Style.Stroke.Width   = 1;

            for (int lon = -180; lon <= 180; lon += 30)
            {
                var points = new List <GeoPoint>();
                for (int lat = -85; lat <= 85; lat++)
                {
                    points.Add(new GeoPoint(lon, lat));
                }
                var pl = new VectorPolyline
                {
                    Geometry = new GeoLineString(points)
                };
                layer.Items.Add(pl);

                var lbl = Math.Abs(lon) + "°";
                if (lon > 0)
                {
                    lbl += "E";
                }
                else if (lon < 0)
                {
                    lbl += "W";
                }

                var pm = new VectorPlacemark
                {
                    Geometry = new GeoPoint(lon, 0),
                    Marker   = { Caption = lbl, LabelPosition = LabelPosition.Top }
                };
                layer.Items.Add(pm);
            }

            for (int lat = -80; lat <= 80; lat += 20)
            {
                var points = new List <GeoPoint>();
                for (int lon = -180; lon <= 180; lon++)
                {
                    points.Add(new GeoPoint(lon, lat));
                }
                var pl = new VectorPolyline
                {
                    Geometry = new GeoLineString(points)
                };
                layer.Items.Add(pl);

                var lbl = Math.Abs(lat) + "°";
                if (lat > 0)
                {
                    lbl += "N";
                }
                else if (lat < 0)
                {
                    lbl += "S";
                }

                var pm = new VectorPlacemark
                {
                    Geometry = new GeoPoint(0, lat),
                    Marker   = { Caption = lbl, LabelPosition = LabelPosition.Right }
                };
                layer.Items.Add(pm);
            }
        }
Ejemplo n.º 4
0
        protected override void InitMap()
        {
            base.InitMap();
            c1Map1.Viewport.Zoom = 1;
            var layer = new VectorLayer {
                LabelVisibility = LabelVisibility.Visible, Track = false
            };

            c1Map1.Layers.Add(layer);

            layer.LabelStyle.ForeColor = Color.DarkGray;
            layer.Style.Stroke.Color   = Color.DarkGray;
            layer.Style.Stroke.Style   = DashStyle.Dash;
            layer.Style.Stroke.Width   = 1;

            for (int lon = -180; lon <= 180; lon += 30)
            {
                var pl = new VectorPolyline
                {
                    Geometry = new GeoLineString(new[] { new GeoPoint(lon, -85), new GeoPoint(lon, 85) })
                };
                layer.Items.Add(pl);

                var lbl = Math.Abs(lon) + "°";
                if (lon > 0)
                {
                    lbl += "E";
                }
                else if (lon < 0)
                {
                    lbl += "W";
                }

                var pm = new VectorPlacemark
                {
                    Geometry = new GeoPoint(lon, 0),
                    Marker   = { Caption = lbl, LabelPosition = LabelPosition.Top }
                };
                layer.Items.Add(pm);
            }

            for (int lat = -80; lat <= 80; lat += 20)
            {
                var pl = new VectorPolyline
                {
                    Geometry = new GeoLineString(new[] { new GeoPoint(-180, lat), new GeoPoint(180, lat) })
                };
                layer.Items.Add(pl);

                var lbl = Math.Abs(lat) + "°";
                if (lat > 0)
                {
                    lbl += "N";
                }
                else if (lat < 0)
                {
                    lbl += "S";
                }

                var pm = new VectorPlacemark
                {
                    Geometry = new GeoPoint(0, lat),
                    Marker   = { Caption = lbl, LabelPosition = LabelPosition.Right }
                };
                layer.Items.Add(pm);
            }
        }