Package populus :: Module Annotations :: Class Annotations
[frames] | no frames]

Class Annotations

This is a class for drawing visual annotations such as lines, circles, grids and so on. It could be used for on-screen debugging of behaviors or just for simple drawing. Each annotation is created as a nodepath containing the defined geometry and could be attached to another parent node. Notice that each new annotation should have a new name whilts, reusing an old name, will refresh that old annotation. Therefore, reuse of annotation names is a way for implementing animated annotations.

Instance Methods
 
__init__(self)
 
annotationLine(self, name, start, end, basis=render, color=(1, 1, 1, 1), thickness=1, label=None, lblAlign='ACenter')
Draw an annotation line between the points start and end.
 
annotationCircle(self, name, center, radius, maxAngle=360, basis=render, normal=(0, 0, 1), color=(1, 1, 1, 1), thickness=1, numSteps=64, label=None, lblAlign='ACenter')
Draw an annotation circle with the given center and radius in the plane defined by center and normal.
 
annotationBox(self, name, topLeft, bottomRight, basis=render, color=(1, 1, 1, 1), thickness=1, label=None, lblAlign='ACenter')
Draw an annotation box using two points: top left and bottom right.
 
annotationSphere(self, name, center, radius, maxAngle=360, basis=render, axis=(0, 1, 0), color=(1, 1, 1, 1), thickness=1, numSteps=64, label=None, lblAlign='ACenter')
Draw an annotation sphere using the given center and radius.
 
annotationAxes(self, name, origin=(0, 0, 0), basis=render, scale=0.1, thickness=2)
Draw an annotation axes of the coordinate system given by basis.
 
annotationGrid(self, name, basis=render, normal=(0, 0, 1), width=10.0, depth=10.0, divisions=10, minorDivisions=5, color=(1, 1, 1, 1))
Draw a reference grid on the given plane (XY-plane by default).
 
annotationMsrTape(self, name, start, end)
Draw a measuring tape that shows the distance between start and end points.
 
changeFont(self, fontPath)
Load and set a new font.
 
getAnnotation(self, name)
Get an Annotation by name.
 
removeAnnotation(self, name)
Remove a specified annotation.
 
clearAnnotations(self)
Remove all the annotations.
 
hideAnnotation(self, name)
Hide a specified annotation.
 
hideAllAnnotations(self)
Hide all the annotations.
 
showAnnotation(self, name)
Show a specified annotation supposed to be hiden.
 
showAllAnnotations(self)
Show up all the annotations.
 
toggleAnnotation(self, name)
Toggle visibility of a given annotation.
 
enableAnnotations(self)
Enable annotations from now on.
 
disableAnnotations(self)
Disable annotations from now on.
Class Variables
  DEFAULT_FONT = 'Models/font/cour.egg'
Method Details

annotationLine(self, name, start, end, basis=render, color=(1, 1, 1, 1), thickness=1, label=None, lblAlign='ACenter')

 

Draw an annotation line between the points start and end. The line will be attached to the basis nodepath. Set a label if you want to attach textual explanation to the line. The label could be alligned to the center(ACenter), or to the begin (ABegin) or to the end (AEnd) of the annotation line.

annotationCircle(self, name, center, radius, maxAngle=360, basis=render, normal=(0, 0, 1), color=(1, 1, 1, 1), thickness=1, numSteps=64, label=None, lblAlign='ACenter')

 

Draw an annotation circle with the given center and radius in the plane defined by center and normal. The circle will be attached to the specified parent nodepath (basis). The parameter numSteps controls the precision of the drawing, therefore using low precision the annotation will draw a poligonal shape. Set a max angle if you want to draw an arc instead of a full circle. Set a label if you want to attach some textual explanation to the annotation circle. The label could be alligned to the center(ACenter), or to the up side(AUp), or to the down side (ADown), or to the left side (ALeft), or to the right side (ARight) of the annotation circle.

annotationBox(self, name, topLeft, bottomRight, basis=render, color=(1, 1, 1, 1), thickness=1, label=None, lblAlign='ACenter')

 

Draw an annotation box using two points: top left and bottom right.

Set a label if you want to attach some text to the annotation box. The label could be aligned to the center(ACenter), or to the up side (AUp), or to the down side (ADown), or to the left side (ALeft), or to the right side (ARight) of the annotation box.

annotationSphere(self, name, center, radius, maxAngle=360, basis=render, axis=(0, 1, 0), color=(1, 1, 1, 1), thickness=1, numSteps=64, label=None, lblAlign='ACenter')

 

Draw an annotation sphere using the given center and radius. The sphere will be attached to the basis nodepath. The parameter numSteps controls the precision of the drawing, therefore using low precision the annotation will draw a poligonal shape. Set a max angle if you want to draw spherical cone instead of a full sphere. Use axis to specify a pointing axis for the sphere. Setting axis is intended mainly for orienting spherical cones. Set a label if you want to attach some textual explanation to the annotation sphere. The label can be alligned to the center (ACenter), or to the up side (AUp), or to the down side (ADown), or to the left side (ALeft), or to the right side (ARight) of the annotation sphere XY plane.

annotationAxes(self, name, origin=(0, 0, 0), basis=render, scale=0.1, thickness=2)

 

Draw an annotation axes of the coordinate system given by basis. Origin is the origin of the origin point of the three axis. Use basis to attach the axes to NodePath. Use scale to make the axis bigger or smaller.

annotationGrid(self, name, basis=render, normal=(0, 0, 1), width=10.0, depth=10.0, divisions=10, minorDivisions=5, color=(1, 1, 1, 1))

 

Draw a reference grid on the given plane (XY-plane by default). Use width and depth to specify the grid dimensions. Use divisions to set the number of rows and columns along the grid's width and depth. Use minorDivisions to further subdivided rows and columns with an extra thinner grid.

annotationMsrTape(self, name, start, end)

 

Draw a measuring tape that shows the distance between start and end points. The tape is a simple line with a label attach on it.

changeFont(self, fontPath)

 

Load and set a new font. If the font doesn't exist the current font is retain.

enableAnnotations(self)

 

Enable annotations from now on. Every successive call for an annotation method will draw something.

disableAnnotations(self)

 

Disable annotations from now on. Every successive call for an annotation method will not make any drawing. Call this method when you need to stash them from the scene and don't waste resources refreshing them.