Ignore:
Timestamp:
2011-06-10T11:21:54+02:00 (13 years ago)
Author:
malcolmh
Message:

save

Location:
applications/editors/josm/plugins/smed/plugs/oseam/src
Files:
5 added
3 edited

Legend:

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

    r26110 r26114  
    6161        public PanelLit(OSeaMAction dia) {
    6262                dlg = dia;
    63                 panelSector = new PanelSectors();
    64                 panelSector.setAlwaysOnTop(true);
    65                 panelSector.setLocation(450, 0);
    6663                panelChr = new PanelChr(dlg);
    6764                panelChr.setBounds(new Rectangle(0, 0, 88, 160));
     
    7875                                sectorButton.setBorderPainted(sectorButton.isSelected());
    7976                                if (sectorButton.isSelected()) {
     77                                        if (panelSector == null) {
     78                                                panelSector = new PanelSectors(dlg.mark.light);
     79                                                panelSector.setAlwaysOnTop(true);
     80                                                panelSector.setLocation(450, 0);
     81                                        }
     82                                        if (dlg.mark.light.getRowCount() == 1) {
     83                                                dlg.mark.light.addSector(1);
     84                                                dlg.mark.setSectored(true);
     85                                        }
    8086                                        panelSector.setVisible(true);
    8187                                } else {
     88                                        dlg.mark.setSectored(false);
    8289                                        panelSector.setVisible(false);
    8390                                }
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSectors.java

    r26110 r26114  
    11package oseam.panels;
     2
     3import java.util.ArrayList;
    24
    35import javax.swing.ImageIcon;
     
    911import javax.swing.table.AbstractTableModel;
    1012
     13import oseam.seamarks.Light;
     14import oseam.seamarks.SeaMark;
     15
    1116public class PanelSectors extends JFrame {
    1217       
     
    1621        public JTable table;
    1722       
    18         class TableModel extends AbstractTableModel {
    19 
    20                 private String[] columns = { "Sector", "Start", "End", "Colour",
    21                                 "Character", "Group", "Period", "Height", "Range", "Visibility" };
    22                 private Object[][] data = { { new Integer(1), "", "", "", "", "", "", "", "", "" } };
    23 
    24                 public String getColumnName(int col) {
    25                         return columns[col].toString();
    26                 }
    27 
    28                 public int getColumnCount() {
    29                         return columns.length;
    30                 }
    31 
    32                 public int getRowCount() {
    33                         return data.length;
    34                 }
    35 
    36                 public Object getValueAt(int row, int col) {
    37                         return data[row][col];
    38                 }
    39 
    40                 public boolean isCellEditable(int row, int col) {
    41                         return (col > 0);
    42                 }
    43 
    44                 public void setValueAt(Object value, int row, int col) {
    45                         data[row][col] = value;
    46                         fireTableCellUpdated(row, col);
    47                 }
    48 }
    49        
    50         public PanelSectors() {
     23        public PanelSectors(Light light) {
    5124                super("Sector Table");
    5225                panel = new JPanel();
     
    5831                plusButton = new JButton(new ImageIcon(getClass().getResource("/images/PlusButton.png")));
    5932                plusButton.setBounds(0, 34, 32, 34);
    60                 table = new JTable(new TableModel());
     33                table = new JTable(light);
    6134                JScrollPane tablePane = new JScrollPane(table);
    6235                tablePane.setBounds(40, 0, 660, 34);
  • applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/seamarks/SeaMark.java

    r26096 r26114  
    440440                        setBearing1("");
    441441                        setBearing2("");
    442                         setRadius("");
     442                        setVisibility(Vis.UNKNOWN);
    443443                }
    444444        }
     
    453453                sectorIndex = sector;
    454454        }
    455 
     455       
    456456        public enum Chr {
    457457                UNKNOWN, FIXED, FLASH, LONGFLASH, QUICK, VERYQUICK, ULTRAQUICK,
     
    490490        }
    491491       
     492        public Light light = new Light();
     493       
    492494        private String[] LightChar = new String[10];
    493495
     
    596598        }
    597599
    598         private String[] Radius = new String[10];
    599 
    600         public String getRadius() {
    601                 if (Radius[sectorIndex] == null)
    602                         return (Radius[0]);
    603                 return Radius[sectorIndex];
    604         }
    605 
    606         public void setRadius(String radius) {
     600        public enum Vis { UNKNOWN, HIGH, LOW, FAINT, INTEN, UNINTEN, REST, OBS, PARTOBS }
     601        public static final Map<EnumSet<Vis>, String> VisMAP = new HashMap<EnumSet<Vis>, String>();
     602        static {
     603                VisMAP.put(EnumSet.of(Vis.UNKNOWN), "");
     604                VisMAP.put(EnumSet.of(Vis.HIGH), "high");
     605                VisMAP.put(EnumSet.of(Vis.LOW), "low");
     606                VisMAP.put(EnumSet.of(Vis.FAINT), "faint");
     607                VisMAP.put(EnumSet.of(Vis.INTEN), "intensified");
     608                VisMAP.put(EnumSet.of(Vis.UNINTEN), "unintensified");
     609                VisMAP.put(EnumSet.of(Vis.REST), "restricted");
     610                VisMAP.put(EnumSet.of(Vis.OBS), "obscured");
     611                VisMAP.put(EnumSet.of(Vis.PARTOBS), "part_obscured");
     612        }
     613       
     614        private Vis[] Visibility = new Vis[10];
     615
     616        public Vis getVisibility() {
     617                if (Visibility[sectorIndex] == null)
     618                        return (Visibility[0]);
     619                return Visibility[sectorIndex];
     620        }
     621
     622        public void setVisibility(Vis visibility) {
    607623                if (sectorIndex == 0)
    608                         Radius = new String[10];
    609                 Radius[sectorIndex] = radius;
     624                        Visibility = new Vis[10];
     625                Visibility[sectorIndex] = visibility;
    610626        }
    611627
     
    926942                                        if (values.length > 2)
    927943                                                Bearing2[index] = values[2];
    928                                         if (values.length > 3)
    929                                                 Radius[index] = values[3];
    930944                                } else {
    931945                                        index = 0;
     
    11911205                        for (int i = 1; i < 10; i++) {
    11921206                                if ((colour = lightColour[i]) != Col.UNKNOWN)
    1193                                         if (colour.equals("R")) {
    1194                                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red"));
    1195                                                 if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
    1196                                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "red:" + Bearing1[i] + ":"
    1197                                                             + Bearing2[i] + ":" + Radius[i]));
    1198                                         } else if (colour.equals("G")) {
    1199                                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "green"));
    1200                                                 if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
    1201                                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i] + ":"
    1202                                                             + Bearing2[i] + ":" + Radius[i]));
    1203                                         } else if (colour.equals("W")) {
    1204                                                 Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white"));
    1205                                                 if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
    1206                                                         Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "white:" + Bearing1[i] + ":"
    1207                                                             + Bearing2[i] + ":" + Radius[i]));
    1208                                         }
     1207//                                      if (colour.equals("R")) {
     1208//                                              Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "red"));
     1209//                                              if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
     1210//                                                      Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "red:" + Bearing1[i] + ":"
     1211//                                                          + Bearing2[i] + ":" + Radius[i]));
     1212//                                      } else if (colour.equals("G")) {
     1213//                                              Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "green"));
     1214//                                              if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
     1215//                                                      Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "green:" + Bearing1[i] + ":"
     1216//                                                          + Bearing2[i] + ":" + Radius[i]));
     1217//                                      } else if (colour.equals("W")) {
     1218//                                              Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":colour", "white"));
     1219//                                              if ((Bearing1[i] != null) && (Bearing2[i] != null) && (Radius[i] != null))
     1220//                                                      Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i, "white:" + Bearing1[i] + ":"
     1221//                                                          + Bearing2[i] + ":" + Radius[i]));
     1222//                                      }
    12091223                                if (LightPeriod[i] != null)
    12101224                                        Main.main.undoRedo.add(new ChangePropertyCommand(node, "seamark:light:" + i + ":period", LightPeriod[i]));
Note: See TracChangeset for help on using the changeset viewer.