OpenStructure
Loading...
Searching...
No Matches
strategies.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// This file is part of the OpenStructure project <www.openstructure.org>
3//
4// Copyright (C) 2008-2020 by the OpenStructure authors
5// Copyright (C) 2003-2010 by the IPLT authors
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License as published by the Free
9// Software Foundation; either version 3.0 of the License, or (at your option)
10// any later version.
11// This library is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14// details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this library; if not, write to the Free Software Foundation, Inc.,
18// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//------------------------------------------------------------------------------
20
21/*
22 Authors: Andreas Schenk, Ansgar Philippsen
23*/
24
25#ifndef IMG_GUI_STRATEGIES_HH_
26#define IMG_GUI_STRATEGIES_HH_
27
28
29#include <ost/geom/geom.hh>
30
31#include "strategies_fw.hh"
32
33#include <QPainter>
34#include <QPoint>
35#include <QColor>
36#include <QPen>
37#include <QBrush>
38namespace ost { namespace img { namespace gui {
39
40
42{
43public:
46
47 virtual void Draw(QPainter& pnt, const QPoint& center);
48
49 virtual void SetPenColor(const QColor& color){pen_.setColor(color);}
50 virtual QColor GetPenColor() const {return pen_.color();}
51 void SetPen(const QPen& pen) {pen_=pen;}
52 virtual QPen GetPen() const {return pen_;}
53 virtual void SetBrush(const QBrush& brush) {brush_=brush;}
54 virtual QBrush GetBrush() const {return brush_;}
55 virtual unsigned int GetSymbolSize() const {return symbolsize_;}
56 virtual void SetSymbolSize(unsigned int symbolsize) {symbolsize_=symbolsize;}
57 virtual unsigned int GetSymbolStrength() const {return symbolstrength_;}
58 virtual void SetSymbolStrength(unsigned int s) {symbolstrength_=s;}
59 virtual bool HasCrosshair(){return false;}
60 virtual String GetShape()=0;
61protected:
62 virtual void DrawSymbol(QPainter& pnt, const QPoint& center)=0;
63 unsigned int symbolsize_;
64 unsigned int symbolstrength_;
65 QPen pen_;
66 QBrush brush_;
67};
68
69
71{
72public:
78 virtual String GetShape(){return "Square";}
79protected:
80 virtual void DrawSymbol(QPainter& pnt, const QPoint& center);
81};
82
84{
85public:
88 void SetPen(const QPen& pen);
89 void SetPenColor(const QColor& color);
90 virtual void Draw(QPainter& pnt, const QPoint& center);
91 virtual bool HasCrosshair(){return true;}
92protected:
93 virtual void DrawCrosshair(QPainter& pnt, const QPoint& center);
95 QPen pen2_;
96};
97
99{
100public:
106 virtual String GetShape(){return "Circle";}
107protected:
108 virtual void DrawSymbol(QPainter& pnt, const QPoint& center);
109};
110
112{
113public:
120 virtual String GetShape(){return "Square";}
121protected:
122 virtual void DrawSymbol(QPainter& pnt, const QPoint& center);
123};
124
126{
127public:
134 virtual String GetShape(){return "Circle";}
135protected:
136 virtual void DrawSymbol(QPainter& pnt, const QPoint& center);
137};
138
139}}} //ns
140
141#endif /*STRATEGIES_HH_*/
virtual void DrawSymbol(QPainter &pnt, const QPoint &center)
CircleDrawingStrategy(const SymbolDrawingStrategy &strategy)
CrosshairBaseDrawingStrategy(const SymbolDrawingStrategy &strategy)
virtual void DrawCrosshair(QPainter &pnt, const QPoint &center)
virtual void Draw(QPainter &pnt, const QPoint &center)
virtual void DrawSymbol(QPainter &pnt, const QPoint &center)
CrosshairCircleDrawingStrategy(const SymbolDrawingStrategy &strategy)
virtual void DrawSymbol(QPainter &pnt, const QPoint &center)
CrosshairSquareDrawingStrategy(const SymbolDrawingStrategy &strategy)
virtual void DrawSymbol(QPainter &pnt, const QPoint &center)
SquareDrawingStrategy(const SymbolDrawingStrategy &strategy)
Definition strategies.hh:75
virtual void SetSymbolStrength(unsigned int s)
Definition strategies.hh:58
virtual void SetBrush(const QBrush &brush)
Definition strategies.hh:53
virtual unsigned int GetSymbolSize() const
Definition strategies.hh:55
virtual QColor GetPenColor() const
Definition strategies.hh:50
virtual void SetPenColor(const QColor &color)
Definition strategies.hh:49
virtual QBrush GetBrush() const
Definition strategies.hh:54
virtual void SetSymbolSize(unsigned int symbolsize)
Definition strategies.hh:56
virtual void Draw(QPainter &pnt, const QPoint &center)
virtual void DrawSymbol(QPainter &pnt, const QPoint &center)=0
virtual unsigned int GetSymbolStrength() const
Definition strategies.hh:57
std::string String
Definition base.hh:54
Definition base.dox:1