Changeset 11726 in josm
- Timestamp:
- 2017-03-13T18:54:20+01:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.classpath
r11571 r11726 21 21 <classpathentry kind="lib" path="test/lib/system-rules-1.16.1.jar"/> 22 22 <classpathentry kind="lib" path="test/lib/unitils-core/unitils-core-3.4.6.jar"/> 23 <classpathentry kind="lib" path="pja.jar"/> 23 24 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> 24 25 <classpathentry exported="true" kind="con" path="GROOVY_SUPPORT"/> -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r11553 r11726 1532 1532 settingsMap.keySet().stream() 1533 1533 .filter(key -> key.startsWith("color.")) 1534 . flatMap(key -> {1534 .map(key -> { 1535 1535 final String newKey = ColorProperty.getColorKey(key.substring("color.".length())); 1536 return key.equals(newKey) || settingsMap.containsKey(newKey) 1537 ? Stream.empty() 1538 : Stream.of(new AbstractMap.SimpleImmutableEntry<>(key, newKey)); 1536 return new AbstractMap.SimpleImmutableEntry<>(key, newKey); 1537 }) 1538 .filter(entry -> { 1539 return !entry.getKey().equals(entry.getValue()) && !settingsMap.containsKey(entry.getValue()); 1539 1540 }) 1540 1541 .collect(Collectors.toList()) // to avoid ConcurrentModificationException -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/RenderBenchmarkCollector.java
r10697 r11726 37 37 /** 38 38 * Notified when the renderer method starts drawing 39 * @param allStyleElems All the elements that are painted. 39 * @param allStyleElems All the elements that are painted. Unsorted 40 40 * @return <code>true</code> if the renderer should continue to render 41 41 */ -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java
r11722 r11726 15 15 import org.openstreetmap.josm.gui.mappaint.Environment; 16 16 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 17 import org.openstreetmap.josm.gui.util.RotationAngle;18 17 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 18 import org.openstreetmap.josm.tools.Utils; … … 63 62 public Float extentThreshold; 64 63 65 /** 66 * The icon that is displayed on the center of the area. 67 */ 68 private final MapImage iconImage; 69 70 /** 71 * The rotation of the {@link #iconImageAngle} 72 */ 73 private final RotationAngle iconImageAngle; 74 75 protected AreaElement(Cascade c, Color color, MapImage fillImage, Float extent, 76 Float extentThreshold, TextLabel text, MapImage iconImage, RotationAngle iconImageAngle) { 64 protected AreaElement(Cascade c, Color color, MapImage fillImage, Float extent, Float extentThreshold, TextLabel text) { 77 65 super(c, 1f); 78 66 CheckParameterUtil.ensureParameterNotNull(color); … … 82 70 this.extentThreshold = extentThreshold; 83 71 this.text = text; 84 this.iconImage = iconImage;85 this.iconImageAngle = iconImageAngle;86 72 } 87 73 … … 119 105 120 106 TextLabel text = null; // <- text is handled by TextElement 121 MapImage iconImage = NodeElement.createIcon(env);122 RotationAngle rotationAngle = NodeElement.createRotationAngle(env);123 124 if (iconImage != null) {125 // fake a transparent color.126 color = new Color(0, 0, 0, 0);127 }128 107 129 108 if (color != null) { … … 131 110 Float extentThreshold = c.get(FILL_EXTENT_THRESHOLD, null, float.class); 132 111 133 return new AreaElement(c, color, fillImage, extent, extentThreshold, text , iconImage, rotationAngle);112 return new AreaElement(c, color, fillImage, extent, extentThreshold, text); 134 113 } else { 135 114 return null; … … 156 135 painter.drawArea((Relation) osm, myColor, fillImage, extent, extentThreshold, painter.isInactiveMode() || osm.isDisabled(), text); 157 136 } 158 159 if (iconImage != null && painter.isShowIcons()) {160 painter.drawAreaIcon(osm, iconImage, painter.isInactiveMode() || osm.isDisabled(), selected, member,161 iconImageAngle == null ? 0.0 : iconImageAngle.getRotationAngle(osm));162 }163 137 } 164 138 … … 173 147 Objects.equals(text, that.text) && 174 148 Objects.equals(extent, that.extent) && 175 Objects.equals(extentThreshold, that.extentThreshold) && 176 Objects.equals(iconImage, that.iconImage) && 177 Objects.equals(iconImageAngle, that.iconImageAngle); 149 Objects.equals(extentThreshold, that.extentThreshold); 178 150 } 179 151 180 152 @Override 181 153 public int hashCode() { 182 return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold , iconImage, iconImageAngle);154 return Objects.hash(super.hashCode(), color, fillImage, text, extent, extentThreshold); 183 155 } 184 156 … … 186 158 public String toString() { 187 159 return "AreaElemStyle{" + super.toString() + "color=" + Utils.toString(color) + 188 " fillImage=[" + fillImage + "] iconImage=[" + iconImage + "] iconImageAngle=[" + iconImageAngle + "]}";160 " fillImage=[" + fillImage + "]}"; 189 161 } 190 162 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r11702 r11726 66 66 this.mapImage = mapImage; 67 67 this.symbol = symbol; 68 this.mapImageAngle = rotationAngle; 68 this.mapImageAngle = Objects.requireNonNull(rotationAngle, "rotationAngle"); 69 69 } 70 70 … … 106 106 Cascade c = env.mc.getCascade(env.layer); 107 107 108 RotationAngle rotationAngle = null;108 RotationAngle rotationAngle = RotationAngle.NO_ROTATION; 109 109 final Float angle = c.get(ICON_ROTATION, null, Float.class, true); 110 110 if (angle != null) { -
trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java
r11725 r11726 116 116 } 117 117 } 118 119 /** 120 * A no-rotation angle that always returns 0. 121 * @since 11726 122 */ 123 static RotationAngle NO_ROTATION = new StaticRotationAngle(0); 118 124 119 125 /** -
trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
r11714 r11726 98 98 new TestConfig("area-fill-image", AREA_DEFAULT), 99 99 100 /** Tests area label drawing/placement */ 101 new TestConfig("area-text", AREA_DEFAULT), 102 100 103 /** Tests if all styles are sorted correctly. Tests {@link StyleRecord#compareTo(StyleRecord)} */ 101 104 new TestConfig("order", AREA_DEFAULT) -
trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java
r10945 r11726 48 48 Layer layer = new OsmDataLayer(ds, null, null); 49 49 Main.getLayerManager().addLayer(layer); 50 // FIXME enable this test after we fix the bug. Test disabled for now 51 // try { 52 // new JoinAreasAction().join(ds.getWays()); 53 // } finally { 54 // Ensure we clean the place before leaving, even if test fails. 55 Main.getLayerManager().removeLayer(layer); 56 // } 50 try { 51 new JoinAreasAction().join(ds.getWays()); 52 } finally { 53 // Ensure we clean the place before leaving, even if test fails. 54 Main.getLayerManager().removeLayer(layer); 55 } 57 56 } 58 57 } … … 77 76 Main.main.menu.joinAreas.join(Utils.filteredCollection(found, Way.class)); 78 77 79 Collection<OsmPrimitive> found2 = SearchAction.searchAndReturn("type: wayref="+ref, SearchAction.SearchMode.replace);78 Collection<OsmPrimitive> found2 = SearchAction.searchAndReturn("type:relation ref="+ref, SearchAction.SearchMode.replace); 80 79 assertEquals(1, found2.size()); 81 80 System.out.println(" ==> OK");
Note:
See TracChangeset
for help on using the changeset viewer.