Changeset 31224 in osm for applications/editors
- Timestamp:
- 2015-06-06T18:54:58+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/FastDraw
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FastDraw/nbproject/project.xml
r30709 r31224 7 7 </general-data> 8 8 <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2"> 9 <!-- Не используйте диалоговое окно свойств проекта при редактировании данного файла вручную. --> 9 <!-- Не используйте средство настройки свойств проекта при редактировании файла вручную. 10 Чтобы средство настройки не отображалось, создайте файл nbproject/project.properties и добавьте в него свойство 11 auxiliary.show.customizer=false. 12 Если добавлено свойство 13 auxiliary.show.customizer.message=<message>, 14 при попытке открытия средства настройки любым пользователем будет отображаться заданное сообщение. --> 10 15 <name>FastDraw</name> 11 16 <properties/> 12 17 <folders> 13 18 <source-folder> 19 <label>FastDraw</label> 20 <location>.</location> 21 <encoding>UTF-8</encoding> 22 </source-folder> 23 <source-folder> 14 24 <label>src</label> 15 25 <type>java</type> 16 26 <location>src</location> 27 <encoding>UTF-8</encoding> 17 28 </source-folder> 18 29 <build-file> 19 <location> ../../dist/FastDraw.jar</location>30 <location>F:\josm\core\dist\josm-custom.jar</location> 20 31 </build-file> 21 32 </folders> 22 33 <ide-actions> 23 34 <action name="build"> 24 <target> compile</target>35 <target>install</target> 25 36 </action> 26 37 <action name="clean"> … … 30 41 <target>runjosm</target> 31 42 </action> 43 <action name="test"> 44 <target>test</target> 45 </action> 32 46 <action name="rebuild"> 33 47 <target>clean</target> 34 <target> compile</target>48 <target>install</target> 35 49 </action> 36 50 <action name="debug"> 37 <script>nbproject/ide- targets.xml</script>51 <script>nbproject/ide-file-targets.xml</script> 38 52 <target>debug-nb</target> 39 53 </action> … … 41 55 <export> 42 56 <type>jar</type> 43 <location> ../../dist/FastDraw.jar</location>44 <build-target> compile</build-target>57 <location>F:\josm\core\dist\josm-custom.jar</location> 58 <build-target>install</build-target> 45 59 </export> 46 60 <view> … … 59 73 <ide-action name="clean"/> 60 74 <ide-action name="run"/> 75 <ide-action name="test"/> 61 76 <ide-action name="debug"/> 62 77 </context-menu> … … 67 82 <compilation-unit> 68 83 <package-root>src</package-root> 69 <classpath mode="compile">../../core/src ;../../core/dist/josm-custom.jar</classpath>70 <built-to> ../../dist/FastDraw.jar</built-to>84 <classpath mode="compile">../../core/src</classpath> 85 <built-to>F:\josm\core\dist\josm-custom.jar</built-to> 71 86 <source-level>1.7</source-level> 72 87 </compilation-unit> -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java
r29457 r31224 35 35 // option for simplifiction: 0="Autosimplify and wait", 36 36 //1="Simplify and wait", 2="Save as is" 37 38 public boolean allowEditExistingWays; 37 39 38 40 public boolean drawClosed; … … 73 75 drawClosed = Main.pref.getBoolean("fastdraw.drawclosed", false); 74 76 simplifyMode = Main.pref.getInteger("fastdraw.simplifymode", 0); 77 allowEditExistingWays = Main.pref.getBoolean("fastdraw.alloweditexisting", false); 78 75 79 autoTags = Main.pref.get("fastdraw.autotags"); 76 80 } … … 91 95 Main.pref.putInteger("fastdraw.simplifymode", simplifyMode); 92 96 Main.pref.put("fastdraw.autotags", autoTags); 97 Main.pref.put("fastdraw.alloweditexisting", allowEditExistingWays); 93 98 try {Main.pref.save();} catch (IOException e) { 94 99 System.err.println(tr("Can not save preferences")); -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java
r30710 r31224 41 41 private final JCheckBox fixedClickCb = new JCheckBox(tr("Add fixed points on click")); 42 42 private final JCheckBox fixedSpaceCb = new JCheckBox(tr("Add fixed points on spacebar")); 43 private final JCheckBox allowEditExistingWaysCb = new JCheckBox(tr("Allow edit existing ways")); 43 44 private final JCheckBox drawClosedCb = new JCheckBox(tr("Draw closed polygons only")); 44 45 private final HistoryComboBox addTags = new HistoryComboBox(); … … 87 88 all.add(drawClosedCb,GBC.eop().insets(20,0,0,0)); 88 89 90 all.add(allowEditExistingWaysCb,GBC.eop().insets(20,0,0,0)); 91 89 92 addTags.setText(settings.autoTags); 90 93 text1.setValue(settings.epsilonMult); … … 95 98 fixedSpaceCb.setSelected(settings.fixedSpacebar); 96 99 drawClosedCb.setSelected(settings.drawClosed); 100 allowEditExistingWaysCb.setSelected(settings.allowEditExistingWays); 97 101 combo1.setSelectedIndex(settings.simplifyMode); 98 102 … … 110 114 public ExtendedDialog showDialog() { 111 115 ExtendedDialog result = super.showDialog(); 112 if (getValue() == 0) {116 if (getValue() == 1) { 113 117 try { 114 118 settings.epsilonMult=NumberFormat.getInstance().parse(text1.getText()).doubleValue(); … … 118 122 settings.fixedClick=fixedClickCb.isSelected(); 119 123 settings.fixedSpacebar=fixedSpaceCb.isSelected(); 124 settings.allowEditExistingWays=allowEditExistingWaysCb.isSelected(); 120 125 settings.drawClosed=drawClosedCb.isSelected(); 121 126 settings.simplifyMode=combo1.getSelectedIndex(); -
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r30710 r31224 15 15 import java.util.ArrayList; 16 16 import java.util.Collection; 17 import java.util.Collections; 17 18 import java.util.HashSet; 18 19 import java.util.Iterator; … … 27 28 import org.openstreetmap.josm.actions.mapmode.MapMode; 28 29 import org.openstreetmap.josm.command.AddCommand; 30 import org.openstreetmap.josm.command.ChangeCommand; 29 31 import org.openstreetmap.josm.command.Command; 30 32 import org.openstreetmap.josm.command.DeleteCommand; … … 73 75 private int nearestPointIndex; 74 76 private int dragNode=-1; 75 private SequenceCommand delCmd;76 77 private List<Node> oldNodes; 77 78 78 79 private boolean lineWasSaved; 79 80 private boolean deltaChanged; 81 private Way oldWay; 80 82 81 83 FastDrawingMode(MapFrame mapFrame) { … … 511 513 // <editor-fold defaultstate="collapsed" desc="Different action helper methods"> 512 514 public void newDrawing() { 513 if (delCmd!=null) delCmd.undoCommand(); 514 delCmd=null; oldNodes=null; 515 oldWay=null; oldNodes=null; 515 516 eps=settings.startingEps; 516 517 line.clear(); … … 526 527 Collection<Command> cmds = new LinkedList<>(); 527 528 int i = 0; 528 Way w = new Way(); 529 530 Way w; 531 if (oldWay==null) { 532 w = new Way(); 533 } else { 534 w = new Way(oldWay); 535 w.setNodes(new ArrayList<Node>()); // nodes will be created frosm scratch 536 } 537 529 538 LatLon first=pts.get(0); 530 539 Node firstNode=null; … … 570 579 } 571 580 } 572 if ( delCmd!=null) {581 if (oldWay!=null) { 573 582 List<Node> nodes = w.getNodes(); 583 cmds.add(new ChangeCommand(oldWay, w)); 574 584 for (Node nd: oldNodes) { 575 585 // node from old way but not in new way … … 577 587 List<OsmPrimitive> refs = nd.getReferrers(); 578 588 // does someone need this node? if no-delete it. 579 if (refs. isEmpty() && !nd.isDeleted() && nd.isUsable()) cmds.add(new DeleteCommand(nd));589 if (refs.size()==1 && !nd.isDeleted() && nd.isUsable() && !nd.isTagged()) cmds.add(new DeleteCommand(nd)); 580 590 } 581 591 } 582 delCmd = null; // that is all with this command 583 cmds.add(new AddCommand(w)); 592 oldWay = null; // that is all with this command 584 593 } else cmds.add(new AddCommand(w)); 585 594 Command c = new SequenceCommand(tr("Draw the way by mouse"), cmds); … … 638 647 639 648 private void loadFromWay(Way w) { 640 Collection<Command> cmds = new LinkedList<>();641 649 642 650 Object[] nodes = w.getNodes().toArray(); … … 645 653 for (int i=0;i<n;i++) { 646 654 Node nd=(Node) nodes[i]; 647 line.addLast(nd.getCoor()); 655 List<OsmPrimitive> refs = nd.getReferrers(); 656 if (refs.size()>1 || nd.isTagged()) { 657 line.addFixed(nd.getCoor()); 658 } else { 659 line.addLast(nd.getCoor()); 660 } 648 661 } 649 662 if (w.isClosed()) line.closeLine(); 650 663 oldNodes = w.getNodes(); 651 List <OsmPrimitive> wl = new ArrayList<>(); wl.add(w); 652 653 Command c = DeleteCommand.delete(getEditLayer(), wl, false); 654 if (c != null) cmds.add(c); 655 delCmd = new SequenceCommand(tr("Convert way to FastDraw line"), cmds); 656 Main.main.undoRedo.add(delCmd); 664 oldWay = w; 657 665 } 658 666 … … 690 698 Way w = selectedWays.iterator().next(); 691 699 692 if (w.isNew() ) loadFromWay(w);700 if (w.isNew() || settings.allowEditExistingWays) loadFromWay(w); 693 701 } 694 702 }
Note:
See TracChangeset
for help on using the changeset viewer.