.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2017 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.ogl.basic

.. highlight:: python



.. _wx.lib.ogl.basic.PolygonShape:

==========================================================================================================================================
|phoenix_title|  **wx.lib.ogl.basic.PolygonShape**
==========================================================================================================================================

The :class:`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| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>PolygonShape</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.ogl.basic.PolygonShape_inheritance.png" alt="Inheritance diagram of PolygonShape" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.ogl.basic.Shape.html" title="wx.lib.ogl.basic.Shape" alt="" coords="39,83,200,112"/> <area shape="rect" id="node3" href="wx.lib.ogl.basic.PolygonShape.html" title="wx.lib.ogl.basic.PolygonShape" alt="" coords="15,160,224,189"/> <area shape="rect" id="node2" href="wx.lib.ogl.basic.ShapeEvtHandler.html" title="wx.lib.ogl.basic.ShapeEvtHandler" alt="" coords="5,5,235,35"/> </map> 
   </p>

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.ogl.basic.Shape`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.ogl.basic.PolygonShape.__init__`                                  Default class constructor
:meth:`~wx.lib.ogl.basic.PolygonShape.AddPolygonPoint`                           Add a control point after the given point.
:meth:`~wx.lib.ogl.basic.PolygonShape.AttachmentIsValid`                         Is attachment valid?
:meth:`~wx.lib.ogl.basic.PolygonShape.CalculateBoundingBox`                      Calculate the bounding box.
:meth:`~wx.lib.ogl.basic.PolygonShape.CalculatePolygonCentre`                    Recalculates the centre of the polygon, and
:meth:`~wx.lib.ogl.basic.PolygonShape.ClearPoints`                               Clear the points.
:meth:`~wx.lib.ogl.basic.PolygonShape.Create`                                    Takes a list of :class:`wx.Points` or tuples; each point is an offset
:meth:`~wx.lib.ogl.basic.PolygonShape.DeletePolygonPoint`                        Delete the given control point.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetAttachmentPosition`                     Get attachment position.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetBoundingBoxMin`                         Get minimum bounding box.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetNumberOfAttachments`                    Get number of attachments.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetOriginalHeight`                         Get the original height.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetOriginalPoints`                         Get the original points.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetOriginalWidth`                          Get the original width.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetPerimeterPoint`                         Get the perimeter point.
:meth:`~wx.lib.ogl.basic.PolygonShape.GetPoints`                                 Return the internal list of polygon vertices.
:meth:`~wx.lib.ogl.basic.PolygonShape.HitTest`                                   Hit text
:meth:`~wx.lib.ogl.basic.PolygonShape.MakeControlPoints`                         Make control points.
:meth:`~wx.lib.ogl.basic.PolygonShape.OnDraw`                                    The draw handler.
:meth:`~wx.lib.ogl.basic.PolygonShape.OnDrawOutline`                             The draw outline handler.
:meth:`~wx.lib.ogl.basic.PolygonShape.OnSizingBeginDragLeft`                     The sizing begin drag left handler.
:meth:`~wx.lib.ogl.basic.PolygonShape.OnSizingDragLeft`                          The sizing drag left handler.
:meth:`~wx.lib.ogl.basic.PolygonShape.OnSizingEndDragLeft`                       The sizing end drag left handler.
:meth:`~wx.lib.ogl.basic.PolygonShape.ResetControlPoints`                        Reset control points.
:meth:`~wx.lib.ogl.basic.PolygonShape.Rotate`                                    Rotate about the given axis by the given amount in radians.
:meth:`~wx.lib.ogl.basic.PolygonShape.SetOriginalHeight`                         Set the original height.
:meth:`~wx.lib.ogl.basic.PolygonShape.SetOriginalWidth`                          Set the original width.
:meth:`~wx.lib.ogl.basic.PolygonShape.SetSize`                                   Set the size
:meth:`~wx.lib.ogl.basic.PolygonShape.UpdateOriginalPoints`                      If we've changed the shape, must make the original points match the
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: PolygonShape(Shape)

   The :class:`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.

   .. method:: __init__(self)

      Default class constructor
      
      Does not follow above statement, should it? or is Create called
      automagically?


   .. method:: AddPolygonPoint(self, pos)

      Add a control point after the given point.
      
      :param `pos`: position of point


   .. method:: AttachmentIsValid(self, attachment)

      Is attachment valid?
      
      :param `attachment`: ???


   .. method:: CalculateBoundingBox(self)

      Calculate the bounding box.


   .. method:: 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.


   .. method:: ClearPoints(self)

      Clear the points.


   .. method:: Create(self, the_points = None)

      Takes a list of :class:`wx.Points` or tuples; each point is an offset
      from the centre.


   .. method:: DeletePolygonPoint(self, pos)

      Delete the given control point.
      
      :param `pos`: position of point


   .. method:: GetAttachmentPosition(self, attachment, nth = 0, no_arcs = 1, line = None)

      Get attachment position.
      
      :param `attachment`: the attachment ???
      :param `nth`: get nth attachment ???
      :param `no_arcs`: ???
      :param `line`: ???


   .. method:: GetBoundingBoxMin(self)

      Get minimum bounding box.


   .. method:: GetNumberOfAttachments(self)

      Get number of attachments.


   .. method:: GetOriginalHeight(self)

      Get the original height.


   .. method:: GetOriginalPoints(self)

      Get the original points.


   .. method:: GetOriginalWidth(self)

      Get the original width.


   .. method:: GetPerimeterPoint(self, x1, y1, x2, y2)

      Get the perimeter point.
      
      :param `x1`: the x1 position
      :param `y1`: the y1 position
      :param `x2`: the x2 position
      :param `y2`: the y2 position


   .. method:: GetPoints(self)

      Return the internal list of polygon vertices.


   .. method:: HitTest(self, x, y)

      Hit text
      
      :param `x`: the x position
      :param `y`: the y position


   .. method:: MakeControlPoints(self)

      Make control points.


   .. method:: OnDraw(self, dc)

      The draw handler.


   .. method:: OnDrawOutline(self, dc, x, y, w, h)

      The draw outline handler.


   .. method:: OnSizingBeginDragLeft(self, pt, x, y, keys = 0, attachment = 0)

      The sizing begin drag left handler.


   .. method:: OnSizingDragLeft(self, pt, draw, x, y, keys = 0, attachment = 0)

      The sizing drag left handler.


   .. method:: OnSizingEndDragLeft(self, pt, x, y, keys = 0, attachment = 0)

      The sizing end drag left handler.


   .. method:: ResetControlPoints(self)

      Reset control points.


   .. method:: Rotate(self, x, y, theta)

      Rotate about the given axis by the given amount in radians.
      
      :param `x`: the x position
      :param `y`: the y position
      :param `theta`: the theta


   .. method:: SetOriginalHeight(self, h)

      Set the original height.
      
      :param `w`: the height


   .. method:: SetOriginalWidth(self, w)

      Set the original width.
      
      :param `w`: the width


   .. method:: SetSize(self, new_width, new_height, recursive = True)

      Set the size
      
      :param `new_width`: the width
      :param `new_height`: the height
      :param `recursive`: not used


   .. method:: UpdateOriginalPoints(self)

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


