Commit 7c040dd6 authored by Elon Bontemps's avatar Elon Bontemps
Browse files

autosave

parents cd0cc8c1 37773ebd
......@@ -7,14 +7,17 @@
using namespace std;
//function returns map of pairs
map<string, pair<double, double>> mapMaker() {
pair<double, double> longAndLat () {
ifstream fin;
fin.open("countries.txt");
//cout << "What city/country are you from/closest to: "
ifstream filestream("countries.txt");
print("Print this", filestream);
//variables
map<string, pair<double, double>> tempMap;
pair<double,double> tempPair;
vector <pair<double, double>> coordinateVector;
map<string, pair<double, double>> tempMap();
string placeName;
int cityNum;
if(!fin.is_open()) {
cerr << "Error couldn't open file." << endl;
......@@ -22,13 +25,37 @@ map<string, pair<double, double>> mapMaker() {
}
while(!fin.eof()) {
pair<double,double> tempPair;
getline(fin, placeName, '.');
getline(fin, tempPair.first, '.');
getline(fin, tempPair.second, '\n');
coordinateVector.push_back(tempPair); //ads latitudes and longitutes to coordinate vector
tempMap.emplace(placeName, tempPair);
placeName.clear();
}
//<<<<<<< HEAD
return tempMap;
}
//output the country.txt file onto the system
//give eric the specific line the user chooses in the text file and give just coordimnates
//=======
// TODO Print the cities
do {
cout << "Which city do you live in/live near?: ";
if (!(cin >> cityNum)) { // validates that numbers were entered and checks input
cerr << "Error! Please enter a valid integar." << endl;
cin.clear();
cin.ignore(1000, '\n');
continue;
}
if (cityNum > 0 && cityNum < 40) {
break;
} else {
cerr << "Error! Invalid year. Please enter a year between 1 and 9099" << endl;
}
} while (true);
return coordinateVector.at(cityNum - 1);
}
//>>>>>>> 37773ebd81c48909890df464721d8b1870634f96
......@@ -237,208 +237,207 @@ vector <pair<double, double>> viewFinder (pair <double, double> centerPt) { // f
pair<double, double> pair3;
pair<double, double> pair4;
if (centerPt.second > 0) {
if (centerPt.first > 20.125 && centerPt.second < 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875), centerPt.second - 39);
corners.push_back(pair4);
}
if (centerPt.second > 0) {
if (centerPt.first > 20.125 && centerPt.second < 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875), centerPt.second - 39);
corners.push_back(pair4);
}
} else if (centerPt.first < 3.875 && centerPt.second < 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875), centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if (centerPt.first < 3.875 && centerPt.second < 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875), centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), centerPt.second - 39);
corners.push_back(pair4);
}
} else if (centerPt.first > 20.125 && centerPt.second > 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, -90 + (centerPt.second - 51));
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if (centerPt.first > 20.125 && centerPt.second > 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, -90 + (centerPt.second - 51));
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, centerPt.second - 39);
corners.push_back(pair4);
}
} else if (centerPt.first < 3.875 && centerPt.second > 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), -90 + (centerPt.second - 51));
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if (centerPt.first < 3.875 && centerPt.second > 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), -90 + (centerPt.second - 51));
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), centerPt.second - 39);
corners.push_back(pair4);
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second > 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second > 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, -90 + (centerPt.second - 51));
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, centerPt.second - 39);
corners.push_back(pair4);
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second < 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 51);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second < 51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 51);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if (centerPt.second < 0) {
if (centerPt.first > 20.125 && centerPt.second > -51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875), centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if (centerPt.second < 0) {
if (centerPt.first > 20.125 && centerPt.second > -51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875), centerPt.second - 39);
corners.push_back(pair4);
}
} else if (centerPt.first < 3.875 && centerPt.second > -51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875), centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if (centerPt.first < 3.875 && centerPt.second > -51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875), centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), centerPt.second - 39);
corners.push_back(pair4);
}
} else if (centerPt.first > 20.125 && centerPt.second < -51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, 90 + (centerPt.second + 51));
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair4);
}
}
} else if (centerPt.first > 20.125 && centerPt.second < -51) { // done
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair((centerPt.first + 3.875) - 24, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair((centerPt.first + 3.875) - 24, 90 + (centerPt.second + 51));
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair4);
}
} else if (centerPt.first < 3.875 && centerPt.second < -51) {
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), 90 + (centerPt.second + 51));
corners.push_back(pair4);
}
}
} else if (centerPt.first < 3.875 && centerPt.second < -51) {
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(24 - (3.875 - centerPt.first), centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(24 - (3.875 - centerPt.first), 90 + (centerPt.second + 51));
corners.push_back(pair4);
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second < -51) {
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair4);
}
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second < -51) {
for(int i = 0; i < 4; i++) {
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, 90 + (centerPt.second + 51));
corners.push_back(pair4);
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second > -51) {
for(int i = 0; i < 4; i++) {
pair<double, double> pair;
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point
pair3 = make_pair(centerPt.first + 3.875, centerPt.second - 39);
corners.push_back(pair3);
} else if (i == 3) { // bottom right point
pair4 = make_pair(centerPt.first - 3.875, centerPt.second - 39);
corners.push_back(pair4);
}
}
} else if ((centerPt.first < 20.125 && centerPt.first > 3.875) && centerPt.second > -51) {
for(int i = 0; i < 4; i++) {
pair<double, double> pair;
if (i == 0) { // top left point
pair1 = make_pair(centerPt.first + 3.875, centerPt.second + 39);
corners.push_back(pair1);
} else if (i == 1) { // top right point
pair2 = make_pair(centerPt.first - 3.875, centerPt.second + 39);
corners.push_back(pair2);
} else if (i == 2) { // bottom left point