-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshape.h
83 lines (65 loc) · 1.35 KB
/
shape.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* shape.h
* 4/3/2016
*
* CS 372 Sp16
* Group Project 2: Postscript Generator
*/
#ifndef SHAPE_H_INCLUDED
#define SHAPE_H_INCLUDED
#include <utility>
using std::pair;
#include <string>
using std::string;
#include <sstream>
using std::stringstream;
#include <cmath>
#include <iostream>
using std::ostream;
#include <algorithm>
using std::min;
using std::max;
#include <typeinfo>
#include "utils.h"
class Shape
{
public:
Shape(): x_(0), y_(0), boundsWidth_(0), boundsHeight_(0) {};
Shape(int x, int y, double width, double height): x_(x), y_(y), boundsWidth_(width), boundsHeight_(height) {};
Shape(double width,double height) : Shape(0,0,width,height) {};
virtual ~Shape() {};
virtual string draw() const;
virtual string draw(int x,int y) const;
virtual void place(int x, int y);
string bounds();
double width();
double height();
int x();
void x(int x);
int y();
void y(int y);
string operator()();
string operator()(int x, int y);
virtual int numOfSides();
virtual double sideLength();
virtual double radius();
protected:
/**
* x coordinate of shape position
*/
int x_;
/**
* y coordinate of shape position
*/
int y_;
/**
* width of boundary box
*/
double boundsWidth_;
/**
* height of boundary box
*/
double boundsHeight_;
}; //end of class Shape
ostream & operator<<(ostream &os, const Shape & shape);
#endif