/// <summary>
        /// Transforms a <see cref="BoundingBox"/>
        /// </summary>
        /// <param name="box">Geometry to transform</param>
        /// <param name="from">Source Projection</param>
        /// <param name="to">Target Projection</param>
        /// <returns>Transformed BoundingBox</returns>
        public static BoundingBox TransformBox(BoundingBox box, ProjectionInfo from, ProjectionInfo to)
        {
            var corners = new[] { box.MinX, box.MinY, box.MinX, box.MaxY, box.MaxX, box.MaxY, box.MaxX, box.MinY };
            Reproject.ReprojectPoints(corners, null, from, to, 0, 4);

            var res = new BoundingBox(corners[0], corners[4], corners[1], corners[5]);
            res.ExpandToInclude(new BoundingBox(corners[2], corners[6], corners[3], corners[7]));
            return res;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Transforms a <see cref="BoundingBox"/>
        /// </summary>
        /// <param name="box">Geometry to transform</param>
        /// <param name="from">Source Projection</param>
        /// <param name="to">Target Projection</param>
        /// <returns>Transformed BoundingBox</returns>
        public static BoundingBox TransformBox(BoundingBox box, ProjectionInfo from, ProjectionInfo to)
        {
            var corners = new[] { box.MinX, box.MinY, box.MinX, box.MaxY, box.MaxX, box.MaxY, box.MaxX, box.MinY };

            Reproject.ReprojectPoints(corners, null, from, to, 0, 4);

            var res = new BoundingBox(corners[0], corners[4], corners[1], corners[5]);

            res.ExpandToInclude(new BoundingBox(corners[2], corners[6], corners[3], corners[7]));
            return(res);
        }
Exemplo n.º 3
0
        public override GeoAPI.Geometries.Envelope GetFeatureExtent(string where)
        {
            FieldSelection fieldSelection = new FieldSelection(this, GeometryField.Name);
            QueryFilter    queryFilter    = new QueryFilter(GeometryField.Name, where);
            RecordSet      recordSet      = _service.MapServer.QueryFeatureData(DataFrame.Name, _mapLayerInfo.LayerID, queryFilter);
            DataTable      table          = RecordSetToTable(recordSet, fieldSelection);

            GeoAPI.Geometries.Envelope extent = new GeoAPI.Geometries.Envelope();

            foreach (DataRow row in table.Rows)
            {
                if (!row.IsNull(0))
                {
                    extent.ExpandToInclude(((IGeometry)row[0]).EnvelopeInternal);
                }
            }

            return(extent);
        }