Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Polygon and simple GIS Project, need help with code. C++ simple-polygons.txt polygons.txt TEST Files: Geographic Information System (GIS) Project Outcomes: Develop a C++ program that

Polygon and simple GIS Project, need help with code. C++

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

simple-polygons.txt

image text in transcribed

polygons.txt

image text in transcribed

TEST Files:

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Geographic Information System (GIS) Project Outcomes: Develop a C++ program that uses: - Dynamic arrays - Memory management in classes - Arrays of complex objects - Multiple user-defined classes - Make rules for compiling and testing code Geographic Information Systems (GIS) are a useful application of technology to the field of Geography. GIS tools are used in systems such as GCCS, often used by the military for mission planning and high-level navigation. They are also used by municipalities for managing resources such as monitoring watersheds for testing purposes. County tax assessors likewise use such tools for assessing taxes on property owners. All of these applications involve efficient and accurate querying of points (for example a mouse click) to determine whether a query is inside a particular polygon. The purpose of such queries is often to report the name of the polygon that contains the query point. The polygons used in GIS systems are often referred as parcels. Checking whether a point is inside a polygon depends on how the polygon is stored. For this project, we'll work with convex polygons only, this enables us to simplify the inclusion check a bit. In our case, polygons will be stored as a list of vertices given in the clockwise order. Thus, checking if a point is inside a polygon involves checking whether the point lies on or to the right of all edges if we treat every edge as a directed line following the clockwise direction. Given three points, to determine the location of a point p3 related to the line from point p1 to point p2, we can use the following formula (p2.xp1.x)(p3.yp1.y)(p2.yp1.y)(p3.xp1.x) to calculate the cross product of two vectors p2>p1 and p3>p1. If this value is negative, p3 is on the right to the line from p1 to p2. If this value is zero, it is on the edge. Both should be consider inside the polygon. You may make a private function to perform this check. Your application must function as described below: 1. Your program shall adhere to the test suites provided here. Read the tests and create the required files, classes, and methods. This means that all tests must pass in their current configuration. 2. A Makefile is provided. Read it to have some understanding of the project. Never modify it!. 3. Additionally, you must create a user application that allows a user to specify an input file which conforms to the Sample data format given below. - Data will be given as alternating and values. - Each line of the input file will contain a single polygon. - All coordinate values are integer values. - The first parcel in the sample data below is a 22 square with the bottom left vertex at (0,0) and a rectangle that is two units high and six units wide with a bottom left vertex at (0,2). - Not all inputs will be axis-aligned rectangles, they are just good exemplars due to their simplicity. 4. The program must then allow queries to be submitted in the form of x and y coordinates and should report the title of the polygon which contains the query point. - The user should be prompted for the x coordinate, then prompted for the y coordinate as seen in Sample run below. This sample data is found in simple-polygons.txt. A more complicated input file is in polygons.txt, for when you are ready to test your program against something more complicated. Sample run Please enter the file with the polygon data: bad-file-name.zz Invalid file name! Please enter the file with the polygon data: simple-polygons.txt Coordinates of query point (non-integer quits) x:1 y: 1 Query point is inside: squareParcel Coordinates of query point (non-integer quits) x:3 Query point is inside: wideRectangleParcel Coordinates of query point (non-integer quits) x:7 y: 7 Query point is inside: Not Found Coordinates of query point (non-integer quits) x: quit Have a great day! 1. Create a project that is object oriented, therefore there should be several classes. 2. The input file will match the exact format given above. 3. Your program must compile and pass a tests listed above. - This application must be compiled by running and shall create an executable file called - All tests must pass by running together with . You can run individual test during development. 4. To practice the memory management principals learned in class, you must use dynamic arrays to store lists of data in your classes. You classes must be memory leak free. Memory leakage will be checked and graded in autograding. 1squareParcel0000222020 \( \begin{array}{ll}1 & \text { \#include ". /gis.hpp" } \\ 2 & \text { \#include "catch/catch.hpp" } \\ 3 & \\ 4 & \text { TEST_CASE("Testing container (GIS) operations") }\{ \\ 5 & \text { GIS taxMap; } \\ 6 & \text { SECTION("Check file availability") }\{ \\ 7 & \text { REQUIRE(ItaxMap.readFile("zzzzz.zzzz")); } \\ 8 & \text { REQUIRE(taxllap.readFile("simple-polygons.txt")); } \\ 9 & \text { \} } \\ 10 & \text { SECTION("Check point that isn't inside any of the polygons") }\{ \\ 11 & \text { taxMap.readFile("simple-polygons.txt"); } \\ 12 & \text { CHECK("Not Found" == taxMap.findParcelName(Point (-1, }-1))) ; \\ 13 & \text { S } \\ 14 & \text { SECTION("Check for point inside polygon") }\{ \\ 15 & \text { taxMap.readFile("simple-polygons.txt"); } \\ 16 & \text { CHECK("squareParcel" == taxMap.findParcelName(Point(1, 1))); } \\ 17 & \text { CHECK("wideRectangleParcel" = taxMap.findParcelName(Point(5, 4))); } \\ 18 & \text { \} }\end{array} \)

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

What is a prospectus? What is its purpose?

Answered: 1 week ago

Question

11. Are your speaking notes helpful and effective?

Answered: 1 week ago

Question

The Goals of Informative Speaking Topics for Informative

Answered: 1 week ago