Changeset 32907 in osm for applications/editors/josm/plugins/seachart/jbasemap/src
- Timestamp:
- 2016-09-03T16:43:42+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachart/jbasemap/src/jbasemap/Jbasemap.java
r32906 r32907 1 /* Copyright 2014 Malcolm Herring 2 * 3 * This is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, version 3 of the License. 6 * 7 * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. 8 */ 9 1 // License: GPL. For details, see LICENSE file. 10 2 package jbasemap; 11 3 … … 22 14 import org.w3c.dom.Document; 23 15 16 import render.ChartContext; 17 import render.Renderer; 24 18 import s57.S57map; 19 import s57.S57map.Feature; 20 import s57.S57map.GeomIterator; 21 import s57.S57map.Pflag; 22 import s57.S57map.Snode; 25 23 import s57.S57obj.Obj; 26 24 import s57.S57osm; 27 import s57.S57map.*; 28 import symbols.*; 29 import render.*; 25 import symbols.Symbols; 30 26 31 public class Jbasemap { 27 /** 28 * @author Malcolm Herring 29 */ 30 public final class Jbasemap { 31 private Jbasemap() { 32 // Hide default constructor for utilities classes 33 } 32 34 33 35 static String src; … … 39 41 40 42 static class Context implements ChartContext { 41 42 static double top = 0; 43 static double mile = 0; 44 45 publicContext43 44 static double top = 0; 45 static double mile = 0; 46 47 Context() { 46 48 top = (1.0 - Math.log(Math.tan(map.bounds.maxlat) + 1.0 / Math.cos(map.bounds.maxlat)) / Math.PI) / 2.0 * 256.0 * z2; 47 49 mile = 256 / ((Math.toDegrees(map.bounds.maxlat) - Math.toDegrees(map.bounds.minlat)) * 60); 48 } 49 50 } 51 52 @Override 50 53 public Point2D getPoint(Snode coord) { 51 54 double x = (Math.toDegrees(coord.lon) - Math.toDegrees(map.bounds.minlon)) * 256.0 * (z2 / 2) / 180.0; … … 54 57 } 55 58 59 @Override 56 60 public double mile(Feature feature) { 57 61 return mile; 58 62 } 59 63 64 @Override 60 65 public boolean clip() { 61 66 return true; 62 67 } 63 68 69 @Override 64 70 public Color background(S57map map) { 65 71 if (map.features.containsKey(Obj.COALNE)) { … … 76 82 if (node == null) 77 83 continue; 78 if ((node.lat >= map.bounds.minlat) && (node.lat <= map.bounds.maxlat) && (node.lon >= map.bounds.minlon) && (node.lon <= map.bounds.maxlon)) { 84 if ((node.lat >= map.bounds.minlat) && (node.lat <= map.bounds.maxlat) 85 && (node.lon >= map.bounds.minlon) && (node.lon <= map.bounds.maxlon)) { 79 86 return Symbols.Bwater; 80 87 } … … 84 91 return Symbols.Yland; 85 92 } else { 86 if (map.features.containsKey(Obj.ROADWY) || map.features.containsKey(Obj.RAILWY) || map.features.containsKey(Obj.LAKARE) || map.features.containsKey(Obj.RIVERS) || map.features.containsKey(Obj.CANALS)) { 93 if (map.features.containsKey(Obj.ROADWY) || map.features.containsKey(Obj.RAILWY) || map.features.containsKey(Obj.LAKARE) || 94 map.features.containsKey(Obj.RIVERS) || map.features.containsKey(Obj.CANALS)) { 87 95 return Symbols.Yland; 88 96 } else { … … 92 100 } 93 101 102 @Override 94 103 public RuleSet ruleset() { 95 104 return RuleSet.BASE; 96 105 } 97 106 } 98 107 99 108 public static void main(String[] args) throws IOException { 100 109 if (args.length < 5) {
Note:
See TracChangeset
for help on using the changeset viewer.