From 50158e028548d08ec6b333dc7c9d4d120c39a7ed Mon Sep 17 00:00:00 2001 From: dubravat Date: Fri, 28 Jul 2023 15:19:02 +0200 Subject: [PATCH] Proper naming for Chaikin's algorithm --- README.md | 8 ++++---- generalizerdialog.py | 26 +++++++++++++------------- metadata.txt | 4 ++-- smooth.py | 2 +- ui_generalizer.py | 28 ++++++++++++++-------------- ui_generalizer.ui | 10 +++++----- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 3ada28d..c19246c 100644 --- a/README.md +++ b/README.md @@ -21,17 +21,17 @@ Functions : ![Boyle's](https://grasswiki.osgeo.org/w/images/thumb/V.generalize.pic15.png/400px-V.generalize.pic15.png "Original line is black") - * Chaiken's Algorithm + * Chaikin's Algorithm - ![Chaiken's smooth](https://grass.osgeo.org/grass79/manuals/v_generalize_smooth.png "Original line is black") + ![Chaikin's smooth](https://grass.osgeo.org/grass79/manuals/v_generalize_smooth.png "Original line is black") - ![Chaiken's](https://grasswiki.osgeo.org/w/images/thumb/V.generalize.pic7.png/400px-V.generalize.pic7.png "Original is black") + ![Chaikin's](https://grasswiki.osgeo.org/w/images/thumb/V.generalize.pic7.png/400px-V.generalize.pic7.png "Original is black") * Hermite Spline Interpolation ![Hermite](https://grasswiki.osgeo.org/w/images/thumb/V.generalize.pic8.png/400px-V.generalize.pic8.png "Original is black") - ![Hermite and Chaiken](https://grasswiki.osgeo.org/w/images/thumb/V.generalize.pic9.png/400px-V.generalize.pic9.png "Original = black, Green = Chaiken, Blue = Hermite") + ![Hermite and Chaikin](https://grasswiki.osgeo.org/w/images/thumb/V.generalize.pic9.png/400px-V.generalize.pic9.png "Original = black, Green = Chaikin, Blue = Hermite") * McMaster's Distance-Weighting Algorithm diff --git a/generalizerdialog.py b/generalizerdialog.py index b3ad45d..8c042f7 100644 --- a/generalizerdialog.py +++ b/generalizerdialog.py @@ -44,7 +44,7 @@ 'lang':'Lang Algorithm', 'reduction':'Vertex Reduction', 'boyle':'Boyle\'s Forward-Looking Algorithm', - 'chaiken':'Chaiken\'s Algorithm', + 'chaikin':'Chaikin\'s Algorithm', 'hermite':'Hermite Spline Interpolation', 'distance':'McMaster\'s Distance-Weighting Algorithm', 'sliding':'McMaster\'s Sliding Averaging Algorithm', @@ -169,7 +169,7 @@ def doAddAlgorithm(self, index): par2.setValue(msg[0]) par2.setToolTip('Look ahead') - elif algName[0] == algorithm['chaiken']: #'Chaiken\'s Algorithm': + elif algName[0] == algorithm['chaikin']: #'Chaikin\'s Algorithm': par1 = QSpinBox() par1.setRange(0, 99) msg = QInputDialog.getInt(None, 'Generalizer', 'Level:', 1, 0, 99) @@ -375,8 +375,8 @@ def GetArguments(self, par1=-1, par2=-1): arguments['slide_LA'] = self.ui.sbSlide_LA.value() arguments['dist_slide'] = self.ui.sbDist_slide.value() arguments['dist_LA'] = self.ui.sbDist_LA.value() - arguments['chaiken_level'] = self.ui.sbChaiken_level.value() - arguments['chaiken_weight'] = self.ui.sbChaiken_weight.value() + arguments['chaikin_level'] = self.ui.sbChaikin_level.value() + arguments['chaikin_weight'] = self.ui.sbChaikin_weight.value() arguments['hermite_thresh'] = self.ui.sbHermite_steps.value() arguments['hermite_tightness'] = self.ui.sbHermite_tightness.value() arguments['jenks_thresh'] = self.ui.sbJenks_thresh.value() @@ -396,8 +396,8 @@ def GetArguments(self, par1=-1, par2=-1): arguments['slide_LA'] = par2 arguments['dist_slide'] = par1 arguments['dist_LA'] = par2 - arguments['chaiken_level'] = par1 - arguments['chaiken_weight'] = par2 + arguments['chaikin_level'] = par1 + arguments['chaikin_weight'] = par2 arguments['hermite_thresh'] = par1 arguments['hermite_tightness'] = par2 arguments['jenks_thresh'] = par1 @@ -422,8 +422,8 @@ def GetFunction(self, funcName): return self.sliding_averaging elif funcName == algorithm['distance']:#'McMaster\'s Distance-Weighting Algorithm': return self.distance_weighting - elif funcName == algorithm['chaiken']:#'Chaiken\'s Algorithm': - return self.chaiken + elif funcName == algorithm['chaikin']:#'Chaikin\'s Algorithm': + return self.chaikin elif funcName == algorithm['reduction']:#'Vertex Reduction': return self.vertex_reduction elif funcName == algorithm['DP']:#'Douglas-Peucker Algorithm': @@ -448,8 +448,8 @@ def NameFromFunc(self, func, arguments): return '-slide_slide-' + str(arguments['slide_slide']) + '_LA-' + str(arguments['slide_LA']) elif func == self.distance_weighting: return '-dist_slide-' + str(arguments['dist_slide']) + '_LA-' + str(arguments['dist_LA']) - elif func == self.chaiken: - return '-chaiken_level-' + str(arguments['chaiken_level']) + '_weight-' + str(arguments['chaiken_weight']) + elif func == self.chaikin: + return '-chaikin_level-' + str(arguments['chaikin_level']) + '_weight-' + str(arguments['chaikin_weight']) elif func == self.vertex_reduction: return '-reduction_thresh-' + str(arguments['reduction_thresh']) elif func == self.douglas_peucker: @@ -700,11 +700,11 @@ def distance_weighting(self,l, **kwargs): return p - def chaiken(self,l, **kwargs): - #Chaiken's Algorithm + def chaikin(self,l, **kwargs): + #Chaikin's Algorithm p = points.Vect_new_line_struct(l) #QInputDialog.getText( self.iface.mainWindow(), "m", "e", QLineEdit.Normal, str(p.n_points) ) - n = smooth.chaiken(p, kwargs['chaiken_level'], kwargs['chaiken_weight']) + n = smooth.chaikin(p, kwargs['chaikin_level'], kwargs['chaikin_weight']) return p diff --git a/metadata.txt b/metadata.txt index 8827fa8..affdb30 100644 --- a/metadata.txt +++ b/metadata.txt @@ -14,7 +14,7 @@ about=Plugin to Generalize, Simplify or Smooth lines in QGIS Vertex Reduction Smooth : Boyle's Forward-Looking Algorithm - Chaiken's Algorithm + Chaikin's Algorithm Hermite Spline Interpolation McMaster's Distance-Weighting Algorithm Distance Weighting @@ -71,4 +71,4 @@ changelog= -supported algorithms: generalization: Remove small objects simplifying: Douglas-Peucker, Lang, Vertex Reduction - smoothing: Boyle's Forward-Looking, Chaiken's, McMaster's Distance-Weighting, McMaster's Sliding Averaging + smoothing: Boyle's Forward-Looking, Chaikin's, McMaster's Distance-Weighting, McMaster's Sliding Averaging diff --git a/smooth.py b/smooth.py index ca8b7e2..a2bf7b4 100644 --- a/smooth.py +++ b/smooth.py @@ -168,7 +168,7 @@ def distance_weighting(points, slide, look_ahead): return points.n_points -def chaiken(points, level, weight): +def chaikin(points, level, weight): n = 0 i = 0 j = 0 diff --git a/ui_generalizer.py b/ui_generalizer.py index b88c781..7a3905e 100644 --- a/ui_generalizer.py +++ b/ui_generalizer.py @@ -208,19 +208,19 @@ def setupUi(self, generalizer): self.label_22 = QtWidgets.QLabel(self.page_16) self.label_22.setObjectName("label_22") self.gridLayout_16.addWidget(self.label_22, 0, 0, 1, 1) - self.sbChaiken_level = QtWidgets.QSpinBox(self.page_16) - self.sbChaiken_level.setMinimum(1) - self.sbChaiken_level.setMaximum(99) - self.sbChaiken_level.setObjectName("sbChaiken_level") - self.gridLayout_16.addWidget(self.sbChaiken_level, 0, 1, 1, 1) + self.sbChaikin_level = QtWidgets.QSpinBox(self.page_16) + self.sbChaikin_level.setMinimum(1) + self.sbChaikin_level.setMaximum(99) + self.sbChaikin_level.setObjectName("sbChaikin_level") + self.gridLayout_16.addWidget(self.sbChaikin_level, 0, 1, 1, 1) self.label_23 = QtWidgets.QLabel(self.page_16) self.label_23.setObjectName("label_23") self.gridLayout_16.addWidget(self.label_23, 1, 0, 1, 1) - self.sbChaiken_weight = QtWidgets.QDoubleSpinBox(self.page_16) - self.sbChaiken_weight.setMinimum(1.0) - self.sbChaiken_weight.setProperty("value", 3.0) - self.sbChaiken_weight.setObjectName("sbChaiken_weight") - self.gridLayout_16.addWidget(self.sbChaiken_weight, 1, 1, 1, 1) + self.sbChaikin_weight = QtWidgets.QDoubleSpinBox(self.page_16) + self.sbChaikin_weight.setMinimum(1.0) + self.sbChaikin_weight.setProperty("value", 3.0) + self.sbChaikin_weight.setObjectName("sbChaikin_weight") + self.gridLayout_16.addWidget(self.sbChaikin_weight, 1, 1, 1, 1) self.stackOptions.addWidget(self.page_16) self.page = QtWidgets.QWidget() self.page.setObjectName("page") @@ -400,9 +400,9 @@ def setupUi(self, generalizer): generalizer.setTabOrder(self.bCancel, self.sbLang_LA) generalizer.setTabOrder(self.sbLang_LA, self.sbReduction_thresh) generalizer.setTabOrder(self.sbReduction_thresh, self.sbBoyle_LA) - generalizer.setTabOrder(self.sbBoyle_LA, self.sbChaiken_level) - generalizer.setTabOrder(self.sbChaiken_level, self.sbChaiken_weight) - generalizer.setTabOrder(self.sbChaiken_weight, self.sbHermite_steps) + generalizer.setTabOrder(self.sbBoyle_LA, self.sbChaikin_level) + generalizer.setTabOrder(self.sbChaikin_level, self.sbChaikin_weight) + generalizer.setTabOrder(self.sbChaikin_weight, self.sbHermite_steps) generalizer.setTabOrder(self.sbHermite_steps, self.sbHermite_tightness) generalizer.setTabOrder(self.sbHermite_tightness, self.sbDist_slide) generalizer.setTabOrder(self.sbDist_slide, self.sbDist_LA) @@ -440,7 +440,7 @@ def retranslateUi(self, generalizer): self.cbAlgorithm.setItemText(7, _translate("generalizer", "Vertex Reduction")) self.cbAlgorithm.setItemText(8, _translate("generalizer", "-----Smoothing-----")) self.cbAlgorithm.setItemText(9, _translate("generalizer", "Boyle\'s Forward-Looking Algorithm")) - self.cbAlgorithm.setItemText(10, _translate("generalizer", "Chaiken\'s Algorithm")) + self.cbAlgorithm.setItemText(10, _translate("generalizer", "Chaikin\'s Algorithm")) self.cbAlgorithm.setItemText(11, _translate("generalizer", "Hermite Spline Interpolation")) self.cbAlgorithm.setItemText(12, _translate("generalizer", "McMaster\'s Distance-Weighting Algorithm")) self.cbAlgorithm.setItemText(13, _translate("generalizer", "McMaster\'s Sliding Averaging Algorithm")) diff --git a/ui_generalizer.ui b/ui_generalizer.ui index 06189d1..cae4ce4 100644 --- a/ui_generalizer.ui +++ b/ui_generalizer.ui @@ -153,7 +153,7 @@ - Chaiken's Algorithm + Chaikin's Algorithm @@ -410,7 +410,7 @@ - + 1 @@ -427,7 +427,7 @@ - + 1.000000000000000 @@ -748,8 +748,8 @@ sbLang_LA sbReduction_thresh sbBoyle_LA - sbChaiken_level - sbChaiken_weight + sbChaikin_level + sbChaikin_weight sbHermite_steps sbHermite_tightness sbDist_slide