4.1.3.8. Ortho2D
This module implements an Orthonormal 2D Viewport.
-
class PyOpenGLng.HighLevelApi.Ortho2D.Ortho2D(max_area, zoom_manager, window)[source]
Bases: object
This class implements an Orthonormal 2D Viewport.
Public Attributes:
display_scale
gl_to_window_parity
inverse_parity_display_scale
parity_display_scale
viewport_area
window
zoom_manager
The parameter max_area must be an Tools.Interval.Interval2D instance
that defines the maximum area allowed for the viewport.
The parameter zoom_manager must be an ZoomManager instance.
The parameter window must implement a Window Trait, that defines a method size()
returning the 2-tuple (width, height).
-
_compute_display_scale()[source]
Compute the display scale.
-
_compute_zoom_to_fit_axis(length, axis)[source]
Compute the zoom to fit an axis size.
-
_compute_zoom_to_fit_interval(interval)[source]
Compute the zoom to fit an interval. The parameter interval must be an
Tools.Interval.Interval2D instance.
-
_logger = <logging.Logger object at 0x43d9410>
-
fit_axis(length, axis)[source]
Set the zoom so as to fit an axis size.
-
get_state()[source]
Get the viewport state.
-
gl_to_window_coordinate(gl_point)[source]
Return the window coordinate from the scene coordinate. The parameter gl_point
must be an Numpy array.
-
gl_to_window_parity = array([ 1., -1.])
-
ortho2d_bounding_box()[source]
-
resize()[source]
Resize the viewport for the new window size.
-
row_bounding_box()[source]
-
set_state(state)[source]
Set the viewport state.
-
translate(dx, axis)[source]
Translate the viewport of dx in the axis direction.
-
view_matrix()[source]
Return the view matrix.
-
viewport_scale(window_size)[source]
Return the viewport scale.
-
viewport_uniform_buffer_data(window_size)[source]
Return the viewport uniform buffer data.
-
window_to_gl_coordinate(window_point)[source]
Return the scene coordinate from the window coordinate. The parameter window_point
must be an Numpy array.
-
window_to_gl_distance(x_window)[source]
-
zoom_at(center)[source]
Zoom the viewport centered on the point center. The parameter center must be an
Numpy array.
-
zoom_at_center(zoom_factor)[source]
Zoom on the viewport center.
-
zoom_at_with_scale(point, zoom_factor)[source]
Zoom the viewport centered on a point. The parameter point must be an Numpy array.
-
zoom_interval(interval)[source]
Zoom to an interval. The parameter interval must be an
Tools.Interval.Interval2D instance.
-
class PyOpenGLng.HighLevelApi.Ortho2D.ViewportArea(max_area)[source]
Bases: object
This class defines a viewport area.
It implements an interval arithmetic using the class Tools.Interval.Interval2D.
Public Attributes:
ref_point
The parameter max_area must be an Tools.Interval.Interval2D instance
that defines the maximum area allowed for the viewport.
-
_check_area(area)[source]
Check the interval area is included in the the max area.
-
_check_axis_interval(axis_interval, axis)[source]
Check the axis interval and return a new one that is included in the max area.
-
_logger = <logging.Logger object at 0x43d9410>
-
_set_reference_point()[source]
Set the reference point of the viewport defined as the left-bottom corner.
-
area[source]
-
center()[source]
Return the viewport center as an Numpy array.
-
max_area[source]
-
size(dtype=<type 'numpy.uint64'>)[source]
Return the viewport size as an Numpy array.
-
translate(dx, axis)[source]
Translate the viewport of dx in the axis direction.
-
class PyOpenGLng.HighLevelApi.Ortho2D.ZoomManagerAbc[source]
Bases: object
This class implements a basic zoom manager.
Public Attributes:
zoom_factor
The initial zoom factor is set to one.
-
_logger = <logging.Logger object at 0x43d9410>
-
check_zoom(zoom_factor)[source]
Basic implementation to check a zoom factor, return the 2-tuple (True, zoom_factor).
-
PyOpenGLng.HighLevelApi.Ortho2D.interval2d_from_center_and_size(center, size)[source]
Return an Tools.Interval.Interval2D instance. The parameter center is a
2-tuple that defines the center of the interval and the parameter size the 2-tuple (width,
height).