Changeset 30737 in osm for applications/editors/josm/plugins/pdfimport
- Timestamp:
- 2014-10-18T23:07:52+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/pdfimport/src/pdfimport
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pdfimport/src/pdfimport/DuplicateNodesFinder.java
r25349 r30737 20 20 */ 21 21 public static Map<Point2D, Point2D> findDuplicateNodes(Collection<Point2D> nodes, final double tolerance){ 22 List<Point2D> points = new ArrayList< Point2D>(nodes);22 List<Point2D> points = new ArrayList<>(nodes); 23 23 Collections.sort(points, new Comparator<Point2D>(){ 24 24 public int compare(Point2D o1, Point2D o2) { … … 28 28 }); 29 29 30 Map<Point2D, Point2D> result = new HashMap< Point2D, Point2D>();31 TreeMap<Point2D, Point2D> sweepLine = new TreeMap< Point2D, Point2D>(new Comparator<Point2D>(){30 Map<Point2D, Point2D> result = new HashMap<>(); 31 TreeMap<Point2D, Point2D> sweepLine = new TreeMap<>(new Comparator<Point2D>(){ 32 32 public int compare(Point2D o1, Point2D o2) { 33 33 double diff = o1.getX() - o2.getX(); -
applications/editors/josm/plugins/pdfimport/src/pdfimport/LayerContents.java
r25349 r30737 10 10 public class LayerContents{ 11 11 12 List<Point2D> points = new ArrayList< Point2D>();13 List<PdfPath> paths = new ArrayList< PdfPath>();14 List<PdfMultiPath> multiPaths = new ArrayList< PdfMultiPath>();12 List<Point2D> points = new ArrayList<>(); 13 List<PdfPath> paths = new ArrayList<>(); 14 List<PdfMultiPath> multiPaths = new ArrayList<>(); 15 15 LayerInfo info; 16 16 } -
applications/editors/josm/plugins/pdfimport/src/pdfimport/OsmBuilder.java
r25349 r30737 66 66 67 67 private void addLayer(DataSet target, LayerContents layer) { 68 Map<Point2D, Node> point2Node = new HashMap< Point2D, Node>();68 Map<Point2D, Node> point2Node = new HashMap<>(); 69 69 70 70 this.fillName = this.printColor(layer.info.fill); … … 82 82 83 83 //insert ways 84 Map<PdfPath, Way> path2Way = new HashMap< PdfPath, Way>();84 Map<PdfPath, Way> path2Way = new HashMap<>(); 85 85 86 86 for (PdfPath path: layer.paths){ … … 105 105 Relation rel = new Relation(); 106 106 107 Map<String, String> keys = new HashMap< String, String>();107 Map<String, String> keys = new HashMap<>(); 108 108 keys.put("type", "multipolygon"); 109 109 keys.put("area", "yes"); … … 128 128 this.monitorPos ++; 129 129 130 List<Node> nodes = new ArrayList< Node>(path.points.size());130 List<Node> nodes = new ArrayList<>(path.points.size()); 131 131 132 132 for (Point2D point: path.points) { … … 139 139 } 140 140 141 Map<String, String> keys = new HashMap< String, String>();141 Map<String, String> keys = new HashMap<>(); 142 142 143 143 if (this.mode != Mode.Draft) { -
applications/editors/josm/plugins/pdfimport/src/pdfimport/ParallelSegmentsFinder.java
r25349 r30737 16 16 public double angleSum; 17 17 public int refCount; 18 public List<PdfPath> paths = new ArrayList< PdfPath>();18 public List<PdfPath> paths = new ArrayList<>(); 19 19 20 20 public void addPath(PdfPath path, double angle2) { … … 30 30 tr.rotate(-angle); 31 31 32 final Map<PdfPath, Point2D> positions = new HashMap< PdfPath, Point2D>();32 final Map<PdfPath, Point2D> positions = new HashMap<>(); 33 33 Point2D src = new Point2D.Double(); 34 34 … … 55 55 56 56 //process sweep 57 List<ParallelSegmentsFinder> result = new ArrayList< ParallelSegmentsFinder>();57 List<ParallelSegmentsFinder> result = new ArrayList<>(); 58 58 59 Map<PdfPath, ParallelSegmentsFinder> sweepLine = new HashMap< PdfPath, ParallelSegmentsFinder>();59 Map<PdfPath, ParallelSegmentsFinder> sweepLine = new HashMap<>(); 60 60 61 Set<ParallelSegmentsFinder> adjacentClustersSet = new HashSet< ParallelSegmentsFinder>();62 List<ParallelSegmentsFinder> adjacentClusters = new ArrayList< ParallelSegmentsFinder>();63 List<PdfPath> pathsToRemove = new ArrayList< PdfPath>();61 Set<ParallelSegmentsFinder> adjacentClustersSet = new HashSet<>(); 62 List<ParallelSegmentsFinder> adjacentClusters = new ArrayList<>(); 63 List<PdfPath> pathsToRemove = new ArrayList<>(); 64 64 65 65 for (PdfPath path: paths){ -
applications/editors/josm/plugins/pdfimport/src/pdfimport/PathOptimizer.java
r29913 r30737 27 27 public PathOptimizer(double _pointsTolerance, Color _color, boolean _splitOnColorChange) 28 28 { 29 uniquePointMap = new HashMap< Point2D, Point2D>();30 uniquePoints = new ArrayList< Point2D>();31 layerMap = new HashMap< LayerInfo, LayerContents>();32 layers = new ArrayList< LayerContents>();29 uniquePointMap = new HashMap<>(); 30 uniquePoints = new ArrayList<>(); 31 layerMap = new HashMap<>(); 32 layers = new ArrayList<>(); 33 33 pointsTolerance = _pointsTolerance; 34 34 color = _color; … … 67 67 68 68 //optimize the paths 69 Set<Point2D> points = new HashSet< Point2D>();69 Set<Point2D> points = new HashSet<>(); 70 70 for(PdfPath path: paths) { 71 71 points.addAll(path.points); … … 148 148 149 149 public void splitLayersBySimilarShapes(double tolerance) { 150 List<LayerContents> newLayers = new ArrayList< LayerContents>();150 List<LayerContents> newLayers = new ArrayList<>(); 151 151 for(LayerContents l: this.layers) { 152 152 List<LayerContents> splitResult = splitBySimilarGroups(l); … … 160 160 161 161 public void splitLayersByPathKind(boolean closed, boolean single, boolean orthogonal) { 162 List<LayerContents> newLayers = new ArrayList< LayerContents>();162 List<LayerContents> newLayers = new ArrayList<>(); 163 163 for(LayerContents l: this.layers) { 164 164 List<LayerContents> splitResult = splitBySegmentKind(l, closed, single, orthogonal); … … 211 211 212 212 private void finalizeLayer(LayerContents layer){ 213 Set<Point2D> points = new HashSet< Point2D>();214 layer.points = new ArrayList< Point2D>();213 Set<Point2D> points = new HashSet<>(); 214 layer.points = new ArrayList<>(); 215 215 216 216 for(PdfPath pp: layer.paths){ … … 242 242 private void fixPoints(LayerContents layer, Map<Point2D, Point2D> pointMap) { 243 243 244 List<PdfPath> newPaths = new ArrayList< PdfPath>(layer.paths.size());244 List<PdfPath> newPaths = new ArrayList<>(layer.paths.size()); 245 245 246 246 for(PdfPath path: layer.paths) { … … 265 265 private List<Point2D> fixPoints(List<Point2D> points, Map<Point2D, Point2D> pointMap) { 266 266 267 List<Point2D> newPoints = new ArrayList< Point2D>(points.size());267 List<Point2D> newPoints = new ArrayList<>(points.size()); 268 268 Point2D prevPoint = null; 269 269 … … 287 287 288 288 private void removeSmallObjects(LayerContents layer, double min, double max) { 289 List<PdfPath> newPaths = new ArrayList< PdfPath>(layer.paths.size());289 List<PdfPath> newPaths = new ArrayList<>(layer.paths.size()); 290 290 291 291 for(PdfPath path: layer.paths) { … … 300 300 layer.paths = newPaths; 301 301 302 List<PdfMultiPath> newMPaths = new ArrayList< PdfMultiPath>(layer.multiPaths.size());302 List<PdfMultiPath> newMPaths = new ArrayList<>(layer.multiPaths.size()); 303 303 304 304 for (PdfMultiPath mp: layer.multiPaths){ … … 341 341 342 342 //filter paths by direction 343 List<ParallelSegmentsFinder> angles = new ArrayList< ParallelSegmentsFinder>();343 List<ParallelSegmentsFinder> angles = new ArrayList<>(); 344 344 345 345 for(PdfPath path: layer.paths) { … … 371 371 } 372 372 373 Set<PdfPath> pathsToRemove = new HashSet< PdfPath>();373 Set<PdfPath> pathsToRemove = new HashSet<>(); 374 374 375 375 //process each direction … … 389 389 390 390 //generate new path list 391 List<PdfPath> result = new ArrayList< PdfPath>(layer.paths.size() - pathsToRemove.size());391 List<PdfPath> result = new ArrayList<>(layer.paths.size() - pathsToRemove.size()); 392 392 393 393 for(PdfPath path: layer.paths) { … … 406 406 */ 407 407 private void concatenatePaths(LayerContents layer) { 408 Map<Point2D, List<PdfPath>> pathEndpoints = new HashMap< Point2D, List<PdfPath>>();409 Set<PdfPath> mergedPaths = new HashSet< PdfPath>();410 List<PdfPath> newPaths = new ArrayList< PdfPath>();408 Map<Point2D, List<PdfPath>> pathEndpoints = new HashMap<>(); 409 Set<PdfPath> mergedPaths = new HashSet<>(); 410 List<PdfPath> newPaths = new ArrayList<>(); 411 411 412 412 //fill pathEndpoints map … … 419 419 List<PdfPath> paths = pathEndpoints.get(pp.firstPoint()); 420 420 if (paths == null){ 421 paths = new ArrayList< PdfPath>(2);421 paths = new ArrayList<>(2); 422 422 pathEndpoints.put(pp.firstPoint(), paths); 423 423 } … … 426 426 paths = pathEndpoints.get(pp.lastPoint()); 427 427 if (paths == null){ 428 paths = new ArrayList< PdfPath>(2);428 paths = new ArrayList<>(2); 429 429 pathEndpoints.put(pp.lastPoint(), paths); 430 430 } … … 432 432 } 433 433 434 List<PdfPath> pathChain = new ArrayList< PdfPath>(2);435 Set<Point2D> pointsInPath = new HashSet< Point2D>();434 List<PdfPath> pathChain = new ArrayList<>(2); 435 Set<Point2D> pointsInPath = new HashSet<>(); 436 436 437 437 //join the paths … … 567 567 private boolean isSubpathOf(PdfPath main, PdfPath sub) { 568 568 569 Set<Point2D> points = new HashSet< Point2D>(main.points);569 Set<Point2D> points = new HashSet<>(main.points); 570 570 571 571 for(Point2D point: sub.points) { … … 586 586 OrthogonalShapesFilter of = new OrthogonalShapesFilter(10); 587 587 588 List<PdfPath> singleSegmentPaths = new ArrayList< PdfPath>();589 List<PdfPath> multiSegmentPaths = new ArrayList< PdfPath>();590 List<PdfPath> closedPaths = new ArrayList< PdfPath>();591 List<PdfPath> orthogonalPaths = new ArrayList< PdfPath>();592 List<PdfPath> orthogonalClosedPaths = new ArrayList< PdfPath>();588 List<PdfPath> singleSegmentPaths = new ArrayList<>(); 589 List<PdfPath> multiSegmentPaths = new ArrayList<>(); 590 List<PdfPath> closedPaths = new ArrayList<>(); 591 List<PdfPath> orthogonalPaths = new ArrayList<>(); 592 List<PdfPath> orthogonalClosedPaths = new ArrayList<>(); 593 593 594 594 for(PdfPath path: layer.paths) { … … 621 621 } 622 622 623 List<LayerContents> layers = new ArrayList< LayerContents>();623 List<LayerContents> layers = new ArrayList<>(); 624 624 625 625 if (multiSegmentPaths.size() > 0) { … … 665 665 666 666 private List<LayerContents> splitBySimilarGroups(LayerContents layer) { 667 List<List<PdfPath>> subparts = new ArrayList< List<PdfPath>>();667 List<List<PdfPath>> subparts = new ArrayList<>(); 668 668 669 669 //split into similar parts … … 680 680 681 681 if (sublayer == null) { 682 sublayer = new ArrayList< PdfPath>();682 sublayer = new ArrayList<>(); 683 683 subparts.add(sublayer); 684 684 } … … 690 690 int minGroupTreshold = 10; 691 691 692 List<PdfPath> independantPaths = new ArrayList< PdfPath>();693 List<LayerContents> result = new ArrayList< LayerContents>();692 List<PdfPath> independantPaths = new ArrayList<>(); 693 List<LayerContents> result = new ArrayList<>(); 694 694 695 695 for(List<PdfPath> list: subparts){ -
applications/editors/josm/plugins/pdfimport/src/pdfimport/ProjectionInfo.java
r28448 r30737 11 11 12 12 public class ProjectionInfo { 13 private static Map<String, ProjectionChoice> allCodesPC = new HashMap< String, ProjectionChoice>();14 private static Map<String, Projection> allCodes = new HashMap< String, Projection>();13 private static Map<String, ProjectionChoice> allCodesPC = new HashMap<>(); 14 private static Map<String, Projection> allCodes = new HashMap<>(); 15 15 16 16 static { -
applications/editors/josm/plugins/pdfimport/src/pdfimport/pdfbox/GraphicsProcessor.java
r30701 r30737 76 76 77 77 private List<PdfPath> parsePath(Shape s, boolean closed) { 78 List<PdfPath> result = new ArrayList< PdfPath>(2);79 List<Point2D> points = new ArrayList< Point2D>(2);78 List<PdfPath> result = new ArrayList<>(2); 79 List<Point2D> points = new ArrayList<>(2); 80 80 81 81 PathIterator iter = s.getPathIterator(null); … … 91 91 result.add(new PdfPath(points)); 92 92 } 93 points = new ArrayList< Point2D>(2);93 points = new ArrayList<>(2); 94 94 } else if (type == PathIterator.SEG_CUBICTO) { 95 95 //cubic curve … … 104 104 result.add(new PdfPath(points)); 105 105 } 106 points = new ArrayList< Point2D>(2);106 points = new ArrayList<>(2); 107 107 this.addPoint(points, this.parsePoint(coords, 0)); 108 108 }
Note:
See TracChangeset
for help on using the changeset viewer.