This project has moved and is read-only. For the latest updates, please go here.

Implementation of Free Polygon

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



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.

Oct 29, 2012 at 11: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 5:31 AM

Thanks. I'll try it.

Have a good day!