esriGeometry::ITopologicalOperatorPtr topoOp = pGeo; // pGeo initialized earlier if (topoOp != NULL) { VARIANT_BOOL isSimple = VARIANT_TRUE; hr = topoOp->get_IsSimple(&isSimple); // returns 'true' for the geometry in question if (VARIANT_FALSE == isSimple) { // Simplifies the geometry in place hr = topoOp->Simplify(); } } esriGeometry::IWkbPtr ipWkb = pGeo; long reqSize = 0; if (FAILED(hr = ipWkb->get_WkbSize(&reqSize))) { return false; } esriGeometry::esriGeometryType aoGeoType; hr = pGeo->get_GeometryType(&aoGeoType); unsigned char* pInOutWorkingBuffer = new unsigned char[reqSize]; if (FAILED(hr = ipWkb->ExportToWkb(&reqSize, pInOutWorkingBuffer))) { // Fails here with hr=-2147220968 return false; }
Solved! Go to Solution.