wx.lib.ogl.basic.PolygonShape¶
The PolygonShape
class shape is defined by a number of points
passed to the object’s constructor. It can be used to create new shapes
such as diamonds and triangles.
Class Hierarchy¶
Known Superclasses¶
Methods Summary¶
Default class constructor |
|
Add a control point after the given point. |
|
Is attachment valid? |
|
Calculate the bounding box. |
|
Recalculates the centre of the polygon, and |
|
Clear the points. |
|
Takes a list of |
|
Delete the given control point. |
|
Get attachment position. |
|
Get minimum bounding box. |
|
Get number of attachments. |
|
Get the original height. |
|
Get the original points. |
|
Get the original width. |
|
Get the perimeter point. |
|
Return the internal list of polygon vertices. |
|
Hit text |
|
Make control points. |
|
The draw handler. |
|
The draw outline handler. |
|
The sizing begin drag left handler. |
|
The sizing drag left handler. |
|
The sizing end drag left handler. |
|
Reset control points. |
|
Rotate about the given axis by the given amount in radians. |
|
Set the original height. |
|
Set the original width. |
|
Set the size |
|
If we’ve changed the shape, must make the original points match the |
Class API¶
- class PolygonShape(Shape)¶
The
PolygonShape
class shape is defined by a number of points passed to the object’s constructor. It can be used to create new shapes such as diamonds and triangles.
Methods¶
- __init__(self)¶
Default class constructor
Does not follow above statement, should it? or is Create called automagically?
- AddPolygonPoint(self, pos)¶
Add a control point after the given point.
- Parameters:
pos – position of point
- AttachmentIsValid(self, attachment)¶
Is attachment valid?
- Parameters:
attachment – ???
- CalculateBoundingBox(self)¶
Calculate the bounding box.
- CalculatePolygonCentre(self)¶
Recalculates the centre of the polygon, and readjusts the point offsets accordingly. Necessary since the centre of the polygon is expected to be the real centre of the bounding box.
- ClearPoints(self)¶
Clear the points.
- Create(self, the_points=None)¶
Takes a list of
wx.Points
or tuples; each point is an offset from the centre.
- DeletePolygonPoint(self, pos)¶
Delete the given control point.
- Parameters:
pos – position of point
- GetAttachmentPosition(self, attachment, nth=0, no_arcs=1, line=None)¶
Get attachment position.
- Parameters:
attachment – the attachment ???
nth – get nth attachment ???
no_arcs – ???
line – ???
- GetBoundingBoxMin(self)¶
Get minimum bounding box.
- GetNumberOfAttachments(self)¶
Get number of attachments.
- GetOriginalHeight(self)¶
Get the original height.
- GetOriginalPoints(self)¶
Get the original points.
- GetOriginalWidth(self)¶
Get the original width.
- GetPerimeterPoint(self, x1, y1, x2, y2)¶
Get the perimeter point.
- Parameters:
x1 – the x1 position
y1 – the y1 position
x2 – the x2 position
y2 – the y2 position
- GetPoints(self)¶
Return the internal list of polygon vertices.
- HitTest(self, x, y)¶
Hit text
- Parameters:
x – the x position
y – the y position
- MakeControlPoints(self)¶
Make control points.
- OnDraw(self, dc)¶
The draw handler.
- OnDrawOutline(self, dc, x, y, w, h)¶
The draw outline handler.
- OnSizingBeginDragLeft(self, pt, x, y, keys=0, attachment=0)¶
The sizing begin drag left handler.
- OnSizingDragLeft(self, pt, draw, x, y, keys=0, attachment=0)¶
The sizing drag left handler.
- OnSizingEndDragLeft(self, pt, x, y, keys=0, attachment=0)¶
The sizing end drag left handler.
- ResetControlPoints(self)¶
Reset control points.
- Rotate(self, x, y, theta)¶
Rotate about the given axis by the given amount in radians.
- Parameters:
x – the x position
y – the y position
theta – the theta
- SetOriginalHeight(self, h)¶
Set the original height.
- Parameters:
w – the height
- SetOriginalWidth(self, w)¶
Set the original width.
- Parameters:
w – the width
- SetSize(self, new_width, new_height, recursive=True)¶
Set the size
- Parameters:
new_width – the width
new_height – the height
recursive – not used
- UpdateOriginalPoints(self)¶
If we’ve changed the shape, must make the original points match the working points with this function.