urclib.ui_qt.visualizer

2D visualizer package.

Subpackages

Submodules

Package Contents

Classes

StringEntry

Container for storing a string and some rendering information.

GradientRecord

Record for representing a gradient swatch with two or more anchor points.

ColorRange

Record for coloring groups of vertices.

IndexedColor

Color associated with index.

IndexedGlyph

Maps a series of indices to a character representing a glyph used to represent spactial points.

IndexedScale

Maps a series of indices to a specific scaling value to apply to points.

LayerRecord

Record of draw data for a given "ogr_layer" of data.

PolyLayerRecord

Polygon-specialized ogr_layer.

PointLayerRecord

Point-specialized ogr_layer data.

LineLayerRecord

Record representing line geometry to be drawn.

RasterLayerRecord

Raster-specialized ogr_layer data.

RasterIndexLayerRecord

Raster-specialized ogr_layer data.

ReferenceRecord

Reference to another layer record within the GaiaGeometryScene object. This exists reduce duplicate data

TextLayerRecord

Raster-specialized ogr_layer data.

Functions

newGeometryScene(*args, **kwargs)

Initialize a new GeometryGLScene.

newOGRScene(*args, **kwargs)

Initialize a new OGRGLScene.

Attributes

POLY_FILL

POINT_FILL

LINE_FILL

__version__

class urclib.ui_qt.visualizer.StringEntry(txt='', anchor=(0.0, 0.0, 0.0), color=(0.0, 0.0, 0.0, 1.0), h_justify='center', v_justify='center', tabspacing=4)

Bases: object

Container for storing a string and some rendering information.

Parameters:
  • txt – The string to store; note that tabs will be converted to spaces.

  • anchor – The point which “anchors” the string in Worldspace coordinates. The value should be a container with 3 float values, corresponding to (x,y,z).

  • color – The color to use for rendering the text; defaults to opaque black. The value should be a container with 3 float values bounded to the range [0,1], corresponding to (red,green,blue,alpha).

  • h_justify – String representing the horizontal justification relative to the anchor point. Valid values are: * ‘center’: The string centers horizontally on the anchor point. This is the default value. * ‘left’: The string positions itself so the anchor is to the left. * ‘right’: The string positions itself so the anchor is to the right.

  • v_justify – String representing the vertical justification relative to the anchor point. Valid values are: * ‘center’: The string centers vertically on the anchor point. This is the default value. * ‘top’: The string positions itself so the anchor is on top. * ‘bottom’: The string positions itself so the anchor is below the bottom.

  • tabspacing – The number of spaces to substitute for tab characters. The default is 4.

txt

The string to be rendered, with tab substitution applied.

anchor

The (x,y,z) anchor point in worldspace.

color

The color to apply to the string as (red,green,blue,alpha).

h_justify

The string’s horizontal justification.

v_justify

The string’s vertical justification.

property validCount

The total number of characters in the string, minus the ‘ ‘ and ‘ ‘ control characters.

Type:

int

__len__()
urclib.ui_qt.visualizer.POLY_FILL
urclib.ui_qt.visualizer.POINT_FILL
urclib.ui_qt.visualizer.LINE_FILL
class urclib.ui_qt.visualizer.GradientRecord(*args)

Bases: object

Record for representing a gradient swatch with two or more anchor points.

__setitem__(key, value)
__getitem__(weight)
__iter__()
__reversed__()
__len__()
__eq__(other)

Return self==value.

clear()

Clear all entries.

static _lerp(c1, c2, w)

Basic linear interpolation algorithm.

Parameters:
  • c1 (SimpleColor) – The first color.

  • c2 (SimpleColor) – The second color.

  • w (float) – Normalized weight balancing c1 and c2.

Returns:

The interpolated color value.

Return type:

SimpleColor

addColorAnchor(weight, color)

Add another anchor to the gradient.

Parameters:
  • weight (float) – Normalized weight for location along gradient.

  • color (iterable) – The 4-channel color to insert at the anchor point.

