Miscellaneous support functions for OGL.
params marked with ‘???’ need review!
Centre a text |
|
Check for line intersection |
|
Draw arc to ellipse |
|
Draw formatted text |
|
Find the end for a box |
|
Find end for a circle |
|
Find the end for a polyline |
|
Format a text |
|
Get point on arrow |
|
Get the centred text extend |
|
Get point on a line |
|
Straighten a line in graphics |
|
Hittest for a polyline |
|
Check if values are roughly equal |
CentreText
(dc, text_list, xpos, ypos, width, height, formatMode)¶Centre a text
dc – the wx.MemoryDC
text_list – a list of texts
xpos – the x position
ypos – the y position
width – the width of the box???
height – the height of the box???
formatMode – one of the format modes, can be combined in a bit list
Format mode name |
Description |
---|---|
|
Left justification |
|
Centre horizontally |
|
Centre vertically |
|
Resize shape to contents |
CheckLineIntersection
(x1, y1, x2, y2, x3, y3, x4, y4)¶Check for line intersection
x1 – x1 position
y1 – y1 position
x2 – x2 position
y2 – y2 position
x3 – x3 position
y3 – y3 position
x4 – x4 position
y4 – y4 position
a length ratio and a k line???
DrawArcToEllipse
(x1, y1, width1, height1, x2, y2, x3, y3)¶Draw arc to ellipse
x1 – x1 position
y1 – y1 position
width1 – width
height1 – height
x2 – x2 position
y2 – y2 position
x3 – x3 position
y3 – y3 position
ellipse points ???
DrawFormattedText
(dc, text_list, xpos, ypos, width, height, formatMode)¶Draw formatted text
dc – the wx.MemoryDC
text_list – a list of texts
xpos – the x position
ypos – the y position
width – the width of the box???
height – the height of the box???
formatMode – one of the format modes, can be combined in a bit list
Format mode name |
Description |
---|---|
|
Left justification |
|
Centre horizontally |
|
Centre vertically |
|
Resize shape to contents |
FindEndForBox
(width, height, x1, y1, x2, y2)¶Find the end for a box
width – the width of the box
height – the height of the box
x1 – x1 position
y1 – y1 position
x2 – x2 position
y2 – y2 position
the end position
FindEndForCircle
(radius, x1, y1, x2, y2)¶Find end for a circle
radius – radius
x1 – x1 position
y1 – y1 position
x2 – x2 position
y2 – y2 position
end position
FindEndForPolyline
(xvec, yvec, x1, y1, x2, y2)¶Find the end for a polyline
xvec – x vector ???
yvec – y vector ???
x1 – x1 position
y1 – y1 position
x2 – x2 position
y2 – y2 position
the end position
FormatText
(dc, text, width, height, formatMode)¶Format a text
dc – the wx.MemoryDC
text – the text to format
width – the width of the box???
height – the height of the box??? it is not used in the code!
formatMode – one of the format modes, can be combined in a bit list
Format mode name |
Description |
---|---|
|
Left justification |
|
Centre horizontally |
|
Centre vertically |
|
Resize shape to contents |
a list of strings fitting in the box
GetArrowPoints
(x1, y1, x2, y2, length, width)¶Get point on arrow
x1 – x1 position
y1 – y1 position
x2 – x2 position
y2 – y2 position
length – length ???
width – width ???
point on line
GetCentredTextExtent
(dc, text_list, xpos=0, ypos=0, width=0, height=0)¶Get the centred text extend
dc – the wx.MemoryDC
text_list – a list of text lines
xpos – unused
ypos – unused
width – unused
height – unused
maximum width and the height
GetPointOnLine
(x1, y1, x2, y2, length)¶Get point on a line
x1 – x1 position
y1 – y1 position
x2 – x2 position
y2 – y2 position
length – length ???
point on line
GraphicsStraightenLine
(point1, point2)¶Straighten a line in graphics
point1 – a point list???
point2 – a point list???
PolylineHitTest
(xvec, yvec, x1, y1, x2, y2)¶Hittest for a polyline
xvec – x vector ???
yvec – y vector ???
x1 – x1 position
y1 – y1 position
x2 – x2 position
y2 – y2 position
True
or False
RoughlyEqual
(val1, val2, tol=0.00001)¶Check if values are roughly equal
val1 – the first value to check
val2 – the second value to check
tol – the tolerance, defaults to 0.00001
True
or False