[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dr-geo] Done with storing points and its implementation
From: |
Gurjot Singh Bhatti |
Subject: |
[Dr-geo] Done with storing points and its implementation |
Date: |
Tue, 12 Aug 2014 13:45:22 +0530 |
Here is what I have done.
I have implemented a container class in kernel that stores the points
that'd be drawn on the drawing area using Cairo.
Since points are the basic unit for other entities, it is paramount
that we store these points in some memory blocks.
I have used 'vector' to store these points. I have chosen 'vector'
instead of using other types of containers like map, array, etc.
because the points are not associated with any key and their order of
storing does not make much of a difference.
I have implemented such that the line which was previously drawn on
two random clicks on the drawing-area is now drawn only when the mouse
click happens on a previously drawn point.
So now when 'line' menu is selected, motion event is enabled which
checks the current mouse position and compare it with the stored
coordinate values in our vector. If the current position matches, the
cursor shape changes to pencil.
Now when the user clicks on it, the already stored values are set for
the starting/ending coordinates of line. This is done to draw line if
the point exists.
There is some pre-defined radius/ effective region in which the point
exists, this enables the user to click in this region and still be
able to point to the nearest stored value of the point.
"Snap-to-point".
Today I'll implement circle and arc in the same manner.
Regards
--
Gurjot Singh Bhatti
Blog: http://bhattigurjot.wordpress.com
"It takes a person who is wide awake to make his dream come true." ~
Roger Babson
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dr-geo] Done with storing points and its implementation,
Gurjot Singh Bhatti <=