Changeset 23862 in osm for applications
- Timestamp:
- 2010-10-27T15:31:08+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/pdfimport/src
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pdfimport/src/pdfimport/LayerInfo.java
r23702 r23862 10 10 public boolean stroke; 11 11 12 public int nr; 12 public int nr; 13 13 public int divider; 14 14 public int dash; 15 15 16 @Override 16 17 public int hashCode() 17 18 { 18 int code = Double.toString(width).hashCode() ^ this.divider ;19 19 int code = Double.toString(width).hashCode() ^ this.divider ^ this.dash; 20 20 21 if (this.fill) { 21 22 code ^= this.fillColor.hashCode(); 22 23 } 23 24 24 25 if (this.stroke) { 25 26 code ^= this.color.hashCode(); 26 27 } 27 28 28 29 return code; 29 30 } 30 31 32 @Override 31 33 public boolean equals(Object o) 32 34 { 33 35 LayerInfo l = (LayerInfo) o; 34 boolean eq = 35 this.width == l.width && 36 this.divider == l.divider && 36 boolean eq = 37 this.width == l.width && 38 this.divider == l.divider && 37 39 this.fill == l.fill && 38 this.stroke == l.stroke; 39 40 this.stroke == l.stroke && 41 this.dash == l.dash; 42 40 43 if (this.fill){ 41 eq &= this.fillColor.equals(l.fillColor); 44 eq &= this.fillColor.equals(l.fillColor); 42 45 } 43 44 if (this.stroke) { 45 eq &= this.color.equals(l.color); 46 47 if (this.stroke) { 48 eq &= this.color.equals(l.color); 46 49 } 47 50 48 51 return eq; 49 52 } … … 57 60 result.fill = this.fill; 58 61 result.stroke = this.stroke; 62 result.dash = this.dash; 59 63 return result; 60 64 } 61 65 62 66 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java
r23861 r23862 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; 4 import it.stefanochizzolini.clown.documents.Document;5 import it.stefanochizzolini.clown.documents.Page;6 import it.stefanochizzolini.clown.documents.contents.ContentScanner;7 import it.stefanochizzolini.clown.documents.contents.Contents;8 import it.stefanochizzolini.clown.files.File;9 import it.stefanochizzolini.clown.tokens.FileFormatException;10 4 11 5 import java.awt.BorderLayout; … … 18 12 import java.awt.event.WindowAdapter; 19 13 import java.awt.event.WindowEvent; 14 import java.io.File; 20 15 import java.io.FileNotFoundException; 21 16 import java.io.IOException; … … 43 38 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 44 39 import org.openstreetmap.josm.io.OsmExporter; 40 41 import pdfimport.pdfbox.PdfBoxParser; 45 42 46 43 public class LoadPdfDialog extends JFrame { … … 242 239 new Runnable() { 243 240 public void run() { 244 data = loadPDF(fileName .getAbsolutePath());241 data = loadPDF(fileName); 245 242 } 246 243 }, … … 411 408 } 412 409 413 private PathOptimizer loadPDF(String fileName) { 414 File file; 410 private PathOptimizer loadPDF(File fileName) { 411 412 PathOptimizer data = new PathOptimizer(); 415 413 416 414 try { 417 file = new File(fileName); 415 PdfBoxParser parser = new PdfBoxParser(data); 416 parser.parse(fileName); 417 418 418 } catch (FileNotFoundException e1) { 419 419 JOptionPane … … 422 422 tr("File not found.")); 423 423 return null; 424 } catch ( FileFormatException e1) {424 } catch (it.stefanochizzolini.clown.tokens.FileFormatException e1) { 425 425 JOptionPane 426 426 .showMessageDialog( … … 428 428 tr("Could not parse file. Not a PDF file?")); 429 429 return null; 430 } 430 } catch (Exception e) { 431 JOptionPane 432 .showMessageDialog( 433 Main.parent, 434 tr("Error while parsing: {0}", e.getMessage())); 435 return null; 436 } 437 438 /* 439 File file = new File(fileName); 431 440 432 441 Document document = file.getDocument(); 433 442 Page page = document.getPages().get(0); 434 435 PathOptimizer data = new PathOptimizer();436 443 data.bounds = page.getBox(); 437 444 … … 440 447 processor.process(new ContentScanner(c)); 441 448 processor.finish(); 442 document.delete(); 449 document.delete();*/ 443 450 444 451 data.optimize(); 445 446 452 return data; 447 453 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/PathOptimizer.java
r23861 r23862 145 145 146 146 List<Point2D> newNodes = tryMergeNodeLists(path.points, p1.points); 147 148 if (newNodes == null) 149 { 150 int a = 10; 151 a++; 152 } 153 147 154 path.points = newNodes; 148 155 mergedPaths.add(p1); -
applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/PdfBoxParser.java
r23861 r23862 3 3 4 4 import java.awt.Dimension; 5 import java.awt.geom.Rectangle2D; 5 6 import java.io.File; 6 7 import java.util.List; … … 12 13 import org.apache.pdfbox.util.PDFStreamEngine; 13 14 14 import pdfimport.GraphicsProcessor;15 15 import pdfimport.PathOptimizer; 16 16 … … 41 41 Dimension pageDimension = pageSize.createDimension(); 42 42 43 GraphicsProcessor p = new GraphicsProcessor(target );43 GraphicsProcessor p = new GraphicsProcessor(target, pageDimension.getHeight()); 44 44 PageDrawer drawer = new PageDrawer(); 45 45 drawer.drawPage(p, page, pageDimension); 46 this.target.bounds = new Rectangle2D.Double(pageSize.getLowerLeftX(), pageSize.getLowerLeftY(), pageSize.getWidth(), pageSize.getHeight()); 46 47 } 47 48 }
Note:
See TracChangeset
for help on using the changeset viewer.