Implementation of Free Polygon

Oct 29, 2012 at 8:05 AM
Edited Oct 29, 2012 at 8:06 AM

Hello.

 

I want to implement a new shape, 'Free Polygon'.

- Has variable vertexes, like Regular Polygon

- Each vertex can be moved any position, like Free Triangle

 

Could you tell me the way?

 

Thank you.

Coordinator
Oct 29, 2012 at 10:42 AM

Start a new DLL project. Search this discussion for "NShapeInitializer" for learning how to turn your DLL in an NShape shape library (implement the NShapeInitializer method).

Take the code of the FreeTriangle as base for your new class (or derive your shape from TriangleBase). For the fist step, add one additional point (search for occurences of field "shapePoints") and try to get it working.
Then, have a look at the implemenation of RegularPolygone to get the implementations of all methods dealing with ControlPoints and ControlPointIds.
Implement the hit tests (IsHit, ContainsPoint, IntersectsWith) and the IEntity interface (static method GetPropertyDefinitions, SaveFieldsCore/LoadFieldsCode methods).

Nov 1, 2012 at 4:31 AM

Thanks. I'll try it.

Have a good day!