[mapguide-users] Problem whit generate kml from mapguide.

Traian Stanev traian.stanev at autodesk.com
Wed Jan 23 11:25:42 EST 2008


OK, so I don't get it. Are you dealing with an MgPolygon or an MgMultiPolygon. If it is an MgMultiPolygon, it will contain a collection of polygons, each of which can be read in with the code in my original email below. You can iterate over the polygons in the multipolygon as follows:

    INT32 nPolygons = multiPolygon->GetCount();
    for (INT32 i = 0; i < nPolygons; i++)
    {
        Ptr<MgPolygon> polygon = multiPolygon->GetPolygon(i);

        //use something similar to code from my previous message to read the polygon
        DoPolygonStuff();
    }


Traian


> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-
> bounces at lists.osgeo.org] On Behalf Of Maciej Skorczewski
> Sent: Wednesday, January 23, 2008 9:58 AM
> To: MapGuide Users Mail List
> Subject: Re: [mapguide-users] Problem whit generate kml from mapguide.
>
> hi still whitout any results :(
>
> what i try to do i get coords (x,y) of all polygons...the problem is
> that this are 3 polygon in one source row...
>
> http://www.imagehost.ro/pict/2316512147975469a645f.JPG
>
>
> thx for eny help.
>
> maciek
>
>
>
>
>
>  > Traian Stanev
> > Here is an excerpt from some C++ code from MapGuide that seems to do
> something to that effect. You will need to replicate
> > The for loop that iterates over the inner rings:
> >
> >     INT32 outerNumRings = 0;
> >     Ptr<MgLinearRing> outerRing = polygon->GetExteriorRing();
> >
> >     // OuterRing
> >     int currentIndex = 0;
> >     Ptr<MgCoordinateIterator> iter = outerRing->GetCoordinates();
> >     int nCoords = CoordinateIteratorToFloatArray(bufferParams, iter,
> vertices, currentIndex);
> >     if (nCoords > 0)
> >     {
> >         nPolyVerts[0] = nCoords; // outerRing coordinates
> >     }
> >
> >     INT32 innerNumRings = polygon->GetInteriorRingCount();
> >
> >     // Inner rings
> >     for (int i = 0; i < innerNumRings; i++)
> >     {
> >         Ptr<MgLinearRing> innerRing = polygon->GetInteriorRing(i); //
> Get Ring
> >         Ptr<MgCoordinateIterator> iter1 = innerRing-
> >GetCoordinates();
> >         nCoords = CoordinateIteratorToFloatArray(bufferParams, iter1,
> vertices, currentIndex); // Covert to OpsFloatPoint
> >         if (nCoords > 0)
> >         {
> >             nPolyVerts[i+1] = nCoords;
> >         }
> >     }
> >
> >
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list