I selected many geometries, including points, lines and polygons, from 3 layers. and then I make a MgMultiGeometry? based on the MgGeometryCollection? of these selected geometries, and then I make a buffer of this MgMultiGeometry?.
Theorectically, if these selected geometries are very close, the buffer geometry should be a single polygon, or else, the buffer might be a MgMultiPolygon?.
But what I got is always a geometry of MgPolygon? even though it is visually shown as many disconnected polygons.
I found this problem is because I need a spatialfilter to select geometries on the map. When I create a buffer, composed of many polygon, of selected geometries as the spatialfilter, I found only those geometried intersected with some a polygon of the buffer can be selected out.
I stepped into the code and found the generated buffer is really of type 'MgPolygon?' but with data of 'MgMultiPolygon?'.
Follow is part of the code:
MgGeometryCollection? mgc = GetGeometryCollectionFromSelectionXML(SelectionXML);
if (mgc.Count > 0)
{
MgGeometryFactory? geomFactory = new MgGeometryFactory?();
MgGeometry? geo = null;
if (mgc.Count == 1)
geo = mgc.GetItem?(0);
else
geo = geomFactory.CreateMultiGeometry?(mgc);
MgGeometry? Buffer = geo.Buffer(dist, null);
......
}