Ignore:
Timestamp:
2014-02-12T00:55:05+01:00 (10 years ago)
Author:
Don-vip
Message:

see #9680 - Boost multipolygon computation performance by caching Areas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r6830 r6841  
    441441    }
    442442
    443     private static Area getArea(List<Node> polygon) {
     443    /**
     444     * Returns the Area of a polygon, from its list of nodes.
     445     * @param polygon List of nodes forming polygon
     446     * @return Area for the given list of nodes
     447     * @since 6841
     448     */
     449    public static Area getArea(List<Node> polygon) {
    444450        Path2D path = new Path2D.Double();
    445451
     
    462468    /**
    463469     * Tests if two polygons intersect.
    464      * @param first
    465      * @param second
     470     * @param first List of nodes forming first polygon
     471     * @param second List of nodes forming second polygon
    466472     * @return intersection kind
    467473     */
    468474    public static PolygonIntersection polygonIntersection(List<Node> first, List<Node> second) {
    469 
    470475        Area a1 = getArea(first);
    471476        Area a2 = getArea(second);
     477        return polygonIntersection(a1, a2);
     478    }
     479
     480    /**
     481     * Tests if two polygons intersect.
     482     * @param a1 Area of first polygon
     483     * @param a2 Area of second polygon
     484     * @return intersection kind
     485     * @since 6841
     486     */
     487    public static PolygonIntersection polygonIntersection(Area a1, Area a2) {
    472488
    473489        Area inter = new Area(a1);
Note: See TracChangeset for help on using the changeset viewer.