phoenix_title wx.lib.ogl.oglmisc

Miscellaneous support functions for OGL.

params marked with ‘???’ need review!

function_summary Functions Summary

CentreText

Centre a text

CheckLineIntersection

Check for line intersection

DrawArcToEllipse

Draw arc to ellipse

DrawFormattedText

Draw formatted text

FindEndForBox

Find the end for a box

FindEndForCircle

Find end for a circle

FindEndForPolyline

Find the end for a polyline

FormatText

Format a text

GetArrowPoints

Get point on arrow

GetCentredTextExtent

Get the centred text extend

GetPointOnLine

Get point on a line

GraphicsStraightenLine

Straighten a line in graphics

PolylineHitTest

Hittest for a polyline

RoughlyEqual

Check if values are roughly equal


Functions



CentreText(dc, text_list, xpos, ypos, width, height, formatMode)

Centre a text

Parameters
  • 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

    FORMAT_NONE

    Left justification

    FORMAT_CENTRE_HORIZ

    Centre horizontally

    FORMAT_CENTRE_VERT

    Centre vertically

    FORMAT_SIZE_TO_CONTENTS

    Resize shape to contents



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

Check for line intersection

Parameters
  • x1 – x1 position

  • y1 – y1 position

  • x2 – x2 position

  • y2 – y2 position

  • x3 – x3 position

  • y3 – y3 position

  • x4 – x4 position

  • y4 – y4 position

Returns

a length ratio and a k line???



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

Draw arc to ellipse

Parameters
  • x1 – x1 position

  • y1 – y1 position

  • width1 – width

  • height1 – height

  • x2 – x2 position

  • y2 – y2 position

  • x3 – x3 position

  • y3 – y3 position

Returns

ellipse points ???



DrawFormattedText(dc, text_list, xpos, ypos, width, height, formatMode)

Draw formatted text

Parameters
  • 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

    FORMAT_NONE

    Left justification

    FORMAT_CENTRE_HORIZ

    Centre horizontally

    FORMAT_CENTRE_VERT

    Centre vertically

    FORMAT_SIZE_TO_CONTENTS

    Resize shape to contents



FindEndForBox(width, height, x1, y1, x2, y2)

Find the end for a box

Parameters
  • width – the width of the box

  • height – the height of the box

  • x1 – x1 position

  • y1 – y1 position

  • x2 – x2 position

  • y2 – y2 position

Returns

the end position



FindEndForCircle(radius, x1, y1, x2, y2)

Find end for a circle

Parameters
  • radius – radius

  • x1 – x1 position

  • y1 – y1 position

  • x2 – x2 position

  • y2 – y2 position

Returns

end position



FindEndForPolyline(xvec, yvec, x1, y1, x2, y2)

Find the end for a polyline

Parameters
  • xvec – x vector ???

  • yvec – y vector ???

  • x1 – x1 position

  • y1 – y1 position

  • x2 – x2 position

  • y2 – y2 position

Returns

the end position



FormatText(dc, text, width, height, formatMode)

Format a text

Parameters
  • 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

    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



GetArrowPoints(x1, y1, x2, y2, length, width)

Get point on arrow

Parameters
  • x1 – x1 position

  • y1 – y1 position

  • x2 – x2 position

  • y2 – y2 position

  • length – length ???

  • width – width ???

Returns

point on line



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

Get the centred text extend

Parameters
  • dc – the wx.MemoryDC

  • text_list – a list of text lines

  • xpos – unused

  • ypos – unused

  • width – unused

  • height – unused

Returns

maximum width and the height



GetPointOnLine(x1, y1, x2, y2, length)

Get point on a line

Parameters
  • x1 – x1 position

  • y1 – y1 position

  • x2 – x2 position

  • y2 – y2 position

  • length – length ???

Returns

point on line



GraphicsStraightenLine(point1, point2)

Straighten a line in graphics

Parameters
  • point1 – a point list???

  • point2 – a point list???



PolylineHitTest(xvec, yvec, x1, y1, x2, y2)

Hittest for a polyline

Parameters
  • xvec – x vector ???

  • yvec – y vector ???

  • x1 – x1 position

  • y1 – y1 position

  • x2 – x2 position

  • y2 – y2 position

Returns

True or False



RoughlyEqual(val1, val2, tol=0.00001)

Check if values are roughly equal

Parameters
  • val1 – the first value to check

  • val2 – the second value to check

  • tol – the tolerance, defaults to 0.00001

Returns

True or False