@@ -175,8 +175,10 @@ bool CShapefile::SelectShapesCore(Extent& extents, double Tolerance, SelectMode
175175 shapeVal = i;
176176 }
177177
178- IShape* shape = _shapeData[shapeVal]->shape ;
179- // convert querying shape to GEOS
178+ // get current shape
179+ CComPtr<IShape> shape = nullptr ;
180+ get_Shape (shapeVal, &shape);
181+ // convert querying shape to GEOS
180182 GEOSGeom geosShape = GeosConverter::ShapeToGeom (shape);
181183 // check for containment
182184 if (GeosHelper::Contains (geosShape, geosPoint))
@@ -255,9 +257,10 @@ bool CShapefile::SelectShapesCore(Extent& extents, double Tolerance, SelectMode
255257
256258 if ( shpType2D == SHP_POLYLINE && SelectMode == INTERSECTION)
257259 {
258- // get current shape
259- IShape* shape = _shapeData[shapeVal]->shape ;
260- // convert shape to GEOS
260+ // get current shape
261+ CComPtr<IShape> shape = nullptr ;
262+ get_Shape (shapeVal, &shape);
263+ // convert shape to GEOS
261264 GEOSGeom geos = GeosConverter::ShapeToGeom (shape);
262265 // see if shape intersects polygon extent
263266 if (GeosHelper::Intersects (geosExtent, geos))
@@ -271,10 +274,11 @@ bool CShapefile::SelectShapesCore(Extent& extents, double Tolerance, SelectMode
271274 // }
272275 }
273276 else if ( shpType2D == SHP_POLYGON && SelectMode == INTERSECTION)
274- {
275- // get current shape
276- IShape* shape = _shapeData[shapeVal]->shape ;
277- // convert shape to GEOS
277+ {
278+ // get current shape
279+ CComPtr<IShape> shape = nullptr ;
280+ get_Shape (shapeVal, &shape);
281+ // convert shape to GEOS
278282 GEOSGeom geos = GeosConverter::ShapeToGeom (shape);
279283 // see if shape intersects polygon extent
280284 if (GeosHelper::Intersects (geosExtent, geos))
0 commit comments