public XmlAreaOfInterest([NotNull] AreaOfInterest aoi)
        {
            Assert.ArgumentNotNull(aoi, nameof(aoi));

            Type = aoi.IsEmpty
                                       ? AreaOfInterestType.Empty
                                       : aoi.Geometry is IPolygon
                                               ? AreaOfInterestType.Polygon
                                               : AreaOfInterestType.Box;

            Description = GetValue(aoi.Description);

            FeatureSource = GetValue(aoi.FeatureSource);
            WhereClause   = GetValue(aoi.WhereClause);

            BufferDistance          = aoi.BufferDistance;
            GeneralizationTolerance = aoi.GeneralizationTolerance;

            if (aoi.ClipExtent != null && !aoi.ClipExtent.IsEmpty)
            {
                ClipExtent = new Xml2DEnvelope(aoi.ClipExtent);
            }

            Extent = aoi.IsEmpty
                                         ? null
                                         : new Xml2DEnvelope(aoi.Extent);
        }
Beispiel #2
0
        public static string FormatExtent([NotNull] Xml2DEnvelope extent)
        {
            Assert.ArgumentNotNull(extent, nameof(extent));

            bool round = extent.XMax > 10000 || extent.YMax > 10000;

            string format = round
                                                ? "X-Min: {0:N2} Y-Min: {1:N2} X-Max: {2:N2} Y-Max: {3:N2}"
                                                : "X-Min: {0} Y-Min: {1} X-Max: {2} Y-Max: {3}";

            string extentString = string.Format(format,
                                                extent.XMin, extent.YMin,
                                                extent.XMax, extent.YMax);

            return(StringUtils.IsNotEmpty(extent.CoordinateSystem)
                                       ? string.Format("{0} ({1})", extentString, extent.CoordinateSystem)
                                       : extentString);
        }