From acb078b5e5c04bcaf5031f6420eccefcc27f3af8 Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Tue, 8 Mar 2016 05:46:42 -0700
Subject: [PATCH] fix for approgGridSurf hanging wall rJB calc

---
 .../fault/surface/ApproxGriddedSurface.java   | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/org/opensha2/eq/fault/surface/ApproxGriddedSurface.java b/src/org/opensha2/eq/fault/surface/ApproxGriddedSurface.java
index 15420a0a4..ba54e497a 100644
--- a/src/org/opensha2/eq/fault/surface/ApproxGriddedSurface.java
+++ b/src/org/opensha2/eq/fault/surface/ApproxGriddedSurface.java
@@ -1,5 +1,7 @@
 package org.opensha2.eq.fault.surface;
 
+import java.util.List;
+
 import org.opensha2.eq.fault.Faults;
 import org.opensha2.geo.GeoTools;
 import org.opensha2.geo.Location;
@@ -7,6 +9,9 @@ import org.opensha2.geo.LocationList;
 import org.opensha2.geo.LocationVector;
 import org.opensha2.geo.Locations;
 
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
 /**
  * A {@code GriddedSurface} defined by an upper and lower trace whose spacing is
  * scaled to the be as close to a desired target spacing as possible over the
@@ -402,6 +407,21 @@ public class ApproxGriddedSurface extends AbstractGriddedSurface {
 		return centroid;
 	}
 
+	public LocationList getRow(int row) {
+		List<Location> locs = Lists.newArrayList();
+		for (int col = 0; col < getNumCols(); col++)
+			locs.add(get(row, col));
+		return LocationList.create(locs);
+	}
+
+	@Override
+	public LocationList getPerimeter() {
+		LocationList topTr = getRow(0);
+		LocationList botTr = LocationList.create(getRow(getNumRows() - 1)).reverse();
+		Iterable<Location> locs = Iterables.concat(topTr, botTr,
+			Lists.newArrayList(topTr.get(0)));
+		return LocationList.create(locs);
+	}
 
 //	@Override
 //	public double getAveDip() {
-- 
GitLab