viewerlayers¶
this module contains the LayerManager and related classes
- class tuiview.viewerlayers.LayerManager(*args: Any, **kwargs: Any)[source]¶
Class that manages a list of layers
- newPercentSig¶
signal emitted when a new progress percent is reached
alias of
int
- topLayerChanged¶
signal emitted when top layer changed
alias of
object
- addRasterLayer(gdalDataset, width, height, stretch, lut=None, ignoreProjectionMismatch=False, quiet=False)[source]¶
Add a new raster layer with given display width and height, stretch and optional lut.
- addVectorFeatureLayer(ogrDataSource, ogrLayer, ogrFeature, width, height, color=(255, 255, 0, 255), quiet=False)[source]¶
Add a vector feature layer
- addVectorLayer(ogrDataSource, ogrLayer, width, height, color=(255, 255, 0, 255), resultSet=False, origSQL=None, label=None, quiet=False)[source]¶
Add a vector layer. See ViewerVectorLayer.open for more info on params
- fromFile(fileobj, nlayers, width, height)[source]¶
Tries to read the json out of fileobj and reconstruct all the layers
- getTopDisplayedRasterLayer()[source]¶
Returns the top most raster layer (if there is one) otherwise None
- getTopDisplayedVectorLayer()[source]¶
Returns the top most vector layer (if there is one) otherwise None
- static isSameRasterProjection(layer1, layer2)[source]¶
Checks to see if 2 raster layers have the same projection
- moveLayerDown(layer)[source]¶
Move the specified layer ‘down’ - ie render it later which is actually up the list
- moveLayerUp(layer)[source]¶
Move the specified layer ‘up’ - ie render it later which is actually down the list
- recalcFullExtent()[source]¶
Internal method. Recalculates the full extent of all the layers. Called when dataset added or removed.
- setDisplayedState(layer, state)[source]¶
Sets the displayed state for a layer use this rather than setting layer.displayed directly as title bar will be updated this way
- setStretchAllLayers(stretch, local=False)[source]¶
Sets the stretch for all layers contained by the LayerManager.
- timeseriesBackward()[source]¶
Assume images are a stacked timeseries oldest to newest. Turn on the previous one to the current topmost displayed
- timeseriesForward()[source]¶
Assume images are a stacked timeseries oldest to newest. Turn off the current topmost displayed
- toFile(fileobj)[source]¶
Save all the layers and info needed to re-create them to the fileobj as JSON.
- updateImages()[source]¶
Tell each of the layers to get a new ‘image’ for rendering. This is called when extents have changed etc.
- updateTopFilename()[source]¶
Call this when the top displayed layer may have changed and the correct signal will be emitted
- zoomFullExtent()[source]¶
Zoom to the full extent of all the layers This might need a re-think for vectors.
- endProgressSig¶
signal emitted when progress is finished
- layersChanged¶
signal emitted when layers have changed
- newProgressSig = 'QString'¶
signal emitted when a new progress bar is needed
- statusMessageSig = 'QString'¶
signal emitted with a new status message needs to be shown to the user
- class tuiview.viewerlayers.OverviewInfo(xsize, ysize, fullrespixperpix, index)[source]¶
Stores size and index of an overview
- class tuiview.viewerlayers.OverviewManager[source]¶
This class contains a list of valid overviews and allows the best overview to be retrieved
- class tuiview.viewerlayers.PropertyInfo[source]¶
Container for Info for proerties window
- class tuiview.viewerlayers.ViewerFeatureVectorLayer[source]¶
A vector Feature layer. Same as ViewerVectorLayer but works with a single feature provided by the driving program.
- class tuiview.viewerlayers.ViewerLayer[source]¶
Base class for a type of layer
- class tuiview.viewerlayers.ViewerRasterLayer(layermanager)[source]¶
Represents a raster layer
- changeUpdateAccess(update)[source]¶
Re-opens the GDAL dataset in the new update mode (True for update False for readonly)
- exportStretchandLUTToText(fname)[source]¶
Exports the current stretch and lookup table to a JSON formatted text file
- fromFile(fileobj, width, height)[source]¶
Reads information (written by toFile) and builds a layer assumes that the ‘type’ line has already been read.
- getImage()[source]¶
Refresh the ‘image’ which is a QImage instance used for rendering. Does the selection of overview, choosing of area (based on coordmgr) reading, and applying LUT.
- getPropertiesInfo()[source]¶
Get the properties of the file as a PropertyInfo for presentation to user. Do something similar to gdalinfo.
- getWavelengths()[source]¶
Return the list of wavelength if file they conform to the expected format for the driver (provided by getWavelengthsMetaFormat).
- getWavelengthsMetaFormat()[source]¶
Get the format used to store wavelenths in the metadata.
Note, currently just returns ENVI for all drivers. This can be used for ENVI files and files converted from ENVI format, which retain the same metadata format.
- open(gdalDataset, width, height, stretch, lut=None)[source]¶
Open a filename as a raster layer. width and height is the display size. stretch is the ViewerStretch instance to use. if specified, the lut is used to display the data, otherwise calculated from the stretch Keeps a reference to gdalDataset Assumes gdalDataset opened in read only mode.
- class tuiview.viewerlayers.ViewerVectorLayer[source]¶
A vector layer. Uses vectorrasterizer to burn in the outlines
- fromFile(fileobj, width, height)[source]¶
Initialise this instance of the class with information from json in fileobj
- getAttributesAtPoint(easting, northing, tolerance=0)[source]¶
Returns a list of attributes for the point centred on (easting, northing). If tolerance is specified a box will will be drawn centred at (easting, northing) and size tolerance. Each item in the list contains a dictionary keyed on the attribute name and the value will be the attribute value as a string.
- open(ogrDataSource, ogrLayer, width, height, extent=None, color=(255, 255, 0, 255), resultSet=False, origSQL=None, label=None)[source]¶
Use the supplied datasource and layer for accessing vector data keeps a reference to the datasource and layer If resultSet is True then ogrDataSource.ReleaseResultSet is called on destruction. If resultSet is True then origSQL should be passed so layer can be recreated if saved as json
- tuiview.viewerlayers.replicateArray(arr, outarr, dspLeftExtra, dspTopExtra, dspRightExtra, dspBottomExtra)[source]¶
Replicate the data in the given 2-d array so that it increases in size to be (ysize, xsize).
Replicates each pixel in both directions.
dspLeftExtra, dspTopExtra are the number of pixels to be shaved off the top and left. dspRightExtra, dspBottomExtra are the number of pixels to be shaved off the bottom and right of the result. This allows us to display fractional pixels.
- tuiview.viewerlayers.NOTSET_STRING = 'Not Set'¶
Returned when one of the property items not set on the file