popColorAnchor(weight)

Remove and return a color.

Parameters:

weight (float) – Normalized weight of color anchor.

Returns:

The color at the anchor point.

Return type:

SimpleColor

Raises:

KeyError – If weight is not an anchor point.

moveColorAnchor(oldWeight, newWeight)

Move a color to a new anchor point.

Parameters:
  • oldWeight (float) – The old anchor location.

  • newWeight (float) – the new location for the color.

Raises:

KeyError – If oldWeight is not an anchor point.

colorForWeight(weight)

Retrieve the color for the requested weight.

Parameters:

weight (float) – Normalized weight value.

Returns:

Color found at weight point. None: If no weighted colors are present.

Return type:

SimpleColor

colorStrip(count, flatten=False)

Builds a regular color strip based on weighted values

Parameters:
  • count (int) – The number samples to take between 0 and 1.

  • flatten (bool) – If true, strings the individual channel values together in a fashion suitable for direct rendering. Defaults to false.

Returns:

If flatten is False; list of SimpleColor objects representing regular sampling numpy.array: If flatten is True; individual channel values for each color.

Return type:

list

squeezeBetweenWeights(minWt, maxWt)

Squeeze current gradient between range of weights, saturating with weighted values outside of range.

Parameters:
  • minWt (float) – The lower bound weight in range (0,1); must be less than maxWt.

  • maxWt (float) – The upper bound weight in range (0,1); must be greater than minWt.

inflateBetweenWeights(minWt, maxWt)

Stretch subrange of gradient to entire range, overwriting any anchors outside of the range.

Parameters:
  • minWt (float) – The lower bound weight in range (0,1); must be less than maxWt.

  • maxWt (float) – The upper bound weight in range (0,1); must be greater than minWt.

clone(squeeze=None, inflate=None, alphaOverride=None)

Creating a copy of the GradientRecord object, optionally transforming via squeeze or inflate.

Parameters:
  • squeeze (tuple,optional) – Pair of lower and upper weights to apply in a squeeze transformation.

  • inflate (tuple,optional) – Pair of lower and upper weights to apply in an inflate transformation.

  • alphaOverride (float or None, optional) – Alpha value to apply to clone if not None.

Returns:

Copy of GradientRecord with transformation applied.

Return type:

GradientRecord

Notes

If both squeeze and inflate are passed in, The squeeze transformation will be applied first, followed by the inflate transformation.

See also

GradientRecord.squeezeBetweenWeights() GradientRecord.inflateBetweenWeights()

class urclib.ui_qt.visualizer.ColorRange(color, start, count)

Bases: object

Record for coloring groups of vertices.

color

Color range.

Type:

glm.vec4

start

The first index for applying color.

Type:

int

count

The number of vertices to apply the color to.

Type:

int

Parameters:
  • color (glm.vec4) – Color range.

  • start (int) – The first index for applying color.

  • count (int) – The number of vertices to apply the color to.

__eq__(other)

Return self==value.

class urclib.ui_qt.visualizer.IndexedColor(color, inds)

Bases: object

Color associated with index.

color

The color value.

Type:

glm.vec4

inds

The associated indexes.

Type:

list

Parameters:
  • color (glm.vec4) – The color value.

  • inds (list) – The associated indexes.

static expandIndexes(indexes, recCount, d_color=glm.vec4(0.0, 0.0, 0.0, 1.0))

Retrieve colors based on indices.

Parameters:
  • indexes (list) – Indexes to look up.

  • recCount (int) – The number of colors to produce.

  • d_color (glm.vec4) – The color to use as default, in the case the index isn’t present.

Returns:

colors associated with indexes.

Return type:

list

__len__()
__eq__(other)

Return self==value.

class urclib.ui_qt.visualizer.IndexedGlyph(glyph, inds)

Bases: object

Maps a series of indices to a character representing a glyph used to represent spactial points.

glyphVal

ord value of character representing glyph.

Type:

int

inds

The list of indices indicating the point to apply the glyph to.

Type:

