Changeset 4724 in josm
- Timestamp:
- 2011-12-27T16:31:36+01:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r4719 r4724 39 39 import javax.swing.JTextArea; 40 40 import javax.swing.KeyStroke; 41 import javax.swing.RepaintManager;42 41 import javax.swing.UIManager; 43 42 … … 887 886 while(it.hasNext()){ 888 887 WeakReference<ProjectionChangeListener> wr = it.next(); 889 if (wr.get() == null) { 888 ProjectionChangeListener listener = wr.get(); 889 if (listener == null) { 890 890 it.remove(); 891 891 continue; 892 892 } 893 wr.get().projectionChanged(oldValue, newValue);893 listener.projectionChanged(oldValue, newValue); 894 894 } 895 895 } -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r4580 r4724 208 208 209 209 /* 210 * Holding bin for changeset tag information, to be applied when or if this is ever uploaded.211 */210 * Holding bin for changeset tag information, to be applied when or if this is ever uploaded. 211 */ 212 212 private Map<String, String> changeSetTags = new HashMap<String, String>(); 213 213 … … 586 586 selectedPrimitives = new LinkedHashSet<OsmPrimitive>(); 587 587 changed = addSelected(selection, false) 588 || (!wasEmpty && selectedPrimitives.isEmpty());588 || (!wasEmpty && selectedPrimitives.isEmpty()); 589 589 if (changed) { 590 590 selectionSnapshot = null; … … 783 783 } 784 784 785 /**786 *787 * @param primitiveId788 * @param createNew789 * @return790 * @deprecated This method can created inconsistent dataset when called for node with id < 0 and createNew=true. That will add791 * complete node without coordinates to dataset which is not allowed.792 */793 @Deprecated794 public OsmPrimitive getPrimitiveById(PrimitiveId primitiveId, boolean createNew) {795 OsmPrimitive result = primitivesMap.get(primitiveId);796 797 if (result == null && createNew) {798 switch (primitiveId.getType()) {799 case NODE: result = new Node(primitiveId.getUniqueId(), true); break;800 case WAY: result = new Way(primitiveId.getUniqueId(), true); break;801 case RELATION: result = new Relation(primitiveId.getUniqueId(), true); break;802 }803 addPrimitive(result);804 }805 806 return result;807 }808 785 809 786 /** … … 1175 1152 return ret; 1176 1153 } 1177 1154 1178 1155 /** 1179 1156 * Moves all primitives and datasources from DataSet "from" to this DataSet -
trunk/src/org/openstreetmap/josm/data/osm/NodeData.java
r4431 r4724 23 23 24 24 private boolean isLatLonKnown() { 25 return lat != Double.NaN && lon != Double.NaN;25 return !Double.isNaN(lat) && !Double.isNaN(lon); 26 26 } 27 27 -
trunk/src/org/openstreetmap/josm/data/osm/PrimitiveData.java
r4099 r4724 3 3 4 4 import java.util.ArrayList; 5 import java.util.Arrays; 5 6 import java.util.Collection; 6 7 import java.util.List; … … 27 28 this.id = id; 28 29 } 29 30 30 31 public void setVersion(int version) { 31 32 this.version = version; 32 33 } 33 34 34 35 /** 35 36 * override to make it public … … 45 46 public String toString() { 46 47 StringBuilder builder = new StringBuilder(); 47 builder.append(id).append( keys).append(getFlagsAsString());48 builder.append(id).append(Arrays.toString(keys)).append(getFlagsAsString()); 48 49 return builder.toString(); 49 50 } -
trunk/src/org/openstreetmap/josm/data/osm/history/History.java
r4602 r4724 71 71 } 72 72 } 73 );73 ); 74 74 return new History(id, type, copy); 75 75 } … … 84 84 } 85 85 } 86 );86 ); 87 87 return new History(id, type,copy); 88 88 } … … 96 96 } 97 97 } 98 );98 ); 99 99 } 100 100 … … 107 107 } 108 108 } 109 );109 ); 110 110 } 111 111 … … 122 122 } 123 123 } 124 );124 ); 125 125 } 126 126 … … 133 133 } 134 134 } 135 );135 ); 136 136 } 137 137 … … 140 140 } 141 141 142 public History forUser(final String user) {143 return filter(144 this,145 new FilterPredicate() {146 public boolean matches(HistoryOsmPrimitive primitive) {147 return primitive.getUser().equals(user);148 }149 }150 );151 }152 153 142 public History forUserId(final long uid) { 154 143 return filter( … … 159 148 } 160 149 } 161 );150 ); 162 151 } 163 152 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java
r4627 r4724 252 252 * represent a line that is shifted by a certain offset perpendicular 253 253 * to the way direction. 254 * 254 * 255 255 * There is no intention, to handle consecutive duplicate Nodes in a 256 256 * perfect way, but it is should not throw an exception. … … 328 328 int m = dx_next*(y_current0 - y_prev0) - dy_next*(x_current0 - x_prev0); 329 329 330 int cx_ = x_prev0 + Math.round( m * dx_prev / det);331 int cy_ = y_prev0 + Math.round( m * dy_prev / det);330 int cx_ = x_prev0 + Math.round((float)m * dx_prev / det); 331 int cy_ = y_prev0 + Math.round((float)m * dy_prev / det); 332 332 ++idx; 333 333 prev = current; … … 809 809 810 810 Shape area = path.createTransformedShape(nc.getAffineTransform()); 811 811 812 812 if (!isOutlineOnly) { 813 813 if (fillImage == null) { … … 816 816 } else { 817 817 TexturePaint texture = new TexturePaint(fillImage, 818 // new Rectangle(polygon.xpoints[0], polygon.ypoints[0], fillImage.getWidth(), fillImage.getHeight()));819 new Rectangle(0, 0, fillImage.getWidth(), fillImage.getHeight()));818 // new Rectangle(polygon.xpoints[0], polygon.ypoints[0], fillImage.getWidth(), fillImage.getHeight())); 819 new Rectangle(0, 0, fillImage.getWidth(), fillImage.getHeight())); 820 820 g.setPaint(texture); 821 821 if (fillImageAlpha != 1f) { … … 858 858 859 859 if ((pb.width >= nb.getWidth() && pb.height >= nb.getHeight()) && // quick check 860 area.contains(centeredNBounds) // slow but nice861 ) {860 area.contains(centeredNBounds) // slow but nice 861 ) { 862 862 g.setColor(text.color); 863 863 Font defaultFont = g.getFont(); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r3851 r4724 45 45 { 46 46 return tr("Remote Control has been asked to load data from the API.") + 47 "<br>" + tr("Request details: {0}", request);47 "<br>" + tr("Request details: {0}", request); 48 48 } 49 49 … … 81 81 Area toDownload = null; 82 82 DataSet ds = Main.main.getCurrentDataSet(); 83 if (ds != null) 83 if (ds != null) { 84 84 present = ds.getDataSourceArea(); 85 } 85 86 if (present != null && !present.isEmpty()) { 86 87 toDownload = new Area(new Rectangle2D.Double(minlon,minlat,maxlon-minlon,maxlat-minlat)); … … 168 169 } 169 170 ds.setSelected(newSel); 170 if (Main.pref.getBoolean(changeViewportPermissionKey, changeViewportPermissionDefault)) 171 if (Main.pref.getBoolean(changeViewportPermissionKey, changeViewportPermissionDefault)) { 171 172 new AutoScaleAction("selection").actionPerformed(null); 173 } 172 174 } 173 175 }); … … 189 191 tags = URLDecoder.decode(args.get("addtags"), "UTF-8").split("\\|"); 190 192 } catch (UnsupportedEncodingException e) { 191 new RuntimeException();193 throw new RuntimeException(); 192 194 } 193 195 String[][] keyValue = new String[tags.length][2]; -
trunk/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java
r4546 r4724 171 171 List<OsmPrimitive> lhsList = lhs.getPrimitives(root); 172 172 for (OsmPrimitive o: rhs.getPrimitives(root)) { 173 if (lhsList.contains(o) && condition == null && condition.match(o)) {173 if (lhsList.contains(o) && (condition == null || condition.match(o))) { 174 174 result.add(o); 175 175 }
Note:
See TracChangeset
for help on using the changeset viewer.