-
Notifications
You must be signed in to change notification settings - Fork 1
/
element.h
64 lines (58 loc) · 1.62 KB
/
element.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
/**
* PGR 2013 project
* Abstract class used for all objects that can be drawn
*
* @author xskota05 Klara Vankova
* xsimet00 Vojtech Simetka
* @date 2013/11/25
* @version 1
* @file element.h
*/
#ifndef ELEMENT_H
#define ELEMENT_H
#include "point.h"
namespace ElementType
{
typedef enum
{
POLYGON,
CIRCLE,
LINE,
SELECTION_RECTANGLE //NEVER use in drawing
} Type;
}
class Element
{
public:
Element(ElementType::Type type);
virtual ~Element();
virtual void paintMe() const = 0;
virtual void forcedPaintMe() const = 0;
virtual void paintPoints() const = 0;
virtual void resize(float x1, float y1, float x2, float y2) = 0;
virtual bool intersects(float min_x, float min_y, float max_x, float max_y) const = 0;
virtual bool intersects(Point) const = 0;
virtual bool intersects(float, float) const = 0;
virtual bool getCounterPoint(float, float, float *, float *) const = 0;
virtual float getMinX() const = 0;
virtual float getMinY() const = 0;
virtual float getMaxX() const = 0;
virtual float getMaxY() const = 0;
virtual void resizeToBoundingRectangle(float, float, float, float) = 0;
virtual void finalizeResize() = 0;
virtual void translatef(float, float) = 0;
virtual void rotate(Point, float) = 0;
void highlightMe();
void deHighlightMe();
void selectMe();
void deSelectMe();
bool isSelected() const;
ElementType::Type getType() const;
void setVisible(bool);
protected:
bool highlighted;
bool selected;
bool visible;
const ElementType::Type type;
};
#endif // ELEMENT_H