src/main/java/de/blau/android/util/Geometry.java
/**
     * Calculate the centroid of a way
     * 
     * @param w screen width
     * @param h screen height
     * @param v current display bounding box
     * @param way way to caculate the centroid of
     * @return screen coordinates of centroid, null if the way has problems and if the way has length or area zero
     *         return the coordinates of the first node
     */
Calculate the centroid of a way


Calculate the centroid of a way
@Nullable
    public static Coordinates centroidXY(int w, int h, @NonNull ViewBox v, @Nullable final Way way) {
        if (way == null || way.nodeCount() == 0) {
            return null;
        }
        Coordinates[] coords = Coordinates.nodeListToCoordinateArray(w, h, v, way.getNodes());
        return centroidXY(coords, false);
    }
@ Nullable public static Coordinates centroidXY ( int w , int h , @ NonNull ViewBox v , @ Nullable final Way way ) { if ( way == null || way . nodeCount ( ) == 0 ) { return null ; } Coordinates [ ] coords = Coordinates . nodeListToCoordinateArray ( w , h , v , way . getNodes ( ) ) ; return centroidXY ( coords , false ) ; }
Calculate the centroid of a way
Calculate the centroid of a way