MapGuide API Reference
|
Translates a string in AGF (Autodesk Geometry Format) Text format into an MgGeometry object and vice versa. See the AGF Text topic. . More...
Public Member Functions | |
MgWktReaderWriter () | |
Constructor. | |
virtual MgGeometry * | Read (CREFSTRING wkt) |
Reads a geometry object from an AGF Text format. | |
virtual MgGeometry * | Read (CREFSTRING wkt, MgTransform *transform) |
Reads a geometry object from a string in WKT format applying the specified transform during the read. | |
virtual STRING | Write (MgGeometry *geometry) |
Writes a geometry object to a string in AGF Text format. | |
virtual STRING | Write (MgGeometry *geometry, MgTransform *transform) |
Writes a geometry object to a string in WKT format applying the specified transform during the write. |
Translates a string in AGF (Autodesk Geometry Format) Text format into an MgGeometry object and vice versa. See the AGF Text topic. .
$wktReaderWriter = new MgWktReaderWriter(); $agfReaderWriter = new MgAgfReaderWriter(); // In the string to geometry direction: $agfTextPoint = "POINT XY (0 0)"; $pointGeometryFromWkt = $wktReaderWriter->Read($agfTextPoint); $byteReader = $agfReaderWriter->Write($pointGeometryFromAgfText); // In the geometry to string direction: $pointGeometryFromBytes = $agfReaderWriter->Read($byteReader); $agfTextPoint = $wktReaderWriter->Write($pointGeometryFromBytes); // prints "POINT XY (0 0)" to screen echo "$agfTextPoint\n";
private MgAgfReaderWriter agfReaderWriter; private MgWktReaderWriter wktReaderWriter; private MgPoint pt11FromText; private MgPoint pt11; private String pt11TextSpec = "POINT XY ( 1 1 )"; private MgByteReader byteReader; private String geometryAgfText; agfReaderWriter = new MgAgfReaderWriter(); wktReaderWriter = new MgWktReaderWriter(); // In the string to geometry direction: pt11FromText = wktReaderWriter.Read(pt11TextSpec) as MgPoint; byteReader = agfReaderWriter.Write(pt11FromText); // In the geometry to string direction: pt11 = agfReaderWriter.Read(byteReader); geometryAgfText = wktReaderWriter.Write(pt11); // geometryAgfText now contains the text representation of the geometry