sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlaid...@apache.org
Subject svn commit: r1358453 - /incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
Date Fri, 06 Jul 2012 22:27:04 GMT
Author: rlaidlaw
Date: Fri Jul  6 22:27:04 2012
New Revision: 1358453

URL: http://svn.apache.org/viewvc?rev=1358453&view=rev
Log:
SIS-49: updated for loop in method getCircularRegionApproximation of LatLonPointRadius class
to prevent ArrayIndexOutOfBoundsException

Modified:
    incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java

Modified: incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java?rev=1358453&r1=1358452&r2=1358453&view=diff
==============================================================================
--- incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
(original)
+++ incubator/sis/trunk/sis-core/src/main/java/org/apache/sis/core/LatLonPointRadius.java
Fri Jul  6 22:27:04 2012
@@ -69,9 +69,11 @@ public class LatLonPointRadius {
     }
     // plus one to add closing point
     LatLon[] points = new LatLon[numberOfPoints + 1];
-    for (int i = 0; i < 360; i += (360 / numberOfPoints)) {
+    int bearingIncrement = 360/numberOfPoints;
+    for (int i = 0; i < numberOfPoints; i++) 
+    {
       points[i] = DistanceUtils.getPointOnGreatCircle(this.center.getLat(),
-          this.center.getLon(), radius, i);
+          this.center.getLon(), radius, i * bearingIncrement);
     }
 
     points[numberOfPoints] = points[0];



Mime
View raw message