Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a class that inherits from BaseDynamicLayer and I override the DrawDynamicLayer() method. Is there something special that needs to be done for a successful inDynamicDisplay.DrawPolygon(poly) call? The method crashes every time I call it with a "Exception from HRESULT: 0x80040218." I can use the same point collection to create a Polyline and call DrawPolyline(polyLine) without a problem. I can also successfully use all the other draw commands, like DrawMarker() & DrawRectangle().

share|improve this question
add comment

1 Answer

Is your polygon a simple geometry? You may need to invoke simplify and then try to draw it.

Here's an example of simplifying a polygon

//Set the IsKnownSimple property to false, 
//otherwise simplification will not take place.
ITopologicalOperator2 topoOp = geometry as ITopologicalOperator2;
topoOp.IsKnownSimple_2 = true;
topoOp.Simplify();
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.