Changeset 29175 in osm for applications/editors/josm/plugins/smed2/src
- Timestamp:
- 2013-01-06T16:33:30+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/s57/S57val.java
r29172 r29175 1086 1086 } 1087 1087 1088 public static Object nullVal(Att att) { 1089 switch (keys.get(att).conv) { 1090 case A: 1091 case S: 1092 return ""; 1093 case E: 1094 for (Enum<?> key : keys.get(att).map.keySet()) 1095 return key; 1096 case L: 1097 ArrayList<Enum<?>> list = new ArrayList<Enum<?>>(); 1098 for (Enum<?> key : keys.get(att).map.keySet()) { 1099 list.add(key); 1100 return list; 1101 } 1102 case I: 1103 return null; 1104 case F: 1105 return null; 1106 } 1107 return null; 1108 } 1109 1088 1110 public static String decodeValue(String val, Integer attl) { // Convert S57 attribute value string to OSeaM attribute value string 1089 1111 Att att = S57att.lookupAttribute(attl); -
applications/editors/josm/plugins/smed2/src/seamap/Renderer.java
r29174 r29175 14 14 import java.awt.geom.Point2D; 15 15 import java.util.ArrayList; 16 import java.util.EnumMap; 17 import java.util.HashMap; 16 18 19 import s57.S57att.Att; 20 import s57.S57obj.Obj; 21 import s57.S57val.ColCOL; 22 import s57.S57val.*; 23 import s57.S57val; 17 24 import seamap.SeaMap.*; 18 25 import symbols.Symbols; … … 40 47 } 41 48 42 public static void symbol(Feature feature, ArrayList<Instr> symbol) { 49 public static EnumMap<Att, AttItem> getAtts(Feature feature, Obj obj, int idx) { 50 HashMap<Integer, EnumMap<Att, AttItem>> objs = feature.objs.get(obj); 51 if (objs == null) return null; 52 else return objs.get(idx); 53 } 54 55 public static Object getAttVal(Feature feature, Obj obj, int idx, Att att) { 56 EnumMap<Att, AttItem> atts = getAtts(feature, obj, idx); 57 if (atts == null) return S57val.nullVal(att); 58 else { 59 AttItem item = atts.get(att); 60 if (item == null) return S57val.nullVal(att); 61 return item.val; 62 } 63 } 64 65 public static void symbol(Feature feature, ArrayList<Instr> symbol, Obj obj) { 43 66 Point2D point = helper.getPoint(map.nodes.get(feature.refs)); 44 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), null, null); 67 ArrayList<ColCOL> colours = (ArrayList<ColCOL>) getAttVal(feature, obj, 0, Att.COLOUR); 68 ArrayList<ColPAT> pattern = (ArrayList<ColPAT>) getAttVal(feature, obj, 0, Att.COLPAT); 69 Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), null, new Scheme(pattern, colours)); 45 70 } 46 71 -
applications/editors/josm/plugins/smed2/src/seamap/Rules.java
r29174 r29175 11 11 12 12 import java.util.ArrayList; 13 import java.util.EnumMap;14 import java.util.HashMap;15 13 16 import s57.S57att; 17 import s57.S57val.BcnSHP; 14 import s57.S57val.*; 18 15 import s57.S57att.*; 19 import s57.S57obj;20 16 import s57.S57obj.*; 21 import s57.S57val;22 import s57.S57val.*;23 17 24 18 import seamap.SeaMap.AttItem; 25 19 import seamap.SeaMap.Feature; 26 20 import symbols.Beacons; 27 import symbols. Symbols.Instr;21 import symbols.Buoys; 28 22 29 23 public class Rules { … … 106 100 107 101 private static void shoreline(ArrayList<Feature> features) { 108 for (Feature feature : features) { 109 } 102 // for (Feature feature : features) { 103 // } 110 104 } 111 105 private static void pipelines(ArrayList<Feature> features) {} … … 131 125 private static void gauges(ArrayList<Feature> features) {} 132 126 private static void platforms(ArrayList<Feature> features) {} 133 private static void buoys(ArrayList<Feature> features) {} 127 private static void buoys(ArrayList<Feature> features) { 128 for (Feature feature : features) { 129 BoySHP shape = (BoySHP) Renderer.getAttVal(feature, feature.type, 0, Att.BOYSHP); 130 Renderer.symbol(feature, Buoys.Shapes.get(shape), feature.type); 131 } 132 } 134 133 private static void beacons(ArrayList<Feature> features) { 135 134 for (Feature feature : features) { 136 BcnSHP shape; 137 HashMap<Integer, EnumMap<Att, AttItem>> objs = feature.objs.get(feature.type); 138 if (objs == null) shape = BcnSHP.BCN_UNKN; 139 else { 140 EnumMap<Att, AttItem> atts = objs.get(0); 141 if (atts == null) shape = BcnSHP.BCN_UNKN; 142 else { 143 AttItem item = atts.get(Att.BCNSHP); 144 if (item == null) shape = BcnSHP.BCN_UNKN; 145 else shape = (BcnSHP) item.val; 135 BcnSHP shape = (BcnSHP) Renderer.getAttVal(feature, feature.type, 0, Att.BCNSHP); 136 if (((shape == BcnSHP.BCN_PRCH) || (shape == BcnSHP.BCN_WTHY)) && (feature.type == Obj.BCNLAT)) { 137 CatLAM cat = (CatLAM) Renderer.getAttVal(feature, feature.type, 0, Att.CATLAM); 138 switch (cat) { 139 case LAM_PORT: 140 if (shape == BcnSHP.BCN_PRCH) 141 Renderer.symbol(feature, Beacons.PerchPort, feature.type); 142 else 143 Renderer.symbol(feature, Beacons.WithyPort, feature.type); 144 break; 145 case LAM_STBD: 146 if (shape == BcnSHP.BCN_PRCH) 147 Renderer.symbol(feature, Beacons.PerchStarboard, feature.type); 148 else 149 Renderer.symbol(feature, Beacons.WithyStarboard, feature.type); 150 break; 151 default: 152 Renderer.symbol(feature, Beacons.Stake, feature.type); 146 153 } 147 }148 if (shape == BcnSHP.BCN_PRCH) {149 150 } else if (shape == BcnSHP.BCN_WTHY) {151 152 154 } else { 153 Renderer.symbol(feature, Beacons.Shapes.get(shape)); 155 Renderer.symbol(feature, Beacons.Shapes.get(shape), feature.type); 154 156 } 155 157 } -
applications/editors/josm/plugins/smed2/src/smed2/MapImage.java
r29174 r29175 24 24 25 25 private SeaMap mapdata; 26 // private Params imageParams;27 private Renderer renderer;28 26 29 privatedouble top;30 privatedouble bottom;31 privatedouble left;32 privatedouble right;33 privatedouble width;34 privatedouble height;35 privateint zoom;27 double top; 28 double bottom; 29 double left; 30 double right; 31 double width; 32 double height; 33 int zoom; 36 34 37 35 public MapImage(ImageryInfo info, SeaMap map) { -
applications/editors/josm/plugins/smed2/src/smed2/Smed2Action.java
r29174 r29175 12 12 import org.openstreetmap.josm.gui.MapView; 13 13 import org.openstreetmap.josm.gui.MapView.EditLayerChangeListener; 14 import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener;15 14 import org.openstreetmap.josm.gui.layer.*; 16 15 import org.openstreetmap.josm.data.SelectionChangedListener; -
applications/editors/josm/plugins/smed2/src/symbols/Buoys.java
r29110 r29175 14 14 import java.awt.geom.*; 15 15 import java.util.ArrayList; 16 16 import java.util.EnumMap; 17 18 import s57.S57val.BoySHP; 17 19 import symbols.Symbols.*; 18 20 … … 247 249 Super.add(new Instr(Prim.PLIN, p)); 248 250 } 251 252 public static final EnumMap<BoySHP, ArrayList<Instr>> Shapes = new EnumMap<BoySHP, ArrayList<Instr>>(BoySHP.class); 253 static { 254 Shapes.put(BoySHP.BOY_UNKN, Buoys.Pillar); Shapes.put(BoySHP.BOY_CONE, Buoys.Cone); Shapes.put(BoySHP.BOY_CAN, Buoys.Can); 255 Shapes.put(BoySHP.BOY_SPHR, Buoys.Sphere); Shapes.put(BoySHP.BOY_PILR, Buoys.Pillar); Shapes.put(BoySHP.BOY_SPAR, Buoys.Spar); 256 Shapes.put(BoySHP.BOY_BARL, Buoys.Barrel); Shapes.put(BoySHP.BOY_SUPR, Buoys.Super); Shapes.put(BoySHP.BOY_ICE, Buoys.Ice); 257 } 249 258 }
Note:
See TracChangeset
for help on using the changeset viewer.