list

Parameters:
  • glyph (str or int) – int (ord value) or single-character string representing the point glyph.

  • inds (list) – list of point indices that are represented by this glyph.

property glyph

single character string which represents the glyph.

Type:

str

static expandIndexes(indexes, recCount, d_glyph='.')

Expand individual index values into a full list glyph ord values.

Parameters:
  • indexes (list) – List of IndexedGlyph objects.

  • recCount (int) – Total number of entries.

  • d_glyph (int or str, optional) – The default value for unreferenced indices.

Returns:

A list of ord (int) values representing the glyph for each point.

Return type:

numpy.ndarray

__len__()
__eq__(other)

Return self==value.

class urclib.ui_qt.visualizer.IndexedScale(scale, inds)

Bases: object

Maps a series of indices to a specific scaling value to apply to points.

scale

The scale factor to apply to the associated indices.

Type:

float

inds

The list of indices indicating the point to apply the glyph to.

Type:

list

Parameters:
  • scale (float) – Scaling factor to apply.

  • inds (list) – list of point indices that are represented by this glyph.

static expandIndexes(indexes, recCount, d_scale=1)

Expand individual index values into a full list scaling factors

Parameters:
  • indexes (list) – List of IndexedGlyph objects.

  • recCount (int) – Total number of entries.

  • d_scale (float, optional) – The default scaling factor for unreferenced indices.

Returns:

A list of float values representing the scaling factor for each point.

Return type:

numpy.ndarray

__len__()
__eq__(other)

Return self==value.

class urclib.ui_qt.visualizer.LayerRecord(id, vao=0, buff=0, count=0, exts=None, volatile=False, **kwargs)

Bases: object

Record of draw data for a given “ogr_layer” of data.

vao

Vertex array object provided by the OpenGL API.

Type:

int

buff

Array buffer provided by the OpenGL API.

Type:

int

draw

If True, draw items defined in this ogr_layer.

Type:

bool

count

The number of features in the layer record.

Type:

int

exts

The exents of the layer’s coverage.

Type:

list

id

The unique identifier used by the drawing engine to identify the layer.

Type:

int

geomColors

Optional list of Simple colors providing individual colors for each bit of geometry.

Type:

list or None

selectedGeom

Indices of geometry marked as _selected_.

Type:

set

volatile

Whether or not the geometry is expected to change.

Type:

bool

Parameters:
  • id (int) – The id to assign the layer.

  • vao (int) – Vertex array object provided by the OpenGL API.

  • buff (int) – Array buffer provided by the OpenGL API.

  • count (int) – The number of features in the layer.

  • exts (list) – The extents of the enclosed geometry.

  • volatile (bool) – Whether or not the geometry is expected to change.

property vertCount

Number of vertices associated with this record.

Type:

int

value_eq(other)

Compare another Layer Record to see if they are equivalentg.

Parameters:

other (LayerRecord) – The other record to compare.

Returns:

True if all values are equivalent; False otherwise.

Return type:

bool

setSingleColor(c)

Set a color for all components in a layer

Parameters:

c (glm.vec4) – The color to assign.

ClearBuffers()

Delete associated OpenGL VAO and FBO.

selectRecs(active)

Mark specific records as ‘selected’.

Parameters:

active (list) – List of record indices to enable.

deselectRecs(inactive)

Mark specific records as ‘deselected’.

Parameters:

inactive (list) – List of record indices to disable.

prepareForGLLoad(verts, ext, extra=None)

Perform any necessary preparation work prior to loading data into OpenGL.

Parameters:
  • verts (np.ndarray) – Floats repreensting vertices.

  • ext (list) – Floats of data extents.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

Returns:

  1. np.ndarray: The vertices to use; default implementation returns verts, but subclass implementations

    may return an alternative set.

  2. object: Default implementation returns extra, but subclass implementations may return a replacement

    value.

Return type:

tuple

loadGLBuffer(verts, drawMode, scene, extra=None)

Load some data into the currently bound VBO.

