Changeset 21191 in osm for applications/editors/josm/plugins/cadastre-fr
- Timestamp:
- 2010-05-09T02:00:54+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CacheControl.java
r20931 r21191 73 73 74 74 private void checkDirSize(File path) { 75 long size = 0; 76 long oldestFileDate = Long.MAX_VALUE; 77 int oldestFile = 0; 78 File[] files = path.listFiles(); 79 for (int i = 0; i < files.length; i++) { 80 size += files[i].length(); 81 if (files[i].lastModified() < oldestFileDate) { 82 oldestFile = i; 83 oldestFileDate = files[i].lastModified(); 84 } 85 } 86 if (size > cacheSize*1024*1024) { 87 System.out.println("Delete oldest file \""+ files[oldestFile].getName() 88 + "\" in cache dir to stay under the limit of " + cacheSize + " MB."); 89 files[oldestFile].delete(); 90 checkDirSize(path); 75 if (cacheSize != 0) { 76 long size = 0; 77 long oldestFileDate = Long.MAX_VALUE; 78 int oldestFile = 0; 79 File[] files = path.listFiles(); 80 for (int i = 0; i < files.length; i++) { 81 size += files[i].length(); 82 if (files[i].lastModified() < oldestFileDate) { 83 oldestFile = i; 84 oldestFileDate = files[i].lastModified(); 85 } 86 } 87 if (size > (long)cacheSize*1024*1024) { 88 System.out.println("Delete oldest file \""+ files[oldestFile].getName() 89 + "\" in cache dir to stay under the limit of " + cacheSize + " MB."); 90 files[oldestFile].delete(); 91 checkDirSize(path); 92 } 91 93 } 92 94 } -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
r20765 r21191 258 258 } 259 259 content += "&codeDepartement="; 260 content += wmsLayer.getDepartement(); 260 261 content += "&nbResultatParPage=10"; 261 262 content += "&x=0&y=0"; -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePlugin.java
r20825 r21191 113 113 * - last deployment for Java1.5 compatibility 114 114 * 2.0 xx-xxx-xxxx - update projection for "La Reunion" departement to RGR92, UTM40S. 115 * - add 'departement' as option in the municipality selection 116 * - fixed bug in cache directory size control (and disabled by default) 115 117 */ 116 118 public class CadastrePlugin extends Plugin { -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastrePreferenceSetting.java
r20659 r21191 57 57 private JRadioButton crosspiece4 = new JRadioButton("100m"); 58 58 59 private JCheckBox autoFirstLayer = new JCheckBox(tr(" Automaticly select first WMS layerwhen grabing if multiple layers exist."));59 private JCheckBox autoFirstLayer = new JCheckBox(tr("Select first WMS layer in list.")); 60 60 61 61 private JRadioButton grabRes1 = new JRadioButton("high"); … … 80 80 private JCheckBox enableCache = new JCheckBox(tr("Enable automatic caching.")); 81 81 82 static final int DEFAULT_CACHE_SIZE = 500;82 static final int DEFAULT_CACHE_SIZE = 0; // disabled by default 83 83 JLabel jLabelCacheSize = new JLabel(tr("Max. cache size (in MB)")); 84 84 private JTextField cacheSize = new JTextField(20); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionNewLocation.java
r20824 r21191 8 8 import java.util.ArrayList; 9 9 10 import javax.swing.JComboBox; 10 11 import javax.swing.JLabel; 11 12 import javax.swing.JOptionPane; … … 24 25 25 26 private static final long serialVersionUID = 1L; 27 28 private static final String departements[] = { 29 "", tr("(optional)"), 30 "001", "01 - Ain", "002", "02 - Aisne", "003", "03 - Allier", "004", "04 - Alpes de Haute-Provence", "005", "05 - Hautes-Alpes", 31 "006", "06 - Alpes-Maritimes", "007", "07 - Ard\u00eache", "008", "08 - Ardennes", "009", "09 - Ari\u00e8ge", "010", "10 - Aube", 32 "011", "11 - Aude", "012", "12 - Aveyron", "013", "13 - Bouches-du-Rh\u00f4ne", "014", "14 - Calvados", "015", "15 - Cantal", 33 "016", "16 - Charente", "017", "17 - Charente-Maritime", "018", "18 - Cher", "019", "19 - Corr\u00e8ze", 34 "02A", "2A - Corse-du-Sud", "02B", "2B - Haute-Corse", 35 "021", "21 - C\u00f4te-d'Or", "022", "22 - C\u00f4tes d'Armor", "023", "23 - Creuse", "024", "24 - Dordogne", "025", "25 - Doubs", 36 "026", "26 - Dr\u00f4me", "027", "27 - Eure", "028", "28 - Eure-et-Loir", "029", "29 - Finist\u00e8re", "030", "30 - Gard", 37 "031", "31 - Haute-Garonne", "032", "32 - Gers", "033", "33 - Gironde", "034", "34 - H\u00e9rault", "035", "35 - Ille-et-Vilaine", 38 "036", "36 - Indre", "037", "37 - Indre-et-Loire", "038", "38 - Is\u00e8re", "039", "39 - Jura", "040", "40 - Landes", 39 "041", "41 - Loir-et-Cher", "042", "42 - Loire", "043", "43 - Haute-Loire", "044", "44 - Loire-Atlantique", "045", "45 - Loiret", 40 "046", "46 - Lot", "047", "47 - Lot-et-Garonne", "048", "48 - Loz\u00e8re", "049", "49 - Maine-et-Loire", "050", "50 - Manche", 41 "051", "51 - Marne", "052", "52 - Haute-Marne", "053", "53 - Mayenne", "054", "54 - Meurthe-et-Moselle", "055", "55 - Meuse", 42 "056", "56 - Morbihan", "057", "57 - Moselle", "058", "58 - Ni\u00e8vre", "059", "59 - Nord", "060", "60 - Oise", 43 "061", "61 - Orne", "062", "62 - Pas-de-Calais", "063", "63 - Puy-de-D\u00f4me", "064", "64 - Pyr\u00e9n\u00e9es-Atlantiques", "065", "65 - Hautes-Pyr\u00e9n\u00e9es", 44 "066", "66 - Pyr\u00e9n\u00e9es-Orientales", "067", "67 - Bas-Rhin", "068", "68 - Haut-Rhin", "069", "69 - Rh\u00f4ne", "070", "70 - Haute-Sa\u00f4ne", 45 "071", "71 - Sa\u00f4ne-et-Loire", "072", "72 - Sarthe", "073", "73 - Savoie", "074", "74 - Haute-Savoie", "075", "75 - Paris", 46 "076", "76 - Seine-Maritime", "077", "77 - Seine-et-Marne", "078", "78 - Yvelines", "079", "79 - Deux-S\u00e8vres", "080", "80 - Somme", 47 "081", "81 - Tarn", "082", "82 - Tarn-et-Garonne", "083", "83 - Var", "084", "84 - Vaucluse", "085", "85 - Vend\u00e9e", 48 "086", "86 - Vienne", "087", "87 - Haute-Vienne", "088", "88 - Vosges", "089", "89 - Yonne", "090", "90 - Territoire de Belfort", 49 "091", "91 - Essonne", "092", "92 - Hauts-de-Seine", "093", "93 - Seine-Saint-Denis", "094", "94 - Val-de-Marne", "095", "95 - Val-d'Oise", 50 "971", "971 - Guadeloupe", "972", "972 - Martinique", "973", "973 - Guyane", "974", "974 - R\u00e9union" 51 }; 26 52 27 53 public MenuActionNewLocation() { … … 46 72 inputTown.setToolTipText(tr("<html>Enter the town,village or city name.<br>" 47 73 + "Use the syntax and punctuation known by www.cadastre.gouv.fr .</html>")); 74 JLabel labelDepartement = new JLabel(tr("Departement")); 75 final JComboBox inputDepartement = new JComboBox(); 76 for (int i=1; i<departements.length; i+=2) { 77 inputDepartement.addItem(departements[i]); 78 } 79 inputDepartement.setToolTipText(tr("<html>Departement number (optional)</html>")); 48 80 49 81 p.add(labelSectionNewLocation, GBC.eol()); 50 82 p.add(labelLocation, GBC.std().insets(10, 0, 0, 0)); 51 83 p.add(inputTown, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5)); 84 p.add(labelDepartement, GBC.std().insets(10, 0, 0, 0)); 85 p.add(inputDepartement, GBC.eol().fill(GBC.HORIZONTAL).insets(5, 0, 0, 5)); 52 86 JOptionPane pane = new JOptionPane(p, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null) { 53 87 private static final long serialVersionUID = 1L; … … 66 100 if (!inputTown.getText().equals("")) { 67 101 location = inputTown.getText().toUpperCase(); 102 codeDepartement = departements[inputDepartement.getSelectedIndex()*2]; 68 103 changeInterface = true; 69 104 Main.pref.put("cadastrewms.location", location); … … 71 106 if (Main.map != null) { 72 107 for (Layer l : Main.map.mapView.getAllLayers()) { 73 if (l instanceof WMSLayer && l.getName().equalsIgnoreCase(location + codeDepartement)) {108 if (l instanceof WMSLayer && l.getName().equalsIgnoreCase(location)) { 74 109 return null; 75 110 } … … 85 120 zone = ((UTM_France_DOM)Main.proj).getCurrentGeodesic(); 86 121 wmsLayer = new WMSLayer(location, codeCommune, zone); 122 wmsLayer.setDepartement(codeDepartement); 87 123 CadastrePlugin.addWMSLayer(wmsLayer); 88 124 System.out.println("Add new layer with Location:" + inputTown.getText()); -
applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
r20765 r21191 69 69 70 70 private String location = ""; 71 72 private String departement = ""; 71 73 72 74 private String codeCommune = ""; … … 377 379 this.location = location; 378 380 setName(rebuildName()); 381 } 382 383 public String getDepartement() { 384 return departement; 385 } 386 387 public void setDepartement(String departement) { 388 this.departement = departement; 379 389 } 380 390
Note:
See TracChangeset
for help on using the changeset viewer.