I am trying to draw an EllipticArc (or any other Segment for that matter) in my Dynamic Layer using the ArcObjects C++ API. For something that seems like it should be straightforward, I am having a very hard time figuring it out. So far I have taken these steps:
- Create the EllipticArc itself. I have confirmed that I have created one and that its geometry is correct.
- Cast the EllipticArc to a PointCollection so it may be drawn by DynamicDislay.
The problem seems to be that the PointCollection I create contains 0 points, and I am not sure how to solve this problem.
Here is what I have so far:
PointCollection4Ptr finalform(CLSID_Polyline); IConstructEllipticArcPtr arcCon(CLSID_EllipticArc); /*Code to construct arc omitted, it was rather lengthy. I have confirmed that the arc was correctly constructed and that the object exists*/ IEllipticArcPtr arc = arcCon; //Cast to a PointCollection so we can draw it IPointCollection4Ptr pointcol = arc; finalform->AddPointCollection(pointcol); std::cout<<"before pointcount\n"; long pc; finalform->get_PointCount(&pc); std::cout<<pc<<std::endl; std::cout<<"after pointcount\n"; pDynamicDisplay->DrawPolyline(finalform);
The code outputs that the pointcount is 0.
Am I completely missing something here? I feel like this should be straightforward, but I have had no luck drawing any Segment on my Dynamic Layer. How is this supposed to be done? Can it be done? Is there a solution for drawing Segments on non-dynamic layers that I will have to use? (I hope not...)
Any input is appreciated!