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

save

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.