Return Value
An Envelope
// Use a builderEx convenience method or use a builderEx constructor. MapPoint minPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0); MapPoint maxPt = MapPointBuilderEx.CreateMapPoint(2.0, 2.0); Envelope envelope = EnvelopeBuilderEx.CreateEnvelope(minPt, maxPt); EnvelopeBuilderEx builderEx = new EnvelopeBuilderEx(minPt, maxPt); envelope = builderEx.ToGeometry() as Envelope;
// use the convenience builders Envelope env1 = EnvelopeBuilderEx.CreateEnvelope(0, 0, 1, 1, SpatialReferences.WGS84); Envelope env2 = EnvelopeBuilderEx.CreateEnvelope(0.5, 0.5, 1.5, 1.5, SpatialReferences.WGS84); Envelope env3 = env1.Union(env2); double area = env3.Area; double depth = env3.Depth; double height = env3.Height; double width = env3.Width; double len = env3.Length; MapPoint centerPt = env3.Center; Coordinate2D coord = env3.CenterCoordinate; bool isEmpty = env3.IsEmpty; int pointCount = env3.PointCount; // coordinates //env3.XMin, env3.XMax, env3.YMin, env3.YMax //env3.ZMin, env3.ZMax, env3.MMin, env3.MMax bool isEqual = env1.IsEqual(env2); // false // or use the builderEx constructors which don't need to run on the MCT. EnvelopeBuilderEx builderEx = new EnvelopeBuilderEx(0, 0, 1, 1, SpatialReferences.WGS84); builderEx.Union(env2); // builder is updated to the result depth = builderEx.Depth; height = builderEx.Height; width = builderEx.Width; centerPt = builderEx.Center; coord = builderEx.CenterCoordinate; isEmpty = builderEx.IsEmpty; env3 = builderEx.ToGeometry() as Envelope;
// use the convenience builders Envelope env1 = EnvelopeBuilderEx.CreateEnvelope(0, 0, 1, 1, SpatialReferences.WGS84); Envelope env2 = EnvelopeBuilderEx.CreateEnvelope(0.5, 0.5, 1.5, 1.5, SpatialReferences.WGS84); bool intersects = env1.Intersects(env2); // true Envelope env3 = env1.Intersection(env2); // or use the builderEx constructors which don't need to run on the MCT. EnvelopeBuilderEx builderEx = new EnvelopeBuilderEx(0, 0, 1, 1, SpatialReferences.WGS84); intersects = builderEx.Intersects(env2); builderEx.Intersection(env2); // note this sets the builder to the intersection env3 = builderEx.ToGeometry() as Envelope;
// Use a builderEx convenience method or use a builderEx constructor. // convenience methods don't need to run on the MCT. Envelope envelope = EnvelopeBuilderEx.CreateEnvelope(100.0, 100.0, 500.0, 500.0); // shrink the envelope by 50% Envelope result = envelope.Expand(0.5, 0.5, true); // builderEx constructors don't need to run on the MCT. EnvelopeBuilderEx builderEx = new EnvelopeBuilderEx(100.0, 100.0, 500.0, 500.0); builderEx.Expand(0.5, 0.5, true); envelope = builderEx.ToGeometry() as Envelope;
Coordinate2D minCoord = new Coordinate2D(1, 3); Coordinate2D maxCoord = new Coordinate2D(2, 4); Coordinate2D c1 = new Coordinate2D(0, 5); Coordinate2D c2 = new Coordinate2D(1, 3); // use the EnvelopeBuilderEx. This constructor doesn't need to run on the MCT. EnvelopeBuilderEx builderEx = new EnvelopeBuilderEx(minCoord, maxCoord); // builderEx.XMin, YMin, Zmin, MMin = 1, 3, 0, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 2, 4, 0, double.Nan // set XMin. if XMin > XMax; both XMin and XMax change builderEx.XMin = 6; // builderEx.XMin, YMin, ZMin, MMin = 6, 3, 0, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 6, 4, 0, double.Nan // set XMax builderEx.XMax = 8; // builderEx.XMin, YMin, ZMin, MMin = 6, 3, 0, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 8, 4, 0, double.Nan // set XMax. if XMax < XMin, both XMin and XMax change builderEx.XMax = 3; // builderEx.XMin, YMin, ZMin, MMin = 3, 3, 0, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 3, 4, 0, double.Nan // set YMin builderEx.YMin = 2; // builderEx.XMin, YMin, ZMin, MMin = 3, 2, 0, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 3, 4, 0, double.Nan // set ZMin. if ZMin > ZMax, both ZMin and ZMax change builderEx.ZMin = 3; // builderEx.XMin, YMin, ZMin, MMin = 3, 2, 3, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 3, 4, 3, double.Nan // set ZMax. if ZMax < ZMin. both ZMin and ZMax change builderEx.ZMax = -1; // builderEx.XMin, YMin, ZMin, MMin = 3, 2, -1, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 3, 4, -1, double.Nan builderEx.SetZCoords(8, -5); // builderEx.XMin, YMin, ZMin, MMin = 3, 2, -5, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 3, 4, 8, double.Nan builderEx.SetXYCoords(c1, c2); // builderEx.XMin, YMin, ZMin, MMin = 0, 3, -5, double.Nan // builderEx.XMax, YMax, ZMax, MMax = 1, 5, 8, double.Nan builderEx.HasM = true; builderEx.SetMCoords(2, 5); var geomEx = builderEx.ToGeometry();
Target Platforms: Windows 11, Windows 10