Package wx :: Package lib :: Package ogl :: Class PolygonShape

[frames | no frames]

## Type PolygonShape

         object --+
                  |
    ShapeEvtHandler --+
                      |
                  Shape --+
                          |
                         PolygonShape

A PolygonShape's 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.

Method Summary
| `__init__(self)`
| ``AddPolygonPoint`(self, pos)` Add a control point after the given point.
| ``AttachmentIsValid`(self, attachment)` TRUE if attachment is a valid attachment point.
| `CalculateBoundingBox(self)`
| ``CalculatePolygonCentre`(self)` Recalculates the centre of the polygon, and readjusts the point offsets accordingly.
| `ClearPoints(self)`
| ``Create`(self, the_points)` Takes a list of wx.RealPoints or tuples; each point is an offset from the centre.
| ``DeletePolygonPoint`(self, pos)` Delete the given control point.
| ``GetAttachmentPosition`(self, attachment, nth, no_arcs, line)` Get the position at which the given attachment point should be drawn.
| ``GetBoundingBoxMin`(self)` Get the minimum bounding box for the shape, that defines the area available for drawing the contents (such as text).
| ``GetNumberOfAttachments`(self)` Get the number of attachment points for this shape.
| `GetOriginalHeight(self)`
| `GetOriginalPoints(self)`
| `GetOriginalWidth(self)`
| ``GetPerimeterPoint`(self, x1, y1, x2, y2)` Get the point at which the line from (x1, y1) to (x2, y2) hits the shape.
| ``GetPoints`(self)` Return the internal list of polygon vertices.
| ``HitTest`(self, x, y)` Given a point on a canvas, returns TRUE if the point was on the shape, and returns the nearest attachment point and distance from the given point and target.
| ``MakeControlPoints`(self)` Make a list of control points (draggable handles) appropriate to the shape.
| `OnDraw(self, dc)`
| `OnDrawOutline(self, dc, x, y, w, h)`
| `OnSizingBeginDragLeft(self, pt, x, y, keys, attachment)`
| `OnSizingDragLeft(self, pt, draw, x, y, keys, attachment)`
| `OnSizingEndDragLeft(self, pt, x, y, keys, attachment)`
| ``ResetControlPoints`(self)` Reset the positions of the control points (for instance when the shape's shape has changed).
| ``Rotate`(self, x, y, theta)` Rotate about the given axis by the given amount in radians.
| `SetOriginalHeight(self, h)`
| `SetOriginalWidth(self, w)`
| `SetSize(self, new_width, new_height, recursive)`
| ``UpdateOriginalPoints`(self)` If we've changed the shape, must make the original points match the working points with this function.

Class Variable Summary

Method Details

### AddPolygonPoint(self, pos)

Add a control point after the given point.

### AttachmentIsValid(self, attachment)

TRUE if attachment is a valid attachment point.

  Overrides:
    `wx.lib.ogl.Shape.AttachmentIsValid` (inherited documentation)

### 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.

### Create(self, the_points=None)

Takes a list of wx.RealPoints or tuples; each point is an offset from the centre.

### DeletePolygonPoint(self, pos)

Delete the given control point.

### GetAttachmentPosition(self, attachment, nth=0, no_arcs=1, line=None)

Get the position at which the given attachment point should be drawn.

If attachment isn't found among the attachment points of the shape, returns None.

  Overrides:
    `wx.lib.ogl.Shape.GetAttachmentPosition` (inherited documentation)

### GetBoundingBoxMin(self)

Get the minimum bounding box for the shape, that defines the area available for drawing the contents (such as text).

Must be overridden.

  Overrides:
    `wx.lib.ogl.Shape.GetBoundingBoxMin` (inherited documentation)

### GetNumberOfAttachments(self)

Get the number of attachment points for this shape.

  Overrides:
    `wx.lib.ogl.Shape.GetNumberOfAttachments` (inherited documentation)

### GetPerimeterPoint(self, x1, y1, x2, y2)

Get the point at which the line from (x1, y1) to (x2, y2) hits the shape. Returns False if the line doesn't hit the perimeter.

  Overrides:
    `wx.lib.ogl.Shape.GetPerimeterPoint` (inherited documentation)

### GetPoints(self)

Return the internal list of polygon vertices.

### HitTest(self, x, y)

Given a point on a canvas, returns TRUE if the point was on the shape, and returns the nearest attachment point and distance from the given point and target.

  Overrides:
    `wx.lib.ogl.Shape.HitTest` (inherited documentation)

### MakeControlPoints(self)

Make a list of control points (draggable handles) appropriate to the shape.

  Overrides:
    `wx.lib.ogl.Shape.MakeControlPoints` (inherited documentation)

### ResetControlPoints(self)

Reset the positions of the control points (for instance when the shape's shape has changed).

  Overrides:
    `wx.lib.ogl.Shape.ResetControlPoints` (inherited documentation)

### Rotate(self, x, y, theta)

Rotate about the given axis by the given amount in radians.

  Overrides:
    `wx.lib.ogl.Shape.Rotate` (inherited documentation)

### UpdateOriginalPoints(self)

If we've changed the shape, must make the original points match the working points with this function.

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:07:54 2007 | http://epydoc.sf.net