Parameters:
  • verts (numpy.ndarray) – Vertex data to load into the array buffer.

  • drawMode (int) – The draw mode to attach to the buffer. Should be one of GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

  • scene (GeometryGLScene) – The scene tied to the active OpenGL context.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

class urclib.ui_qt.visualizer.PolyLayerRecord(id, vao=0, buff=0, polygroups=(), hasAdjacency=False, **kwargs)

Bases: LayerRecord

Polygon-specialized ogr_layer.

groups

list of (index,count) pairs that provide the offset and number of vertices in the vertex list that make up each polygon.

Type:

list

refTex

Pointer for referenceTexture.

Type:

int

customGradTexes

Pointer to value and gradient texture need for value coloring.

Type:

list

refVao

Pointer to reference VAO.

Type:

int

refBuff

Pointer to reference FBO.

Type:

int

drawGrid

Show/hide polygon outlines.

Type:

bool

fillGrid

If True fill polygons.

Type:

bool

useFillAttrVals

Fill with values intead of colors (DEPRECATED).

Type:

bool

gridColor

Color to use to draw grid.

Type:

glm.vec4

attrVals

The values to associate with records.

Type:

list

Parameters:
  • id (int) – The id to assign the layer.

  • vao (int) – Vertex array object provided by the OpenGL API.

  • buff (int) – Array buffer provided by the OpenGL API.

  • polygroups (list) – list of (index,count) pairs that provide the offset and number of vertices in the vertex list that make up each polygon.

property vertCount

Number of vertices associated with this record.

Type:

int

property ringCount

The total number of polygon rings contained within the record.

Type:

int

property grid_thickness

DEPRECATED

Type:

float

value_eq(other)

Compare another Layer Record to see if they are equivalentg.

Parameters:

other (LayerRecord) – The other record to compare.

Returns:

True if all values are equivalent; False otherwise.

Return type:

bool

setSingleColor(c)

Set a color for all components in a layer

Parameters:

c (glm.vec4) – The color to assign.

ClearBuffers()

Delete associated OpenGL VAO and FBO.

prepareForGLLoad(verts, ext, extra=None)

Perform any necessary preparation work prior to loading data into OpenGL.

Parameters:
  • verts (np.ndarray) – Floats repreensting vertices.

  • ext (list) – Floats of data extents.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

Returns:

  1. np.ndarray: The vertices to use; default implementation returns verts, but subclass implementations

    may return an alternative set.

  2. object: Default implementation returns extra, but subclass implementations may return a replacement

    value.

Return type:

tuple

loadGLBuffer(verts, drawMode, scene, extra=None)

Load some data into the currently bound VBO.

Parameters:
  • verts (numpy.ndarray) – Vertex data to load into the array buffer.

  • drawMode (int) – The draw mode to attach to the buffer. Should be one of GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

  • scene (GeometryGLScene) – The scene tied to the active OpenGL context.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

class urclib.ui_qt.visualizer.PointLayerRecord(id, vao=0, buff=0, count=0, **kwargs)

Bases: LayerRecord

Point-specialized ogr_layer data.

ptSelBuff

Array buffer for selected points provided by the OpenGL API.

Type:

int

count

Total number of points in this ogr_layer.

Type:

int

Parameters:
  • vao (int) – Vertex array object provided by the OpenGL API.

  • buff (int) – Array buffer provided by the OpenGL API.

  • count (int) – Total number of points in this ogr_layer.

property ptSize

size of point to draw, in pixels.

Type:

float

property glyphCode

The ord code for the glyph used to draw points.

Type:

int

value_eq(other)

Compare another Layer Record to see if they are equivalentg.

Parameters:

other (LayerRecord) – The other record to compare.

Returns:

True if all values are equivalent; False otherwise.

Return type:

bool

setSingleColor(c)

Set a color for all components in a layer

Parameters:

c (glm.vec4) – The color to assign.

ClearBuffers()

Delete associated OpenGL VAO and FBO.

prepareForGLLoad(verts, ext, extra=None)

