Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper naming for Chaikin's algorithm #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 13 additions & 13 deletions generalizerdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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':
Expand All @@ -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:
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion smooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 14 additions & 14 deletions ui_generalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"))
Expand Down
10 changes: 5 additions & 5 deletions ui_generalizer.ui
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
</item>
<item>
<property name="text">
<string>Chaiken's Algorithm</string>
<string>Chaikin's Algorithm</string>
</property>
</item>
<item>
Expand Down Expand Up @@ -410,7 +410,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="sbChaiken_level">
<widget class="QSpinBox" name="sbChaikin_level">
<property name="minimum">
<number>1</number>
</property>
Expand All @@ -427,7 +427,7 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="sbChaiken_weight">
<widget class="QDoubleSpinBox" name="sbChaikin_weight">
<property name="minimum">
<double>1.000000000000000</double>
</property>
Expand Down Expand Up @@ -748,8 +748,8 @@
<tabstop>sbLang_LA</tabstop>
<tabstop>sbReduction_thresh</tabstop>
<tabstop>sbBoyle_LA</tabstop>
<tabstop>sbChaiken_level</tabstop>
<tabstop>sbChaiken_weight</tabstop>
<tabstop>sbChaikin_level</tabstop>
<tabstop>sbChaikin_weight</tabstop>
<tabstop>sbHermite_steps</tabstop>
<tabstop>sbHermite_tightness</tabstop>
<tabstop>sbDist_slide</tabstop>
Expand Down