/// <summary> Initializes a new instance of the <see cref="ShapeLayer"/> class. By default, the spatial reference system is set to "EPSG:4326". </summary>
        /// <param name="name"> Name of the layer. </param>
        public ShapeLayer(string name)
            : base(name)
        {
            SpatialReferenceId = "EPSG:4326";
            InitializeFactory(CanvasCategory.Content,
                              map =>
            {
                if (map.Name != "Map")
                {
                    return(null);
                }

                var localOffset = (LocalOffset.X != 0 || LocalOffset.Y != 0)
                        ? GeoTransform.Transform(LocalOffset, SpatialReferenceId, "PTV_MERCATOR")
                        : new Point(0, 0);

                return(new ShapeCanvas(map, Shapes, SpatialReferenceId, LazyUpdate, true, localOffset));
            });
        }
Beispiel #2
0
 /// <summary>
 /// Converts a geographic point to a canvas coordinate.
 /// </summary>
 /// <param name="geoPoint">The geographic point.</param>
 /// <param name="spatialReferenceId">The spatial reference identifier.</param>
 /// <returns> The transformed canvas coordinate. </returns>
 public Point GeoToCanvas(Point geoPoint, string spatialReferenceId)
 {
     return(PtvMercatorToCanvas(GeoTransform.Transform(geoPoint, spatialReferenceId, "PTV_MERCATOR")));
 }