For initializing the vertices and any other info for OpenGL loading

loadGLBuffer(verts, drawMode, scene, extra=None)

Load some data into the currently bound VBO.

Parameters:
  • verts (numpy.ndarray) – Vertex data to load into the array buffer.

  • drawMode (int) – The draw mode to attach to the buffer. Should be one of GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

  • scene (GeometryGLScene) – The scene tied to the active OpenGL context.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

class urclib.ui_qt.visualizer.LineLayerRecord(id, vao=0, buff=0, linegroups=None, segmentcount=None, **kwargs)

Bases: LayerRecord

Record representing line geometry to be drawn.

Attributes:

Parameters:
  • id (int) – The id to assign the layer.

  • vao (int,optional) – Vertex array object provided by the OpenGL API.

  • buff (int,optional) – Array buffer provided by the OpenGL API.

  • linegroups (list,optional) – List of (start,count) tuples representing linestrings; can be None only if segmentCount is not None.

  • segmentcount (int,optional) – Total number of line segments; can be None only if linegroups is not None.

Keyword Arguments:
  • hasAdjacency (bool,optional) – If True the adjacency geometry adjustments are skipped when prepareGLLoad() is called. Otherwise, adjacency geometry will be computed.

  • lineThickness (float) – How think each line should be drawn, in pixels.

  • singleColor (glm.vec4) – Color to render all lines in.

property vertCount

Number of vertices associated with this record.

Type:

int

value_eq(other)

Compare another Layer Record to see if they are equivalentg.

Parameters:

other (LayerRecord) – The other record to compare.

Returns:

True if all values are equivalent; False otherwise.

Return type:

bool

setSingleColor(c)

Set a color for all components in a layer

Parameters:

c (glm.vec4) – The color to assign.

ClearBuffers()

Delete associated OpenGL VAO and FBO.

prepareForGLLoad(verts, ext, extra=None)

Perform any necessary preparation work prior to loading data into OpenGL.

Parameters:
  • verts (np.ndarray) – Floats repreensting vertices.

  • ext (list) – Floats of data extents.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

Returns:

  1. np.ndarray: The vertices to use; default implementation returns verts, but subclass implementations

    may return an alternative set.

  2. object: Default implementation returns extra, but subclass implementations may return a replacement

    value.

Return type:

tuple

loadGLBuffer(verts, drawMode, scene, extra=None)

Load some data into the currently bound VBO.

Parameters:
  • verts (numpy.ndarray) – Vertex data to load into the array buffer.

  • drawMode (int) – The draw mode to attach to the buffer. Should be one of GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

  • scene (GeometryGLScene) – The scene tied to the active OpenGL context.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

class urclib.ui_qt.visualizer.RasterLayerRecord(id, vao=0, buff=0, texId=0, **kwargs)

Bases: LayerRecord

Raster-specialized ogr_layer data.

texId

Texture id for raster image.

Type:

int

smooth

whether or not to apply smoothing to the texture.

Type:

bool

Parameters:
  • vao (int) – Vertex array object provided by the OpenGL API.

  • buff (int) – Array buffer provided by the OpenGL API.

  • texId (int) – Texture id for raster image provided by OpenGL API.

  • gradTexId (int) – optional id of 1D texture for gradient coloring provided by OpenGL API.

ClearBuffers()

Delete associated OpenGL VAO and FBO.

prepareForGLLoad(verts, ext, extra=None)

Perform any necessary preparation work prior to loading data into OpenGL.

Parameters:
  • verts (np.ndarray) – Floats repreensting vertices.

  • ext (list) – Floats of data extents.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

Returns:

  1. np.ndarray: The vertices to use; default implementation returns verts, but subclass implementations

    may return an alternative set.

  2. object: Default implementation returns extra, but subclass implementations may return a replacement

    value.

Return type:

tuple

loadGLBuffer(verts, drawMode, scene, extra=None)

Load some data into the currently bound VBO.

