MapGuide API Reference
|
An MgMultiLineString is a one-dimensional aggregate geometry whose elements are MgLineString geometries. More...
Public Member Functions | |
virtual MgGeometricEntity * | Copy () |
virtual INT32 | GetCount () |
virtual INT32 | GetDimension () |
virtual INT32 | GetGeometryType () |
virtual MgLineString * | GetLineString (INT32 index) |
virtual bool | IsClosed () |
virtual bool | IsEmpty () |
virtual MgGeometricEntity * | Transform (MgTransform *transform) |
An MgMultiLineString is a one-dimensional aggregate geometry whose elements are MgLineString geometries.
// A helper class additional to those created in the // MgLineString example code is needed. $lineStringCollection = new MgLineStringCollection(); // After each MgLineString geometry is constructed, // it is added to an MgLineStringCollection. $index = $lineStringCollection->Add($lineString); echo "A line string is added to a line string collection at index: $index\n"; // construct the MgMultiLineString geometry $multiLineString = $geometryFactory->CreateMultiLineString($lineStringCollection); // print out the Agf Text string for the geometry $multiLineStringAgfText = $wktReaderWriter->Write($multiLineString); echo "AGF Text representation of MultiLineString: $multiLineStringAgfText\n";
using OSGeo.MapGuide; private MgWktReaderWriter wktReaderWriter; private MgGeometryFactory geometryFactory; private MgMultiLineString mlsLs0121Ls1121; // the data for 1 linestring private double[,] da0121 = { { 0, 1 }, { 2, 1 } }; // the data for another linestring private double[,] da1121 = { { 1, 1 }, { 2, 1 } }; // the data for 2 linestrings private double[][,] mlsLs0121Ls1121Data; private String geometryAgfText; public MgMultiLineString CreateAMultiLineStringXY(double[][,] lineStrings) { MgLineStringCollection lines = new MgLineStringCollection(); for (int i = 0; i < lineStrings.GetLength(0); i++) { lines.Add(CreateALineStringXY(lineStrings[i])); } return geometryFactory.CreateMultiLineString(lines); } geometryFactory = new MgGeometryFactory(); mlsLs0121Ls1121Data = new double[2][,]; mlsLs0121Ls1121Data[0] = da0121; mlsLs0121Ls1121Data[1] = da1121; mlsLs0121Ls1121 = CreateAMultiLineStringXY(mlsLs0121Ls1121Data); // print out the Agf Text string for the geometry wktReaderWriter = new MgWktReaderWriter(); geometryAgfText = wktReaderWriter.Write(mlsLs0121Ls1121); // geometryAgfText now contains: // "MULTILINESTRING XY ((0 1, 2 1), (1 1, 2 1))"