Changeset 29175 in osm for applications/editors/josm/plugins/smed2/src/seamap
- Timestamp:
- 2013-01-06T16:33:30+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/seamap
- Files:
-
- 2 edited
-
Renderer.java (modified) (2 diffs)
-
Rules.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.
