Hi all
I am having fun learning how to draw a chart using BPMN (Business Process
Modelling Notation).
Here is a link to a poster showing all the symbols -
http://bpt.hpi.uni-potsdam.de/pub/Public/BPMNCorner/BPMN1_1_Poster_EN.pdf
Drawing the symbols in no real problem - some of them are quite challenging,
but that is part of the fun.
I am trying to work out how to do a HitTest, so that I can detect if the
user wants to drag a symbol. At this stage I am concentrating on a Circle.
GraphicsPath has a Contains() method - you pass it a Point, and it returns
True if the point is within the path, else False. This seems like the
obvious way to perform the test.
If you run the attached program, you will see that there are three circles.
One is a plain circle, the second has a thick transparent border, and the
third has a thick solid border.
Using gtk2, HitTest always returns None, no matter where I click. Maybe the
Contains() method is not supported on gtk2. [See my P.S. at the bottom]
Using msw, HitTest works correctly, but it is actually cleverer than I want
it to be. The first circle works perfectly, the second two return True if I
click within the border, but False if I click in the centre of the circle. I
want a click anywhere within the outer circle to return True, but I cannot
figure out how to do it.
I have tried three approaches -
1. AddCircle() for the outer and the inner circles
2. AddCircle() for the outer, then create a sub-path and AddCircle() to the
sub-path for the inner circle
3. AddEllipse() for the outer and the inner circles
They all give the same result.
I do not have a clear understanding of what constitutes a Path, what
constitutes a SubPath, how the Stroke/Fill/Draw methods interact with them,
and how to manipulate them to give the desired effect. The docs do not give
any assistance here.
Most symbols are quite a bit more complex than a simple circle. I will need
to detect a click anywhere within outer perimeter of the shape.
Any info will be much appreciated.
Frank Millman
P.S. I have just noticed that gtk2 returns True if you click on the actual
line defining the circle, but not if you click within the circle.
Unfortunately this does not help me.
bpmn11.py (2.41 KB)