Changeset 33647 in osm for applications/editors
- Timestamp:
- 2017-09-21T02:58:29+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFile.java
r33646 r33647 56 56 } 57 57 58 protected void safeGet(EdigeoRecord r, List<String> list) {58 protected final void safeGet(EdigeoRecord r, List<String> list) { 59 59 list.add(""); 60 60 safeGet(r, s -> { … … 64 64 } 65 65 66 protected void safeGet(EdigeoRecord r, Consumer<String> callback) {66 protected final void safeGet(EdigeoRecord r, Consumer<String> callback) { 67 67 (lastReadString = callback).accept(r.length > 0 ? r.values.get(0) : null); 68 68 } 69 69 70 protected int safeGetInt(EdigeoRecord r) {70 protected final int safeGetInt(EdigeoRecord r) { 71 71 return r.length > 0 ? Integer.parseInt(r.values.get(0)) : 0; 72 72 } 73 73 74 protected LocalDate safeGetDate(EdigeoRecord r) {74 protected final LocalDate safeGetDate(EdigeoRecord r) { 75 75 return r.length > 0 ? LocalDate.parse(r.values.get(0), dateFormatter) : null; 76 76 } 77 77 78 protected void safeGetAndLog(EdigeoRecord r, Consumer<String> callback, String msg) { 78 protected final double safeGetDouble(EdigeoRecord r) { 79 return r.length > 0 ? Double.parseDouble(r.values.get(0)) : 0; 80 } 81 82 protected final void safeGetAndLog(EdigeoRecord r, Consumer<String> callback, String msg) { 79 83 if (r.length > 0) { 80 84 String v = r.values.get(0); … … 84 88 } 85 89 86 protected LocalDate safeGetDateAndLog(EdigeoRecord r, String msg) {90 protected final LocalDate safeGetDateAndLog(EdigeoRecord r, String msg) { 87 91 if (r.length > 0) { 88 92 LocalDate v = LocalDate.parse(r.values.get(0), dateFormatter); -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileQAL.java
r33643 r33647 4 4 import java.io.IOException; 5 5 import java.nio.file.Path; 6 import java.time.LocalDate; 7 import java.util.ArrayList; 8 import java.util.List; 6 9 7 10 /** … … 9 12 */ 10 13 public class EdigeoFileQAL extends EdigeoFile { 14 15 /** 16 * Update descriptor. 17 */ 18 public static class Update extends Block { 19 20 enum UpdateType { 21 NO_MODIFICATION(0), 22 CREATION(1), 23 REPLACEMENT(2), 24 DELETION(3); 25 26 final int code; 27 UpdateType(int code) { 28 this.code = code; 29 } 30 31 public static UpdateType of(int code) { 32 for (UpdateType s : values()) { 33 if (s.code == code) { 34 return s; 35 } 36 } 37 throw new IllegalArgumentException(Integer.toString(code)); 38 } 39 } 40 41 enum Perennity { 42 TEMPORARY(1), 43 DEFINITIVE(2); 44 45 final int code; 46 Perennity(int code) { 47 this.code = code; 48 } 49 50 public static Perennity of(int code) { 51 for (Perennity s : values()) { 52 if (s.code == code) { 53 return s; 54 } 55 } 56 throw new IllegalArgumentException(Integer.toString(code)); 57 } 58 } 59 60 /** ODA */ LocalDate observationDate; 61 /** UTY */ UpdateType updateType; 62 /** ULO */ Perennity perennity; 63 /** UDA */ LocalDate updateDate; 64 /** RAT */ double annualRatio; 65 /** EDA */ LocalDate endOfValidity; 66 /** COC */ int nElements; 67 /** COP */ final List<String> mcdRef = new ArrayList<>(); 68 69 Update(String type) { 70 super(type); 71 } 72 73 @Override 74 void processRecord(EdigeoRecord r) { 75 switch (r.name) { 76 case "ODA": observationDate = safeGetDate(r); break; 77 case "UTY": updateType = UpdateType.of(safeGetInt(r)); break; 78 case "ULO": perennity = Perennity.of(safeGetInt(r)); break; 79 case "UDA": updateDate = safeGetDate(r); break; 80 case "RAT": annualRatio = safeGetDouble(r); break; 81 case "EDA": endOfValidity = safeGetDate(r); break; 82 case "COC": nElements = safeGetInt(r); break; 83 case "COP": safeGet(r, mcdRef); break; 84 default: 85 super.processRecord(r); 86 } 87 } 88 } 11 89 12 90 /** … … 21 99 @Override 22 100 protected Block createBlock(String type) { 23 // TODO Auto-generated method stub 24 return null; 101 if ("QUP".equals(type)) { 102 return new Update(type); 103 } 104 throw new IllegalArgumentException(type); 25 105 } 26 27 106 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileSCD.java
r33646 r33647 84 84 FACE("FAC"); 85 85 86 String code;86 final String code; 87 87 PrimitiveKind(String code) { 88 88 this.code = code; … … 189 189 BELONG_TO("BET"); 190 190 191 String code;191 final String code; 192 192 RelationKind(String code) { 193 193 this.code = code;
Note:
See TracChangeset
for help on using the changeset viewer.