Changeset 26951 in osm


Ignore:
Timestamp:
2011-10-23T16:35:40+02:00 (13 years ago)
Author:
malcolmh
Message:

save

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

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelHaz.java

    r26925 r26951  
    2424                public void actionPerformed(java.awt.event.ActionEvent e) {
    2525                        Shp shp = Shp.UNKNOWN;
    26                         if (dlg.mark != null)
     26                        if (dlg.mark != null) {
    2727                                shp = dlg.mark.getShape();
    28                         if (northButton.isSelected()) {
    29                                 dlg.mark.setCategory(Cat.CAM_NORTH);
    30                                 dlg.mark.setColour(Ent.BODY, Col.BLACK);
    31                                 dlg.mark.addColour(Ent.BODY, Col.YELLOW);
    32                                 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ);
    33                                 if (shapes.containsKey(shp))
    34                                         shapes.get(shp).doClick();
    35                                 northButton.setBorderPainted(true);
    36                         } else {
    37                                 northButton.setBorderPainted(false);
    38                         }
    39                         if (southButton.isSelected()) {
    40                                 dlg.mark.setCategory(Cat.CAM_SOUTH);
    41                                 dlg.mark.setColour(Ent.BODY, Col.YELLOW);
    42                                 dlg.mark.addColour(Ent.BODY, Col.BLACK);
    43                                 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ);
    44                                 if (shapes.containsKey(shp))
    45                                         shapes.get(shp).doClick();
    46                                 southButton.setBorderPainted(true);
    47                         } else {
    48                                 southButton.setBorderPainted(false);
    49                         }
    50                         if (eastButton.isSelected()) {
    51                                 dlg.mark.setCategory(Cat.CAM_EAST);
    52                                 dlg.mark.setColour(Ent.BODY, Col.BLACK);
    53                                 dlg.mark.addColour(Ent.BODY, Col.YELLOW);
    54                                 dlg.mark.addColour(Ent.BODY, Col.BLACK);
    55                                 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ);
    56                                 if (shapes.containsKey(shp))
    57                                         shapes.get(shp).doClick();
    58                                 eastButton.setBorderPainted(true);
    59                         } else {
    60                                 eastButton.setBorderPainted(false);
    61                         }
    62                         if (westButton.isSelected()) {
    63                                 dlg.mark.setCategory(Cat.CAM_WEST);
    64                                 dlg.mark.setColour(Ent.BODY, Col.YELLOW);
    65                                 dlg.mark.addColour(Ent.BODY, Col.BLACK);
    66                                 dlg.mark.addColour(Ent.BODY, Col.YELLOW);
    67                                 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ);
    68                                 if (shapes.containsKey(shp))
    69                                         shapes.get(shp).doClick();
    70                                 westButton.setBorderPainted(true);
    71                         } else {
    72                                 westButton.setBorderPainted(false);
    73                         }
    74                         if (isolButton.isSelected()) {
    75                                 dlg.mark.setCategory(Cat.UNKNOWN);
    76                                 dlg.mark.setColour(Ent.BODY, Col.BLACK);
    77                                 dlg.mark.addColour(Ent.BODY, Col.RED);
    78                                 dlg.mark.addColour(Ent.BODY, Col.BLACK);
    79                                 dlg.mark.setPattern(Ent.BODY, Pat.HORIZ);
    80                                 if (shapes.containsKey(shp))
    81                                         shapes.get(shp).doClick();
    82                                 isolButton.setBorderPainted(true);
    83                         } else {
    84                                 isolButton.setBorderPainted(false);
     28                                dlg.panelMain.panelMore.panelPat.clearSelections();
     29                                dlg.panelMain.panelMore.panelPat.horizButton.doClick();
     30                                if (northButton.isSelected()) {
     31                                        dlg.mark.setCategory(Cat.CAM_NORTH);
     32                                        dlg.panelMain.panelMore.panelPat.panelCol.blackButton.doClick();
     33                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     34                                        dlg.panelMain.panelMore.panelPat.panelCol.yellowButton.doClick();
     35                                        if (shapes.containsKey(shp))
     36                                                shapes.get(shp).doClick();
     37                                        northButton.setBorderPainted(true);
     38                                } else {
     39                                        northButton.setBorderPainted(false);
     40                                }
     41                                if (southButton.isSelected()) {
     42                                        dlg.mark.setCategory(Cat.CAM_SOUTH);
     43                                        dlg.panelMain.panelMore.panelPat.panelCol.yellowButton.doClick();
     44                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     45                                        dlg.panelMain.panelMore.panelPat.panelCol.blackButton.doClick();
     46                                        if (shapes.containsKey(shp))
     47                                                shapes.get(shp).doClick();
     48                                        southButton.setBorderPainted(true);
     49                                } else {
     50                                        southButton.setBorderPainted(false);
     51                                }
     52                                if (eastButton.isSelected()) {
     53                                        dlg.mark.setCategory(Cat.CAM_EAST);
     54                                        dlg.panelMain.panelMore.panelPat.panelCol.blackButton.doClick();
     55                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     56                                        dlg.panelMain.panelMore.panelPat.panelCol.yellowButton.doClick();
     57                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     58                                        dlg.panelMain.panelMore.panelPat.panelCol.blackButton.doClick();
     59                                        if (shapes.containsKey(shp))
     60                                                shapes.get(shp).doClick();
     61                                        eastButton.setBorderPainted(true);
     62                                } else {
     63                                        eastButton.setBorderPainted(false);
     64                                }
     65                                if (westButton.isSelected()) {
     66                                        dlg.mark.setCategory(Cat.CAM_WEST);
     67                                        dlg.panelMain.panelMore.panelPat.panelCol.yellowButton.doClick();
     68                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     69                                        dlg.panelMain.panelMore.panelPat.panelCol.blackButton.doClick();
     70                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     71                                        dlg.panelMain.panelMore.panelPat.panelCol.yellowButton.doClick();
     72                                        if (shapes.containsKey(shp))
     73                                                shapes.get(shp).doClick();
     74                                        westButton.setBorderPainted(true);
     75                                } else {
     76                                        westButton.setBorderPainted(false);
     77                                }
     78                                if (isolButton.isSelected()) {
     79                                        dlg.mark.setCategory(Cat.UNKNOWN);
     80                                        dlg.panelMain.panelMore.panelPat.panelCol.blackButton.doClick();
     81                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     82                                        dlg.panelMain.panelMore.panelPat.panelCol.redButton.doClick();
     83                                        dlg.panelMain.panelMore.panelPat.panelCol.addButton.doClick();
     84                                        dlg.panelMain.panelMore.panelPat.panelCol.blackButton.doClick();
     85                                        if (shapes.containsKey(shp))
     86                                                shapes.get(shp).doClick();
     87                                        isolButton.setBorderPainted(true);
     88                                } else {
     89                                        isolButton.setBorderPainted(false);
     90                                }
    8591                        }
    8692                }
     
    114120                        }
    115121                        if (dlg.mark != null) {
    116                                 if ((dlg.mark.getObject() != Obj.UNKNOWN) && (dlg.mark.getShape() != Shp.UNKNOWN))
     122                                if ((dlg.mark.getObject() != Obj.UNKNOWN) && (dlg.mark.getShape() != Shp.UNKNOWN)) {
     123                                        topmarkButton.setVisible(true);
    117124                                        dlg.panelMain.moreButton.setVisible(true);
    118                                 else
     125                                } else {
     126                                        topmarkButton.setVisible(false);
    119127                                        dlg.panelMain.moreButton.setVisible(false);
     128                                }
    120129                                dlg.mark.paintSign();
    121130                        }
     
    125134        private ActionListener alTop = new ActionListener() {
    126135                public void actionPerformed(java.awt.event.ActionEvent e) {
    127                         if (topmarkButton.isSelected()) {
    128                                 topmarkButton.setBorderPainted(true);
    129                         } else {
    130                                 topmarkButton.setBorderPainted(false);
     136                        if (dlg.mark != null) {
     137                                dlg.panelMain.panelTop.clearSelections();
     138                                if (topmarkButton.isSelected()) {
     139                                        dlg.panelMain.panelTop.panelPat.noneButton.doClick();
     140                                        dlg.panelMain.panelTop.panelPat.panelCol.blackButton.doClick();
     141                                        switch (dlg.mark.getCategory()) {
     142                                        case CAM_NORTH:
     143                                                dlg.panelMain.panelTop.northTopButton.doClick();
     144                                                break;
     145                                        case CAM_SOUTH:
     146                                                dlg.panelMain.panelTop.southTopButton.doClick();
     147                                                break;
     148                                        case CAM_EAST:
     149                                                dlg.panelMain.panelTop.eastTopButton.doClick();
     150                                                break;
     151                                        case CAM_WEST:
     152                                                dlg.panelMain.panelTop.westTopButton.doClick();
     153                                                break;
     154                                        default:
     155                                                dlg.panelMain.panelTop.spheres2TopButton.doClick();
     156                                                break;
     157                                        }
     158                                        topmarkButton.setBorderPainted(true);
     159                                } else {
     160                                        topmarkButton.setBorderPainted(false);
     161                                }
    131162                        }
    132163                }
     
    147178                this.add(getShapeButton(coneButton, 55, 96, 34, 32, "Cone", Shp.CONE, Obj.BOYCAR, Obj.BOYISD), null);
    148179                this.add(getShapeButton(sphereButton, 55, 128, 34, 32, "Sphere", Shp.SPHERE, Obj.BOYCAR, Obj.BOYISD), null);
    149                 this.add(getShapeButton(floatButton, 90, 0,34, 32, "Float", Shp.FLOAT, Obj.LITFLT, Obj.LITFLT), null);
     180                this.add(getShapeButton(floatButton, 90, 0, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT, Obj.LITFLT), null);
    150181                this.add(getShapeButton(beaconButton, 90, 32, 34, 32, "Beacon", Shp.BEACON, Obj.BCNCAR, Obj.BCNISD), null);
    151182                this.add(getShapeButton(towerButton, 90, 64, 34, 32, "Tower", Shp.TOWER, Obj.BCNCAR, Obj.BCNISD), null);
     
    159190        public void clearSelections() {
    160191                topmarkButton.setSelected(false);
     192                topmarkButton.setVisible(false);
    161193                alTop.actionPerformed(null);
    162194                catButtons.clearSelection();
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java

    r26949 r26951  
    9797
    9898        public enum Ent {
    99                 BODY, BUOY, BEACON, FLOAT, TOPMARK, DAYMARK, LIGHT, MOORING, STATION
     99                BODY, BUOY, BEACON, FLOAT, TOPMARK, LIGHT, MOORING, STATION
    100100        }
    101101
     
    305305        private ArrayList<Col> bodyColour = new ArrayList<Col>();
    306306        private ArrayList<Col> topColour = new ArrayList<Col>();
    307         private ArrayList<Col> dayColour = new ArrayList<Col>();
    308307        private ArrayList<Col> lightColour = new ArrayList<Col>();
    309308
     
    321320                                return topColour.get(i);
    322321                        break;
    323                 case DAYMARK:
    324                         if (i < dayColour.size())
    325                                 return dayColour.get(i);
    326                         break;
    327322                case LIGHT:
    328323                        if (i < lightColour.size())
     
    346341                        topColour.add(col);
    347342                        break;
    348                 case DAYMARK:
    349                         dayColour.clear();
    350                         dayColour.add(col);
    351                         break;
    352343                case LIGHT:
    353344                        lightColour.clear();
     
    368359                        topColour.set(i, col);
    369360                        break;
    370                 case DAYMARK:
    371                         dayColour.set(i, col);
    372                         break;
    373361                case LIGHT:
    374362                        lightColour.set(i, col);
     
    388376                        topColour.add(i, col);
    389377                        break;
    390                 case DAYMARK:
    391                         dayColour.add(i, col);
    392                         break;
    393378                case LIGHT:
    394379                        lightColour.add(i, col);
     
    408393                        topColour.add(col);
    409394                        break;
    410                 case DAYMARK:
    411                         dayColour.add(col);
    412                         break;
    413395                case LIGHT:
    414396                        lightColour.add(col);
     
    428410                        topColour.remove(i);
    429411                        break;
    430                 case DAYMARK:
    431                         dayColour.remove(i);
    432                         break;
    433412                case LIGHT:
    434413                        lightColour.remove(i);
     
    452431        private Pat bodyPattern = Pat.NONE;
    453432        private Pat topPattern = Pat.NONE;
    454         private Pat dayPattern = Pat.NONE;
    455433
    456434        public Pat getPattern(Ent ent) {
     
    463441                case TOPMARK:
    464442                        return topPattern;
    465                 case DAYMARK:
    466                         return dayPattern;
    467443                }
    468444                return Pat.NONE;
     
    479455                case TOPMARK:
    480456                        topPattern = pat;
    481                         break;
    482                 case DAYMARK:
    483                         dayPattern = pat;
    484457                        break;
    485458                }
Note: See TracChangeset for help on using the changeset viewer.