Changeset 27028 in osm for applications


Ignore:
Timestamp:
2011-11-08T18:34:00+01:00 (13 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages_en.properties

    r26173 r27028  
    2020LightVessel=Light vessel
    2121LightFloat=Light float
     22SSWarning=Warning Signal Station
     23SSTraffic=Traffic Signal Station
    2224Topmarks=Topmarks
    2325FogSignals=Fog signals
     
    3739Stake=Stake beacon
    3840Perch=Perch beacon
     41Cairn=Cairn beacon
    3942
    4043RegionA=IALA Region A
     
    8891Range=Range
    8992Category=Category
     93SSCategory=Signal Station
     94UKCategory=Unknown Category
    9095NoneSpecified=None specified
    9196Vert2=Vertically disposed x2
    9297Visibility=Visibility
    93 Intensified=intensified
    94 Unintensified=unintensified
     98Intensified=Intensified
     99Unintensified=Unintensified
    95100PartiallyObscured=Partially obscured
    96101Orientation=Orientation
    97102Exhibition=Exhibition
    9810324h=24h
    99 Day=day
    100 Night=night
    101 Fog=fog
    102 
    103 NoColour=No colour
     104Day=Day
     105Night=Night
     106Fog=Fog
     107
     108RemColour=Remove colour
     109AddColour=Add colour
    104110White=White
    105111Red=Red
     
    111117Violet=Violet
    112118Black=Black
     119Grey=Grey
     120Brown=Brown
     121Magenta=Magenta
     122Pink=Pink
     123NoPat=No Pattern
     124HorizPat=Horizontal Stripes
     125VertPat=Vertical Stripes
     126DiagPat=Diagonal Stripes
     127SquarePat=Squared Pattern
     128BorderPat=Border Stripe
     129
     130UKPurpose=Unknown Purpose
     131Warning=Warning
     132Yachting=Yachting
     133Outfall=Outfall
     134ODAS=ODAS
     135RecreationZone=Recreation Zone
     136Mooring=Mooring
     137LANBY=LANBY
     138Leading=Leading
     139Notice=Notice
     140TSS=TSS
     141FoulGround=Foul Ground
     142FerryCross=Ferry Crossing
     143Anchorage=Anchorage
     144ChanSeparation=Channel Separation
     145
     146UKCategory=Unknown Category
     147Traffic=Traffic Control
     148PortControl=Port Control
     149PortEntry=Port Entry/Departure
     150IPT=International Port Traffic
     151Berthing=Berthing
     152Dock=Dock
     153Lock=Lock
     154Barrage=Flood Barrage
     155Bridge=Bridge Passage
     156Dredging=Dredging
     157Danger=Danger
     158Storm=Storm
     159Weather=Weather
     160Obstruction=Obstruction
     161Cable=Cable
     162Distress=Distress
     163Time=time
     164Tide=Tide
     165TidalStream=Tidal Stream
     166TideGauge=Tide Gauge
     167TideScale=Tide Scale
     168Diving=Diving
     169Ice=Ice
     170LevelGauge=Water Level Gauge
     171Military=Military Practice
     172
     173Status=Status
     174Information=Information
     175Source=Source
     176Elevation=Elevation
     177Visibility=Visibility
     178Reflectivity=Reflectivity
     179Construction=Construction
     180
     181NotSet=Not set
     182
     183Permanent=Permanent
     184Occasional=Occasional
     185Recommended=Recommended
     186NotInUse=Not in use
     187Intermittent=Intermittent
     188Reserved=Reserved
     189Temporary=Temporary
     190Private=Private
     191Mandatory=Mandatory
     192Destroyed=Destroyed
     193Extinguished=Extinguished
     194Illuminated=Illuminated
     195Historic=Historic
     196Public=Public
     197Synchronized=Synchronized
     198Watched=Watched
     199UnWatched=Unwatched
     200Doubtful=Existence Doubtful
     201
     202Masonry=Masonry
     203Concreted=Concreted
     204Boulders=Loose boulders
     205HardSurfaced=Hard surfaced
     206Unsurfaced=Unsurfaced
     207Wooden=Wooden
     208Metal=Metal
     209GRP=GRP
     210Painted=Painted
     211
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSectors.java

    r27027 r27028  
    1010import oseam.Messages;
    1111import oseam.dialogs.OSeaMAction;
     12import oseam.seamarks.SeaMark;
    1213import oseam.seamarks.SeaMark.*;
    1314
     
    3536                }
    3637        };
     38        public JComboBox colourBox;
     39        public EnumMap<Col, ImageIcon> colours = new EnumMap<Col, ImageIcon>(Col.class);
    3740        public JComboBox visibilityBox;
    3841        public EnumMap<Vis, String> visibilities = new EnumMap<Vis, String>(Vis.class);
     42        public JComboBox exhibitionBox;
     43        public EnumMap<Exh, String> exhibitions = new EnumMap<Exh, String>(Exh.class);
    3944
    4045        public PanelSectors(OSeaMAction dia) {
    4146                super("Sector Table");
    4247                dlg = dia;
    43                 this.setSize(800, 100);
     48                this.setSize(900, 100);
    4449                this.setVisible(true);
    4550                this.setAlwaysOnTop(true);
     
    5661                this.add(plusButton);
    5762                panel = new JPanel(new BorderLayout());
    58                 panel.setBounds(40, 0, 760, 512);
     63                panel.setBounds(40, 0, 860, 512);
    5964                model = new SectorTable();
    6065                table = new JTable(model);
    61                 table.setBounds(0, 0, 760, 34);
     66                table.setBounds(0, 0, 860, 34);
    6267                panel.add(new JScrollPane(table));
    6368                this.getContentPane().add(panel);
    6469               
    65                 TableColumn visColumn = table.getColumnModel().getColumn(11);
     70                TableColumn col = table.getColumnModel().getColumn(1);
     71                col.setCellRenderer(new ColourCellRenderer());
     72
     73                TableColumn colColumn = table.getColumnModel().getColumn(1);
     74                colourBox = new JComboBox();
     75                addColItem(new ImageIcon(getClass().getResource("/images/DelButton.png")), Col.UNKNOWN);
     76                addColItem(new ImageIcon(getClass().getResource("/images/WhiteButton.png")), Col.WHITE);
     77                addColItem(new ImageIcon(getClass().getResource("/images/RedButton.png")), Col.RED);
     78                addColItem(new ImageIcon(getClass().getResource("/images/GreenButton.png")), Col.GREEN);
     79                addColItem(new ImageIcon(getClass().getResource("/images/YellowButton.png")), Col.YELLOW);
     80                addColItem(new ImageIcon(getClass().getResource("/images/OrangeButton.png")), Col.ORANGE);
     81                addColItem(new ImageIcon(getClass().getResource("/images/AmberButton.png")), Col.AMBER);
     82                addColItem(new ImageIcon(getClass().getResource("/images/BlueButton.png")), Col.BLUE);
     83                addColItem(new ImageIcon(getClass().getResource("/images/VioletButton.png")), Col.VIOLET);
     84                colColumn.setCellEditor(new DefaultCellEditor(colourBox));
     85               
     86                TableColumn visColumn = table.getColumnModel().getColumn(12);
    6687                visibilityBox = new JComboBox();
    67                 addVisibItem(Messages.getString("NoneSpecified"), Vis.UNKNOWN);
     88                addVisibItem("", Vis.UNKNOWN);
    6889                addVisibItem(Messages.getString("Intensified"), Vis.INTEN);
    6990                addVisibItem(Messages.getString("Unintensified"), Vis.UNINTEN);
    7091                addVisibItem(Messages.getString("PartiallyObscured"), Vis.PARTOBS);
    7192                visColumn.setCellEditor(new DefaultCellEditor(visibilityBox));
     93               
     94                TableColumn exhColumn = table.getColumnModel().getColumn(13);
     95                exhibitionBox = new JComboBox();
     96                addExhibItem("", Exh.UNKNOWN);
     97                addExhibItem(Messages.getString("24h"), Exh.H24);
     98                addExhibItem(Messages.getString("Day"), Exh.DAY);
     99                addExhibItem(Messages.getString("Night"), Exh.NIGHT);
     100                addExhibItem(Messages.getString("Fog"), Exh.FOG);
     101                exhColumn.setCellEditor(new DefaultCellEditor(exhibitionBox));
    72102        }
    73103
     
    75105
    76106                private String[] headings = { "Sector", "Colour", "Character", "Group", "Sequence", "Period",
    77                                 "Start", "End", "Radius", "Height", "Range", "Visibility", "Exhibition", "Category" };
     107                                "Directional", "Start", "End", "Radius", "Height", "Range", "Visibility", "Exhibition" };
    78108
    79109                public SectorTable() {
     
    99129                        switch (col) {
    100130                        case 1:
    101                                 return Color.class;
    102                         case 11:
    103                                 return Vis.class;
    104                         case 12:
    105                                 return Exh.class;
    106                         case 13:
    107                                 return Lit.class;
     131                                return Col.class;
     132                        case 6:
     133                                return Boolean.class;
    108134                        default:
    109135                                return String.class;
     
    112138
    113139                public Object getValueAt(int row, int col) {
    114                         if (col == 0)
     140                        switch (col) {
     141                        case 0:
    115142                                return row;
    116                         else
    117                                 return dlg.mark.getLightAtt(col-1, row);
     143                        case 1:
     144                                return dlg.mark.getLightAtt(Att.COL, row);
     145                        case 6:
     146                                return (dlg.mark.getLightAtt(Att.LIT, row) == Lit.DIR);
     147                        case 7:
     148                        case 8:
     149                                if (dlg.mark.getLightAtt(Att.LIT, row) == Lit.DIR)
     150                                        return dlg.mark.getLightAtt(Att.ORT, row);
     151                                else
     152                                        return dlg.mark.getLightAtt(col - 1, row);
     153                        case 12:
     154                                return visibilities.get(dlg.mark.getLightAtt(Att.VIS, row));
     155                        case 13:
     156                                return exhibitions.get(dlg.mark.getLightAtt(Att.EXH, row));
     157                        default:
     158                                return dlg.mark.getLightAtt(col - 1, row);
     159                        }
    118160                }
    119161
    120162                public void setValueAt(Object value, int row, int col) {
    121163                        switch (col) {
    122                         case 4:
     164                        case 1:
     165                                for (Col colour : colours.keySet()) {
     166                                        ImageIcon img = colours.get(colour);
     167                                        if (img == value)
     168                                                dlg.mark.setLightAtt(Att.COL, row, colour);
     169                                }
     170                                break;
    123171                        case 5:
     172                        case 9:
     173                        case 10:
     174                        case 11:
     175                                dlg.mark.setLightAtt(col - 1, row, dlg.mark.validDecimal((String) value));
     176                                break;
    124177                        case 6:
     178                                if ((Boolean) value == true) {
     179                                        dlg.mark.setLightAtt(Att.LIT, row, Lit.DIR);
     180                                } else {
     181                                        dlg.mark.setLightAtt(Att.LIT, row, Lit.UNKNOWN);
     182                                        dlg.mark.setLightAtt(Att.ORT, row, "");
     183                                }
     184                                break;
    125185                        case 7:
    126186                        case 8:
    127                         case 9:
    128                         case 13:
    129                                 dlg.mark.setLightAtt(col-1, row, dlg.mark.validDecimal((String)value));
    130                                 break;
    131                         case 11:
     187                                if (dlg.mark.getLightAtt(Att.LIT, row) == Lit.DIR) {
     188                                        dlg.mark.setLightAtt(Att.ORT, row, dlg.mark.validDecimal((String) value));
     189                                } else {
     190                                        dlg.mark.setLightAtt(Att.LIT, row, Lit.UNKNOWN);
     191                                        dlg.mark.setLightAtt(col - 1, row, dlg.mark.validDecimal((String) value));
     192                                }
     193                                break;
     194                        case 12:
    132195                                for (Vis vis : visibilities.keySet()) {
    133196                                        String str = visibilities.get(vis);
     
    136199                                }
    137200                                break;
     201                        case 13:
     202                                for (Exh exh : exhibitions.keySet()) {
     203                                        String str = exhibitions.get(exh);
     204                                        if (str.equals(value))
     205                                                dlg.mark.setLightAtt(Att.EXH, row, exh);
     206                                }
     207                                break;
    138208                        default:
    139                                 dlg.mark.setLightAtt(col-1, row, value);
     209                                dlg.mark.setLightAtt(col - 1, row, value);
    140210                        }
     211                }
     212        }
     213
     214        public class ColourCellRenderer extends JLabel implements TableCellRenderer {
     215                public Component getTableCellRendererComponent(JTable table, Object value,
     216                                boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
     217                        setHorizontalAlignment(SwingConstants.CENTER);
     218                        setIcon(colours.get(value));
     219                        return this;
    141220                }
    142221        }
     
    148227        public void addSector(int idx) {
    149228                dlg.mark.addLight(idx);
    150                 table.setSize(760, ((table.getRowCount() * 16) + 18));
     229                table.setSize(860, ((table.getRowCount() * 16) + 18));
    151230                if (table.getRowCount() > 3) {
    152                         this.setSize(800, ((table.getRowCount() * 16) + 40));
     231                        this.setSize(900, ((table.getRowCount() * 16) + 40));
    153232                } else {
    154                         this.setSize(800, 100);
     233                        this.setSize(900, 100);
    155234                }
    156235        }
    157236
    158237        public void deleteSector(int idx) {
    159                 dlg.mark.subLight(idx);
    160                 table.setSize(760, ((table.getRowCount() * 16) + 18));
     238                dlg.mark.delLight(idx);
     239                table.setSize(860, ((table.getRowCount() * 16) + 18));
    161240                if (table.getRowCount() > 3) {
    162                         this.setSize(800, ((table.getRowCount() * 16) + 40));
     241                        this.setSize(900, ((table.getRowCount() * 16) + 40));
    163242                } else {
    164                         this.setSize(800, 100);
    165                 }
     243                        this.setSize(900, 100);
     244                }
     245        }
     246
     247        private void addColItem(ImageIcon img, Col col) {
     248                colours.put(col, img);
     249                colourBox.addItem(img);
    166250        }
    167251
     
    171255        }
    172256
     257        private void addExhibItem(String str, Exh exh) {
     258                exhibitions.put(exh, str);
     259                exhibitionBox.addItem(str);
     260        }
     261
    173262}
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java

    r27027 r27028  
    483483        }
    484484
    485         public static final Map<EnumSet<Lit>, String> LitSTR = new HashMap<EnumSet<Lit>, String>();
     485        public static final EnumMap<Lit, String> LitSTR = new EnumMap<Lit, String>(Lit.class);
    486486        static {
    487                 LitSTR.put(EnumSet.of(Lit.VERT), "vertical");
     487                LitSTR.put(Lit.UNKNOWN, "");
     488                LitSTR.put(Lit.VERT, "vertical");
     489                LitSTR.put(Lit.HORIZ, "horizontal");
     490                LitSTR.put(Lit.DIR, "directional");
     491                LitSTR.put(Lit.UPPER, "upper");
     492                LitSTR.put(Lit.LOWER, "lower");
     493                LitSTR.put(Lit.LEAD, "leading");
     494                LitSTR.put(Lit.REAR, "rear");
     495                LitSTR.put(Lit.FRONT, "front");
     496                LitSTR.put(Lit.AERO, "aero");
     497                LitSTR.put(Lit.AIROBS, "air_obstruction");
     498                LitSTR.put(Lit.FOGDET, "fog_detector");
     499                LitSTR.put(Lit.FLOOD, "floodlight");
     500                LitSTR.put(Lit.STRIP, "striplight");
     501                LitSTR.put(Lit.SUBS, "subsidairy");
     502                LitSTR.put(Lit.SPOT, "spotlight");
     503                LitSTR.put(Lit.MOIRE, "moire");
     504                LitSTR.put(Lit.EMERG, "emergency");
     505                LitSTR.put(Lit.BEAR, "bearing");
    488506        }
    489507
     
    499517        }
    500518       
    501         public enum Att { COL, CHR, GRP, SEQ, PER, BEG, END, RAD, HGT, RNG, VIS, EXH, LIT, ORT }
     519        public enum Att { COL, CHR, GRP, SEQ, PER, LIT, BEG, END, RAD, HGT, RNG, VIS, EXH, ORT }
    502520       
    503         public Object[] sector = {Col.UNKNOWN, "", "", "", "", "", "", "", "", "", Vis.UNKNOWN, Exh.UNKNOWN, Lit.UNKNOWN, "" };
     521        public Object[] sector = {Col.UNKNOWN, "", "", "", "", Lit.UNKNOWN, "", "", "", "", "", Vis.UNKNOWN, Exh.UNKNOWN, "" };
    504522       
    505523        private ArrayList<Object[]> sectors = new ArrayList<Object[]>();
     
    528546        }
    529547
    530         public void clrLight() {
    531                 sectors.clear();
    532                 sectors.add(sector.clone());
    533         }
    534 
    535548        public void addLight(int i) {
    536549                if (sectors.size() >= i) {
    537                         sectors.add(i, sectors.get(0).clone());
     550                        if (sectors.size() == 0)
     551                                sectors.add(sector.clone());
     552                        else
     553                                sectors.add(i, sectors.get(0).clone());
    538554                }
    539555        }
    540556
    541557        public void addLight() {
    542                 sectors.add(sectors.get(0).clone());
    543         }
    544 
    545         public void subLight(int i) {
     558                if (sectors.size() == 0)
     559                        sectors.add(sector.clone());
     560                else
     561                        sectors.add(sectors.get(0).clone());
     562        }
     563
     564        public void delLight(int i) {
    546565                if (sectors.size() > i)
    547566                        sectors.remove(i);
     
    12771296                }
    12781297               
    1279                 clrLight();
     1298                sectors.clear();
     1299                sectors.add(sector.clone());
     1300                boolean found;
     1301                for (int i = 0; i < 30; i++) {
     1302                        found = false;
     1303                        addLight();
     1304                        String secStr = (i == 0) ? "" : (":" + Integer.toString(i));
     1305                        if (keys.containsKey("seamark:light" + secStr + ":colour")) {
     1306                                setLightAtt(Att.COL, i, keys.get("seamark:light" + secStr + ":colour"));
     1307                                found = true;
     1308                        }
     1309                        if (!found) {
     1310                                delLight(i);
     1311                                break;
     1312                        }
     1313                }
    12801314
    12811315                if (keys.containsKey("seamark:fog_signal")) {
     
    17291763                                if (!((String)sectors.get(i)[4]).isEmpty())
    17301764                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String)sectors.get(i)[4]));
    1731                                 if (!((String)sectors.get(i)[5]).isEmpty())
    1732                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String)sectors.get(i)[5]));
     1765                                if (sectors.get(i)[5] != Lit.UNKNOWN)
     1766                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[5])));
    17331767                                if (!((String)sectors.get(i)[6]).isEmpty())
    1734                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String)sectors.get(i)[6]));
     1768                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String)sectors.get(i)[6]));
    17351769                                if (!((String)sectors.get(i)[7]).isEmpty())
    1736                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String)sectors.get(i)[7]));
     1770                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String)sectors.get(i)[7]));
    17371771                                if (!((String)sectors.get(i)[8]).isEmpty())
    1738                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String)sectors.get(i)[8]));
     1772                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String)sectors.get(i)[8]));
    17391773                                if (!((String)sectors.get(i)[9]).isEmpty())
    1740                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String)sectors.get(i)[9]));
    1741                                 if (sectors.get(i)[10] != Vis.UNKNOWN)
    1742                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[10])));
    1743                                 if (sectors.get(i)[11] != Exh.UNKNOWN)
    1744                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[11])));
    1745                                 if (sectors.get(i)[12] != Lit.UNKNOWN)
    1746                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[12])));
     1774                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String)sectors.get(i)[9]));
     1775                                if (!((String)sectors.get(i)[10]).isEmpty())
     1776                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String)sectors.get(i)[10]));
     1777                                if (sectors.get(i)[11] != Vis.UNKNOWN)
     1778                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[11])));
     1779                                if (sectors.get(i)[12] != Exh.UNKNOWN)
     1780                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[12])));
    17471781                                if (!((String)sectors.get(i)[13]).isEmpty())
    17481782                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":orientation", (String)sectors.get(i)[13]));
Note: See TracChangeset for help on using the changeset viewer.