.. wxPython Phoenix documentation

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

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

.. include:: headings.inc

.. module:: wx.lib.ogl.oglmisc

.. currentmodule:: wx.lib.ogl.oglmisc

.. highlight:: python



.. _wx.lib.ogl.oglmisc:

==========================================================================================================================================
|phoenix_title|  **wx.lib.ogl.oglmisc**
==========================================================================================================================================

Miscellaneous support functions for OGL.

params marked with '???' need review!


|function_summary| Functions Summary
====================================

================================================================================ ================================================================================
:func:`~wx.lib.ogl.oglmisc.CentreText`                                           Centre a text
:func:`~wx.lib.ogl.oglmisc.CheckLineIntersection`                                Check for line intersection
:func:`~wx.lib.ogl.oglmisc.DrawArcToEllipse`                                     Draw arc to ellipse
:func:`~wx.lib.ogl.oglmisc.DrawFormattedText`                                    Draw formated text
:func:`~wx.lib.ogl.oglmisc.FindEndForBox`                                        Find the end for a box
:func:`~wx.lib.ogl.oglmisc.FindEndForCircle`                                     Find end for a circle
:func:`~wx.lib.ogl.oglmisc.FindEndForPolyline`                                   Find the end for a polyline
:func:`~wx.lib.ogl.oglmisc.FormatText`                                           Format a text
:func:`~wx.lib.ogl.oglmisc.GetArrowPoints`                                       Get point on arrow
:func:`~wx.lib.ogl.oglmisc.GetCentredTextExtent`                                 Get the centred text extend
:func:`~wx.lib.ogl.oglmisc.GetPointOnLine`                                       Get point on a line
:func:`~wx.lib.ogl.oglmisc.GraphicsStraightenLine`                               Straighten a line in graphics
:func:`~wx.lib.ogl.oglmisc.PolylineHitTest`                                      Hittest for a polyline
:func:`~wx.lib.ogl.oglmisc.RoughlyEqual`                                         Check if values are roughtly equal
================================================================================ ================================================================================


|



Functions
------------

.. function:: CentreText(dc, text_list, xpos, ypos, width, height, formatMode)

   Centre a text
   
   :param `dc`: the :class:`wx.MemoryDC`
   :param `text_list`: a list of texts
   :param `xpos`: the x position
   :param `ypos`: the y position
   :param `width`: the width of the box???
   :param `height`: the height of the box???
   :param `formatMode`: one of the format modes, can be combined in a bit list
   
     ======================================== ==================================
     Format mode name                         Description
     ======================================== ==================================
     `FORMAT_NONE`                            Left justification
     `FORMAT_CENTRE_HORIZ`                    Centre horizontally
     `FORMAT_CENTRE_VERT`                     Centre vertically
     `FORMAT_SIZE_TO_CONTENTS`                Resize shape to contents
     ======================================== ==================================


.. function:: CheckLineIntersection(x1, y1, x2, y2, x3, y3, x4, y4)

   Check for line intersection
   
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `x2`: x2 position
   :param `y2`: y2 position
   :param `x3`: x3 position
   :param `y3`: y3 position
   :param `x4`: x4 position
   :param `y4`: y4 position
   
   :returns: a lenght ratio and a k line???


.. function:: DrawArcToEllipse(x1, y1, width1, height1, x2, y2, x3, y3)

   Draw arc to ellipse
   
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `width1`: width
   :param `height1`: height
   :param `x2`: x2 position
   :param `y2`: y2 position
   :param `x3`: x3 position
   :param `y3`: y3 position
   
   :returns: ellipse points ???


.. function:: DrawFormattedText(dc, text_list, xpos, ypos, width, height, formatMode)

   Draw formated text
   
   :param `dc`: the :class:`wx.MemoryDC`
   :param `text_list`: a list of texts
   :param `xpos`: the x position
   :param `ypos`: the y position
   :param `width`: the width of the box???
   :param `height`: the height of the box???
   :param `formatMode`: one of the format modes, can be combined in a bit list
   
     ======================================== ==================================
     Format mode name                         Description
     ======================================== ==================================
     `FORMAT_NONE`                            Left justification
     `FORMAT_CENTRE_HORIZ`                    Centre horizontally
     `FORMAT_CENTRE_VERT`                     Centre vertically
     `FORMAT_SIZE_TO_CONTENTS`                Resize shape to contents
     ======================================== ==================================


.. function:: FindEndForBox(width, height, x1, y1, x2, y2)

   Find the end for a box
   
   :param `width`: the width of the box
   :param `height`: the height of the box
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `x2`: x2 position
   :param `y2`: y2 position
   
   :returns: the end position


.. function:: FindEndForCircle(radius, x1, y1, x2, y2)

   Find end for a circle
   
   :param `radius`: radius
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `x2`: x2 position
   :param `y2`: y2 position
   
   :returns: end position


.. function:: FindEndForPolyline(xvec, yvec, x1, y1, x2, y2)

   Find the end for a polyline
   
   :param `xvec`: x vector ???
   :param `yvec`: y vector ???
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `x2`: x2 position
   :param `y2`: y2 position
   
   :returns: the end position


.. function:: FormatText(dc, text, width, height, formatMode)

   Format a text
   
   :param `dc`: the :class:`wx.MemoryDC`
   :param `text`: the text to format
   :param `width`: the width of the box???
   :param `height`: the height of the box??? it is not used in the code!
   :param `formatMode`: one of the format modes, can be combined in a bit list
   
     ======================================== ==================================
     Format mode name                         Description
     ======================================== ==================================
     `FORMAT_NONE`                            Left justification
     `FORMAT_CENTRE_HORIZ`                    Centre horizontally
     `FORMAT_CENTRE_VERT`                     Centre vertically
     `FORMAT_SIZE_TO_CONTENTS`                Resize shape to contents
     ======================================== ==================================
   
   :returns: a list of strings fitting in the box


.. function:: GetArrowPoints(x1, y1, x2, y2, length, width)

   Get point on arrow
   
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `x2`: x2 position
   :param `y2`: y2 position
   :param `length`: length ???
   :param `width`: width ???
   
   :returns: point on line


.. function:: GetCentredTextExtent(dc, text_list, xpos=0, ypos=0, width=0, height=0)

   Get the centred text extend
   
   :param `dc`: the :class:`wx.MemoryDC`
   :param `text_list`: a list of text lines
   :param `xpos`: unused
   :param `ypos`: unused
   :param `width`: unused
   :param `height`: unused
   
   :returns: maximum width and the height


.. function:: GetPointOnLine(x1, y1, x2, y2, length)

   Get point on a line
   
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `x2`: x2 position
   :param `y2`: y2 position
   :param `length`: length ???
   
   :returns: point on line


.. function:: GraphicsStraightenLine(point1, point2)

   Straighten a line in graphics
   
   :param `point1`: a point list???
   :param `point2`: a point list???


.. function:: PolylineHitTest(xvec, yvec, x1, y1, x2, y2)

   Hittest for a polyline
   
   :param `xvec`: x vector ???
   :param `yvec`: y vector ???
   :param `x1`: x1 position
   :param `y1`: y1 position
   :param `x2`: x2 position
   :param `y2`: y2 position
   
   :returns: ``True`` or False


.. function:: RoughlyEqual(val1, val2, tol=0.00001)

   Check if values are roughtly equal
   
   :param `val1`: the first value to check
   :param `val2`: the second value to check
   :param `tol`: the tolerance, defaults to 0.00001
   
   :returns: ``True`` or False


