-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShape.h
More file actions
55 lines (33 loc) · 1.23 KB
/
Shape.h
File metadata and controls
55 lines (33 loc) · 1.23 KB
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
#ifndef SHAPE_H
#define SHAPE_H
#include "Canvas.h"
using namespace std;
class Shape {
public:
Shape() = delete;
Shape(const string &nameOfShape, const string &desc);
Shape(const Shape &) = default;
virtual ~Shape() = default;
const Shape &operator=(const Shape &rhs);
int getIdNum() const;
string getShapeName() const;
string getDescription() const;
string doubleToString(double d, int p) const; // takes a double and returns a string. p is for precision
virtual string toString() const;
virtual void scale(int s) = 0;
virtual double geoArea() const = 0;
virtual double geoPerimeter() const = 0;
virtual int scrArea() const = 0;
virtual int scrPerimeter() const = 0;
virtual int bBoxWidth() const = 0;
virtual int bBoxHeight() const = 0;
/* Draws textual image of the shape on a drawing surface*/
virtual void draw(Canvas &canvas, int c, int r, char fg, char bg = ' ') const = 0;
private:
static int nextId; // keeps track of next id number to be assigned
int idNum; // unique id number
string shapeName; // generic name
string description; // variable descriptive name
};
ostream &operator<<(ostream &ostr, const Shape &rhs);
#endif // !SHAPE_H