Skip to content

Commit

Permalink
#88 added formula + correction for max_rel_dist
Browse files Browse the repository at this point in the history
  • Loading branch information
dieuska committed Jan 13, 2025
1 parent 4e9f132 commit 0b92f41
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 15 deletions.
27 changes: 21 additions & 6 deletions plugin/brdrq/brdrq.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def __init__(self, iface):
self.actions = []
self.toolbar = self.iface.addToolBar("brdrQ")
self.toolbar.setObjectName("brdrQ")
self.max_rel_dist = None
self.minimum = 0
self.maximum = 1500
self.step = 10
Expand All @@ -105,6 +106,7 @@ def __init__(self, iface):
self.reference_id = None
self.reference_loader = None
self.original_geometry = None
self.formula = None
self.full_parcel = None
self.partial_snapping =None
self.partial_snapping_strategy =None
Expand Down Expand Up @@ -204,8 +206,10 @@ def update_reference_choice(self, index):
def update_partial_snapping(self, state):
if state==2:
self.settingsDialog.comboBox_snapstrategy.setEnabled(True)
self.settingsDialog.spinBox_snap_max_segment_length.setEnabled(True)
else:
self.settingsDialog.comboBox_snapstrategy.setEnabled(False)
self.settingsDialog.spinBox_snap_max_segment_length.setEnabled(False)
return

def updateFields_reference(self):
Expand All @@ -232,12 +236,13 @@ def _update_settings(self):
self.threshold_overlap_percentage = (
self.settingsDialog.spinBox_threshold.value()
)
if self.maximum is None:
self.maximum = int(s.value("brdrq/maximum", 5))
self.settingsDialog.spinBox_max_relevant_distance.setValue(self.maximum)
self.maximum = (
if self.max_rel_dist is None:
self.max_rel_dist = int(s.value("brdrq/max_rel_dist", 5))
self.settingsDialog.spinBox_max_relevant_distance.setValue(self.max_rel_dist)
self.max_rel_dist = (
self.settingsDialog.spinBox_max_relevant_distance.value()
)
self.maximum = self.max_rel_dist*100
self.relevant_distances = [
round(k, 1)
for k in np.arange(
Expand Down Expand Up @@ -288,6 +293,13 @@ def _update_settings(self):
self.settingsDialog.checkBox_full_parcel.checkState()
)

if self.formula is None:
self.formula = int(s.value("brdrq/formula", 0))
self.settingsDialog.checkBox_formula.setCheckState(self.formula)
self.formula = (
self.settingsDialog.checkBox_formula.checkState()
)

if self.partial_snapping is None:
self.partial_snapping = int(s.value("brdrq/partial_snapping", 0))
self.settingsDialog.checkBox_partial_snapping.setCheckState(self.partial_snapping)
Expand Down Expand Up @@ -320,7 +332,8 @@ def _update_settings(self):
s.setValue("brdrq/reference_choice", self.reference_choice)
s.setValue("brdrq/reference_id", self.reference_id)
s.setValue("brdrq/reference_layer", self.reference_layer)
s.setValue("brdrq/maximum", self.maximum)
s.setValue("brdrq/max_rel_dist", self.max_rel_dist)
s.setValue("brdrq/formula", self.formula)
s.setValue("brdrq/full_parcel", self.full_parcel)
s.setValue("brdrq/partial_snapping", self.partial_snapping)
s.setValue("brdrq/partial_snapping_strategy", self.partial_snapping_strategy.name)
Expand Down Expand Up @@ -386,6 +399,7 @@ def openDock(self):
# Create the dockwidget (after translation) and keep reference
self.dockwidget = brdrQDockWidget()


self.dockwidget.horizontalSlider.setMinimum(self.minimum)
self.dockwidget.horizontalSlider.setMaximum(self.maximum)
self.dockwidget.horizontalSlider.setSingleStep(self.step)
Expand Down Expand Up @@ -509,7 +523,8 @@ def _onFeatureChange(self, currentItem):
self._align()

fcs = self.aligner.get_results_as_geojson(
resulttype=AlignerResultType.PROCESSRESULTS
resulttype=AlignerResultType.PROCESSRESULTS,
formula=self.formula
)

geojson_to_layer(
Expand Down
50 changes: 41 additions & 9 deletions plugin/brdrq/brdrq_settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>523</width>
<height>465</height>
<height>562</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -186,7 +186,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>330</y>
<y>360</y>
<width>191</width>
<height>16</height>
</rect>
Expand All @@ -199,7 +199,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>370</y>
<y>400</y>
<width>191</width>
<height>16</height>
</rect>
Expand All @@ -212,7 +212,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>410</y>
<y>440</y>
<width>191</width>
<height>31</height>
</rect>
Expand All @@ -225,7 +225,7 @@
<property name="geometry">
<rect>
<x>200</x>
<y>410</y>
<y>440</y>
<width>201</width>
<height>22</height>
</rect>
Expand All @@ -244,7 +244,7 @@
<property name="geometry">
<rect>
<x>200</x>
<y>330</y>
<y>360</y>
<width>81</width>
<height>20</height>
</rect>
Expand All @@ -263,7 +263,7 @@
<property name="geometry">
<rect>
<x>200</x>
<y>370</y>
<y>400</y>
<width>201</width>
<height>21</height>
</rect>
Expand All @@ -273,7 +273,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>290</y>
<y>320</y>
<width>191</width>
<height>16</height>
</rect>
Expand All @@ -286,7 +286,7 @@
<property name="geometry">
<rect>
<x>200</x>
<y>290</y>
<y>320</y>
<width>81</width>
<height>20</height>
</rect>
Expand All @@ -301,6 +301,38 @@
<bool>false</bool>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_formula">
<property name="geometry">
<rect>
<x>200</x>
<y>280</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>10</x>
<y>280</y>
<width>191</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>brdr_formula toevoegen</string>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
Expand Down

0 comments on commit 0b92f41

Please sign in to comment.