OpenStructure
pointlist_overlay_base.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 /*
23  Authors: Ansgar Philippsen, Andreas Schenk
24 */
25 
26 #ifndef IMG_POINTLIST_OVERLAY_BASE_HH
27 #define IMG_POINTLIST_OVERLAY_BASE_HH
28 
29 
30 
31 #include <ost/img/point.hh>
32 
33 #include <ost/img/point.hh>
34 #include <ost/gui/module_config.hh>
36 
37 #include "strategies_fw.hh"
38 
39 #include <QColor>
40 #include <QAction>
41 #include <QDialog>
42 #include <QLineEdit>
43 #include <QColorDialog>
44 #include <QPushButton>
45 #include <QVBoxLayout>
46 
47 
48 namespace ost { namespace img { namespace gui {
49 
51 {
52  Q_OBJECT;
53  public:
54  PointlistOverlayBaseSettings(const QColor& ac, const QColor& pc, int ssiz, int sstr, QWidget* p);
55 
56  public slots:
57  void OnActiveColor();
59  void OnSymbolSize(int v);
60  void OnSymbolStrength(int v);
61 
62  public:
63  QColor active_color;
64  QColor passive_color;
67 
68  protected:
69 
70  QVBoxLayout* main_layout_;
71  QPushButton* active_color_b_;
72  QPushButton* passive_color_b_;
73 };
74 
76 {
77  Q_OBJECT;
78 public:
80 
81  // overlay interface
82  virtual void OnDraw(QPainter& pnt, DataViewerPanel* dvp, bool is_active) {};
83  virtual void OnMenuEvent(QAction* e);
84  virtual QMenu* GetMenu();
85 
86  // own virtual interface
87  virtual void DrawPointList(QPainter& pnt, DataViewerPanel* dvp, const QColor& col ,const std::vector<QPoint>& pointlist);
88  virtual void DrawVariableSizePointList(QPainter& pnt, DataViewerPanel* dvp, const QColor& col ,const std::vector<std::pair<QPoint,double> >& pointlist);
89 
90  //
91  unsigned int GetSymbolSize() const;
92  void SetSymbolSize(unsigned int symbolsize);
93  unsigned int GetSymbolShape() const;
94  void SetSymbolShape(unsigned int symbolshape);
95  bool GetCrosshair() const;
96  void SetCrosshair(bool flag);
97  void SetActiveColor(const QColor& col);
98  void SetPassiveColor(const QColor& col);
99 private:
100 
101  template <class StrategyClass>
102  void ReplaceStrategy();
103 
104 protected:
108  unsigned int symbolsize_;
109  unsigned int symbolstrength_;
110  QMenu* menu_;
111 
112  QAction* a_sq_;
113  QAction* a_ci_;
114  QAction* a_cr_;
115  QAction* a_settings_;
116 
118 };
119 
120 }}} //ns
121 
122 
123 #endif
virtual void DrawPointList(QPainter &pnt, DataViewerPanel *dvp, const QColor &col, const std::vector< QPoint > &pointlist)
void SetSymbolShape(unsigned int symbolshape)
virtual QMenu * GetMenu()
return overlay specific pulldown menu
virtual void DrawVariableSizePointList(QPainter &pnt, DataViewerPanel *dvp, const QColor &col, const std::vector< std::pair< QPoint, double > > &pointlist)
PointlistOverlayBase(const String &name)
unsigned int GetSymbolShape() const
void SetSymbolSize(unsigned int symbolsize)
void SetProps(PointlistOverlayBaseSettings *props)
virtual void OnMenuEvent(QAction *e)
void SetActiveColor(const QColor &col)
void SetPassiveColor(const QColor &col)
unsigned int GetSymbolSize() const
virtual void OnDraw(QPainter &pnt, DataViewerPanel *dvp, bool is_active)
call when redrawing is necessary
PointlistOverlayBaseSettings(const QColor &ac, const QColor &pc, int ssiz, int sstr, QWidget *p)
#define DLLEXPORT_OST_GUI
std::string String
Definition: base.hh:54
boost::shared_ptr< SymbolDrawingStrategy > SymbolDrawingStrategyPtr
Definition: base.dox:1