org.opensha.commons.geo
Class RegionUtils

java.lang.Object
  extended by org.opensha.commons.geo.RegionUtils

public class RegionUtils
extends Object

Add comments here

Version:
$Id: RegionUtils.java 8975 2012-05-18 16:22:48Z pmpowers $
Author:
Peter Powers

Nested Class Summary
static class RegionUtils.Style
           
 
Constructor Summary
RegionUtils()
           
 
Method Summary
static double getFractionInside(Region region, Iterable<Location> locs)
          The returns the fraction of points in the given collection of locations that is inside the given region.
static Area getNodeShape(Location p, double w, double h)
          Returns the Region spanned by a node centered at the supplied location with the given width and height.
static void locListToKML(LocationList locs, String filename, Color c)
           
static void main(String[] args)
           
static void regionToKML(Region region, String filename, Color c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegionUtils

public RegionUtils()
Method Detail

regionToKML

public static void regionToKML(Region region,
                               String filename,
                               Color c)

locListToKML

public static void locListToKML(LocationList locs,
                                String filename,
                                Color c)

getFractionInside

public static double getFractionInside(Region region,
                                       Iterable<Location> locs)
                                throws NullPointerException,
                                       IllegalArgumentException
The returns the fraction of points in the given collection of locations that is inside the given region. This will commonly be used with the AbstractEvenlyGriddedSurface class to determine the fraction of a fault surface that is inside of a region.

Parameters:
region - the region for which to test
locs - any instance of Iterable, for example, ArrayList or EvenlyGriddedSurface.
Returns:
fraction of locations inside the given region
Throws:
NullPointerException - if region or locs is null
IllegalArgumentException - if locs is empty

getNodeShape

public static Area getNodeShape(Location p,
                                double w,
                                double h)
Returns the Region spanned by a node centered at the supplied location with the given width and height.

Parameters:
p - Location at center of a grid node
w - node width
h - node height
Returns:
the node's Region

main

public static void main(String[] args)