Changeset 11731 in josm
- Timestamp:
- 2017-03-13T20:29:33+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r11729 r11731 939 939 double yRay = y.applyAsDouble(rayFrom); 940 940 941 for (Way part : parts) {941 for (Way part : parts) { 942 942 // intersect against all way segments 943 943 for (int i = 0; i < part.getNodesCount() - 1; i++) { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r11730 r11731 464 464 Rectangle2D nb = fontMetrics.getStringBounds(name, g); // if slow, approximate by strlen()*maxcharbounds(font) 465 465 466 Rectangle2D centeredNBounds = text.getLabelPositionSt eategy().findLabelPlacement(area, nb);466 Rectangle2D centeredNBounds = text.getLabelPositionStrategy().findLabelPlacement(area, nb); 467 467 if (centeredNBounds != null) { 468 468 Font defaultFont = g.getFont(); … … 751 751 * @since 11670 752 752 */ 753 public void drawAreaIcon(OsmPrimitive osm, MapImage img, boolean disabled, boolean selected, boolean member, double theta, PositionForAreaStrategy iconPosition) { 753 public void drawAreaIcon(OsmPrimitive osm, MapImage img, boolean disabled, boolean selected, boolean member, double theta, 754 PositionForAreaStrategy iconPosition) { 754 755 Rectangle2D.Double iconRect = new Rectangle2D.Double(-img.getWidth() / 2.0, -img.getHeight() / 2.0, img.getWidth(), img.getHeight()); 755 756 … … 1112 1113 */ 1113 1114 public void drawText(OsmPrimitive osm, TextLabel text) { 1114 PositionForAreaStrategy position = text.getLabelPositionSt eategy();1115 PositionForAreaStrategy position = text.getLabelPositionStrategy(); 1115 1116 if (position.supportsGlyphVector()) { 1116 1117 if (osm instanceof Way) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaIconElement.java
r11730 r11731 14 14 * This class defines how an icon is rendered onto the area. 15 15 * @author Michael Zangl 16 * @since 117 2916 * @since 11730 17 17 */ 18 18 public class AreaIconElement extends StyleElement { … … 32 32 private final PositionForAreaStrategy iconPosition = PositionForAreaStrategy.PARTIALY_INSIDE; 33 33 34 pr ivateAreaIconElement(Cascade c, MapImage iconImage, RotationAngle iconImageAngle) {34 protected AreaIconElement(Cascade c, MapImage iconImage, RotationAngle iconImageAngle) { 35 35 super(c, 4.8f); 36 36 this.iconImage = Objects.requireNonNull(iconImage, "iconImage"); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/PositionForAreaStrategy.java
r11724 r11731 33 33 * @since 11722 34 34 */ 35 publicstatic PositionForAreaStrategy forKeyword(Keyword keyword) {35 static PositionForAreaStrategy forKeyword(Keyword keyword) { 36 36 return forKeyword(keyword, LINE); 37 37 } … … 44 44 * @since 11722 45 45 */ 46 publicstatic PositionForAreaStrategy forKeyword(Keyword keyword, PositionForAreaStrategy defaultStrategy) {46 static PositionForAreaStrategy forKeyword(Keyword keyword, PositionForAreaStrategy defaultStrategy) { 47 47 if (keyword == null) { 48 48 return defaultStrategy; … … 65 65 * @since 11722 66 66 */ 67 public staticPositionForAreaStrategy LINE = new OnLineStrategy();67 PositionForAreaStrategy LINE = new OnLineStrategy(); 68 68 69 69 /** … … 72 72 * @since 11722 73 73 */ 74 public staticPositionForAreaStrategy INSIDE = new CompletelyInsideAreaStrategy();74 PositionForAreaStrategy INSIDE = new CompletelyInsideAreaStrategy(); 75 75 76 76 /** … … 78 78 * @since 11722 79 79 */ 80 public staticPositionForAreaStrategy PARTIALY_INSIDE = new PartialyInsideAreaStrategy();80 PositionForAreaStrategy PARTIALY_INSIDE = new PartialyInsideAreaStrategy(); 81 81 82 82 /** … … 96 96 return true; 97 97 } 98 } ;98 } 99 99 100 100 /** … … 148 148 // | 8 3 7 | 149 149 // +-----------+ 150 Rectangle[] candidates = new Rectangle[] { new Rectangle(x2, y1, nbw, nbh), new Rectangle(x3, y2, nbw, nbh), 151 new Rectangle(x2, y3, nbw, nbh), new Rectangle(x1, y2, nbw, nbh), new Rectangle(x1, y1, nbw, nbh), 152 new Rectangle(x3, y1, nbw, nbh), new Rectangle(x3, y3, nbw, nbh), new Rectangle(x1, y3, nbw, nbh) }; 150 Rectangle[] candidates = new Rectangle[] { 151 new Rectangle(x2, y1, nbw, nbh), 152 new Rectangle(x3, y2, nbw, nbh), 153 new Rectangle(x2, y3, nbw, nbh), 154 new Rectangle(x1, y2, nbw, nbh), 155 new Rectangle(x1, y1, nbw, nbh), 156 new Rectangle(x3, y1, nbw, nbh), 157 new Rectangle(x3, y3, nbw, nbh), 158 new Rectangle(x1, y3, nbw, nbh) 159 }; 153 160 // Dumb algorithm to find a better placement. We could surely find a smarter one but it should 154 161 // solve most of building issues with only few calculations (8 at most) … … 176 183 * @since 11722 177 184 */ 178 publicclass PartialyInsideAreaStrategy extends CompletelyInsideAreaStrategy {185 class PartialyInsideAreaStrategy extends CompletelyInsideAreaStrategy { 179 186 @Override 180 187 public Rectangle2D findLabelPlacement(Shape area, Rectangle2D nb) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java
r11722 r11731 59 59 * The position strategy for this text label. 60 60 */ 61 private final PositionForAreaStrategy labelPositionSt eategy;61 private final PositionForAreaStrategy labelPositionStrategy; 62 62 63 63 /** … … 90 90 * @param haloRadius halo radius 91 91 * @param haloColor halo color 92 * @param labelPositionSteategy The position in the area. 93 */ 94 protected TextLabel(LabelCompositionStrategy strategy, Font font, int xOffset, int yOffset, Color color, Float haloRadius, Color haloColor, PositionForAreaStrategy labelPositionSteategy) { 92 * @param labelPositionStrategy The position in the area. 93 */ 94 protected TextLabel(LabelCompositionStrategy strategy, Font font, int xOffset, int yOffset, Color color, Float haloRadius, 95 Color haloColor, PositionForAreaStrategy labelPositionStrategy) { 95 96 this.labelCompositionStrategy = strategy; 96 97 this.font = Objects.requireNonNull(font, "font"); … … 100 101 this.haloRadius = haloRadius; 101 102 this.haloColor = haloColor; 102 this.labelPositionSt eategy = Objects.requireNonNull(labelPositionSteategy, "labelPositionSteategy");103 this.labelPositionStrategy = Objects.requireNonNull(labelPositionStrategy, "labelPositionStrategy"); 103 104 } 104 105 … … 116 117 this.haloColor = other.haloColor; 117 118 this.haloRadius = other.haloRadius; 118 this.labelPositionSt eategy = other.labelPositionSteategy;119 this.labelPositionStrategy = other.labelPositionStrategy; 119 120 } 120 121 … … 123 124 * 124 125 * @param other the other element. 125 * @param labelPositionSt eategy the position126 */ 127 private TextLabel(TextLabel other, PositionForAreaStrategy labelPositionSt eategy) {126 * @param labelPositionStrategy the position 127 */ 128 private TextLabel(TextLabel other, PositionForAreaStrategy labelPositionStrategy) { 128 129 this.labelCompositionStrategy = other.labelCompositionStrategy; 129 130 this.font = other.font; … … 133 134 this.haloColor = other.haloColor; 134 135 this.haloRadius = other.haloRadius; 135 this.labelPositionSt eategy = labelPositionSteategy;136 this.labelPositionStrategy = labelPositionStrategy; 136 137 } 137 138 … … 242 243 * @since 11722 243 244 */ 244 public PositionForAreaStrategy getLabelPositionSt eategy() {245 return labelPositionSt eategy;246 } 247 248 public TextLabel withPosition(PositionForAreaStrategy labelPositionSt eategy) {249 return new TextLabel(this, labelPositionSt eategy);245 public PositionForAreaStrategy getLabelPositionStrategy() { 246 return labelPositionStrategy; 247 } 248 249 public TextLabel withPosition(PositionForAreaStrategy labelPositionStrategy) { 250 return new TextLabel(this, labelPositionStrategy); 250 251 } 251 252 -
trunk/src/org/openstreetmap/josm/gui/util/RotationAngle.java
r11726 r11731 22 22 * The rotation along a way. 23 23 */ 24 staticfinal class WayDirectionRotationAngle implements RotationAngle {24 final class WayDirectionRotationAngle implements RotationAngle { 25 25 @Override 26 26 public double getRotationAngle(OsmPrimitive p) { … … 71 71 * A static rotation 72 72 */ 73 staticfinal class StaticRotationAngle implements RotationAngle {73 final class StaticRotationAngle implements RotationAngle { 74 74 private final double angle; 75 75 … … 121 121 * @since 11726 122 122 */ 123 staticRotationAngle NO_ROTATION = new StaticRotationAngle(0);123 RotationAngle NO_ROTATION = new StaticRotationAngle(0); 124 124 125 125 /**
Note:
See TracChangeset
for help on using the changeset viewer.