Remove Code from cadi, it is now in authz
[aaf/cadi.git] / client / src / main / java / org / onap / aaf / cadi / routing / GreatCircle.java
diff --git a/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java b/client/src/main/java/org/onap/aaf/cadi/routing/GreatCircle.java
deleted file mode 100644 (file)
index 9e47b3f..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- *  *      http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- *  * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.cadi.routing;\r
-\r
-import org.onap.aaf.inno.env.util.Split;\r
-\r
-public class GreatCircle {\r
-       // Note: multiplying by this constant is faster than calling Math equivalent function \r
-       private static final double DEGREES_2_RADIANS = Math.PI/180.0;\r
-       \r
-       public static final double DEGREES_2_NM = 60;\r
-       public static final double DEGREES_2_KM = DEGREES_2_NM * 1.852; // 1.852 is exact ratio per 1929 Standard Treaty, adopted US 1954\r
-       public static final double DEGREES_2_MI = DEGREES_2_NM * 1.1507795; \r
-       \r
-       /**\r
-        * \r
-        * Calculate the length of an arc on a perfect sphere based on Latitude and Longitudes of two points\r
-        *    Parameters are in Degrees (i.e. the coordinate system you get from GPS, Mapping WebSites, Phones, etc)\r
-        *    \r
-        *              L1 = Latitude of point A\r
-        *      G1 = Longitude of point A\r
-        *          L2 = Latitude of point B\r
-        *      G2 = Longitude of point B\r
-        *      \r
-        *      d  = acos (sin(L1)*sin(L2) + cos(L1)*cos(L2)*cos(G1 - G2))\r
-        * \r
-        * Returns answer in Degrees\r
-        * \r
-        * Since there are 60 degrees per nautical miles, you can convert to NM by multiplying by 60\r
-        * \r
-        * Essential formula from a Princeton website, the "Law of Cosines" method.  \r
-        * \r
-        * Refactored cleaned up for speed  3/8/2013\r
-        * \r
-        * @param latA\r
-        * @param lonA\r
-        * @param latB\r
-        * @param lonB\r
-        * @return\r
-        */\r
-       public static double calc(double latA, double lonA, double latB, double lonB) {\r
-               // Formula requires Radians.  Expect Params to be Coordinates (Degrees)\r
-               // Simple ratio, quicker than calling Math.toRadians()\r
-               latA *= DEGREES_2_RADIANS;\r
-               lonA *= DEGREES_2_RADIANS;\r
-               latB *= DEGREES_2_RADIANS;\r
-               lonB *= DEGREES_2_RADIANS;\r
-\r
-               return Math.acos(\r
-                               Math.sin(latA) * Math.sin(latB) + \r
-                               Math.cos(latA) * Math.cos(latB) * Math.cos(lonA-lonB)\r
-                       )\r
-                       / DEGREES_2_RADIANS;\r
-       }\r
-       \r
-       /** \r
-        * Convert from "Lat,Long Lat,Long" String format\r
-        *              "Lat,Long,Lat,Long" Format\r
-        *           or all four entries "Lat Long Lat Long"\r
-        * \r
-        * (Convenience function)\r
-        * \r
-        * Since Distance is positive, a "-1" indicates an error in String formatting\r
-        */\r
-       public static double calc(String ... coords) {\r
-               try {\r
-                       String [] array;\r
-                       switch(coords.length) {\r
-                       case 1:\r
-                               array = Split.split(',',coords[0]);\r
-                               if(array.length!=4)return -1;\r
-                               return calc(\r
-                                       Double.parseDouble(array[0]),\r
-                                       Double.parseDouble(array[1]),\r
-                                       Double.parseDouble(array[2]),\r
-                                       Double.parseDouble(array[3])\r
-                                       );\r
-                       case 2:\r
-                               array = Split.split(',',coords[0]);\r
-                               String [] array2 = Split.split(',',coords[1]);\r
-                               if(array.length!=2 || array2.length!=2)return -1;\r
-                               return calc(\r
-                                       Double.parseDouble(array[0]),\r
-                                       Double.parseDouble(array[1]),\r
-                                       Double.parseDouble(array2[0]),\r
-                                       Double.parseDouble(array2[1])\r
-                                       );\r
-                       case 4:\r
-                               return calc(\r
-                                       Double.parseDouble(coords[0]),\r
-                                       Double.parseDouble(coords[1]),\r
-                                       Double.parseDouble(coords[2]),\r
-                                       Double.parseDouble(coords[3])\r
-                                       );\r
-                               \r
-                       default:\r
-                               return -1;\r
-                       }\r
-               } catch (NumberFormatException e) {\r
-                       return -1;\r
-               }\r
-       }\r
-\r
-}\r
-\r
-///**\r
-//* Haverside method, from Princeton\r
-//* \r
-//* @param alat\r
-//* @param alon\r
-//* @param blat\r
-//* @param blon\r
-//* @return\r
-//*/\r
-//public static double calc3(double alat, double alon, double blat, double blon) {\r
-//     alat *= DEGREES_2_RADIANS;\r
-//     alon *= DEGREES_2_RADIANS;\r
-//     blat *= DEGREES_2_RADIANS;\r
-//     blon *= DEGREES_2_RADIANS;\r
-//     return 2 * Math.asin(\r
-//                     Math.min(1, Math.sqrt(\r
-//                             Math.pow(Math.sin((blat-alat)/2), 2) +\r
-//                             (Math.cos(alat)*Math.cos(blat)*\r
-//                                     Math.pow(\r
-//                                             Math.sin((blon-alon)/2),2)\r
-//                                     )\r
-//                             )\r
-//                     )\r
-//             )\r
-//     / DEGREES_2_RADIANS;\r
-//}\r
-//\r
-\r
-\r
-\r
-//This is a MEAN radius.  The Earth is not perfectly spherical\r
-//     public static final double EARTH_RADIUS_KM = 6371.0;\r
-//     public static final double EARTH_RADIUS_NM = 3440.07;\r
-//     public static final double KM_2_MILES_RATIO = 0.621371192;\r
-///**\r
-//* Code on Internet based on Unknown book.  Lat/Long is in Degrees\r
-//* @param alat\r
-//* @param alon\r
-//* @param blat\r
-//* @param blon\r
-//* @return\r
-//*/\r
-//public static double calc1(double alat, double alon, double blat, double blon) {\r
-//     alat *= DEGREES_2_RADIANS;\r
-//     alon *= DEGREES_2_RADIANS;\r
-//     blat *= DEGREES_2_RADIANS;\r
-//     blon *= DEGREES_2_RADIANS;\r
-//     \r
-//     // Reused values\r
-//     double cosAlat,cosBlat;\r
-//     \r
-//     return Math.acos(\r
-//             ((cosAlat=Math.cos(alat))*Math.cos(alon)*(cosBlat=Math.cos(blat))*Math.cos(blon)) +\r
-//             (cosAlat*Math.sin(alon)*cosBlat*Math.sin(blon)) +\r
-//             (Math.sin(alat)*Math.sin(blat))\r
-//             )/DEGREES_2_RADIANS;\r
-//     \r
-//}\r
-\r
-/*\r
-*  This method was 50% faster than calculation 1, and 75% than the Haverside method\r
-*  Also, since it's based off of Agree standard Degrees of the Earth, etc, the calculations are more exact,\r
-*    at least for Nautical Miles and Kilometers\r
-*/\r