Changeset 29174 in osm


Ignore:
Timestamp:
2013-01-06T12:00:09+01:00 (12 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed2/src
Files:
1 added
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed2/src/seamap/Renderer.java

    r29157 r29174  
    1010package seamap;
    1111
    12 public class Render {
     12import java.awt.Graphics2D;
     13import java.awt.RenderingHints;
     14import java.awt.geom.Point2D;
     15import java.util.ArrayList;
    1316
     17import seamap.SeaMap.*;
     18import symbols.Symbols;
     19import symbols.Symbols.*;
     20
     21public class Renderer {
     22       
     23        static MapHelper helper;
     24        static SeaMap map;
     25        static double sScale;
     26        static double tScale;
     27        static Graphics2D g2;
     28       
     29        public static void reRender(Graphics2D g, int zoom, double factor, SeaMap m, MapHelper h) {
     30                g2 = g;
     31                helper = h;
     32                map = m;
     33                sScale = Symbols.symbolScale[zoom]*factor;
     34                tScale = Symbols.textScale[zoom]*factor;
     35                if (map != null) {
     36                        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     37                        g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
     38                        Rules.MainRules(map, zoom);
     39                }
     40        }
     41       
     42        public static void symbol(Feature feature, ArrayList<Instr> symbol) {
     43                Point2D point = helper.getPoint(map.nodes.get(feature.refs));
     44                Symbols.drawSymbol(g2, symbol, sScale, point.getX(), point.getY(), null, null);
     45        }
     46       
    1447}
  • applications/editors/josm/plugins/smed2/src/seamap/Rules.java

    r29172 r29174  
    1010package seamap;
    1111
    12 import s57.S57obj.Obj;
     12import java.util.ArrayList;
     13import java.util.EnumMap;
     14import java.util.HashMap;
     15
     16import s57.S57att;
     17import s57.S57val.BcnSHP;
     18import s57.S57att.*;
     19import s57.S57obj;
     20import s57.S57obj.*;
     21import s57.S57val;
     22import s57.S57val.*;
     23
     24import seamap.SeaMap.AttItem;
    1325import seamap.SeaMap.Feature;
     26import symbols.Beacons;
     27import symbols.Symbols.Instr;
    1428
    1529public class Rules {
    1630
    17         public static void MainRules (SeaMap map) {
    18                 for (Feature feature : map.features.get(Obj.SLCONS)) shoreline(feature);
    19                 for (Feature feature : map.features.get(Obj.PIPSOL)) pipelines(feature);
    20                 for (Feature feature : map.features.get(Obj.CBLSUB)) cables(feature);
    21                 for (Feature feature : map.features.get(Obj.PIPOHD)) pipelines(feature);
    22                 for (Feature feature : map.features.get(Obj.CBLOHD)) cables(feature);
    23                 for (Feature feature : map.features.get(Obj.TSEZNE)) separation(feature);
    24                 for (Feature feature : map.features.get(Obj.TSSCRS)) separation(feature);
    25                 for (Feature feature : map.features.get(Obj.TSSRON)) separation(feature);
    26                 for (Feature feature : map.features.get(Obj.TSELNE)) separation(feature);
    27                 for (Feature feature : map.features.get(Obj.TSSLPT)) separation(feature);
    28                 for (Feature feature : map.features.get(Obj.TSSBND)) separation(feature);
    29                 for (Feature feature : map.features.get(Obj.SNDWAV)) areas(feature);
    30                 for (Feature feature : map.features.get(Obj.OSPARE)) areas(feature);
    31                 for (Feature feature : map.features.get(Obj.FAIRWY)) areas(feature);
    32                 for (Feature feature : map.features.get(Obj.DRGARE)) areas(feature);
    33                 for (Feature feature : map.features.get(Obj.RESARE)) areas(feature);
    34                 for (Feature feature : map.features.get(Obj.SPLARE)) areas(feature);
    35                 for (Feature feature : map.features.get(Obj.SEAARE)) areas(feature);
    36                 for (Feature feature : map.features.get(Obj.OBSTRN)) obstructions(feature);
    37                 for (Feature feature : map.features.get(Obj.UWTROC)) obstructions(feature);
    38                 for (Feature feature : map.features.get(Obj.MARCUL)) areas(feature);
    39                 for (Feature feature : map.features.get(Obj.WTWAXS)) waterways(feature);
    40                 for (Feature feature : map.features.get(Obj.RECTRC)) transits(feature);
    41                 for (Feature feature : map.features.get(Obj.NAVLNE)) transits(feature);
    42                 for (Feature feature : map.features.get(Obj.HRBFAC)) harbours(feature);
    43                 for (Feature feature : map.features.get(Obj.ACHARE)) harbours(feature);
    44                 for (Feature feature : map.features.get(Obj.ACHBRT)) harbours(feature);
    45                 for (Feature feature : map.features.get(Obj.LOKBSN)) locks(feature);
    46                 for (Feature feature : map.features.get(Obj.LKBSPT)) locks(feature);
    47                 for (Feature feature : map.features.get(Obj.GATCON)) locks(feature);
    48                 for (Feature feature : map.features.get(Obj.DISMAR)) distances(feature);
    49                 for (Feature feature : map.features.get(Obj.HULKES)) ports(feature);
    50                 for (Feature feature : map.features.get(Obj.CRANES)) ports(feature);
    51                 for (Feature feature : map.features.get(Obj.LNDMRK)) landmarks(feature);
    52                 for (Feature feature : map.features.get(Obj.MORFAC)) moorings(feature);
    53                 for (Feature feature : map.features.get(Obj.NOTMRK)) notices(feature);
    54                 for (Feature feature : map.features.get(Obj.SMCFAC)) marinas(feature);
    55                 for (Feature feature : map.features.get(Obj.BRIDGE)) bridges(feature);
    56                 for (Feature feature : map.features.get(Obj.LITMAJ)) lights(feature);
    57                 for (Feature feature : map.features.get(Obj.LITMIN)) lights(feature);
    58                 for (Feature feature : map.features.get(Obj.LIGHTS)) lights(feature);
    59                 for (Feature feature : map.features.get(Obj.SISTAT)) signals(feature);
    60                 for (Feature feature : map.features.get(Obj.SISTAW)) signals(feature);
    61                 for (Feature feature : map.features.get(Obj.CGUSTA)) signals(feature);
    62                 for (Feature feature : map.features.get(Obj.RDOSTA)) signals(feature);
    63                 for (Feature feature : map.features.get(Obj.RADSTA)) signals(feature);
    64                 for (Feature feature : map.features.get(Obj.RSCSTA)) signals(feature);
    65                 for (Feature feature : map.features.get(Obj.PILBOP)) signals(feature);
    66                 for (Feature feature : map.features.get(Obj.WTWGAG)) gauges(feature);
    67                 for (Feature feature : map.features.get(Obj.OFSPLF)) platforms(feature);
    68                 for (Feature feature : map.features.get(Obj.WRECKS)) wrecks(feature);
    69                 for (Feature feature : map.features.get(Obj.LITVES)) floats(feature);
    70                 for (Feature feature : map.features.get(Obj.LITFLT)) floats(feature);
    71                 for (Feature feature : map.features.get(Obj.BOYINB)) floats(feature);
    72                 for (Feature feature : map.features.get(Obj.BOYLAT)) buoys(feature);
    73                 for (Feature feature : map.features.get(Obj.BOYCAR)) buoys(feature);
    74                 for (Feature feature : map.features.get(Obj.BOYISD)) buoys(feature);
    75                 for (Feature feature : map.features.get(Obj.BOYSAW)) buoys(feature);
    76                 for (Feature feature : map.features.get(Obj.BOYSPP)) buoys(feature);
    77                 for (Feature feature : map.features.get(Obj.BOYWTW)) buoys(feature);
    78                 for (Feature feature : map.features.get(Obj.BCNLAT)) beacons(feature);
    79                 for (Feature feature : map.features.get(Obj.BCNCAR)) beacons(feature);
    80                 for (Feature feature : map.features.get(Obj.BCNISD)) beacons(feature);
    81                 for (Feature feature : map.features.get(Obj.BCNSAW)) beacons(feature);
    82                 for (Feature feature : map.features.get(Obj.BCNSPP)) beacons(feature);
    83                 for (Feature feature : map.features.get(Obj.BCNWTW)) beacons(feature);
     31        static SeaMap map;
     32        static int zoom;
     33       
     34        public static void MainRules (SeaMap m, int z) {
     35                map = m;
     36                zoom = z;
     37                ArrayList<Feature> feature;
     38                if ((feature = map.features.get(Obj.SLCONS)) != null) shoreline(feature);
     39                if ((feature = map.features.get(Obj.SLCONS)) != null) shoreline(feature);
     40                if ((feature = map.features.get(Obj.PIPSOL)) != null) pipelines(feature);
     41                if ((feature = map.features.get(Obj.CBLSUB)) != null) cables(feature);
     42                if ((feature = map.features.get(Obj.PIPOHD)) != null) pipelines(feature);
     43                if ((feature = map.features.get(Obj.CBLOHD)) != null) cables(feature);
     44                if ((feature = map.features.get(Obj.TSEZNE)) != null) separation(feature);
     45                if ((feature = map.features.get(Obj.TSSCRS)) != null) separation(feature);
     46                if ((feature = map.features.get(Obj.TSSRON)) != null) separation(feature);
     47                if ((feature = map.features.get(Obj.TSELNE)) != null) separation(feature);
     48                if ((feature = map.features.get(Obj.TSSLPT)) != null) separation(feature);
     49                if ((feature = map.features.get(Obj.TSSBND)) != null) separation(feature);
     50                if ((feature = map.features.get(Obj.SNDWAV)) != null) areas(feature);
     51                if ((feature = map.features.get(Obj.OSPARE)) != null) areas(feature);
     52                if ((feature = map.features.get(Obj.FAIRWY)) != null) areas(feature);
     53                if ((feature = map.features.get(Obj.DRGARE)) != null) areas(feature);
     54                if ((feature = map.features.get(Obj.RESARE)) != null) areas(feature);
     55                if ((feature = map.features.get(Obj.SPLARE)) != null) areas(feature);
     56                if ((feature = map.features.get(Obj.SEAARE)) != null) areas(feature);
     57                if ((feature = map.features.get(Obj.OBSTRN)) != null) obstructions(feature);
     58                if ((feature = map.features.get(Obj.UWTROC)) != null) obstructions(feature);
     59                if ((feature = map.features.get(Obj.MARCUL)) != null) areas(feature);
     60                if ((feature = map.features.get(Obj.WTWAXS)) != null) waterways(feature);
     61                if ((feature = map.features.get(Obj.RECTRC)) != null) transits(feature);
     62                if ((feature = map.features.get(Obj.NAVLNE)) != null) transits(feature);
     63                if ((feature = map.features.get(Obj.HRBFAC)) != null) harbours(feature);
     64                if ((feature = map.features.get(Obj.ACHARE)) != null) harbours(feature);
     65                if ((feature = map.features.get(Obj.ACHBRT)) != null) harbours(feature);
     66                if ((feature = map.features.get(Obj.LOKBSN)) != null) locks(feature);
     67                if ((feature = map.features.get(Obj.LKBSPT)) != null) locks(feature);
     68                if ((feature = map.features.get(Obj.GATCON)) != null) locks(feature);
     69                if ((feature = map.features.get(Obj.DISMAR)) != null) distances(feature);
     70                if ((feature = map.features.get(Obj.HULKES)) != null) ports(feature);
     71                if ((feature = map.features.get(Obj.CRANES)) != null) ports(feature);
     72                if ((feature = map.features.get(Obj.LNDMRK)) != null) landmarks(feature);
     73                if ((feature = map.features.get(Obj.MORFAC)) != null) moorings(feature);
     74                if ((feature = map.features.get(Obj.NOTMRK)) != null) notices(feature);
     75                if ((feature = map.features.get(Obj.SMCFAC)) != null) marinas(feature);
     76                if ((feature = map.features.get(Obj.BRIDGE)) != null) bridges(feature);
     77                if ((feature = map.features.get(Obj.LITMAJ)) != null) lights(feature);
     78                if ((feature = map.features.get(Obj.LITMIN)) != null) lights(feature);
     79                if ((feature = map.features.get(Obj.LIGHTS)) != null) lights(feature);
     80                if ((feature = map.features.get(Obj.SISTAT)) != null) signals(feature);
     81                if ((feature = map.features.get(Obj.SISTAW)) != null) signals(feature);
     82                if ((feature = map.features.get(Obj.CGUSTA)) != null) signals(feature);
     83                if ((feature = map.features.get(Obj.RDOSTA)) != null) signals(feature);
     84                if ((feature = map.features.get(Obj.RADSTA)) != null) signals(feature);
     85                if ((feature = map.features.get(Obj.RSCSTA)) != null) signals(feature);
     86                if ((feature = map.features.get(Obj.PILBOP)) != null) signals(feature);
     87                if ((feature = map.features.get(Obj.WTWGAG)) != null) gauges(feature);
     88                if ((feature = map.features.get(Obj.OFSPLF)) != null) platforms(feature);
     89                if ((feature = map.features.get(Obj.WRECKS)) != null) wrecks(feature);
     90                if ((feature = map.features.get(Obj.LITVES)) != null) floats(feature);
     91                if ((feature = map.features.get(Obj.LITFLT)) != null) floats(feature);
     92                if ((feature = map.features.get(Obj.BOYINB)) != null) floats(feature);
     93                if ((feature = map.features.get(Obj.BOYLAT)) != null) buoys(feature);
     94                if ((feature = map.features.get(Obj.BOYCAR)) != null) buoys(feature);
     95                if ((feature = map.features.get(Obj.BOYISD)) != null) buoys(feature);
     96                if ((feature = map.features.get(Obj.BOYSAW)) != null) buoys(feature);
     97                if ((feature = map.features.get(Obj.BOYSPP)) != null) buoys(feature);
     98                if ((feature = map.features.get(Obj.BOYWTW)) != null) buoys(feature);
     99                if ((feature = map.features.get(Obj.BCNLAT)) != null) beacons(feature);
     100                if ((feature = map.features.get(Obj.BCNCAR)) != null) beacons(feature);
     101                if ((feature = map.features.get(Obj.BCNISD)) != null) beacons(feature);
     102                if ((feature = map.features.get(Obj.BCNSAW)) != null) beacons(feature);
     103                if ((feature = map.features.get(Obj.BCNSPP)) != null) beacons(feature);
     104                if ((feature = map.features.get(Obj.BCNWTW)) != null) beacons(feature);
    84105        }
    85106       
    86         private static void shoreline(Feature feature) {}
    87         private static void pipelines(Feature feature) {}
    88         private static void cables(Feature feature) {}
    89         private static void separation(Feature feature) {}
    90         private static void areas(Feature feature) {}
    91         private static void obstructions(Feature feature) {}
    92         private static void waterways(Feature feature) {}
    93         private static void transits(Feature feature) {}
    94         private static void harbours(Feature feature) {}
    95         private static void locks(Feature feature) {}
    96         private static void distances(Feature feature) {}
    97         private static void ports(Feature feature) {}
    98         private static void landmarks(Feature feature) {}
    99         private static void moorings(Feature feature) {}
    100         private static void notices(Feature feature) {}
    101         private static void marinas(Feature feature) {}
    102         private static void bridges(Feature feature) {}
    103         private static void lights(Feature feature) {}
    104         private static void floats(Feature feature) {}
    105         private static void signals(Feature feature) {}
    106         private static void wrecks(Feature feature) {}
    107         private static void gauges(Feature feature) {}
    108         private static void platforms(Feature feature) {}
    109         private static void buoys(Feature feature) {}
    110         private static void beacons(Feature feature) {}
    111 
     107        private static void shoreline(ArrayList<Feature> features) {
     108                for (Feature feature : features) {
     109                }
     110        }
     111        private static void pipelines(ArrayList<Feature> features) {}
     112        private static void cables(ArrayList<Feature> features) {}
     113        private static void separation(ArrayList<Feature> features) {}
     114        private static void areas(ArrayList<Feature> features) {}
     115        private static void obstructions(ArrayList<Feature> features) {}
     116        private static void waterways(ArrayList<Feature> features) {}
     117        private static void transits(ArrayList<Feature> features) {}
     118        private static void harbours(ArrayList<Feature> features) {}
     119        private static void locks(ArrayList<Feature> features) {}
     120        private static void distances(ArrayList<Feature> features) {}
     121        private static void ports(ArrayList<Feature> features) {}
     122        private static void landmarks(ArrayList<Feature> features) {}
     123        private static void moorings(ArrayList<Feature> features) {}
     124        private static void notices(ArrayList<Feature> features) {}
     125        private static void marinas(ArrayList<Feature> features) {}
     126        private static void bridges(ArrayList<Feature> features) {}
     127        private static void lights(ArrayList<Feature> features) {}
     128        private static void floats(ArrayList<Feature> features) {}
     129        private static void signals(ArrayList<Feature> features) {}
     130        private static void wrecks(ArrayList<Feature> features) {}
     131        private static void gauges(ArrayList<Feature> features) {}
     132        private static void platforms(ArrayList<Feature> features) {}
     133        private static void buoys(ArrayList<Feature> features) {}
     134        private static void beacons(ArrayList<Feature> features) {
     135                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;
     146                                }
     147                        }
     148                        if (shape == BcnSHP.BCN_PRCH) {
     149                               
     150                        } else if (shape == BcnSHP.BCN_WTHY) {
     151                                       
     152                        } else {
     153                                Renderer.symbol(feature, Beacons.Shapes.get(shape));
     154                        }
     155                }
     156        }
    112157}
  • applications/editors/josm/plugins/smed2/src/seamap/SeaMap.java

    r29172 r29174  
    5454
    5555        public class Coord {
    56                 double lat;
    57                 double lon;
     56                public double lat;
     57                public double lon;
    5858
    5959                Coord(double ilat, double ilon) {
     
    6767        public HashMap<Long, ArrayList<Long>> mpolys;
    6868        public EnumMap<Obj, ArrayList<Feature>> features;
    69         public double minlat;
    70         public double minlon;
    71         public double maxlat;
    72         public double maxlon;
    7369
    7470        private Feature feature;
     
    149145                                if (atts == null) {
    150146                                        atts = new EnumMap<Att, AttItem>(Att.class);
     147                                        items.put(idx, atts);
    151148                                }
    152149                                AttVal attval = S57val.convertValue(val, att);
  • applications/editors/josm/plugins/smed2/src/smed2/MapImage.java

    r29172 r29174  
    11package smed2;
    22
     3import java.awt.Color;
    34import java.awt.Graphics2D;
    4 import java.awt.RenderingHints;
     5import java.awt.geom.Point2D;
    56
    67import javax.swing.Action;
     
    89import org.openstreetmap.josm.Main;
    910import org.openstreetmap.josm.data.Bounds;
     11import org.openstreetmap.josm.data.coor.LatLon;
    1012import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1113import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     
    1416import org.openstreetmap.josm.gui.layer.ImageryLayer;
    1517
     18import seamap.MapHelper;
     19import seamap.Renderer;
    1620import seamap.SeaMap;
    17 import symbols.Symbols;
    18 import symbols.Buoys;
     21import seamap.SeaMap.Coord;
    1922
    20 public class MapImage extends ImageryLayer implements ZoomChangeListener {
     23public class MapImage extends ImageryLayer implements ZoomChangeListener, MapHelper {
    2124
    2225        private SeaMap mapdata;
     26//      private Params imageParams;
     27        private Renderer renderer;
     28
     29        private double top;
     30        private double bottom;
     31        private double left;
     32        private double right;
     33        private double width;
     34        private double height;
    2335        private int zoom;
    2436       
    2537        public MapImage(ImageryInfo info, SeaMap map) {
    2638                super(info);
     39                zoomChanged();
    2740                MapView.addZoomChangeListener(this);
     41                mapdata = map;
    2842        }
    2943       
     
    5064        @Override
    5165        public void paint(Graphics2D g2, MapView mv, Bounds bb) {
    52                 double scale = Symbols.symbolScale[zoom]*Math.pow(2, (zoom-12));
    53                 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    54                 g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
    55                 Symbols.drawSymbol(g2, Buoys.Pillar, scale, 768, 768, null, null);
    56                 g2.drawString(String.valueOf(zoom), 768, 800);
     66                g2.setPaint(new Color(0xb5d0d0));
     67                g2.fill(Main.map.mapView.getBounds());
     68                Renderer.reRender(g2, zoom, Math.pow(2, (zoom-12)), mapdata, this);
    5769        }
    5870
    5971        @Override
    6072        public void zoomChanged() {
    61                 Bounds bounds = Main.map.mapView.getRealBounds();
    62                 zoom = ((int)Math.min(18, Math.max(9, Math.round(Math.floor(Math.log(4096/bounds.asRect().width)/Math.log(2))))));
     73                if ((Main.map != null) && (Main.map.mapView != null)) {
     74                        Bounds bounds = Main.map.mapView.getRealBounds();
     75                        top = bounds.getMax().lat();
     76                        bottom = bounds.getMin().lat();
     77                        left = bounds.getMin().lon();
     78                        right = bounds.getMax().lon();
     79                        width = Main.map.mapView.getBounds().getWidth();
     80                        height = Main.map.mapView.getBounds().getHeight();
     81                        zoom = ((int) Math.min(18, Math.max(9, Math.round(Math.floor(Math.log(4096 / bounds.asRect().width) / Math.log(2))))));
     82                }
    6383        }
    6484
     85        public Point2D getPoint(Coord coord) {
     86                return Main.map.mapView.getPoint2D(new LatLon(coord.lat, coord.lon));
     87        }
    6588}
  • applications/editors/josm/plugins/smed2/src/smed2/Smed2Action.java

    r29172 r29174  
    121121                // System.out.println("hello");
    122122                rendering = new MapImage(new ImageryInfo("OpenSeaMap"), map);
     123                rendering.setBackgroundLayer(true);
    123124                Main.main.addLayer(rendering);
     125                reMap();
    124126        }
    125127
     
    130132                        frame.setVisible(false);
    131133                        frame.dispose();
    132                         data = null;
    133                         map = null;
     134//                      data = null;
     135//                      map = null;
    134136                }
    135137                isOpen = false;
     
    159161        void reMap() {
    160162                map = new SeaMap();
    161                 for (OsmPrimitive osm : data) {
    162                         if ((osm instanceof Node) || (osm instanceof Way)) {
    163                                 if (osm instanceof Node) {
    164                                         map.addNode(((Node) osm).getUniqueId(), ((Node) osm).getCoor().lat(), ((Node) osm).getCoor().lon());
    165                                 } else {
    166                                         map.addWay(((Way) osm).getUniqueId());
    167                                         for (Node node : ((Way) osm).getNodes()) {
    168                                                 map.addToWay((node.getUniqueId()));
     163                if (data != null) {
     164                        for (OsmPrimitive osm : data) {
     165                                if ((osm instanceof Node) || (osm instanceof Way)) {
     166                                        if (osm instanceof Node) {
     167                                                map.addNode(((Node) osm).getUniqueId(), ((Node) osm).getCoor().lat(), ((Node) osm).getCoor().lon());
     168                                        } else {
     169                                                map.addWay(((Way) osm).getUniqueId());
     170                                                for (Node node : ((Way) osm).getNodes()) {
     171                                                        map.addToWay((node.getUniqueId()));
     172                                                }
    169173                                        }
    170                                 }
    171                                 for (Entry<String, String> entry : osm.getKeys().entrySet()) {
    172                                         map.addTag(entry.getKey(), entry.getValue());
    173                                 }
    174                                 map.tagsDone();
    175                         } else if ((osm instanceof Relation) && ((Relation) osm).isMultipolygon()) {
    176                                 map.addMpoly(((Relation) osm).getUniqueId());
    177                                 for (RelationMember mem : ((Relation) osm).getMembers()) {
    178                                         if (mem.getType() == OsmPrimitiveType.WAY)
    179                                                 map.addToMpoly(mem.getUniqueId(), (mem.getRole().equals("outer")));
     174                                        for (Entry<String, String> entry : osm.getKeys().entrySet()) {
     175                                                map.addTag(entry.getKey(), entry.getValue());
     176                                        }
     177                                        map.tagsDone();
     178                                } else if ((osm instanceof Relation) && ((Relation) osm).isMultipolygon()) {
     179                                        map.addMpoly(((Relation) osm).getUniqueId());
     180                                        for (RelationMember mem : ((Relation) osm).getMembers()) {
     181                                                if (mem.getType() == OsmPrimitiveType.WAY)
     182                                                        map.addToMpoly(mem.getUniqueId(), (mem.getRole().equals("outer")));
     183                                        }
    180184                                }
    181185                        }
  • applications/editors/josm/plugins/smed2/src/symbols/Beacons.java

    r29120 r29174  
    1717import java.awt.geom.Path2D;
    1818import java.util.ArrayList;
     19import java.util.EnumMap;
    1920
    2021import symbols.Symbols.Instr;
    2122import symbols.Symbols.Prim;
    2223
     24import s57.S57val.*;
     25
    2326public class Beacons {
     27       
    2428        public static final ArrayList<Instr> Beacon = new ArrayList<Instr>();
    2529        static {
     
    155159                WithyStarboard.add(new Instr(Prim.LINE, new Line2D.Double(-30,-21,0,-35)));
    156160        }
     161       
     162        public static final EnumMap<BcnSHP, ArrayList<Instr>> Shapes = new EnumMap<BcnSHP, ArrayList<Instr>>(BcnSHP.class);
     163        static {
     164                Shapes.put(BcnSHP.BCN_UNKN, Beacons.Beacon); Shapes.put(BcnSHP.BCN_STAK, Beacons.Stake); Shapes.put(BcnSHP.BCN_TOWR, Beacons.Tower);
     165                Shapes.put(BcnSHP.BCN_LATT, Beacons.Beacon); Shapes.put(BcnSHP.BCN_PILE, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POLE, Beacons.Stake);
     166                Shapes.put(BcnSHP.BCN_CARN, Beacons.Cairn); Shapes.put(BcnSHP.BCN_BUOY, Beacons.Beacon); Shapes.put(BcnSHP.BCN_POST, Beacons.Stake);
     167        }
    157168}
Note: See TracChangeset for help on using the changeset viewer.