Parameters:
  • verts (numpy.ndarray) – Vertex data to load into the array buffer.

  • drawMode (int) – The draw mode to attach to the buffer. Should be one of GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

  • scene (GeometryGLScene) – The scene tied to the active OpenGL context.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

_extToVerts(ext)
class urclib.ui_qt.visualizer.RasterIndexLayerRecord(id, vao=0, buff=0, texId=0, gradTexId=0, **kwargs)

Bases: RasterLayerRecord

Raster-specialized ogr_layer data.

texId

Texture id for raster image.

Type:

int

gradTexId

optional id of 1D texture for gradient coloring.

Type:

int

Parameters:
  • vao (int) – Vertex array object provided by the OpenGL API.

  • buff (int) – Array buffer provided by the OpenGL API.

  • texId (int) – Texture id for raster image provided by OpenGL API.

  • gradTexId (int) – optional id of 1D texture for gradient coloring provided by OpenGL API.

ClearBuffers()

Delete associated OpenGL VAO and FBO.

prepareForGLLoad(verts, ext, extra=None)

Perform any necessary preparation work prior to loading data into OpenGL.

Parameters:
  • verts (np.ndarray) – Floats repreensting vertices.

  • ext (list) – Floats of data extents.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

Returns:

  1. np.ndarray: The vertices to use; default implementation returns verts, but subclass implementations

    may return an alternative set.

  2. object: Default implementation returns extra, but subclass implementations may return a replacement

    value.

Return type:

tuple

class urclib.ui_qt.visualizer.ReferenceRecord(id, srcRecord, pureAlias=False)

Bases: LayerRecord

Reference to another layer record within the GaiaGeometryScene object. This exists reduce duplicate data sent to the GPU. ReferenceRecords operate in two ways: the default mode allows for overwriting of characteristics from the source layer; the alias can contain custom color, sizes, etc, while just sharing geometry. “Pure Alias” records act as read-only references to the src layer.

Notes

  • Attempting to access a ReferenceRecord whose source layer has been deleted is undefined.

  • All attributes from the source layer should be available through the ReferenceRecord instance; the attributes

listed here are specific to ReferenceRecords

srcRecord

The record to be referenced.

Type:

LayerRecord

Parameters:
  • id (int) – Unique identifier to assign to RefereneRecord.

  • srcRecord (LayerRecord) – The source LayerRecord object being referenced.

  • pureAlias (bool,optional) – If true, act as a read-only alias for source; otherwise, allows for local customization

__getattr__(item)
__setattr__(key, value)

Implement setattr(self, name, value).

ClearBuffers()

Delete associated OpenGL VAO and FBO.

prepareForGLLoad(verts, ext, extra=None)

Perform any necessary preparation work prior to loading data into OpenGL.

Parameters:
  • verts (np.ndarray) – Floats repreensting vertices.

  • ext (list) – Floats of data extents.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

Returns:

  1. np.ndarray: The vertices to use; default implementation returns verts, but subclass implementations

    may return an alternative set.

  2. object: Default implementation returns extra, but subclass implementations may return a replacement

    value.

Return type:

tuple

loadGLBuffer(verts, drawMode, scene, extra=None)

Load some data into the currently bound VBO.

Parameters:
  • verts (numpy.ndarray) – Vertex data to load into the array buffer.

  • drawMode (int) – The draw mode to attach to the buffer. Should be one of GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

  • scene (GeometryGLScene) – The scene tied to the active OpenGL context.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

class urclib.ui_qt.visualizer.TextLayerRecord(id, vao=0, buff=0, txtRenderer=None, **kwargs)

Bases: LayerRecord

Raster-specialized ogr_layer data.

texId

Texture id for raster image.

Type:

int

smooth

whether or not to apply smoothing to the texture.

Type:

bool

Parameters:
  • vao (int) – Vertex array object provided by the OpenGL API.

  • buff (int) – Array buffer provided by the OpenGL API.

  • texId (int) – Texture id for raster image provided by OpenGL API.

  • gradTexId (int) – optional id of 1D texture for gradient coloring provided by OpenGL API.

