Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

# MgPoint Class Reference
[MgPoint]

An MgPoint is a 0-dimensional geometry and represents a single location in coordinate space. More...

Inherits MgGeometry.

List of all members.

## Public Member Functions
virtual MgGeometricEntity * | Copy ()
virtual MgCoordinate * | GetCoordinate ()
virtual MgCoordinateIterator * | GetCoordinates ()
| Returns an iterator over the coordinates included in this geometric entity.
virtual INT32 | GetDimension ()
virtual INT32 | GetGeometryType ()
virtual bool | IsClosed ()
virtual bool | IsEmpty ()
virtual MgGeometricEntity * | Transform (MgTransform *transform)
| Returns a transformed copy of this geometric entity.

## Detailed Description

An MgPoint is a 0-dimensional geometry and represents a single location in coordinate space.

Remarks:
  An instance of this class is constructed by calling a non-static MgGeometryFactory::CreatePoint() method and, once constructed, is immutable.

Example (PHP)
The following code shows the construction of a point

     $geometryFactory = new MgGeometryFactory();

     // create a coordinate
     $oordinate = $geometryFactory->CreateCoordinateXY(0,2);

     // create a point
     $point = $geometryFactory->CreatePoint($coordinate);

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

Example (C#)

     using OSGeo.MapGuide;

     private MgPoint pt11;
     private MgPoint pt11FromText;
     private String pt11TextSpec = "POINT XY ( 1 1 )";
     private MgWktReaderWriter wktReaderWriter;
     private MgGeometryFactory geometryFactory;
     private String geometryAgfText;

     public MgPoint CreateAPointXY(double x, double y)
     {
         MgCoordinate coord = geometryFactory.CreateCoordinateXY(x, y);
         return geometryFactory.CreatePoint(coord);
     }

     wktReaderWriter = new MgWktReaderWriter();
     geometryFactory = new MgGeometryFactory();
     // create a geometry using the geometry factory
     pt11 = CreateAPointXY(1, 1);
     // create a geometry from an Agf textual specification
     pt11FromText = wktReaderWriter.Read(pt11TextSpec) as MgPoint;
     // print out the Agf Text string for the geometry
     geometryAgfText = wktReaderWriter.Write(pt11);
     // geometryAgfText now contains:
     // "POINT XY ( 1 1 )"

Comments or suggestions? Send us feedback.