Ignore:
Timestamp:
2010-09-20T23:31:35+02:00 (14 years ago)
Author:
malcolmh
Message:

SP topmarks

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

Legend:

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

    r23269 r23287  
    960960                        cbM01TopMark.addActionListener(new ActionListener() {
    961961                                public void actionPerformed(ActionEvent e) {
    962                                         int top = cbM01TopMark.getSelectedIndex();
     962                                        buoy.setTopMarkIndex(cbM01TopMark.getSelectedIndex());
    963963                                        buoy.paintSign();
    964964                                }
  • applications/editors/josm/plugins/toms/src/toms/msg/messages.properties

    r23078 r23287  
    8282SmpDialogAction.212=Not set
    8383SmpDialogAction.213=*Select shape*
     84SmpDialogAction.214=Can
     85SmpDialogAction.215=Cone
     86
  • applications/editors/josm/plugins/toms/src/toms/seamarks/SeaMark.java

    r23269 r23287  
    110110
    111111        /**
     112         * Topmark Shapes - correspond to TopMarkIndex
     113         */
     114
     115        public final static int UNKNOWN_TOPMARK = 0;
     116        public final static int TOP_YELLOW_X = 1;
     117        public final static int TOP_RED_X = 2;
     118        public final static int TOP_YELLOW_CAN = 3;
     119        public final static int TOP_YELLOW_CONE = 4;
     120
     121        /**
    112122         * Radar Beacons - correspond to Ratyp Index
    113123         */
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java

    r23269 r23287  
    353353                 */
    354354                dlg.cM01TopMark.setSelected(topMark);
     355        }
     356
     357        private int TopMarkIndex = 0;
     358
     359        public int getTopMarkIndex() {
     360                return TopMarkIndex;
     361        }
     362
     363        public void setTopMarkIndex(int index) {
     364                TopMarkIndex = index;
    355365        }
    356366
     
    895905
    896906        protected void saveTopMarkData(String shape, String colour) {
    897                 if (dlg.cM01TopMark.isSelected()) {
     907                if (hasTopMark()) {
    898908                        Main.main.undoRedo.add(new ChangePropertyCommand(Node,
    899909                                        "seamark:topmark:shape", shape));
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java

    r23269 r23287  
    4747                dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.210")); //$NON-NLS-1$
    4848                dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.211")); //$NON-NLS-1$
     49                dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.214")); //$NON-NLS-1$
     50                dlg.cbM01TopMark.addItem(Messages.getString("SmpDialogAction.215")); //$NON-NLS-1$
    4951
    5052                dlg.cM01TopMark.setEnabled(true);
     
    116118                if (keys.containsKey("seamark:topmark:shape")) { //$NON-NLS-1$
    117119                        str = keys.get("seamark:topmark:shape"); //$NON-NLS-1$
    118 
     120                        setTopMark(true);
    119121                        if (str.equals("x-shape")) { //$NON-NLS-1$
    120                                 setTopMark(true);
     122                                if (keys.containsKey("seamark:topmark:colour")) { //$NON-NLS-1$
     123                                        if (keys.get("seamark:topmark:colour").equals("red"))
     124                                                setTopMarkIndex(TOP_RED_X);
     125                                        else
     126                                                setTopMarkIndex(TOP_YELLOW_X);
     127                                }
     128                        } else if (str.equals("cone, point up")) { //$NON-NLS-1$
     129                                        setTopMarkIndex(TOP_YELLOW_CONE);
     130                        } else if (str.equals("cylinder")) { //$NON-NLS-1$
     131                                setTopMarkIndex(TOP_YELLOW_CAN);
    121132                        }
    122133                }
     
    243254                                        case SPEC_PILLAR:
    244255                                        case SPEC_SPAR:
    245                                                 image = "/images/Top_X_Yellow_Buoy.png"; //$NON-NLS-1$
     256                                                switch (getTopMarkIndex()) {
     257                                                case TOP_YELLOW_X:
     258                                                        image = "/images/Top_X_Yellow_Buoy.png"; //$NON-NLS-1$
     259                                                        break;
     260                                                case TOP_RED_X:
     261                                                        image = "/images/Top_X_Red_Buoy.png"; //$NON-NLS-1$
     262                                                        break;
     263                                                case TOP_YELLOW_CAN:
     264                                                        image = "/images/Top_Can_Yellow_Buoy.png"; //$NON-NLS-1$
     265                                                        break;
     266                                                case TOP_YELLOW_CONE:
     267                                                        image = "/images/Top_Cone_Yellow_Buoy.png"; //$NON-NLS-1$
     268                                                        break;
     269                                                }
    246270                                                break;
    247271                                        case SPEC_CAN:
     
    249273                                        case SPEC_SPHERE:
    250274                                        case SPEC_BARREL:
    251                                                 image = "/images/Top_X_Yellow_Buoy_Small.png"; //$NON-NLS-1$
     275                                                switch (getTopMarkIndex()) {
     276                                                case TOP_YELLOW_X:
     277                                                        image = "/images/Top_X_Yellow_Buoy_Small.png"; //$NON-NLS-1$
     278                                                        break;
     279                                                case TOP_RED_X:
     280                                                        image = "/images/Top_X_Red_Buoy_Small.png"; //$NON-NLS-1$
     281                                                        break;
     282                                                case TOP_YELLOW_CAN:
     283                                                        image = "/images/Top_Can_Yellow_Buoy_Small.png"; //$NON-NLS-1$
     284                                                        break;
     285                                                case TOP_YELLOW_CONE:
     286                                                        image = "/images/Top_Cone_Yellow_Buoy_Small.png"; //$NON-NLS-1$
     287                                                        break;
     288                                                }
    252289                                                break;
    253290                                        case SPEC_BEACON:
    254291                                        case SPEC_TOWER:
    255                                                 image = "/images/Top_X_Yellow_Beacon.png"; //$NON-NLS-1$
     292                                                switch (getTopMarkIndex()) {
     293                                                case TOP_YELLOW_X:
     294                                                        image = "/images/Top_X_Yellow_Beacon.png"; //$NON-NLS-1$
     295                                                        break;
     296                                                case TOP_RED_X:
     297                                                        image = "/images/Top_X_Red_Beacon.png"; //$NON-NLS-1$
     298                                                        break;
     299                                                case TOP_YELLOW_CAN:
     300                                                        image = "/images/Top_Can_Yellow_Beacon.png"; //$NON-NLS-1$
     301                                                        break;
     302                                                case TOP_YELLOW_CONE:
     303                                                        image = "/images/Top_Cone_Yellow_Beacon.png"; //$NON-NLS-1$
     304                                                        break;
     305                                                }
    256306                                                break;
    257307                                        case SPEC_FLOAT:
    258                                                 image = "/images/Top_X_Yellow_Float.png"; //$NON-NLS-1$
     308                                                switch (getTopMarkIndex()) {
     309                                                case TOP_YELLOW_X:
     310                                                        image = "/images/Top_X_Yellow_Float.png"; //$NON-NLS-1$
     311                                                        break;
     312                                                case TOP_RED_X:
     313                                                        image = "/images/Top_X_Red_Float.png"; //$NON-NLS-1$
     314                                                        break;
     315                                                case TOP_YELLOW_CAN:
     316                                                        image = "/images/Top_Can_Yellow_Float.png"; //$NON-NLS-1$
     317                                                        break;
     318                                                case TOP_YELLOW_CONE:
     319                                                        image = "/images/Top_Cone_Yellow_Float.png"; //$NON-NLS-1$
     320                                                        break;
     321                                                }
    259322                                                break;
    260323                                        }
     
    322385                default:
    323386                }
    324                 saveTopMarkData("x-shape", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$
     387                switch (getTopMarkIndex()) {
     388                case TOP_YELLOW_X:
     389                        saveTopMarkData("x-shape", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$
     390                        break;
     391                case TOP_RED_X:
     392                        saveTopMarkData("x-shape", "red"); //$NON-NLS-1$ //$NON-NLS-2$
     393                        break;
     394                case TOP_YELLOW_CAN:
     395                        saveTopMarkData("cylinder", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$
     396                        break;
     397                case TOP_YELLOW_CONE:
     398                        saveTopMarkData("cone, point up", "yellow"); //$NON-NLS-1$ //$NON-NLS-2$
     399                        break;
     400                }
    325401                saveLightData(); //$NON-NLS-1$
    326402                saveRadarFogData();
Note: See TracChangeset for help on using the changeset viewer.