Geometry objects – Pitney Bowes MapXtreme User Manual

Page 302

Advertising
background image

Chapter 16: Spatial Objects and Coordinate Systems

Geometries

MapXtreme v7.1

309

Developer Guide

Geometry Objects

Geometry objects that are not also FeatureGeometry objects need to be converted to a suitable
FeatureGeometry object to be displayed on a map. Most FeatureGeometry classes contain
constructors that take appropriate Geometry objects and create new FeatureGeometry objects:

using MapInfo.Geometry;

Curve curve = new Curve(csys, lineString);
MultiCurve multiCurve = new MultiCurve(curve.CoordSys, curve);

The code above creates the Curve using parameters defined elsewhere in the code of a CoordSys
(csys) and a LineString (lineString). A new MultiCurve is then created using the CoordSys
property of the Curve and the Curve itself.

In the example above, as in all FeatureGeometries created from objects, a copy of the original object
is created because the reference cannot be shared.

Curve

The Curve class inherits from the CurveSegmentList class, and represents a contiguous linear
Geometry. Curves contain a collection of CurveSegments that must remain contiguous. This class is
included in the model to allow for future expansion and is part of the OGC standards.

Use the following example code to model the creation of a Curve:

using MapInfo.Geometry;

DPoint[] points = new DPoint[4];

points[0]= new DPoint(-88.135215,43.998892);
points[1]= new DPoint(-104.875119,43.998892);
points[2]= new DPoint(-120.242895,47.048364);
points[3]= new DPoint(-89.135215 46.998892);

LineString lineString = new LineString(csys, points);
Curve curve = new Curve(csys, lineString);

CurveSegments

At present a CurveSegment can only be a LineString. The class is designed to expand in future
iterations of the product to include Spline, CircularArc, and EllipticalArc CurveSegments. Curves and
Rings are comprised of CurveSegments.

Rings

A Ring is a collection of CurveSegments which must remain contiguous and closed.

Use the following example code to model the creation of a Ring:

using MapInfo.Geometry;

dPoints = new DPoint[102];
dPoints[0] = new DPoint(-109.171279,49.214879);

Advertising