Changeset 4087 in josm for trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
- Timestamp:
- 2011-05-15T23:51:25+02:00 (13 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java
r4081 r4087 1 1 /* License: GPL. Copyright 2007 by Immanuel Scholz and others */ 2 2 package org.openstreetmap.josm.data.osm.visitor.paint; 3 4 /* To enable debugging or profiling remove the double / signs */5 3 6 4 import java.awt.BasicStroke; … … 20 18 import org.openstreetmap.josm.data.Bounds; 21 19 import org.openstreetmap.josm.data.osm.BBox; 20 import org.openstreetmap.josm.data.osm.Changeset; 22 21 import org.openstreetmap.josm.data.osm.DataSet; 23 22 import org.openstreetmap.josm.data.osm.Node; … … 26 25 import org.openstreetmap.josm.data.osm.RelationMember; 27 26 import org.openstreetmap.josm.data.osm.Way; 28 import org.openstreetmap.josm.data.osm.visitor. AbstractVisitor;27 import org.openstreetmap.josm.data.osm.visitor.Visitor; 29 28 import org.openstreetmap.josm.gui.NavigatableComponent; 30 29 31 30 /** 32 * A visitor that paints a simple scheme of every primitive it visits to a31 * A map renderer that paints a simple scheme of every primitive it visits to a 33 32 * previous set graphic environment. 34 33 * 35 34 * @author imi 36 35 */ 37 public class SimplePaintVisitor extends AbstractVisitor implements PaintVisitor { 38 /** 39 * The environment to paint to. 40 */ 41 protected Graphics2D g; 42 /** 43 * MapView to get screen coordinates. 44 */ 45 protected NavigatableComponent nc; 46 47 public boolean inactive; 36 public class WireframeMapRenderer extends AbstractMapRenderer implements Visitor { 48 37 49 38 /** … … 85 74 protected GeneralPath currentPath = new GeneralPath(); 86 75 76 /** 77 * {@inheritDoc} 78 */ 79 public WireframeMapRenderer(Graphics2D g, NavigatableComponent nc, boolean isInactiveMode) { 80 super(g, nc, isInactiveMode); 81 } 82 87 83 public void getColors() 88 84 { … … 132 128 133 129 DataSet ds; 134 public void visitAll(DataSet data, boolean virtual, Bounds bounds) {130 public void render(DataSet data, boolean virtual, Bounds bounds) { 135 131 BBox bbox = new BBox(bounds); 136 132 this.ds = data; 137 //boolean profiler = Main.pref.getBoolean("simplepaint.profiler",false);138 //long profilerStart = java.lang.System.currentTimeMillis();139 //long profilerLast = profilerStart;140 //int profilerN = 0;141 //if(profiler)142 // System.out.println("Simplepaint Profiler");143 144 133 getSettings(virtual); 145 146 //if(profiler)147 //{148 // System.out.format("Prepare : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast));149 // profilerLast = java.lang.System.currentTimeMillis();150 //}151 134 152 135 /* draw tagged ways first, then untagged ways. takes 153 136 time to iterate through list twice, OTOH does not 154 137 require changing the colour while painting... */ 155 //profilerN = 0;156 138 for (final OsmPrimitive osm: data.searchRelations(bbox)) { 157 139 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden()) { 158 140 osm.visit(this); 159 // profilerN++; 160 } 161 } 162 163 //if(profiler) 164 //{ 165 // System.out.format("Relations: %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 166 // profilerLast = java.lang.System.currentTimeMillis(); 167 //} 168 169 //profilerN = 0; 141 } 142 } 143 170 144 for (final OsmPrimitive osm:data.searchWays(bbox)){ 171 145 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden() && osm.isTagged()) { 172 146 osm.visit(this); 173 // profilerN++;174 147 } 175 148 } … … 179 152 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden() && !osm.isTagged()) { 180 153 osm.visit(this); 181 // profilerN++;182 154 } 183 155 } 184 156 displaySegments(); 185 186 //if(profiler)187 //{188 // System.out.format("Ways : %4dms, n=%5d\n",189 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN);190 // profilerLast = java.lang.System.currentTimeMillis();191 //}192 193 //profilerN = 0;194 157 for (final OsmPrimitive osm : data.getSelected()) { 195 158 if (!osm.isDeleted()) { 196 159 osm.visit(this); 197 // profilerN++;198 160 } 199 161 } 200 162 displaySegments(); 201 163 202 //if(profiler)203 //{204 // System.out.format("Selected : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);205 // profilerLast = java.lang.System.currentTimeMillis();206 //}207 208 //profilerN = 0;209 164 for (final OsmPrimitive osm: data.searchNodes(bbox)) { 210 165 if (!osm.isDeleted() && !ds.isSelected(osm) && !osm.isDisabledAndHidden()) 211 166 { 212 167 osm.visit(this); 213 // profilerN++; 214 } 215 } 216 217 //if(profiler) 218 //{ 219 // System.out.format("Nodes : %4dms, n=%5d\n", 220 // (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 221 // profilerLast = java.lang.System.currentTimeMillis(); 222 //} 223 168 } 169 } 224 170 drawVirtualNodes(data.searchWays(bbox)); 225 226 //if(profiler)227 //{228 // System.out.format("All : %4dms\n", (profilerLast-profilerStart));229 //}230 171 } 231 172 … … 248 189 Color color; 249 190 250 if (i nactive || n.isDisabled()) {191 if (isInactiveMode || n.isDisabled()) { 251 192 color = inactiveColor; 252 193 } else if (ds.isSelected(n)) { … … 339 280 Color wayColor; 340 281 341 if (i nactive || w.isDisabled()) {282 if (isInactiveMode || w.isDisabled()) { 342 283 wayColor = inactiveColor; 343 284 } else if(w.isHighlighted()) { … … 372 313 373 314 Color col; 374 if (i nactive || r.isDisabled()) {315 if (isInactiveMode || r.isDisabled()) { 375 316 col = inactiveColor; 376 317 } else if (ds.isSelected(r)) { … … 415 356 } 416 357 } 358 359 @Override 360 public void visit(Changeset cs) {/* ignore */} 417 361 418 362 /** … … 519 463 } 520 464 521 public void setGraphics(Graphics2D g) {522 this.g = g;523 }524 525 public void setNavigatableComponent(NavigatableComponent nc) {526 this.nc = nc;527 }528 529 465 protected void displaySegments() { 530 466 displaySegments(null); … … 538 474 } 539 475 } 540 541 public void setInactive(boolean inactive) {542 this.inactive = inactive;543 }544 476 }
Note:
See TracChangeset
for help on using the changeset viewer.