Changeset 29995 in osm for applications
- Timestamp:
- 2013-10-05T20:05:27+02:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/panels/PanelMain.java
r29992 r29995 7 7 import java.awt.Rectangle; 8 8 import java.awt.event.ActionListener; 9 import java.util.ArrayList; 10 import java.util.Iterator; 9 11 10 12 import javax.swing.*; 11 13 12 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 16 17 import s57.S57att.Att; 18 import s57.S57obj.Obj; 19 import s57.S57val; 20 import seamap.SeaMap; 21 import seamap.SeaMap.*; 22 import smed2.S57en; 14 23 import smed2.Smed2Action; 15 24 16 25 public class PanelMain extends JPanel { 17 26 27 public static JTextArea decode = null; 18 28 public static JTextField messageBar = null; 19 29 public JButton saveButton = null; … … 78 88 saveButton.addActionListener(alSave); 79 89 90 decode = new JTextArea(); 91 decode.setBounds(0, 0, 480, 420); 92 decode.setTabSize(1); 93 add(decode); 94 } 95 96 public void parseMark(Feature feature) { 97 decode.setText("Selected feature:\n"); 98 decode.append("\tType: " + S57en.ObjEN.get(feature.type) + "\n"); 99 if (feature.atts.get(Att.OBJNAM) != null) { 100 decode.append("\tName: " + feature.atts.get(Att.OBJNAM).val + "\n"); 101 } 102 decode.append("\tObjects:\n"); 103 for (Obj obj : feature.objs.keySet()) { 104 decode.append("\t\t" + S57en.ObjEN.get(obj) + "\n"); 105 if (feature.objs.get(obj).size() != 0) { 106 for (AttMap atts : feature.objs.get(obj).values()) { 107 for (Att att : atts.keySet()) { 108 AttItem item = atts.get(att); 109 switch (item.conv) { 110 case E: 111 decode.append("\t\t\t" + S57en.AttEN.get(att) + ": " + S57en.enums.get(att).get(item.val) + "\n"); 112 break; 113 case L: 114 decode.append("\t\t\t" + S57en.AttEN.get(att) + ": "); 115 Iterator it = ((ArrayList)item.val).iterator(); 116 while (it.hasNext()) { 117 Object val = it.next(); 118 decode.append((String)S57en.enums.get(att).get(val)); 119 if (it.hasNext()) { 120 decode.append(", "); 121 } 122 } 123 decode.append("\n"); 124 break; 125 default: 126 decode.append("\t\t\t" + S57en.AttEN.get(att) + ": " + item.val + "\n"); 127 } 128 } 129 } 130 } 131 } 80 132 } 81 133 -
applications/editors/josm/plugins/smed2/src/s57/S57att.java
r29992 r29995 133 133 AttStr.put(Att.TIMEND, "end_time"); AttStr.put(Att.TIMSTA, "start_time"); AttStr.put(Att.TOPSHP, "shape"); AttStr.put(Att.TRAFIC, "traffic_flow"); 134 134 AttStr.put(Att.VALACM, "variation_change"); AttStr.put(Att.VALDCO, "depth"); AttStr.put(Att.VALLMA, "anomaly"); AttStr.put(Att.VALMAG, "variation"); 135 AttStr.put(Att.VALMXR, "maximum_range"); AttStr.put(Att.VALNMR, "range"); AttStr.put(Att.VALSOU, " sounding"); AttStr.put(Att.VERACC, "vertical_accuracy");135 AttStr.put(Att.VALMXR, "maximum_range"); AttStr.put(Att.VALNMR, "range"); AttStr.put(Att.VALSOU, "depth"); AttStr.put(Att.VERACC, "vertical_accuracy"); 136 136 AttStr.put(Att.VERCLR, "clearance_height"); AttStr.put(Att.VERCCL, "clearance_height_closed"); AttStr.put(Att.VERCOP, "clearance_height_open"); 137 137 AttStr.put(Att.VERCSA, "clearance_height_safe"); AttStr.put(Att.VERDAT, "vertical_datum"); AttStr.put(Att.VERLEN, "vertical_length"); AttStr.put(Att.WATLEV, "water_level"); … … 202 202 objatt.add(new ObjAtt(Obj.VEGATN, Att.CATVEG)); objatt.add(new ObjAtt(Obj.VEHTRF, Att.CATVTR)); objatt.add(new ObjAtt(Obj.WATTUR, Att.CATWAT)); 203 203 objatt.add(new ObjAtt(Obj.WEDKLP, Att.CATWED)); objatt.add(new ObjAtt(Obj.WRECKS, Att.CATWRK)); objatt.add(new ObjAtt(Obj.TS_FEB, Att.CAT_TS)); 204 objatt.add(new ObjAtt(Obj.UNKOBJ, Att.RADIUS)); objatt.add(new ObjAtt(Obj.LIGHTS, Att.LITRAD)); objatt.add(new ObjAtt(Obj.NOTMRK, Att.BNKWTW)); 204 objatt.add(new ObjAtt(Obj.DEPCNT, Att.VALDCO)); objatt.add(new ObjAtt(Obj.SOUNDG, Att.VALSOU)); objatt.add(new ObjAtt(Obj.NOTMRK, Att.BNKWTW)); 205 objatt.add(new ObjAtt(Obj.UNKOBJ, Att.RADIUS)); objatt.add(new ObjAtt(Obj.LIGHTS, Att.LITRAD)); 205 206 } 206 207 -
applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java
r29826 r29995 96 96 97 97 public class AttItem { 98 Conv conv;99 Object val;98 public Conv conv; 99 public Object val; 100 100 101 101 AttItem(Conv iconv, Object ival) { … … 360 360 if (subkeys[1].equals("type")) { 361 361 feature.type = S57obj.enumType(val); 362 if (feature.objs.get(feature.type) == null) { 363 feature.objs.put(feature.type, new ObjTab()); 364 } 362 365 } else { 363 366 Att att = S57att.enumAttribute(subkeys[1], Obj.UNKOBJ); -
applications/editors/josm/plugins/smed2/src/smed2/S57en.java
r29992 r29995 9 9 public class S57en { 10 10 11 p rivatestatic final EnumMap<Obj, String> ObjEN = new EnumMap<Obj, String>(Obj.class);11 public static final EnumMap<Obj, String> ObjEN = new EnumMap<Obj, String>(Obj.class); 12 12 static { 13 13 ObjEN.put(Obj.UNKOBJ, "Unkown object"); ObjEN.put(Obj.ADMARE, "Administrative area"); ObjEN.put(Obj.AIRARE, "Airfield"); ObjEN.put(Obj.ACHBRT, "Anchor berth"); … … 62 62 } 63 63 64 p rivatestatic final EnumMap<Att, String> AttEN = new EnumMap<Att, String>(Att.class);64 public static final EnumMap<Att, String> AttEN = new EnumMap<Att, String>(Att.class); 65 65 static { 66 66 AttEN.put(Att.UNKATT, "Unknown attribute"); AttEN.put(Att.AGENCY, "Agency"); AttEN.put(Att.BCNSHP, "Beacon shape"); AttEN.put(Att.BUISHP, "Building shape"); … … 112 112 AttEN.put(Att.CATBNK, "Waterway bank category"); AttEN.put(Att.CATNMK, "Notice mark category"); AttEN.put(Att.CLSDNG, "Dangerous cargo class"); AttEN.put(Att.DIRIMP, "Direction of impact"); 113 113 AttEN.put(Att.DISBK1, "First distance from notice"); AttEN.put(Att.DISBK2, "Second distance from notice");AttEN.put(Att.DISIPU, "Upstream distance of impact"); 114 AttEN.put(Att.DISIPD, "D wonstream distance of impact"); AttEN.put(Att.ELEVA1, "Minimum elevation"); AttEN.put(Att.ELEVA2, "Maximum elevation"); AttEN.put(Att.FNCTNM, "Notice mark function");114 AttEN.put(Att.DISIPD, "Downstream distance of impact"); AttEN.put(Att.ELEVA1, "Minimum elevation"); AttEN.put(Att.ELEVA2, "Maximum elevation"); AttEN.put(Att.FNCTNM, "Notice mark function"); 115 115 AttEN.put(Att.WTWDIS, "Waterway distance"); AttEN.put(Att.BUNVES, "Bunker vessel availibility"); AttEN.put(Att.CATBRT, "Berth category"); AttEN.put(Att.CATBUN, "Bunker station category"); 116 116 AttEN.put(Att.CATCCL, "CEMT class category"); AttEN.put(Att.CATHBR, "Harbour area category"); AttEN.put(Att.CATRFD, "Refuse dump category"); AttEN.put(Att.CATTML, "Terminal category"); … … 127 127 } 128 128 129 private static final EnumMap<BcnSHP, String> Bcnshp = new EnumMap<BcnSHP, String>(BcnSHP.class); static { Bcnshp.put(BcnSHP.BCN_UNKN, ""); 130 Bcnshp.put(BcnSHP.BCN_STAK, "Stake"); Bcnshp.put(BcnSHP.BCN_WTHY, "Withy"); Bcnshp.put(BcnSHP.BCN_TOWR, "Tower"); Bcnshp.put(BcnSHP.BCN_LATT, "Lattice"); Bcnshp.put(BcnSHP.BCN_PILE, "Pile"); 131 Bcnshp.put(BcnSHP.BCN_CARN, "Cairn"); Bcnshp.put(BcnSHP.BCN_BUOY, "Buoyant"); Bcnshp.put(BcnSHP.BCN_POLE, "Pole"); Bcnshp.put(BcnSHP.BCN_PRCH, "Perch"); Bcnshp.put(BcnSHP.BCN_POST, "Post"); 129 132 } 133 private static final EnumMap<BuiSHP, String> Buishp = new EnumMap<BuiSHP, String>(BuiSHP.class); static { Buishp.put(BuiSHP.BUI_UNKN, ""); 134 Buishp.put(BuiSHP.BUI_HIRS, "High-rise"); Buishp.put(BuiSHP.BUI_PYRD, "Pyramid"); Buishp.put(BuiSHP.BUI_CYLR, "Cylindrical"); Buishp.put(BuiSHP.BUI_SPHR, "Spherical"); Buishp.put(BuiSHP.BUI_CUBE, "Cubic"); 135 } 136 private static final EnumMap<BoySHP, String> Boyshp = new EnumMap<BoySHP, String>(BoySHP.class); static { Boyshp.put(BoySHP.BOY_UNKN, ""); 137 Boyshp.put(BoySHP.BOY_CONE, "Conical"); Boyshp.put(BoySHP.BOY_CAN, "Can"); Boyshp.put(BoySHP.BOY_SPHR, "Spherical"); Boyshp.put(BoySHP.BOY_PILR, "Pillar"); Boyshp.put(BoySHP.BOY_SPAR, "Spar"); 138 Boyshp.put(BoySHP.BOY_BARL, "Barrel"); Boyshp.put(BoySHP.BOY_SUPR, "Super-buoy"); Boyshp.put(BoySHP.BOY_ICE, "Ice buoy"); 139 } 140 private static final EnumMap<CatCAM, String> Catcam = new EnumMap<CatCAM, String>(CatCAM.class); static { Catcam.put(CatCAM.CAM_UNKN, ""); 141 Catcam.put(CatCAM.CAM_NORTH, "North"); Catcam.put(CatCAM.CAM_EAST, "East"); Catcam.put(CatCAM.CAM_SOUTH, "South"); Catcam.put(CatCAM.CAM_WEST, "West"); 142 } 143 private static final EnumMap<ColCOL, String> Colour = new EnumMap<ColCOL, String>(ColCOL.class); static { Colour.put(ColCOL.COL_UNK, ""); 144 Colour.put(ColCOL.COL_WHT, "White"); Colour.put(ColCOL.COL_BLK, "Black"); Colour.put(ColCOL.COL_RED, "Red"); Colour.put(ColCOL.COL_GRN, "Green"); Colour.put(ColCOL.COL_BLU, "Blue"); 145 Colour.put(ColCOL.COL_YEL, "Yellow"); Colour.put(ColCOL.COL_GRY, "Grey"); Colour.put(ColCOL.COL_BRN, "Brown"); Colour.put(ColCOL.COL_AMB, "Amber"); Colour.put(ColCOL.COL_VIO, "Violet"); 146 Colour.put(ColCOL.COL_ORG, "Orange"); Colour.put(ColCOL.COL_MAG, "Magenta"); Colour.put(ColCOL.COL_PNK, "Pink"); 147 } 148 private static final EnumMap<ColPAT, String> Colpat = new EnumMap<ColPAT, String>(ColPAT.class); static { Colpat.put(ColPAT.PAT_UNKN, ""); Colpat.put(ColPAT.PAT_HORI, "Horizontal"); 149 Colpat.put(ColPAT.PAT_VERT, "Vertical"); Colpat.put(ColPAT.PAT_DIAG, "Diagonal"); Colpat.put(ColPAT.PAT_SQUR, "Squared"); Colpat.put(ColPAT.PAT_STRP, "Stripes"); 150 Colpat.put(ColPAT.PAT_BRDR, "Border"); Colpat.put(ColPAT.PAT_CROS, "Cross"); Colpat.put(ColPAT.PAT_SALT, "Saltire"); 151 } 152 153 public static final EnumMap<Att, EnumMap> enums = new EnumMap<Att, EnumMap>(Att.class); 154 static { 155 enums.put(Att.BCNSHP, Bcnshp); enums.put(Att.BUISHP, Buishp); enums.put(Att.BOYSHP, Boyshp); enums.put(Att.CATCAM, Catcam); enums.put(Att.COLOUR, Colour); enums.put(Att.COLPAT, Colpat); 156 } 157 158 } -
applications/editors/josm/plugins/smed2/src/smed2/Smed2Action.java
r29881 r29995 118 118 editFrame.setResizable(true); 119 119 editFrame.setAlwaysOnTop(true); 120 editFrame.setVisible( false);120 editFrame.setVisible(true); 121 121 panelMain = new PanelMain(); 122 122 editFrame.add(panelMain); … … 181 181 if (nextFeature.compareTo(feature) != 0) { 182 182 feature = nextFeature; 183 panelMain.parseMark(map.index.get(feature.getUniqueId())); 183 184 // showFrame.setVisible(true); 184 185 showFrame.showFeature(feature, map);
Note:
See TracChangeset
for help on using the changeset viewer.