Changeset 34817 in osm for applications/editors/josm/plugins/utilsplugin2/src/org
- Timestamp:
- 2019-01-12T15:03:13+01:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/UtilsPlugin2.java
r34454 r34817 3 3 4 4 import javax.swing.JMenu; 5 import javax.swing.JMenuItem;6 5 7 6 import org.openstreetmap.josm.data.osm.search.SearchCompiler; … … 55 54 private static UtilsPlugin2 instance; 56 55 57 JMenuItem copyTags;58 59 JMenuItem unglueRelation;60 JMenuItem symmetry;61 JMenuItem addIntersections;62 JMenuItem splitObject;63 JMenuItem selectWayNodes;64 JMenuItem adjNodes;65 JMenuItem unsNodes;66 JMenuItem midNodes;67 JMenuItem adjWays;68 JMenuItem adjWaysAll;69 JMenuItem intWays;70 JMenuItem intWaysR;71 JMenuItem allInside;72 JMenuItem undoSelection;73 JMenuItem extractPoint;74 JMenuItem wiki;75 JMenuItem latlon;76 JMenuItem multiTag;77 78 JMenuItem replaceGeometry;79 JMenuItem replaceMembership;80 JMenuItem tagBuffer;81 JMenuItem sourceTag;82 JMenuItem pasteRelations;83 JMenuItem alignWayNodes;84 JMenuItem splitOnIntersections;85 JMenuItem selModifiedNodes;86 JMenuItem selModifiedWays;87 JMenuItem selectHighway;88 JMenuItem selectAreaBoundary;89 90 JMenuItem selectURL;91 92 JMenuItem drawArc;93 94 56 public UtilsPlugin2(PluginInformation info) { 95 57 super(info); … … 101 63 JMenu selectionMenu = MainApplication.getMenu().selectionMenu; 102 64 103 copyTags =MainMenu.addAfter(editMenu, new CopyTagsAction(), false, MainApplication.getMenu().copy);65 MainMenu.addAfter(editMenu, new CopyTagsAction(), false, MainApplication.getMenu().copy); 104 66 105 addIntersections = MainMenu.add(toolsMenu, new AddIntersectionsAction()); 106 splitObject = MainMenu.add(toolsMenu, new SplitObjectAction()); 107 alignWayNodes = MainMenu.add(toolsMenu, new AlignWayNodesAction()); 108 symmetry = MainMenu.add(toolsMenu, new SymmetryAction()); 109 splitOnIntersections = MainMenu.add(toolsMenu, new SplitOnIntersectionsAction()); 110 unglueRelation = MainMenu.add(toolsMenu, new UnGlueRelationAction()); 67 MainMenu.add(toolsMenu, new AddIntersectionsAction()); 68 MainMenu.add(toolsMenu, new SplitObjectAction()); 69 MainMenu.add(toolsMenu, new AlignWayNodesAction()); 70 MainMenu.add(toolsMenu, new SymmetryAction()); 71 MainMenu.add(toolsMenu, new SplitOnIntersectionsAction()); 72 MainMenu.add(toolsMenu, new UnGlueRelationAction()); 73 111 74 toolsMenu.addSeparator(); 112 replaceGeometry = MainMenu.add(toolsMenu, new ReplaceGeometryAction()); 113 replaceMembership = MainMenu.add(toolsMenu, new ReplaceMembershipAction()); 114 extractPoint = MainMenu.add(toolsMenu, new ExtractPointAction()); 115 tagBuffer = MainMenu.add(toolsMenu, new TagBufferAction()); 116 sourceTag = MainMenu.add(toolsMenu, new TagSourceAction()); 117 pasteRelations = MainMenu.add(toolsMenu, new PasteRelationsAction()); 118 wiki = MainMenu.add(dataMenu, new OpenPageAction()); 119 latlon = MainMenu.add(toolsMenu, new LatLonAction()); 120 drawArc = MainMenu.add(toolsMenu, new CurveAction()); 75 76 MainMenu.add(toolsMenu, new ReplaceGeometryAction()); 77 MainMenu.add(toolsMenu, new ReplaceMembershipAction()); 78 MainMenu.add(toolsMenu, new ExtractPointAction()); 79 MainMenu.add(toolsMenu, new TagBufferAction()); 80 MainMenu.add(toolsMenu, new TagSourceAction()); 81 MainMenu.add(toolsMenu, new PasteRelationsAction()); 82 MainMenu.add(dataMenu, new OpenPageAction()); 83 MainMenu.add(toolsMenu, new LatLonAction()); 84 MainMenu.add(toolsMenu, new CurveAction()); 121 85 122 86 selectionMenu.addSeparator(); 123 87 124 selectWayNodes =MainMenu.add(selectionMenu, new SelectWayNodesAction());125 adjNodes =MainMenu.add(selectionMenu, new AdjacentNodesAction());126 unsNodes =MainMenu.add(selectionMenu, new UnselectNodesAction());127 midNodes =MainMenu.add(selectionMenu, new MiddleNodesAction());128 adjWays =MainMenu.add(selectionMenu, new AdjacentWaysAction());129 adjWaysAll =MainMenu.add(selectionMenu, new ConnectedWaysAction());130 intWays =MainMenu.add(selectionMenu, new IntersectedWaysAction());131 intWaysR =MainMenu.add(selectionMenu, new IntersectedWaysRecursiveAction());132 allInside =MainMenu.add(selectionMenu, new SelectAllInsideAction());133 selModifiedNodes =MainMenu.add(selectionMenu, new SelectModNodesAction());134 selModifiedWays =MainMenu.add(selectionMenu, new SelectModWaysAction());135 undoSelection =MainMenu.add(selectionMenu, new UndoSelectionAction());136 selectHighway =MainMenu.add(selectionMenu, new SelectHighwayAction());137 selectAreaBoundary =MainMenu.add(selectionMenu, new SelectBoundaryAction());88 MainMenu.add(selectionMenu, new SelectWayNodesAction()); 89 MainMenu.add(selectionMenu, new AdjacentNodesAction()); 90 MainMenu.add(selectionMenu, new UnselectNodesAction()); 91 MainMenu.add(selectionMenu, new MiddleNodesAction()); 92 MainMenu.add(selectionMenu, new AdjacentWaysAction()); 93 MainMenu.add(selectionMenu, new ConnectedWaysAction()); 94 MainMenu.add(selectionMenu, new IntersectedWaysAction()); 95 MainMenu.add(selectionMenu, new IntersectedWaysRecursiveAction()); 96 MainMenu.add(selectionMenu, new SelectAllInsideAction()); 97 MainMenu.add(selectionMenu, new SelectModNodesAction()); 98 MainMenu.add(selectionMenu, new SelectModWaysAction()); 99 MainMenu.add(selectionMenu, new UndoSelectionAction()); 100 MainMenu.add(selectionMenu, new SelectHighwayAction()); 101 MainMenu.add(selectionMenu, new SelectBoundaryAction()); 138 102 139 selectURL =MainMenu.add(dataMenu, new ChooseURLAction());140 multiTag =MainMenu.add(dataMenu, new MultiTagAction());103 MainMenu.add(dataMenu, new ChooseURLAction()); 104 MainMenu.add(dataMenu, new MultiTagAction()); 141 105 142 106 // register search operators … … 147 111 @Override 148 112 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 149 boolean enabled = newFrame != null;150 enabled = false;151 unglueRelation.setEnabled(enabled);152 addIntersections.setEnabled(enabled);153 splitObject.setEnabled(enabled);154 155 replaceGeometry.setEnabled(enabled);156 replaceMembership.setEnabled(enabled);157 tagBuffer.setEnabled(enabled);158 sourceTag.setEnabled(enabled);159 pasteRelations.setEnabled(enabled);160 alignWayNodes.setEnabled(enabled);161 splitOnIntersections.setEnabled(enabled);162 wiki.setEnabled(enabled);163 164 selectWayNodes.setEnabled(enabled);165 adjNodes.setEnabled(enabled);166 unsNodes.setEnabled(enabled);167 midNodes.setEnabled(enabled);168 adjWays.setEnabled(enabled);169 adjWaysAll.setEnabled(enabled);170 intWays.setEnabled(enabled);171 intWaysR.setEnabled(enabled);172 selModifiedNodes.setEnabled(enabled);173 selModifiedWays.setEnabled(enabled);174 undoSelection.setEnabled(enabled);175 selectURL.setEnabled(enabled);176 allInside.setEnabled(enabled);177 178 drawArc.setEnabled(enabled);179 multiTag.setEnabled(enabled);180 113 } 181 114 -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/PasteRelationsAction.java
r34812 r34817 14 14 import java.util.List; 15 15 import java.util.Map; 16 import java.util.Map.Entry; 16 17 17 18 import org.openstreetmap.josm.actions.JosmAction; … … 79 80 80 81 List<Command> commands = new ArrayList<>(); 81 for (Relation rel : relations.keySet()) { 82 for (Entry<Relation, String> entry : relations.entrySet()) { 83 Relation rel = entry.getKey(); 82 84 Relation r = new Relation(rel); 83 85 boolean changed = false; 84 86 for (OsmPrimitive p : selection) { 85 87 if (!r.getMemberPrimitives().contains(p) && !r.equals(p)) { 86 String role = relations.get(rel);88 String role = entry.getValue(); 87 89 if ("associatedStreet".equals(r.get("type"))) { 88 90 if (p.get("highway") != null) { -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/curves/CircleArcMaker.java
r34812 r34817 131 131 int i = 1; 132 132 for (EastNorth p : slice(points, 1, -2)) { 133 if ( i == p2Index.value) {133 if (p2Index.value != null && i == p2Index.value) { 134 134 Node n2new = new Node(n2); 135 135 n2new.setEastNorth(p); -
applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/selection/NodeWayUtils.java
r34816 r34817 410 410 int n = getRayIntersectionsCount(point, polygonPoints); 411 411 if (n < 0) return true; // we are near node or near edge 412 return (n % 2 == 1);412 return (n % 2 != 0); 413 413 } 414 414
Note:
See TracChangeset
for help on using the changeset viewer.