Changeset 18415 in osm for applications/editors/josm/plugins/multipoly
- Timestamp:
- 2009-11-02T08:53:38+01:00 (15 years ago)
- Location:
- applications/editors/josm/plugins/multipoly
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/multipoly/build.xml
r18142 r18415 47 47 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/> 48 48 <attribute name="Plugin-Link" value="http://svn.openstreetmap.org/applications/editors/josm/plugins/multipoly/"/> 49 <attribute name="Plugin-Mainversion" value="2 267"/>49 <attribute name="Plugin-Mainversion" value="2381"/> 50 50 </manifest> 51 51 </jar> -
applications/editors/josm/plugins/multipoly/src/multipoly/MultipolyAction.java
r18079 r18415 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.event.*; 7 import java.util.*; 6 import java.awt.event.ActionEvent; 7 import java.awt.event.KeyEvent; 8 import java.util.ArrayList; 9 import java.util.Collection; 10 import java.util.HashSet; 11 import java.util.LinkedList; 12 import java.util.List; 8 13 9 14 import javax.swing.JOptionPane; 10 15 16 import org.openstreetmap.josm.Main; 11 17 import org.openstreetmap.josm.actions.JosmAction; 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.command.*; 18 import org.openstreetmap.josm.command.AddCommand; 19 import org.openstreetmap.josm.command.Command; 20 import org.openstreetmap.josm.command.SequenceCommand; 14 21 import org.openstreetmap.josm.data.coor.EastNorth; 15 import org.openstreetmap.josm.data.osm.*; 16 import org.openstreetmap.josm.tools.*; 22 import org.openstreetmap.josm.data.osm.Node; 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 import org.openstreetmap.josm.data.osm.Relation; 25 import org.openstreetmap.josm.data.osm.RelationMember; 26 import org.openstreetmap.josm.data.osm.Way; 27 import org.openstreetmap.josm.tools.Pair; 28 import org.openstreetmap.josm.tools.Shortcut; 17 29 18 30 /** 19 31 * Create multipolygon from selected ways automatically. 20 * 32 * 21 33 * New relation with type=multipolygon is created 22 * 34 * 23 35 * If one or more of ways is already in relation with type=multipolygon or the way os not closed, 24 36 * then error is reported and no relation is created 25 * 37 * 26 38 * The "inner" and "outer" roles are guessed automatically. 27 39 * First, bbox is calculated for each way. then the largest area is assumed to be outside … … 39 51 setEnabled(true); 40 52 } 41 53 42 54 /** 43 55 * The action button has been clicked … … 48 60 // Get all ways in some type=multipolygon relation 49 61 HashSet<OsmPrimitive> relationsInMulti = new HashSet<OsmPrimitive>(); 50 for (Relation r : Main.main.getCurrentDataSet(). relations) {62 for (Relation r : Main.main.getCurrentDataSet().getRelations()) { 51 63 if (!r.isUsable()) continue; 52 64 if (r.get("type")!="multipolygon") continue; … … 60 72 61 73 //List of selected ways 62 List<Way> selectedWays = new ArrayList<Way>(); ;74 List<Way> selectedWays = new ArrayList<Way>(); 63 75 //Area of largest way (in square degrees) 64 76 double maxarea=0; … … 118 130 rel.put("type","multipolygon"); 119 131 //Add ways to it 120 for (int i=0;i<selectedWays.size();i++) { 132 for (int i=0;i<selectedWays.size();i++) { 121 133 Way s=selectedWays.get(i); 122 134 String xrole="inner";
Note:
See TracChangeset
for help on using the changeset viewer.