#include "GPS_Sedlak.h"

void main () {
	GPSSTRUCT gpsData, gpsm;
	char Conf[40] = "";
	char Ref[40] = "";
	ofstream myfile;
	cout.precision(5);
	cout.setf(ios::fixed);
	myfile.precision(5);
	myfile.setf(ios::fixed);
	double a=0;
	double b=0;
	double lat1, lat2, longi1, longi2, N1, N2, E1, E2;
	int i = 0, j = 0;

	string Cbod1 = "49°34'15.237N, 15°56'55.854E";//49°34'15.237N, 15°56'55.854E-zdar dum
	string Cbod2 = "49°13'9.799N, 16°35'42.154E"; //49°13'9.799N, 16°35'42.154E-brno
	
	NacteniSoubor();
	PrevedStrToUTMaLL(Cbod1, N1, E1, lat1, longi1);
	PrevedStrToUTMaLL(Cbod2, N2, E2, lat2, longi2);
	cout<<endl;
	cout<<"Vypocet vzdalenosti bod A -> bod B"<<endl;
	cout<<"Bod A = "<<Cbod1<<endl;
	cout<<"Po prevedeni do LL: "<<endl;
	cout<<"Sirka: "<<lat1<<endl;
	cout<<"Delka: "<<longi1<<endl<<endl;
	cout<<"Po prevedeni do UTM: "<<endl;
	cout<<"Nording: "<<N1<<endl;
	cout<<"Easting: "<<E1<<endl<<endl;
	cout<<"Bod B = "<<Cbod2<<endl;
	cout<<"Po prevedeni do LL: "<<endl;
	cout<<"Sirka: "<<lat2<<endl;
	cout<<"Delka: "<<longi2<<endl<<endl;
	cout<<"Po prevedeni do UTM: "<<endl;
	cout<<"Nording: "<<N2<<endl;
	cout<<"Easting: "<<E2<<endl<<endl;
	cout<<"Vzdalenost vzdusnou carou bod A -> bod B "<<Vzdalenost(Cbod1, Cbod2)<<" metru"<<endl<<endl;

	if(!Magellan_Init_Remote(MAGELLANREMOTEGPS)) {
		while(1) {
			if(!Magellan(gpsData)) {
				cout<<"Cas: "<<gpsData.d_cas<<" Sirka: "<<gpsData.d_sirka<<gpsData.s_sirkasektor<<" Delka: "<<gpsData.d_delka<<gpsData.s_delkasektor<<" Vyska: "<<gpsData.d_vyska<<endl;
				cout<<"Korekce: "<<gpsData.i_korekce<<" PocetSat: "<<gpsData.i_pocetsat<<endl;
			}
		}
	}
}