Changeset 28699 in osm for applications/editors/josm/plugins/opendata
- Timestamp:
- 2012-09-08T20:52:36+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModule.java
r28696 r28699 120 120 @Override 121 121 public int compare(Relation o1, Relation o2) { 122 return o1.get("ref").compareTo(o2.get("ref")); 122 if (o1.hasKey("name") && o2.hasKey("name")) { 123 return o1.get("name").compareTo(o2.get("name")); 124 } else if (o1.hasKey("ref") && o2.hasKey("ref")) { 125 return o1.get("ref").compareTo(o2.get("ref")); 126 } else { 127 return o1.get("description").compareTo(o2.get("description")); 128 } 123 129 } 124 130 }); … … 138 144 if (data.allPrimitives().isEmpty()) { 139 145 for (final ToulouseDataSetHandler handler : new ToulouseDataSetHandler[]{ 140 new SecteursHandler(), new QuartiersHandler()}) {146 new CommuneHandler(), new SecteursHandler(), new QuartiersHandler()}) { 141 147 Main.worker.submit(new Runnable() { 142 148 @Override … … 159 165 } 160 166 167 public static final Collection<Relation> getMunicipalities() { 168 return getBoundaries(8); 169 } 170 161 171 public static final Collection<Relation> getSectors() { 162 172 return getBoundaries(10); -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/ToulouseDataSetHandler.java
r28696 r28699 92 92 setDataURL(url+"/resource/document"); 93 93 } 94 addTool(new SplitByMunicipality()); 94 95 addTool(new SplitBySector()); 95 96 addTool(new SplitByNeighbourhood()); … … 159 160 } 160 161 } 161 Main.main.addLayer(new OdDataLayer(data, baseName+"/"+boundary.get("ref"), null, ToulouseDataSetHandler.this)); 162 if (!data.allPrimitives().isEmpty()) { 163 String name = boundary.get("name"); 164 if (name == null || name.isEmpty()) { 165 name = boundary.get("ref"); 166 } 167 if (name == null || name.isEmpty()) { 168 name = boundary.get("description"); 169 } 170 Main.main.addLayer(new OdDataLayer(data, baseName+"/"+name, null, ToulouseDataSetHandler.this)); 171 } 162 172 } 163 173 } … … 189 199 } 190 200 201 protected class SplitByMunicipality extends SplitAction { 202 public SplitByMunicipality() { 203 super(marktr("Split by municipality"), tr("Split this data by municipality (admin_level=8).")); 204 } 205 @Override 206 protected Collection<Relation> getBoundaries() { 207 return ToulouseModule.getMunicipalities(); 208 } 209 } 210 191 211 protected class SplitBySector extends SplitAction { 192 212 public SplitBySector() {
Note:
See TracChangeset
for help on using the changeset viewer.