From f76c55c2b52444b2f80c0dbcb235ee6a4b77bf38 Mon Sep 17 00:00:00 2001
From: Michael Zangl <michael.zangl@student.kit.edu>
Date: Fri, 24 Jul 2015 10:28:20 +0200
Subject: [PATCH] Added StyledMapRenderer documentation.
---
.../osm/visitor/paint/AbstractMapRenderer.java | 1 +
.../data/osm/visitor/paint/StyledMapRenderer.java | 60 +++++++++++++++++++++-
2 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
index 97a6006..205323e 100644
a
|
b
|
public abstract class AbstractMapRenderer implements Rendering {
|
87 | 87 | * @param p1 First point of the way segment. |
88 | 88 | * @param p2 Second point of the way segment. |
89 | 89 | * @param orderNumber The number of the segment in the way. |
| 90 | * @param clr The color to use for drawing the text. |
90 | 91 | */ |
91 | 92 | protected void drawOrderNumber(Point p1, Point p2, int orderNumber, Color clr) { |
92 | 93 | if (isSegmentVisible(p1, p2) && isLargeSegment(p1, p2, segmentNumberSpace)) { |
diff --git a/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java b/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
index ba06c2a..381bcb5 100644
a
|
b
|
public class StyledMapRenderer extends AbstractMapRenderer {
|
257 | 257 | * this case, but the method has been changed to simply return false by default. |
258 | 258 | * (This can be changed with a setting in the advanced preferences.) |
259 | 259 | * |
| 260 | * @param font The font to check. |
260 | 261 | * @return false by default, but depends on the value of the advanced |
261 | 262 | * preference glyph-bug=false|true|auto, where auto is the automatic detection |
262 | 263 | * method which apparently no longer gives a useful result for Java 7. |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
290 | 291 | |
291 | 292 | private Color highlightColorTransparent; |
292 | 293 | |
| 294 | /** |
| 295 | * Flags used to store the primitive state along with the style. This is the normal style. |
| 296 | * <p> |
| 297 | * Not used in any public interfaces. |
| 298 | */ |
293 | 299 | private static final int FLAG_NORMAL = 0; |
| 300 | /** |
| 301 | * A primitive with {@link OsmPrimitive#isDisabled()} |
| 302 | */ |
294 | 303 | private static final int FLAG_DISABLED = 1; |
| 304 | /** |
| 305 | * A primitive with {@link OsmPrimitive#isMemberOfSelected()} |
| 306 | */ |
295 | 307 | private static final int FLAG_MEMBER_OF_SELECTED = 2; |
| 308 | /** |
| 309 | * A primitive with {@link OsmPrimitive#isSelected()} |
| 310 | */ |
296 | 311 | private static final int FLAG_SELECTED = 4; |
| 312 | /** |
| 313 | * A primitive with {@link OsmPrimitive#isOuterMemberOfSelected()} |
| 314 | */ |
297 | 315 | private static final int FLAG_OUTERMEMBER_OF_SELECTED = 8; |
298 | 316 | |
299 | 317 | private static final double PHI = Math.toRadians(20); |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
536 | 554 | } |
537 | 555 | } |
538 | 556 | |
| 557 | /** |
| 558 | * Draws a multipolygon area. |
| 559 | * @param r The multipolygon relation |
| 560 | * @param color The color to fill the area with. |
| 561 | * @param fillImage The image to fill the area with. Overrides color. |
| 562 | * @param disabled If this should be drawn with a special disabled style. |
| 563 | * @param text The text to write on the area. |
| 564 | */ |
539 | 565 | public void drawArea(Relation r, Color color, MapImage fillImage, boolean disabled, TextElement text) { |
540 | 566 | Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r); |
541 | 567 | if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) { |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
551 | 577 | } |
552 | 578 | } |
553 | 579 | |
| 580 | /** |
| 581 | * Draws an area defined by a way. They way does not need to be closed, but it should. |
| 582 | * @param w The way. |
| 583 | * @param color The color to fill the area with. |
| 584 | * @param fillImage The image to fill the area with. Overrides color. |
| 585 | * @param disabled If this should be drawn with a special disabled style. |
| 586 | * @param text The text to write on the area. |
| 587 | */ |
554 | 588 | public void drawArea(Way w, Color color, MapImage fillImage, boolean disabled, TextElement text) { |
555 | 589 | drawArea(w, getPath(w), color, fillImage, disabled, text); |
556 | 590 | } |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
618 | 652 | * |
619 | 653 | * @param way the way |
620 | 654 | * @param pattern the image |
| 655 | * @param disabled If this should be drawn with a special disabled style. |
621 | 656 | * @param offset offset from the way |
622 | 657 | * @param spacing spacing between two images |
623 | 658 | * @param phase initial spacing |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
846 | 881 | /** |
847 | 882 | * Draw a number of the order of the two consecutive nodes within the |
848 | 883 | * parents way |
| 884 | * |
| 885 | * @param n1 First node of the way segment. |
| 886 | * @param n2 Second node of the way segment. |
| 887 | * @param orderNumber The number of the segment in the way. |
| 888 | * @param clr The color to use for drawing the text. |
849 | 889 | */ |
850 | 890 | public void drawOrderNumber(Node n1, Node n2, int orderNumber, Color clr) { |
851 | 891 | Point p1 = nc.getPoint(n1); |
852 | 892 | Point p2 = nc.getPoint(n2); |
853 | | StyledMapRenderer.this.drawOrderNumber(p1, p2, orderNumber, clr); |
| 893 | drawOrderNumber(p1, p2, orderNumber, clr); |
854 | 894 | } |
855 | 895 | |
856 | 896 | /** |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
1067 | 1107 | pVia, vx, vx2, vy, vy2, iconAngle, r.isSelected()); |
1068 | 1108 | } |
1069 | 1109 | |
| 1110 | /** |
| 1111 | * Draws a text along a given way. |
| 1112 | * @param way The way to draw the text on. |
| 1113 | * @param text The text definition (font/.../text content) to draw. |
| 1114 | */ |
1070 | 1115 | public void drawTextOnPath(Way way, TextElement text) { |
1071 | 1116 | if (way == null || text == null) |
1072 | 1117 | return; |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
1236 | 1281 | } |
1237 | 1282 | |
1238 | 1283 | /** |
1239 | | * draw way |
| 1284 | * draw way. This method allows for two draw styles (line using color, dashes using dashedColor) to be passed. |
| 1285 | * @param way The way to draw |
| 1286 | * @param color The base color to draw the way in |
| 1287 | * @param line The line style to use. This is drawn using color. |
| 1288 | * @param dashes The dash style to use. This is drawn using dashedColor. <code>null</code> if unused. |
| 1289 | * @param dashedColor The color of the dashes. |
| 1290 | * @param offset |
1240 | 1291 | * @param showOrientation show arrows that indicate the technical orientation of |
1241 | 1292 | * the way (defined by order of nodes) |
| 1293 | * @param showHeadArrowOnly True if only the arrow at the end of the line but not those on the segments should be displayed. |
1242 | 1294 | * @param showOneway show symbols that indicate the direction of the feature, |
1243 | 1295 | * e.g. oneway street or waterway |
1244 | 1296 | * @param onewayReversed for oneway=-1 and similar |
… |
… |
public class StyledMapRenderer extends AbstractMapRenderer {
|
1366 | 1418 | displaySegments(path, orientationArrows, onewayArrows, onewayArrowsCasing, color, line, dashes, dashedColor); |
1367 | 1419 | } |
1368 | 1420 | |
| 1421 | /** |
| 1422 | * Gets the "circum". This is the distance on the map in meters that 100 screen pixels represent. |
| 1423 | * @return The "circum" |
| 1424 | */ |
1369 | 1425 | public double getCircum() { |
1370 | 1426 | return circum; |
1371 | 1427 | } |