Changeset 18892 in osm for applications/editors/josm/plugins/czechaddress
- Timestamp:
- 2009-12-02T16:17:08+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/czechaddress
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/czechaddress/build.xml
r18803 r18892 75 75 <arg value="."/> 76 76 </exec> 77 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/> 77 <xmlproperty file="REVISION" prefix="version" 78 keepRoot="false" collapseAttributes="true"/> 78 79 <delete file="REVISION"/> 79 80 </target> … … 94 95 95 96 <target name="run" depends="compile"> 96 <fail message="You must firstly compile the JOSM itself"><condition><not> 97 <resourcecount count="1" when="gt"> 98 <fileset id="josm" dir="${josm.classpath}" includes="*"/> 99 </resourcecount> 100 </not></condition></fail> 97 <fail message="You must firstly compile the JOSM itself"> 98 <condition> 99 <not> 100 <resourcecount count="1" when="gt"> 101 <fileset includes="*" id="josm" 102 dir="${josm.classpath}"/> 103 </resourcecount> 104 </not> 105 </condition> 106 </fail> 101 107 102 108 <java classname="JOSM" fork="true"> … … 117 123 118 124 119 <target name="profile" depends="compile" description="Profile CzechAddress"> 120 <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail> 125 <target name="profile" depends="compile" 126 description="Profile CzechAddress with Netbeans"> 127 <fail unless="netbeans.home"> 128 This target can only run inside the NetBeans IDE. 129 </fail> 121 130 <nbprofiledirect> 122 <classpath><pathelement location="${plugin.build.dir}"/></classpath> 131 <classpath> 132 <pathelement location="${plugin.build.dir}"/> 133 </classpath> 123 134 </nbprofiledirect> 124 135 <java classname="JOSM" fork="true"> … … 135 146 </java> 136 147 </target> 148 149 <target name="debug" depends="compile" 150 description="Debug CzechAddress with Netbeans"> 151 <fail message="You must firstly compile the JOSM itself"> 152 <condition> 153 <not> 154 <resourcecount count="1" when="gt"> 155 <fileset dir="${josm.classpath}" 156 includes="*" id="josm"/> 157 </resourcecount> 158 </not> 159 </condition> 160 </fail> 161 <nbjpdastart addressproperty="jpda.address" 162 name="czechaddress" 163 transport="dt_socket"/> 164 <java classname="JOSM" fork="true"> 165 <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> 166 <jvmarg value="-Xmx1024m"/> 167 <jvmarg value="-Xdebug"/> 168 <jvmarg value="-ea"/> 169 <classpath> 170 <pathelement location="${plugin.build.dir}"/> 171 <pathelement path="${java.class.path}"/> 172 </classpath> 173 <classpath> 174 <pathelement location="${josm}"/> 175 <pathelement path="${java.class.path}"/> 176 </classpath> 177 </java> 178 </target> 179 137 180 </project> -
applications/editors/josm/plugins/czechaddress/nbproject/project.xml
r16417 r18892 46 46 <target>dist</target> 47 47 </action> 48 <action name="debug"> 49 <!--<script>nbproject/ide-targets.xml</script>--> 50 <target>debug</target> 51 </action> 48 52 </ide-actions> 49 53 <export> … … 72 76 <ide-action name="javadoc"/> 73 77 <ide-action name="run"/> 78 <ide-action name="debug"/> 74 79 </context-menu> 75 80 </view> -
applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/actions/SplitAreaByEmptyWayAction.java
r18413 r18892 7 7 import java.util.Collection; 8 8 import java.util.Collections; 9 import java.util.List; 9 10 10 11 import javax.swing.JOptionPane; … … 12 13 import org.openstreetmap.josm.Main; 13 14 import org.openstreetmap.josm.actions.JosmAction; 15 import org.openstreetmap.josm.data.osm.Node; 14 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 17 import org.openstreetmap.josm.data.osm.Relation; … … 111 113 private int splitArea(Way area, Way border, Way newArea1, Way newArea2) { 112 114 113 Way tempBorder = new Way(border); 115 for (Relation r : Main.main.getCurrentDataSet().getRelations()) 116 for (RelationMember rm : r.getMembers()) 117 if (rm.refersTo(area) || rm.refersTo(border)) 118 return 2; 114 119 115 int index1 = area.getNodes().indexOf(tempBorder.firstNode()); 116 int index2 = area.getNodes().indexOf(tempBorder.lastNode()); 120 List<Node> bordNodes = border.getNodes(); 121 List<Node> areaNodes = area.getNodes(); 122 123 int index1 = areaNodes.indexOf(bordNodes.get(0)); 124 int index2 = areaNodes.indexOf(bordNodes.get(bordNodes.size()-1)); 117 125 if (index1 == index2) 118 126 return 1; 119 127 120 128 if (index1 > index2) { 121 Collections.reverse( tempBorder.getNodes());122 index1 = area .getNodes().indexOf(tempBorder.firstNode());123 index2 = area .getNodes().indexOf(tempBorder.lastNode());129 Collections.reverse(areaNodes); 130 index1 = areaNodes.indexOf(bordNodes.get(0)); 131 index2 = areaNodes.indexOf(bordNodes.get(bordNodes.size()-1)); 124 132 } 125 126 for (Relation relation : Main.main.getCurrentDataSet().getRelations())127 for (RelationMember areaMember : relation.getMembers())128 if (area.equals(areaMember.getMember()))129 return 2;130 133 131 134 for (String key : area.keySet()) { … … 134 137 } 135 138 136 newArea1.getNodes().addAll(area.getNodes().subList(0, index1)); 137 newArea1.getNodes().addAll(tempBorder.getNodes()); 138 newArea1.getNodes().addAll(area.getNodes().subList(index2, area.getNodes().size()-1)); 139 newArea1.getNodes().add(area.getNodes().get(0)); 139 List<Node> newNodeList1 = newArea1.getNodes(); 140 List<Node> newNodeList2 = newArea1.getNodes(); 140 141 141 Collections.reverse(tempBorder.getNodes()); 142 newArea2.getNodes().addAll(area.getNodes().subList(index1, index2)); 143 newArea2.getNodes().addAll(tempBorder.getNodes()); 144 newArea2.getNodes().add(area.getNodes().get(index1)); 142 newNodeList1.addAll(areaNodes.subList(0, index1)); 143 newNodeList1.addAll(bordNodes); 144 newNodeList1.addAll(areaNodes.subList(index2 + 1, areaNodes.size())); 145 145 146 removeDuplicateNodesFromWay(newArea1); 147 removeDuplicateNodesFromWay(newArea2); 146 Collections.reverse(bordNodes); 147 newNodeList2.addAll(areaNodes.subList(index1, index2)); 148 newNodeList2.addAll(bordNodes); 149 150 newArea1.setNodes(newNodeList1); 151 newArea2.setNodes(newNodeList2); 148 152 149 153 return 0; 150 154 } 151 152 /**153 * Removes all consequent nodes, which are on the same way.154 */155 void removeDuplicateNodesFromWay(Way w) {156 int i=0;157 while (i<w.getNodes().size()-1) {158 if (w.getNodes().get(i).equals(w.getNodes().get(i+1)))159 w.getNodes().remove(i);160 else161 i++;162 }163 }164 155 }
Note:
See TracChangeset
for help on using the changeset viewer.