Ignore:
Timestamp:
2010-08-13T19:17:07+02:00 (14 years ago)
Author:
malcolmh
Message:

weekend

Location:
applications/editors/josm/plugins/toms/src/toms
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/toms/src/toms/dialogs/SmpDialogAction.java

    r22623 r22626  
    1919import javax.swing.ImageIcon;
    2020import javax.swing.JButton;
     21import javax.swing.JToggleButton;
    2122import javax.swing.JCheckBox;
    2223import javax.swing.JComboBox;
     
    108109        private JDialog dM01SeaMap = null;
    109110        private JPanel pM01SeaMap = null;
    110         private JLabel lM01Colour = null;
    111111        private JLabel lM01TimeUnit = null;
    112         private JLabel lM01HeightUnit = null;
    113         private JLabel lM01RangeUnit = null;
    114112        private JLabel lM01RepeatTime = null;
    115113        private JLabel lM01Kennung = null;
    116         private JLabel lM01Height = null;
    117         private JLabel lM01Range = null;
    118114        private JLabel lM01Name = null;
    119115        private JLabel lM01Props02 = null;
     
    123119        private JLabel lM01Head = null;
    124120        public JLabel lM01Icon01 = null;
    125         public JComboBox cbM01Region = null;
     121        public JToggleButton tbM01Region = null;
    126122        public JComboBox cbM01TypeOfMark = null;
    127123        public JComboBox cbM01StyleOfMark = null;
     
    135131        private JButton bM01Close = null;
    136132        public JTextField tfM01RepeatTime = null;
    137         public JTextField tfM01Range = null;
    138         public JTextField tfM01Height = null;
    139133        public JComboBox cbM01Kennung = null;
    140         public JComboBox cbM01Colour = null;
    141134        public JTextField tfM01FireMark = null;
    142135        private JCheckBox cM01IconVisible = null;
     
    320313                                "/images/Auge.png")));
    321314
    322                 cbM01Region.setEnabled(true);
     315                tbM01Region.setEnabled(true);
    323316                cbM01TypeOfMark.setEnabled(true);
    324317                cbM01StyleOfMark.setEnabled(true);
     
    342335
    343336                if (keys.containsKey("seamark") || keys.containsKey("seamark:type")) {
    344                         if (keys.containsKey("seamark:type")) {
    345                         }
    346 
    347                         if ((keys.containsKey("seamark:buoy_lateral:category") == true)
    348                                         || (keys.containsKey("seamark:beacon_lateral:category") == true)) {
     337
     338                        if (keys.containsKey("seamark:buoy_lateral:category")
     339                                        || keys.containsKey("seamark:beacon_lateral:category")) {
    349340
    350341                                buoy = null; // Prototyp der Lateraltonne
    351                                 int ind = 0; // index für cbM01TypeOfMark
    352342                                String cat; // Kathegorie
    353343
     
    385375                                        }
    386376                                        buoy.setName(name);
    387                                         ind = SeaMark.PORT_HAND;
    388377                                }
    389378
     
    399388                                        }
    400389                                        buoy.setName(name);
    401                                         ind = SeaMark.STARBOARD_HAND;
    402390                                }
    403391
     
    414402
    415403                                        buoy.setName(name);
    416                                         ind = SeaMark.PREF_PORT_HAND;
    417404                                }
    418405
     
    429416
    430417                                        buoy.setName(name);
    431                                         ind = SeaMark.PREF_STARBOARD_HAND;
    432418                                }
    433419
     
    455441                                        buoy.setNode(node);
    456442                                        buoy.setValid(true);
    457                                         buoy.setBuoyIndex(ind);
    458443                                        cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex());
    459444                                        buoy.paintSign();
     
    473458
    474459                                buoy = null; // Prototyp der Kardinaltonne
    475                                 int ind = 6; // index für cbM01TypeOfMark
    476460                                String cat; // Kathegorie
    477461
     
    485469                                if (name.compareTo("") == 0) {
    486470                                        if (keys.containsKey("seamark:buoy_cardinal:name"))
    487                                                 name = keys.get("seamark:buoy_lateral:name");
     471                                                name = keys.get("seamark:buoy_cardinal:name");
    488472                                        if (keys.containsKey("seamark:beacon_cardinal:name"))
    489                                                 name = keys.get("seamark:beacon_lateral:name");
     473                                                name = keys.get("seamark:beacon_cardinal:name");
    490474                                }
    491475
     
    507491
    508492                                        buoy.setName(name);
    509                                         ind = SeaMark.CARD_NORTH;
    510493                                } // Ende if(str.compareTo("black;yellow")== 0)
    511494
     
    519502
    520503                                        buoy.setName(name);
    521                                         ind = SeaMark.CARD_EAST;
    522504                                } // Ende if(str.compareTo("black;yellow;black")== 0)
    523505
     
    531513
    532514                                        buoy.setName(name);
    533                                         ind = SeaMark.CARD_SOUTH;
    534515                                } // Ende if(str.compareTo("yellow;black")== 0)
    535516
     
    543524
    544525                                        buoy.setName(name);
    545                                         ind = SeaMark.CARD_WEST;
    546526                                } // Ende if(str.compareTo("yellow;black;black")== 0)
    547527
     
    564544                                        buoy.setNode(node);
    565545                                        buoy.setValid(true);
    566                                         buoy.setBuoyIndex(ind);
    567546                                        cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex());
    568547                                        buoy.paintSign();
     
    579558
    580559                        // Test buoy_safewater
    581                         if (keys.containsKey("seamark:buoy_water:shape") == true) {
     560                        if (keys.containsKey("seamark:buoy_safe_water:shape") == true) {
    582561
    583562                                if (keys.containsKey("seamark:buoy_safe_water:colour") == false) {
     
    620599                                buoy.setValid(true);
    621600                                buoy.setNode(node);
    622                                 buoy.setBuoyIndex(5);
    623601                                cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex());
    624602                                buoy.paintSign();
     
    670648                                buoy.setValid(true);
    671649                                buoy.setNode(node);
    672                                 buoy.setBuoyIndex(5);
    673650                                cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex());
    674651                                buoy.paintSign();
     
    679656
    680657                        // Test buoy_isolated_danger
    681                         if ((keys.containsKey("seamark:buoy_isolated_danger:shape") == true)
    682                                         || (keys.containsKey("seamark:beacon_isolated_danger:shape") == true)) {
    683 
    684                                 if ((keys.containsKey("seamark:buoy_isolated_danger:colour") == false)
    685                                                 && (keys.containsKey("seamark:beacon_isolated_danger:colour") == false)) {
    686                                         buoy = new BuoyUkn(this, "Parse-Error: No colour set");
    687                                         buoy.setNode(node);
    688                                         return;
    689                                 }
    690 
    691                                 if (keys.containsKey("seamark:buoy_isolated_danger:shape") == true)
     658                        if ((keys.containsKey("seamark:buoy_isolated_danger:colour") == true)
     659                                        || (keys.containsKey("seamark:beacon_isolated_danger:colour") == true)) {
     660
     661                                if ((keys.containsKey("seamark:buoy_isolated_danger:colour") == true)
     662                                                && (keys.containsKey("seamark:buoy_isolated_danger:shape") == false)) {
     663                                        buoy = new BuoyUkn(this, "Parse-Error: No shape set");
     664                                        buoy.setNode(node);
     665                                        return;
     666                                }
     667
     668                                if (keys.containsKey("seamark:buoy_isolated_danger:colour") == true)
    692669                                        str = keys.get("seamark:buoy_isolated_danger:colour");
    693670                                else
     
    725702                                buoy.setValid(true);
    726703                                buoy.setNode(node);
    727                                 buoy.setBuoyIndex(5);
     704                                cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex());
     705                                buoy.paintSign();
     706
     707                                return;
     708
     709                        }
     710
     711                        // Test light_float
     712
     713                        if ((keys.containsKey("seamark:type") == true)
     714                                        && (keys.get("seamark:type").equals("light_float"))) {
     715
     716                                if (keys.containsKey("seamark:light_float:colour") == false) {
     717                                        buoy = new BuoyUkn(this, "Parse-Error: No colour set");
     718                                        buoy.setNode(node);
     719                                        return;
     720                                }
     721
     722                                str = keys.get("seamark:light_float:colour");
     723                                if (str.equals("red") || str.equals("green")
     724                                                || str.equals("red;green;red") || str.equals("green;red;green")) {
     725                                        boolean region = Main.pref.get("tomsplugin.IALA").equals("B");
     726                                        if (str.equals("red")) {
     727                                                if ((keys.containsKey("seamark:topmark:shape") && keys.get(
     728                                                                "seamark:topmark:shape").equals("cylinder"))
     729                                                                || (region == SeaMark.IALA_A)) {
     730                                                        buoy = new BuoyLat(this, SeaMark.PORT_HAND);
     731                                                } else {
     732                                                        buoy = new BuoyLat(this, SeaMark.STARBOARD_HAND);
     733                                                }
     734                                                buoy.setColour(SeaMark.RED);
     735                                        } else if (str.equals("green")) {
     736                                                if ((keys.containsKey("seamark:topmark:shape") && keys.get(
     737                                                                "seamark:topmark:shape").equals("cone, point up"))
     738                                                                || (region == SeaMark.IALA_A)) {
     739                                                        buoy = new BuoyLat(this, SeaMark.STARBOARD_HAND);
     740                                                } else {
     741                                                        buoy = new BuoyLat(this, SeaMark.PORT_HAND);
     742                                                }
     743                                                buoy.setColour(SeaMark.GREEN);
     744                                        } else if (str.equals("red;green;red")) {
     745                                                if ((keys.containsKey("seamark:topmark:shape") && keys.get(
     746                                                                "seamark:topmark:shape").equals("cylinder"))
     747                                                                || (region == SeaMark.IALA_A)) {
     748                                                        buoy = new BuoyLat(this, SeaMark.PREF_PORT_HAND);
     749                                                } else {
     750                                                        buoy = new BuoyLat(this, SeaMark.PREF_STARBOARD_HAND);
     751                                                }
     752                                                buoy.setColour(SeaMark.RED_GREEN_RED);
     753                                        } else if (str.equals("green;red;green")) {
     754                                                if ((keys.containsKey("seamark:topmark:shape") && keys.get(
     755                                                                "seamark:topmark:shape").equals("cone, point up"))
     756                                                                || (region == SeaMark.IALA_A)) {
     757                                                        buoy = new BuoyLat(this, SeaMark.PREF_STARBOARD_HAND);
     758                                                } else {
     759                                                        buoy = new BuoyLat(this, SeaMark.PREF_PORT_HAND);
     760                                                }
     761                                                buoy.setColour(SeaMark.GREEN_RED_GREEN);
     762                                        }
     763                                } else if (str.equals("black;yellow")) {
     764                                        buoy = new BuoyCard(this, SeaMark.CARD_NORTH);
     765                                        buoy.setColour(SeaMark.BLACK_YELLOW);
     766                                } else if (str.equals("black;yellow;black")) {
     767                                        buoy = new BuoyCard(this, SeaMark.CARD_EAST);
     768                                        buoy.setColour(SeaMark.BLACK_YELLOW_BLACK);
     769                                } else if (str.equals("yellow;black")) {
     770                                        buoy = new BuoyCard(this, SeaMark.CARD_SOUTH);
     771                                        buoy.setColour(SeaMark.YELLOW_BLACK);
     772                                } else if (str.equals("yellow;black;yellow")) {
     773                                        buoy = new BuoyCard(this, SeaMark.CARD_WEST);
     774                                        buoy.setColour(SeaMark.YELLOW_BLACK_YELLOW);
     775                                } else if (str.equals("black;red;black")) {
     776                                        buoy = new BuoyIsol(this, SeaMark.ISOLATED_DANGER);
     777                                        buoy.setColour(SeaMark.BLACK_RED_BLACK);
     778                                } else if (str.equals("red;white")) {
     779                                        buoy = new BuoySaw(this, SeaMark.SAFE_WATER);
     780                                        buoy.setColour(SeaMark.RED_WHITE);
     781                                } else {
     782                                        buoy = new BuoyUkn(this, "Parse-Error: Invalid colour");
     783                                        buoy.setNode(node);
     784                                        return;
     785                                }
     786
     787                                buoy.setName(name);
     788
     789                                if (buoy.parseTopMark(node) == false) {
     790                                        str = buoy.getErrMsg();
     791                                        if (str == null)
     792                                                buoy.setValid(false);
     793                                }
     794
     795                                if (buoy.parseLight(node) == false) {
     796                                        str = buoy.getErrMsg();
     797                                        if (str == null)
     798                                                buoy.setValid(false);
     799                                }
     800
     801                                if (buoy.parseShape(node) == false) {
     802                                        str = buoy.getErrMsg();
     803                                        if (str == null)
     804                                                buoy = new BuoyUkn(this, str);
     805                                        buoy.setNode(node);
     806                                        return;
     807                                }
     808
     809                                buoy.setValid(true);
     810                                buoy.setNode(node);
    728811                                cbM01StyleOfMark.setSelectedIndex(buoy.getStyleIndex());
    729812                                buoy.paintSign();
     
    780863                if (pM01SeaMap == null) {
    781864                        lM01TimeUnit = new JLabel();
    782                         lM01TimeUnit.setBounds(new Rectangle(125, 250, 26, 20));
     865                        lM01TimeUnit.setBounds(new Rectangle(325, 230, 26, 20));
    783866                        lM01TimeUnit.setFont(new Font("Dialog", Font.PLAIN, 12));
    784867                        lM01TimeUnit.setText("s");
    785868
    786                         lM01HeightUnit = new JLabel();
    787                         lM01HeightUnit.setBounds(new Rectangle(220, 250, 26, 20));
    788                         lM01HeightUnit.setFont(new Font("Dialog", Font.PLAIN, 12));
    789                         lM01HeightUnit.setText("m");
    790 
    791                         lM01RangeUnit = new JLabel();
    792                         lM01RangeUnit.setBounds(new Rectangle(320, 250, 26, 20));
    793                         lM01RangeUnit.setFont(new Font("Dialog", Font.PLAIN, 12));
    794                         lM01RangeUnit.setText("M");
    795 
    796                         lM01Height = new JLabel();
    797                         lM01Height.setBounds(new Rectangle(140, 250, 70, 20));
    798                         lM01Height.setFont(new Font("Dialog", Font.PLAIN, 12));
    799                         lM01Height.setText("Height:");
    800 
    801                         lM01Range = new JLabel();
    802                         lM01Range.setBounds(new Rectangle(240, 250, 70, 20));
    803                         lM01Range.setFont(new Font("Dialog", Font.PLAIN, 12));
    804                         lM01Range.setText("Range:");
    805 
    806869                        lM01RepeatTime = new JLabel();
    807                         lM01RepeatTime.setBounds(new Rectangle(45, 250, 70, 20));
     870                        lM01RepeatTime.setBounds(new Rectangle(245, 230, 70, 20));
    808871                        lM01RepeatTime.setFont(new Font("Dialog", Font.PLAIN, 12));
    809872                        lM01RepeatTime.setText("Period:");
     
    814877                        lM01Kennung.setText("Character:");
    815878
    816                         lM01Colour = new JLabel();
    817                         lM01Colour.setBounds(new Rectangle(240, 230, 60, 20));
    818                         lM01Colour.setFont(new Font("Dialog", Font.PLAIN, 12));
    819                         lM01Colour.setText("Colour:");
    820 
    821879                        lM01Name = new JLabel();
    822880                        lM01Name.setBounds(new Rectangle(5, 120, 82, 16));
     
    856914                        pM01SeaMap.setLayout(null);
    857915                        pM01SeaMap.add(lM01TimeUnit, null);
    858 //                      pM01SeaMap.add(lM01HeightUnit, null);
    859 //                      pM01SeaMap.add(lM01RangeUnit, null);
    860 //                      pM01SeaMap.add(lM01Height, null);
    861 //                      pM01SeaMap.add(lM01Range, null);
    862916                        pM01SeaMap.add(lM01RepeatTime, null);
    863                         pM01SeaMap.add(lM01Colour, null);
    864917                        pM01SeaMap.add(lM01Kennung, null);
    865918                        pM01SeaMap.add(lM01Name, null);
     
    870923                        pM01SeaMap.add(lM01Head, null);
    871924                        pM01SeaMap.add(lM01Icon01, null);
    872                         pM01SeaMap.add(getCbM01Region(), null);
     925                        pM01SeaMap.add(getTbM01Region(), null);
    873926                        pM01SeaMap.add(getCbM01TypeOfMark(), null);
    874927                        pM01SeaMap.add(getCbM01StyleOfMark(), null);
     
    882935                        pM01SeaMap.add(getBM01Close(), null);
    883936                        pM01SeaMap.add(getTfM01RepeatTime(), null);
    884 //                      pM01SeaMap.add(getTfM01Range(), null);
    885 //                      pM01SeaMap.add(getTfM01Height(), null);
    886937                        pM01SeaMap.add(getCbM01Kennung(), null);
    887                         pM01SeaMap.add(getCbM01Colour(), null);
    888938                        pM01SeaMap.add(getTfM01FireMark(), null);
    889939                        pM01SeaMap.add(getCM01IconVisible(), null);
     
    948998                                                        buoy.setColour(SeaMark.RED);
    949999                                                        buoy.setRegion(SeaMark.IALA_A);
    950                                                         cbM01Region.setSelectedIndex(SeaMark.IALA_A);
     1000                                                        tbM01Region.setSelected(SeaMark.IALA_A);
    9511001                                                } else {
    9521002                                                        buoy.setColour(SeaMark.GREEN);
     
    9601010                                                        buoy.setColour(SeaMark.GREEN);
    9611011                                                        buoy.setRegion(SeaMark.IALA_A);
    962                                                         cbM01Region.setSelectedIndex(SeaMark.IALA_A);
     1012                                                        tbM01Region.setSelected(SeaMark.IALA_A);
    9631013                                                } else {
    9641014                                                        buoy.setColour(SeaMark.RED);
     
    9721022                                                        buoy.setColour(SeaMark.RED_GREEN_RED);
    9731023                                                        buoy.setRegion(SeaMark.IALA_A);
    974                                                         cbM01Region.setSelectedIndex(SeaMark.IALA_A);
     1024                                                        tbM01Region.setSelected(SeaMark.IALA_A);
    9751025                                                } else {
    9761026                                                        buoy.setColour(SeaMark.GREEN_RED_GREEN);
     
    9841034                                                        buoy.setColour(SeaMark.GREEN_RED_GREEN);
    9851035                                                        buoy.setRegion(SeaMark.IALA_A);
    986                                                         cbM01Region.setSelectedIndex(SeaMark.IALA_A);
     1036                                                        tbM01Region.setSelected(SeaMark.IALA_A);
    9871037                                                } else {
    9881038                                                        buoy.setColour(SeaMark.RED_GREEN_RED);
     
    10371087        }
    10381088
    1039         private JComboBox getCbM01Region() {
    1040                 if (cbM01Region == null) {
    1041                         cbM01Region = new JComboBox();
    1042 
    1043                         // Inhalt der ComboBox
    1044                         cbM01Region.addItem("Not set");
    1045                         cbM01Region.addItem("IALA-A");
    1046                         cbM01Region.addItem("IALA-B");
    1047 
    1048                         cbM01Region.setBounds(new Rectangle(60, 55, 100, 25));
    1049                         cbM01Region.setEditable(false);
    1050                         cbM01Region.setFont(new Font("Dialog", Font.PLAIN, 12));
    1051                         cbM01Region.setEnabled(true);
    1052 
    1053                         cbM01Region.addActionListener(new java.awt.event.ActionListener() {
     1089        private JToggleButton getTbM01Region() {
     1090                if (tbM01Region == null) {
     1091                        tbM01Region = new JToggleButton();
     1092
     1093                        tbM01Region.setBounds(new Rectangle(60, 55, 80, 25));
     1094                        tbM01Region.setFont(new Font("Dialog", Font.PLAIN, 12));
     1095                        tbM01Region.setEnabled(false);
     1096                        if (Main.pref.get("tomsplugin.IALA").equals("B")) {
     1097                                tbM01Region.setSelected(true);
     1098                                tbM01Region.setText("IALA-B");
     1099                        } else {
     1100                                tbM01Region.setSelected(false);
     1101                                tbM01Region.setText("IALA-A");
     1102                        }
     1103
     1104                        tbM01Region.addActionListener(new java.awt.event.ActionListener() {
    10541105                                public void actionPerformed(java.awt.event.ActionEvent e) {
    1055                                         buoy.setRegion(cbM01Region.getSelectedIndex());
     1106                                        if (tbM01Region.isSelected()) {
     1107                                                buoy.setRegion(true);
     1108                                                tbM01Region.setText("IALA-B");
     1109                                        } else {
     1110                                                buoy.setRegion(false);
     1111                                                tbM01Region.setText("IALA-A");
     1112                                        }
    10561113                                        if (buoy instanceof BuoyLat)
    10571114                                                buoy.setLightColour();
     
    10611118                }
    10621119
    1063                 return cbM01Region;
     1120                return tbM01Region;
    10641121        }
    10651122
     
    12251282                if (tfM01RepeatTime == null) {
    12261283                        tfM01RepeatTime = new JTextField();
    1227                         tfM01RepeatTime.setBounds(new Rectangle(90, 250, 30, 20));
     1284                        tfM01RepeatTime.setBounds(new Rectangle(290, 230, 30, 20));
    12281285                        tfM01RepeatTime.addActionListener(new java.awt.event.ActionListener() {
    12291286                                public void actionPerformed(java.awt.event.ActionEvent e) {
     
    12461303
    12471304                return tfM01RepeatTime;
    1248         }
    1249 
    1250         private JTextField getTfM01Range() {
    1251                 if (tfM01Range == null) {
    1252                         tfM01Range = new JTextField();
    1253                         tfM01Range.setBounds(new Rectangle(285, 250, 30, 20));
    1254                         tfM01Range.setEnabled(false);
    1255                         tfM01Range.addActionListener(new java.awt.event.ActionListener() {
    1256                                 public void actionPerformed(java.awt.event.ActionEvent e) {
    1257                                         String s = tfM01Range.getText();
    1258 
    1259                                         buoy.setRange(s);
    1260                                         buoy.paintSign();
    1261                                 }
    1262                         });
    1263 
    1264                         tfM01Range.addFocusListener(new java.awt.event.FocusAdapter() {
    1265                                 public void focusLost(java.awt.event.FocusEvent e) {
    1266                                         String s = tfM01Range.getText();
    1267 
    1268                                         buoy.setRange(s);
    1269                                         buoy.paintSign();
    1270                                 }
    1271                         });
    1272                 }
    1273 
    1274                 return tfM01Range;
    1275         }
    1276 
    1277         private JTextField getTfM01Height() {
    1278                 if (tfM01Height == null) {
    1279                         tfM01Height = new JTextField();
    1280                         tfM01Height.setBounds(new Rectangle(185, 250, 30, 20));
    1281                         tfM01Height.setEnabled(false);
    1282                         tfM01Height.addActionListener(new java.awt.event.ActionListener() {
    1283                                 public void actionPerformed(java.awt.event.ActionEvent e) {
    1284                                         String s = tfM01Height.getText();
    1285 
    1286                                         buoy.setHeight(s);
    1287                                         buoy.paintSign();
    1288                                 }
    1289                         });
    1290 
    1291                         tfM01Height.addFocusListener(new java.awt.event.FocusAdapter() {
    1292                                 public void focusLost(java.awt.event.FocusEvent e) {
    1293                                         String s = tfM01Height.getText();
    1294 
    1295                                         buoy.setHeight(s);
    1296                                         buoy.paintSign();
    1297                                 }
    1298                         });
    1299                 }
    1300 
    1301                 return tfM01Height;
    13021305        }
    13031306
     
    13521355
    13531356                return cbM01Kennung;
    1354         }
    1355 
    1356         private JComboBox getCbM01Colour() {
    1357                 if (cbM01Colour == null) {
    1358                         cbM01Colour = new JComboBox();
    1359                         cbM01Colour.setBounds(new Rectangle(285, 230, 50, 20));
    1360                         cbM01Colour.addActionListener(new java.awt.event.ActionListener() {
    1361                                 public void actionPerformed(java.awt.event.ActionEvent e) {
    1362                                         String it = (String) cbM01Colour.getSelectedItem();
    1363 
    1364                                         if (it == null)
    1365                                                 return;
    1366 
    1367                                         if (it.compareTo("Not set") == 0)
    1368                                                 return;
    1369 
    1370                                         if (buoy == null) {
    1371                                                 return;
    1372                                         }
    1373                                         buoy.setLightColour(it);
    1374                                         buoy.paintSign();
    1375                                 }
    1376                         });
    1377                 }
    1378 
    1379                 return cbM01Colour;
    13801357        }
    13811358
  • applications/editors/josm/plugins/toms/src/toms/seamarks/SeaMark.java

    r22623 r22626  
    5656         * Regions
    5757         */
    58         public final static int UNKNOWN_REGION = 0;
    59         public final static int IALA_A = 1;
    60         public final static int IALA_B = 2;
     58        public final static boolean IALA_A = false;
     59        public final static boolean IALA_B = true;
    6160
    6261        /**
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java

    r22623 r22626  
    4747        }
    4848
    49         private int Region = 0;
    50 
    51         public int getRegion() {
     49        private boolean Region = false;
     50
     51        public boolean getRegion() {
    5252                return Region;
    5353        }
    5454
    55         public void setRegion(int region) {
     55        public void setRegion(boolean region) {
    5656                Region = region;
     57                dlg.tbM01Region.setSelected(region);
     58                dlg.tbM01Region.setText(region ? "IALA-B" : "IALA-A");
    5759        }
    5860
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java

    r22623 r22626  
    2828                dlg.cbM01StyleOfMark.addItem("Float");
    2929
    30                 dlg.cbM01Colour.removeAllItems();
    31                 dlg.cbM01Colour.addItem("W");
    32                 dlg.cbM01Colour.setSelectedIndex(0);
    33                 dlg.cbM01Colour.setEnabled(false);
    3430                dlg.cM01Fired.setSelected(false);
    3531                dlg.cM01TopMark.setSelected(false);
    36 
     32                dlg.tbM01Region.setEnabled(false);
     33
     34                setBuoyIndex(type);
    3735                setStyleIndex(0);
    38                 setBuoyIndex(type);
    3936                setLightColour("W");
    4037
     
    251248                        else if (str.compareTo("spar") == 0)
    252249                                setStyleIndex(CARD_SPAR);
    253                         else if (str.compareTo("float") == 0)
    254                                 setStyleIndex(CARD_FLOAT);
    255250                        else
    256251                                ret = false;
    257                 } else if (keys.containsKey("seamark:beacon_cardinal")) {
     252                } else if (keys.containsKey("seamark:beacon_cardinal:colour")) {
    258253                        if (keys.containsKey("seamark:beacon_cardinal:shape")) {
    259254                                str = keys.get("seamark:beacon_cardinal:shape");
     
    261256                                if (str.compareTo("tower") == 0)
    262257                                        setStyleIndex(CARD_TOWER);
     258                                else
     259                                        setStyleIndex(CARD_BEACON);
    263260                        } else
    264261                                setStyleIndex(CARD_BEACON);
     262                } else if ((keys.containsKey("seamark:type") == true)
     263                                && (keys.get("seamark:type").equals("light_float"))) {
     264                        setStyleIndex(CARD_FLOAT);
    265265                }
    266266                return ret;
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java

    r22623 r22626  
    3131                dlg.cbM01Kennung.addItem("Fl(2)");
    3232
    33                 dlg.cbM01Colour.removeAllItems();
    34                 dlg.cbM01Colour.addItem("W");
    35                 dlg.cbM01Colour.setSelectedIndex(0);
    36                 dlg.cbM01Colour.setEnabled(false);
    3733                dlg.cM01Fired.setSelected(false);
    3834                dlg.cM01TopMark.setSelected(true);
    3935                dlg.cM01TopMark.setEnabled(false);
     36                dlg.tbM01Region.setEnabled(false);
    4037
    4138                setColour(SeaMark.BLACK_RED_BLACK);
     
    243240                        else
    244241                                ret = false;
    245                 }
    246                 if (keys.containsKey("seamark:beacon_isolated_danger:shape")) {
    247                         str = keys.get("seamark:beacon_isolated_danger:shape");
    248 
    249                         if (str.compareTo("stake") == 0)
     242                } else if (keys.containsKey("seamark:beacon_isolated_danger:colour")) {
     243                        if (keys.containsKey("seamark:beacon_isolated_danger:shape")) {
     244                                str = keys.get("seamark:beacon_isolated_danger:shape");
     245
     246                                if (str.compareTo("tower") == 0)
     247                                        setStyleIndex(ISOL_TOWER);
     248                                else
     249                                        setStyleIndex(ISOL_BEACON);
     250                        } else
    250251                                setStyleIndex(ISOL_BEACON);
    251                         else
    252                                 ret = false;
    253                 }
    254 
     252                } else if ((keys.containsKey("seamark:type") == true)
     253                                && (keys.get("seamark:type").equals("light_float"))) {
     254                        setStyleIndex(CARD_FLOAT);
     255                }
    255256                return ret;
    256257        }
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java

    r22623 r22626  
    3232                dlg.cbM01Kennung.setSelectedIndex(0);
    3333
    34                 dlg.cbM01Colour.removeAllItems();
    35                 dlg.cbM01Colour.addItem("");
    36                 dlg.cbM01Colour.addItem("R");
    37                 dlg.cbM01Colour.addItem("G");
    38                 dlg.cbM01Colour.setSelectedIndex(0);
    39                 dlg.cbM01Colour.setEnabled(false);
    40 
    4134                setBuoyIndex(type);
    4235                setStyleIndex(0);
     
    4437                setFired(false);
    4538                setTopMark(false);
     39                setRegion(Main.pref.get("tomsplugin.IALA").equals("B"));
    4640
    4741                refreshStyles();
     
    119113
    120114                int cat = getBuoyIndex();
    121                 int region = getRegion();
     115                boolean region = getRegion();
    122116                int style = getStyleIndex();
    123117
     
    351345                        image += ".png";
    352346
    353 // System.out.println("finename: " + image);
     347                        // System.out.println("finename: " + image);
    354348                        dlg.lM01Icon01.setIcon(new ImageIcon(getClass().getResource(image)));
    355349                } else
     
    701695
    702696                saveTopMarkData(shape, colour);
    703 
    704697                saveLightData(colour);
     698
     699                Main.pref.put("tomsplugin.IALA", getRegion() ? "B" : "A");
    705700        }
    706701
     
    723718                        case PORT_HAND:
    724719                        case PREF_PORT_HAND:
    725                                 if (str.compareTo("cylinder") == 0) {
     720                                if (str.equals("cylinder")) {
    726721                                        setTopMark(true);
    727 
     722                                        setRegion(IALA_A);
     723                                } else if (str.equals("cone, point up")) {
     724                                        setTopMark(true);
     725                                        setRegion(IALA_B);
    728726                                } else {
    729727                                        setTopMark(false);
     
    734732                        case STARBOARD_HAND:
    735733                        case PREF_STARBOARD_HAND:
    736                                 if (str.compareTo("cone, point up") == 0 || str.compareTo("cone") == 0) {
     734                                if (str.equals("cone, point up")) {
    737735                                        setTopMark(true);
    738 
     736                                        setRegion(IALA_A);
     737                                } else if (str.equals("cylinder")) {
     738                                        setTopMark(true);
     739                                        setRegion(IALA_B);
    739740                                } else {
    740741                                        setTopMark(false);
     
    746747                                ret = false;
    747748                        }
    748 
    749749                        if (!hasTopMark()) {
    750750                                setErrMsg("Parse-Error: Topmark falsch");
    751751                                ret = false;
    752752                        }
    753 
    754                 }
    755 
     753                }
    756754                return ret;
    757755        }
     
    779777
    780778                        if (isFired()) {
     779
    781780                        } else {
    782781                                if (getErrMsg() == null)
     
    792791
    793792        public void setLightColour() {
    794                 if (getRegion() != IALA_B
     793                if (getRegion() == IALA_A
    795794                                && (getBuoyIndex() == PORT_HAND || getBuoyIndex() == PREF_PORT_HAND)) {
    796795                        super.setLightColour("R");
    797                         dlg.cbM01Colour.setSelectedIndex(RED_LIGHT);
    798796                } else {
    799797                        super.setLightColour("G");
    800                         dlg.cbM01Colour.setSelectedIndex(GREEN_LIGHT);
    801798                }
    802799        }
     
    812809                case PORT_HAND:
    813810                case PREF_PORT_HAND:
    814                         if (str.compareTo("red") == 0) {
    815 
    816                                 setFired(true);
    817                                 super.setLightColour("R");
     811                        if (getRegion() == IALA_A) {
     812                                if (str.compareTo("red") == 0) {
     813                                        setFired(true);
     814                                        super.setLightColour("R");
     815                                } else {
     816                                        super.setLightColour("");
     817                                }
    818818                        } else {
    819                                 super.setLightColour("");
    820                         }
    821 
     819                                if (str.compareTo("green") == 0) {
     820                                        setFired(true);
     821                                        super.setLightColour("G");
     822                                } else {
     823                                        super.setLightColour("");
     824                                }
     825                        }
    822826                        break;
    823827
    824828                case STARBOARD_HAND:
    825829                case PREF_STARBOARD_HAND:
    826                         if (str.compareTo("green") == 0) {
    827                                 setFired(true);
    828                                 super.setLightColour("G");
     830                        if (getRegion() == IALA_A) {
     831                                if (str.compareTo("green") == 0) {
     832                                        setFired(true);
     833                                        super.setLightColour("G");
     834                                } else {
     835                                        super.setLightColour("");
     836                                }
    829837                        } else {
    830                                 super.setLightColour("");
     838                                if (str.compareTo("red") == 0) {
     839                                        setFired(true);
     840                                        super.setLightColour("R");
     841                                } else {
     842                                        super.setLightColour("");
     843                                }
    831844                        }
    832845                        break;
     
    856869                                else if (str.compareTo("spar") == 0)
    857870                                        setStyleIndex(LAT_SPAR);
    858                                 else if (str.compareTo("float") == 0)
    859                                         setStyleIndex(LAT_FLOAT);
    860                                 else if (str.compareTo("perch") == 0)
    861                                         setStyleIndex(LAT_PERCH);
    862871                                else
    863872                                        ret = false;
     
    882891                                else if (str.compareTo("spar") == 0)
    883892                                        setStyleIndex(LAT_SPAR);
    884                                 else if (str.compareTo("float") == 0)
    885                                         setStyleIndex(LAT_FLOAT);
    886                                 else if (str.compareTo("perch") == 0)
    887                                         setStyleIndex(LAT_PERCH);
    888893                                else
    889894                                        ret = false;
     
    904909                                ret = false;
    905910                        }
    906                 } else if (keys.containsKey("seamark:beacon_lateral:shape")) {
    907                         str = keys.get("seamark:beacon_lateral:shape");
    908 
    909                         int cat = getBuoyIndex();
    910                         switch (cat) {
    911                         case PORT_HAND:
    912                                 if (str.compareTo("stake") == 0)
    913                                         setStyleIndex(LAT_BEACON);
    914                                 else if (str.compareTo("tower") == 0)
     911                } else if (keys.containsKey("seamark:beacon_lateral:colour")) {
     912                        if (keys.containsKey("seamark:beacon_lateral:shape")) {
     913                                str = keys.get("seamark:beacon_lateral:shape");
     914                                if (str.compareTo("tower") == 0)
    915915                                        setStyleIndex(LAT_TOWER);
    916916                                else
    917                                         ret = false;
    918                                 break;
    919 
    920                         case PREF_PORT_HAND:
    921                                 if (str.compareTo("stake") == 0)
    922917                                        setStyleIndex(LAT_BEACON);
    923                                 else if (str.compareTo("tower") == 0)
    924                                         setStyleIndex(LAT_TOWER);
    925                                 else
    926                                         ret = false;
    927                                 break;
    928 
    929                         case STARBOARD_HAND:
    930                                 if (str.compareTo("stake") == 0)
    931                                         setStyleIndex(LAT_BEACON);
    932                                 else if (str.compareTo("tower") == 0)
    933                                         setStyleIndex(LAT_TOWER);
    934                                 else
    935                                         ret = false;
    936                                 break;
    937 
    938                         case PREF_STARBOARD_HAND:
    939                                 if (str.compareTo("stake") == 0)
    940                                         setStyleIndex(LAT_BEACON);
    941                                 else if (str.compareTo("tower") == 0)
    942                                         setStyleIndex(LAT_TOWER);
    943                                 else
    944                                         ret = false;
    945                                 break;
    946 
    947                         default:
    948                                 ret = false;
    949                         }
     918                        } else
     919                                setStyleIndex(LAT_BEACON);
     920                } else if ((keys.containsKey("seamark:type") == true)
     921                                && (keys.get("seamark:type").equals("light_float"))) {
     922                        setStyleIndex(LAT_FLOAT);
    950923                }
    951924                return ret;
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyNota.java

    r22623 r22626  
    3232                dlg.cbM01Kennung.setSelectedIndex(0);
    3333
    34                 dlg.cbM01Colour.removeAllItems();
    35                 dlg.cbM01Colour.addItem("Not set");
    36                 dlg.cbM01Colour.addItem("R");
    37                 dlg.cbM01Colour.addItem("G");
    38                 dlg.cbM01Colour.addItem("W");
    39                 dlg.cbM01Colour.setEnabled(true);
     34                dlg.tbM01Region.setEnabled(false);
    4035
    4136                setBuoyIndex(type);
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java

    r22623 r22626  
    3333                dlg.cbM01Kennung.addItem("Mo()");
    3434
    35                 dlg.cbM01Colour.removeAllItems();
    36                 dlg.cbM01Colour.addItem("W");
    37                 dlg.cbM01Colour.setSelectedIndex(0);
    38                 dlg.cbM01Colour.setEnabled(false);
    3935                dlg.cM01Fired.setSelected(false);
    4036                dlg.cM01TopMark.setSelected(false);
     37                dlg.tbM01Region.setEnabled(false);
    4138
    4239                setColour(SeaMark.RED_WHITE);
     
    227224                        else if (str.compareTo("sphere") == 0)
    228225                                setStyleIndex(SAFE_SPHERE);
    229                         else if (str.compareTo("float") == 0)
    230                                 setStyleIndex(SAFE_FLOAT);
    231226                        else
    232227                                ret = false;
     228                } else if ((keys.containsKey("seamark:type") == true)
     229                                && (keys.get("seamark:type").equals("light_float"))) {
     230                        setStyleIndex(SAFE_FLOAT);
    233231                }
    234232
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java

    r22623 r22626  
    2828                dlg.cbM01Kennung.addItem("Not set");
    2929
    30                 dlg.cbM01Colour.removeAllItems();
    31                 dlg.cbM01Colour.addItem("W");
    32                 dlg.cbM01Colour.setSelectedIndex(0);
    33                 dlg.cbM01Colour.setEnabled(false);
    3430                dlg.cM01Fired.setSelected(false);
    3531                dlg.cM01TopMark.setSelected(false);
     32                dlg.tbM01Region.setEnabled(false);
    3633
    3734                setColour(SeaMark.YELLOW);
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyUkn.java

    r22623 r22626  
    1313                super(dia);
    1414
    15                 setBuoyIndex(0);
    1615                if (dlg.cbM01Kennung != null) {
    1716                        dlg.cbM01Kennung.removeAllItems();
     
    1918                }
    2019
    21                 dlg.cbM01Colour.removeAllItems();
    22                 dlg.cbM01Colour.setEnabled(false);
    2320                dlg.cM01Fired.setSelected(false);
    2421                dlg.cM01TopMark.setSelected(false);
     22                dlg.tbM01Region.setEnabled(false);
    2523
    2624                setErrMsg(Msg);
     
    2927                setFired(false);
    3028                setValid(false);
     29                setBuoyIndex(0);
    3130
    3231                paintSign();
Note: See TracChangeset for help on using the changeset viewer.