Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

gis.hpp #ifndef GIS_HPP #define GIS_HPP #include class Gis{ private: string fileName; Point *points; public: Gis(); ~Gis(); bool readFile(ifstream fileName); string findParcelName(Point pointForGis); }; #endif gis.cpp

gis.hpp

#ifndef GIS_HPP

#define GIS_HPP

#include

class Gis{

private:

string fileName;

Point *points;

public:

Gis();

~Gis();

bool readFile(ifstream fileName);

string findParcelName(Point pointForGis);

};

#endif

gis.cpp

#include

#include

#include

#include

#include "gis.hpp"

using namespace std;

Gis::Gis(){

fileName = "";

readFile = "";

}

Gis::~Gis()

{

}

bool Gis::readFile(ifstream fileName){

if (!fileName.true){

cout << "File not found!" << endl;

return false;

}

else

{

cout << "File found congrats!" << endl;

return true;

}

}

string Gis::findParcelName(Point pointForGis){

int i, j, c = 0;

for (i = 0, j = vertexCount-1; i < vertexCount; j = i++)

{

if ( ((points[i].getY()>=point.getY()) != (points[j].getY()>=point.getY())) &&

(point.getX() >= (points[j].getX()-points[i].getX()) * (point.getY()-points[i].getY()) / (points[j].getY()-points[i].getY()) + points[i].getX()) )

{

c = !c;

}

}

return c;

}

test-4-gis.cpp

#include "../gis.hpp"

#include "catch/catch.hpp"

TEST_CASE("Testing container (GIS) operations") {

GIS taxMap;

SECTION("Check file availability") {

REQUIRE(!taxMap.readFile("zzzzz.zzzz"));

REQUIRE(taxMap.readFile("simple-polygons.txt"));

}

SECTION("Check point that isn't inside any of the polygons") {

taxMap.readFile("simple-polygons.txt");

CHECK("Not Found" == taxMap.findParcelName(Point(-1, -1)));

}

SECTION("Check for point inside polygon") {

taxMap.readFile("simple-polygons.txt");

CHECK("squareParcel" == taxMap.findParcelName(Point(1, 1)));

CHECK("wideRectangleParcel" == taxMap.findParcelName(Point(5, 4)));

}

}

Im having diffculty with following what I need to do here any assitance would be great!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

What are the classifications of Bank?

Answered: 1 week ago