Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
bc19529
Implementation of Number class
aiddya Nov 1, 2018
dcf538e
Merge branch 'dev' into g1_dev
aiddya Nov 1, 2018
ccfd4e8
Fixing and optimizing flawed implementation of power function
aiddya Nov 1, 2018
83754e1
Temporary implementation of sqrt
aiddya Nov 1, 2018
605869b
Merge pull request #12 from SpatialTypeSystem/g1_dev
JasonCochran Nov 2, 2018
80ed251
Edited Point2D.h, Point2D.cpp, and re-added missing Point2DImpl.h. Tr…
kclegg Nov 6, 2018
0fac0ea
Merge pull request #13 from SpatialTypeSystem/dev
JasonCochran Nov 9, 2018
a617212
Updates to readme for GMP... not fully working though
JasonCochran Nov 9, 2018
bc0da8e
RGPs
kotaprabhakar Nov 13, 2018
163328f
Removed comment
kotaprabhakar Nov 13, 2018
6d72bbf
Added Line2D files
kclegg Nov 18, 2018
508a4c8
Merge pull request #14 from SpatialTypeSystem/g1_dev
lokeshsurya6 Nov 19, 2018
8435ced
Update Point2D.h
lokeshsurya6 Nov 20, 2018
3931cf2
Create Point2DForProgrammer.h
lokeshsurya6 Nov 20, 2018
a56bc33
Update Point2DImpl.h
lokeshsurya6 Nov 20, 2018
413c4aa
Delete Line2D.cpp
lokeshsurya6 Nov 20, 2018
f34256c
Delete Line2DForProgrammer.cpp
lokeshsurya6 Nov 20, 2018
cdb166e
Update Point2D.cpp
lokeshsurya6 Nov 20, 2018
91b07dd
Create Point2DForProgrammer.cpp
lokeshsurya6 Nov 20, 2018
7c568f5
Create Point2DImpl.cpp
lokeshsurya6 Nov 20, 2018
99205df
All Line2D header files added
kclegg Nov 20, 2018
de6bab5
Fixed compile Line2D.h errors
kclegg Nov 20, 2018
c389215
Updated Line2DImpl.h parameter of operator!=(),operator==()
kclegg Nov 20, 2018
9a6fba1
Added Line2D cpp files
kclegg Nov 20, 2018
f1981c5
Intersection of Line Segments
kotaprabhakar Nov 20, 2018
5e49220
Implement sqrt using long division
aiddya Nov 26, 2018
ffa6490
Merge branch 'g1_dev' of github.com:SpatialTypeSystem/PostGRES_ext in…
aiddya Nov 26, 2018
27566bb
Removing pointers from implementation
aiddya Nov 29, 2018
db0888e
Merge pull request #15 from SpatialTypeSystem/g1_dev
JasonCochran Nov 29, 2018
796d869
Updated Line2DImpl, outline for parse() function
kclegg Nov 29, 2018
c0f20d5
Added instructions for local compilation
aiddya Nov 30, 2018
924d7e8
Using long div for to_string, fixed operator>>, unit tests
aiddya Dec 3, 2018
85079db
Makefile for NumberTest
aiddya Dec 3, 2018
b4c518b
Updated parse() function and added iterator stuff
kclegg Dec 3, 2018
0cb33be
Minor update to Line2DImpl.cpp
kclegg Dec 4, 2018
0b483d7
Merge pull request #16 from SpatialTypeSystem/g1_dev
JasonCochran Dec 4, 2018
4fc1fb0
Merge pull request #17 from SpatialTypeSystem/dev
lokeshsurya6 Dec 5, 2018
487d06f
Add files via upload
lokeshsurya6 Dec 6, 2018
60cd244
Add files via upload
lokeshsurya6 Dec 6, 2018
3963257
Updated Line2DImpl with correct iterator stuff
kclegg Dec 7, 2018
f3c3405
Support negative number in constructor and sqrt
aiddya Dec 7, 2018
1e1ed6b
slight update to parse()
kclegg Dec 7, 2018
9435ea6
Updated parse() function. Still needs testing that actual values are …
kclegg Dec 7, 2018
710bfa9
Update destructor
kclegg Dec 8, 2018
86c5bb7
Added doc defining Line2D functions
kclegg Dec 8, 2018
f6b7ec0
Merge pull request #19 from SpatialTypeSystem/g1_dev
JasonCochran Dec 8, 2018
d16237b
Updated bb function in Line2D
kclegg Dec 8, 2018
13daa28
Updated bb function
kclegg Dec 8, 2018
dee3aca
Updated #include
kclegg Dec 8, 2018
7263357
Merge pull request #20 from SpatialTypeSystem/dev
JasonCochran Dec 8, 2018
f434814
Add files via upload
kadarisai Dec 8, 2018
fdf711c
Add files via upload
lokeshsurya6 Dec 8, 2018
b990f84
Add files via upload
lokeshsurya6 Dec 8, 2018
7c7e008
Merge pull request #21 from SpatialTypeSystem/master
lokeshsurya6 Dec 8, 2018
68a4851
Delete Line2DImpl.h
lokeshsurya6 Dec 8, 2018
a61cee3
Delete Point2DImpl.h
lokeshsurya6 Dec 8, 2018
57f14cd
Add files via upload
kadarisai Dec 8, 2018
a1bb2bd
Add files via upload
kadarisai Dec 8, 2018
e83c204
Update Line2D.cpp
lokeshsurya6 Dec 8, 2018
c9bd99f
Update Line2DForProgrammer.cpp
lokeshsurya6 Dec 8, 2018
3caa6da
Update Line2DImpl.cpp
lokeshsurya6 Dec 8, 2018
73c247a
Update Point2D.cpp
lokeshsurya6 Dec 8, 2018
8aa4159
Update RGPHalfSegment2D.cpp
lokeshsurya6 Dec 8, 2018
a53ee7f
Update postgres_ext.cpp
lokeshsurya6 Dec 8, 2018
f29a72a
Updated report group2
kclegg Dec 9, 2018
eb5d8e5
Merge branch 'group4_fin' into Group2_November
JasonCochran Dec 9, 2018
e755e26
Revert "Merge branch 'group4_fin' into Group2_November"
JasonCochran Dec 9, 2018
fe7dd16
Update Region2DImpl.cpp
lokeshsurya6 Dec 9, 2018
1545a45
Update Line2DImpl.h
lokeshsurya6 Dec 9, 2018
2d5b345
Update Point2D.h
lokeshsurya6 Dec 9, 2018
9c491ac
Update Point2DImpl.h
lokeshsurya6 Dec 9, 2018
5a72a61
Update Region2DImpl.h
lokeshsurya6 Dec 9, 2018
9ce9d77
Update postgres_ext.cpp
lokeshsurya6 Dec 9, 2018
228f0a7
Update Line2DImpl.cpp
lokeshsurya6 Dec 9, 2018
3a1499e
Update Point2D.cpp
lokeshsurya6 Dec 9, 2018
c38444b
Update Point2DImpl.cpp
lokeshsurya6 Dec 9, 2018
b6748e2
Merge branch 'Group2_November' of https://github.com/SpatialTypeSyste…
lokeshsurya6 Dec 9, 2018
fa1f339
Update Region2DImpl.cpp
lokeshsurya6 Dec 9, 2018
a08434c
Update Region2DImpl.h
lokeshsurya6 Dec 9, 2018
7b45811
Update Region2DImpl.cpp
lokeshsurya6 Dec 9, 2018
baf608d
Update Point2D.h
lokeshsurya6 Dec 9, 2018
c5fffd2
Update Point2DImpl.h
lokeshsurya6 Dec 9, 2018
21ba656
Update postgres_ext.cpp
lokeshsurya6 Dec 9, 2018
6afa4e6
Update Point2D.cpp
lokeshsurya6 Dec 9, 2018
7dd670b
Update Point2DImpl.cpp
lokeshsurya6 Dec 9, 2018
8d61fa2
Update postgres_ext.cpp
lokeshsurya6 Dec 9, 2018
3c2aa19
Update Line2D.h
lokeshsurya6 Dec 9, 2018
c168565
Update Line2DImpl.h
lokeshsurya6 Dec 9, 2018
b95c2c3
Update postgres_ext.cpp
lokeshsurya6 Dec 9, 2018
4a1c6f4
Update Line2D.cpp
lokeshsurya6 Dec 9, 2018
c24f0e6
Update Line2DImpl.cpp
lokeshsurya6 Dec 9, 2018
ab939e9
Update Point2DForProgrammer.h
lokeshsurya6 Dec 9, 2018
d921689
Update Point2DForProgrammer.cpp
lokeshsurya6 Dec 9, 2018
667143b
Update Line2D.h
lokeshsurya6 Dec 9, 2018
f3df2e4
Update Line2DImpl.h
lokeshsurya6 Dec 9, 2018
4eaca2e
Update Point2D.h
lokeshsurya6 Dec 9, 2018
b4394b2
Update Point2DForProgrammer.h
lokeshsurya6 Dec 9, 2018
9e04e75
Update Point2DImpl.h
lokeshsurya6 Dec 9, 2018
a48b104
Update Line2D.cpp
lokeshsurya6 Dec 9, 2018
09e1744
Update Line2DImpl.cpp
lokeshsurya6 Dec 9, 2018
5eb9c60
Update Point2D.cpp
lokeshsurya6 Dec 9, 2018
0ccc605
Update Point2DForProgrammer.cpp
lokeshsurya6 Dec 9, 2018
92c506b
Update Point2DImpl.cpp
lokeshsurya6 Dec 9, 2018
17b7da6
Add files via upload
lokeshsurya6 Dec 9, 2018
57df0c6
Delete Report_Group2.docx
lokeshsurya6 Dec 9, 2018
707663f
Delete Line2D.docx
lokeshsurya6 Dec 9, 2018
e141c9c
Update Line2DForProgrammer.h
lokeshsurya6 Dec 9, 2018
f4cceed
Update Point2D.cpp
lokeshsurya6 Dec 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added ProjectReport_Group2.pdf
Binary file not shown.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ Spatial database course extension to PostGRES
Currently the build builds all the implementation files and builds postgres_ext.cpp file which includes all interfaces.

