Changeset 30314 in osm for applications/editors/josm/plugins/smed2/src/render
- Timestamp:
- 2014-03-01T18:57:59+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/render
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/render/Renderer.java
r30285 r30314 220 220 git.nextComp(); 221 221 boolean first = true; 222 while (git.hasNode()) { 223 prev = next; 224 next = context.getPoint(git.next()); 225 angle = Math.atan2(next.getY() - prev.getY(), next.getX() - prev.getX()); 226 piv = true; 227 if (first) { 228 curr = succ = next; 229 gap = (space > 0); 230 stcount = ratio - 1; 231 symbol = prisymb; 232 len = gap ? psize * space * 0.5 : psize; 233 first = false; 234 } else { 235 while (curr.distance(next) >= len) { 236 if (piv) { 237 double rem = len; 238 double s = prev.distance(next); 239 double p = curr.distance(prev); 240 if ((s > 0) && (p > 0)) { 241 double n = curr.distance(next); 242 double theta = Math.acos((s * s + p * p - n * n) / 2 / s / p); 243 double phi = Math.asin(p / len * Math.sin(theta)); 244 rem = len * Math.sin(Math.PI - theta - phi) / Math.sin(theta); 222 while (git.hasEdge()) { 223 git.nextEdge(); 224 while (git.hasNode()) { 225 prev = next; 226 next = context.getPoint(git.next()); 227 angle = Math.atan2(next.getY() - prev.getY(), next.getX() - prev.getX()); 228 piv = true; 229 if (first) { 230 curr = succ = next; 231 gap = (space > 0); 232 stcount = ratio - 1; 233 symbol = prisymb; 234 len = gap ? psize * space * 0.5 : psize; 235 first = false; 236 } else { 237 while (curr.distance(next) >= len) { 238 if (piv) { 239 double rem = len; 240 double s = prev.distance(next); 241 double p = curr.distance(prev); 242 if ((s > 0) && (p > 0)) { 243 double n = curr.distance(next); 244 double theta = Math.acos((s * s + p * p - n * n) / 2 / s / p); 245 double phi = Math.asin(p / len * Math.sin(theta)); 246 rem = len * Math.sin(Math.PI - theta - phi) / Math.sin(theta); 247 } 248 succ = new Point2D.Double(prev.getX() + (rem * Math.cos(angle)), prev.getY() + (rem * Math.sin(angle))); 249 piv = false; 250 } else { 251 succ = new Point2D.Double(curr.getX() + (len * Math.cos(angle)), curr.getY() + (len * Math.sin(angle))); 245 252 } 246 succ = new Point2D.Double(prev.getX() + (rem * Math.cos(angle)), prev.getY() + (rem * Math.sin(angle))); 247 piv = false; 248 } else { 249 succ = new Point2D.Double(curr.getX() + (len * Math.cos(angle)), curr.getY() + (len * Math.sin(angle))); 250 } 251 if (!gap) { 252 Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Scheme(col), 253 new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90)))); 254 } 255 if (space > 0) 256 gap = !gap; 257 curr = succ; 258 len = gap ? (psize * space) : (--stcount == 0) ? (stflag ? tsize : ssize) : psize; 259 if (stcount == 0) { 260 symbol = stflag ? tersymb : secsymb; 261 if (trect != null) stflag = !stflag; 262 stcount = ratio; 263 } else { 264 symbol = prisymb; 253 if (!gap) { 254 Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Scheme(col), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90)))); 255 } 256 if (space > 0) 257 gap = !gap; 258 curr = succ; 259 len = gap ? (psize * space) : (--stcount == 0) ? (stflag ? tsize : ssize) : psize; 260 if (stcount == 0) { 261 symbol = stflag ? tersymb : secsymb; 262 if (trect != null) 263 stflag = !stflag; 264 stcount = ratio; 265 } else { 266 symbol = prisymb; 267 } 265 268 } 266 269 } … … 278 281 while (git.hasComp()) { 279 282 git.nextComp(); 280 point = context.getPoint(git.next()); 281 p.moveTo(point.getX(), point.getY()); 282 while (git.hasNode()) { 283 while (git.hasEdge()) { 284 git.nextEdge(); 283 285 point = context.getPoint(git.next()); 284 p.lineTo(point.getX(), point.getY()); 286 p.moveTo(point.getX(), point.getY()); 287 while (git.hasNode()) { 288 point = context.getPoint(git.next()); 289 p.lineTo(point.getX(), point.getY()); 290 } 285 291 } 286 292 } … … 353 359 while (git.hasComp()) { 354 360 git.nextComp(); 355 point = context.getPoint(git.next()); 356 p.moveTo(point.getX(), point.getY()); 357 while (git.hasNode()) { 361 while (git.hasEdge()) { 362 git.nextEdge(); 358 363 point = context.getPoint(git.next()); 359 p.lineTo(point.getX(), point.getY()); 364 p.moveTo(point.getX(), point.getY()); 365 while (git.hasNode()) { 366 point = context.getPoint(git.next()); 367 p.lineTo(point.getX(), point.getY()); 368 } 360 369 } 361 370 } … … 500 509 git.nextComp(); 501 510 boolean first = true; 502 while (git.hasNode()) { 503 prev = next; 504 next = context.getPoint(git.next()); 505 angle = Math.atan2(next.getY() - prev.getY(), next.getX() - prev.getX()); 506 piv = true; 507 if (first) { 508 curr = succ = next; 509 // len = psize; 510 first = false; 511 } else { 512 while (curr.distance(next) >= len) { 513 if (piv) { 514 double rem = len; 515 double s = prev.distance(next); 516 double p = curr.distance(prev); 517 if ((s > 0) && (p > 0)) { 518 double n = curr.distance(next); 519 double theta = Math.acos((s * s + p * p - n * n) / 2 / s / p); 520 double phi = Math.asin(p / len * Math.sin(theta)); 521 rem = len * Math.sin(Math.PI - theta - phi) / Math.sin(theta); 511 while (git.hasEdge()) { 512 git.nextEdge(); 513 while (git.hasNode()) { 514 prev = next; 515 next = context.getPoint(git.next()); 516 angle = Math.atan2(next.getY() - prev.getY(), next.getX() - prev.getX()); 517 piv = true; 518 if (first) { 519 curr = succ = next; 520 // len = psize; 521 first = false; 522 } else { 523 while (curr.distance(next) >= len) { 524 if (piv) { 525 double rem = len; 526 double s = prev.distance(next); 527 double p = curr.distance(prev); 528 if ((s > 0) && (p > 0)) { 529 double n = curr.distance(next); 530 double theta = Math.acos((s * s + p * p - n * n) / 2 / s / p); 531 double phi = Math.asin(p / len * Math.sin(theta)); 532 rem = len * Math.sin(Math.PI - theta - phi) / Math.sin(theta); 533 } 534 succ = new Point2D.Double(prev.getX() + (rem * Math.cos(angle)), prev.getY() + (rem * Math.sin(angle))); 535 piv = false; 536 } else { 537 succ = new Point2D.Double(curr.getX() + (len * Math.cos(angle)), curr.getY() + (len * Math.sin(angle))); 522 538 } 523 succ = new Point2D.Double(prev.getX() + (rem * Math.cos(angle)), prev.getY() + (rem * Math.sin(angle))); 524 piv = false; 525 } else { 526 succ = new Point2D.Double(curr.getX() + (len * Math.cos(angle)), curr.getY() + (len * Math.sin(angle))); 539 // Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), 540 // curr.getY(), new Delta(Handle.BC, 541 // AffineTransform.getRotateInstance(Math.atan2((succ.getY() - 542 // curr.getY()), (succ.getX() - curr.getX())) + 543 // Math.toRadians(90))), null); 544 curr = succ; 545 // len = psize; 527 546 } 528 // Symbols.drawSymbol(g2, symbol, sScale, curr.getX(), curr.getY(), new Delta(Handle.BC, AffineTransform.getRotateInstance(Math.atan2((succ.getY() - curr.getY()), (succ.getX() - curr.getX())) + Math.toRadians(90))), null);529 curr = succ;530 // len = psize;531 547 } 532 548 } -
applications/editors/josm/plugins/smed2/src/render/Rules.java
r30285 r30314 628 628 Renderer.symbol(feature, Harbours.Post); 629 629 break; 630 default: 631 break; 630 632 } 631 633 Signals.addSignals(feature);
Note:
See TracChangeset
for help on using the changeset viewer.