diff --git a/__init__.py b/__init__.py index 82bd0fb6f9d3ff1744a0c058565475dfbd812a54..c6fd27aa97ba9ddb70302aad877a1e475d674500 100644 --- a/__init__.py +++ b/__init__.py @@ -31,5 +31,5 @@ def classFactory(iface): # pylint: disable=invalid-name :type iface: QgsInterface """ # - from .sensecarbon_tsv import SenseCarbon_TSV - return SenseCarbon_TSV(iface) + from .sensecarbon_tsv import TimeSeriesViewer + return TimeSeriesViewer(iface) diff --git a/imagechipviewsettings_widget_base.ui b/imagechipviewsettings_widget_base.ui index 1dd7dac1b218fae8370c26190acb15e616d07fbe..dcd880f6864416991ed0630a6af8f3f74745ef77 100644 --- a/imagechipviewsettings_widget_base.ui +++ b/imagechipviewsettings_widget_base.ui @@ -208,13 +208,13 @@ </widget> <tabstops> <tabstop>cb_r</tabstop> - <tabstop>tb_range_r_min</tabstop> - <tabstop>tb_range_r_max</tabstop> <tabstop>cb_g</tabstop> - <tabstop>tb_range_g_min</tabstop> - <tabstop>tb_range_g_max</tabstop> <tabstop>cb_b</tabstop> + <tabstop>tb_range_r_min</tabstop> + <tabstop>tb_range_g_min</tabstop> <tabstop>tb_range_b_min</tabstop> + <tabstop>tb_range_r_max</tabstop> + <tabstop>tb_range_g_max</tabstop> <tabstop>tb_range_b_max</tabstop> </tabstops> <resources/> diff --git a/sensecarbon_tsv.py b/sensecarbon_tsv.py index 8fbb36e0428b5e398553b6b1e09f9c652b6edfbe..4b759c47b1af0a1288550ac04c5af2983caa2450 100644 --- a/sensecarbon_tsv.py +++ b/sensecarbon_tsv.py @@ -29,21 +29,30 @@ from qgis.core import * from osgeo import gdal, ogr, osr, gdal_array DEBUG = True - +import qgis.analysis try: from qgis.gui import * import qgis import qgis_add_ins qgis_available = True + + #import console.console_output + #console.show_console() + #sys.stdout = console.console_output.writeOut() + #sys.stderr = console.console_output.writeOut() + except: + print('Can not find QGIS instance') qgis_available = False import numpy as np -import six + import multiprocessing from PyQt4.QtCore import * from PyQt4.QtGui import * - +import sys +import code +import codecs #abbreviations mkdir = lambda p: os.makedirs(p, exist_ok=True) @@ -241,17 +250,20 @@ class TimeSeriesItemModel(QAbstractItemModel): def columnCount(self, index=QModelIndex()): return 1 -LUT_SensorNames = {(6,30.,30.): 'L7 ETM+' \ - ,(7,30.,30.): 'L8 OLI' \ - ,(4,10.,10.): 'S2 MSI 10m' \ - ,(6,20.,20.): 'S2 MSI 20m' \ - ,(3,30.,30.): 'S2 MSI 60m' \ - ,(3,30.,30.): 'S2 MSI 60m' \ - ,(5,5.,5.): 'RE 5m' \ - } +LUT_SENSORNAMES = {(6, 30., 30.): 'Landsat Legacy' \ + , (7,30.,30.): 'L8 OLI' \ + , (4,10.,10.): 'S2 MSI 10m' \ + , (6,20.,20.): 'S2 MSI 20m' \ + , (3,30.,30.): 'S2 MSI 60m' \ + , (3,30.,30.): 'S2 MSI 60m' \ + , (5,5.,5.): 'RE 5m' \ + } + +class BandView(QObject): + + removeView = pyqtSignal(object) -class BandView(object): def __init__(self, TS, recommended_bands=None): assert type(TS) is TimeSeries self.representation = collections.OrderedDict() @@ -282,17 +294,18 @@ class BandView(object): def initSensor(self, sensor, recommended_bands=None): """ - :param sensor: :param recommended_bands: :return: """ + assert type(sensor) is SensorConfiguration if sensor not in self.representation.keys(): #self.bandMappings[sensor] = ((0, 0, 5000), (1, 0, 5000), (2, 0, 5000)) #x = imagechipviewsettings_widget.ImageChipViewSettings(sensor) #x = tsv_widgets.BandViewSettings(sensor) x = tsv_widgets.ImageChipViewSettings(sensor) + #x.removeView.connect(lambda : self.removeView.emit(self)) if recommended_bands is not None: assert min(recommended_bands) > 0 @@ -367,8 +380,8 @@ class SensorConfiguration(object): if sensor_name is None: id = (self.nb, self.px_size_x, self.px_size_y) - if id in LUT_SensorNames.keys(): - sensor_name = LUT_SensorNames[id] + if id in LUT_SENSORNAMES.keys(): + sensor_name = LUT_SENSORNAMES[id] else: sensor_name = '{} b x {} m'.format(self.nb, self.px_size_x) @@ -403,10 +416,16 @@ class SensorConfiguration(object): class ImageChipLabel(QLabel): - def __init__(self, parent=None, iface=None, TSD=None, bands=None): - super(ImageChipLabel, self).__init__(parent) + + clicked = pyqtSignal(object, object) + + + def __init__(self, time_series_viewer=None, iface=None, TSD=None, bands=None): + super(ImageChipLabel, self).__init__(time_series_viewer) + self.TSV = time_series_viewer self.TSD = TSD self.bn = os.path.basename(self.TSD.pathImg) + self.iface=iface self.bands=bands self.setContextMenuPolicy(Qt.DefaultContextMenu) @@ -419,13 +438,19 @@ class ImageChipLabel(QLabel): self.setToolTip(list2str(tt)) + def mouseReleaseEvent(self, event): + self.clicked.emit(self, event) + + def contextMenuEvent(self, event): menu = QMenu() #add general options + action = menu.addAction('Copy to clipboard') action.triggered.connect(lambda : QApplication.clipboard().setPixmap(self.pixmap())) + #add QGIS specific options if self.iface: action = menu.addAction('Add {} to QGIS layers'.format(self.bn)) @@ -1302,7 +1327,7 @@ class ImageChipBuffer(object): list2str = lambda ll : '\n'.join([str(l) for l in ll]) -class SenseCarbon_TSV: +class TimeSeriesViewer: """QGIS Plugin Implementation.""" def __init__(self, iface): @@ -1361,7 +1386,7 @@ class SenseCarbon_TSV: D.btn_loadTSFile.clicked.connect(self.ua_loadTSFile) D.btn_saveTSFile.clicked.connect(self.ua_saveTSFile) D.btn_addTSExample.clicked.connect(self.ua_loadExampleTS) - + D.btn_labeling_clear.clicked.connect(D.tb_labeling_text.clear) D.actionAdd_Images.triggered.connect(lambda :self.ua_addTSImages()) D.actionAdd_Masks.triggered.connect(lambda :self.ua_addTSMasks()) D.actionLoad_Time_Series.triggered.connect(self.ua_loadTSFile) @@ -1390,13 +1415,14 @@ class SenseCarbon_TSV: if self.iface: self.canvas = self.iface.mapCanvas() self.menu = self.tr(u'&SenseCarbon TSV') - self.toolbar = self.iface.addToolBar(u'SenseCarbon TSV') - self.toolbar.setObjectName(u'SenseCarbon TSV') + #self.toolbar = self.iface.addToolBar(u'SenseCarbon TSV') + #self.toolbar.setObjectName(u'SenseCarbon TSV') self.RectangleMapTool = qgis_add_ins.RectangleMapTool(self.canvas) self.RectangleMapTool.rectangleDrawed.connect(self.ua_selectBy_Response) self.PointMapTool = qgis_add_ins.PointMapTool(self.canvas) self.PointMapTool.coordinateSelected.connect(self.ua_selectBy_Response) + #self.RectangleMapTool.connect(self.ua_selectByRectangle_Done) self.ICP = self.dlg.scrollArea_imageChip_content.layout() @@ -1581,88 +1607,20 @@ class SenseCarbon_TSV: return QCoreApplication.translate('EnMAPBox', message) - def add_action( - self, - icon_path, - text, - callback, - enabled_flag=True, - add_to_menu=True, - add_to_toolbar=True, - status_tip="SenseCarbon Time Series Viewer - a tool to visualize a time series of remote sensing imagery", - whats_this="Open SenseCarbon Time Series Viewer", - parent=None): - """Add a toolbar icon to the toolbar. - - :param icon_path: Path to the icon for this action. Can be a resource - path (e.g. ':/plugins/foo/bar.png') or a normal file system path. - :type icon_path: str - - :param text: Text that should be shown in menu items for this action. - :type text: str - - :param callback: Function to be called when the action is triggered. - :type callback: function - - :param enabled_flag: A flag indicating if the action should be enabled - by default. Defaults to True. - :type enabled_flag: bool - - :param add_to_menu: Flag indicating whether the action should also - be added to the menu. Defaults to True. - :type add_to_menu: bool - - :param add_to_toolbar: Flag indicating whether the action should also - be added to the toolbar. Defaults to True. - :type add_to_toolbar: bool - - :param status_tip: Optional text to show in a popup when mouse pointer - hovers over the action. - :type status_tip: str - - :param parent: Parent widget for the new action. Defaults None. - :type parent: QWidget - - :param whats_this: Optional text to show in the status bar when the - mouse pointer hovers over the action. - - :returns: The action that was created. Note that the action is also - added to self.actions list. - :rtype: QAction - """ - - icon = QIcon(icon_path) - action = QAction(icon, text, parent) - action.triggered.connect(callback) - action.setEnabled(enabled_flag) - - if status_tip is not None: - action.setStatusTip(status_tip) - - if whats_this is not None: - action.setWhatsThis(whats_this) - - if add_to_toolbar: - self.toolbar.addAction(action) - - if add_to_menu: - self.iface.addPluginToMenu( - self.menu, - action) - - self.actions.append(action) - - return action def initGui(self): """Create the menu entries and toolbar icons inside the QGIS GUI.""" self.icon_path = ':/plugins/SenseCarbon/icon.png' - self.add_action( - self.icon_path, - text=self.tr(u'SenseCarbon Time Series Viewer'), - callback=self.run, - parent=self.iface.mainWindow()) + + icon = QIcon(self.icon_path) + self.action = QAction(icon, self.tr(u'SenseCarbon Time Series Viewer'), self.iface.mainWindow()) + self.action.triggered.connect(self.run) + #action.setEnabled(enabled_flag) + + #add to toolbar: + self.iface.addToolBarIcon(self.action) + def ua_addTSD_to_QGIS(self, TSD, bands): @@ -1673,14 +1631,8 @@ class SenseCarbon_TSV: def unload(self): - """Removes the plugin menu item and icon from QGIS GUI.""" - for action in self.actions: - self.iface.removePluginMenu( - self.tr(u'&SenseCarbon Time Series Viewer'), - action) - self.iface.removeToolBarIcon(action) - # remove the toolbar - del self.toolbar + """Removes the plugin menu item and icon """ + self.iface.removeToolBarIcon(self.action) def run(self): """Run method that performs all the real work""" @@ -1800,10 +1752,11 @@ class SenseCarbon_TSV: #imv = QGraphicsView(self.dlg.scrollArea_imageChip_content) #imv = MyGraphicsView(self.dlg.scrollArea_imageChip_content, iface=self.iface, path=TSD.pathImg, bands=bands) #imv = pg.ImageView(view=None) - imgLabel = ImageChipLabel(iface=self.iface, TSD=TSD, bands=bands) + imgLabel = ImageChipLabel(time_series_viewer=self.dlg, iface=self.iface, TSD=TSD, bands=bands) imgLabel.setMinimumSize(size_x, size_y) imgLabel.setMaximumSize(size_x, size_y) + imgLabel.clicked.connect(self.ua_collect_date) viewList.append(imgLabel) @@ -1857,6 +1810,21 @@ class SenseCarbon_TSV: self.TS.getSpatialChips_parallel(bbWkt, srsWkt, TSD_band_list=missing) + def ua_collect_date(self, ICL, event): + if self.dlg.rb_labeling_activate.isChecked(): + txt = self.dlg.tb_labeling_text.toPlainText() + reg = re.compile('\d{4}-\d{2}-\d{2}', re.I | re.MULTILINE) + dates = set([np.datetime64(m) for m in reg.findall(txt)]) + doi = ICL.TSD.getDate() + + if event.button() == Qt.LeftButton: + dates.add(doi) + elif event.button() == Qt.MiddleButton and doi in dates: + dates.remove(doi) + + dates = sorted(list(dates)) + txt = ' '.join([d.astype(str) for d in dates]) + self.dlg.tb_labeling_text.setText(txt) def ua_showPxCoordinate_addChips(self, results, TSD=None): @@ -1949,7 +1917,9 @@ class SenseCarbon_TSV: def ua_addBandView(self, band_recommendation = [3, 2, 1]): - self.BAND_VIEWS.append(BandView(self.TS, recommended_bands=band_recommendation)) + bandView = BandView(self.TS, recommended_bands=band_recommendation) + #bandView.removeView.connect(self.ua_removeBandView) + self.BAND_VIEWS.append(bandView) self.refreshBandViews() @@ -1990,10 +1960,7 @@ class SenseCarbon_TSV: def ua_removeBandView(self, w): self.BAND_VIEWS.remove(w) - L = self.dlg.scrollArea_viewsWidget.layout() - L.removeWidget(w) - w.deleteLater() - self.setViewNames() + self.refreshBandViews() def ua_clear_TS(self): #remove views @@ -2112,7 +2079,7 @@ def run_tests(): import PyQt4.Qt app=PyQt4.Qt.QApplication([]) - S = SenseCarbon_TSV(None) + S = TimeSeriesViewer(None) S.run() if True: @@ -2146,7 +2113,7 @@ def run_tests(): a = QgsApplication([], True) - S = SenseCarbon_TSV(a) + S = TimeSeriesViewer(a) S.run() if True: diff --git a/sensecarbon_tsv_gui_base.ui b/sensecarbon_tsv_gui_base.ui index a58e98df7b9c1a2f96fdc483b3fadcf4f99cc8dd..46c7414710690f58f57fc3cb1bb13c7478d22451 100644 --- a/sensecarbon_tsv_gui_base.ui +++ b/sensecarbon_tsv_gui_base.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>898</width> - <height>947</height> + <width>1035</width> + <height>983</height> </rect> </property> <property name="windowTitle"> @@ -88,49 +88,8 @@ <bool>true</bool> </property> <property name="currentIndex"> - <number>1</number> + <number>0</number> </property> - <widget class="QWidget" name="tab_console"> - <attribute name="title"> - <string>Console</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <widget class="QPushButton" name="bt_console_clear"> - <property name="text"> - <string>Clear</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QTextEdit" name="tb_console"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>2</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </widget> <widget class="QWidget" name="tab_timeseries"> <attribute name="title"> <string>Time Series</string> @@ -286,8 +245,8 @@ <rect> <x>0</x> <y>0</y> - <width>754</width> - <height>204</height> + <width>891</width> + <height>244</height> </rect> </property> <property name="sizePolicy"> @@ -316,362 +275,680 @@ <widget class="QWidget" name="dockWidgetContents_4"> <layout class="QVBoxLayout" name="verticalLayout_6"> <item> - <widget class="QPushButton" name="btn_showPxCoordinate"> - <property name="toolTip"> - <string>Load or reload time series image chips. Requires that the time series is specified and which bands are to be shown.</string> - </property> - <property name="text"> - <string>Load image chips!</string> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_spatialsubset"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="title"> - <string>Image subset</string> - </property> - <layout class="QFormLayout" name="formLayout_3"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="1"> - <widget class="QPushButton" name="btn_selectByCoordinate"> - <property name="toolTip"> - <string>Selects the center coordinate from QGIS.</string> - </property> - <property name="text"> - <string>Select center coordinate</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="btn_selectByRectangle"> - <property name="toolTip"> - <string>Selects the image subset from QGIS.</string> - </property> - <property name="text"> - <string>Select subset by rectangle</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="toolTip"> - <string>Center coordinate x value</string> - </property> - <property name="text"> - <string>x</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="spinBox_coordinate_x"> - <property name="decimals"> - <number>8</number> - </property> - <property name="minimum"> - <double>-999999999.000000000000000</double> - </property> - <property name="maximum"> - <double>999999999.000000000000000</double> - </property> - <property name="singleStep"> - <double>30.000000000000000</double> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_4"> - <property name="toolTip"> - <string>Center coordinate y value</string> - </property> - <property name="text"> - <string>y</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="spinBox_coordinate_y"> - <property name="decimals"> - <number>8</number> - </property> - <property name="minimum"> - <double>-999999999.000000000000000</double> - </property> - <property name="maximum"> - <double>999999999.000000000000000</double> - </property> - <property name="singleStep"> - <double>30.000000000000000</double> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_7"> - <property name="toolTip"> - <string>Spatial Reference System (SRS) of center coordinate</string> - </property> - <property name="text"> - <string>SRS</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QPlainTextEdit" name="tb_bb_srs"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>50</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>50</height> - </size> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>size x</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox_subset_size_x"> - <property name="suffix"> - <string>m</string> - </property> - <property name="minimum"> - <double>1.000000000000000</double> - </property> - <property name="maximum"> - <double>999999.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>2000.000000000000000</double> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>size y</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QDoubleSpinBox" name="doubleSpinBox_subset_size_y"> - <property name="suffix"> - <string>m</string> - </property> - <property name="minimum"> - <double>1.000000000000000</double> - </property> - <property name="maximum"> - <double>9999999.000000000000000</double> - </property> - <property name="singleStep"> - <double>10.000000000000000</double> - </property> - <property name="value"> - <double>2000.000000000000000</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_rendering"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="title"> - <string>Chip Rendering</string> + <widget class="QTabWidget" name="tabbar_left"> + <property name="currentIndex"> + <number>0</number> </property> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="2" column="0" colspan="2"> - <widget class="QFrame" name="frame_timewindow"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="minimumSize"> - <size> - <width>50</width> - <height>50</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>before</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sb_ndates_before"> - <property name="maximum"> - <number>9999</number> - </property> - <property name="value"> - <number>1</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>after</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="sb_ndates_after"> - <property name="maximum"> - <number>9999</number> - </property> - <property name="value"> - <number>1</number> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>max. size </string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QSpinBox" name="spinBox_chipsize_max"> - <property name="minimumSize"> - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Max. length of an image chip on screen.</string> - </property> - <property name="suffix"> - <string>px</string> - </property> - <property name="minimum"> - <number>20</number> - </property> - <property name="maximum"> - <number>1000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="value"> - <number>200</number> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>#cpu</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QSpinBox" name="spinBox_ncpu"> - <property name="toolTip"> - <string>Number of CPUs used for parallel image chip calculation</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>DOI</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QComboBox" name="cb_doi"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QRadioButton" name="rb_showTimeWindow"> - <property name="toolTip"> - <string>Select </string> - </property> - <property name="text"> - <string>Time Window around DOI</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QRadioButton" name="rb_showEntireTS"> - <property name="text"> - <string>Entire Time Series</string> - </property> - <property name="checked"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>Viewer</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <widget class="QPushButton" name="btn_showPxCoordinate"> + <property name="toolTip"> + <string>Load or reload time series image chips. Requires that the time series is specified and which bands are to be shown.</string> + </property> + <property name="text"> + <string>Load image chips!</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_spatialsubset"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Image subset</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="1" column="0"> + <widget class="QLabel" name="label_12"> + <property name="toolTip"> + <string>Spatial Reference System (SRS) of center coordinate</string> + </property> + <property name="text"> + <string>Center</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QFrame" name="frame_2"> + <layout class="QHBoxLayout" name="horizontalLayout_6"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_3"> + <property name="toolTip"> + <string>Center coordinate x value</string> + </property> + <property name="text"> + <string>x</string> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="spinBox_coordinate_x"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="decimals"> + <number>8</number> + </property> + <property name="minimum"> + <double>-999999999.000000000000000</double> + </property> + <property name="maximum"> + <double>999999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>30.000000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_4"> + <property name="toolTip"> + <string>Center coordinate y value</string> + </property> + <property name="text"> + <string>y</string> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="spinBox_coordinate_y"> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="decimals"> + <number>8</number> + </property> + <property name="minimum"> + <double>-999999999.000000000000000</double> + </property> + <property name="maximum"> + <double>999999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>30.000000000000000</double> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_6"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_10"> + <property name="toolTip"> + <string>Spatial Reference System (SRS) of center coordinate</string> + </property> + <property name="text"> + <string>Size</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QFrame" name="frame"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>x</string> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="doubleSpinBox_subset_size_x"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="suffix"> + <string>m</string> + </property> + <property name="minimum"> + <double>1.000000000000000</double> + </property> + <property name="maximum"> + <double>999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + <property name="value"> + <double>2000.000000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>y</string> + </property> + </widget> + </item> + <item> + <widget class="QDoubleSpinBox" name="doubleSpinBox_subset_size_y"> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="suffix"> + <string>m</string> + </property> + <property name="minimum"> + <double>1.000000000000000</double> + </property> + <property name="maximum"> + <double>9999999.000000000000000</double> + </property> + <property name="singleStep"> + <double>10.000000000000000</double> + </property> + <property name="value"> + <double>2000.000000000000000</double> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_7"> + <property name="toolTip"> + <string>Spatial Reference System (SRS) of center coordinate</string> + </property> + <property name="text"> + <string>SRS</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QPlainTextEdit" name="tb_bb_srs"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>50</height> + </size> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QFrame" name="frame_3"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_7"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QPushButton" name="btn_selectByCoordinate"> + <property name="toolTip"> + <string>Selects the center coordinate from QGIS.</string> + </property> + <property name="text"> + <string>center coordinate</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btn_selectByRectangle"> + <property name="toolTip"> + <string>Selects the image subset from QGIS.</string> + </property> + <property name="text"> + <string>rectangle</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_13"> + <property name="toolTip"> + <string>Spatial Reference System (SRS) of center coordinate</string> + </property> + <property name="text"> + <string>Select</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_rendering"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Chip Rendering</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item row="4" column="0" colspan="2"> + <widget class="QFrame" name="frame_5"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_9"> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>max. size </string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox_chipsize_max"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Max. length of an image chip on screen.</string> + </property> + <property name="suffix"> + <string>px</string> + </property> + <property name="minimum"> + <number>20</number> + </property> + <property name="maximum"> + <number>1000</number> + </property> + <property name="singleStep"> + <number>50</number> + </property> + <property name="value"> + <number>300</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>#cpu</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBox_ncpu"> + <property name="toolTip"> + <string>Number of CPUs used for parallel image chip calculation</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>DOI</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="cb_doi"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QRadioButton" name="rb_showEntireTS"> + <property name="text"> + <string>Time Series</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="rb_showTimeWindow"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="toolTip"> + <string>Select </string> + </property> + <property name="text"> + <string>Time Window</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QFrame" name="frame_timewindow"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <property name="spacing"> + <number>2</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>before</string> + </property> + </widget> + </item> + <item> + <widget class="QFrame" name="frame_4"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="margin"> + <number>0</number> + </property> + </layout> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_ndates_before"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>after</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="sb_ndates_after"> + <property name="maximum"> + <number>9999</number> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_14"> + <property name="text"> + <string>DOI</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_5"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_4"> + <attribute name="title"> + <string>Labeling</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QFrame" name="frame"> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QRadioButton" name="rb_labeling_none"> + <property name="text"> + <string>None</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="rb_labeling_activate"> + <property name="toolTip"> + <string>Activates labeling of observation dates. Use left button and middle button to add or remove observation dates.</string> + </property> + <property name="text"> + <string>Collect Labels</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btn_labeling_clear"> + <property name="maximumSize"> + <size> + <width>50</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QTextEdit" name="tb_labeling_text"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> </item> <item> @@ -697,7 +974,7 @@ </widget> </item> <item> - <spacer name="verticalSpacer_4"> + <spacer name="verticalSpacer_6"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> @@ -717,7 +994,7 @@ <rect> <x>0</x> <y>0</y> - <width>898</width> + <width>1035</width> <height>21</height> </rect> </property> @@ -797,12 +1074,12 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>83</x> - <y>341</y> + <x>72</x> + <y>336</y> </hint> <hint type="destinationlabel"> - <x>160</x> - <y>380</y> + <x>227</x> + <y>337</y> </hint> </hints> </connection> diff --git a/tsv_widgets.py b/tsv_widgets.py index d92d01779ff318d881b9b9660862cbe476586ac4..1b2f7f787a8c52c4e8c27b3da8c3bdad77bc74e2 100644 --- a/tsv_widgets.py +++ b/tsv_widgets.py @@ -161,7 +161,9 @@ class ImageChipViewSettings(QGroupBox, FORM_CLASS_IMAGECHIPVIEWSETTINGS): menu = QMenu() #add general options - + action = menu.addAction('Remove Band View') + action.setToolTip('Removes this band view') + action.triggered.connect(lambda : self.removeView.emit()) #add QGIS specific options txt = QApplication.clipboard().text() if re.search('<!DOCTYPE(.|\n)*rasterrenderer.*type="multibandcolor"', txt) is not None: