Changeset 27028 in osm for applications
- Timestamp:
- 2011-11-08T18:34:00+01:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/msg/messages_en.properties
r26173 r27028 20 20 LightVessel=Light vessel 21 21 LightFloat=Light float 22 SSWarning=Warning Signal Station 23 SSTraffic=Traffic Signal Station 22 24 Topmarks=Topmarks 23 25 FogSignals=Fog signals … … 37 39 Stake=Stake beacon 38 40 Perch=Perch beacon 41 Cairn=Cairn beacon 39 42 40 43 RegionA=IALA Region A … … 88 91 Range=Range 89 92 Category=Category 93 SSCategory=Signal Station 94 UKCategory=Unknown Category 90 95 NoneSpecified=None specified 91 96 Vert2=Vertically disposed x2 92 97 Visibility=Visibility 93 Intensified= intensified94 Unintensified= unintensified98 Intensified=Intensified 99 Unintensified=Unintensified 95 100 PartiallyObscured=Partially obscured 96 101 Orientation=Orientation 97 102 Exhibition=Exhibition 98 103 24h=24h 99 Day=day 100 Night=night 101 Fog=fog 102 103 NoColour=No colour 104 Day=Day 105 Night=Night 106 Fog=Fog 107 108 RemColour=Remove colour 109 AddColour=Add colour 104 110 White=White 105 111 Red=Red … … 111 117 Violet=Violet 112 118 Black=Black 119 Grey=Grey 120 Brown=Brown 121 Magenta=Magenta 122 Pink=Pink 123 NoPat=No Pattern 124 HorizPat=Horizontal Stripes 125 VertPat=Vertical Stripes 126 DiagPat=Diagonal Stripes 127 SquarePat=Squared Pattern 128 BorderPat=Border Stripe 129 130 UKPurpose=Unknown Purpose 131 Warning=Warning 132 Yachting=Yachting 133 Outfall=Outfall 134 ODAS=ODAS 135 RecreationZone=Recreation Zone 136 Mooring=Mooring 137 LANBY=LANBY 138 Leading=Leading 139 Notice=Notice 140 TSS=TSS 141 FoulGround=Foul Ground 142 FerryCross=Ferry Crossing 143 Anchorage=Anchorage 144 ChanSeparation=Channel Separation 145 146 UKCategory=Unknown Category 147 Traffic=Traffic Control 148 PortControl=Port Control 149 PortEntry=Port Entry/Departure 150 IPT=International Port Traffic 151 Berthing=Berthing 152 Dock=Dock 153 Lock=Lock 154 Barrage=Flood Barrage 155 Bridge=Bridge Passage 156 Dredging=Dredging 157 Danger=Danger 158 Storm=Storm 159 Weather=Weather 160 Obstruction=Obstruction 161 Cable=Cable 162 Distress=Distress 163 Time=time 164 Tide=Tide 165 TidalStream=Tidal Stream 166 TideGauge=Tide Gauge 167 TideScale=Tide Scale 168 Diving=Diving 169 Ice=Ice 170 LevelGauge=Water Level Gauge 171 Military=Military Practice 172 173 Status=Status 174 Information=Information 175 Source=Source 176 Elevation=Elevation 177 Visibility=Visibility 178 Reflectivity=Reflectivity 179 Construction=Construction 180 181 NotSet=Not set 182 183 Permanent=Permanent 184 Occasional=Occasional 185 Recommended=Recommended 186 NotInUse=Not in use 187 Intermittent=Intermittent 188 Reserved=Reserved 189 Temporary=Temporary 190 Private=Private 191 Mandatory=Mandatory 192 Destroyed=Destroyed 193 Extinguished=Extinguished 194 Illuminated=Illuminated 195 Historic=Historic 196 Public=Public 197 Synchronized=Synchronized 198 Watched=Watched 199 UnWatched=Unwatched 200 Doubtful=Existence Doubtful 201 202 Masonry=Masonry 203 Concreted=Concreted 204 Boulders=Loose boulders 205 HardSurfaced=Hard surfaced 206 Unsurfaced=Unsurfaced 207 Wooden=Wooden 208 Metal=Metal 209 GRP=GRP 210 Painted=Painted 211 -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSectors.java
r27027 r27028 10 10 import oseam.Messages; 11 11 import oseam.dialogs.OSeaMAction; 12 import oseam.seamarks.SeaMark; 12 13 import oseam.seamarks.SeaMark.*; 13 14 … … 35 36 } 36 37 }; 38 public JComboBox colourBox; 39 public EnumMap<Col, ImageIcon> colours = new EnumMap<Col, ImageIcon>(Col.class); 37 40 public JComboBox visibilityBox; 38 41 public EnumMap<Vis, String> visibilities = new EnumMap<Vis, String>(Vis.class); 42 public JComboBox exhibitionBox; 43 public EnumMap<Exh, String> exhibitions = new EnumMap<Exh, String>(Exh.class); 39 44 40 45 public PanelSectors(OSeaMAction dia) { 41 46 super("Sector Table"); 42 47 dlg = dia; 43 this.setSize( 800, 100);48 this.setSize(900, 100); 44 49 this.setVisible(true); 45 50 this.setAlwaysOnTop(true); … … 56 61 this.add(plusButton); 57 62 panel = new JPanel(new BorderLayout()); 58 panel.setBounds(40, 0, 760, 512);63 panel.setBounds(40, 0, 860, 512); 59 64 model = new SectorTable(); 60 65 table = new JTable(model); 61 table.setBounds(0, 0, 760, 34);66 table.setBounds(0, 0, 860, 34); 62 67 panel.add(new JScrollPane(table)); 63 68 this.getContentPane().add(panel); 64 69 65 TableColumn visColumn = table.getColumnModel().getColumn(11); 70 TableColumn col = table.getColumnModel().getColumn(1); 71 col.setCellRenderer(new ColourCellRenderer()); 72 73 TableColumn colColumn = table.getColumnModel().getColumn(1); 74 colourBox = new JComboBox(); 75 addColItem(new ImageIcon(getClass().getResource("/images/DelButton.png")), Col.UNKNOWN); 76 addColItem(new ImageIcon(getClass().getResource("/images/WhiteButton.png")), Col.WHITE); 77 addColItem(new ImageIcon(getClass().getResource("/images/RedButton.png")), Col.RED); 78 addColItem(new ImageIcon(getClass().getResource("/images/GreenButton.png")), Col.GREEN); 79 addColItem(new ImageIcon(getClass().getResource("/images/YellowButton.png")), Col.YELLOW); 80 addColItem(new ImageIcon(getClass().getResource("/images/OrangeButton.png")), Col.ORANGE); 81 addColItem(new ImageIcon(getClass().getResource("/images/AmberButton.png")), Col.AMBER); 82 addColItem(new ImageIcon(getClass().getResource("/images/BlueButton.png")), Col.BLUE); 83 addColItem(new ImageIcon(getClass().getResource("/images/VioletButton.png")), Col.VIOLET); 84 colColumn.setCellEditor(new DefaultCellEditor(colourBox)); 85 86 TableColumn visColumn = table.getColumnModel().getColumn(12); 66 87 visibilityBox = new JComboBox(); 67 addVisibItem( Messages.getString("NoneSpecified"), Vis.UNKNOWN);88 addVisibItem("", Vis.UNKNOWN); 68 89 addVisibItem(Messages.getString("Intensified"), Vis.INTEN); 69 90 addVisibItem(Messages.getString("Unintensified"), Vis.UNINTEN); 70 91 addVisibItem(Messages.getString("PartiallyObscured"), Vis.PARTOBS); 71 92 visColumn.setCellEditor(new DefaultCellEditor(visibilityBox)); 93 94 TableColumn exhColumn = table.getColumnModel().getColumn(13); 95 exhibitionBox = new JComboBox(); 96 addExhibItem("", Exh.UNKNOWN); 97 addExhibItem(Messages.getString("24h"), Exh.H24); 98 addExhibItem(Messages.getString("Day"), Exh.DAY); 99 addExhibItem(Messages.getString("Night"), Exh.NIGHT); 100 addExhibItem(Messages.getString("Fog"), Exh.FOG); 101 exhColumn.setCellEditor(new DefaultCellEditor(exhibitionBox)); 72 102 } 73 103 … … 75 105 76 106 private String[] headings = { "Sector", "Colour", "Character", "Group", "Sequence", "Period", 77 "Start", "End", "Radius", "Height", "Range", "Visibility", "Exhibition ", "Category" };107 "Directional", "Start", "End", "Radius", "Height", "Range", "Visibility", "Exhibition" }; 78 108 79 109 public SectorTable() { … … 99 129 switch (col) { 100 130 case 1: 101 return Color.class; 102 case 11: 103 return Vis.class; 104 case 12: 105 return Exh.class; 106 case 13: 107 return Lit.class; 131 return Col.class; 132 case 6: 133 return Boolean.class; 108 134 default: 109 135 return String.class; … … 112 138 113 139 public Object getValueAt(int row, int col) { 114 if (col == 0) 140 switch (col) { 141 case 0: 115 142 return row; 116 else 117 return dlg.mark.getLightAtt(col-1, row); 143 case 1: 144 return dlg.mark.getLightAtt(Att.COL, row); 145 case 6: 146 return (dlg.mark.getLightAtt(Att.LIT, row) == Lit.DIR); 147 case 7: 148 case 8: 149 if (dlg.mark.getLightAtt(Att.LIT, row) == Lit.DIR) 150 return dlg.mark.getLightAtt(Att.ORT, row); 151 else 152 return dlg.mark.getLightAtt(col - 1, row); 153 case 12: 154 return visibilities.get(dlg.mark.getLightAtt(Att.VIS, row)); 155 case 13: 156 return exhibitions.get(dlg.mark.getLightAtt(Att.EXH, row)); 157 default: 158 return dlg.mark.getLightAtt(col - 1, row); 159 } 118 160 } 119 161 120 162 public void setValueAt(Object value, int row, int col) { 121 163 switch (col) { 122 case 4: 164 case 1: 165 for (Col colour : colours.keySet()) { 166 ImageIcon img = colours.get(colour); 167 if (img == value) 168 dlg.mark.setLightAtt(Att.COL, row, colour); 169 } 170 break; 123 171 case 5: 172 case 9: 173 case 10: 174 case 11: 175 dlg.mark.setLightAtt(col - 1, row, dlg.mark.validDecimal((String) value)); 176 break; 124 177 case 6: 178 if ((Boolean) value == true) { 179 dlg.mark.setLightAtt(Att.LIT, row, Lit.DIR); 180 } else { 181 dlg.mark.setLightAtt(Att.LIT, row, Lit.UNKNOWN); 182 dlg.mark.setLightAtt(Att.ORT, row, ""); 183 } 184 break; 125 185 case 7: 126 186 case 8: 127 case 9: 128 case 13: 129 dlg.mark.setLightAtt(col-1, row, dlg.mark.validDecimal((String)value)); 130 break; 131 case 11: 187 if (dlg.mark.getLightAtt(Att.LIT, row) == Lit.DIR) { 188 dlg.mark.setLightAtt(Att.ORT, row, dlg.mark.validDecimal((String) value)); 189 } else { 190 dlg.mark.setLightAtt(Att.LIT, row, Lit.UNKNOWN); 191 dlg.mark.setLightAtt(col - 1, row, dlg.mark.validDecimal((String) value)); 192 } 193 break; 194 case 12: 132 195 for (Vis vis : visibilities.keySet()) { 133 196 String str = visibilities.get(vis); … … 136 199 } 137 200 break; 201 case 13: 202 for (Exh exh : exhibitions.keySet()) { 203 String str = exhibitions.get(exh); 204 if (str.equals(value)) 205 dlg.mark.setLightAtt(Att.EXH, row, exh); 206 } 207 break; 138 208 default: 139 dlg.mark.setLightAtt(col -1, row, value);209 dlg.mark.setLightAtt(col - 1, row, value); 140 210 } 211 } 212 } 213 214 public class ColourCellRenderer extends JLabel implements TableCellRenderer { 215 public Component getTableCellRendererComponent(JTable table, Object value, 216 boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) { 217 setHorizontalAlignment(SwingConstants.CENTER); 218 setIcon(colours.get(value)); 219 return this; 141 220 } 142 221 } … … 148 227 public void addSector(int idx) { 149 228 dlg.mark.addLight(idx); 150 table.setSize( 760, ((table.getRowCount() * 16) + 18));229 table.setSize(860, ((table.getRowCount() * 16) + 18)); 151 230 if (table.getRowCount() > 3) { 152 this.setSize( 800, ((table.getRowCount() * 16) + 40));231 this.setSize(900, ((table.getRowCount() * 16) + 40)); 153 232 } else { 154 this.setSize( 800, 100);233 this.setSize(900, 100); 155 234 } 156 235 } 157 236 158 237 public void deleteSector(int idx) { 159 dlg.mark. subLight(idx);160 table.setSize( 760, ((table.getRowCount() * 16) + 18));238 dlg.mark.delLight(idx); 239 table.setSize(860, ((table.getRowCount() * 16) + 18)); 161 240 if (table.getRowCount() > 3) { 162 this.setSize( 800, ((table.getRowCount() * 16) + 40));241 this.setSize(900, ((table.getRowCount() * 16) + 40)); 163 242 } else { 164 this.setSize(800, 100); 165 } 243 this.setSize(900, 100); 244 } 245 } 246 247 private void addColItem(ImageIcon img, Col col) { 248 colours.put(col, img); 249 colourBox.addItem(img); 166 250 } 167 251 … … 171 255 } 172 256 257 private void addExhibItem(String str, Exh exh) { 258 exhibitions.put(exh, str); 259 exhibitionBox.addItem(str); 260 } 261 173 262 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r27027 r27028 483 483 } 484 484 485 public static final Map<EnumSet<Lit>, String> LitSTR = newHashMap<EnumSet<Lit>, String>();485 public static final EnumMap<Lit, String> LitSTR = new EnumMap<Lit, String>(Lit.class); 486 486 static { 487 LitSTR.put(EnumSet.of(Lit.VERT), "vertical"); 487 LitSTR.put(Lit.UNKNOWN, ""); 488 LitSTR.put(Lit.VERT, "vertical"); 489 LitSTR.put(Lit.HORIZ, "horizontal"); 490 LitSTR.put(Lit.DIR, "directional"); 491 LitSTR.put(Lit.UPPER, "upper"); 492 LitSTR.put(Lit.LOWER, "lower"); 493 LitSTR.put(Lit.LEAD, "leading"); 494 LitSTR.put(Lit.REAR, "rear"); 495 LitSTR.put(Lit.FRONT, "front"); 496 LitSTR.put(Lit.AERO, "aero"); 497 LitSTR.put(Lit.AIROBS, "air_obstruction"); 498 LitSTR.put(Lit.FOGDET, "fog_detector"); 499 LitSTR.put(Lit.FLOOD, "floodlight"); 500 LitSTR.put(Lit.STRIP, "striplight"); 501 LitSTR.put(Lit.SUBS, "subsidairy"); 502 LitSTR.put(Lit.SPOT, "spotlight"); 503 LitSTR.put(Lit.MOIRE, "moire"); 504 LitSTR.put(Lit.EMERG, "emergency"); 505 LitSTR.put(Lit.BEAR, "bearing"); 488 506 } 489 507 … … 499 517 } 500 518 501 public enum Att { COL, CHR, GRP, SEQ, PER, BEG, END, RAD, HGT, RNG, VIS, EXH , LIT, ORT }519 public enum Att { COL, CHR, GRP, SEQ, PER, LIT, BEG, END, RAD, HGT, RNG, VIS, EXH, ORT } 502 520 503 public Object[] sector = {Col.UNKNOWN, "", "", "", "", "", "", "", "", "", Vis.UNKNOWN, Exh .UNKNOWN, Lit.UNKNOWN, "" };521 public Object[] sector = {Col.UNKNOWN, "", "", "", "", Lit.UNKNOWN, "", "", "", "", "", Vis.UNKNOWN, Exh.UNKNOWN, "" }; 504 522 505 523 private ArrayList<Object[]> sectors = new ArrayList<Object[]>(); … … 528 546 } 529 547 530 public void clrLight() {531 sectors.clear();532 sectors.add(sector.clone());533 }534 535 548 public void addLight(int i) { 536 549 if (sectors.size() >= i) { 537 sectors.add(i, sectors.get(0).clone()); 550 if (sectors.size() == 0) 551 sectors.add(sector.clone()); 552 else 553 sectors.add(i, sectors.get(0).clone()); 538 554 } 539 555 } 540 556 541 557 public void addLight() { 542 sectors.add(sectors.get(0).clone()); 543 } 544 545 public void subLight(int i) { 558 if (sectors.size() == 0) 559 sectors.add(sector.clone()); 560 else 561 sectors.add(sectors.get(0).clone()); 562 } 563 564 public void delLight(int i) { 546 565 if (sectors.size() > i) 547 566 sectors.remove(i); … … 1277 1296 } 1278 1297 1279 clrLight(); 1298 sectors.clear(); 1299 sectors.add(sector.clone()); 1300 boolean found; 1301 for (int i = 0; i < 30; i++) { 1302 found = false; 1303 addLight(); 1304 String secStr = (i == 0) ? "" : (":" + Integer.toString(i)); 1305 if (keys.containsKey("seamark:light" + secStr + ":colour")) { 1306 setLightAtt(Att.COL, i, keys.get("seamark:light" + secStr + ":colour")); 1307 found = true; 1308 } 1309 if (!found) { 1310 delLight(i); 1311 break; 1312 } 1313 } 1280 1314 1281 1315 if (keys.containsKey("seamark:fog_signal")) { … … 1729 1763 if (!((String)sectors.get(i)[4]).isEmpty()) 1730 1764 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":period", (String)sectors.get(i)[4])); 1731 if ( !((String)sectors.get(i)[5]).isEmpty())1732 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ": sector_start", (String)sectors.get(i)[5]));1765 if (sectors.get(i)[5] != Lit.UNKNOWN) 1766 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":category", LitSTR.get(sectors.get(i)[5]))); 1733 1767 if (!((String)sectors.get(i)[6]).isEmpty()) 1734 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_ end", (String)sectors.get(i)[6]));1768 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_start", (String)sectors.get(i)[6])); 1735 1769 if (!((String)sectors.get(i)[7]).isEmpty()) 1736 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ": radius", (String)sectors.get(i)[7]));1770 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":sector_end", (String)sectors.get(i)[7])); 1737 1771 if (!((String)sectors.get(i)[8]).isEmpty()) 1738 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ": height", (String)sectors.get(i)[8]));1772 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":radius", (String)sectors.get(i)[8])); 1739 1773 if (!((String)sectors.get(i)[9]).isEmpty()) 1740 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ": range", (String)sectors.get(i)[9]));1741 if (sectors.get(i)[10] != Vis.UNKNOWN)1742 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ": visibility", VisSTR.get(sectors.get(i)[10])));1743 if (sectors.get(i)[11] != Exh.UNKNOWN)1744 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ": exhibition", ExhSTR.get(sectors.get(i)[11])));1745 if (sectors.get(i)[12] != Lit.UNKNOWN)1746 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ": category", LitSTR.get(sectors.get(i)[12])));1774 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":height", (String)sectors.get(i)[9])); 1775 if (!((String)sectors.get(i)[10]).isEmpty()) 1776 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":range", (String)sectors.get(i)[10])); 1777 if (sectors.get(i)[11] != Vis.UNKNOWN) 1778 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":visibility", VisSTR.get(sectors.get(i)[11]))); 1779 if (sectors.get(i)[12] != Exh.UNKNOWN) 1780 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":exhibition", ExhSTR.get(sectors.get(i)[12]))); 1747 1781 if (!((String)sectors.get(i)[13]).isEmpty()) 1748 1782 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light" + secStr + ":orientation", (String)sectors.get(i)[13]));
Note:
See TracChangeset
for help on using the changeset viewer.