Changeset 24995 in osm for applications/editors/josm/plugins/importvec
- Timestamp:
- 2011-01-08T13:10:55+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/importvec/src/org/openstreetmap/josm/plugins/importvec/ImportVectorAction.java
r23724 r24995 51 51 public ImportVectorAction() { 52 52 super(tr("Import..."), "open", tr("Import vector graphics."), 53 Shortcut.registerShortcut("system:import", tr("File: {0}", tr("Import...")), KeyEvent.VK_I, Shortcut.GROUP_MENU),true); 53 Shortcut.registerShortcut("system:import", tr("File: {0}", tr("Import...")), KeyEvent.VK_I, Shortcut.GROUP_MENU), false); 54 // Avoid to override "open" toolbar function 55 putValue("toolbar", "importvec"); 56 Main.toolbar.register(this); 54 57 } 55 58 public static JFileChooser createAndOpenFileChooser(boolean open, boolean multiple, String title) { … … 122 125 123 126 File[] files = fc.getSelectedFiles(); 124 127 125 128 Main.worker.submit(new ImportTask(Arrays.asList(files))); 126 129 } 127 130 128 131 static public class ImportTask extends PleaseWaitRunnable { 129 132 LinkedList<Node> nodes = new LinkedList<Node>(); … … 150 153 EastNorth center; 151 154 double scale; 152 155 153 156 Way currentway; 154 157 double lastX; 155 158 double lastY; 156 159 157 160 private void appendNode(double x, double y) throws IOException { 158 161 if (currentway == null) … … 195 198 cube(1-t)*ay+3*sqr(1-t)*t*by+3*(1-t)*t*t*cy+t*t*t*dy); 196 199 } 197 200 198 201 private void processElement(SVGElement el) throws IOException { 199 202 if (el instanceof Group) { … … 224 227 double lasty = lastY; 225 228 for (int i = 1;i<Settings.getCurveSteps();i++) { 226 appendNode(interpolate_quad(lastx,lasty,coords[0],coords[1],coords[2],coords[3], (double)i/Settings.getCurveSteps()));229 appendNode(interpolate_quad(lastx,lasty,coords[0],coords[1],coords[2],coords[3],i/Settings.getCurveSteps())); 227 230 } 228 231 appendNode(coords[2],coords[3]); … … 232 235 lasty = lastY; 233 236 for (int i = 1;i<Settings.getCurveSteps();i++) { 234 appendNode(interpolate_cubic(lastx,lasty,coords[0],coords[1],coords[2],coords[3],coords[4],coords[5], (double)i/Settings.getCurveSteps()));237 appendNode(interpolate_cubic(lastx,lasty,coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],i/Settings.getCurveSteps())); 235 238 } 236 239 appendNode(coords[4],coords[5]); … … 265 268 in.close(); 266 269 } 267 270 268 271 SVGDiagram diagram = loader.getLoadedDiagram(); 269 272 ShapeElement root = diagram.getRoot(); … … 271 274 Rectangle2D bbox = root.getBoundingBox(); 272 275 this.center = this.center.add(-bbox.getCenterX()*scale, bbox.getCenterY()*scale); 273 276 274 277 processElement(root); 275 278 }
Note:
See TracChangeset
for help on using the changeset viewer.