Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

# MgGeometryFactory Class Reference
[MgGeometryFactory]

The MgGeometryFactory class is used to construct objects whose classes are derived from MgGeometry. More...

Inherits MgGuardDisposable.

List of all members.

## Public Member Functions
virtual MgArcSegment * | CreateArcSegment (MgCoordinate *start, MgCoordinate *end, MgCoordinate *control)
| Creates an arc segment from start, end, and control coordinates.
virtual MgCoordinate * | CreateCoordinateXY (double x, double y)
| Creates an MgCoordinate object with Dimension = XY, X = x, Y = y.
virtual MgCoordinate * | CreateCoordinateXYM (double x, double y, double m)
| Creates an MgCoordinate object with Dimension = XYM, X = x, Y = y, M = m.
virtual MgCoordinate * | CreateCoordinateXYZ (double x, double y, double z)
| Creates an MgCoordinate object with Dimension = XYZ, X = x, Y = y, Z = z.
virtual MgCoordinate * | CreateCoordinateXYZM (double x, double y, double z, double m)
| Creates an MgCoordinate object with Dimension = XYZM, X = x, Y = y, Z = z, M = m.
virtual MgCurvePolygon * | CreateCurvePolygon (MgCurveRing *outerRing, MgCurveRingCollection *innerRings)
| Creates a curve polygon from an outer ring and a collection of inner rings.
virtual MgCurveRing * | CreateCurveRing (MgCurveSegmentCollection *curveSegments)
| Creates a curve ring from a collection of curve segments.
virtual MgCurveString * | CreateCurveString (MgCurveSegmentCollection *curveSegments)
| Creates a curve string from a collection of curve segments.
virtual MgLinearRing * | CreateLinearRing (MgCoordinateCollection *coordinates)
| Creates a linear ring from a collection of coordinates.
virtual MgLinearSegment * | CreateLinearSegment (MgCoordinateCollection *coordinates)
| Creates a linear segment from a collection of coordinates.
virtual MgLineString * | CreateLineString (MgCoordinateCollection *coordinates)
| Creates a line string from a collection of coordinates.
virtual MgMultiCurvePolygon * | CreateMultiCurvePolygon (MgCurvePolygonCollection *polygons)
| Creates a multi curve polygon aggregate geometry from a collection of curve polygons.
virtual MgMultiCurveString * | CreateMultiCurveString (MgCurveStringCollection *curveStrings)
| Creates a multi curve string aggregate geometry from a collection of curve strings.
virtual MgMultiGeometry * | CreateMultiGeometry (MgGeometryCollection *geometries)
| Creates an aggregate geometry from a collection of geometry objects.
virtual MgMultiLineString * | CreateMultiLineString (MgLineStringCollection *lineStrings)
| Creates a multi line string aggregate geometry from a collection of line strings.
virtual MgMultiPoint * | CreateMultiPoint (MgPointCollection *points)
| Creates a multi point aggregate geometry from a collection of points.
virtual MgMultiPolygon * | CreateMultiPolygon (MgPolygonCollection *polygons)
| Creates a multi polygon aggregate geometry from a collection of polygons.
virtual MgPoint * | CreatePoint (MgCoordinate *coordinate)
| Creates a point from a coordinate.
virtual MgPolygon * | CreatePolygon (MgLinearRing *outerRing, MgLinearRingCollection *innerRings)
| Creates a polygon from an outer ring and a collection of inner rings.
| MgGeometryFactory ()
| Creates an MgGeometryFactory object.

## Detailed Description

The MgGeometryFactory class is used to construct objects whose classes are derived from MgGeometry.

Remarks:
  The starting point for the construction of the MgGeometry objects is user-supplied numbers of type double or integer. The lexical analyzer converts integers to doubles. The numbers are passed to one of the CreateCoordinate????() methods where ???? is one of XY, XYM, XYZ, or XYZM.
  The MgGeometryFactory methods do no spatial analysis. Errors in the construction of the geometry objects are not detected until some operation in the datastore requiring spatial analysis is performed.
  The general rules for constructing geometry objects are as follows:
  - add coordinates to a coordinate collection which defines an MgLinearRing so that the first and last coordinates are identical,
  - add coordinates to a coordinate collection which defines an MgLinearRing to be used as an exterior ring in an MgPolygon so that the direction of traversal is counterclockwise,
  - add coordinates to a coordinate collection which defines an MgLinearRing to be used as an interior ring in an MgPolygon so that the direction of traversal is clockwise,
  - add MgCurveSegment objects (either MgArcSegment objects or MgLinearSegment objects) to an MgCurveSegmentCollection so that they are contiguous in the order added and so that the last coordinate in an MgCurveSegment object is identical to the first coordinate in the succeeding MgCurveSegment object,
  - add MgCurveSegment objects (either MgArcSegment objects or MgLinearSegment objects) to an MgCurveSegmentCollection which defines an MgCurveRing to be used as an exterior ring in an MgCurvePolygon so that the direction of traversal is counterclockwise,
  - add MgCurveSegment objects (either MgArcSegment objects or MgLinearSegment objects) to an MgCurveSegmentCollection which defines an MgCurveRing to be used as an interior ring in an MgCurvePolygon so that the direction of traversal is clockwise.
  With respect to the construction of linear and curve polygons, the Autodesk Geometry Format (AGF) Binary specification does not stipulate the direction of traversal in a ring. However, some providers, for example, Oracle, require that the direction of traversal be counterclockwise in an exterior ring and clockwise in an interior ring.
  The following statements are represented in the graphic at the bottom of this pane.
  MgCoordinate objects are used directly to create MgPoint geometries and MgArcSegment geometry components.
  MgCoordinateCollection objects are used to create MgLineString geometries, MgLinearRing geometry components and MgLinearSegment geometry components.
  An MgPolygon geometry is constructed from an MgLinearRing geometry component, which defines the polygon's external boundary, and an optional MgLinearRingCollection of MgLinearRing geometry components, which define "holes' in the containing ring.
  An MgCurveSegmentCollection of MgLinearSegment objects and MgArcSegment objects are used to create MgCurveString geometries and MgCurveRing geometry components.
  An MgCurvePolygon geometry is constructed from an MgCurveRing geometry component, which defines the curve polygon's external boundary, and an optional MgCurveRingCollection of MgCurveRing geometries, which define "holes" in the containing ring.
  Each single geometry (point, line string, polygon, curve string, and curve polygon) has a homogeneous multi-version. For example, an MgMultiPoint geometry is composed of MgPoint geometries. For each geometry type there is a helper collection class used to construct the multi-version object.
  Finally an MgMultiGeometry object, which consists of a heterogeneous collection of geometries, is constructed by adding geometries to a helper collection class object and passing that collection object to a constructor.

Comments or suggestions? Send us feedback.