/// <summary>
 ///
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public bool EqualParams(object obj)
 {
     if (obj is DotSpatialCoordinateSystem)
     {
         return(_projectionInfo.Matches(((DotSpatialCoordinateSystem)obj)._projectionInfo));
     }
     if (obj is ProjectionInfo)
     {
         return(_projectionInfo.Matches((ProjectionInfo)obj));
     }
     return(false);
 }
        public static GeometryTransform GetTransform(string shapefile, string targetWKT)
        {
            string prjPath = Path.ChangeExtension(shapefile, ".prj");

            if (targetWKT != null && File.Exists(prjPath))
            {
                string sourceWKT = File.ReadAllText(prjPath);

                ProjectionInfo source = ProjectionInfo.FromEsriString(sourceWKT);
                ProjectionInfo target = ProjectionInfo.FromEsriString(targetWKT);

                if (source != null && !source.Matches(target))
                {
                    return(new GeometryTransform(source, target));
                }
            }

            return(null);
        }
        /// <summary>
        /// Reprojects all of the in-ram vertices of vectors, or else this
        /// simply updates the "Bounds" of image and raster objects
        /// This will also update the projection to be the specified projection.
        /// </summary>
        /// <param name="targetProjection">
        /// The projection information to reproject the coordinates to.
        /// </param>
        public override void Reproject(ProjectionInfo targetProjection)
        {
            base.Reproject(targetProjection);

            if (targetProjection != null)
            {
                //Set the target projection if necessary
                _targetProjection = targetProjection.Matches(_sourceProjection)
                    ? null
                    : targetProjection;
            }
            else
            {
                _targetProjection = null;
            }

            // Adjusting the projection
            Projection = _targetProjection ?? _sourceProjection;

            //Is this necessary?
            //MapFrame.Invalidate(Extent);
        }
Exemple #4
0
 /// <summary>
 /// Tests whether this transform does not move any points.
 /// </summary>
 /// <returns></returns>
 public bool Identity()
 {
     return(_source.Matches(_target));
 }