AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

MgMultiGeometry Class Reference
[MgMultiGeometry]

Inherits MgAggregateGeometry.

List of all members.


Detailed Description

An MgMultiGeometry is a heterogeneous aggregate of one or more MgGeometry objects.

Remarks:
Both "single" and "multiple" MgGeometry objects, for example, MgPoint and MgMultiPoint objects, may be included. The geometries are not connected or ordered. An instance of this class is constructed by calling a non-static MgGeometryFactory::CreateMultiGeometry() method and, once constructed, is immutable.
Example (PHP)
The following code shows the construction of an MgMultiGeoemtry geometry. Review the example code for the construction of the possible constituent geometries:
 $geometryFactory = new MgGeometryFactory();
 $geometryCollection = new MgGeometryCollection();

 // After each MgGeometry is constructed,
 // it is added to the MgGeometryCollection.
 $index = $geometryCollection->Add($point);
 $index = $geometryCollection->Add($multiPoint);
 $index = $geometryCollection->Add($lineString);
 $index = $geometryCollection->Add($multiLineString);
 $index = $geometryCollection->Add($curveString);
 $index = $geometryCollection->Add($multiCurveString);
 $index = $geometryCollection->Add($polygon);
 $index = $geometryCollection->Add($multiPolygon);
 $index = $geometryCollection->Add($curvePolygon);
 $index = $geometryCollection->Add($multiCurvePolygon);

 // construct the MgMultiGeometry geometry
 $multiGeometry = $geometryFactory->CreateMultiGeometry($geometryCollection);

 // print out the Agf Text string for the geometry
 $multiGeometryAgfText = $wktReaderWriter->Write($multiGeometry);
 echo "AGF Text representation of MultiGeometry: $multiGeometryAgfText\n";

Example (C#)
The following code shows the construction of an MgMultiGeometry object, which consists of a point and a line.

 using OSGeo.MapGuide;
 private MgWktReaderWriter wktReaderWriter;
 private MgGeometryFactory geometryFactory;
 private MgMultiGeometry multiGeom;
 private MgGeometryCollection geometries;
 private MgPoint pt11;
 private MgLineString ls1121;
 private String geometryAgfText;

 geometries = new MgGeometryCollection();
 geometryFactory = new MgGeometryFactory();
 // Review the MgPoint example code for the construction of the point geometry.
 geometries.Add(pt11 as MgGeometry);
 // Review the MgLineString example code for the construction of the line string geometry.
 geometries.Add(ls1121 as MgGeometry);
 multiGeom = geometryFactory.CreateMultiGeometry(geometries);

 // print out the Agf Text string for the geometry
 wktReaderWriter = new MgWktReaderWriter();
 geometryAgfText = wktReaderWriter.Write(multiGeom);
 // geometryAgfText now contains:
 // "GEOMETRYCOLLECTION ( POINT XY ( 1 1 ), LINESTRING XY ( 1 1, 2 1 ) )"


Public Member Functions

virtual
MgGeometricEntity
Copy ()
virtual INT32 GetCount ()
virtual INT32 GetDimension ()
 
virtual MgGeometryGetGeometry (INT32 index)
 
virtual INT32 GetGeometryType ()
virtual bool IsClosed ()
virtual bool IsEmpty ()
 
virtual
MgGeometricEntity
Transform (MgTransform *transform)
 Returns a transformed copy of this geometric entity.