Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java (revision 1634)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java (revision 1635)
@@ -55,5 +55,5 @@
protected Color untaggedColor;
protected Color textColor;
- protected int currentDashed = 0;
+ protected float[] currentDashed = new float[0];
protected Color currentDashedColor;
protected int currentWidth = 0;
@@ -250,5 +250,5 @@
int width = defaultSegmentWidth;
int realWidth = 0; /* the real width of the element in meters */
- int dashed = 0;
+ float dashed[] = new float[0];
Color dashedColor = null;
Node lastN;
@@ -1125,7 +1125,7 @@
}
- private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, int dashed, Color dashedColor) {
+ private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, float dashed[], Color dashedColor) {
//profilerSegments++;
- if (col != currentColor || width != currentWidth || dashed != currentDashed || dashedColor != currentDashedColor) {
+ if (col != currentColor || width != currentWidth || !Arrays.equals(dashed,currentDashed) || dashedColor != currentDashedColor) {
displaySegments(col, width, dashed, dashedColor);
}
@@ -1149,14 +1149,19 @@
protected void displaySegments() {
- displaySegments(null, 0, 0, null);
- }
-
- protected void displaySegments(Color newColor, int newWidth, int newDash, Color newDashedColor) {
+ displaySegments(null, 0, new float[0], null);
+ }
+
+ protected void displaySegments(Color newColor, int newWidth, float newDash[], Color newDashedColor) {
if (currentPath != null) {
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(inactive ? inactiveColor : currentColor);
if (currentStroke == null && useStrokes > dist) {
- if (currentDashed != 0)
- g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,new float[] {currentDashed},0));
+ if (currentDashed.length > 0) {
+ try {
+ g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,currentDashed,0));
+ } catch (IllegalArgumentException e) {
+ g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
+ }
+ }
else
g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
@@ -1167,6 +1172,15 @@
g2d.setColor(currentDashedColor);
if (currentStroke == null && useStrokes > dist) {
- if (currentDashed != 0)
- g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,new float[] {currentDashed},currentDashed));
+ if (currentDashed.length > 0) {
+ float[] currentDashedOffset = new float[currentDashed.length];
+ System.arraycopy(currentDashed, 1, currentDashedOffset, 0, currentDashed.length - 1);
+ currentDashedOffset[currentDashed.length-1] = currentDashed[0];
+ float offset = currentDashedOffset[0];
+ try {
+ g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,currentDashedOffset,offset));
+ } catch (IllegalArgumentException e) {
+ g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
+ }
+ }
else
g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java (revision 1634)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java (revision 1635)
@@ -105,9 +105,13 @@
try
{
- line.dashed=Integer.parseInt(atts.getValue(count));
+ String[] parts = atts.getValue(count).split(",");
+ line.dashed = new float[parts.length];
+ for (int i = 0; i < parts.length; i++) {
+ line.dashed[i] = (float)(Integer.parseInt(parts[i]));
+ }
} catch (NumberFormatException nfe) {
boolean dashed=Boolean.parseBoolean(atts.getValue(count));
if(dashed) {
- line.dashed = 9;
+ line.dashed = new float[]{9};
}
}
Index: /trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java (revision 1634)
+++ /trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java (revision 1635)
@@ -9,5 +9,5 @@
public int realWidth; //the real width of this line in meter
public Color color;
- public int dashed;
+ public float[] dashed;
public Color dashedColor;
@@ -57,5 +57,5 @@
width = 1;
realWidth = 0;
- dashed = 0;
+ dashed = new float[0];
dashedColor = null;
priority = 0;
Index: /trunk/styles/standard/elemstyles.xml
===================================================================
--- /trunk/styles/standard/elemstyles.xml (revision 1634)
+++ /trunk/styles/standard/elemstyles.xml (revision 1635)
@@ -14,4 +14,5 @@
- priority
- dashed x - dashed line, length of dashes / spaces in x pixels
+ - dashed x,y - dashed line, x length of dashes / spaces in y pixels
- dashedcolour second (background) colour of a dashed line
4. linemod attributes
@@ -355,5 +356,5 @@
-
+
1
50000