Changeset 1635 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1629 r1635 55 55 protected Color untaggedColor; 56 56 protected Color textColor; 57 protected int currentDashed = 0;57 protected float[] currentDashed = new float[0]; 58 58 protected Color currentDashedColor; 59 59 protected int currentWidth = 0; … … 250 250 int width = defaultSegmentWidth; 251 251 int realWidth = 0; /* the real width of the element in meters */ 252 int dashed = 0;252 float dashed[] = new float[0]; 253 253 Color dashedColor = null; 254 254 Node lastN; … … 1125 1125 } 1126 1126 1127 private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, int dashed, Color dashedColor) {1127 private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, float dashed[], Color dashedColor) { 1128 1128 //profilerSegments++; 1129 if (col != currentColor || width != currentWidth || dashed != currentDashed|| dashedColor != currentDashedColor) {1129 if (col != currentColor || width != currentWidth || !Arrays.equals(dashed,currentDashed) || dashedColor != currentDashedColor) { 1130 1130 displaySegments(col, width, dashed, dashedColor); 1131 1131 } … … 1149 1149 1150 1150 protected void displaySegments() { 1151 displaySegments(null, 0, 0, null);1152 } 1153 1154 protected void displaySegments(Color newColor, int newWidth, int newDash, Color newDashedColor) {1151 displaySegments(null, 0, new float[0], null); 1152 } 1153 1154 protected void displaySegments(Color newColor, int newWidth, float newDash[], Color newDashedColor) { 1155 1155 if (currentPath != null) { 1156 1156 Graphics2D g2d = (Graphics2D)g; 1157 1157 g2d.setColor(inactive ? inactiveColor : currentColor); 1158 1158 if (currentStroke == null && useStrokes > dist) { 1159 if (currentDashed != 0) 1160 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,new float[] {currentDashed},0)); 1159 if (currentDashed.length > 0) { 1160 try { 1161 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,currentDashed,0)); 1162 } catch (IllegalArgumentException e) { 1163 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND)); 1164 } 1165 } 1161 1166 else 1162 1167 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND)); … … 1167 1172 g2d.setColor(currentDashedColor); 1168 1173 if (currentStroke == null && useStrokes > dist) { 1169 if (currentDashed != 0) 1170 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,new float[] {currentDashed},currentDashed)); 1174 if (currentDashed.length > 0) { 1175 float[] currentDashedOffset = new float[currentDashed.length]; 1176 System.arraycopy(currentDashed, 1, currentDashedOffset, 0, currentDashed.length - 1); 1177 currentDashedOffset[currentDashed.length-1] = currentDashed[0]; 1178 float offset = currentDashedOffset[0]; 1179 try { 1180 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_BUTT,BasicStroke.JOIN_ROUND,0,currentDashedOffset,offset)); 1181 } catch (IllegalArgumentException e) { 1182 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND)); 1183 } 1184 } 1171 1185 else 1172 1186 g2d.setStroke(new BasicStroke(currentWidth,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyleHandler.java
r1629 r1635 105 105 try 106 106 { 107 line.dashed=Integer.parseInt(atts.getValue(count)); 107 String[] parts = atts.getValue(count).split(","); 108 line.dashed = new float[parts.length]; 109 for (int i = 0; i < parts.length; i++) { 110 line.dashed[i] = (float)(Integer.parseInt(parts[i])); 111 } 108 112 } catch (NumberFormatException nfe) { 109 113 boolean dashed=Boolean.parseBoolean(atts.getValue(count)); 110 114 if(dashed) { 111 line.dashed = 9;115 line.dashed = new float[]{9}; 112 116 } 113 117 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
r1340 r1635 9 9 public int realWidth; //the real width of this line in meter 10 10 public Color color; 11 public intdashed;11 public float[] dashed; 12 12 public Color dashedColor; 13 13 … … 57 57 width = 1; 58 58 realWidth = 0; 59 dashed = 0;59 dashed = new float[0]; 60 60 dashedColor = null; 61 61 priority = 0; -
trunk/styles/standard/elemstyles.xml
r1630 r1635 14 14 - priority 15 15 - dashed x - dashed line, length of dashes / spaces in x pixels 16 - dashed x,y - dashed line, x length of dashes / spaces in y pixels 16 17 - dashedcolour second (background) colour of a dashed line 17 18 4. linemod attributes … … 355 356 <condition k="barrier" v="bollard"/> 356 357 <icon annotate="true" src="vehicle/restriction/bollard.png"/> 357 <line width="3" colour="barrier#F0F050" />358 <line width="3" colour="barrier#F0F050" dashed="3,9"/> 358 359 <scale_min>1</scale_min> 359 360 <scale_max>50000</scale_max>
Note:
See TracChangeset
for help on using the changeset viewer.