Ignore:
Timestamp:
2010-08-22T16:56:26+02:00 (14 years ago)
Author:
malcolmh
Message:

bug fixes

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

Legend:

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

    r22725 r22732  
    271271                        buoy = new BuoyUkn(this, "active layer contains no OSM data");
    272272                        buoy.setNode(null);
     273                        buoy.paintSign();
    273274                        return;
    274275                }
     
    280281                        buoy = new BuoyUkn(this, "Please select a node");
    281282                        buoy.setNode(null);
     283                        buoy.paintSign();
    282284                        return;
    283285                }
     
    286288                        buoy = new BuoyUkn(this, "Please select only one node");
    287289                        buoy.setNode(null);
     290                        buoy.paintSign();
    288291                        return;
    289292                }
     
    325328
    326329                        if (type.equals("buoy_lateral") || type.equals("beacon_lateral")
    327                                         || keys.containsKey("seamark:buoy_lateral")
    328                                         || keys.containsKey("seamark:beacon_lateral")) {
     330                                        || keys.containsKey("seamark:buoy_lateral:category")
     331                                        || keys.containsKey("seamark:buoy_lateral:shape")
     332                                        || keys.containsKey("seamark:buoy_lateral:colour")
     333                                        || keys.containsKey("seamark:beacon_lateral:category")
     334                                        || keys.containsKey("seamark:beacon_lateral:shape")
     335                                        || keys.containsKey("seamark:beacon_lateral:colour")) {
    329336                                buoy = new BuoyLat(this, node);
     337                                buoy.paintSign();
    330338                                return;
    331339
    332340                        } else if (type.equals("buoy_cardinal") || type.equals("beacon_cardinal")
    333                                         || keys.containsKey("seamark:buoy_cardinal")
    334                                         || keys.containsKey("seamark:beacon_cardinal")) {
     341                                        || keys.containsKey("seamark:buoy_cardinal:category")
     342                                        || keys.containsKey("seamark:buoy_cardinal:shape")
     343                                        || keys.containsKey("seamark:buoy_cardinal:colour")
     344                                        || keys.containsKey("seamark:beacon_cardinal:category")
     345                                        || keys.containsKey("seamark:beacon_cardinal:shape")
     346                                        || keys.containsKey("seamark:beacon_cardinal:colour")) {
    335347                                buoy = new BuoyCard(this, node);
     348                                buoy.paintSign();
    336349                                return;
    337350
    338351                        } else if (type.equals("buoy_safe_water")
    339352                                        || type.equals("beacon_safe_water")
    340                                         || keys.containsKey("seamark:buoy_safe_water")
    341                                         || keys.containsKey("seamark:beacon_safe_water")) {
     353                                        || keys.containsKey("seamark:buoy_safe_water:shape")
     354                                        || keys.containsKey("seamark:buoy_safe_water:colour")
     355                                        || keys.containsKey("seamark:beacon_safe_water:shape")
     356                                        || keys.containsKey("seamark:beacon_safe_water:colour")) {
    342357                                buoy = new BuoySaw(this, node);
     358                                buoy.paintSign();
    343359                                return;
    344360
    345361                        } else if (type.equals("buoy_special_purpose")
    346362                                        || type.equals("beacon_special_purpose")
    347                                         || keys.containsKey("seamark:buoy_special_purpose")
    348                                         || keys.containsKey("seamark:beacon_special_purpose")) {
     363                                        || keys.containsKey("seamark:buoy_special_purpose:shape")
     364                                        || keys.containsKey("seamark:buoy_special_purpose:colour")
     365                                        || keys.containsKey("seamark:beacon_special_purpose:shape")
     366                                        || keys.containsKey("seamark:beacon_special_purpose:colour")) {
    349367                                buoy = new BuoySpec(this, node);
     368                                buoy.paintSign();
    350369                                return;
    351370
    352371                        } else if (type.equals("buoy_isolated_danger")
    353372                                        || type.equals("beacon_isolated_danger")
    354                                         || (keys.containsKey("seamark:buoy_isolated_danger"))
    355                                         || (keys.containsKey("seamark:beacon_isolated_danger"))) {
     373                                        || keys.containsKey("seamark:buoy_isolated_danger:shape")
     374                                        || keys.containsKey("seamark:buoy_isolated_danger:colour")
     375                                        || keys.containsKey("seamark:beacon_isolated_danger:shape")
     376                                        || keys.containsKey("seamark:beacon_isolated_danger:colour")) {
    356377                                buoy = new BuoyIsol(this, node);
     378                                buoy.paintSign();
    357379                                return;
    358380
     
    363385                                                        || str.equals("red;green;red") || str.equals("green;red;green")) {
    364386                                                buoy = new BuoyLat(this, node);
     387                                                buoy.paintSign();
    365388                                                return;
    366389                                        } else if (str.equals("black;yellow")
     
    368391                                                        || str.equals("yellow;black;yellow")) {
    369392                                                buoy = new BuoyCard(this, node);
     393                                                buoy.paintSign();
    370394                                                return;
    371395                                        } else if (str.equals("black;red;black")) {
    372396                                                buoy = new BuoyIsol(this, node);
     397                                                buoy.paintSign();
    373398                                                return;
    374399                                        } else if (str.equals("red;white")) {
    375400                                                buoy = new BuoySaw(this, node);
     401                                                buoy.paintSign();
    376402                                                return;
    377403                                        } else if (str.equals("yellow")) {
    378404                                                buoy = new BuoySaw(this, node);
     405                                                buoy.paintSign();
    379406                                                return;
    380407                                        } else {
    381408                                                buoy = new BuoyUkn(this, "Parse-Error: Invalid colour");
    382409                                                buoy.setNode(node);
    383                                                 return;
    384                                         }
    385                                 } else if (keys.containsKey("seamark:light_float:topmark")) {
    386                                         if (keys.containsKey("seamark:light_float:topmark:shape")) {
    387                                                 str = keys.get("seamark:light_float:topmark:shape");
    388                                                 if (str.equals("cylinder") || str.equals("cone, point up")) {
    389                                                         buoy = new BuoyLat(this, node);
    390                                                         return;
    391                                                 }
    392                                         } else if (keys.containsKey("seamark:light_float:topmark:colour")) {
    393                                                 str = keys.get("seamark:light_float:topmark:colour");
    394                                                 if (str.equals("red") || str.equals("green")) {
    395                                                         buoy = new BuoyLat(this, node);
    396                                                         return;
    397                                                 }
     410                                                buoy.paintSign();
     411                                                return;
     412                                        }
     413                                } else if (keys.containsKey("seamark:light_float:topmark:shape")) {
     414                                        str = keys.get("seamark:light_float:topmark:shape");
     415                                        if (str.equals("cylinder") || str.equals("cone, point up")) {
     416                                                buoy = new BuoyLat(this, node);
     417                                                buoy.paintSign();
     418                                                return;
     419                                        }
     420                                } else if (keys.containsKey("seamark:light_float:topmark:colour")) {
     421                                        str = keys.get("seamark:light_float:topmark:colour");
     422                                        if (str.equals("red") || str.equals("green")) {
     423                                                buoy = new BuoyLat(this, node);
     424                                                buoy.paintSign();
     425                                                return;
    398426                                        }
    399427                                }
     
    403431                buoy = new BuoyUkn(this, "Seamark not set");
    404432                buoy.setNode(node);
     433                buoy.paintSign();
    405434                return;
    406435        }
     
    556585                                public void actionPerformed(java.awt.event.ActionEvent e) {
    557586                                        Node n;
    558                                         String name;
    559587                                        int type = cbM01TypeOfMark.getSelectedIndex();
    560588
    561589                                        if (buoy == null) {
    562590                                                buoy = new BuoyUkn(dia, "Seamark not set");
     591                                                buoy.paintSign();
    563592                                                return;
    564593                                        }
     
    568597                                        n = buoy.getNode();
    569598                                        if (n == null)
    570                                                 n = onode;
    571                                         if (n == null)
    572                                                 return;
    573                                         name = buoy.getName();
     599                                                return;
    574600                                        switch (type) {
    575601
     
    615641                                        }
    616642
    617                                         buoy.setNode(n);
    618643                                        buoy.setBuoyIndex(type);
    619644                                        buoy.refreshStyles();
    620645                                        buoy.refreshLights();
    621                                         buoy.setName(name);
    622                                         if (buoy instanceof BuoyLat)
    623                                                 buoy.setLightColour();
    624646                                        buoy.paintSign();
    625647                                }
     
    655677                                                tbM01Region.setText("IALA-A");
    656678                                        }
    657                                         if (buoy instanceof BuoyLat)
    658                                                 buoy.setLightColour();
    659                                         buoy.paintSign();
    660679                                }
    661680                        });
     
    698717
    699718                                        buoy.saveSign();
    700                                         buoy.paintSign();
    701719                                }
    702720                        });
     
    791809                                public void focusLost(java.awt.event.FocusEvent e) {
    792810                                        buoy.setName(tfM01Name.getText());
    793                                         buoy.paintSign();
    794811                                }
    795812                        });
     
    958975                                                obuoy = null;
    959976                                        }
     977                                        buoy.paintSign();
    960978                                }
    961979                        });
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/Buoy.java

    r22722 r22732  
    231231                dlg.tfM01RepeatTime.setText(LightPeriod);
    232232
     233                dlg.tfM01Name.setText(getName());
     234               
    233235                if (isFired()) {
    234236                        String lp, c;
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyCard.java

    r22722 r22732  
    110110                        } else
    111111                                setStyleIndex(CARD_BEACON);
    112                 } else if ((keys.containsKey("seamark:type") == true)
     112                } else if (keys.containsKey("seamark:type")
    113113                                && (keys.get("seamark:type").equals("light_float"))) {
    114114                        setStyleIndex(CARD_FLOAT);
     
    148148                        }
    149149                }
    150 
    151                 paintSign();
    152150        }
    153151
     
    278276                super.setLightColour("W");
    279277        }
    280        
     278
    281279        public void saveSign() {
    282280                Node node = getNode();
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyIsol.java

    r22722 r22732  
    4646                setTopMark(true);
    4747
     48                if (keys.containsKey("name"))
     49                        setName(keys.get("name"));
     50
     51                if (keys.containsKey("seamark:name"))
     52                        setName(keys.get("seamark:name"));
     53
     54                if (keys.containsKey("seamark:buoy_isolated_danger:name"))
     55                        setName(keys.get("seamark:buoy_isolated_danger:name"));
     56                else if (keys.containsKey("seamark:beacon_isolated_danger:name"))
     57                        setName(keys.get("seamark:beacon_isolated_danger:name"));
     58                else if (keys.containsKey("seamark:light_float:name"))
     59                        setName(keys.get("seamark:light_float:name"));
     60
    4861                if (keys.containsKey("seamark:buoy_isolated_danger:shape")) {
    4962                        str = keys.get("seamark:buoy_isolated_danger:shape");
     
    6376                        } else
    6477                                setStyleIndex(ISOL_BEACON);
    65                 } else if ((keys.containsKey("seamark:type") == true)
     78                } else if (keys.containsKey("seamark:type")
    6679                                && (keys.get("seamark:type").equals("light_float"))) {
    6780                        setStyleIndex(CARD_FLOAT);
     
    90103                        }
    91104                }
    92 
    93                 paintSign();
    94105        }
    95106
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyLat.java

    r22722 r22732  
    219219                        } else
    220220                                setStyleIndex(LAT_BEACON);
    221                 } else if ((keys.containsKey("seamark:type") == true)
     221                } else if (keys.containsKey("seamark:type")
    222222                                && (keys.get("seamark:type").equals("light_float"))) {
    223223                        setStyleIndex(LAT_FLOAT);
     
    266266                        setLightPeriod(keys);
    267267                }
    268 
    269                 paintSign();
    270268        }
    271269
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySaw.java

    r22722 r22732  
    4646                setLightColour("W");
    4747                setBuoyIndex(SAFE_WATER);
     48
     49                if (keys.containsKey("name"))
     50                        setName(keys.get("name"));
     51
     52                if (keys.containsKey("seamark:name"))
     53                        setName(keys.get("seamark:name"));
     54
     55                if (keys.containsKey("seamark:buoy_safe_water:name"))
     56                        setName(keys.get("seamark:buoy_safe_water:name"));
     57                else if (keys.containsKey("seamark:beacon_safe_water:name"))
     58                        setName(keys.get("seamark:beacon_safe_water:name"));
     59                else if (keys.containsKey("seamark:light_float:name"))
     60                        setName(keys.get("seamark:light_float:name"));
    4861
    4962                if (keys.containsKey("seamark:buoy_safe_water:shape")) {
     
    89102                        }
    90103                }
    91 
    92                 paintSign();
    93104        }
    94105
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoySpec.java

    r22725 r22732  
    1616
    1717public class BuoySpec extends Buoy {
    18         public BuoySpec(SmpDialogAction dia,  Node node) {
     18        public BuoySpec(SmpDialogAction dia, Node node) {
    1919                super(dia);
    2020
     
    5656                setBuoyIndex(SPECIAL_PURPOSE);
    5757
     58                if (keys.containsKey("name"))
     59                        setName(keys.get("name"));
     60
     61                if (keys.containsKey("seamark:name"))
     62                        setName(keys.get("seamark:name"));
     63
     64                if (keys.containsKey("seamark:buoy_special_purpose:name"))
     65                        setName(keys.get("seamark:buoy_special_purpose:name"));
     66                else if (keys.containsKey("seamark:beacon_special_purpose:name"))
     67                        setName(keys.get("seamark:beacon_special_purpose:name"));
     68                else if (keys.containsKey("seamark:light_float:name"))
     69                        setName(keys.get("seamark:light_float:name"));
     70
    5871                if (keys.containsKey("seamark:buoy_special_purpose:shape")) {
    5972                        str = keys.get("seamark:buoy_special_purpose:shape");
     
    6982                }
    7083
    71                 if (keys.containsKey("seamark:beacon_special_purpose"))
     84                if ((keys.containsKey("seamark:type") && keys.get("seamark:type").equals(
     85                                "beacon_special_purpose"))
     86                                || keys.containsKey("seamark:special_purpose_beacon:colour")
     87                                || keys.containsKey("seamark:special_purpose_beacon:shape"))
    7288                        setStyleIndex(SPEC_BEACON);
    73                 else if (keys.containsKey("seamark:light_float")
    74                                 && keys.containsKey("seamark:light_float:colour")
     89                else if (keys.containsKey("seamark:light_float:colour")
    7590                                && keys.get("seamark:light_float:colour").equals("yellow"))
    7691                        setStyleIndex(SPEC_FLOAT);
     
    104119                        }
    105120                }
    106 
    107                 paintSign();
    108121        }
    109122
  • applications/editors/josm/plugins/toms/src/toms/seamarks/buoys/BuoyUkn.java

    r22722 r22732  
    3131                setValid(false);
    3232                setBuoyIndex(0);
    33 
    34                 paintSign();
    3533        }
    3634
Note: See TracChangeset for help on using the changeset viewer.