Skip to content

Commit 7d0afd5

Browse files
committed
Merge pull request #39 from clusterpy/consecutive_naming
Consecutive naming
2 parents 713c105 + 173010a commit 7d0afd5

7 files changed

Lines changed: 31 additions & 12 deletions

File tree

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,3 @@ transclean:
113113

114114
clean:
115115
rm $(UI_FILES) $(RESOURCE_FILES)
116-

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ a free and Open Source Geographic Information System.
2020
##Cite the plugin
2121
If you are interested in citing this plugin, you can use:
2222

23-
Duque, J.C.; Botero, Sergio (2014). Clusterpy QGIS plugin, Version 0.13-preview RiSE-group (Research in Spatial Economics). EAFIT University. http://www.rise-group.org.
23+
Duque, J.C.; Botero, Sergio (2014). Clusterpy QGIS plugin, Version 0.14-preview RiSE-group (Research in Spatial Economics). EAFIT University. http://www.rise-group.org.
2424

2525
Or this BibTeX entry:
2626
```
2727
@Manual{clusterpy-qgis-plugin,
2828
title = {Clusterpy QGIS plugin,
29-
{Version} 0.13-preview},
29+
{Version} 0.14-preview},
3030
author = {Duque, Juan C. and Botero, Sergio},
3131
organization = {RiSE-group (Research in Spatial Economics). EAFIT University.},
3232
address = {Colombia},

clusterpy_light.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,3 @@ def maxp(self):
7777
self.maxpdlg.layer_combo.clear()
7878
self.maxpdlg.layer_combo.addItems([x.name() for x in self.mc.layers()])
7979
self.maxpdlg.exec_()
80-

metadata.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name=Clusterpy - Spatially constrained clustering
55
qgisMinimumVersion=2.0
66
description=Clusterpy plugin version for QGIS
7-
version=0.13-preview
7+
version=0.14-preview
88
author=RISE Group Universidad EAFIT
99
email=software@rise-group.org
1010

@@ -14,11 +14,11 @@ email=software@rise-group.org
1414
# changelog=
1515

1616
# tags are comma separated with spaces allowed
17-
tags=Clusterpy,Clustering,RISE Group
17+
tags=Clusterpy,Clustering,RISE Group,cluster
1818

1919
homepage=http://www.rise-group.org
20-
tracker=https://www.github.com/clusterpy/clusterpy-qgis-plugin/issues
21-
repository=https://www.github.com/clusterpy/clusterpy-qgis-plugin
20+
tracker=https://www.github.com/clusterpy/clusterpy_qgis_plugin/issues
21+
repository=https://www.github.com/clusterpy/clusterpy_qgis_plugin
2222
icon=uifiles/icon.png
2323
experimental=False
2424

plugin_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ def saveDialog( parent, filtering="Shapefiles (*.shp *.SHP)"):
7373
files = fileDialog.selectedFiles()
7474
settings.setValue("/UI/lastShapefileDir", QFileInfo( unicode( files[0] ) ).absolutePath() )
7575
return ( unicode( files[0] ), unicode( fileDialog.encoding() ) )
76-

uifiles/about.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ <h2>Research in Spatial Economics</h2>
99
<h3>Cite the Plugin</h3>
1010
If you are interested in citing this plugin, you can use:
1111
<p>
12-
Duque, J.C.; Botero, Sergio (2014). Clusterpy QGIS plugin, Version 0.13-preview RiSE-group (Research in Spatial Economics). EAFIT University. http://www.rise-group.org.
12+
Duque, J.C.; Botero, Sergio (2014). Clusterpy QGIS plugin, Version 0.14-preview RiSE-group (Research in Spatial Economics). EAFIT University. http://www.rise-group.org.
1313
</p>
1414
Or this BibTeX entry:
1515
<pre><code>
1616
@Manual{clusterpy-qgis-plugin,
1717
title = {Clusterpy QGIS plugin,
18-
{Version} 0.13-preview},
18+
{Version} 0.14-preview},
1919
author = {Duque, Juan C. and Botero, Sergio},
2020
organization = {RiSE-group (Research in Spatial Economics). EAFIT University.},
2121
address = {Colombia},

workers.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# coding=utf-8
2+
# Clusterpy QGIS plugin - (C) 2014, RiSE Group
3+
14
from qgis.core import *
25
from PyQt4 import QtCore, QtGui
36

@@ -26,7 +29,9 @@ def __init__(self, info={}):
2629

2730
def run(self):
2831
provider = self.layer.dataProvider()
29-
maxpfield = QgsField(name = "MAXP", type = 2)
32+
curr = [ fl.name() for fl in provider.fields() ]
33+
nfn = newColumnName(curr)
34+
maxpfield = QgsField(name = nfn, type = 2)
3035
newfields = QgsFields()
3136
newfields.extend(provider.fields())
3237
newfields.append(maxpfield)
@@ -88,3 +93,20 @@ def run(self):
8893
outputmsg = self.ERROR_MSG + str(map(str, islands))
8994
self.progress.emit(100.0)
9095
self.finished.emit(valid, outputmsg)
96+
97+
# Get the name of the next MAXP execution column.
98+
def newColumnName(fields, basename = 'MAXP'):
99+
last = -1
100+
for fld in fields:
101+
if fld.startswith(basename):
102+
try:
103+
cnt = int(fld[len(basename):])
104+
last = cnt if cnt > last else last
105+
except ValueError:
106+
last = 0
107+
108+
num = ""
109+
if last >= 0:
110+
num = str(last + 1)
111+
112+
return basename + num

0 commit comments

Comments
 (0)