Changeset 23991 in osm for applications/editors/josm/plugins
- Timestamp:
- 2010-11-01T14:27:55+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/pdfimport
- Files:
-
- 32 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pdfimport/build.xml
r23863 r23991 86 86 <copy todir="${plugin.build.dir}/images"> 87 87 <fileset dir="images" /> 88 </copy> 89 <copy todir="${plugin.build.dir}"> 90 <fileset dir="resources" /> 88 91 </copy> 89 92 -
applications/editors/josm/plugins/pdfimport/src/pdfimport/LayerContents.java
r23702 r23991 13 13 List<PdfPath> paths = new ArrayList<PdfPath>(); 14 14 List<PdfMultiPath> multiPaths = new ArrayList<PdfMultiPath>(); 15 LayerInfo info; 15 LayerInfo info; 16 16 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/LayerInfo.java
r23862 r23991 4 4 5 5 public class LayerInfo{ 6 public Color fill; 7 public Color stroke; 8 public int dash; 6 9 public double width; 7 public Color color; 8 public Color fillColor; 9 public boolean fill; 10 public boolean stroke; 10 public int divider; 11 public boolean isGroup; 11 12 12 13 public int nr; 13 public int divider;14 public int dash;15 14 16 15 @Override … … 19 18 int code = Double.toString(width).hashCode() ^ this.divider ^ this.dash; 20 19 21 if (this.fill ) {22 code ^= this.fill Color.hashCode();20 if (this.fill != null) { 21 code ^= this.fill.hashCode(); 23 22 } 24 23 25 if (this.stroke ) {26 code ^= this. color.hashCode();24 if (this.stroke != null) { 25 code ^= this.stroke.hashCode(); 27 26 } 28 27 … … 34 33 { 35 34 LayerInfo l = (LayerInfo) o; 36 boolean eq = 37 this.width == l.width && 38 this.divider == l.divider && 39 this.fill == l.fill && 40 this.stroke == l.stroke && 41 this.dash == l.dash; 35 boolean eq = this.width == l.width && 36 this.divider == l.divider && 37 this.dash == l.dash; 42 38 43 if (this.fill){ 44 eq &= this.fillColor.equals(l.fillColor); 39 40 if (this.fill != null){ 41 eq &= this.fill.equals(l.fill); 45 42 } 46 43 47 if (this.stroke ) {48 eq &= this. color.equals(l.color);44 if (this.stroke != null) { 45 eq &= this.stroke.equals(l.stroke); 49 46 } 50 47 … … 54 51 public LayerInfo copy() { 55 52 LayerInfo result = new LayerInfo(); 56 result.color = this.color;57 result.fillColor = this.fillColor;58 result.width = this.width;59 result.divider = this.divider;60 53 result.fill = this.fill; 61 54 result.stroke = this.stroke; 62 55 result.dash = this.dash; 56 result.width = this.width; 57 result.divider = this.divider; 63 58 return result; 64 59 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java
r23866 r23991 19 19 import javax.swing.BorderFactory; 20 20 import javax.swing.JButton; 21 import javax.swing.JCheckBox; 21 22 import javax.swing.JComboBox; 22 23 import javax.swing.JFileChooser; … … 67 68 private JButton showButton; 68 69 private JButton saveButton; 70 private JCheckBox debugModeCheck; 69 71 70 72 public LoadPdfDialog() { … … 159 161 this.getMaxButton = new JButton(tr("Take X and Y from selected node")); 160 162 163 this.debugModeCheck = new JCheckBox(tr("Debug info")); 164 161 165 162 166 JPanel selectFilePanel = new JPanel(new GridBagLayout()); … … 164 168 c.gridx = 0; c.gridy = 0; c.gridwidth = 1; 165 169 selectFilePanel.add(this.loadFileButton, c); 170 171 c.gridx = 0; c.gridy = 1; c.gridwidth = 1; 172 selectFilePanel.add(this.debugModeCheck, c); 166 173 167 174 JPanel projectionPanel = new JPanel(new GridBagLayout()); … … 208 215 projectionPanel.add(this.getMaxButton, c); 209 216 210 211 217 JPanel okCancelPanel = new JPanel(new GridLayout(1,3)); 212 218 okCancelPanel.add(this.cancelButton); … … 246 252 public void actionPerformed(ActionEvent e) { 247 253 if (data!= null) { 254 OsmBuilder.Mode mode = LoadPdfDialog.this.debugModeCheck.isSelected() ? OsmBuilder.Mode.Debug: OsmBuilder.Mode.Draft; 248 255 LoadPdfDialog.this.fileName = fileName.getAbsolutePath(); 249 LoadPdfDialog.this.makeLayer(tr("PDF file preview"), false);256 LoadPdfDialog.this.makeLayer(tr("PDF file preview"), mode); 250 257 LoadPdfDialog.this.loadFileButton.setText(tr("Loaded")); 251 258 LoadPdfDialog.this.loadFileButton.setEnabled(true); … … 264 271 265 272 //rebuild layer with latest projection 266 this.makeLayer(tr("Imported PDF: ") + this.fileName, true);273 this.makeLayer(tr("Imported PDF: ") + this.fileName, OsmBuilder.Mode.Final); 267 274 this.setVisible(false); 268 275 } … … 480 487 } 481 488 482 private void makeLayer(String name, boolean isFinal) {489 private void makeLayer(String name, OsmBuilder.Mode mode) { 483 490 this.removeLayer(); 484 491 … … 487 494 } 488 495 489 DataSet data = builder.build(this.data.getLayers(), isFinal);496 DataSet data = builder.build(this.data.getLayers(), mode); 490 497 this.layer = new OsmDataLayer(data, name, null); 491 498 … … 510 517 511 518 private void saveLayer(java.io.File file) { 512 DataSet data = builder.build(this.data.getLayers(), true);519 DataSet data = builder.build(this.data.getLayers(), OsmBuilder.Mode.Final); 513 520 OsmDataLayer layer = new OsmDataLayer(data, file.getName(), file); 514 521 -
applications/editors/josm/plugins/pdfimport/src/pdfimport/OsmBuilder.java
r23907 r23991 20 20 public class OsmBuilder { 21 21 22 enum Mode {Draft, Final, Debug}; 23 22 24 public Projection projection = null; 23 25 public double minX = 0; … … 31 33 public double maxNorth = 10000; 32 34 33 private final Map<String, String> stringsMap = new HashMap<String, String>(); 35 private String layerName; 36 private String fillName; 37 private String lineName; 38 private Mode mode; 34 39 35 40 … … 59 64 } 60 65 61 public DataSet build(List<LayerContents> data, boolean full) { 62 66 public DataSet build(List<LayerContents> data, Mode mode) { 67 68 this.mode = mode; 63 69 DataSet result = new DataSet(); 64 70 65 71 for (LayerContents layer: data) { 66 this.addLayer(result, layer , full);72 this.addLayer(result, layer); 67 73 } 68 74 return result; … … 70 76 71 77 72 private void addLayer(DataSet target, LayerContents layer , boolean full) {78 private void addLayer(DataSet target, LayerContents layer) { 73 79 Map<Point2D, Node> point2Node = new HashMap<Point2D, Node>(); 80 81 this.fillName = this.printColor(layer.info.fill); 82 this.lineName = this.printColor(layer.info.stroke); 83 this.layerName = "" + layer.info.nr; 74 84 75 85 //insert nodes … … 86 96 87 97 for (PdfPath path: layer.paths){ 88 Way w = this.insertWay(path, point2Node, -1, f ull, false);98 Way w = this.insertWay(path, point2Node, -1, false); 89 99 target.addPrimitive(w); 90 100 path2Way.put(path, w); … … 94 104 for (PdfMultiPath mpath: layer.multiPaths) { 95 105 for (PdfPath path: mpath.paths){ 96 Way w = this.insertWay(path, point2Node, pathId, full,true);106 Way w = this.insertWay(path, point2Node, pathId, true); 97 107 target.addPrimitive(w); 98 108 path2Way.put(path, w); … … 101 111 } 102 112 103 if ( full) {113 if (this.mode != Mode.Draft) { 104 114 //insert relations 105 115 for (PdfMultiPath mpath: layer.multiPaths) { … … 121 131 } 122 132 123 private Way insertWay(PdfPath path, Map<Point2D, Node> point2Node, int multipathId, boolean full, booleanmultipolygon) {133 private Way insertWay(PdfPath path, Map<Point2D, Node> point2Node, int multipathId, boolean multipolygon) { 124 134 125 135 List<Node> nodes = new ArrayList<Node>(path.points.size()); … … 136 146 Map<String, String> keys = new HashMap<String, String>(); 137 147 138 if ( full) {148 if (this.mode != Mode.Draft) { 139 149 keys.put("PDF_nr", "" + path.nr); 140 keys.put("PDF_layer", this. getString("" + path.layer.info.nr));150 keys.put("PDF_layer", this.layerName); 141 151 142 152 if (path.isClosed()){ … … 144 154 } 145 155 146 if ( path.layer.info.fill){147 keys.put("PDF_fillColor", printColor(path.layer.info.fillColor));148 } 149 150 if ( path.layer.info.stroke) {151 keys.put("PDF_lineColor", printColor(path.layer.info.color));156 if (this.fillName != null){ 157 keys.put("PDF_fillColor", this.fillName); 158 } 159 160 if (this.lineName != null) { 161 keys.put("PDF_lineColor", this.lineName); 152 162 } 153 163 … … 155 165 keys.put("PDF_multipath", ""+ multipathId); 156 166 } 157 else if (path.layer.info.fill && !multipolygon) {167 else if (path.layer.info.fill != null && !multipolygon) { 158 168 keys.put("area", "yes"); 159 169 } 170 } 171 172 if (this.mode == Mode.Debug) { 173 174 keys.put("PDF_pathLayer", ""+path.layer.info.nr); 175 keys.put("PDF_lineWidth", ""+path.layer.info.width); 176 keys.put("PDF_lineDash", ""+path.layer.info.dash); 177 keys.put("PDF_layerHash", ""+path.layer.info.hashCode()); 178 keys.put("PDF_layerDivider", ""+path.layer.info.divider); 160 179 } 161 180 … … 167 186 168 187 169 private String getString(String string) {170 if (this.stringsMap.containsKey(string)) {171 return this.stringsMap.get(string);172 } else {173 this.stringsMap.put(string, string);174 return string;175 }176 }177 188 178 189 private String printColor(Color col){ 179 String s = "#" + Integer.toHexString(col.getRGB() & 0xffffff); 180 return getString(s); 190 if (col == null){ 191 return null; 192 } 193 194 String s = Integer.toHexString(col.getRGB()); 195 while (s.length() < 6) { 196 s = "0" + s; 197 } 198 199 return "#" + s; 181 200 } 182 201 -
applications/editors/josm/plugins/pdfimport/src/pdfimport/PathOptimizer.java
r23862 r23991 4 4 import java.awt.geom.Rectangle2D; 5 5 import java.util.ArrayList; 6 import java.util.Collections; 6 7 import java.util.HashMap; 7 8 import java.util.HashSet; … … 68 69 public void optimize() 69 70 { 71 70 72 for(LayerContents layer: this.layers) { 71 this.concatenat aPaths(layer);73 this.concatenatePaths(layer); 72 74 } 73 75 74 76 75 77 List<LayerContents> newLayers = new ArrayList<LayerContents>(); 76 int nr = 0; 77 78 /* 79 for(LayerContents l: this.layers) { 80 List<LayerContents> splitResult = splitBySimilarGroups(l); 81 82 for(LayerContents ll: splitResult) { 83 newLayers.add(ll); 84 } 85 } 86 this.layers = newLayers; 87 */ 88 89 90 newLayers = new ArrayList<LayerContents>(); 78 91 for(LayerContents l: this.layers) { 79 92 List<LayerContents> splitResult = splitBySegmentKind(l); 80 93 81 94 for(LayerContents ll: splitResult) { 82 ll.info.nr = nr;83 nr ++;84 95 newLayers.add(ll); 85 96 } … … 87 98 88 99 this.layers = newLayers; 89 100 int nr = 0; 90 101 for(LayerContents layer: this.layers) { 102 layer.info.nr = nr; 103 nr++; 91 104 finalizeLayer(layer); 92 105 } … … 127 140 * @param layer the layer to process. 128 141 */ 129 private void concatenat aPaths(LayerContents layer) {142 private void concatenatePaths(LayerContents layer) { 130 143 Map<Point2D, PdfPath> pathEndpoints = new HashMap<Point2D, PdfPath>(); 131 144 Set<PdfPath> mergedPaths = new HashSet<PdfPath>(); … … 140 153 141 154 if (pathEndpoints.containsKey(path.firstPoint())) { 155 142 156 PdfPath p1 = pathEndpoints.get(path.firstPoint()); 157 158 if (this.isSubpathOf(p1, path)){ 159 continue; 160 } 161 143 162 pathEndpoints.remove(p1.firstPoint()); 144 163 pathEndpoints.remove(p1.lastPoint()); … … 159 178 if (pathEndpoints.containsKey(path.lastPoint())) { 160 179 PdfPath p1 = pathEndpoints.get(path.lastPoint()); 180 181 if (this.isSubpathOf(p1, path)){ 182 continue; 183 } 184 161 185 pathEndpoints.remove(p1.firstPoint()); 162 186 pathEndpoints.remove(p1.lastPoint()); … … 184 208 185 209 layer.paths = resultPaths; 210 } 211 212 /** 213 * Tests if sub is subpath of main. 214 * @param main 215 * @param sub 216 * @return 217 */ 218 private boolean isSubpathOf(PdfPath main, PdfPath sub) { 219 220 Set<Point2D> points = new HashSet<Point2D>(main.points); 221 222 for(Point2D point: sub.points) { 223 if (!points.contains(point)){ 224 return false; 225 } 226 } 227 228 return true; 186 229 } 187 230 … … 232 275 } 233 276 277 private List<LayerContents> splitBySimilarGroups(LayerContents layer) { 278 List<List<PdfPath>> subparts = new ArrayList<List<PdfPath>>(); 279 280 //split into similar parts 281 for (PdfPath path: layer.paths) { 282 List<PdfPath> sublayer = null; 283 284 for(List<PdfPath> ll: subparts){ 285 if (this.pathsSimilar(ll.get(0).points, path.points)) 286 { 287 sublayer = ll; 288 break; 289 } 290 } 291 292 if (sublayer == null) { 293 sublayer = new ArrayList<PdfPath>(); 294 subparts.add(sublayer); 295 } 296 297 sublayer.add(path); 298 } 299 300 //get groups 301 int minGroupTreshold = 10; 302 303 List<PdfPath> independantPaths = new ArrayList<PdfPath>(); 304 List<LayerContents> result = new ArrayList<LayerContents>(); 305 306 for(List<PdfPath> list: subparts){ 307 if (list.size() >= minGroupTreshold) { 308 LayerContents l = new LayerContents(); 309 l.paths = list; 310 l.info = layer.info.copy(); 311 l.info.isGroup = true; 312 l.multiPaths = Collections.EMPTY_LIST; 313 result.add(l); 314 } 315 else 316 { 317 independantPaths.addAll(list); 318 } 319 } 320 321 if (independantPaths.size() > 0 || layer.multiPaths.size() > 0) { 322 LayerContents l = new LayerContents(); 323 l.paths = independantPaths; 324 l.info = layer.info.copy(); 325 l.info.isGroup = false; 326 l.multiPaths = layer.multiPaths; 327 result.add(l); 328 } 329 330 331 return result; 332 } 333 234 334 235 335 … … 277 377 } 278 378 379 /** 380 * Test if paths are different only by offset. 381 * @return 382 */ 383 private boolean pathsSimilar(List<Point2D> path1, List<Point2D> path2) { 384 if (path1.size() != path2.size()) { 385 return false; 386 } 387 388 if (path1.size() < 3) { 389 return false; 390 //cannot judge so small paths 391 } 392 393 Point2D p1 = path1.get(0); 394 Point2D p2 = path2.get(0); 395 396 double offsetX = p1.getX() - p2.getX(); 397 double offsetY = p1.getY() - p2.getY(); 398 double tolerance = 1e-4; 399 400 for(int pos = 0; pos < path1.size(); pos ++) { 401 p1 = path1.get(pos); 402 p2 = path2.get(pos); 403 404 double errorX = p1.getX() - p2.getX() - offsetX; 405 double errorY = p1.getY() - p2.getY() - offsetY; 406 407 if (Math.abs(errorX) + Math.abs(errorY) > tolerance){ 408 return false; 409 } 410 } 411 412 return true; 413 } 414 279 415 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/GraphicsProcessor.java
r23866 r23991 3 3 import java.awt.BasicStroke; 4 4 import java.awt.Color; 5 import java.awt.Composite;6 import java.awt.Font;7 import java.awt.FontMetrics;8 import java.awt.Graphics;9 import java.awt.Graphics2D;10 import java.awt.GraphicsConfiguration;11 import java.awt.Image;12 import java.awt.Paint;13 import java.awt.Rectangle;14 import java.awt.RenderingHints;15 5 import java.awt.Shape; 16 6 import java.awt.Stroke; 17 import java.awt.RenderingHints.Key;18 import java.awt.font.FontRenderContext;19 import java.awt.font.GlyphVector;20 7 import java.awt.geom.AffineTransform; 21 8 import java.awt.geom.PathIterator; 22 9 import java.awt.geom.Point2D; 23 import java.awt.image.BufferedImage;24 import java.awt.image.BufferedImageOp;25 import java.awt.image.ImageObserver;26 import java.awt.image.RenderedImage;27 import java.awt.image.renderable.RenderableImage;28 import java.text.AttributedCharacterIterator;29 10 import java.util.ArrayList; 30 11 import java.util.List; 31 import java.util.Map;32 12 33 13 import pdfimport.LayerInfo; … … 35 15 import pdfimport.PdfPath; 36 16 37 public class GraphicsProcessor extends Graphics2D{17 public class GraphicsProcessor{ 38 18 39 19 public PathOptimizer target; … … 44 24 private boolean complexClipShape; 45 25 private boolean clipAreaDrawn; 46 private final double height;47 26 48 27 private final AffineTransform transform; 49 28 50 public GraphicsProcessor(PathOptimizer target, int rotation , double height)29 public GraphicsProcessor(PathOptimizer target, int rotation) 51 30 { 52 this.height = height;53 31 this.target = target; 54 32 this.transform = new AffineTransform(); 55 this.transform.rotate(Math.toRadians(rotation)); 56 this.info.color = Color.BLACK; 57 this.info.fillColor = Color.BLACK; 58 } 59 60 private void addPath(Shape s, boolean fill) { 61 List<PdfPath> paths = this.parsePath(s); 62 if (fill) { 63 this.info.fill = true; 64 this.info.stroke = false; 65 } 66 else { 67 this.info.fill = false; 68 this.info.stroke = true; 69 } 33 this.transform.rotate(-Math.toRadians(rotation)); 34 this.info.stroke = Color.BLACK; 35 this.info.fill = Color.BLACK; 36 } 37 38 39 private void addPath(Shape s, boolean closed) { 40 List<PdfPath> paths = this.parsePath(s, closed); 70 41 71 42 for (PdfPath p: paths){ … … 84 55 85 56 86 private List<PdfPath> parsePath(Shape s ) {57 private List<PdfPath> parsePath(Shape s, boolean closed) { 87 58 List<PdfPath> result = new ArrayList<PdfPath>(2); 88 59 List<Point2D> points = new ArrayList<Point2D>(2); 89 90 60 91 61 PathIterator iter = s.getPathIterator(null); … … 139 109 if (points.size() > 1 ) 140 110 { 111 if (closed) { 112 this.addPoint(points, points.get(0)); 113 } 114 141 115 result.add(new PdfPath(points)); 142 116 } 143 144 145 117 146 118 return result; … … 161 133 private Point2D parsePoint(double[] buffer, int offset) { 162 134 //invert Y. 163 Point2D point = new Point2D.Double(buffer[offset], this.height -buffer[offset + 1]);135 Point2D point = new Point2D.Double(buffer[offset], buffer[offset + 1]); 164 136 Point2D dest = new Point2D.Double(); 165 137 this.transform.transform(point, dest); … … 167 139 } 168 140 169 170 @Override 171 public void draw(Shape s) { 172 173 if (complexClipShape) 174 { 175 if (!this.clipAreaDrawn) 176 { 141 public void drawPath(Shape path, Color stroke, Color fill, 142 int windingRule) { 143 144 if (complexClipShape) { 145 if (!this.clipAreaDrawn) { 146 this.info.stroke = null; 147 this.info.fill = Color.CYAN; 177 148 this.addPath(this.clipShape, true); 178 149 this.clipAreaDrawn = true; 179 150 } 180 151 } 181 else 182 { 183 this.addPath(s, false); 184 } 185 } 186 187 188 @Override 189 public void fill(Shape s) { 190 this.addPath(s, true); 191 } 192 193 @Override 194 public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) { 195 196 if (!this.clipAreaDrawn) 197 { 152 153 if (!complexClipShape || fill != null) { 154 this.info.stroke = stroke; 155 this.info.fill = fill; 156 this.addPath(path, fill != null); 157 } 158 } 159 160 161 public void drawImage() { 162 163 if (!this.clipAreaDrawn) { 164 this.info.stroke = null; 165 this.info.fill = Color.CYAN; 198 166 this.addPath(this.clipShape, true); 199 167 this.clipAreaDrawn = true; 200 168 } 201 return true; 202 } 203 204 205 @Override 169 } 170 171 206 172 public void setClip(Shape clip) { 207 173 if (this.clipShape == clip) 208 174 return; 209 175 210 this.clipPath = this.parsePath(clip );176 this.clipPath = this.parsePath(clip, true); 211 177 212 178 boolean complexClipPath = false; … … 227 193 } 228 194 229 @Override 230 public void setColor(Color c) { 231 this.info.color = c; 232 this.info.fillColor = c; 233 } 234 235 236 @Override 195 237 196 public void setStroke(Stroke s) { 238 197 BasicStroke stroke = (BasicStroke) s; … … 245 204 } 246 205 247 248 @Override 249 public void clip(Shape s) { 250 //TODO: 251 } 252 253 254 @Override 255 public void addRenderingHints(Map<?, ?> hints) { 206 public void drawString(float x, float y, String character, Color color) { 256 207 // TODO Auto-generated method stub 257 208 } 258 259 260 @Override261 public void drawGlyphVector(GlyphVector g, float x, float y) {262 // TODO Auto-generated method stub263 264 }265 266 @Override267 public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {268 // TODO Auto-generated method stub269 270 }271 272 @Override273 public void drawRenderableImage(RenderableImage img, AffineTransform xform) {274 // TODO Auto-generated method stub275 276 }277 278 @Override279 public void drawRenderedImage(RenderedImage img, AffineTransform xform) {280 // TODO Auto-generated method stub281 282 }283 284 @Override285 public void drawString(String str, int x, int y) {286 // TODO Auto-generated method stub287 288 }289 290 @Override291 public void drawString(String str, float x, float y) {292 // TODO Auto-generated method stub293 294 }295 296 @Override297 public void drawString(AttributedCharacterIterator iterator, int x, int y) {298 // TODO Auto-generated method stub299 300 }301 302 @Override303 public void drawString(AttributedCharacterIterator iterator, float x,304 float y) {305 // TODO Auto-generated method stub306 307 }308 309 310 @Override311 public Color getBackground() {312 // TODO Auto-generated method stub313 return null;314 }315 316 @Override317 public Composite getComposite() {318 // TODO Auto-generated method stub319 return null;320 }321 322 @Override323 public GraphicsConfiguration getDeviceConfiguration() {324 // TODO Auto-generated method stub325 return null;326 }327 328 @Override329 public FontRenderContext getFontRenderContext() {330 // TODO Auto-generated method stub331 return null;332 }333 334 @Override335 public Paint getPaint() {336 // TODO Auto-generated method stub337 return null;338 }339 340 @Override341 public Object getRenderingHint(Key hintKey) {342 // TODO Auto-generated method stub343 return null;344 }345 346 @Override347 public RenderingHints getRenderingHints() {348 // TODO Auto-generated method stub349 return null;350 }351 352 @Override353 public Stroke getStroke() {354 // TODO Auto-generated method stub355 return null;356 }357 358 @Override359 public AffineTransform getTransform() {360 // TODO Auto-generated method stub361 return null;362 }363 364 @Override365 public boolean hit(Rectangle rect, Shape s, boolean onStroke) {366 // TODO Auto-generated method stub367 return false;368 }369 370 @Override371 public void rotate(double theta) {372 // TODO Auto-generated method stub373 374 }375 376 @Override377 public void rotate(double theta, double x, double y) {378 // TODO Auto-generated method stub379 380 }381 382 @Override383 public void scale(double sx, double sy) {384 // TODO Auto-generated method stub385 386 }387 388 @Override389 public void setBackground(Color color) {390 // TODO Auto-generated method stub391 392 }393 394 @Override395 public void setComposite(Composite comp) {396 // TODO Auto-generated method stub397 398 }399 400 @Override401 public void setPaint(Paint paint) {402 // TODO Auto-generated method stub403 404 }405 406 @Override407 public void setRenderingHint(Key hintKey, Object hintValue) {408 // TODO Auto-generated method stub409 410 }411 412 @Override413 public void setRenderingHints(Map<?, ?> hints) {414 // TODO Auto-generated method stub415 416 }417 418 @Override419 public void setTransform(AffineTransform Tx) {420 // TODO Auto-generated method stub421 422 }423 424 @Override425 public void shear(double shx, double shy) {426 // TODO Auto-generated method stub427 428 }429 430 @Override431 public void transform(AffineTransform Tx) {432 // TODO Auto-generated method stub433 434 }435 436 @Override437 public void translate(int x, int y) {438 // TODO Auto-generated method stub439 440 }441 442 @Override443 public void translate(double tx, double ty) {444 // TODO Auto-generated method stub445 446 }447 448 @Override449 public void clearRect(int x, int y, int width, int height) {450 // TODO Auto-generated method stub451 452 }453 454 @Override455 public void clipRect(int x, int y, int width, int height) {456 // TODO Auto-generated method stub457 458 }459 460 @Override461 public void copyArea(int x, int y, int width, int height, int dx, int dy) {462 // TODO Auto-generated method stub463 464 }465 466 @Override467 public Graphics create() {468 // TODO Auto-generated method stub469 return null;470 }471 472 @Override473 public void dispose() {474 // TODO Auto-generated method stub475 476 }477 478 @Override479 public void drawArc(int x, int y, int width, int height, int startAngle,480 int arcAngle) {481 // TODO Auto-generated method stub482 483 }484 485 @Override486 public boolean drawImage(Image img, int x, int y, ImageObserver observer) {487 // TODO Auto-generated method stub488 return false;489 }490 491 @Override492 public boolean drawImage(Image img, int x, int y, Color bgcolor,493 ImageObserver observer) {494 // TODO Auto-generated method stub495 return false;496 }497 498 @Override499 public boolean drawImage(Image img, int x, int y, int width, int height,500 ImageObserver observer) {501 // TODO Auto-generated method stub502 return false;503 }504 505 @Override506 public boolean drawImage(Image img, int x, int y, int width, int height,507 Color bgcolor, ImageObserver observer) {508 // TODO Auto-generated method stub509 return false;510 }511 512 @Override513 public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,514 int sx1, int sy1, int sx2, int sy2, ImageObserver observer) {515 // TODO Auto-generated method stub516 return false;517 }518 519 @Override520 public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2,521 int sx1, int sy1, int sx2, int sy2, Color bgcolor,522 ImageObserver observer) {523 // TODO Auto-generated method stub524 return false;525 }526 527 @Override528 public void drawLine(int x1, int y1, int x2, int y2) {529 // TODO Auto-generated method stub530 531 }532 533 @Override534 public void drawOval(int x, int y, int width, int height) {535 // TODO Auto-generated method stub536 537 }538 539 @Override540 public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {541 // TODO Auto-generated method stub542 543 }544 545 @Override546 public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {547 // TODO Auto-generated method stub548 549 }550 551 @Override552 public void drawRoundRect(int x, int y, int width, int height,553 int arcWidth, int arcHeight) {554 // TODO Auto-generated method stub555 556 }557 558 @Override559 public void fillArc(int x, int y, int width, int height, int startAngle,560 int arcAngle) {561 // TODO Auto-generated method stub562 563 }564 565 @Override566 public void fillOval(int x, int y, int width, int height) {567 // TODO Auto-generated method stub568 569 }570 571 @Override572 public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {573 // TODO Auto-generated method stub574 575 }576 577 @Override578 public void fillRect(int x, int y, int width, int height) {579 // TODO Auto-generated method stub580 581 }582 583 @Override584 public void fillRoundRect(int x, int y, int width, int height,585 int arcWidth, int arcHeight) {586 // TODO Auto-generated method stub587 588 }589 590 @Override591 public Shape getClip() {592 // TODO Auto-generated method stub593 return null;594 }595 596 @Override597 public Rectangle getClipBounds() {598 // TODO Auto-generated method stub599 return null;600 }601 602 @Override603 public Color getColor() {604 // TODO Auto-generated method stub605 return null;606 }607 608 @Override609 public Font getFont() {610 // TODO Auto-generated method stub611 return null;612 }613 614 @Override615 public FontMetrics getFontMetrics(Font f) {616 // TODO Auto-generated method stub617 return null;618 }619 620 621 @Override622 public void setClip(int x, int y, int width, int height) {623 // TODO Auto-generated method stub624 625 }626 627 628 @Override629 public void setFont(Font font) {630 // TODO Auto-generated method stub631 632 }633 634 @Override635 public void setPaintMode() {636 // TODO Auto-generated method stub637 638 }639 640 @Override641 public void setXORMode(Color c1) {642 // TODO Auto-generated method stub643 644 }645 646 209 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/PdfBoxParser.java
r23866 r23991 2 2 import static org.openstreetmap.josm.tools.I18n.tr; 3 3 4 import java.awt.Dimension;5 4 import java.awt.geom.Rectangle2D; 6 5 import java.io.File; 7 6 import java.util.List; 8 7 9 import org.apache.pdfbox.pdfviewer.PageDrawer;10 8 import org.apache.pdfbox.pdmodel.PDDocument; 11 9 import org.apache.pdfbox.pdmodel.PDPage; … … 39 37 PDPage page = (PDPage)allPages.get(0); 40 38 PDRectangle pageSize = page.findMediaBox(); 41 Dimension pageDimension = pageSize.createDimension();42 39 Integer rotationVal = page.getRotation(); 43 40 int rotation = 0; … … 46 43 } 47 44 48 GraphicsProcessor p = new GraphicsProcessor(target, rotation , pageDimension.getHeight());45 GraphicsProcessor p = new GraphicsProcessor(target, rotation); 49 46 PageDrawer drawer = new PageDrawer(); 50 drawer.drawPage(p, page , pageDimension);47 drawer.drawPage(p, page); 51 48 this.target.bounds = new Rectangle2D.Double(pageSize.getLowerLeftX(), pageSize.getLowerLeftY(), pageSize.getWidth(), pageSize.getHeight()); 52 49 }
Note:
See TracChangeset
for help on using the changeset viewer.