Changeset 25349 in osm for applications
- Timestamp:
- 2011-02-18T09:43:44+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/pdfimport/src/pdfimport
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pdfimport/src/pdfimport/LayerContents.java
r23991 r25349 1 1 /** 2 * 2 * 3 3 */ 4 4 package pdfimport; -
applications/editors/josm/plugins/pdfimport/src/pdfimport/OrthogonalShapesFilter.java
r24654 r25349 9 9 tolerance = Math.toRadians(toleranceDegrees); 10 10 } 11 11 12 12 public boolean isOrthogonal(PdfPath path) { 13 13 14 14 if (path.points.size() < 3) 15 15 return false; 16 16 17 17 int targetPos = path.isClosed() ? path.points.size(): path.points.size() - 1; 18 18 19 19 for(int pos = 1; pos < targetPos; pos++) { 20 20 Point2D p1 = path.points.get(pos -1); 21 21 Point2D p2 = path.points.get(pos); 22 22 Point2D p3 = pos+1 == path.points.size() ? path.points.get(1) : path.points.get(pos+1); 23 23 24 24 double angle1 = Math.atan2(p2.getY() - p1.getY(),p2.getX() - p1.getX()); 25 25 double angle2 = Math.atan2(p3.getY() - p2.getY(),p3.getX() - p2.getX()); 26 26 27 27 double angleDifference = angle1 - angle2; 28 28 while (angleDifference < 0) angleDifference += Math.PI; … … 30 30 //test straight angles 31 31 boolean hasGoodVariant = false; 32 33 for (int quadrant = 0; quadrant <= 4; quadrant ++) { 32 33 for (int quadrant = 0; quadrant <= 4; quadrant ++) { 34 34 double difference = angleDifference - Math.PI / 2 * quadrant; 35 35 if (Math.abs(difference) <= tolerance) 36 36 hasGoodVariant = true; 37 37 } 38 38 39 39 if (!hasGoodVariant) 40 40 return false; 41 41 } 42 42 43 43 return true; 44 44 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/PathOptimizer.java
r24654 r25349 586 586 { 587 587 if (!closed && !single) { 588 return Collections.singletonList(layer); 589 } 590 588 return Collections.singletonList(layer); 589 } 590 591 591 OrthogonalShapesFilter of = new OrthogonalShapesFilter(10); 592 592 … … 601 601 boolean pathUnclosed = !path.isClosed() && closed; 602 602 boolean pathSingleSegment = path.points.size() <= 3 && single; 603 603 604 604 if (pathSingleSegment) { 605 605 singleSegmentPaths.add(path); 606 606 } 607 607 else if (pathUnclosed) { 608 608 609 609 if (pathOrthgonal) { 610 610 orthogonalPaths.add(path); … … 616 616 else { 617 617 if (pathOrthgonal) { 618 orthogonalClosedPaths.add(path); 618 orthogonalClosedPaths.add(path); 619 619 } 620 620 else … … 622 622 closedPaths.add(path); 623 623 } 624 624 625 625 } 626 626 } … … 642 642 layers.add(l); 643 643 } 644 644 645 645 646 646 if (orthogonalPaths.size() > 0) { … … 650 650 layers.add(l); 651 651 } 652 652 653 653 if (orthogonalClosedPaths.size() > 0) { 654 654 LayerContents l = new LayerContents(); -
applications/editors/josm/plugins/pdfimport/src/pdfimport/PdfImportPlugin.java
r23702 r25349 15 15 public class PdfImportPlugin extends Plugin { 16 16 17 17 protected String name; 18 18 19 20 21 22 23 24 25 26 27 28 29 19 public PdfImportPlugin(PluginInformation info) { 20 super(info); 21 name = tr("Import PDf file"); 22 JMenu toolsMenu = null; 23 for (int i = 0; i < Main.main.menu.getMenuCount() && toolsMenu == null; i++) { 24 JMenu menu = Main.main.menu.getMenu(i); 25 String name = menu.getText(); 26 if (name != null && name.equals(tr("Tools"))) { 27 toolsMenu = menu; 28 } 29 } 30 30 31 32 33 34 35 36 37 38 39 31 if (toolsMenu == null) { 32 toolsMenu = new JMenu(name); 33 toolsMenu.add(new JMenuItem(new PdfImportAction())); 34 Main.main.menu.add(toolsMenu, 2); 35 } else { 36 toolsMenu.addSeparator(); 37 toolsMenu.add(new JMenuItem(new PdfImportAction())); 38 } 39 } 40 40 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/PdfMultiPath.java
r23702 r25349 11 11 paths = paths2; 12 12 } 13 13 14 14 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/PageDrawer.java
r24189 r25349 186 186 * 187 187 * @param newStroke The current stroke. 188 * 188 * 189 189 */ 190 190 public void setStroke(BasicStroke newStroke) … … 217 217 * @param awtImage The image to draw. 218 218 * @param at The transformation to use when drawing. 219 * 219 * 220 220 */ 221 221 public void drawImage(){ … … 257 257 * 258 258 * @param windingRule The winding rule this path will use. 259 * 259 * 260 260 */ 261 261 public void setClippingPath(int windingRule) -
applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/operators/ClosePath.java
r23991 r25349 38 38 * @param operator The operator that is being executed. 39 39 * @param arguments List 40 * 40 * 41 41 * @throws IOException if something went wrong during logging 42 42 */
Note:
See TracChangeset
for help on using the changeset viewer.