Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

# MgMultiPoint Class Reference
[MgMultiPoint]

An MgMultiPoint is a 0 dimensional aggregate geometry whose elements are MgPoint geometries. More...

Inherits MgAggregateGeometry.

List of all members.

## Public Member Functions
virtual MgGeometricEntity * | Copy ()
virtual INT32 | GetCount ()
virtual INT32 | GetDimension ()
virtual INT32 | GetGeometryType ()
virtual MgPoint * | GetPoint (INT32 index)
virtual bool | IsClosed ()
virtual bool | IsEmpty ()
virtual MgGeometricEntity * | Transform (MgTransform *transform)
| Returns a transformed copy of this geometric entity.

## Detailed Description

An MgMultiPoint is a 0 dimensional aggregate geometry whose elements are MgPoint geometries.

Remarks:
  The points are not connected or ordered. An instance of this class is constructed by calling a non-static MgGeometryFactory::CreateMultiPoint() method and, once constructed, is immutable.

Example (PHP)
The following code shows the construction of an MgMultiPoint geometry. Review the MgPoint Class example code.

     // A helper class additional to those created in the
     // MgPoint example code is needed.
     $pointCollection = new MgPointCollection();

     // After each MgPoint geometry is constructed,
     // it is added to an MgPointCollection.
     $index = $pointCollection->Add($point);
     echo "A point is added to a point collection at index: $index\n";

     // construct the MgMultiPoint geometry
     $multiPoint = $geometryFactory->CreateMultiPoint($pointCollection);

     // print out the Agf Text string for the geometry
     $multiPointAgfText = $wktReaderWriter->Write($multiPoint);

     echo "AGF Text representation of MultiPoint: $multiPointAgfText\n";

Example (C#)
The CreateAMultiPointXY method calls the CreateAPointXY method. The code for the CreateAPointXY method is in the MgPoint example code.

     using OSGeo.MapGuide;

     private MgWktReaderWriter wktReaderWriter;
     private MgGeometryFactory geometryFactory;
     private MgMultiPoint mpt1121;
     private double[,] da1121 = { { 1, 1 }, { 2, 1 } };
     private String geometryAgfText;

     public MgMultiPoint CreateAMultiPointXY(double[,] multiPointData)
     {
         MgPointCollection points = new MgPointCollection();
         for (int i = 0; i < multiPointData.GetLength(0); i++)
         {
             points.Add(CreateAPointXY(multiPointData[i, 0], multiPointData[i, 1]));
         }
         return geometryFactory.CreateMultiPoint(points);
     }

     geometryFactory = new MgGeometryFactory();
     mpt1121 = CreateAMultiPointXY(da1121);

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

Comments or suggestions? Send us feedback.