keyu21

How to get the exterior ring from newly polygon?

Discussion created by keyu21 on Apr 8, 2011
Latest reply on Apr 10, 2011 by keyu21
I used follow code to create a polygon:
    IPolygonPtr poly;
    poly.CreateInstance(CLSID_Polygon);
    IGeometryCollectionPtr pGeos;
    poly->QueryInterface(&pGeos);
    for( int i = 0;.....
    {
          IRingPtr ring;
 ring.CreateInstance(CLSID_Ring);
 IPointCollectionPtr ps;
 ring->QueryInterface(&ps);
 for (long j = 0;..........
 {
  IPointPtr pnt;
  pnt.CreateInstance(CLSID_Point);
  pnt->PutCoords(p[k].x, p[k].y);
  ps->AddPoint(pnt);
 }
 HRESULT hr = pGeos->AddGeometry(ring, NULL, NULL);
     }


After create it , I want to get the Exterior ring to check its direction. I use get_ExteriorRingBag method, And I got nothing? Why the exterior rings is NULL?

Outcomes