Changeset 26949 in osm for applications/editors
- Timestamp:
- 2011-10-23T14:06:19+02:00 (13 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelChan.java
r26925 r26949 8 8 import oseam.Messages; 9 9 import oseam.dialogs.OSeaMAction; 10 import oseam.seamarks.SeaMark; 10 11 import oseam.seamarks.SeaMark.*; 11 12 … … 108 109 private ActionListener alTop = new ActionListener() { 109 110 public void actionPerformed(java.awt.event.ActionEvent e) { 110 if (topmarkButton.isSelected()) { 111 topmarkButton.setBorderPainted(true); 112 } else { 113 // dlg.panelMain.panelTop.clearSelections(); 114 topmarkButton.setBorderPainted(false); 111 if (dlg.mark != null) { 112 dlg.panelMain.panelTop.clearSelections(); 113 if (topmarkButton.isSelected()) { 114 if (SeaMark.GrpMAP.get(dlg.mark.getObject()) == Grp.SAW) { 115 dlg.panelMain.panelTop.sphereTopButton.doClick(); 116 dlg.panelMain.panelTop.panelPat.noneButton.doClick(); 117 dlg.panelMain.panelTop.panelPat.panelCol.redButton.doClick(); 118 } else { 119 switch (dlg.mark.getCategory()) { 120 case LAM_PORT: 121 case LAM_PPORT: 122 dlg.panelMain.panelTop.canTopButton.doClick(); 123 switch (dlg.mark.getRegion()) { 124 case A: 125 dlg.panelMain.panelTop.panelPat.noneButton.doClick(); 126 dlg.panelMain.panelTop.panelPat.panelCol.redButton.doClick(); 127 break; 128 case B: 129 dlg.panelMain.panelTop.panelPat.noneButton.doClick(); 130 dlg.panelMain.panelTop.panelPat.panelCol.greenButton.doClick(); 131 break; 132 case C: 133 dlg.panelMain.panelTop.panelPat.horizButton.doClick(); 134 dlg.panelMain.panelTop.panelPat.panelCol.redButton.doClick(); 135 dlg.panelMain.panelTop.panelPat.panelCol.addButton.doClick(); 136 dlg.panelMain.panelTop.panelPat.panelCol.whiteButton.doClick(); 137 break; 138 } 139 break; 140 case LAM_STBD: 141 case LAM_PSTBD: 142 dlg.panelMain.panelTop.coneTopButton.doClick(); 143 switch (dlg.mark.getRegion()) { 144 case A: 145 dlg.panelMain.panelTop.panelPat.noneButton.doClick(); 146 dlg.panelMain.panelTop.panelPat.panelCol.greenButton.doClick(); 147 break; 148 case B: 149 dlg.panelMain.panelTop.panelPat.noneButton.doClick(); 150 dlg.panelMain.panelTop.panelPat.panelCol.redButton.doClick(); 151 break; 152 case C: 153 dlg.panelMain.panelTop.panelPat.horizButton.doClick(); 154 dlg.panelMain.panelTop.panelPat.panelCol.greenButton.doClick(); 155 dlg.panelMain.panelTop.panelPat.panelCol.addButton.doClick(); 156 dlg.panelMain.panelTop.panelPat.panelCol.whiteButton.doClick(); 157 break; 158 } 159 break; 160 } 161 } 162 topmarkButton.setBorderPainted(true); 163 } else { 164 topmarkButton.setBorderPainted(false); 165 } 115 166 } 116 167 } -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelCol.java
r26927 r26949 16 16 17 17 private OSeaMAction dlg; 18 private ActionListener act;19 18 private Ent ent; 20 19 private ButtonGroup colourButtons = new ButtonGroup(); … … 55 54 stackIdx--; 56 55 } else { 57 dlg.mark.setColour( Ent.BODY, Col.UNKNOWN);56 dlg.mark.setColour(ent, Col.UNKNOWN); 58 57 } 59 58 } else if (button == addButton) { … … 107 106 }; 108 107 109 public PanelCol(OSeaMAction dia, ActionListener al,Ent entity) {108 public PanelCol(OSeaMAction dia, Ent entity) { 110 109 dlg = dia; 111 act = al;112 110 ent = entity; 113 111 this.setLayout(null); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelLit.java
r26881 r26949 51 51 panelChr = new PanelChr(dlg); 52 52 panelChr.setBounds(new Rectangle(0, 0, 88, 160)); 53 panelCol = new PanelCol(dlg, alType,Ent.LIGHT);53 panelCol = new PanelCol(dlg, Ent.LIGHT); 54 54 panelCol.setBounds(new Rectangle(88, 0, 34, 160)); 55 55 this.setLayout(null); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMain.java
r26925 r26949 9 9 import oseam.Messages; 10 10 import oseam.dialogs.OSeaMAction; 11 import oseam.seamarks.SeaMark.*;12 11 13 12 public class PanelMain extends JPanel { -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelMore.java
r26925 r26949 1 1 package oseam.panels; 2 3 import static org.openstreetmap.josm.tools.I18n.tr;4 2 5 3 import java.awt.*; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPat.java
r26925 r26949 15 15 16 16 private OSeaMAction dlg; 17 private Ent ent; 17 18 public PanelCol panelCol; 18 private ActionListener alType;19 19 20 20 private ButtonGroup patButtons = new ButtonGroup(); … … 32 32 JRadioButton button = patterns.get(pat); 33 33 if (button.isSelected()) { 34 dlg.mark.setPattern( Ent.BODY, pat);34 dlg.mark.setPattern(ent, pat); 35 35 button.setBorderPainted(true); 36 36 } else 37 37 button.setBorderPainted(false); 38 38 } 39 switch (dlg.mark.getPattern( Ent.BODY)) {39 switch (dlg.mark.getPattern(ent)) { 40 40 case NONE: 41 41 panelCol.trimStack(1); … … 59 59 public PanelPat(OSeaMAction dia, Ent entity) { 60 60 dlg = dia; 61 ent = entity; 61 62 this.setLayout(null); 62 panelCol = new PanelCol(dlg, alType, entity);63 panelCol = new PanelCol(dlg, ent); 63 64 panelCol.setBounds(new Rectangle(0, 0, 72, 160)); 64 65 this.add(panelCol, null); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPort.java
r26925 r26949 40 40 dlg.panelMain.moreButton.setVisible(true); 41 41 dlg.panelMain.panelChan.topmarkButton.setVisible(true); 42 dlg.panelMain.topButton.setEnabled(true); 43 dlg.panelMain.fogButton.setEnabled(true); 44 dlg.panelMain.radButton.setEnabled(true); 45 dlg.panelMain.litButton.setEnabled(true); 42 46 dlg.panelMain.panelMore.panelPat.panelCol.clearSelections(); 43 47 if (dlg.mark.getCategory() == Cat.LAM_PORT) { … … 95 99 dlg.panelMain.moreButton.setVisible(false); 96 100 dlg.panelMain.panelChan.topmarkButton.setVisible(false); 101 dlg.panelMain.topButton.setEnabled(false); 102 dlg.panelMain.fogButton.setEnabled(false); 103 dlg.panelMain.radButton.setEnabled(false); 104 dlg.panelMain.litButton.setEnabled(false); 97 105 } 98 106 dlg.mark.paintSign(); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSaw.java
r26925 r26949 36 36 dlg.panelMain.moreButton.setVisible(true); 37 37 dlg.panelMain.panelChan.topmarkButton.setVisible(true); 38 dlg.panelMain.topButton.setEnabled(true); 39 dlg.panelMain.fogButton.setEnabled(true); 40 dlg.panelMain.radButton.setEnabled(true); 41 dlg.panelMain.litButton.setEnabled(true); 38 42 dlg.panelMain.panelMore.panelPat.panelCol.clearSelections(); 39 43 dlg.panelMain.panelMore.panelPat.vertButton.doClick(); … … 43 47 } else { 44 48 dlg.panelMain.moreButton.setVisible(false); 49 dlg.panelMain.topButton.setEnabled(false); 50 dlg.panelMain.fogButton.setEnabled(false); 51 dlg.panelMain.radButton.setEnabled(false); 52 dlg.panelMain.litButton.setEnabled(false); 45 53 } 46 54 dlg.mark.paintSign(); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSectors.java
r26561 r26949 1 1 package oseam.panels; 2 2 3 import java.awt.*;4 3 import java.awt.event.*; 5 4 import javax.swing.*; 6 import java.util.*;7 5 8 6 import oseam.seamarks.Light; -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelStbd.java
r26925 r26949 40 40 dlg.panelMain.moreButton.setVisible(true); 41 41 dlg.panelMain.panelChan.topmarkButton.setVisible(true); 42 dlg.panelMain.topButton.setEnabled(true); 43 dlg.panelMain.fogButton.setEnabled(true); 44 dlg.panelMain.radButton.setEnabled(true); 45 dlg.panelMain.litButton.setEnabled(true); 42 46 dlg.panelMain.panelMore.panelPat.panelCol.clearSelections(); 43 47 if (dlg.mark.getCategory() == Cat.LAM_PORT) { … … 95 99 dlg.panelMain.moreButton.setVisible(false); 96 100 dlg.panelMain.panelChan.topmarkButton.setVisible(false); 101 dlg.panelMain.topButton.setEnabled(false); 102 dlg.panelMain.fogButton.setEnabled(false); 103 dlg.panelMain.radButton.setEnabled(false); 104 dlg.panelMain.litButton.setEnabled(false); 97 105 } 98 106 dlg.mark.paintSign(); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelTop.java
r26927 r26949 33 33 public JRadioButton mooringTopButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/MooringTopButton.png"))); 34 34 private EnumMap<Top, JRadioButton> tops = new EnumMap<Top, JRadioButton>(Top.class); 35 private EnumMap<Day, JRadioButton> days = new EnumMap<Day, JRadioButton>(Day.class);36 35 private ActionListener alTop = new ActionListener() { 37 36 public void actionPerformed(java.awt.event.ActionEvent e) { 38 for (Top top : tops.keySet()) { 39 JRadioButton button = tops.get(top); 40 if (button.isSelected()) { 41 dlg.mark.setTopmark(top); 42 dlg.mark.setDaymark(Day.NONE); 43 button.setBorderPainted(true); 44 } else 45 button.setBorderPainted(false); 37 if (dlg.mark != null) { 38 for (Top top : tops.keySet()) { 39 JRadioButton button = tops.get(top); 40 if (button.isSelected()) { 41 dlg.mark.setTopmark(top); 42 button.setBorderPainted(true); 43 } else 44 button.setBorderPainted(false); 45 } 46 mooringTopButton.setBorderPainted(mooringTopButton.isSelected()); 46 47 } 47 for (Day day : days.keySet()) {48 JRadioButton button = days.get(day);49 if (button.isSelected()) {50 dlg.mark.setDaymark(day);51 dlg.mark.setTopmark(Top.NONE);52 button.setBorderPainted(true);53 } else54 button.setBorderPainted(false);55 }56 mooringTopButton.setBorderPainted(mooringTopButton.isSelected());57 48 } 58 49 }; … … 74 65 this.add(getTopButton(westTopButton, 200, 35, 27, 27, "WestTop", Top.WEST), null); 75 66 this.add(getTopButton(spheres2TopButton, 230, 35, 27, 27, "Spheres2Top", Top.SPHERES2), null); 76 this.add(get DayButton(boardDayButton, 110, 65, 27, 27, "BoardDay", Day.BOARD), null);77 this.add(get DayButton(diamondDayButton, 140, 65, 27, 27, "DiamondDay", Day.DIAMOND), null);78 this.add(get DayButton(triangleDayButton, 170, 65, 27, 27, "TriangleDay", Day.TRIANGLE), null);79 this.add(get DayButton(triangleInvDayButton, 200, 65, 27, 27, "TriangleInvDay", Day.TRIANGLE_INV), null);80 this.add(get DayButton(squareDayButton, 230, 65, 27, 27, "SquareDay", Day.SQUARE), null);81 this.add(get DayButton(circleDayButton, 230, 95, 27, 27, "CircleDay", Day.CIRCLE), null);67 this.add(getTopButton(boardDayButton, 110, 65, 27, 27, "BoardDay", Top.BOARD), null); 68 this.add(getTopButton(diamondDayButton, 140, 65, 27, 27, "DiamondDay", Top.DIAMOND), null); 69 this.add(getTopButton(triangleDayButton, 170, 65, 27, 27, "TriangleDay", Top.TRIANGLE), null); 70 this.add(getTopButton(triangleInvDayButton, 200, 65, 27, 27, "TriangleInvDay", Top.TRIANGLE_INV), null); 71 this.add(getTopButton(squareDayButton, 230, 65, 27, 27, "SquareDay", Top.SQUARE), null); 72 this.add(getTopButton(circleDayButton, 230, 95, 27, 27, "CircleDay", Top.CIRCLE), null); 82 73 this.add(getMoorButton(mooringTopButton, 110, 95, 27, 27, "MooringTop"), null); 83 74 } 84 75 85 76 public void clearSelections() { 86 topButtons.clearSelection(); 87 alTop.actionPerformed(null); 77 noTopButton.doClick(); 88 78 panelPat.clearSelections(); 89 79 } … … 91 81 public void enableAll(boolean state) { 92 82 for (JRadioButton button : tops.values()) { 93 button.setEnabled(state);94 }95 for (JRadioButton button : days.values()) {96 83 button.setEnabled(state); 97 84 } … … 109 96 } 110 97 111 private JRadioButton getDayButton(JRadioButton button, int x, int y, int w, int h, String tip, Day day) {112 button.setBounds(new Rectangle(x, y, w, h));113 button.setBorder(BorderFactory.createLoweredBevelBorder());114 button.setToolTipText(Messages.getString(tip));115 button.addActionListener(alTop);116 topButtons.add(button);117 days.put(day, button);118 return button;119 }120 121 98 private JRadioButton getMoorButton(JRadioButton button, int x, int y, int w, int h, String tip) { 122 99 button.setBounds(new Rectangle(x, y, w, h)); -
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java
r26925 r26949 2 2 3 3 import java.awt.*; 4 import java.awt.event.*;5 import java.awt.Color.*;6 4 import javax.swing.*; 7 5 import java.util.*; … … 443 441 } 444 442 445 public static final EnumMap<Pat, String> Pat MAP= new EnumMap<Pat, String>(Pat.class);443 public static final EnumMap<Pat, String> PatSTR = new EnumMap<Pat, String>(Pat.class); 446 444 static { 447 Pat MAP.put(Pat.HORIZ, "horizontal");448 Pat MAP.put(Pat.VERT, "vertical");449 Pat MAP.put(Pat.DIAG, "diagonal");450 Pat MAP.put(Pat.SQUARE, "squared");451 Pat MAP.put(Pat.BORDER, "border");445 PatSTR.put(Pat.HORIZ, "horizontal"); 446 PatSTR.put(Pat.VERT, "vertical"); 447 PatSTR.put(Pat.DIAG, "diagonal"); 448 PatSTR.put(Pat.SQUARE, "squared"); 449 PatSTR.put(Pat.BORDER, "border"); 452 450 } 453 451 … … 489 487 490 488 public enum Top { 491 NONE, CAN, CONE, SPHERE, X_SHAPE, NORTH, SOUTH, EAST, WEST, SPHERES2 489 NONE, CAN, CONE, SPHERE, X_SHAPE, NORTH, SOUTH, EAST, WEST, SPHERES2, 490 BOARD, DIAMOND, CIRCLE, TRIANGLE, TRIANGLE_INV, SQUARE 492 491 } 493 492 … … 496 495 TopSTR.put(Top.CAN, "cylinder"); 497 496 TopSTR.put(Top.CONE, "cylinder"); 498 TopSTR.put(Top.SPHERE, " SPHERE");499 TopSTR.put(Top.X_SHAPE, " X-SHAPE");497 TopSTR.put(Top.SPHERE, "sphere"); 498 TopSTR.put(Top.X_SHAPE, "x-shape"); 500 499 TopSTR.put(Top.NORTH, "2 cones up"); 501 500 TopSTR.put(Top.SOUTH, "2 cones down"); … … 503 502 TopSTR.put(Top.WEST, "2 cones points together"); 504 503 TopSTR.put(Top.SPHERES2, "2 spheres"); 504 TopSTR.put(Top.BOARD, "board"); 505 TopSTR.put(Top.DIAMOND, "diamond"); 506 TopSTR.put(Top.CIRCLE, "circle"); 507 TopSTR.put(Top.TRIANGLE, "triangle, point up"); 508 TopSTR.put(Top.TRIANGLE_INV, "triangle, point down"); 509 TopSTR.put(Top.SQUARE, "square"); 505 510 } 506 511 … … 517 522 public void setTopmark(Top top) { 518 523 topShape = top; 519 }520 521 public enum Day {522 NONE, BOARD, DIAMOND, CIRCLE, TRIANGLE, TRIANGLE_INV, SQUARE523 }524 525 public static final EnumMap<Day, String> DaySTR = new EnumMap<Day, String>(Day.class);526 static {527 DaySTR.put(Day.BOARD, "board");528 DaySTR.put(Day.DIAMOND, "diamond");529 DaySTR.put(Day.CIRCLE, "circle");530 DaySTR.put(Day.TRIANGLE, "triangle, point up");531 DaySTR.put(Day.TRIANGLE_INV, "triangle, point down");532 DaySTR.put(Day.SQUARE, "square");533 }534 535 private Day dayShape = Day.NONE;536 537 public boolean hasDaymark() {538 return (dayShape != Day.NONE);539 }540 541 public Day getDaymark() {542 return dayShape;543 }544 545 public void setDaymark(Day day) {546 dayShape = day;547 524 } 548 525 … … 873 850 str = keys.get("seamark:" + ObjSTR.get(obj) + ":colour_pattern"); 874 851 setPattern(Ent.BODY, Pat.NONE); 875 for (Pat pat : Pat MAP.keySet()) {876 if (Pat MAP.get(pat).equals(str)) {852 for (Pat pat : PatSTR.keySet()) { 853 if (PatSTR.get(pat).equals(str)) { 877 854 setPattern(Ent.BODY, pat); 878 855 } … … 1254 1231 1255 1232 if (getPattern(Ent.BODY) != Pat.NONE) { 1256 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", PatMAP 1257 .get(getPattern(Ent.BODY)))); 1233 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:" + objStr + ":colour_pattern", PatSTR.get(getPattern(Ent.BODY)))); 1258 1234 } 1259 1235 … … 1272 1248 } 1273 1249 } 1250 if (hasTopmark()) { 1251 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:shape", TopSTR.get(getTopmark()))); 1252 if (getPattern(Ent.TOPMARK) != Pat.NONE) 1253 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour_pattern", PatSTR.get(getPattern(Ent.TOPMARK)))); 1254 if (getColour(Ent.TOPMARK, 0) != Col.UNKNOWN) { 1255 String str = ColSTR.get(getColour(Ent.TOPMARK, 0)); 1256 for (int i = 1; topColour.size() > i; i++) { 1257 str += (";" + ColSTR.get(getColour(Ent.TOPMARK, i))); 1258 } 1259 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:topmark:colour", str)); 1260 } 1261 } 1274 1262 } 1275 1263 }
Note:
See TracChangeset
for help on using the changeset viewer.