Changeset 1415 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2009-02-16T15:14:34+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r1398 r1415 5 5 import java.util.Arrays; 6 6 import java.util.Collection; 7 import java.util.Collections;8 7 import java.util.Comparator; 9 8 import java.util.HashSet; -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r1200 r1415 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import java.text.DecimalFormat;6 import java.text.NumberFormat;7 5 8 6 import org.openstreetmap.josm.Main; -
trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java
r1226 r1415 65 65 * If the bounding box has not been set (<code>min</code> or <code>max</code> 66 66 * equal <code>null</code>) this method does not do anything. 67 *68 * @param enlargeDegree69 67 */ 70 68 public void enlargeBoundingBox() { -
trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
r1411 r1415 1 / / License: GPL. Copyright 2007 by Immanuel Scholz and others1 /* License: GPL. Copyright 2007 by Immanuel Scholz and others */ 2 2 package org.openstreetmap.josm.data.osm.visitor; 3 4 /* To enable debugging or profiling remove the double / signs */ 3 5 4 6 import static org.openstreetmap.josm.tools.I18n.marktr; … … 47 49 protected boolean drawRestriction; 48 50 protected boolean leftHandTraffic; 49 protected boolean restrictionDebug;51 //protected boolean restrictionDebug; 50 52 protected int showNames; 51 53 protected int showIcons; … … 70 72 private EastNorth maxEN; 71 73 72 protected int profilerVisibleNodes;73 protected int profilerVisibleWays;74 protected int profilerVisibleAreas;75 protected int profilerSegments;76 protected int profilerVisibleSegments;77 protected boolean profilerOmitDraw;74 //protected int profilerVisibleNodes; 75 //protected int profilerVisibleWays; 76 //protected int profilerVisibleAreas; 77 //protected int profilerSegments; 78 //protected int profilerVisibleSegments; 79 //protected boolean profilerOmitDraw; 78 80 79 81 protected boolean isZoomOk(ElemStyle e) { … … 84 86 return (circum < 1500); 85 87 86 / /formula to calculate a map scale: natural size / map size = scale87 //example: 876000mm (876m as displayed) / 22mm (roughly estimated screen size of legend bar) = 3981888 // 89 //so the exact "correcting value" below depends only on the screen size and resolution90 // XXX - do we need a Preference setting for this (if things vary widely)?88 /* formula to calculate a map scale: natural size / map size = scale 89 example: 876000mm (876m as displayed) / 22mm (roughly estimated screen size of legend bar) = 39818 90 91 so the exact "correcting value" below depends only on the screen size and resolution 92 XXX - do we need a Preference setting for this (if things vary widely)? */ 91 93 return !(circum >= e.maxScale / 22 || circum < e.minScale / 22); 92 94 } … … 132 134 */ 133 135 public void visit(Node n) { 134 / / check, if the node is visible at all136 /* check, if the node is visible at all */ 135 137 if((n.eastNorth.east() > maxEN.east() ) || 136 138 (n.eastNorth.north() > maxEN.north()) || … … 145 147 IconElemStyle nodeStyle = (IconElemStyle)getPrimitiveStyle(n); 146 148 147 if(profilerOmitDraw)148 return;149 //if(profilerOmitDraw) 150 // return; 149 151 150 152 if (nodeStyle != null && isZoomOk(nodeStyle) && showIcons > dist) … … 171 173 } 172 174 173 / / check, if the way is visible at all175 /* check, if the way is visible at all */ 174 176 double minx = 10000; 175 177 double maxx = -10000; … … 208 210 if(wayStyle==null) 209 211 { 210 / / way without style211 profilerVisibleWays++;212 if(!profilerOmitDraw)213 212 /* way without style */ 213 //profilerVisibleWays++; 214 //if(!profilerOmitDraw) 215 drawWay(w, null, untaggedColor, w.selected); 214 216 } 215 217 else if(wayStyle instanceof LineElemStyle) 216 218 { 217 / / way with line style218 profilerVisibleWays++;219 if(!profilerOmitDraw)220 219 /* way with line style */ 220 //profilerVisibleWays++; 221 //if(!profilerOmitDraw) 222 drawWay(w, (LineElemStyle)wayStyle, untaggedColor, w.selected); 221 223 } 222 224 else if (wayStyle instanceof AreaElemStyle) 223 225 { 224 / / way with area style225 if(!profilerOmitDraw)226 {227 228 229 230 231 232 233 234 235 }226 /* way with area style */ 227 //if(!profilerOmitDraw) 228 //{ 229 if (fillAreas > dist) 230 { 231 // profilerVisibleAreas++; 232 drawArea(w, w.selected ? selectedColor : ((AreaElemStyle)wayStyle).color); 233 if(!w.isClosed()) 234 w.putError(tr("Area style way is not closed."), true); 235 } 236 drawWay(w, ((AreaElemStyle)wayStyle).line, ((AreaElemStyle)wayStyle).color, w.selected); 237 //} 236 238 } 237 239 } 238 240 239 241 public void drawWay(Way w, LineElemStyle l, Color color, Boolean selected) { 240 / /show direction arrows, if draw.segment.relevant_directions_only is not set,241 //the way is tagged with a direction key242 // (even if the tag is negated as in oneway=false) or the way is selected242 /* show direction arrows, if draw.segment.relevant_directions_only is not set, 243 the way is tagged with a direction key 244 (even if the tag is negated as in oneway=false) or the way is selected */ 243 245 boolean showDirection = w.selected || ((!useRealWidth) && (showDirectionArrow 244 246 && (!showRelevantDirectionsOnly || w.hasDirectionKeys))); 245 / /head only takes over control if the option is true,246 // the direction should be shown at all and not only because it's selected247 /* head only takes over control if the option is true, 248 the direction should be shown at all and not only because it's selected */ 247 249 boolean showOnlyHeadArrowOnly = showDirection && !w.selected && showHeadArrowOnly; 248 250 int width = defaultSegmentWidth; 249 int realWidth = 0; / /the real width of the element in meters251 int realWidth = 0; /* the real width of the element in meters */ 250 252 int dashed = 0; 251 253 Color dashedColor = null; … … 273 275 color = selectedColor; 274 276 275 / / draw overlays under the way277 /* draw overlays under the way */ 276 278 if(l != null && l.overlays != null) 277 279 { … … 294 296 } 295 297 296 / / draw the way298 /* draw the way */ 297 299 lastN = null; 298 300 Iterator<Node> it = w.nodes.iterator(); … … 306 308 } 307 309 308 / / draw overlays above the way310 /* draw overlays above the way */ 309 311 if(l != null && l.overlays != null) 310 312 { … … 392 394 if(c.selected) selected = true; 393 395 --left; 394 if(n == null) n = new ArrayList (w.nodes);396 if(n == null) n = new ArrayList<Node>(w.nodes); 395 397 n.remove((mode == 21 || mode == 22) ? nl : 0); 396 398 if(mode == 21) … … 466 468 r.mappaintVisibleCode = 0; 467 469 468 / / TODO: is it possible to do this like the nodes/ways code?469 if(profilerOmitDraw)470 return;470 /* TODO: is it possible to do this like the nodes/ways code? */ 471 //if(profilerOmitDraw) 472 // return; 471 473 472 474 if(selectedCall) … … 506 508 } 507 509 508 / /this current experimental implementation will only work for standard restrictions:509 // from(Way) / via(Node) / to(Way)510 /* this current experimental implementation will only work for standard restrictions: 511 from(Way) / via(Node) / to(Way) */ 510 512 public void drawRestriction(Relation r) { 511 if(restrictionDebug)512 System.out.println("Restriction: " + r.keys.get("name") + " restriction " + r.keys.get("restriction"));513 //if(restrictionDebug) 514 // System.out.println("Restriction: " + r.keys.get("name") + " restriction " + r.keys.get("restriction")); 513 515 514 516 r.clearErrors(); … … 518 520 Node via = null; 519 521 520 / / find the "from", "via" and "to" elements522 /* find the "from", "via" and "to" elements */ 521 523 for (RelationMember m : r.members) 522 524 { 523 if(restrictionDebug)524 System.out.println("member " + m.member + " selected " + r.selected);525 //if(restrictionDebug) 526 // System.out.println("member " + m.member + " selected " + r.selected); 525 527 526 528 if(m.member == null) … … 538 540 { 539 541 Way w = (Way) m.member; 540 ElemStyle style = getPrimitiveStyle(w);541 //if(r.selected) {542 // drawWay(w, null /*(LineElemStyle)style*/, selectedColor, true);543 // w.mappaintDrawnCode = paintid;544 //}545 542 if(w.nodes.size() < 2) 546 543 { … … 594 591 } 595 592 596 / / check if "from" way starts or ends at via593 /* check if "from" way starts or ends at via */ 597 594 if(fromWay.nodes.get(0) != via && fromWay.nodes.get(fromWay.nodes.size()-1) != via) { 598 595 r.putError(tr("The \"from\" way doesn't start or end at a \"via\" node."), true); 599 596 return; 600 597 } 601 / / check if "to" way starts or ends at via598 /* check if "to" way starts or ends at via */ 602 599 /*if(toWay.nodes.get(0) != via && toWay.nodes.get(toWay.nodes.size()-1) != via) { 603 600 r.putError(tr("to way doesn't start or end at a via node"), true); 604 //return;601 return; 605 602 }*/ 606 603 607 / / find the "direct" nodes before the via node604 /* find the "direct" nodes before the via node */ 608 605 Node fromNode = null; 609 606 try … … 620 617 } 621 618 622 / / find the "direct" node after the via node619 /* find the "direct" node after the via node */ 623 620 Node toNode = null; 624 621 try 625 622 { 626 623 if(toWay.nodes.get(0) == via) { 627 if(restrictionDebug)628 System.out.println("To way heading away from via");624 //if(restrictionDebug) 625 // System.out.println("To way heading away from via"); 629 626 toNode = toWay.nodes.get(1); 630 627 } else { 631 if(restrictionDebug)632 System.out.println("To way heading towards via");628 //if(restrictionDebug) 629 // System.out.println("To way heading towards via"); 633 630 toNode = toWay.nodes.get(toWay.nodes.size()-2); 634 631 } … … 640 637 Point pVia = nc.getPoint(via.eastNorth); 641 638 642 if(restrictionDebug) { 643 Point pTo = nc.getPoint(toNode.eastNorth); 644 645 // debug output of interesting nodes 646 System.out.println("From: " + fromNode); 647 drawNode(fromNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode); 648 System.out.println("Via: " + via); 649 drawNode(via, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode); 650 System.out.println("To: " + toNode); 651 drawNode(toNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode); 652 System.out.println("From X: " + pFrom.x + " Y " + pFrom.y); 653 System.out.println("Via X: " + pVia.x + " Y " + pVia.y); 654 System.out.println("To X: " + pTo.x + " Y " + pTo.y); 655 } 656 657 // starting from via, go back the "from" way a few pixels 658 // (calculate the vector vx/vy with the specified length and the direction away from the "via" node along the first segment of the "from" way) 639 //if(restrictionDebug) { 640 // Point pTo = nc.getPoint(toNode.eastNorth); 641 642 // /* debug output of interesting nodes */ 643 // System.out.println("From: " + fromNode); 644 // drawNode(fromNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode); 645 // System.out.println("Via: " + via); 646 // drawNode(via, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode); 647 // System.out.println("To: " + toNode); 648 // drawNode(toNode, selectedColor, selectedNodeSize, selectedNodeRadius, fillSelectedNode); 649 // System.out.println("From X: " + pFrom.x + " Y " + pFrom.y); 650 // System.out.println("Via X: " + pVia.x + " Y " + pVia.y); 651 // System.out.println("To X: " + pTo.x + " Y " + pTo.y); 652 //} 653 654 /* starting from via, go back the "from" way a few pixels 655 (calculate the vector vx/vy with the specified length and the direction 656 away from the "via" node along the first segment of the "from" way) 657 */ 659 658 double distanceFromVia=14; 660 659 double dx = (pFrom.x >= pVia.x) ? (pFrom.x - pVia.x) : (pVia.x - pFrom.x); … … 675 674 if(pFrom.y < pVia.y) vy = -vy; 676 675 677 if(restrictionDebug) 678 System.out.println("vx " + vx + " vy " + vy); 679 680 // go a few pixels away from the way (in a right angle) 681 // (calculate the vx2/vy2 vector with the specified length and the direction 90degrees away from the first segment of the "from" way) 676 //if(restrictionDebug) 677 // System.out.println("vx " + vx + " vy " + vy); 678 679 /* go a few pixels away from the way (in a right angle) 680 (calculate the vx2/vy2 vector with the specified length and the direction 681 90degrees away from the first segment of the "from" way) 682 */ 682 683 double distanceFromWay=8; 683 684 double vx2 = 0; … … 733 734 } 734 735 735 / / rotate icon with direction last node in from to736 if(restrictionDebug)737 System.out.println("Deg1 " + fromAngleDeg + " Deg2 " + (fromAngleDeg + 180) + " Icon " + iconAngle);736 /* rotate icon with direction last node in from to */ 737 //if(restrictionDebug) 738 // System.out.println("Deg1 " + fromAngleDeg + " Deg2 " + (fromAngleDeg + 180) + " Icon " + iconAngle); 738 739 ImageIcon rotatedIcon = ImageProvider.createRotatedImage(null /*icon2*/, nodeStyle.icon, iconAngle); 739 740 740 / / scale down icon to 16*16 pixels741 /* scale down icon to 16*16 pixels */ 741 742 ImageIcon smallIcon = new ImageIcon(rotatedIcon.getImage().getScaledInstance(16 , 16, Image.SCALE_SMOOTH)); 742 743 int w = smallIcon.getIconWidth(), h=smallIcon.getIconHeight(); … … 1041 1042 Polygon polygon = getPolygon(w); 1042 1043 1043 / / set the opacity (alpha) level of the filled polygon1044 /* set the opacity (alpha) level of the filled polygon */ 1044 1045 g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); 1045 1046 g.fillPolygon(polygon); … … 1048 1049 protected void drawAreaPolygon(Polygon polygon, Color color) 1049 1050 { 1050 / / set the opacity (alpha) level of the filled polygon1051 /* set the opacity (alpha) level of the filled polygon */ 1051 1052 g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); 1052 1053 g.fillPolygon(polygon); … … 1057 1058 if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return; 1058 1059 1059 profilerVisibleNodes++;1060 //profilerVisibleNodes++; 1060 1061 1061 1062 int w = icon.getIconWidth(), h=icon.getIconHeight(); … … 1092 1093 1093 1094 private void drawSeg(Node n1, Node n2, Color col, boolean showDirection, int width, int dashed, Color dashedColor) { 1094 profilerSegments++;1095 //profilerSegments++; 1095 1096 if (col != currentColor || width != currentWidth || dashed != currentDashed || dashedColor != currentDashedColor) { 1096 1097 displaySegments(col, width, dashed, dashedColor); … … 1102 1103 return; 1103 1104 } 1104 profilerVisibleSegments++;1105 //profilerVisibleSegments++; 1105 1106 currentPath.moveTo(p1.x, p1.y); 1106 1107 currentPath.lineTo(p2.x, p2.y); … … 1166 1167 return; 1167 1168 1168 profilerVisibleNodes++;1169 //profilerVisibleNodes++; 1169 1170 1170 1171 g.setColor(color); … … 1197 1198 } 1198 1199 1199 / / Shows areas before non-areas1200 /* Shows areas before non-areas */ 1200 1201 public void visitAll(DataSet data, Boolean virtual) { 1201 1202 1202 boolean profiler = Main.pref.getBoolean("mappaint.profiler",false);1203 profilerOmitDraw = Main.pref.getBoolean("mappaint.profiler.omitdraw",false);1203 //boolean profiler = Main.pref.getBoolean("mappaint.profiler",false); 1204 //profilerOmitDraw = Main.pref.getBoolean("mappaint.profiler.omitdraw",false); 1204 1205 1205 1206 useStyleCache = Main.pref.getBoolean("mappaint.cache",true); … … 1213 1214 dist = ll1.greatCircleDistance(ll2); 1214 1215 1215 long profilerStart = java.lang.System.currentTimeMillis();1216 long profilerLast = profilerStart;1217 int profilerN;1218 if(profiler)1219 System.out.println("Mappaint Profiler (" +1220 (useStyleCache ? "cache=true, " : "cache=false, ") +1221 "fillareas " + fillAreas + ", " +1222 "fillalpha=" + fillAlpha + "%, " +1223 "dist=" + (int)dist + "m)");1216 //long profilerStart = java.lang.System.currentTimeMillis(); 1217 //long profilerLast = profilerStart; 1218 //int profilerN; 1219 //if(profiler) 1220 // System.out.println("Mappaint Profiler (" + 1221 // (useStyleCache ? "cache=true, " : "cache=false, ") + 1222 // "fillareas " + fillAreas + ", " + 1223 // "fillalpha=" + fillAlpha + "%, " + 1224 // "dist=" + (int)dist + "m)"); 1224 1225 1225 1226 getSettings(virtual); 1226 1227 useRealWidth = Main.pref.getBoolean("mappaint.useRealWidth",false); 1227 1228 zoomLevelDisplay = Main.pref.getBoolean("mappaint.zoomLevelDisplay",false); 1228 circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; / / circumference of the earth in meter1229 circum = Main.map.mapView.getScale()*100*Main.proj.scaleFactor()*40041455; /* circumference of the earth in meter */ 1229 1230 styles = MapPaintStyles.getStyles().getStyleSet(); 1230 1231 drawMultipolygon = Main.pref.getBoolean("mappaint.multipolygon",true); 1231 1232 drawRestriction = Main.pref.getBoolean("mappaint.restriction",true); 1232 restrictionDebug = Main.pref.getBoolean("mappaint.restriction.debug",false);1233 //restrictionDebug = Main.pref.getBoolean("mappaint.restriction.debug",false); 1233 1234 leftHandTraffic = Main.pref.getBoolean("mappaint.lefthandtraffic",false); 1234 1235 orderFont = new Font(Main.pref.get("mappaint.font","Helvetica"), Font.PLAIN, Main.pref.getInteger("mappaint.fontsize", 8)); … … 1243 1244 viewid = nc.getViewID(); 1244 1245 1245 profilerVisibleNodes = 0;1246 profilerVisibleWays = 0;1247 profilerVisibleAreas = 0;1248 profilerSegments = 0;1249 profilerVisibleSegments = 0;1250 1251 if(profiler)1252 {1253 System.out.format("Prepare : %5dms\n", (java.lang.System.currentTimeMillis()-profilerLast));1254 profilerLast = java.lang.System.currentTimeMillis();1255 }1246 //profilerVisibleNodes = 0; 1247 //profilerVisibleWays = 0; 1248 //profilerVisibleAreas = 0; 1249 //profilerSegments = 0; 1250 //profilerVisibleSegments = 0; 1251 1252 //if(profiler) 1253 //{ 1254 // System.out.format("Prepare : %5dms\n", (java.lang.System.currentTimeMillis()-profilerLast)); 1255 // profilerLast = java.lang.System.currentTimeMillis(); 1256 //} 1256 1257 1257 1258 if (fillAreas > dist && styles != null && styles.hasAreas()) { … … 1259 1260 1260 1261 /*** RELATIONS ***/ 1261 profilerN = 0;1262 // profilerN = 0; 1262 1263 for (final Relation osm : data.relations) 1263 1264 { … … 1265 1266 { 1266 1267 osm.visit(this); 1267 profilerN++;1268 } 1269 } 1270 1271 if(profiler)1272 {1273 System.out.format("Relations: %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);1274 profilerLast = java.lang.System.currentTimeMillis();1275 }1268 // profilerN++; 1269 } 1270 } 1271 1272 // if(profiler) 1273 // { 1274 // System.out.format("Relations: %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 1275 // profilerLast = java.lang.System.currentTimeMillis(); 1276 // } 1276 1277 1277 1278 /*** AREAS ***/ 1278 profilerN = 0;1279 // profilerN = 0; 1279 1280 for (final Way osm : data.ways) 1280 1281 { … … 1285 1286 { 1286 1287 osm.visit(this); 1287 profilerN++;1288 // profilerN++; 1288 1289 } else 1289 noAreaWays.add( (Way)osm);1290 } 1291 } 1292 1293 if(profiler)1294 {1295 System.out.format("Areas : %5dms, calls=%7d, visible=%d\n",1296 (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleAreas);1297 profilerLast = java.lang.System.currentTimeMillis();1298 }1290 noAreaWays.add(osm); 1291 } 1292 } 1293 1294 // if(profiler) 1295 // { 1296 // System.out.format("Areas : %5dms, calls=%7d, visible=%d\n", 1297 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleAreas); 1298 // profilerLast = java.lang.System.currentTimeMillis(); 1299 // } 1299 1300 1300 1301 /*** WAYS ***/ 1301 profilerN = 0;1302 // profilerN = 0; 1302 1303 fillAreas = 0; 1303 1304 for (final OsmPrimitive osm : noAreaWays) 1304 1305 { 1305 1306 osm.visit(this); 1306 profilerN++;1307 } 1308 1309 if(profiler)1310 {1311 System.out.format("Ways : %5dms, calls=%7d, visible=%d\n",1312 (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);1313 profilerLast = java.lang.System.currentTimeMillis();1314 }1307 // profilerN++; 1308 } 1309 1310 // if(profiler) 1311 // { 1312 // System.out.format("Ways : %5dms, calls=%7d, visible=%d\n", 1313 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays); 1314 // profilerLast = java.lang.System.currentTimeMillis(); 1315 // } 1315 1316 } 1316 1317 else 1317 1318 { 1318 1319 /*** WAYS (filling disabled) ***/ 1319 profilerN = 0;1320 // profilerN = 0; 1320 1321 for (final OsmPrimitive osm : data.ways) 1321 1322 if (!osm.incomplete && !osm.deleted && !osm.selected … … 1323 1324 { 1324 1325 osm.visit(this); 1325 profilerN++;1326 } 1327 1328 if(profiler)1329 {1330 System.out.format("Ways : %5dms, calls=%7d, visible=%d\n",1331 (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays);1332 profilerLast = java.lang.System.currentTimeMillis();1333 }1326 // profilerN++; 1327 } 1328 1329 // if(profiler) 1330 // { 1331 // System.out.format("Ways : %5dms, calls=%7d, visible=%d\n", 1332 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleWays); 1333 // profilerLast = java.lang.System.currentTimeMillis(); 1334 // } 1334 1335 } 1335 1336 1336 1337 /*** SELECTED ***/ 1337 1338 selectedCall = true; 1338 profilerN = 0;1339 //profilerN = 0; 1339 1340 for (final OsmPrimitive osm : data.getSelected()) { 1340 1341 if (!osm.incomplete && !osm.deleted && !(osm instanceof Node) … … 1342 1343 { 1343 1344 osm.visit(this); 1344 profilerN++;1345 } 1346 } 1347 1348 if(profiler)1349 {1350 System.out.format("Selected : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);1351 profilerLast = java.lang.System.currentTimeMillis();1352 }1345 // profilerN++; 1346 } 1347 } 1348 1349 //if(profiler) 1350 //{ 1351 // System.out.format("Selected : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 1352 // profilerLast = java.lang.System.currentTimeMillis(); 1353 //} 1353 1354 1354 1355 /*** DISPLAY CACHED SEGMENTS (WAYS) NOW ***/ … … 1356 1357 1357 1358 /*** NODES ***/ 1358 profilerN = 0;1359 //profilerN = 0; 1359 1360 for (final OsmPrimitive osm : data.nodes) 1360 1361 if (!osm.incomplete && !osm.deleted … … 1362 1363 { 1363 1364 osm.visit(this); 1364 profilerN++;1365 } 1366 1367 if(profiler)1368 {1369 System.out.format("Nodes : %5dms, calls=%7d, visible=%d\n",1370 (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleNodes);1371 profilerLast = java.lang.System.currentTimeMillis();1372 }1365 // profilerN++; 1366 } 1367 1368 //if(profiler) 1369 //{ 1370 // System.out.format("Nodes : %5dms, calls=%7d, visible=%d\n", 1371 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN, profilerVisibleNodes); 1372 // profilerLast = java.lang.System.currentTimeMillis(); 1373 //} 1373 1374 1374 1375 /*** VIRTUAL ***/ 1375 1376 if (virtualNodeSize != 0) 1376 1377 { 1377 profilerN = 0;1378 // profilerN = 0; 1378 1379 currentColor = nodeColor; 1379 1380 for (final OsmPrimitive osm : data.ways) … … 1381 1382 && osm.mappaintVisibleCode != viewid ) 1382 1383 { 1383 / / TODO: move this into the SimplePaint code?1384 if(!profilerOmitDraw)1384 /* TODO: move this into the SimplePaint code? */ 1385 // if(!profilerOmitDraw) 1385 1386 visitVirtual((Way)osm); 1386 profilerN++;1387 } 1388 1389 if(profiler)1390 {1391 System.out.format("Virtual : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);1392 profilerLast = java.lang.System.currentTimeMillis();1393 }1387 // profilerN++; 1388 } 1389 1390 // if(profiler) 1391 // { 1392 // System.out.format("Virtual : %5dms, calls=%7d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 1393 // profilerLast = java.lang.System.currentTimeMillis(); 1394 // } 1394 1395 1395 1396 displaySegments(null); 1396 1397 } 1397 1398 1398 if(profiler)1399 {1400 System.out.format("Segments : calls=%7d, visible=%d\n", profilerSegments, profilerVisibleSegments);1401 System.out.format("All : %5dms\n", (profilerLast-profilerStart));1402 }1399 //if(profiler) 1400 //{ 1401 // System.out.format("Segments : calls=%7d, visible=%d\n", profilerSegments, profilerVisibleSegments); 1402 // System.out.format("All : %5dms\n", (profilerLast-profilerStart)); 1403 //} 1403 1404 } 1404 1405 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
r1409 r1415 1 / / License: GPL. Copyright 2007 by Immanuel Scholz and others1 /* License: GPL. Copyright 2007 by Immanuel Scholz and others */ 2 2 package org.openstreetmap.josm.data.osm.visitor; 3 4 /* To enable debugging or profiling remove the double / signs */ 3 5 4 6 import static org.openstreetmap.josm.tools.I18n.marktr; … … 127 129 128 130 public void visitAll(DataSet data, Boolean virtual) { 129 boolean profiler = Main.pref.getBoolean("simplepaint.profiler",false);130 long profilerStart = java.lang.System.currentTimeMillis();131 long profilerLast = profilerStart;132 int profilerN = 0;133 if(profiler)134 System.out.println("Simplepaint Profiler");131 //boolean profiler = Main.pref.getBoolean("simplepaint.profiler",false); 132 //long profilerStart = java.lang.System.currentTimeMillis(); 133 //long profilerLast = profilerStart; 134 //int profilerN = 0; 135 //if(profiler) 136 // System.out.println("Simplepaint Profiler"); 135 137 136 138 getSettings(virtual); 137 139 138 if(profiler)139 {140 System.out.format("Prepare : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast));141 profilerLast = java.lang.System.currentTimeMillis();142 }143 144 / /draw tagged ways first, then untagged ways. takes145 //time to iterate through list twice, OTOH does not146 // require changing the colour while painting...147 profilerN = 0;140 //if(profiler) 141 //{ 142 // System.out.format("Prepare : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast)); 143 // profilerLast = java.lang.System.currentTimeMillis(); 144 //} 145 146 /* draw tagged ways first, then untagged ways. takes 147 time to iterate through list twice, OTOH does not 148 require changing the colour while painting... */ 149 //profilerN = 0; 148 150 for (final OsmPrimitive osm : data.relations) 149 151 if (!osm.deleted && !osm.selected) 150 152 { 151 153 osm.visit(this); 152 profilerN++;153 } 154 155 if(profiler)156 {157 System.out.format("Relations: %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);158 profilerLast = java.lang.System.currentTimeMillis();159 }160 161 profilerN = 0;154 // profilerN++; 155 } 156 157 //if(profiler) 158 //{ 159 // System.out.format("Relations: %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 160 // profilerLast = java.lang.System.currentTimeMillis(); 161 //} 162 163 //profilerN = 0; 162 164 for (final OsmPrimitive osm : data.ways) 163 165 if (!osm.deleted && !osm.selected && osm.tagged) 164 166 { 165 167 osm.visit(this); 166 profilerN++;168 // profilerN++; 167 169 } 168 170 displaySegments(); … … 172 174 { 173 175 osm.visit(this); 174 profilerN++;176 // profilerN++; 175 177 } 176 178 displaySegments(); 177 179 178 if(profiler)179 {180 System.out.format("Ways : %4dms, n=%5d\n",181 (java.lang.System.currentTimeMillis()-profilerLast), profilerN);182 profilerLast = java.lang.System.currentTimeMillis();183 }184 185 profilerN = 0;180 //if(profiler) 181 //{ 182 // System.out.format("Ways : %4dms, n=%5d\n", 183 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 184 // profilerLast = java.lang.System.currentTimeMillis(); 185 //} 186 187 //profilerN = 0; 186 188 for (final OsmPrimitive osm : data.getSelected()) 187 189 if (!osm.deleted) 188 190 { 189 191 osm.visit(this); 190 profilerN++;192 // profilerN++; 191 193 } 192 194 displaySegments(); 193 195 194 if(profiler)195 {196 System.out.format("Selected : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);197 profilerLast = java.lang.System.currentTimeMillis();198 }199 200 profilerN = 0;196 //if(profiler) 197 //{ 198 // System.out.format("Selected : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 199 // profilerLast = java.lang.System.currentTimeMillis(); 200 //} 201 202 //profilerN = 0; 201 203 for (final OsmPrimitive osm : data.nodes) 202 204 if (!osm.deleted && !osm.selected) 203 205 { 204 206 osm.visit(this); 205 profilerN++; 206 } 207 if(profiler) 208 { 209 System.out.format("Nodes : %4dms, n=%5d\n", 210 (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 211 profilerLast = java.lang.System.currentTimeMillis(); 212 } 207 // profilerN++; 208 } 209 210 //if(profiler) 211 //{ 212 // System.out.format("Nodes : %4dms, n=%5d\n", 213 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 214 // profilerLast = java.lang.System.currentTimeMillis(); 215 //} 213 216 214 217 if(virtualNodeSize != 0) 215 218 { 216 profilerN = 0;219 // profilerN = 0; 217 220 currentColor = nodeColor; 218 221 for (final OsmPrimitive osm : data.ways) … … 220 223 { 221 224 visitVirtual((Way)osm); 222 profilerN++;225 // profilerN++; 223 226 } 224 227 displaySegments(); 225 228 226 if(profiler)227 {228 System.out.format("Virtual : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);229 profilerLast = java.lang.System.currentTimeMillis();230 }231 } 232 233 if(profiler)234 {235 System.out.format("All : %4dms\n", (profilerLast-profilerStart));236 }229 // if(profiler) 230 // { 231 // System.out.format("Virtual : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 232 // profilerLast = java.lang.System.currentTimeMillis(); 233 // } 234 } 235 236 //if(profiler) 237 //{ 238 // System.out.format("All : %4dms\n", (profilerLast-profilerStart)); 239 //} 237 240 } 238 241 … … 294 297 return; 295 298 296 / /show direction arrows, if draw.segment.relevant_directions_only is not set, the way is tagged with a direction key297 // (even if the tag is negated as in oneway=false) or the way is selected299 /* show direction arrows, if draw.segment.relevant_directions_only is not set, the way is tagged with a direction key 300 (even if the tag is negated as in oneway=false) or the way is selected */ 298 301 299 302 boolean showThisDirectionArrow = w.selected 300 303 || (showDirectionArrow && (!showRelevantDirectionsOnly || w.hasDirectionKeys)); 301 / /head only takes over control if the option is true,302 // the direction should be shown at all and not only because it's selected304 /* head only takes over control if the option is true, 305 the direction should be shown at all and not only because it's selected */ 303 306 boolean showOnlyHeadArrowOnly = showThisDirectionArrow && !w.selected && showHeadArrowOnly; 304 307 Color wayColor; … … 390 393 } 391 394 392 displaySegments(); / / draw nodes on top!395 displaySegments(); /* draw nodes on top! */ 393 396 Color c = g.getColor(); 394 397 g.setColor(backgroundColor); -
trunk/src/org/openstreetmap/josm/data/projection/Lambert.java
r1309 r1415 206 206 * reference ellipsoid used by Lambert is Clark 207 207 * 208 * @param coordprojected coordinates pair in meters209 * @param Xs false east (coordinate system origin) in meters210 * @param Ys false north (coordinate system origin) in meters211 * @param c projection constant212 * @param n projection exponent208 * @param eastNorth projected coordinates pair in meters 209 * @param Xs false east (coordinate system origin) in meters 210 * @param Ys false north (coordinate system origin) in meters 211 * @param c projection constant 212 * @param n projection exponent 213 213 * @return LatLon in radian 214 214 */ … … 236 236 * Translate latitude/longitude in WGS84, (ellipsoid GRS80) to Lambert 237 237 * geographic, (ellipsoid Clark) 238 *239 * @param wgs240 * @return241 238 */ 242 239 private LatLon GRS802Clark(LatLon wgs) { … … 256 253 } 257 254 258 /**259 * @param lambert260 * @return261 */262 255 private LatLon Clark2GRS80(LatLon lambert) { 263 256 double lat = lambert.lat(); // in radian
Note:
See TracChangeset
for help on using the changeset viewer.