IGeometryBagPtr cGeometryBag(CLSID_GeometryBag); IGeometryCollectionPtr cGeometryCollection = cGeometryBag; // QI IGeometryPtr * cGeomVector = new IGeometryPtr[len]; for (i = 0; i < len; i++) { IPointCollectionPtr cPointCollection(CLSID_Polygon); // I fill the cPointCollection object with my polygones (triangles) IPolygonPtr cPolygon = cPointCollection; // QI cGeomVector = cPolygon; } hr = cGeometryCollection -> AddGeometries((long)len, (IGeometry**)cGeomVector); if (FAILED(hr)) { cout << "Impossible to add geometries" << std::endl; return; } long cGeomCount; hr = cGeometryCollection -> get_GeometryCount(&cGeomCount); if (FAILED(hr)) { cout << "Impossible to calculate the number of geometries (1)" << std::endl; return; } cout << "Number of geometries (1): " << cGeomCount << std::endl; // in this dump I see that the number of geometries (in the GeometryCollection) is OK IEnumGeometryPtr cEnumGeometry = cGeometryBag; // QI hr = cEnumGeometry -> get_Count(&cGeomCount); if (FAILED(hr)) { cout << "Impossible to calculate the number of geometries (2)" << std::endl; return; } cout << "Number of geometries (2): " << cGeomCount << std::endl; // in this dump I see that the number of geometries (in the EnumGeometry) is OK IPolygonPtr cResultPolygon(CLSID_Polygon); ITopologicalOperator2Ptr cTopoOp = cResultPolygon; hr = cTopoOp -> ConstructUnion(cEnumGeometry); if (FAILED(hr)) { cout << "Impossible to do ConstructUnion" << std::endl; return; } IPointCollectionPtr cFinalPointCollection = cResultPolygon; // QI hr = cFinalPointCollection -> get_PointCount(&cGeomCount); if (FAILED(hr)) { cout << "Impossible to calculate the number of points (3)" << std::endl; return; } cout << "Number of points (3): " << cGeomCount << std::endl; // In this dump the number (of points of the new geometry) is not OK, is always zero!
IPointCollectionPtr cFinalPointCollection = cResultPolygon; // QI
IPointCollectionPtr cFinalPointCollection = cTopoOp; // QI
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.