Skip to content

Commit

Permalink
add context parameter for iml request
Browse files Browse the repository at this point in the history
Signed-off-by: minff <[email protected]>
  • Loading branch information
minff committed Aug 6, 2024
1 parent 8e49d99 commit 2588bd0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
17 changes: 17 additions & 0 deletions XYZHubConnector/xyz_qgis/gui/ui/tab_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,22 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_16">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Context</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_context"/>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -1109,6 +1125,7 @@
<tabstop>lineEdit_limit</tabstop>
<tabstop>lineEdit_max_feat</tabstop>
<tabstop>comboBox_similarity_threshold</tabstop>
<tabstop>comboBox_context</tabstop>
<tabstop>radioButton_loading_live</tabstop>
<tabstop>radioButton_loading_tile</tabstop>
<tabstop>radioButton_loading_single</tabstop>
Expand Down
13 changes: 12 additions & 1 deletion XYZHubConnector/xyz_qgis/gui/ux/connect_ux.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, *a):
self.lineEdit_tags = None
self.comboBox_similarity_threshold = None
self.filter_dialog = None
self.comboBox_context = None

def config(self, *a):
# super().config(*a)
Expand Down Expand Up @@ -115,6 +116,14 @@ def config(self, *a):
self.lineEdit_selection.setToolTip("Load only the selected properties of features")
self.btn_filter.setToolTip("Query features by property")

for text, data in [
("default", "default"),
("extension", "extension"),
("super", "super"),
]:
self.comboBox_context.addItem(text, data)
self.comboBox_context.setCurrentIndex(0)

def _get_loading_mode(self) -> str:
for mode, box in zip(
LOADING_MODES,
Expand Down Expand Up @@ -144,6 +153,7 @@ def get_params(self):
"loading_mode",
"selection",
"filters",
"context",
]
val = [
strip_list_string(self.lineEdit_tags.text().strip()),
Expand All @@ -154,8 +164,9 @@ def get_params(self):
self._get_loading_mode(),
strip_list_string(self.lineEdit_selection.text().strip()),
self._get_filters(),
self.comboBox_context.currentData(),
]
fn = [str, int, int, int, str, str, str, list]
fn = [str, int, int, int, str, str, str, list, str]
return dict(
(k, f(v)) for k, v, f in zip(key, val, fn) if v is not None and len(str(v)) > 0
)
Expand Down
4 changes: 2 additions & 2 deletions XYZHubConnector/xyz_qgis/loader/layer_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(self, network: NetManager, layer: XYZLayer = None, n_parallel=1):
self.n_parallel = 1
self.status = self.LOADING

self.fixed_keys = ["tags", "filters", "selection"]
self.fixed_keys = ["tags", "filters", "selection", "context"]
self.layer = layer
self.max_feat: int = None
self.kw: dict = None
Expand Down Expand Up @@ -314,7 +314,7 @@ def show_info_msg(self, msg, dt=1):
class TileLayerLoader(LoadLayerController):
def __init__(self, network: NetManager, *a, layer: XYZLayer = None, **kw):
super().__init__(network, *a, **kw)
self.fixed_keys = ["tags", "limit", "tile_schema", "filters", "selection"]
self.fixed_keys = ["tags", "limit", "tile_schema", "filters", "selection", "context"]
self.params_queue = queue.SimpleQueue(key="tile_id") # dont have retry logic
self.layer = layer
self.total_params = 0
Expand Down

0 comments on commit 2588bd0

Please sign in to comment.