/*
* Copyright (C) 2011-2014 GeoForge Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.worldwind._tempo.defaul;
import org.geoforge.lang.util.geography.point.GfrPointAbs;
import org.geoforge.lang.util.geography.point.GfrPointDms;
import org.geoforge.lang.util.geography.point.GfrPointConical;
import org.geoforge.lang.util.geography.point.GfrPointUtm;
import org.geoforge.lang.util.geography.projection.GfrPrjAbs;
import org.geoforge.lang.util.geography.projection.conical.PrjConAbs;
import org.geoforge.lang.util.geography.projection.conical.PrjConLambert1972;
import org.geoforge.lang.util.geography.projection.conical.PrjConLambert2008;
import org.geoforge.lang.util.geography.projection.conical.PrjConLambert93;
import org.geoforge.lang.util.geography.projection.conical.PrjConLambertMexico;
import org.geoforge.lang.util.geography.projection.cylindrical.PrjCylAbs;
import org.geoforge.lang.util.geography.GfrUtilConversionConical;
import org.geoforge.lang.util.geography.GfrUtilConversionCylindrical;
import org.geoforge.java.lang.system.StopWatch;
import org.geoforge.lang.util.geography.GfrUtilConversionCylindricalUtm;
import org.geoforge.lang.util.geography.projection.conical.PrjConLambertIII;
import org.geoforge.lang.util.geography.projection.conical.PrjConLambertII_Carto;
/**
*
* @author Amadeus.Sowerby
*
* email: Amadeus.Sowerby_AT_gmail.com
* ... please remove "_AT_" from the above string to get the right email address
*/
public class Test
{
public static void main(String[] args) throws Exception
{
TestConversion[] tests =
{
new TestConversion(
"PrjConLambert93",
new GfrPointDms(10, 40),
new GfrPointConical(1300132.2440885678, 5903651.94441981),
PrjConLambert93.s_getInstance()),
new TestConversion(
"3812_PrjConLambert2008",
new GfrPointDms(10, 40),
new GfrPointConical(1138158.9936737407, -522382.3696528121),
PrjConLambert2008.s_getInstance()),
new TestConversion(
"SR39_PrjConLambertMexican",
new GfrPointDms(-80.83594322203, 7.916019558907),
new GfrPointConical(4897414.312483, -284576.20796),
PrjConLambertMexico.s_getInstance()),
new TestConversion(
"SR39_PrjConLambert1972",
new GfrPointDms(10, 40),
new GfrPointConical(639153.261772, -1022369.266852),
PrjConLambert1972.s_getInstance()),
new TestConversion(
"Lambert Carto II ext",
new GfrPointDms(1.289542, 46.444770),
new GfrPointConical(519558.64,2161058.15),
PrjConLambertII_Carto.s_getInstance()),
new TestConversion(
"Lambert III",
new GfrPointDms(1.4681805556, 42.5864644444),
new GfrPointConical(528701.67,32224.69),
PrjConLambertIII.s_getInstance()),
new TestConversion(
"Lambert III",
new GfrPointDms(1.5214830555555,42.4552458333333),
new GfrPointConical(532933.35, 17600.64),
PrjConLambertIII.s_getInstance()),
};
StopWatch.start();
/*/
for(int i = 0; i < tests.length; i++)
{
GfrPointAbs input = tests[i].getPointInput();
GfrPrjAbs prj = tests[i].getProjection();
if(input instanceof GfrPointDms && prj instanceof PrjConAbs)//Dms -> conical, Big precision
{
GfrPointConical found = UtilConicalConvert.s_getConicalCoordinateFromDmsWithBigPrecision((GfrPointDms)input, (PrjConAbs)prj);
tests[i].setPointFound(found);
GfrPointDms crossVal = UtilConicalConvert.s_getDmsCoordinateFromConicalBigPrecision(found, (PrjConAbs)prj);
tests[i].setCrossVal(crossVal);
}
/*/
/*
tests[i].show();
}
//*/
for (int i = 0; i < tests.length; i++)
{
GfrPointAbs input = tests[i].getPointInput();
GfrPrjAbs prj = tests[i].getProjection();
if (input instanceof GfrPointDms && prj instanceof PrjConAbs)//Dms -> conical, Big precision
{
GfrPointConical found = GfrUtilConversionConical.s_getConicalCoordinateFromDms((GfrPointDms) input, (PrjConAbs) prj);
tests[i].setPointFound(found);
GfrPointDms crossVal = GfrUtilConversionConical.s_getDmsCoordinateFromConical(found, (PrjConAbs) prj);
tests[i].setCrossVal(crossVal);
}
if (input instanceof GfrPointDms && prj instanceof PrjCylAbs)//Dms -> cylindrical, Big precision
{
GfrPointUtm found = GfrUtilConversionCylindricalUtm.s_getUtmCoordinateFromDms(
(GfrPointDms) input,
(PrjCylAbs) prj);
tests[i].setPointFound(found);
System.out.println(found.getZoneNumber() + found.getZoneLetter());
GfrPointDms crossVal = GfrUtilConversionCylindricalUtm.s_getDmsCoordinateFromUtm(found, (PrjCylAbs) prj);
tests[i].setCrossVal(crossVal);
}
tests[i].show();
}
//*/
System.out.println(StopWatch.getTime("end chrono"));
}
}