Ignore:
Timestamp:
2016-03-07T23:29:30+01:00 (9 years ago)
Author:
simon04
Message:

see #11516 - Compute multipolygon area, include in MapCSS, JOSM search

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r9929 r9952  
    531531
    532532        /**
    533          * Returns the area of a closed way in square meters or {@code null}.
    534          * @param env the environment
    535          * @return the area of a closed way in square meters or {@code null}
    536          * @see Geometry#closedWayArea(Way)
     533         * Returns the area of a closed way or multipolygon in square meters or {@code null}.
     534         * @param env the environment
     535         * @return the area of a closed way or multipolygon in square meters or {@code null}
     536         * @see Geometry#computeArea(OsmPrimitive)
    537537         */
    538538        public static Float areasize(final Environment env) {
    539             if (env.osm instanceof Way && ((Way) env.osm).isClosed()) {
    540                 return (float) Geometry.closedWayArea((Way) env.osm);
    541             } else {
    542                 return null;
    543             }
     539            final Double area = Geometry.computeArea(env.osm);
     540            return area == null ? null : area.floatValue();
    544541        }
    545542
Note: See TracChangeset for help on using the changeset viewer.