AutoCAD Map 3D 2009 Geospatial Platform Reference

AutoCAD Map 3D Geospatial Platform API

MgMultiPolygon Class Reference
[MgMultiPolygon]

Inherits MgAggregateGeometry.

List of all members.


Detailed Description

An MgMultiPolygon is a two-dimensional aggregate geometry whose elements are MgPolygon geometries.

Remarks:
The polygons are not connected or ordered. An instance of this class is constructed by calling a non-static MgGeometryFactory::CreateMultiPolygon() method and, once constructed, is immutable.
Example (PHP)
The following code shows the construction of an MgMultiPolygon geometry. Review the MgPolygon example code.

 // A helper class additional to those created in the
 // MgPolygon example code is needed.
 $polygonCollection = new MgPolygonCollection();
 // After each MgPolygon geometry is constructed,
 // it is added to an MgPolygonCollection.
 $index = $polygonCollection->Add($polygon);
 echo "A polygon is added to a polygon collection at index: $index\n";

 // construct the MgMultiPolygon geometry
 $multiPolygon = $geometryFactory->
 CreateMultiPolygon($polygonCollection);

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

Example (C#)
The CreateAMultiPolygonXY method calls the CreateAPolygonXY method. The code for the CreateAPolygonXY method is in the MgPolygon example code.
 using OSGeo.MapGuide;

 private MgWktReaderWriter wktReaderWriter;
 private MgGeometryFactory geometryFactory;
 private MgMultiPolygon mpnPn0010110100Pn0010110100;
 // this array contains the data for 2 polygons whose values are identical
 private double[][][,] mpnPn0010110100Pn0010110100Data;
 // the following array is used for the exterior ring of a polygon
 // the points are in counterclockwise order
 private double[,] da0010110100 = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 }, { 0, 0 } };
 private String geometryAgfText;

 public MgMultiPolygon CreateAMultiPolygonXY(double[][][,] polygonData)
 {
     MgPolygonCollection polygons = new MgPolygonCollection(); ;
     for (int i = 0; i < polygonData.GetLength(0); i++)
     {
         polygons.Add(CreateAPolygonXY(polygonData[i]));
     }
     return geometryFactory.CreateMultiPolygon(polygons);
 }

 geometryFactory = new MgGeometryFactory();
 pnEr0010110100Data = new double[1][,];
 pnEr0010110100Data[0] = da0010110100;
 mpnPn0010110100Pn0010110100Data = new double[2][][,];
 mpnPn0010110100Pn0010110100Data[0] = pnEr0010110100Data;
 mpnPn0010110100Pn0010110100Data[1] = pnEr0010110100Data;
 mpnPn0010110100Pn0010110100 = CreateAMultiPolygonXY(mpnPn0010110100Pn0010110100Data);

 // print out the Agf Text string for the geometry
 wktReaderWriter = new MgWktReaderWriter();
 geometryAgfText = wktReaderWriter.Write(mpnPn0010110100Pn0010110100);
 // geometryAgfText now contains:
 // "MULTIPOLYGON XY ((( 0 0, 1 0, 1 1, 0 1, 0 0 )), (( 0 0, 1 0, 1 1, 0 1, 0 0 )))"

Public Member Functions

virtual
MgGeometricEntity
Copy ()
virtual
MgCoordinateIterator
GetCoordinates ()
 Returns an iterator over the coordinates included in this geometric entity.
virtual INT32 GetCount ()
virtual INT32 GetDimension ()
 
virtual INT32 GetGeometryType ()
virtual MgPolygonGetPolygon (INT32 index)
 
virtual bool IsClosed ()
virtual bool IsEmpty ()
 
virtual
MgGeometricEntity
Transform (MgTransform *transform)
 Returns a transformed copy of this geometric entity.