property vertCount

Number of vertices associated with this record.

Type:

int

property strEntries

List of StringEntry objects describing the strings present in the layer.

Type:

list

ClearBuffers()

Delete associated OpenGL VAO and FBO.

AddStringEntry(strEntry)

Add a new string to the layer.

Parameters:

strEntry (StringEntry) – The entry object containing the string and its location.

AddString(inStr, anchor, **kwargs)

Add a new string to the layer.

Parameters:
  • inStr – The string to store; note that tabs will be converted to spaces.

  • anchor – The point which “anchors” the string in Worldspace coordinates. The value should be a container with 3 float values, corresponding to (x,y).

Keyword Arguments:
  • h_justify – String representing the horizontal justification relative to the anchor point. Valid values are: * ‘center’: The string centers horizontally on the anchor point. This is the default value. * ‘left’: The string positions itself so the anchor is to the left. * ‘right’: The string positions itself so the anchor is to the right.

  • v_justify – String representing the vertical justification relative to the anchor point. Valid values are: * ‘center’: The string centers vertically on the anchor point. This is the default value. * ‘top’: The string positions itself so the anchor is on top. * ‘bottom’: The string positions itself so the anchor is below the bottom.

  • tabspacing – The number of spaces to substitute for tab characters. The default is 4.

AddStrings(inStrs, anchors, **kwargs)

Add several strings to the layer

Parameters:
  • inStrs (list) – A list of strings to add.

  • anchors (numpy.ndarray) – A list of floats corresponding to the anchor points for each string.

Keyword Arguments:
  • h_justify – String representing the horizontal justification relative to the anchor point. Valid values are: * ‘center’: The string centers horizontally on the anchor point. This is the default value. * ‘left’: The string positions itself so the anchor is to the left. * ‘right’: The string positions itself so the anchor is to the right.

  • v_justify – String representing the vertical justification relative to the anchor point. Valid values are: * ‘center’: The string centers vertically on the anchor point. This is the default value. * ‘top’: The string positions itself so the anchor is on top. * ‘bottom’: The string positions itself so the anchor is below the bottom.

  • tabspacing – The number of spaces to substitute for tab characters. The default is 4.

prepareForGLLoad(verts, ext, extra=None)

Perform any necessary preparation work prior to loading data into OpenGL.

Parameters:
  • verts (np.ndarray) – Floats repreensting vertices.

  • ext (list) – Floats of data extents.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

Returns:

  1. np.ndarray: The vertices to use; default implementation returns verts, but subclass implementations

    may return an alternative set.

  2. object: Default implementation returns extra, but subclass implementations may return a replacement

    value.

Return type:

tuple

loadGLBuffer(verts, drawMode, scene, extra=None)

Load some data into the currently bound VBO.

Parameters:
  • verts (numpy.ndarray) – Vertex data to load into the array buffer.

  • drawMode (int) – The draw mode to attach to the buffer. Should be one of GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

  • scene (GeometryGLScene) – The scene tied to the active OpenGL context.

  • extra (object,optional) – Any additional data needed. Argument reserved for subclass implementations.

loadStrings()

Load strings into VAO and VBO associated with the record.

urclib.ui_qt.visualizer.__version__ = ()
urclib.ui_qt.visualizer.newGeometryScene(*args, **kwargs)

Initialize a new GeometryGLScene.

Parameters:
  • *args (list) – Positional Arguments to be forwarded to constructor.

  • **kwargs (dict) – Keyword arguments to be forwarded to constructor.

Returns:

Newly-constructed GeometryGLScene.

Return type:

GeometryGLScene

urclib.ui_qt.visualizer.newOGRScene(*args, **kwargs)

Initialize a new OGRGLScene.

Parameters:
  • *args (list) – Positional Arguments to be forwarded to constructor.

  • **kwargs (dict) – Keyword arguments to be forwarded to constructor.

Returns:

Newly-constructed OGRGLScene.

Return type:

OGRGLScene