Changeset 31532 in osm for applications/editors/josm/plugins/seachart/src
- Timestamp:
- 2015-08-29T16:55:46+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/seachart/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/src/render/ChartContext.java
r31343 r31532 16 16 17 17 public interface ChartContext { 18 public enum RuleSet { ALL, BASE, SEAMARK } 19 18 20 Point2D getPoint(Snode coord); 19 21 double mile(Feature feature); 20 22 boolean clip(); 21 23 Color background(); 24 RuleSet ruleset(); 22 25 } -
applications/editors/josm/plugins/seachart/src/render/Renderer.java
r31343 r31532 16 16 import java.util.*; 17 17 18 import render.Rules.*;19 18 import s57.S57val.*; 20 19 import s57.S57map; … … 36 35 static int zoom; 37 36 38 public static void reRender(Graphics2D g, R uleSet set, Rectangle rect, int z, double factor, S57map m, ChartContext c) {37 public static void reRender(Graphics2D g, Rectangle rect, int z, double factor, S57map m, ChartContext c) { 39 38 g2 = g; 40 39 zoom = z; … … 53 52 g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP); 54 53 g2.setStroke(new BasicStroke(0, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER)); 55 Rules.rules( set);54 Rules.rules(); 56 55 } 57 56 } -
applications/editors/josm/plugins/seachart/src/render/Rules.java
r31344 r31532 22 22 import s57.S57obj.*; 23 23 import s57.S57map.*; 24 import render.ChartContext.RuleSet; 24 25 import render.Renderer.*; 25 26 import symbols.*; … … 28 29 public class Rules { 29 30 30 public enum RuleSet { ALL, BASE, SEAMARK }31 32 31 static final EnumMap<ColCOL, Color> bodyColours = new EnumMap<ColCOL, Color>(ColCOL.class); 33 32 static { … … 173 172 static Feature feature; 174 173 static ArrayList<Feature> objects; 175 static RuleSet ruleset;176 174 177 175 static boolean testObject(Obj obj) { … … 183 181 } 184 182 185 public static void rules (RuleSet set) { 186 ruleset = set; 187 if ((set == RuleSet.ALL) || (set == RuleSet.BASE)) { 183 public static void rules () { 184 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) { 188 185 if (testObject(Obj.LNDARE)) for (Feature f : objects) if (testFeature(f)) areas(); 189 186 if (testObject(Obj.BUAARE)) for (Feature f : objects) if (testFeature(f)) areas(); … … 202 199 } 203 200 if (testObject(Obj.SLCONS)) for (Feature f : objects) if (testFeature(f)) shoreline(); 204 if (( set == RuleSet.ALL) || (set== RuleSet.SEAMARK)) {201 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.SEAMARK)) { 205 202 if (testObject(Obj.PIPSOL)) for (Feature f : objects) if (testFeature(f)) pipelines(); 206 203 if (testObject(Obj.CBLSUB)) for (Feature f : objects) if (testFeature(f)) cables(); … … 443 440 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0); 444 441 if (topmap.containsKey(Att.TOPSHP)) { 445 Symbol topmark = Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)); 446 if (topmark != null) 447 Renderer.symbol(feature, topmark, getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta); 442 Renderer.symbol(feature, Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(feature, Obj.TOPMAR), Topmarks.BeaconDelta); 448 443 } 449 444 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 450 445 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0); 451 446 if (topmap.containsKey(Att.TOPSHP)) { 452 Symbol topmark = Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)); 453 if (topmark != null) 454 Renderer.symbol(feature, topmark, getScheme(feature, Obj.DAYMAR), Topmarks.BeaconDelta); 447 Renderer.symbol(feature, Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(feature, Obj.DAYMAR), Topmarks.BeaconDelta); 455 448 } 456 449 } … … 468 461 AttMap topmap = feature.objs.get(Obj.TOPMAR).get(0); 469 462 if (topmap.containsKey(Att.TOPSHP)) { 470 Symbol topmark = Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)); 471 if (topmark != null) 472 Renderer.symbol(feature, topmark, getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape)); 463 Renderer.symbol(feature, Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(feature, Obj.TOPMAR), Topmarks.BuoyDeltas.get(shape)); 473 464 } 474 465 } else if (feature.objs.containsKey(Obj.DAYMAR)) { 475 466 AttMap topmap = feature.objs.get(Obj.DAYMAR).get(0); 476 467 if (topmap.containsKey(Att.TOPSHP)) { 477 Symbol topmark = Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)); 478 if (topmark != null) 479 Renderer.symbol(feature, topmark, getScheme(feature, Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape)); 468 Renderer.symbol(feature, Topmarks.Shapes.get(((ArrayList<TopSHP>)(topmap.get(Att.TOPSHP).val)).get(0)), getScheme(feature, Obj.DAYMAR), Topmarks.BuoyDeltas.get(shape)); 480 469 } 481 470 } … … 1035 1024 private static void shoreline() { 1036 1025 CatSLC cat = (CatSLC) getAttEnum(feature, feature.type, 0, Att.CATSLC); 1037 if (( ruleset == RuleSet.ALL) || (ruleset== RuleSet.BASE)) {1026 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.BASE)) { 1038 1027 if ((cat != CatSLC.SLC_SWAY) && (cat != CatSLC.SLC_TWAL)) { 1039 1028 Renderer.lineVector(feature, new LineStyle(Color.black, 10, Symbols.Yland)); 1040 1029 } 1041 1030 } 1042 if (( ruleset == RuleSet.ALL) || (ruleset== RuleSet.SEAMARK)) {1031 if ((Renderer.context.ruleset() == RuleSet.ALL) || (Renderer.context.ruleset() == RuleSet.SEAMARK)) { 1043 1032 if (Renderer.zoom >= 12) { 1044 1033 switch (cat) { -
applications/editors/josm/plugins/seachart/src/s57/S57osm.java
r31044 r31532 37 37 OSMtags.put("waterway=riverbank", new KeyVal<>(Obj.RIVBNK, Att.UNKATT, null, null)); OSMtags.put("waterway=river", new KeyVal<>(Obj.RIVERS, Att.UNKATT, null, null)); 38 38 OSMtags.put("waterway=canal", new KeyVal<>(Obj.CANALS, Att.UNKATT, null, null)); OSMtags.put("waterway=dock", new KeyVal<>(Obj.HRBBSN, Att.UNKATT, null, null)); 39 OSMtags.put("waterway=lock", new KeyVal<>(Obj.HRBBSN, Att.UNKATT, null, null)); 39 OSMtags.put("waterway=lock", new KeyVal<>(Obj.HRBBSN, Att.UNKATT, null, null)); OSMtags.put("landuse=basin", new KeyVal<>(Obj.LAKARE, Att.UNKATT, null, null)); 40 40 OSMtags.put("wetland=tidalflat", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (Double)0.0)); OSMtags.put("tidal=yes", new KeyVal<Double>(Obj.DEPARE, Att.DRVAL2, Conv.F, (Double)0.0)); 41 41 OSMtags.put("natural=mud", new KeyVal<>(Obj.DEPARE, Att.UNKATT, null, null)); OSMtags.put("natural=sand", new KeyVal<>(Obj.DEPARE, Att.UNKATT, null, null)); -
applications/editors/josm/plugins/seachart/src/seachart/ChartImage.java
r31343 r31532 30 30 import render.ChartContext; 31 31 import render.Renderer; 32 import render.Rules.RuleSet;33 32 import s57.S57map.*; 34 33 import symbols.Symbols; … … 67 66 public void paint(Graphics2D g2, MapView mv, Bounds bb) { 68 67 Rectangle rect = Main.map.mapView.getBounds(); 69 Renderer.reRender(g2, RuleSet.ALL,rect, zoom, Math.pow(2, (zoom-12)), SeachartAction.map, this);68 Renderer.reRender(g2, rect, zoom, Math.pow(2, (zoom-12)), SeachartAction.map, this); 70 69 g2.setPaint(Color.black); 71 70 g2.setFont(new Font("Arial", Font.BOLD, 20)); … … 102 101 return (Symbols.Bwater); 103 102 } 103 104 public RuleSet ruleset() { 105 return RuleSet.ALL; 106 } 104 107 }
Note:
See TracChangeset
for help on using the changeset viewer.