source: osm/applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java@ 28054

Last change on this file since 28054 was 28054, checked in by donvip, 13 years ago

opendata: various download improvements

File size: 2.9 KB
Line 
1// JOSM opendata plugin.
2// Copyright (C) 2011-2012 Don-vip
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport;
17
18import java.io.File;
19import java.net.MalformedURLException;
20import java.net.URL;
21
22import org.openstreetmap.josm.data.osm.DataSet;
23import org.openstreetmap.josm.data.osm.OsmPrimitive;
24import org.openstreetmap.josm.plugins.opendata.core.io.NeptuneReader;
25import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.ToulouseDataSetHandler;
26
27public class ReseauTisseoHandler extends ToulouseDataSetHandler {
28
29 private static final URL neptuneSchemaUrl = ReseauTisseoHandler.class.getResource(TOULOUSE_NEPTUNE_XSD);
30
31 public ReseauTisseoHandler() {
32 super(14022, "network=fr_tisseo");
33 NeptuneReader.registerSchema(neptuneSchemaUrl);
34 setName("Réseau Tisséo (Métro, Bus, Tram)");
35 setCategory(CAT_TRANSPORT);
36 setSkipXsdValidationInZipReading(true);
37 }
38
39 @Override
40 public boolean acceptsFilename(String filename) {
41 return acceptsZipFilename(filename, "14022-reseau-tisseo-metro-bus-tram-") || filename.toLowerCase().endsWith(XML_EXT);
42 }
43
44 /* (non-Javadoc)
45 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#acceptsFile(java.io.File)
46 */
47 @Override
48 public boolean acceptsFile(File file) {
49 return acceptsFilename(file.getName()) && (file.getName().toLowerCase().endsWith(ZIP_EXT) || NeptuneReader.acceptsXmlNeptuneFile(file, neptuneSchemaUrl));
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;
58 }
59
60 /* (non-Javadoc)
61 * @see org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.ToulouseDataSetHandler#getWikiURL()
62 */
63 @Override
64 public URL getWikiURL() {
65 try {
66 return new URL("http://wiki.openstreetmap.org/wiki/Toulouse/Transports_en_commun#Réseau_Tisséo");
67 } catch (MalformedURLException e) {
68 e.printStackTrace();
69 }
70 return null;
71 }
72
73 @Override
74 public void updateDataSet(DataSet ds) {
75 for (OsmPrimitive p : ds.allPrimitives()) {
76 p.put("operator", "Tisséo");
77 p.put("network", "fr_tisseo");
78 }
79 }
80}
Note: See TracBrowser for help on using the repository browser.