```bash
# Get the repo and setup GMP
git clone [URL]
cd PostGRES_ext
wget https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz
tar -xf gmp-6.1.2.tar.xz
cd gmp-6.1.2
./configure --prefix=$HOME/.local --enable-cxx
make
make install
cd ..
# Build PostGRES_ext
make clean
make
./postgres_ext
Expand Down
48 changes: 0 additions & 48 deletions include/AVLTree.h

This file was deleted.

34 changes: 0 additions & 34 deletions include/Evaluate.h

This file was deleted.

26 changes: 0 additions & 26 deletions include/Explore.h

This file was deleted.

45 changes: 29 additions & 16 deletions include/Line2D.h
Original file line number Diff line number Diff line change
@@ -1,38 +1,51 @@
#ifndef LINE2D_H
#define LINE2D_H

#include "Number.h"
#include "RGP.h"
#include "Number.h"
#include "Line2DImpl.h"
#include <string>
#include <vector>

class Line2D{
public:
// Constructors
Line2D();
Line2D(std::vector<RGPHalfSegment2D> listOfSegments);
Line2D(std::string listOfLine2DString);
Line2D(std::ifstream& file); // Send in file for constructor
~Line2D();

//iterator to run through the list of half segments
class iterator
{
public:
iterator(RGPHalfSegment2D*);
RGPHalfSegment2D operator*();
RGPHalfSegment2D operator++(int);
RGPHalfSegment2D operator++();
bool operator!=(const iterator&);
bool operator==(const iterator&);
RGPHalfSegment2D *ptr;
};

iterator begin(); // return an iterator to the first element
iterator end(); // return an iterator to the last element

bool add(RGPSegment2D rgpSeg2d); // Adds a new RGPSegment2D
bool update(iterator it, RGPSegment2D rgpSeg2d); // Updates RGPSegment2D existing at specified index
bool remove(iterator it); // Removes a RGPSegment2D at specified index

// Methods
std::string getLineString(); // Get the line as human readable ASCII string
static bool isEmptyLine();
static bool isValidLine();
void printAllLines(); // print all half segments in the vector
bool isEmptyLine();
int getNumberOfSegments(); // Get the total number of RGPSegment2Ds listed
std::vector<RGPSegment2D> getBoundingBox();

bool operator==(const Line2D &l2d); // Override of operator == to check equality of two Line2Ds
bool operator!=(const Line2D &l2d); // Override of operator != to check inequality of two Line2Ds
bool add(RGPSegment2D rgpSeg2d); // Adds a new RGPSegment2D
bool update(int index, RGPSegment2D rgpSeg2d); // Updates RGPSegment2D existing at specified index
bool remove(int index); // Removes a RGPSegment2D at specified index
RGPSegment2D operator[](int index); // Retrieves a RGPSegment2D at specified index

RGPSegment2D getBoundingBox();

private:
class Line2DImpl;

// Fields
Line2DImpl *impl;
struct Line2DStore;
Line2DStore *handle;
};

#endif //LINE2D
43 changes: 43 additions & 0 deletions include/Line2DForProgrammer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef LINE2DFORPROGRAMMER_H
#define LINE2DFORPROGRAMMER_H

#include "Number.h"
#include "RGP.h"
#include "RGPSegment2D.h"
#include <string>
#include <vector>
#include <iterator>

class Line2DForProgrammer{
public:
// Constructors
Line2DForProgrammer(std::string listOfLine2DString);
Line2DForProgrammer(std::ifstream& file); // Send in file for constructor
~Line2DForProgrammer();

//iterator to run through the list of half segments
class iterator
{
public:
iterator(RGPHalfSegment2D*);
RGPHalfSegment2D operator*();
RGPHalfSegment2D operator++(int);
RGPHalfSegment2D operator++();
bool operator!=(const iterator&);
bool operator==(const iterator&);
RGPHalfSegment2D *ptr;
};

iterator begin(); // return an iterator to the first element
iterator end(); // return an iterator to the last element

bool add(RGPSegment2D rgpSeg2d); // Adds a new RGPSegment2D
bool update(iterator it, RGPSegment2D rgpSeg2d); // Updates RGPSegment2D existing at specified index
bool remove(iterator it); // Removes a RGPSegment2D at specified index

private:
struct Line2DProgrammerStore;
Line2DProgrammerStore *handle;
};

#endif //LINE2D
63 changes: 51 additions & 12 deletions include/Line2DImpl.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,60 @@
#ifndef LINE2DIMPL_H
#define LINE2DIMPL_H

#include "RGP.h"
#include "Line2D.h"
#include <string>
#include <vector>

class Line2DImpl : public Line2D {
public:

Line2DImpl();
~Line2DImpl();

std::vector<RGPHalfSegment2D> getSequence();
#include "RGP.h"
#include "RGPSegment2D.h"
#include "RGPHalfSegment2D.h"

private:
class Line2DImpl
{
public:
// Constructors
Line2DImpl(); // no args
Line2DImpl(std::vector<RGPSegment2D> listOfSegments); //send in a vector of segments
Line2DImpl(std::string listOfLine2DString); // send in a string
~Line2DImpl(); //destructor

std::vector<RGPHalfSegment2D> sequence;
//iterator to run through the list of half segments
class iterator
{
public:
iterator(RGPHalfSegment2D*);
RGPHalfSegment2D operator*();
RGPHalfSegment2D operator++(int);
RGPHalfSegment2D operator++();
bool operator!=(const iterator&);
bool operator==(const iterator&);
RGPHalfSegment2D *ptr;
};

iterator begin(); // return an iterator to the first element
iterator end(); // return an iterator to the last element

// Methods
void printAllLines(); // print all half segments in the vector
bool isEmptyLine(); // checks if the line object is empty
int getNumberOfSegments(); // Get the total number of RGPSegment2Ds listed
RGPSegment2D getBoundingBox(); // find the bounding box diaginal
std::vector<RGPHalfSegment2D> getVectorOfSegments();

bool add(RGPSegment2D rgpSeg2d); // Adds a new RGPSegment2D
bool update(iterator it, RGPSegment2D rgpSeg2d); // Updates RGPSegment2D existing at specified index
bool remove(iterator it); // Removes a RGPSegment2D at specified index

bool operator==(const Line2DImpl &l2d); // Override of operator == to check equality of two Line2Ds
bool operator!=(const Line2DImpl &l2d); // Override of operator != to check inequality of two Line2Ds
Line2DImpl operator[](int index); // Retrieves a RGPSegment2D at specified index
Line2DImpl operator=(const Line2DImpl &l2dImpl);

private:
struct Line2DImplStore;
Line2DImplStore *handle;
void lineSort(std::vector<RGPHalfSegment2D> &bar);
void mergeSort(std::vector<RGPHalfSegment2D> &left, std::vector<RGPHalfSegment2D> &right, std::vector<RGPHalfSegment2D> &bars);
bool parseStringToVectorOfLines(std::string st);
};

#endif //LINE2DIMPL_H
#endif //POINT2DIMPL_H
45 changes: 25 additions & 20 deletions include/Number.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,53 @@
#include <iostream>
#include <string>


class Number
{
public:
// Constructors
// Default number value is 0
Number();

// Copy constructor
Number(const Number &n);

// The string will be converted to a rational number
Number(std::string number);

// Destructor
~Number();

// Override arithmetic operators
Number& operator+(const Number& n) const;
Number& operator+=(const Number& n);
Number& operator-(const Number& n) const;
Number& operator-=(const Number& n);
Number& operator*(const Number& n) const;
Number& operator*=(const Number& n);
Number& operator/(const Number& n) const;
Number& operator/=(const Number& n);
Number& operator^(const int n) const;
Number operator=(const Number &n);
Number operator+(const Number &n) const;
Number operator+=(const Number &n);
Number operator-(const Number &n) const;
Number operator-=(const Number &n);
Number operator*(const Number &n) const;
Number operator*=(const Number &n);
Number operator/(const Number &n) const;
Number operator/=(const Number &n);
Number operator^(const int n) const;

// Override comparison operators
bool operator<(const Number& n) const;
bool operator<=(const Number& n) const;
bool operator>(const Number& n) const;
bool operator>=(const Number& n) const;
bool operator==(const Number& n) const;
bool operator!=(const Number& n) const;
bool operator<(const Number &n) const;
bool operator<=(const Number &n) const;
bool operator>(const Number &n) const;
bool operator>=(const Number &n) const;
bool operator==(const Number &n) const;
bool operator!=(const Number &n) const;
Number sqrt() const;
Number sqrt(size_t digits) const;

Number& sqrt() const;
std::string to_string(size_t digits) const;

// Overriding the output and input operator
friend std::ostream& operator<<(std::ostream& os, const Number& n);
friend std::istream& operator>>(std::istream& is, Number& n);
friend std::ostream &operator<<(std::ostream &os, const Number &n);
friend std::istream &operator>>(std::istream &is, Number &n);

private:
struct NumberImpl;
NumberImpl* p;
struct NumberImpl *p;
};

#endif // NUMBER_H
Loading