Github user smarthi commented on a diff in the pull request:
https://github.com/apache/incubator-streams/pull/313#discussion_r84584515
--- Diff:
streams-contrib/streams-provider-twitter/src/main/java/org/apache/streams/twitter/converter/util/TwitterActivityUtil.java
---
@@ -350,4 +351,26 @@ public static void addTwitterExtensions(Activity
activity, Tweet tweet) {
extensions.put("keywords", tweet.getText());
}
+
+ /**
+ * Compute central coordinates from bounding box
+ * @param place the bounding box to use as the source
+ */
+ public static List<Double> boundingBoxCenter(Place place) {
+ if( place == null ) return new ArrayList<>();
+ if( place.getBoundingBox() == null ) return new ArrayList<>();
+ if( place.getBoundingBox().getCoordinates().size() != 1 ) return
new ArrayList<>();
+ if( place.getBoundingBox().getCoordinates().get(0).size() != 4 )
return new ArrayList<>();
+ List<Double> lats = Lists.newArrayList();
+ List<Double> lons = Lists.newArrayList();
+ for( List<Double> point :
place.getBoundingBox().getCoordinates().get(0)) {
+ lats.add(point.get(0));
+ lons.add(point.get(1));
+ }
+ List<Double> result = new ArrayList<Double>();
--- End diff --
the RHS can just be 'new ArrayList<>();' -> Java 7
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---