[mapguide-trac] #287: wrong type of the buffer of more than one geometried

MapGuide Open Source trac_mapguide at osgeo.org
Mon Oct 15 09:06:29 EDT 2007


#287: wrong type of the buffer of more than one geometried
-------------------------------+--------------------------------------------
   Reporter:  carlshe          |       Owner:        
       Type:  defect           |      Status:  new   
   Priority:  medium           |   Milestone:        
  Component:  Feature Service  |     Version:  1.2.0 
   Severity:  major            |    Keywords:  Buffer
External_id:                   |  
-------------------------------+--------------------------------------------
 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);
                 ......
             }

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/287>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list