Beispiel #1
0
        // gets transform between raster's native projection and the map projection
        private void GetTransform(ProjectionInfo mapProjection)
        {
            if (mapProjection == null || _projectionWkt == "")
            {
                _transform = null;
                return;
            }

            // get our two projections
            ProjectionInfo srcCoord = new ProjectionInfo();
            srcCoord.ReadEsriString(_projectionWkt);
            ProjectionInfo tgtCoord = mapProjection;

            // raster and map are in same projection, no need to transform
            if (srcCoord.Matches(tgtCoord))
            {
                _transform = null;
                return;
            }

            // create transform
            _transform = new CoordinateTransformation {Source = srcCoord, Target = tgtCoord};
        }
        /// <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(_projectionInfo)
                    ? null
                    : targetProjection;
            }
            else
            {
                _targetProjection = null;
            }

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

            //Is this necessary?
            //Invalidate(Extent);
        }