Changeset 16601 in osm for applications/editors/josm
- Timestamp:
- 2009-07-20T22:05:15+02:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/czechaddress
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/czechaddress/build.xml
r16290 r16601 36 36 classpath="${josm}" 37 37 debug="true" 38 encoding="utf8" 38 39 destdir="${plugin.build.dir}"> 39 40 <compilerarg value="-Xlint:deprecation"/> … … 51 52 <attribute name="Plugin-Description" value="Creating and handling address nodes and buildings within Czech Republic."/> 52 53 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/Cz:JOSM/Plugins/CzechAddress"/> 53 <attribute name="Plugin-Mainversion" value="1 722"/>54 <attribute name="Plugin-Mainversion" value="1815"/> 54 55 <!--<attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>--> 55 56 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/> -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/CzechAddressPlugin.java
r15763 r16601 13 13 import java.util.logging.LogManager; 14 14 import java.util.logging.Logger; 15 15 16 import javax.swing.JMenu; 16 17 import javax.swing.JMenuItem; … … 24 25 import org.openstreetmap.josm.plugins.Plugin; 25 26 import org.openstreetmap.josm.plugins.czechaddress.actions.ConflictResolveAction; 27 import org.openstreetmap.josm.plugins.czechaddress.actions.FactoryAction; 26 28 import org.openstreetmap.josm.plugins.czechaddress.actions.GroupManipulatorAction; 29 import org.openstreetmap.josm.plugins.czechaddress.actions.HelpAction; 30 import org.openstreetmap.josm.plugins.czechaddress.actions.ManagerAction; 27 31 import org.openstreetmap.josm.plugins.czechaddress.actions.PointManipulatorAction; 32 import org.openstreetmap.josm.plugins.czechaddress.actions.SplitAreaByEmptyWayAction; 28 33 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Database; 29 34 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ElementWithStreets; 30 35 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House; 31 import org.openstreetmap.josm.plugins.czechaddress.parser.MvcrParser;32 import org.openstreetmap.josm.plugins.czechaddress.actions.FactoryAction;33 import org.openstreetmap.josm.plugins.czechaddress.actions.HelpAction;34 import org.openstreetmap.josm.plugins.czechaddress.actions.ManagerAction;35 import org.openstreetmap.josm.plugins.czechaddress.actions.SplitAreaByEmptyWayAction;36 36 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Street; 37 37 import org.openstreetmap.josm.plugins.czechaddress.gui.ConflictResolver; … … 41 41 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner; 42 42 import org.openstreetmap.josm.plugins.czechaddress.intelligence.SelectionMonitor; 43 import org.openstreetmap.josm.plugins.czechaddress.parser.MvcrParser; 43 44 44 45 /** 45 46 * Plugin for handling address nodes within the Czech Republic. 46 * 47 * 47 48 * @author Radomír Černoch, radomir.cernoch@gmail.com 48 49 */ … … 72 73 Logger.getLogger(name).addHandler(fileHandler); 73 74 } 74 75 75 76 } catch (IOException ex) { 76 77 logger.log(Level.SEVERE, "cannot create file", ex); … … 89 90 90 91 addStatusListener(this); 91 92 92 93 ConflictResolver.getInstance(); 93 94 SelectionMonitor.getInstance(); … … 98 99 assert assertionsEnabled = true; 99 100 if (assertionsEnabled) initLoggers(); 100 101 101 102 MainMenu.add(Main.main.menu.toolsMenu, new SplitAreaByEmptyWayAction()); 102 103 … … 129 130 if (newFrame == null) 130 131 return; 131 132 132 133 newFrame.addToggleDialog(FactoryDialog.getInstance()); 133 134 newFrame.addMapMode(new IconToggleButton(new FactoryAction(newFrame))); … … 146 147 reasoner.update(street); 147 148 148 for (OsmPrimitive prim : Main. ds.allPrimitives()) {149 for (OsmPrimitive prim : Main.main.getCurrentDataSet().allPrimitives()) { 149 150 if (House.isMatchable(prim) || Street.isMatchable(prim)) 150 151 reasoner.update(prim); … … 172 173 } 173 174 } 174 175 175 176 static private Set<StatusListener> listeners = new HashSet<StatusListener>(); 176 177 static public void addStatusListener(StatusListener l) {listeners.add(l);} -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/MapUtils.java
r16290 r16601 2 2 3 3 import java.util.Collection; 4 4 5 import org.openstreetmap.josm.Main; 5 6 import org.openstreetmap.josm.actions.AutoScaleAction; … … 21 22 */ 22 23 public static void zoomToMany(Collection<OsmPrimitive> primitives) { 23 Main. ds.setSelected(primitives);24 Main.main.getCurrentDataSet().setSelected(primitives); 24 25 (new AutoScaleAction("selection")).actionPerformed(null); 25 26 } … … 29 30 */ 30 31 public static void zoomTo(OsmPrimitive primitive) { 31 Main. ds.setSelected(primitive);32 Main.main.getCurrentDataSet().setSelected(primitive); 32 33 (new AutoScaleAction("selection")).actionPerformed(null); 33 34 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/FactoryAction.java
r15649 r16601 1 1 package org.openstreetmap.josm.plugins.czechaddress.actions; 2 2 3 import org.openstreetmap.josm.plugins.czechaddress.gui.FactoryDialog;4 3 import java.awt.event.KeyEvent; 5 4 import java.awt.event.MouseEvent; 6 5 import java.awt.event.MouseListener; 6 7 7 import org.openstreetmap.josm.Main; 8 8 import org.openstreetmap.josm.actions.mapmode.MapMode; … … 11 11 import org.openstreetmap.josm.plugins.czechaddress.Preferences; 12 12 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House; 13 import org.openstreetmap.josm.plugins.czechaddress.gui.FactoryDialog; 13 14 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner; 14 15 import org.openstreetmap.josm.plugins.czechaddress.proposal.AddKeyValueProposal; … … 103 104 r.closeTransaction(); 104 105 } 105 106 106 107 FactoryDialog.getInstance().selectionListenerActivated = false; 107 108 FactoryDialog.getInstance().selectNextUnmatchedHouseByCheckBox(); 108 Main. ds.addPrimitive(newNode);109 Main. ds.setSelected(newNode);109 Main.main.getCurrentDataSet().addPrimitive(newNode); 110 Main.main.getCurrentDataSet().setSelected(newNode); 110 111 FactoryDialog.getInstance().selectionListenerActivated = true; 111 112 } -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/PointManipulatorAction.java
r15166 r16601 4 4 import java.awt.event.KeyEvent; 5 5 import java.util.Collection; 6 6 7 import org.openstreetmap.josm.Main; 7 8 import org.openstreetmap.josm.actions.JosmAction; … … 42 43 */ 43 44 public void actionPerformed(ActionEvent e) { 44 Collection<OsmPrimitive> data = Main. ds.getSelected();45 Collection<OsmPrimitive> data = Main.main.getCurrentDataSet().getSelected(); 45 46 46 47 if (data.size() != 1) return; -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/SplitAreaByEmptyWayAction.java
r15166 r16601 26 26 * original area is a member of some relation, this action rejects to 27 27 * preform the split. 28 * 28 * 29 29 * @author Radomír Černoch, radomir.cernoch@gmail.com 30 30 */ … … 50 50 */ 51 51 public void actionPerformed(ActionEvent e) { 52 53 Collection<OsmPrimitive> selectedWays = Main. ds.getSelectedWays();54 Collection<OsmPrimitive> newSelection = Main. ds.getSelected();52 53 Collection<OsmPrimitive> selectedWays = Main.main.getCurrentDataSet().getSelectedWays(); 54 Collection<OsmPrimitive> newSelection = Main.main.getCurrentDataSet().getSelected(); 55 55 56 56 for (OsmPrimitive prim : selectedWays) { 57 57 if (!((Way) prim).isClosed()) continue; 58 58 Way area = (Way) prim; 59 60 for (OsmPrimitive prim2 : Main. ds.allNonDeletedPrimitives()) {59 60 for (OsmPrimitive prim2 : Main.main.getCurrentDataSet().allNonDeletedPrimitives()) { 61 61 if (!(prim2 instanceof Way)) continue; 62 62 if (prim2.equals(prim)) continue; 63 Way border = (Way) prim2; 63 Way border = (Way) prim2; 64 64 if (border.nodes.size() == 0) continue; 65 65 if (border.keySet().size() > 0) continue; … … 69 69 Way newArea1 = new Way(); 70 70 Way newArea2 = new Way(); 71 71 72 72 int errorCode = splitArea(area, border, newArea1, newArea2); 73 73 74 74 if (errorCode == 2) { 75 75 JOptionPane.showMessageDialog(Main.parent, … … 78 78 break; 79 79 } 80 80 81 81 if (errorCode == 0) { 82 Main. ds.addPrimitive(newArea1);83 Main. ds.addPrimitive(newArea2);84 82 Main.main.getCurrentDataSet().addPrimitive(newArea1); 83 Main.main.getCurrentDataSet().addPrimitive(newArea2); 84 85 85 area.delete(true); 86 86 border.delete(true); 87 87 newSelection.remove(area); 88 88 newSelection.remove(border); 89 89 90 90 newSelection.add(newArea1); 91 91 newSelection.add(newArea2); … … 95 95 } 96 96 } 97 98 Main. ds.setSelected(newSelection);97 98 Main.main.getCurrentDataSet().setSelected(newSelection); 99 99 } 100 100 … … 102 102 * Splits a given area into 2 areas. newArea1 and newArea2 must be 103 103 * referneces to already existing areas. 104 * 104 * 105 105 * @param area the original area 106 106 * @param border border line, which goes across the area … … 110 110 */ 111 111 private int splitArea(Way area, Way border, Way newArea1, Way newArea2) { 112 112 113 113 Way tempBorder = new Way(border); 114 114 115 115 int index1 = area.nodes.indexOf(tempBorder.firstNode()); 116 116 int index2 = area.nodes.indexOf(tempBorder.lastNode()); … … 123 123 index2 = area.nodes.indexOf(tempBorder.lastNode()); 124 124 } 125 126 for (Relation relation : Main. ds.relations)125 126 for (Relation relation : Main.main.getCurrentDataSet().relations) 127 127 for (RelationMember areaMember : relation.members) 128 128 if (area.equals(areaMember.member)) 129 129 return 2; 130 130 131 131 for (String key : area.keySet()) { 132 132 newArea1.put(key, area.get(key)); 133 133 newArea2.put(key, area.get(key)); 134 134 } 135 135 136 136 newArea1.nodes.addAll(area.nodes.subList(0, index1)); 137 137 newArea1.nodes.addAll(tempBorder.nodes); … … 143 143 newArea2.nodes.addAll(tempBorder.nodes); 144 144 newArea2.nodes.add(area.nodes.get(index1)); 145 145 146 146 removeDuplicateNodesFromWay(newArea1); 147 147 removeDuplicateNodesFromWay(newArea2); … … 149 149 return 0; 150 150 } 151 151 152 152 /** 153 153 * Removes all consequent nodes, which are on the same way. -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java
r16417 r16601 3 3 import java.awt.Component; 4 4 import java.awt.Font; 5 import java.awt.event.ItemListener; 5 6 import java.util.ArrayList; 6 7 import java.awt.event.ItemListener;8 9 7 10 8 import javax.swing.DefaultComboBoxModel; 11 9 import javax.swing.DefaultListCellRenderer; 12 10 import javax.swing.JList; 13 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement; 14 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Suburb; 15 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ElementWithStreets; 16 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ViToCi; 17 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Region; 11 18 12 import org.openstreetmap.josm.Main; 19 13 import org.openstreetmap.josm.data.coor.LatLon; … … 23 17 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 24 18 import org.openstreetmap.josm.gui.ExtendedDialog; 19 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement; 25 20 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Database; 21 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ElementWithStreets; 22 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Region; 23 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Suburb; 24 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ViToCi; 26 25 27 26 /** … … 71 70 * @deprecated 72 71 */ 73 private void autodetectLocation() { 72 @Deprecated 73 private void autodetectLocation() { 74 74 boolean assertions = false; 75 75 assert assertions = true; … … 83 83 84 84 BoundingXYVisitor visitor = new BoundingXYVisitor(); 85 for (OsmPrimitive op : Main. ds.allPrimitives()) {85 for (OsmPrimitive op : Main.main.getCurrentDataSet().allPrimitives()) { 86 86 if (op instanceof Node) { 87 87 ((Node) op).visit(visitor); … … 103 103 System.out.println("AUTO: Center is " + center); 104 104 105 for (OsmPrimitive op : Main. ds.allPrimitives()) {105 for (OsmPrimitive op : Main.main.getCurrentDataSet().allPrimitives()) { 106 106 107 107 if (!(op instanceof Node)) { -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java
r16417 r16601 1 1 package org.openstreetmap.josm.plugins.czechaddress.gui; 2 2 3 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedTreeModel;4 3 import java.util.ArrayList; 5 4 import java.util.List; 5 6 6 import javax.swing.event.TableModelListener; 7 7 import javax.swing.table.DefaultTableCellRenderer; 8 8 import javax.swing.table.TableModel; 9 9 10 import org.openstreetmap.josm.Main; 10 11 import org.openstreetmap.josm.gui.ExtendedDialog; … … 18 19 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.ViToCi; 19 20 import org.openstreetmap.josm.plugins.czechaddress.gui.databaseeditors.EditorFactory; 21 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedTreeModel; 20 22 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalTreeRenderer; 21 23 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Capitalizator; … … 45 47 46 48 Capitalizator cap = new Capitalizator( 47 Main. ds.allPrimitives(),49 Main.main.getCurrentDataSet().allPrimitives(), 48 50 CzechAddressPlugin.getLocation().getStreets()); 49 51 … … 178 180 return 0; 179 181 } 180 182 181 183 } 182 184 … … 340 342 private void dbEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dbEditButtonActionPerformed 341 343 if (EditorFactory.isEditable(dbTreeValue)) { 342 if (EditorFactory.edit( (AddressElement)dbTreeValue))344 if (EditorFactory.edit(dbTreeValue)) 343 345 dbTree.repaint(); 344 346 } else -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java
r16417 r16601 1 1 package org.openstreetmap.josm.plugins.czechaddress.gui; 2 2 3 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedComboBoxModel;4 3 import java.awt.event.ActionEvent; 5 4 import java.awt.event.KeyEvent; 6 5 import java.util.List; 7 6 import java.util.Map; 7 8 8 import javax.swing.AbstractAction; 9 9 import javax.swing.Action; 10 10 import javax.swing.Timer; 11 11 12 import org.openstreetmap.josm.Main; 12 13 import org.openstreetmap.josm.data.osm.Node; … … 20 21 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.AddressElement; 21 22 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.House; 23 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.HalfCookedComboBoxModel; 22 24 import org.openstreetmap.josm.plugins.czechaddress.gui.utils.UniversalListRenderer; 23 25 import org.openstreetmap.josm.plugins.czechaddress.intelligence.Reasoner; … … 89 91 super.buttonAction(evt); 90 92 if (getValue() == 1) { 91 93 92 94 if (updateMatchesTimer != null && updateMatchesTimer.isRunning()) { 93 95 updateMatchesTimer.stop(); … … 97 99 proposalContainer.applyAll(); 98 100 99 Main. ds.setSelected((Node) null); // TODO: This is an ugly hack.100 Main. ds.setSelected(proposalContainer.getTarget());101 101 Main.main.getCurrentDataSet().setSelected((Node) null); // TODO: This is an ugly hack. 102 Main.main.getCurrentDataSet().setSelected(proposalContainer.getTarget()); 103 102 104 AddressElement elem = (AddressElement) matchesComboBox.getSelectedItem(); 103 105 if (elem != null) { … … 125 127 */ 126 128 public void updateMatches() { 127 129 128 130 if (proposalContainer.getTarget().deleted) 129 131 setVisible(false); … … 145 147 r.closeTransaction(); 146 148 } 147 149 148 150 MatchesComboBoxModel matchesModel = 149 151 ((MatchesComboBoxModel) matchesComboBox.getModel()); … … 175 177 * This method is called from within the constructor to 176 178 * initialize the form. 177 * 179 * 178 180 * <p><b>WARNING:</b> Do NOT modify this code. The content of this method is 179 181 * always regenerated by the Form Editor.</p> … … 290 292 if (updateMatchesTimer != null) 291 293 updateMatchesTimer.stop(); 292 294 293 295 updateMatchesTimer = new Timer(300, updateMatchesAction); 294 296 updateMatchesTimer.setRepeats(false); … … 305 307 private void matchChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_matchChanged 306 308 307 if (matchesComboBox.getSelectedItem() == null) return; 309 if (matchesComboBox.getSelectedItem() == null) return; 308 310 AddressElement selectedElement = (AddressElement) matchesComboBox.getSelectedItem(); 309 311 proposalContainer.setProposals(selectedElement.getDiff(proposalContainer.getTarget())); -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/proposal/ExtractAddressIntoNodeProposal.java
r16290 r16601 2 2 3 3 import org.openstreetmap.josm.Main; 4 import org.openstreetmap.josm.data.coor.LatLon;5 4 import org.openstreetmap.josm.data.osm.Node; 6 5 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 6 import org.openstreetmap.josm.data.osm.Way; 8 7 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 8 import org.openstreetmap.josm.plugins.czechaddress.CzechAddressPlugin; 9 9 10 10 /** … … 66 66 way.remove(key); 67 67 68 Main. ds.addPrimitive(addrNode);68 Main.main.getCurrentDataSet().addPrimitive(addrNode); 69 69 } 70 70
Note:
See TracChangeset
for help on using the changeset viewer.