Changeset 33646 in osm for applications
- Timestamp:
- 2017-09-21T02:35:21+02:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFile.java
r33645 r33646 57 57 58 58 protected void safeGet(EdigeoRecord r, List<String> list) { 59 list.add(""); 59 60 safeGet(r, s -> { 60 61 int idx = list.size() - 1; -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileDIC.java
r33645 r33646 104 104 case "UNI": safeGet(r, s -> unit += s); break; 105 105 case "AVC": nValues = safeGetInt(r); break; 106 case "AVL": values.add("");safeGet(r, values); break;107 case "AVD": descrs.add("");safeGet(r, descrs); break;106 case "AVL": safeGet(r, values); break; 107 case "AVD": safeGet(r, descrs); break; 108 108 default: 109 109 super.processRecord(r); -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileSCD.java
r33643 r33646 4 4 import java.io.IOException; 5 5 import java.nio.file.Path; 6 import java.util.ArrayList; 7 import java.util.List; 6 8 7 9 /** … … 11 13 12 14 /** 15 * MCD Object definition. 16 */ 17 public static class McdObjDef extends Block { 18 19 /** DIP */ String dictRef = ""; 20 /** KND */ String kind = ""; 21 /** AAC */ int nAttributes; 22 /** AAP */ final List<String> attributes = new ArrayList<>(); 23 /** QAC */ int nQualities; 24 25 McdObjDef(String type) { 26 super(type); 27 } 28 29 @Override 30 void processRecord(EdigeoRecord r) { 31 switch (r.name) { 32 case "DIP": safeGet(r, s -> dictRef += s); break; 33 case "KND": safeGet(r, s -> kind += s); break; 34 case "AAC": nAttributes = safeGetInt(r); break; 35 case "AAP": safeGet(r, attributes); break; 36 case "QAC": nQualities = safeGetInt(r); break; 37 default: 38 super.processRecord(r); 39 } 40 } 41 } 42 43 /** 44 * MCD Attribute definition. 45 */ 46 public static class McdAttrDef extends Block { 47 48 /** DIP */ String dictRef = ""; 49 /** CAN */ int nMaxChars; 50 /** CAD */ int nMaxDigits; 51 /** CAE */ int nMaxExponent; 52 /** UNI */ String unit = ""; 53 /** AV1 */ String min = ""; 54 /** AV2 */ String max = ""; 55 56 McdAttrDef(String type) { 57 super(type); 58 } 59 60 @Override 61 void processRecord(EdigeoRecord r) { 62 switch (r.name) { 63 case "DIP": safeGet(r, s -> dictRef += s); break; 64 case "CAN": nMaxChars = safeGetInt(r); break; 65 case "CAD": nMaxDigits = safeGetInt(r); break; 66 case "CAE": nMaxExponent = safeGetInt(r); break; 67 case "UNI": safeGet(r, s -> unit += s); break; 68 case "AV1": safeGet(r, s -> min += s); break; 69 case "AV2": safeGet(r, s -> max += s); break; 70 default: 71 super.processRecord(r); 72 } 73 } 74 } 75 76 /** 77 * MCD Primitive definition. 78 */ 79 public static class McdPrimDef extends Block { 80 81 enum PrimitiveKind { 82 NODE("NOD"), 83 ARC("ARC"), 84 FACE("FAC"); 85 86 String code; 87 PrimitiveKind(String code) { 88 this.code = code; 89 } 90 91 public static PrimitiveKind of(String code) { 92 for (PrimitiveKind s : values()) { 93 if (s.code.equals(code)) { 94 return s; 95 } 96 } 97 throw new IllegalArgumentException(code); 98 } 99 } 100 101 /** KND */ PrimitiveKind kind; 102 /** AAC */ int nAttributes; 103 /** QAC */ int nQualities; 104 105 McdPrimDef(String type) { 106 super(type); 107 } 108 109 @Override 110 void processRecord(EdigeoRecord r) { 111 switch (r.name) { 112 case "KND": safeGet(r, s -> kind = PrimitiveKind.of(s)); break; 113 case "AAC": nAttributes = safeGetInt(r); break; 114 case "QAC": nQualities = safeGetInt(r); break; 115 default: 116 super.processRecord(r); 117 } 118 } 119 } 120 121 /** 122 * MCD Relation definition. 123 */ 124 abstract static class McdRelDef extends Block { 125 126 /** CA1 */ int minCardinal; 127 /** CA2 */ int maxCardinal; 128 /** SCC */ int nTypes; 129 /** SCP */ final List<String> scdRef = new ArrayList<>(); 130 /** OCC */ final List<Integer> nOccurences = new ArrayList<>(); 131 /** AAC */ int nAttributes; 132 /** QAC */ int nQualities; 133 134 McdRelDef(String type) { 135 super(type); 136 } 137 138 @Override 139 void processRecord(EdigeoRecord r) { 140 switch (r.name) { 141 case "CA1": minCardinal = safeGetInt(r); break; 142 case "CA2": maxCardinal = safeGetInt(r); break; 143 case "SCC": nTypes = safeGetInt(r); break; 144 case "SCP": safeGet(r, scdRef); break; 145 case "OCC": nOccurences.add(safeGetInt(r)); break; 146 case "AAC": nAttributes = safeGetInt(r); break; 147 case "QAC": nQualities = safeGetInt(r); break; 148 default: 149 super.processRecord(r); 150 } 151 } 152 } 153 154 /** 155 * MCD Semantic Relation definition. 156 */ 157 public static class McdSemRelDef extends McdRelDef { 158 159 /** DIP */ String dictRef = ""; 160 161 McdSemRelDef(String type) { 162 super(type); 163 } 164 165 @Override 166 void processRecord(EdigeoRecord r) { 167 switch (r.name) { 168 case "DIP": safeGet(r, s -> dictRef += s); break; 169 default: 170 super.processRecord(r); 171 } 172 } 173 } 174 175 /** 176 * MCD Construction Relation definition. 177 */ 178 public static class McdBuildRelDef extends McdRelDef { 179 180 enum RelationKind { 181 IS_COMPOSED_OF("ICO"), 182 IS_DISPLAYED_BY("IDB"), 183 IS_DISPLAYED_BY_ARC("IDR"), 184 HAS_FOR_INITIAL_NODE("IND"), 185 HAS_FOR_FINAL_NODE("FND"), 186 HAS_FOR_LEFT_FACE("LPO"), 187 HAS_FOR_RIGHT_FACE("RPO"), 188 IS_INCLUDED_IN("ILI"), 189 BELONG_TO("BET"); 190 191 String code; 192 RelationKind(String code) { 193 this.code = code; 194 } 195 196 public static RelationKind of(String code) { 197 for (RelationKind s : values()) { 198 if (s.code.equals(code)) { 199 return s; 200 } 201 } 202 throw new IllegalArgumentException(code); 203 } 204 } 205 206 /** KND */ RelationKind kind; 207 208 McdBuildRelDef(String type) { 209 super(type); 210 } 211 212 @Override 213 void processRecord(EdigeoRecord r) { 214 switch (r.name) { 215 case "KND": safeGet(r, s -> kind = RelationKind.of(s)); break; 216 default: 217 super.processRecord(r); 218 } 219 } 220 } 221 222 /** 13 223 * Constructs a new {@code EdigeoFileSCD}. 14 224 * @param path path to SCD file … … 21 231 @Override 22 232 protected Block createBlock(String type) { 23 // TODO Auto-generated method stub 24 return null; 233 switch (type) { 234 case "OBJ": 235 return new McdObjDef(type); 236 case "ATT": 237 return new McdAttrDef(type); 238 case "PGE": 239 return new McdPrimDef(type); 240 case "ASS": 241 return new McdSemRelDef(type); 242 case "REL": 243 return new McdBuildRelDef(type); 244 default: 245 throw new IllegalArgumentException(type); 246 } 25 247 } 26 248 } -
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/EdigeoFileTHF.java
r33645 r33646 220 220 case "SCI": safeGet(r, s -> scdId += s); break; 221 221 case "GDC": nGeoData = safeGetInt(r); break; 222 case "GDN": geoDataName.add("");safeGet(r, geoDataName); break;223 case "GDI": geoDataId.add("");safeGet(r, geoDataId); break;222 case "GDN": safeGet(r, geoDataName); break; 223 case "GDI": safeGet(r, geoDataId); break; 224 224 default: 225 225 super.processRecord(r);
Note:
See TracChangeset
for help on using the changeset viewer.