Changeset 28022 in osm for applications/editors
- Timestamp:
- 2012-03-09T22:06:09+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/opendata
- Files:
-
- 1 added
- 1 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseConstants.java
r28018 r28022 21 21 22 22 /** 23 * Source 23 * Sources 24 24 */ 25 public static final String SOURCE = "GrandToulouse"; 25 public static final String SOURCE_GRAND_TOULOUSE = "GrandToulouse"; 26 public static final String SOURCE_TISSEO = "Tisséo SMTC"; 26 27 27 28 /** -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModule.java
r28018 r28022 47 47 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.PistesCyclablesHandler; 48 48 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.ReseauTisseoHandler; 49 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.TisseoHandler;50 49 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.TramwayStationHandler; 51 50 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.VeloToulouseHandler; … … 96 95 handlers.add(new EquipementCulturelBalmaHandler()); 97 96 handlers.add(new InstallationSportiveBalmaHandler()); 98 handlers.add(new TisseoHandler());99 97 } 100 98 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/ToulouseDataSetHandler.java
r28000 r28022 54 54 @Override 55 55 public String getSource() { 56 return SOURCE ;56 return SOURCE_GRAND_TOULOUSE; 57 57 } 58 58 … … 85 85 86 86 /* (non-Javadoc) 87 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#getLicenseURL() 88 */ 89 @Override 90 public URL getLicenseURL() { 91 try { 92 return new URL(getLocalPortalURL().toString()+"/license"); 93 } catch (MalformedURLException e) { 94 e.printStackTrace(); 95 } 96 return null; 97 } 98 99 /* (non-Javadoc) 87 100 * @see org.openstreetmap.josm.plugins.fr.opendata.datasets.AbstractDataSetHandler#getWikiURL() 88 101 */ -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java
r28000 r28022 16 16 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport; 17 17 18 import java.io.File; 19 import java.net.URL; 20 18 21 import org.openstreetmap.josm.data.osm.DataSet; 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 23 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.ToulouseDataSetHandler; 20 24 … … 27 31 @Override 28 32 public boolean acceptsFilename(String filename) { 29 return acceptsZipFilename(filename, "14022-reseau-tisseo-metro-bus-tram-"); 33 return acceptsZipFilename(filename, "14022-reseau-tisseo-metro-bus-tram-") || filename.toLowerCase().endsWith(XML_EXT); 34 } 35 36 /* (non-Javadoc) 37 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#acceptsFile(java.io.File) 38 */ 39 @Override 40 public boolean acceptsFile(File file) { 41 return acceptsFilename(file.getName()) && (file.getName().toLowerCase().endsWith(ZIP_EXT) || acceptsXmlNeptuneFile(file)); 42 } 43 44 /* (non-Javadoc) 45 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchDataSetHandler#getNeptuneSchema() 46 */ 47 @Override 48 protected URL getNeptuneSchema() { 49 return ReseauTisseoHandler.class.getResource(TOULOUSE_NEPTUNE_XSD); 50 } 51 52 /* (non-Javadoc) 53 * @see org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.ToulouseDataSetHandler#getSource() 54 */ 55 @Override 56 public String getSource() { 57 return SOURCE_TISSEO; 30 58 } 31 59 32 60 @Override 33 61 public void updateDataSet(DataSet ds) { 34 // TODO Auto-generated method stub 35 62 for (OsmPrimitive p : ds.allPrimitives()) { 63 p.put("operator", "Tisséo"); 64 p.put("network", "fr_tisseo"); 65 } 36 66 } 37 67 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/OdConstants.java
r28018 r28022 84 84 public static final String ICON_OSM_24 = "osm24.png"; 85 85 86 public static final String ICON_AGREEMENT_24 = "agreement24.png"; 87 86 88 /** 87 89 * File extensions. -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/actions/OpenLinkAction.java
r28000 r28022 22 22 import java.net.URLEncoder; 23 23 24 import javax.swing.Action; 25 24 26 import org.openstreetmap.josm.actions.JosmAction; 25 27 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 28 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 26 29 import org.openstreetmap.josm.tools.OpenBrowser; 27 30 … … 32 35 33 36 public OpenLinkAction(URL url, String icon24Name, String title, String description) { 34 super(title, icon24Name, description, null, false); 37 super(title, null, description, null, false); 38 putValue(Action.SMALL_ICON, OdUtils.getImageIcon(icon24Name)); 35 39 this.url = url; 36 40 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/AbstractDataSetHandler.java
r28018 r28022 172 172 public abstract URL getLocalPortalURL(); 173 173 public abstract URL getNationalPortalURL(); 174 175 public URL getLicenseURL() {return null;} 174 176 175 177 public final Collection<String> getOsmXapiRequests(Bounds bounds) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/datasets/fr/FrenchDataSetHandler.java
r28018 r28022 288 288 } 289 289 290 p rotectedfinal boolean acceptsXmlNeptuneFile(File file) {290 public final boolean acceptsXmlNeptuneFile(File file) { 291 291 292 292 Source xmlFile = new StreamSource(file); -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/NeptuneReader.java
r28021 r28022 17 17 18 18 import java.io.InputStream; 19 import java.util.HashMap; 20 import java.util.List; 21 import java.util.Map; 19 22 20 23 import javax.xml.bind.JAXBContext; … … 23 26 import javax.xml.bind.Unmarshaller; 24 27 28 import neptune.ChouetteAreaType; 25 29 import neptune.ChouettePTNetworkType; 26 30 import neptune.ChouettePTNetworkType.ChouetteArea.AreaCentroid; 31 import neptune.ChouettePTNetworkType.ChouetteArea.StopArea; 32 import neptune.ChouettePTNetworkType.ChouetteLineDescription.ChouetteRoute; 33 import neptune.ChouettePTNetworkType.ChouetteLineDescription.StopPoint; 34 import neptune.LineType; 35 import neptune.LongLatTypeType; 36 import neptune.PTLinkType; 37 import neptune.PTNetworkType; 38 import neptune.PointType; 39 import neptune.StopAreaType; 40 import neptune.StopPointType; 41 import neptune.TridentObjectType; 42 43 import org.openstreetmap.josm.data.coor.LatLon; 27 44 import org.openstreetmap.josm.data.osm.DataSet; 45 import org.openstreetmap.josm.data.osm.Node; 46 import org.openstreetmap.josm.data.osm.OsmPrimitive; 47 import org.openstreetmap.josm.data.osm.Relation; 48 import org.openstreetmap.josm.data.osm.RelationMember; 28 49 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 29 50 import org.openstreetmap.josm.io.AbstractReader; 30 51 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 31 52 53 /** 54 * NEPTUNE -> OSM converter 55 * See http://www.chouette.mobi/IMG/pdf/NF__F_-Neptune-maj.pdf 56 */ 32 57 public class NeptuneReader extends AbstractReader { 33 58 59 public static final String OSM_PUBLIC_TRANSPORT = "public_transport"; 60 public static final String OSM_STOP = "stop"; 61 public static final String OSM_STOP_AREA = "stop_area"; 62 public static final String OSM_STOP_POSITION = "stop_position"; 63 public static final String OSM_PLATFORM = "platform"; 64 public static final String OSM_STATION = "station"; 65 public static final String OSM_NETWORK = "network"; 66 public static final String OSM_ROUTE = "route"; 67 public static final String OSM_ROUTE_MASTER = "route_master"; 68 69 public static final String OSM_TRAIN = "train"; 70 public static final String OSM_SUBWAY = "subway"; 71 public static final String OSM_MONORAIL = "monorail"; 72 public static final String OSM_TRAM = "tram"; 73 public static final String OSM_BUS = "bus"; 74 public static final String OSM_TROLLEYBUS = "trolleybus"; 75 public static final String OSM_AERIALWAY = "aerialway"; 76 public static final String OSM_FERRY = "ferry"; 77 78 private ChouettePTNetworkType root; 79 80 private final Map<String, OsmPrimitive> tridentObjects = new HashMap<String, OsmPrimitive>(); 81 34 82 public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance) throws JAXBException { 35 83 return new NeptuneReader().parse(in, instance); 36 37 84 } 38 85 … … 44 91 return doc.getValue(); 45 92 } 93 94 private final void linkTridentObjectToOsmPrimitive(TridentObjectType object, OsmPrimitive p) { 95 p.put("ref:neptune", object.getObjectId()); 96 if (tridentObjects.put(object.getObjectId(), p) != null) { 97 System.err.println("Trident object duplicated !!! : "+object.getObjectId()); 98 } 99 } 100 101 protected Node createNode(LatLon latlon){ 102 Node n = new Node(latlon); 103 ds.addPrimitive(n); 104 return n; 105 } 106 107 private Node createStopPosition(StopPointType stop) { 108 Node n = createNode(createLatLon(stop)); 109 n.put(OSM_PUBLIC_TRANSPORT, OSM_STOP_POSITION); 110 linkTridentObjectToOsmPrimitive(stop, n); 111 n.put("name", stop.getName()); 112 return n; 113 } 114 115 protected Relation createRelation(String type){ 116 Relation r = new Relation(); 117 r.put("type", type); 118 ds.addPrimitive(r); 119 return r; 120 } 121 122 protected Relation createPtRelation(String pt, TridentObjectType object){ 123 Relation r = createRelation(OSM_PUBLIC_TRANSPORT); 124 r.put(OSM_PUBLIC_TRANSPORT, pt); 125 linkTridentObjectToOsmPrimitive(object, r); 126 return r; 127 } 128 129 protected Relation createNetwork(PTNetworkType network) { 130 Relation r = createRelation(OSM_NETWORK); 131 linkTridentObjectToOsmPrimitive(network, r); 132 r.put("name", network.getName()); 133 return r; 134 } 135 136 protected Relation createRouteMaster(LineType line) { 137 Relation r = createPtRelation(OSM_ROUTE_MASTER, line); 138 switch (line.getTransportModeName()) { 139 case BUS: 140 r.put(OSM_ROUTE_MASTER, OSM_BUS); break; 141 case AIR: 142 r.put(OSM_ROUTE_MASTER, OSM_AERIALWAY); break; 143 case FERRY: 144 r.put(OSM_ROUTE_MASTER, OSM_FERRY); break; 145 case METRO: 146 r.put(OSM_ROUTE_MASTER, OSM_SUBWAY); break; 147 case TRAIN: 148 r.put(OSM_ROUTE_MASTER, OSM_TRAIN); break; 149 case TRAMWAY: 150 r.put(OSM_ROUTE_MASTER, OSM_TRAM); break; 151 case TROLLEYBUS: 152 r.put(OSM_ROUTE_MASTER, OSM_TROLLEYBUS); break; 153 default: 154 System.err.println("Unsupported transport mode: "+line.getTransportModeName()); 155 } 156 r.put("ref", line.getNumber()); 157 r.put("name", line.getTransportModeName().value()+" "+line.getNumber()+": "+line.getName()); 158 return r; 159 } 160 161 private Relation createRoute(ChouetteRoute route) { 162 Relation r = createPtRelation(OSM_ROUTE, route); 163 r.put("name", route.getName()); 164 return r; 165 } 166 167 protected Relation createStopArea(StopAreaType sa) { 168 Relation r = createPtRelation(OSM_STOP_AREA, sa); 169 r.put("name", sa.getName()); 170 return r; 171 } 172 173 protected LatLon createLatLon(PointType point) { 174 return new LatLon(point.getLatitude().doubleValue(), point.getLongitude().doubleValue()); 175 } 176 177 protected final <T extends TridentObjectType> T findTridentObject(List<T> list, String id) { 178 for (T object : list) { 179 if (object.getObjectId().equals(id)) { 180 return object; 181 } 182 } 183 return null; 184 } 185 186 protected StopPoint findStopPoint(String id) { 187 return findTridentObject(root.getChouetteLineDescription().getStopPoint(), id); 188 } 189 190 protected StopArea findStopArea(String id) { 191 return findTridentObject(root.getChouetteArea().getStopArea(), id); 192 } 193 194 protected AreaCentroid findAreaCentroid(String id) { 195 return findTridentObject(root.getChouetteArea().getAreaCentroid(), id); 196 } 197 198 protected PTLinkType findPtLink(String id) { 199 return findTridentObject(root.getChouetteLineDescription().getPtLink(), id); 200 } 201 202 protected static final boolean isNullLatLon(LatLon ll) { 203 return ll.lat() == 0.0 && ll.lon() == 0.0; 204 } 46 205 47 206 private DataSet parse(InputStream in, ProgressMonitor instance) throws JAXBException { 48 ChouettePTNetworkType root = unmarshal(ChouettePTNetworkType.class, in); 49 50 System.out.println(root); 51 52 // TODO 207 root = unmarshal(ChouettePTNetworkType.class, in); 208 209 Relation network = createNetwork(root.getPTNetwork()); 210 211 // Parsing Stop areas 212 for (StopArea sa : root.getChouetteArea().getStopArea()) { 213 if (sa.getStopAreaExtension().getAreaType().equals(ChouetteAreaType.COMMERCIAL_STOP_POINT)) { 214 Relation stopArea = createStopArea(sa); 215 stopArea.put("name", sa.getName()); 216 for (String childId : sa.getContains()) { 217 if (childId.contains("StopArea")) { 218 StopArea child = findStopArea(childId); 219 if (child == null) { 220 System.err.println("Cannot find StopArea: "+childId); 221 } else { 222 if (child.getStopAreaExtension().getAreaType().equals(ChouetteAreaType.BOARDING_POSITION)) { 223 for (String grandchildId : child.getContains()) { 224 if (grandchildId.contains("StopPoint")) { 225 // TODO 226 StopPoint grandchild = findStopPoint(grandchildId); 227 if (grandchild == null) { 228 System.err.println("Cannot find StopPoint: "+grandchildId); 229 } else { 230 if (grandchild.getLongLatType().equals(LongLatTypeType.WGS_84)) { 231 Node stop = createStopPosition(grandchild); 232 stopArea.addMember(new RelationMember(OSM_STOP, stop)); 233 } else { 234 System.err.println("Unsupported long/lat type: "+grandchild.getLongLatType()); 235 } 236 } 237 } else { 238 System.err.println("Unsupported grandchild: "+grandchildId); 239 } 240 } 241 String centroidId = child.getCentroidOfArea(); 242 AreaCentroid areaCentroid = findAreaCentroid(centroidId); 243 if (areaCentroid == null) { 244 System.err.println("Cannot find AreaCentroid: "+centroidId); 245 } else if (!areaCentroid.getLongLatType().equals(LongLatTypeType.WGS_84)) { 246 System.err.println("Unsupported long/lat type: "+areaCentroid.getLongLatType()); 247 } else { 248 for (RelationMember member : stopArea.getMembers()) { 249 // Fix stop coordinates if needed 250 if (member.getRole().equals(OSM_STOP) && isNullLatLon(member.getNode().getCoor())) { 251 member.getNode().setCoor(createLatLon(areaCentroid)); 252 } 253 } 254 } 255 } else { 256 System.err.println("Unsupported child type: "+child.getStopAreaExtension().getAreaType()); 257 } 258 } 259 260 } else if (childId.contains("StopPoint")) { 261 StopPoint child = findStopPoint(childId); 262 if (child == null) { 263 System.err.println("Cannot find StopPoint: "+childId); 264 } else { 265 // TODO 266 System.out.println("TODO: handle StopPoint "+childId); 267 } 268 269 } else { 270 System.err.println("Unsupported child: "+childId); 271 } 272 } 273 } else if (sa.getStopAreaExtension().getAreaType().equals(ChouetteAreaType.BOARDING_POSITION)) { 274 //System.out.println("skipping StopArea with type "+sa.getStopAreaExtension().getAreaType()+": "+sa.getObjectId()); 275 } else { 276 System.err.println("Unsupported StopArea type: "+sa.getStopAreaExtension().getAreaType()); 277 } 278 } 279 280 Relation routeMaster = createRouteMaster(root.getChouetteLineDescription().getLine()); 281 network.addMember(new RelationMember(null, routeMaster)); 282 283 for (ChouetteRoute cr : root.getChouetteLineDescription().getChouetteRoute()) { 284 Relation route = createRoute(cr); 285 routeMaster.addMember(new RelationMember(null, route)); 286 for (String id : cr.getPtLinkId()) { 287 PTLinkType ptlink = findPtLink(id); 288 if (ptlink == null) { 289 System.err.println("Cannot find PTLinkType: "+id); 290 } else { 291 /*StopPoint start = findStopPoint(ptlink.getStartOfLink()); 292 StopPoint end = findStopPoint(ptlink.getEndOfLink());*/ 293 OsmPrimitive start = tridentObjects.get(ptlink.getStartOfLink()); 294 OsmPrimitive end = tridentObjects.get(ptlink.getEndOfLink()); 295 if (start == null) { 296 System.err.println("Cannot find start StopPoint: "+ptlink.getStartOfLink()); 297 } else { 298 addStopToRoute(route, start); 299 } 300 301 if (end == null) { 302 System.err.println("Cannot find end StopPoint: "+ptlink.getEndOfLink()); 303 } else { 304 addStopToRoute(route, end); 305 } 306 } 307 } 308 } 53 309 54 310 return ds; 55 311 } 312 313 private static final boolean addStopToRoute(Relation route, OsmPrimitive stop) { 314 if (route.getMembersCount() == 0 || !route.getMember(route.getMembersCount()-1).getMember().equals(stop) ) { 315 route.addMember(new RelationMember(OSM_STOP, stop)); 316 return true; 317 } else { 318 return false; 319 } 320 } 56 321 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/archive/ZipReader.java
r28000 r28022 26 26 import java.util.zip.ZipInputStream; 27 27 28 import javax.xml.bind.JAXBException; 28 29 import javax.xml.stream.FactoryConfigurationError; 29 30 import javax.xml.stream.XMLStreamException; … … 34 35 import org.openstreetmap.josm.plugins.opendata.core.OdConstants; 35 36 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 37 import org.openstreetmap.josm.plugins.opendata.core.datasets.fr.FrenchDataSetHandler; 38 import org.openstreetmap.josm.plugins.opendata.core.io.NeptuneReader; 36 39 import org.openstreetmap.josm.plugins.opendata.core.io.geographic.KmlReader; 37 40 import org.openstreetmap.josm.plugins.opendata.core.io.geographic.KmzReader; … … 53 56 } 54 57 55 public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, XMLStreamException, FactoryConfigurationError {58 public static DataSet parseDataSet(InputStream in, AbstractDataSetHandler handler, ProgressMonitor instance) throws IOException, XMLStreamException, FactoryConfigurationError, JAXBException { 56 59 return new ZipReader(new ZipInputStream(in), handler).parseDoc(instance); 57 60 } … … 60 63 final File temp = File.createTempFile("josm_opendata_temp_", Long.toString(System.nanoTime())); 61 64 62 if (!temp.delete()) {65 if (!temp.delete()) { 63 66 throw new IOException("Could not delete temp file: " + temp.getAbsolutePath()); 64 67 } … … 78 81 } 79 82 80 private DataSet parseDoc(ProgressMonitor instance) throws IOException, XMLStreamException, FactoryConfigurationError {83 private DataSet parseDoc(ProgressMonitor instance) throws IOException, XMLStreamException, FactoryConfigurationError, JAXBException { 81 84 82 85 final File temp = createTempDir(); … … 87 90 while ((entry = zis.getNextEntry()) != null) { 88 91 File file = new File(temp + File.separator + entry.getName()); 92 if (file.exists() && !file.delete()) { 93 throw new IOException("Could not delete temp file: " + file.getAbsolutePath()); 94 } 89 95 if (!file.createNewFile()) { 90 96 throw new IOException("Could not create temp file: " + file.getAbsolutePath()); … … 98 104 fos.close(); 99 105 for (String ext : new String[] { 100 CSV_EXT, KML_EXT, KMZ_EXT, XLS_EXT, ODS_EXT, SHP_EXT, MIF_EXT, TAB_EXT 106 CSV_EXT, KML_EXT, KMZ_EXT, XLS_EXT, ODS_EXT, SHP_EXT, MIF_EXT, TAB_EXT, XML_EXT 101 107 }) { 102 108 if (entry.getName().toLowerCase().endsWith("."+ext)) { … … 139 145 } else if (file.getName().toLowerCase().endsWith(TAB_EXT)) { 140 146 from = TabReader.parseDataSet(in, file, handler, instance); 147 } else if (file.getName().toLowerCase().endsWith(XML_EXT)) { 148 if (handler instanceof FrenchDataSetHandler && ((FrenchDataSetHandler)handler).acceptsXmlNeptuneFile(file)) { 149 from = NeptuneReader.parseDataSet(in, handler, instance); 150 } else { 151 System.err.println("Unsupported XML file: "+file.getName()); 152 } 153 154 } else { 155 System.err.println("Unsupported file extension: "+file.getName()); 141 156 } 142 157 if (from != null) { -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/layers/OdDataLayer.java
r28017 r28022 38 38 import org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler; 39 39 import org.openstreetmap.josm.plugins.opendata.core.io.OsmDownloader; 40 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleHandler; 41 import org.openstreetmap.josm.tools.ImageProvider; 40 import org.openstreetmap.josm.plugins.opendata.core.util.OdUtils; 42 41 43 42 public class OdDataLayer extends OsmDataLayer implements OdConstants, OdLayer, LayerChangeListener { … … 65 64 66 65 @Override public Icon getBaseIcon() { 67 return new ImageProvider(handler != null ? handler.getDataLayerIconName() : ICON_CORE_16).setAdditionalClassLoaders(ModuleHandler.getResourceClassLoaders()).get();66 return OdUtils.getImageIcon(handler != null ? handler.getDataLayerIconName() : ICON_CORE_16); 68 67 } 69 68 … … 156 155 tr("View National Portal page"), tr("Launch browser to the national portal page of the selected data set"))); 157 156 } 157 if (this.handler.getLicenseURL() != null) { 158 if (this.handler.getLicenseURL().getProtocol().startsWith("http")) { 159 result.add(new OpenLinkAction(this.handler.getLicenseURL(), ICON_AGREEMENT_24, 160 tr("View License"), tr("Launch browser to the license page of the selected data set"))); 161 } else { 162 // TODO: view embedded licenses 163 } 164 } 158 165 return result.toArray(new Action[0]); 159 166 } -
applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/util/OdUtils.java
r28000 r28022 19 19 import java.util.List; 20 20 21 import javax.swing.ImageIcon; 22 21 23 import org.apache.commons.lang3.StringUtils; 22 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 25 import org.openstreetmap.josm.data.osm.Relation; 26 import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleHandler; 27 import org.openstreetmap.josm.tools.ImageProvider; 24 28 25 29 public abstract class OdUtils { … … 50 54 return result.toArray(new String[0]); 51 55 } 56 57 public static final ImageIcon getImageIcon(String iconName) { 58 return new ImageProvider(iconName).setAdditionalClassLoaders(ModuleHandler.getResourceClassLoaders()).get(); 59 } 52 60 }
Note:
See TracChangeset
for help on using the changeset viewer.