Changeset 20427 in osm for applications/editors
- Timestamp:
- 2010-03-11T21:26:09+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/routes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/routes/build.xml
r19473 r20427 18 18 ** 19 19 ** To build against the core in ../../core, create a correct manifest and deploy to 20 ** SVN, 20 ** SVN, 21 21 ** set the properties commit.message and plugin.main.version 22 22 ** and run … … 28 28 29 29 <property name="commit.message" value="Changed the constructor signature of the plugin main class" /> 30 <property name="plugin.main.version" value=" 2830" />30 <property name="plugin.main.version" value="3116" /> 31 31 32 32 <property name="josm" location="../../core/dist/josm-custom.jar"/> … … 96 96 97 97 <!-- 98 ************************** Publishing the plugin *********************************** 98 ************************** Publishing the plugin *********************************** 99 99 --> 100 100 <!-- 101 ** extracts the JOSM release for the JOSM version in ../core and saves it in the 101 ** extracts the JOSM release for the JOSM version in ../core and saves it in the 102 102 ** property ${coreversion.info.entry.revision} 103 103 ** … … 148 148 149 149 <!-- 150 ** commits the plugin.jar 150 ** commits the plugin.jar 151 151 --> 152 152 <target name="commit-dist"> 153 153 <echo> 154 154 ***** Properties of published ${plugin.jar} ***** 155 Commit message : '${commit.message}' 155 Commit message : '${commit.message}' 156 156 Plugin-Mainversion: ${plugin.main.version} 157 157 JOSM build version: ${coreversion.info.entry.revision} 158 158 Plugin-Version : ${version.entry.commit.revision} 159 ***** / Properties of published ${plugin.jar} ***** 160 159 ***** / Properties of published ${plugin.jar} ***** 160 161 161 Now commiting ${plugin.jar} ... 162 162 </echo> -
applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RelationEditMode.java
r19242 r20427 22 22 public class RelationEditMode extends MapMode { 23 23 private static final long serialVersionUID = -7767329767438266289L; 24 24 25 25 private Way highlightedWay; 26 26 27 27 public RelationEditMode(MapFrame mapFrame) { 28 29 30 28 super(tr("Edit relation"), "node/autonode", tr("Edit relations"), 29 Shortcut.registerShortcut("mapmode:editRelation", tr("Mode: {0}", tr("Edit relation")), KeyEvent.VK_H, Shortcut.GROUP_EDIT), 30 mapFrame, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 31 31 } 32 33 32 33 @Override 34 34 public void enterMode() { 35 36 37 38 39 40 35 super.enterMode(); 36 Main.map.mapView.addMouseListener(this); 37 Main.map.mapView.addMouseMotionListener(this); 38 } 39 40 @Override 41 41 public void exitMode() { 42 43 44 45 46 47 48 49 50 51 52 highlightedWay.highlighted = false;53 54 55 nearestWay.highlighted = true;56 57 58 Main.map.mapView.repaint(); 59 60 61 62 42 super.exitMode(); 43 Main.map.mapView.removeMouseListener(this); 44 Main.map.mapView.removeMouseMotionListener(this); 45 } 46 47 @Override 48 public void mouseMoved(MouseEvent e) { 49 Way nearestWay = Main.map.mapView.getNearestWay(e.getPoint()); 50 if (nearestWay != highlightedWay) { 51 if (highlightedWay != null) { 52 highlightedWay.setHighlighted(false); 53 } 54 if (nearestWay != null) { 55 nearestWay.setHighlighted(true); 56 } 57 highlightedWay = nearestWay; 58 Main.map.mapView.repaint(); 59 } 60 } 61 62 @Override 63 63 public void mouseClicked(MouseEvent e) { 64 Way way = Main.map.mapView.getNearestWay(e.getPoint()); 65 66 Collection<Relation> selectedRelations = Main.main.getCurrentDataSet().getSelectedRelations(); 67 68 if (way != null) { 69 70 if (selectedRelations.isEmpty()) { 71 JOptionPane.showMessageDialog(Main.parent, tr("No relation is selected")); 72 } 73 74 for (OsmPrimitive rel:selectedRelations) { 75 Relation r = (Relation)rel; 76 RelationMember foundMember = null; 77 for (RelationMember member:r.getMembers()) { 78 if (member.getMember() == way) { 79 foundMember = member; 80 break; 81 } 82 } 83 84 if (foundMember != null) { 85 Main.main.undoRedo.add(new RemoveRelationMemberCommand(r, new RelationMember("", way))); 86 } else { 87 Relation newRelation = new Relation(r); 88 newRelation.addMember(new RelationMember("", way)); 89 Main.main.undoRedo.add(new ChangeCommand(r, newRelation)); 90 } 91 } 92 } 93 } 64 Way way = Main.map.mapView.getNearestWay(e.getPoint()); 94 65 95 66 Collection<Relation> selectedRelations = Main.main.getCurrentDataSet().getSelectedRelations(); 67 68 if (way != null) { 69 70 if (selectedRelations.isEmpty()) { 71 JOptionPane.showMessageDialog(Main.parent, tr("No relation is selected")); 72 } 73 74 for (OsmPrimitive rel:selectedRelations) { 75 Relation r = (Relation)rel; 76 RelationMember foundMember = null; 77 for (RelationMember member:r.getMembers()) { 78 if (member.getMember() == way) { 79 foundMember = member; 80 break; 81 } 82 } 83 84 if (foundMember != null) { 85 Main.main.undoRedo.add(new RemoveRelationMemberCommand(r, new RelationMember("", way))); 86 } else { 87 Relation newRelation = new Relation(r); 88 newRelation.addMember(new RelationMember("", way)); 89 Main.main.undoRedo.add(new ChangeCommand(r, newRelation)); 90 } 91 } 92 } 93 } 94 95 96 96 97 97 }
Note:
See TracChangeset
for help on using the changeset viewer.