Changeset 26423 in osm for applications/editors


Ignore:
Timestamp:
2011-07-31T17:26:07+02:00 (13 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed/plugs/oseam/src
Files:
255 added
165 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java

    r26173 r26423  
    4949                                node = null;
    5050                                mark = null;
    51                                 panelMain.clearSelections();
    5251                                manager.showVisualMessage(Messages.getString("SelectNode"));
    5352                        }
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java

    r26297 r26423  
    7878                                panelPort.setVisible(true);
    7979                                panelPort.perchButton.setVisible(true);
     80                                panelPort.stakeButton.setVisible(true);
    8081                        } else {
    8182                                portButton.setBorderPainted(false);
     
    100101                                panelPort.setVisible(true);
    101102                                panelPort.perchButton.setVisible(false);
     103                                panelPort.stakeButton.setVisible(false);
     104                                if (dlg.mark.getShape() == Shp.PERCH || dlg.mark.getShape() == Shp.STAKE) {
     105                                        dlg.mark.setShape(Shp.UNKNOWN);
     106                                        panelPort.clearSelections();
     107                                }
    102108                        } else {
    103109                                prefPortButton.setBorderPainted(false);
     
    142148                                panelStbd.setVisible(true);
    143149                                panelStbd.perchButton.setVisible(true);
     150                                panelStbd.stakeButton.setVisible(true);
    144151                        } else {
    145152                                stbdButton.setBorderPainted(false);
     
    164171                                panelStbd.setVisible(true);
    165172                                panelStbd.perchButton.setVisible(false);
     173                                panelStbd.stakeButton.setVisible(false);
     174                                if (dlg.mark.getShape() == Shp.PERCH || dlg.mark.getShape() == Shp.STAKE) {
     175                                        dlg.mark.setShape(Shp.UNKNOWN);
     176                                        panelStbd.clearSelections();
     177                                }
    166178                        } else {
    167179                                prefStbdButton.setBorderPainted(false);
     
    189201                                panelSaw.setVisible(false);
    190202                        }
    191                         if (dlg.mark != null)
    192                                 dlg.mark.paintSign();
    193203                }
    194204        };
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java

    r26268 r26423  
    8686                                isolButton.setBorderPainted(false);
    8787                        }
    88                         if (dlg.mark != null)
    89                                 dlg.mark.paintSign();
    9088                }
    9189        };
     
    117115                                        button.setBorderPainted(false);
    118116                        }
    119                         if (dlg.mark != null)
    120                                 dlg.mark.paintSign();
    121117                }
    122118        };
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLights.java

    r26173 r26423  
    4040                                        button.setBorderPainted(false);
    4141                        }
    42                         if (dlg.mark != null)
    43                                 dlg.mark.paintSign();
    4442                }
    4543        };
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLit.java

    r26297 r26423  
    8787                                        panelSector.setVisible(false);
    8888                                }
    89                                 dlg.mark.paintSign();
    9089                        }
    9190                };
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPort.java

    r26297 r26423  
    5858        public JRadioButton towerButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/TowerButton.png")));
    5959        public JRadioButton perchButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PerchPButton.png")));
     60        public JRadioButton stakeButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/StakeButton.png")));
    6061        public EnumMap<Shp, JRadioButton> shapes = new EnumMap<Shp, JRadioButton>(Shp.class);
    6162        public EnumMap<Shp, Obj> objects = new EnumMap<Shp, Obj>(Shp.class);
     
    7172                                        button.setBorderPainted(false);
    7273                        }
    73                         if (dlg.mark != null)
    74                                 dlg.mark.paintSign();
     74                        dlg.mark.paintSign();
    7575                }
    7676        };
     
    8585                this.add(getShapeButton(sparButton, 0, 32, 34, 32, "Spar", Shp.SPAR, Obj.BOYLAT), null);
    8686                this.add(getShapeButton(canButton, 0, 64, 34, 32, "Can", Shp.CAN, Obj.BOYLAT), null);
    87                 this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj.LITFLT), null);
    88                 this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT), null);
     87                this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj.BOYLAT), null);
     88                this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.FLTLAT), null);
    8989                this.add(getShapeButton(beaconButton, 35, 0, 34, 32, "Beacon", Shp.BEACON, Obj.BCNLAT), null);
    9090                this.add(getShapeButton(towerButton, 35, 32, 34, 32, "Tower", Shp.TOWER, Obj.BCNLAT), null);
    9191                this.add(getShapeButton(perchButton, 35, 64, 34, 32, "Perch", Shp.PERCH, Obj.BCNLAT), null);
     92                this.add(getShapeButton(stakeButton, 35, 96, 34, 32, "Stake", Shp.STAKE, Obj.BCNLAT), null);
    9293        }
    9394
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSaw.java

    r26173 r26423  
    2525        public JRadioButton sparButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/SparButton.png")));
    2626        public JRadioButton sphereButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/SphereButton.png")));
    27         public JRadioButton barrelButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/BarrelButton.png")));
    2827        public JRadioButton floatButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/FloatButton.png")));
     28        public JRadioButton beaconButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/BeaconButton.png")));
    2929        public EnumMap<Shp, JRadioButton> shapes = new EnumMap<Shp, JRadioButton>(Shp.class);
    3030        public EnumMap<Shp, Obj> objects = new EnumMap<Shp, Obj>(Shp.class);
     
    4040                                        button.setBorderPainted(false);
    4141                        }
    42                         if (dlg.mark != null)
    43                                 dlg.mark.paintSign();
     42                        dlg.mark.paintSign();
    4443                }
    4544        };
     
    5150                this.add(getShapeButton(sparButton, 0, 32, 34, 32, "Spar", Shp.SPAR, Obj.BOYSAW), null);
    5251                this.add(getShapeButton(sphereButton, 0, 64, 34, 32, "Sphere", Shp.SPHERE, Obj.BOYSAW), null);
    53                 this.add(getShapeButton(barrelButton, 0, 96, 34, 32, "Barrel", Shp.BARREL, Obj.BOYSAW), null);
    54                 this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT), null);
     52                this.add(getShapeButton(floatButton, 0, 96, 34, 32, "Float", Shp.FLOAT, Obj.FLTSAW), null);
     53                this.add(getShapeButton(beaconButton, 0, 128, 34, 32, "Beacon", Shp.BEACON, Obj.FLTSAW), null);
    5554        }
    5655
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSpec.java

    r26173 r26423  
    4747                                        button.setBorderPainted(false);
    4848                        }
    49                         if (dlg.mark != null)
    50                                 dlg.mark.paintSign();
    5149                }
    5250        };
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelStbd.java

    r26298 r26423  
    5858        public JRadioButton towerButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/TowerButton.png")));
    5959        public JRadioButton perchButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/PerchSButton.png")));
     60        public JRadioButton stakeButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/StakeButton.png")));
    6061        public EnumMap<Shp, JRadioButton> shapes = new EnumMap<Shp, JRadioButton>(Shp.class);
    6162        public EnumMap<Shp, Obj> objects = new EnumMap<Shp, Obj>(Shp.class);
     
    6768                                        dlg.mark.setShape(shp);
    6869                                        dlg.mark.setObject(objects.get(shp));
    69                                         switch (shp) {
    70                                         case UNKNOWN:
    71                                                         dlg.panelMain.shapeIcon.setIcon(null);
    72                                         case PILLAR:
    73 // *************
    74                                                 dlg.panelMain.topButton.setEnabled(true);
    75                                                 dlg.panelMain.fogButton.setEnabled(true);
    76                                                 dlg.panelMain.radButton.setEnabled(true);
    77                                                 dlg.panelMain.litButton.setEnabled(true);
    78 // *************
    79                                                 switch (dlg.mark.getRegion()) {
    80                                                 case A:
    81                                                         dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/pillar_green.png")));
    82                                                         break;
    83                                                 case B:
    84                                                         dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/pillar_red.png")));
    85                                                         break;
    86                                                 case C:
    87                                                         dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/pillar_green_white_green_white.png")));
    88                                                         break;
    89                                                 }
    90                                                 break;
    91                                         case SPAR:
    92                                                 switch (dlg.mark.getRegion()) {
    93                                                 case A:
    94                                                         dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/spar_green.png")));
    95                                                         break;
    96                                                 case B:
    97                                                         dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/spar_red.png")));
    98                                                         break;
    99                                                 case C:
    100                                                         dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource("/images/spar_green_white_green_white.png")));
    101                                                         break;
    102                                                 }
    103                                                 break;
    104                                         }
    10570                                        button.setBorderPainted(true);
    10671                                } else
    10772                                        button.setBorderPainted(false);
    10873                        }
    109                         if (dlg.mark != null)
    110                                 dlg.mark.paintSign();
     74                        dlg.mark.paintSign();
    11175                }
    11276        };
     
    12185                this.add(getShapeButton(sparButton, 0, 32, 34, 32, "Spar", Shp.SPAR, Obj.BOYLAT), null);
    12286                this.add(getShapeButton(coneButton, 0, 64, 34, 32, "Cone", Shp.CONE, Obj.BOYLAT), null);
    123                 this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj.LITFLT), null);
    124                 this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT), null);
     87                this.add(getShapeButton(sphereButton, 0, 96, 34, 32, "Sphere", Shp.SPHERE, Obj.BOYLAT), null);
     88                this.add(getShapeButton(floatButton, 0, 128, 34, 32, "Float", Shp.FLOAT, Obj.FLTLAT), null);
    12589                this.add(getShapeButton(beaconButton, 35, 0, 34, 32, "Beacon", Shp.BEACON, Obj.BCNLAT), null);
    12690                this.add(getShapeButton(towerButton, 35, 32, 34, 32, "Tower", Shp.TOWER, Obj.BCNLAT), null);
    12791                this.add(getShapeButton(perchButton, 35, 64, 34, 32, "Perch", Shp.PERCH, Obj.BCNLAT), null);
     92                this.add(getShapeButton(stakeButton, 35, 96, 34, 32, "Stake", Shp.STAKE, Obj.BCNLAT), null);
    12893        }
    12994
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java

    r26297 r26423  
    2525                dlg = dia;
    2626        }
    27        
     27
    2828        public enum Reg {
    2929                A, B, C
     
    5151
    5252        public enum Obj {
    53                 UNKNOWN, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP, LITMAJ, LITMIN, LITFLT, LITVES, LNDMRK, MORFAC, SIGSTA
     53                UNKNOWN, BCNCAR, BCNISD, BCNLAT, BCNSAW, BCNSPP, BOYCAR, BOYISD, BOYLAT, BOYSAW, BOYSPP, FLTCAR, FLTISD, FLTLAT, FLTSAW, FLTSPP, LITMAJ, LITMIN, LITFLT, LITVES, LNDMRK, MORFAC, SIGSTA
    5454        }
    5555
     
    6767                ObjMAP.put(Obj.BOYSAW, "buoy_safe_water");
    6868                ObjMAP.put(Obj.BOYSPP, "buoy_special_purpose");
     69                ObjMAP.put(Obj.FLTCAR, "light_float");
     70                ObjMAP.put(Obj.FLTLAT, "light_float");
     71                ObjMAP.put(Obj.FLTSAW, "light_float");
     72                ObjMAP.put(Obj.FLTSPP, "light_float");
    6973                ObjMAP.put(Obj.LITMAJ, "light_major");
    7074                ObjMAP.put(Obj.LITMIN, "light_minor");
     
    235239                case DAYMARK:
    236240                        return dayColour;
    237 //              case LIGHT:
    238 //                      return light.getLightColour();
     241                        // case LIGHT:
     242                        // return light.getLightColour();
    239243                }
    240244                return Col.UNKNOWN;
     
    255259                        dayColour = col;
    256260                        break;
    257 //              case LIGHT:
    258 //                      light.setLightColour(col);
    259 //                      break;
     261                // case LIGHT:
     262                // light.setLightColour(col);
     263                // break;
    260264                }
    261265        }
     
    413417
    414418        public Light light = new Light(dlg);
    415        
     419
    416420        private boolean paintlock = false;
    417421
    418422        public void parseMark(Node node) {
    419                 region = Main.pref.get("tomsplugin.IALA").equals("A") ? Reg.A : Reg.B;
    420                 paintlock = true;
     423                region = Main.pref.get("smedplugin.IALA").equals("C") ? Reg.C : (Main.pref.get("smedplugin.IALA").equals("B") ? Reg.B : Reg.A);
    421424                dlg.panelMain.clearSelections();
    422425                dlg.manager.showVisualMessage("");
     
    435438
    436439                if (typeStr.equals("light_float") || typeStr.equals("") || keys.containsKey("seamark:light_float:colour")
    437                     || keys.containsKey("seamark:light_float:colour_pattern")) {
     440                                || keys.containsKey("seamark:light_float:colour_pattern")) {
    438441                        if (keys.containsKey("seamark:light_float:colour_pattern")) {
    439442                                setObject(Obj.LITFLT);
     
    445448                                        setObject(Obj.BOYLAT);
    446449                                } else if (colStr.equals("black;yellow") || colStr.equals("black;yellow;black") || colStr.equals("yellow;black")
    447                                     || colStr.equals("yellow;black;yellow")) {
     450                                                || colStr.equals("yellow;black;yellow")) {
    448451                                        setObject(Obj.BOYCAR);
    449452                                } else if (colStr.equals("black;red;black")) {
     
    459462                        if (typeStr.equals("")) {
    460463                                if (keys.containsKey("seamark:buoy_lateral:category") || keys.containsKey("seamark:buoy_lateral:shape")
    461                                     || keys.containsKey("seamark:buoy_lateral:colour")) {
     464                                                || keys.containsKey("seamark:buoy_lateral:colour")) {
    462465                                        setObject(Obj.BOYLAT);
    463466                                        typeStr = "buoy_lateral";
    464467                                } else if (keys.containsKey("seamark:beacon_lateral:category") || keys.containsKey("seamark:beacon_lateral:shape")
    465                                     || keys.containsKey("seamark:beacon_lateral:colour")) {
     468                                                || keys.containsKey("seamark:beacon_lateral:colour")) {
    466469                                        setObject(Obj.BCNLAT);
    467470                                        typeStr = "beacon_lateral";
    468471                                } else if (keys.containsKey("seamark:buoy_cardinal:category") || keys.containsKey("seamark:buoy_cardinal:shape")
    469                                     || keys.containsKey("seamark:buoy_cardinal:colour")) {
     472                                                || keys.containsKey("seamark:buoy_cardinal:colour")) {
    470473                                        setObject(Obj.BOYCAR);
    471474                                        typeStr = "buoy_cardinal";
    472475                                } else if (keys.containsKey("seamark:beacon_cardinal:category") || keys.containsKey("seamark:beacon_cardinal:shape")
    473                                     || keys.containsKey("seamark:beacon_cardinal:colour")) {
     476                                                || keys.containsKey("seamark:beacon_cardinal:colour")) {
    474477                                        setObject(Obj.BCNCAR);
    475478                                        typeStr = "beacon_cardinal";
    476479                                } else if (keys.containsKey("seamark:buoy_isolated_danger:category")
    477                                     || keys.containsKey("seamark:buoy_isolated_danger:shape") || keys.containsKey("seamark:buoy_isolated_danger:colour")) {
     480                                                || keys.containsKey("seamark:buoy_isolated_danger:shape") || keys.containsKey("seamark:buoy_isolated_danger:colour")) {
    478481                                        setObject(Obj.BOYISD);
    479482                                        typeStr = "buoy_isolated_danger";
    480483                                } else if (keys.containsKey("seamark:beacon_isolated_danger:category")
    481                                     || keys.containsKey("seamark:beacon_isolated_danger:shape")
    482                                     || keys.containsKey("seamark:beacon_isolated_danger:colour")) {
     484                                                || keys.containsKey("seamark:beacon_isolated_danger:shape")
     485                                                || keys.containsKey("seamark:beacon_isolated_danger:colour")) {
    483486                                        setObject(Obj.BCNISD);
    484487                                        typeStr = "beacon_isolated_danger";
    485488                                } else if (keys.containsKey("seamark:buoy_safe_water:category") || keys.containsKey("seamark:buoy_safe_water:shape")
    486                                     || keys.containsKey("seamark:buoy_safe_water:colour")) {
     489                                                || keys.containsKey("seamark:buoy_safe_water:colour")) {
    487490                                        setObject(Obj.BOYSAW);
    488491                                        typeStr = "buoy_safe_water";
    489492                                } else if (keys.containsKey("seamark:beacon_safe_water:category") || keys.containsKey("seamark:beacon_safe_water:shape")
    490                                     || keys.containsKey("seamark:beacon_safe_water:colour")) {
     493                                                || keys.containsKey("seamark:beacon_safe_water:colour")) {
    491494                                        setObject(Obj.BCNSAW);
    492495                                        typeStr = "beacon_safe_water";
    493496                                } else if (keys.containsKey("seamark:buoy_special_purpose:category")
    494                                     || keys.containsKey("seamark:buoy_special_purpose:shape") || keys.containsKey("seamark:buoy_special_purpose:colour")) {
     497                                                || keys.containsKey("seamark:buoy_special_purpose:shape") || keys.containsKey("seamark:buoy_special_purpose:colour")) {
    495498                                        setObject(Obj.BOYSPP);
    496499                                        typeStr = "buoy_special_purpose";
    497500                                } else if (keys.containsKey("seamark:beacon_special_purpose:category")
    498                                     || keys.containsKey("seamark:beacon_special_purpose:shape")
    499                                     || keys.containsKey("seamark:beacon_special_purpose:colour")) {
     501                                                || keys.containsKey("seamark:beacon_special_purpose:shape")
     502                                                || keys.containsKey("seamark:beacon_special_purpose:colour")) {
    500503                                        setObject(Obj.BCNSPP);
    501504                                        typeStr = "beacon_special_purpose";
     
    512515                        colStr = keys.get("seamark:" + typeStr + ":colour");
    513516                for (Col col : ColMAP.keySet())
    514                         if (ColMAP.get(col).equals(colStr)) setColour(Ent.BODY, col);
     517                        if (ColMAP.get(col).equals(colStr))
     518                                setColour(Ent.BODY, col);
    515519
    516520                if (keys.containsKey("seamark:" + typeStr + ":name")) {
     
    634638                else if (typeStr.equals("light_float"))
    635639                        str = "float";
    636                 else str = "";
     640                else
     641                        str = "";
    637642                if ((str.isEmpty() && (EntMAP.get(getObject()) == Ent.BEACON)) || str.equals("stake"))
    638643                        str = "beacon";
     
    677682                        str = keys.get("seamark:topmark:shape");
    678683                }
    679 /*
    680                 for (Map.Entry<String, String> entry : keys.entrySet()) {
    681                         String key = entry.getKey();
    682                         String value = entry.getValue().trim();
    683                         if (key.contains("seamark:light:")) {
    684                                 light.setFired(true);
    685                                 int index = 0;
    686                                 key = key.substring(14);
    687                                 if (key.matches("^\\d:.*")) {
    688                                         index = key.charAt(0) - '0';
    689                                         key = key.substring(2);
    690                                 } else if (key.matches("^\\d$")) {
    691                                         index = key.charAt(0) - '0';
    692                                         String values[] = value.split(":");
    693                                         if (values[0].equals("red"))
    694                                                 lightColour[index] = Col.RED;
    695                                         else if (values[0].equals("green"))
    696                                                 lightColour[index] = Col.GREEN;
    697                                         else if (values[0].equals("white"))
    698                                                 lightColour[index] = Col.WHITE;
    699                                         if (values.length > 1)
    700                                                 Bearing1[index] = values[1];
    701                                         if (values.length > 2)
    702                                                 Bearing2[index] = values[2];
    703                                 } else {
    704                                         index = 0;
    705                                 }
    706                                 if (index != 0)
    707                                         setSectored(true);
    708                                 if (key.equals("colour")) {
    709                                         if (value.equals("red"))
    710                                                 lightColour[index] = Col.RED;
    711                                         else if (value.equals("green"))
    712                                                 lightColour[index] = Col.GREEN;
    713                                         else if (value.equals("white"))
    714                                                 lightColour[index] = Col.WHITE;
    715                                 } else if (key.equals("character")) {
    716                                         LightChar[index] = value;
    717                                 } else if (key.equals("group")) {
    718                                         LightGroup[index] = value;
    719                                 } else if (key.equals("period")) {
    720                                         LightPeriod[index] = value;
    721                                 } else if (key.equals("height")) {
    722                                         Height[index] = value;
    723                                 } else if (key.equals("range")) {
    724                                         Range[index] = value;
    725                                 }
    726                         }
    727                 }
    728 */
     684                /*
     685                 * for (Map.Entry<String, String> entry : keys.entrySet()) { String key =
     686                 * entry.getKey(); String value = entry.getValue().trim(); if
     687                 * (key.contains("seamark:light:")) { light.setFired(true); int index = 0;
     688                 * key = key.substring(14); if (key.matches("^\\d:.*")) { index =
     689                 * key.charAt(0) - '0'; key = key.substring(2); } else if
     690                 * (key.matches("^\\d$")) { index = key.charAt(0) - '0'; String values[] =
     691                 * value.split(":"); if (values[0].equals("red")) lightColour[index] =
     692                 * Col.RED; else if (values[0].equals("green")) lightColour[index] =
     693                 * Col.GREEN; else if (values[0].equals("white")) lightColour[index] =
     694                 * Col.WHITE; if (values.length > 1) Bearing1[index] = values[1]; if
     695                 * (values.length > 2) Bearing2[index] = values[2]; } else { index = 0; } if
     696                 * (index != 0) setSectored(true); if (key.equals("colour")) { if
     697                 * (value.equals("red")) lightColour[index] = Col.RED; else if
     698                 * (value.equals("green")) lightColour[index] = Col.GREEN; else if
     699                 * (value.equals("white")) lightColour[index] = Col.WHITE; } else if
     700                 * (key.equals("character")) { LightChar[index] = value; } else if
     701                 * (key.equals("group")) { LightGroup[index] = value; } else if
     702                 * (key.equals("period")) { LightPeriod[index] = value; } else if
     703                 * (key.equals("height")) { Height[index] = value; } else if
     704                 * (key.equals("range")) { Range[index] = value; } } }
     705                 */
    729706                if (keys.containsKey("seamark:fog_signal") || keys.containsKey("seamark:fog_signal:category")
    730                     || keys.containsKey("seamark:fog_signal:group") || keys.containsKey("seamark:fog_signal:period")) {
     707                                || keys.containsKey("seamark:fog_signal:group") || keys.containsKey("seamark:fog_signal:period")) {
    731708                        setFog(true);
    732709                        if (keys.containsKey("seamark:fog_signal:category")) {
     
    756733
    757734                if (keys.containsKey("seamark:radar_transponder") || keys.containsKey("seamark:radar_transponder:category")
    758                     || keys.containsKey("seamark:radar_transponder:group")) {
     735                                || keys.containsKey("seamark:radar_transponder:group")) {
    759736                        setRacon(true);
    760737                        if (keys.containsKey("seamark:radar_transponder:category")) {
     
    773750                } else if (keys.containsKey("seamark:radar_reflector"))
    774751                        setRadar(true);
    775                 paintlock = false;
    776                 paintSign();
    777752        }
    778753
     
    782757                        return;
    783758
     759                dlg.panelMain.shapeIcon.setIcon(null);
     760                dlg.panelMain.lightIcon.setIcon(null);
     761                dlg.panelMain.topIcon.setIcon(null);
     762                dlg.panelMain.radarIcon.setIcon(null);
     763                dlg.panelMain.fogIcon.setIcon(null);
     764
    784765                String imgStr = "/images/";
    785                 String shpStr = ShpMAP.get(shape);
    786                 if (shpStr == null)
    787                         dlg.panelMain.shapeIcon.setIcon(null);
    788                 else {
    789                         imgStr += shpStr;
    790                         if (shpStr.equals("perch")) {
    791                                 imgStr += (getCategory() == Cat.LAT_PORT ? "_port" : "_stbd");
     766                switch (dlg.mark.getObject()) {
     767                case BCNCAR:
     768                case BOYCAR:
     769                case FLTCAR:
     770                        switch (dlg.mark.getShape()) {
     771                        case TOWER:
     772                                imgStr += "Cardinal_Tower_";
     773                                break;
     774                        case PILLAR:
     775                                imgStr += "Cardinal_Pillar_";
     776                                break;
     777                        case SPAR:
     778                                imgStr += "Cardinal_Spar_";
     779                                break;
     780                        case CAN:
     781                                imgStr += "Cardinal_Can_";
     782                                break;
     783                        case CONE:
     784                                imgStr += "Cardinal_Cone_";
     785                                break;
     786                        case SPHERE:
     787                                imgStr += "Cardinal_Sphere_";
     788                                break;
     789                        case FLOAT:
     790                                imgStr += "Cardinal_Float_";
     791                                break;
     792                        case BEACON:
     793                                imgStr += "Cardinal_Beacon_";
     794                                break;
     795                        default:
     796                                if (dlg.mark.getObject() == Obj.BCNCAR)
     797                                        imgStr += "Cardinal_Beacon_";
     798                                else
     799                                        imgStr += "Cardinal_Pillar_";
     800                        }
     801                        switch (dlg.mark.getCategory()) {
     802                        case CARD_NORTH:
     803                                imgStr += "North.png";
     804                                break;
     805                        case CARD_SOUTH:
     806                                imgStr += "South.png";
     807                                break;
     808                        case CARD_EAST:
     809                                imgStr += "East.png";
     810                                break;
     811                        case CARD_WEST:
     812                                imgStr += "West.png";
     813                                break;
     814                        }
     815                        break;
     816                case BCNLAT:
     817                case BOYLAT:
     818                case FLTLAT:
     819                        switch (dlg.mark.getShape()) {
     820                        case TOWER:
     821                                imgStr += "Lateral_Tower_";
     822                                break;
     823                        case PILLAR:
     824                                imgStr += "Lateral_Pillar_";
     825                                break;
     826                        case SPAR:
     827                                imgStr += "Lateral_Spar_";
     828                                break;
     829                        case CAN:
     830                                imgStr += "Lateral_Can_";
     831                                break;
     832                        case CONE:
     833                                imgStr += "Lateral_Cone_";
     834                                break;
     835                        case SPHERE:
     836                                imgStr += "Lateral_Sphere_";
     837                                break;
     838                        case FLOAT:
     839                                imgStr += "Lateral_Float_";
     840                                break;
     841                        case BEACON:
     842                                imgStr += "Lateral_Beacon_";
     843                                break;
     844                        case STAKE:
     845                                imgStr += "Lateral_Stake_";
     846                                break;
     847                        case PERCH:
     848                                imgStr += "Lateral_Perch_";
     849                                break;
     850                        default:
     851                                if (dlg.mark.getObject() == Obj.BCNLAT)
     852                                        imgStr += "Lateral_Beacon_";
     853                                else
     854                                        imgStr += "Lateral_Pillar_";
     855                        }
     856                        switch (dlg.mark.getCategory()) {
     857                        case LAT_PORT:
     858                                if (getShape() == Shp.PERCH) {
     859                                        imgStr += "Port.png";
     860                                        break;
     861                                }
     862                                switch (getRegion()) {
     863                                case A:
     864                                        imgStr += "Red.png";
     865                                        break;
     866                                case B:
     867                                        imgStr += "Green.png";
     868                                        break;
     869                                case C:
     870                                        imgStr += "Red_White_Red_White.png";
     871                                        break;
     872                                }
     873                                break;
     874                        case LAT_STBD:
     875                                if (getShape() == Shp.PERCH) {
     876                                        imgStr += "Starboard.png";
     877                                        break;
     878                                }
     879                                switch (getRegion()) {
     880                                case A:
     881                                        imgStr += "Green.png";
     882                                        break;
     883                                case B:
     884                                        imgStr += "Red.png";
     885                                        break;
     886                                case C:
     887                                        imgStr += "Green_White_Green_White.png";
     888                                        break;
     889                                }
     890                                break;
     891                        case LAT_PREF_PORT:
     892                                if (getShape() == Shp.STAKE || getShape() == Shp.PERCH) {
     893                                        imgStr = "/images/";
     894                                        break;
     895                                }
     896                                switch (getRegion()) {
     897                                case A:
     898                                        imgStr += "Red_Green_Red.png";
     899                                        break;
     900                                case B:
     901                                        imgStr += "Green_Red_Green.png";
     902                                        break;
     903                                case C:
     904                                        imgStr = imgStr.replaceFirst("Lateral", "Special_Purpose");
     905                                        imgStr += "Red_Green_Red_Green.png";
     906                                        break;
     907                                }
     908                                break;
     909                        case LAT_PREF_STBD:
     910                                if (getShape() == Shp.STAKE || getShape() == Shp.PERCH) {
     911                                        imgStr = "/images/";
     912                                        break;
     913                                }
     914                                switch (getRegion()) {
     915                                case A:
     916                                        imgStr += "Green_Red_Green.png";
     917                                        break;
     918                                case B:
     919                                        imgStr += "Red_Green_Red.png";
     920                                        break;
     921                                case C:
     922                                        imgStr = imgStr.replaceFirst("Lateral", "Special_Purpose");
     923                                        imgStr += "Red_Green_Red_Green.png";
     924                                        break;
     925                                }
     926                                break;
     927                        }
     928                        break;
     929                case BCNSAW:
     930                case BOYSAW:
     931                case FLTSAW:
     932                        switch (dlg.mark.getShape()) {
     933                        case PILLAR:
     934                                imgStr += "Safe_Water_Pillar.png";
     935                                break;
     936                        case SPAR:
     937                                imgStr += "Safe_Water_Spar.png";
     938                                break;
     939                        case SPHERE:
     940                                imgStr += "Safe_Water_Sphere.png";
     941                                break;
     942                        case FLOAT:
     943                                imgStr += "Safe_Water_Float.png";
     944                                break;
     945                        case BEACON:
     946                                imgStr += "Safe_Water_Beacon.png";
     947                                break;
     948                        default:
     949                                if (dlg.mark.getObject() == Obj.BCNSAW)
     950                                        imgStr += "Safe_Water_Beacon.png";
     951                                else
     952                                        imgStr += "Safe_Water_Pillar.png";
     953                        }
     954                        break;
     955                }
     956                if (!imgStr.equals("/images/")) {
     957                        if (getClass().getResource(imgStr) == null) {
     958                                System.out.println("Missing image: " + imgStr);
     959                                return;
    792960                        } else {
    793                                 String colStr = ColMAP.get(bodyColour);
    794                                 if (colStr != null)
    795                                         imgStr += ("_" + colStr);
    796                         }
    797                         imgStr += ".png";
    798                         if (getClass().getResource(imgStr) == null)
    799                                 System.out.println("Body:" + imgStr);
    800                         else
    801961                                dlg.panelMain.shapeIcon.setIcon(new ImageIcon(getClass().getResource(imgStr)));
    802                 }
    803 
    804                 if (topShape == Top.NONE)
    805                         dlg.panelMain.topIcon.setIcon(null);
    806                 else {
    807                         imgStr = "/images/top_";
    808                         switch (getShape()) {
    809                         case CAN:
    810                         case CONE:
    811                         case SPHERE:
    812                         case BARREL:
    813                                 imgStr += "il_";
    814                                 break;
    815                         case PILLAR:
    816                         case SPAR:
    817                                 imgStr += "ih_";
    818                                 break;
    819                         case FLOAT:
    820                         case SUPER:
    821                                 imgStr += "vl_";
    822                                 break;
    823                         case BEACON:
    824                         case TOWER:
    825                                 imgStr += "vh_";
    826                                 break;
    827                         default:
    828                                 imgStr = null;
    829                                 dlg.panelMain.topIcon.setIcon(null);
    830                                 break;
    831                         }
    832                         if (imgStr != null) {
    833                                 imgStr += (TopMAP.get(topShape) + "_");
    834                                 String colStr = ColMAP.get(topColour);
    835                                 if (colStr != null)
    836                                         imgStr += colStr;
    837                                 imgStr += ".png";
    838                                 if (getClass().getResource(imgStr) == null)
    839                                         System.out.println("Top:" + imgStr);
    840                                 else
    841                                         dlg.panelMain.topIcon.setIcon(new ImageIcon(getClass().getResource(imgStr)));
    842                         }
    843                 }
    844                 /*
    845                  * if (hasRadar()) { dlg.panelMain.radarIcon.setIcon(new
    846                  * ImageIcon(getClass().getResource("/images/Radar_Reflector_355.png"))); }
    847                  * else if (hasRacon()) { dlg.panelMain.radarIcon.setIcon(new
    848                  * ImageIcon(getClass().getResource("/images/Radar_Station.png"))); // if
    849                  * (getRaType() != 0) { // String c = (String)
    850                  * dlg.cbM01Racon.getSelectedItem(); // if ((getRaType() == RATYPE_RACON) &&
    851                  * !getRaconGroup().isEmpty()) // c += ("(" + getRaconGroup() + ")"); //
    852                  * dlg.lM01RadarMarkeys.setText(c); // } }
    853                  *
    854                  * if (hasFog()) { dlg.panelMain.fogIcon.setIcon(new
    855                  * ImageIcon(getClass().getResource("/images/Fog_Signal.png"))); // if
    856                  * (getFogSound() != 0) { // String c = (String)
    857                  * dlg.cbM01Fog.getSelectedItem(); // if (!getFogGroup().isEmpty()) // c +=
    858                  * ("(" + getFogGroup() + ")"); // if (!getFogPeriod().isEmpty()) // c +=
    859                  * (" " + getFogPeriod() + "s"); // dlg.lM01FogMarkeys.setText(c); // } }
    860                  *
    861                  * if (isFired()) { String lp, c; String tmp = null; int i1;
    862                  *
    863                  * Col col = getColour(Ent.LIGHT); if (col == Col.WHITE) {
    864                  * dlg.panelMain.lightIcon.setIcon(new
    865                  * ImageIcon(getClass().getResource("/images/Light_White_120.png"))); } else
    866                  * if (col == Col.RED) { dlg.panelMain.lightIcon.setIcon(new
    867                  * ImageIcon(getClass().getResource("/images/Light_Red_120.png"))); } else
    868                  * if (col == Col.GREEN) { dlg.panelMain.lightIcon.setIcon(new
    869                  * ImageIcon(getClass().getResource("/images/Light_Green_120.png"))); } else
    870                  * { dlg.panelMain.lightIcon.setIcon(new
    871                  * ImageIcon(getClass().getResource("/images/Light_Magenta_120.png"))); }
    872                  *
    873                  * c = getLightChar(); if (c.contains("+")) { i1 = c.indexOf("+"); tmp =
    874                  * c.substring(i1, c.length()); c = c.substring(0, i1); if
    875                  * (!getLightGroup().isEmpty()) { c = c + "(" + getLightGroup() + ")"; } if
    876                  * (tmp != null) c = c + tmp; } else if (!getLightGroup().isEmpty()) c = c +
    877                  * "(" + getLightGroup() + ")"; c = c + " " + getLightColour(); lp =
    878                  * getLightPeriod(); if (!lp.isEmpty()) c = c + " " + lp + "s"; }
    879                  */
     962                        }
     963                }
    880964        }
    881965
    882966        public void saveSign(Node node) {
    883967
    884                 Main.pref.put("tomsplugin.IALA", getRegion() == Reg.A ? "A" : "B");
    885 
    886 //              for (String str : node.getKeys().keySet()) {
    887 //                      if (str.contains("seamark"))
    888 //                              if (!str.equals("seamark")) {
    889 //                                      Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null));
    890 //                              }
    891 //              }
    892                
     968                Main.pref.put("smedplugin.IALA", getRegion() == Reg.C ? "C" : (getRegion() == Reg.B ? "B" : "A"));
     969
     970                // for (String str : node.getKeys().keySet()) {
     971                // if (str.contains("seamark"))
     972                // if (!str.equals("seamark")) {
     973                // Main.main.undoRedo.add(new ChangePropertyCommand(node, str, null));
     974                // }
     975                // }
     976
    893977                if (!name.isEmpty())
    894978                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:name", name));
     
    9411025                                Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:daymark:colour", str));
    9421026                }
    943 /*
    944                 Col colour;
    945                 if (isFired()) {
    946                         if ((colour = lightColour[0]) != Col.UNKNOWN)
    947                                 if (colour == Col.RED) {
    948                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "red"));
    949                                 } else if (colour.equals("G")) {
    950                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "green"));
    951                                 } else if (colour.equals("W")) {
    952                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:colour", "white"));
    953                                 }
    954                         if (!LightPeriod[0].isEmpty())
    955                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:period", LightPeriod[0]));
    956                         if (!LightChar[0].isEmpty())
    957                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:character", LightChar[0]));
    958                         if (!LightGroup[0].isEmpty())
    959                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:group", LightGroup[0]));
    960                         if (!Height[0].isEmpty())
    961                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:height", Height[0]));
    962                         if (!Range[0].isEmpty())
    963                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:range", Range[0]));
    964                         for (int i = 1; i < 10; i++) {
    965                                 if ((colour = lightColour[i]) != Col.UNKNOWN)
    966 //                                      if (colour.equals("R")) {
    967 //                                              Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red"));
    968 //                                              if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
    969 //                                                      Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "red:" + Bearing1[i] + ":"
    970 //                                                          + Bearing2[i] + ":" + Radius[i]));
    971 //                                      } else if (colour.equals("G")) {
    972 //                                              Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "green"));
    973 //                                              if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
    974 //                                                      Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i] + ":"
    975 //                                                          + Bearing2[i] + ":" + Radius[i]));
    976 //                                      } else if (colour.equals("W")) {
    977 //                                              Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white"));
    978 //                                              if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
    979 //                                                      Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "white:" + Bearing1[i] + ":"
    980 //                                                          + Bearing2[i] + ":" + Radius[i]));
    981 //                                      }
    982                                 if (LightPeriod[i] != null)
    983                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":period", LightPeriod[i]));
    984                                 if (LightChar[i] != null)
    985                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":character", LightChar[i]));
    986                                 if (LightGroup[i] != null)
    987                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":group", LightGroup[i]));
    988                                 if (Height[i] != null)
    989                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":height", Height[i]));
    990                                 if (Range[i] != null)
    991                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":range", Range[i]));
    992                                 if (Bearing1[i] != null)
    993                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":sector_start", Bearing1[i]));
    994                                 if (Bearing2[i] != null)
    995                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":sector_end", Bearing2[i]));
    996                         }
    997                 }*/
     1027                /*
     1028                 * Col colour; if (isFired()) { if ((colour = lightColour[0]) !=
     1029                 * Col.UNKNOWN) if (colour == Col.RED) { Main.main.undoRedo.add(new
     1030                 * ChangePropertyCommand(node, "seamark:light:colour", "red")); } else if
     1031                 * (colour.equals("G")) { Main.main.undoRedo.add(new
     1032                 * ChangePropertyCommand(node, "seamark:light:colour", "green")); } else if
     1033                 * (colour.equals("W")) { Main.main.undoRedo.add(new
     1034                 * ChangePropertyCommand(node, "seamark:light:colour", "white")); } if
     1035                 * (!LightPeriod[0].isEmpty()) Main.main.undoRedo.add(new
     1036                 * ChangePropertyCommand(node, "seamark:light:period", LightPeriod[0])); if
     1037                 * (!LightChar[0].isEmpty()) Main.main.undoRedo.add(new
     1038                 * ChangePropertyCommand(node, "seamark:light:character", LightChar[0])); if
     1039                 * (!LightGroup[0].isEmpty()) Main.main.undoRedo.add(new
     1040                 * ChangePropertyCommand(node, "seamark:light:group", LightGroup[0])); if
     1041                 * (!Height[0].isEmpty()) Main.main.undoRedo.add(new
     1042                 * ChangePropertyCommand(node, "seamark:light:height", Height[0])); if
     1043                 * (!Range[0].isEmpty()) Main.main.undoRedo.add(new
     1044                 * ChangePropertyCommand(node, "seamark:light:range", Range[0])); for (int i
     1045                 * = 1; i < 10; i++) { if ((colour = lightColour[i]) != Col.UNKNOWN) // if
     1046                 * (colour.equals("R")) { // Main.main.undoRedo.add(new
     1047                 * ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red")); //
     1048                 * if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] !=
     1049                 * null)) // Main.main.undoRedo.add(new ChangePropertyCommand(node,
     1050                 * "seamark:light:" + i, "red:" + Bearing1[i] + ":" // + Bearing2[i] + ":" +
     1051                 * Radius[i])); // } else if (colour.equals("G")) { //
     1052                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1053                 * i + ":colour", "green")); // if ((Bearing1[i] != null) && (Bearing2[i] !=
     1054                 * null) && (Radius[i] != null)) // Main.main.undoRedo.add(new
     1055                 * ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i]
     1056                 * + ":" // + Bearing2[i] + ":" + Radius[i])); // } else if
     1057                 * (colour.equals("W")) { // Main.main.undoRedo.add(new
     1058                 * ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white"));
     1059                 * // if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] !=
     1060                 * null)) // Main.main.undoRedo.add(new ChangePropertyCommand(node,
     1061                 * "seamark:light:" + i, "white:" + Bearing1[i] + ":" // + Bearing2[i] + ":"
     1062                 * + Radius[i])); // } if (LightPeriod[i] != null)
     1063                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1064                 * i + ":period", LightPeriod[i])); if (LightChar[i] != null)
     1065                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1066                 * i + ":character", LightChar[i])); if (LightGroup[i] != null)
     1067                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1068                 * i + ":group", LightGroup[i])); if (Height[i] != null)
     1069                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1070                 * i + ":height", Height[i])); if (Range[i] != null)
     1071                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1072                 * i + ":range", Range[i])); if (Bearing1[i] != null)
     1073                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1074                 * i + ":sector_start", Bearing1[i])); if (Bearing2[i] != null)
     1075                 * Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" +
     1076                 * i + ":sector_end", Bearing2[i])); } }
     1077                 */
    9981078                if (hasRadar()) {
    9991079                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:radar_reflector", "yes"));
Note: See TracChangeset for help on using the changeset viewer.