viewerwidget

Viewer Widget. Allows display of images, zooming and panning etc.

class tuiview.viewerwidget.ActiveToolChangedInfo(newTool, senderid)[source]

Container class for info pass in the activeToolChanged signal

class tuiview.viewerwidget.GeolinkInfo(senderid, easting, northing, metresperwinpix=0)[source]

Container class for the information passed in the geolinkMove and geolinkQueryPoint signals.

static fromString(jstring)[source]

Create an instance from json

toString()[source]

Return as json

class tuiview.viewerwidget.QueryInfo(easting, northing, column, row, data, layer, modifiers)[source]

Container class for the information passed in the locationSelected signal.

class tuiview.viewerwidget.ViewerWidget(parent)[source]

The main ViewerWidget class. Should be embeddable in other applications. See the open() function for loading images.

addLayersFromJSONFile(fileobj, nlayers)[source]

Get the layer manager to read all the layer descriptions from fileobj and load these layers into this widget.

addRasterLayer(gdalDataset, stretch, lut=None, ignoreProjectionMismatch=False, quiet=False)[source]

Add the given dataset to the stack of images being displayed as a raster layer

addVectorFeatureLayer(ogrDataSource, ogrLayer, ogrFeature, color=None, quiet=None)[source]

Just a single feature vector

addVectorLayer(ogrDataSource, ogrLayer, color=None, resultSet=False, origSQL=None, quiet=False)[source]

Add the vector given by the ogrDataSource and its dependent ogrLayer to the stack of images.

doGeolinkMove(easting, northing, metresperwinpix)[source]

Call this when widget needs to be moved because of geolinking event.

doGeolinkQueryPoint(easting, northing)[source]

Call this when the widget query point has been moved in another viewer and should be updated in this one if the query tool is active.

emitGeolinkMoved()[source]

Call this on each zoom/pan to emit the appropriate signal.

flicker()[source]

Call to change the flicker state (ie draw the top raster image or not).

getGeolinkInfo()[source]

Called by emitGeolinkMoved and anything else that needs the current GeolinkInfo

highlightValues(color, selectionArray=None)[source]

Applies a QColor to the LUT where selectionArray == True to the top layer and redraws. Pass None to reset

mouseMoveEvent(event)[source]

Mouse has been moved while dragging. If in zoom/pan mode we need to do something here.

mousePressEvent(event)[source]

Mouse has been clicked down if we are in zoom/pan mode we need to start doing stuff here

mouseReleaseEvent(event)[source]

Mouse has been released, if we are in zoom/pan mode we do stuff here.

newQueryPoint(easting=None, northing=None, dspY=None, dspX=None, column=None, row=None, modifiers=None)[source]

This viewer has recorded a new query point. Or user has entered new coords in querywindow.

Calls updateQueryPoint and emits the geolinkQueryPoint signal

pass either [easting and northing] or [dspX,dspY] or [column, row]

newVectorQueryPoint(dspX, dspY, modifiers=None)[source]

New vector query point. Does the spatial query and emits the vectorLocationSelected signal with the results

paintEvent(event)[source]

Viewport needs to be redrawn. Assume that each layer’s image is current (as created by getImage()) we can just draw it with QPainter

removeLayer()[source]

Removes the top later

removeQueryPoint(senderid)[source]

Removes a query point. keyed on the id() of the sender

resizeEvent(event)[source]

Window has been resized - get new data

scrollContentsBy(dx, dy)[source]

Handle the user moving the scroll bars

setActiveTool(tool, senderid)[source]

Set active tool (one of VIEWER_TOOL_*). pass VIEWER_TOOL_NONE to disable pass the id() of the calling object. This is passed around in the activeToolChanged signal so GUI elements can recognise who asked for the change

setBackgroundColor(color)[source]

Sets the background color for the widget

setColorTableLookup(lookupArray=None, colName=None, surrogateLUT=None, surrogateName=None)[source]

Uses the supplied lookupArray to look up image data before indexing into color table in the top layer and redraws. Pass None to reset.

setGeolinkFollowExtentAction(followExtent)[source]

Set whether we are following geolink extent of just center

setMouseScrollWheelAction(scrollZoom)[source]

Set the action for a mouse wheen event (scroll/zoom)

setNewStretch(newstretch, layer, local=False)[source]

Change the stretch being applied to the current data

setQueryOnlyDisplayed(queryOnlyDisplayed)[source]

set whether we are only querying displayed layers (True) or all (False)

setQueryPoint(senderid, easting, northing, color, size=None, cursor=None)[source]

Sets/Updates query point keyed on the id() of the sender

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

updateQueryPoint(easting, northing, column, row, modifiers)[source]

Map has been clicked, get the value and emit a locationSelected signal. Called by newQueryPoint or when a geolinkQueryPoint signal has been received.

updateScrollBars()[source]

Update the scroll bars to accurately show where we are relative to the full extent

wheelEvent(event)[source]

User has used mouse wheel to zoom in/out or pan depending on defined preference

zoomFullExtent()[source]

Resets the zoom to full extent - should be the same as when file was opened.

zoomNativeResolution()[source]

Sets the zoom to native resolution wherever the current viewport is centered

activeToolChanged
geolinkMove
geolinkQueryPoint
layerAdded
locationSelected
polygonCollected
polylineCollected
showStatusMessage
vectorLocationSelected