English

How To: Use a polygon as a FilterShape

Summary

A variant of type IUnknown must be used as a FilterShape in some development environments.

Procedure

In Delphi:

Code:
vaPoly := OleVariant(filterShape);
layer.FilterOperator := moAreaIntersect;
layer.FilterShape := IUnknown(vaPoly);

In Visual C++:

Code:
VARIANT vShape;
VariantInit(&vShape);
vShape.vt = VT_UNKNOWN;
vShape.punkVal = filterShp.m_lpDispatch;

layer.SetFilterOperator(moAreaIntersect);
layer.SetFilterShape(vShape);


In Visual Basic simply write the shape into the FilterShape property.

Code:
layer.FilterOperator = moAreaIntersect
Set lyr.FilterShape = shp