iRoCS Toolbox  1.1.0
SVGDataIO.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * This file belongs to the iRoCS Toolbox.
4  *
5  * Copyright (C) 2015 Thorsten Falk
6  *
7  * Image Analysis Lab, University of Freiburg, Germany
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software Foundation,
21  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  **************************************************************************/
24 
25 #ifndef SVGDATAIO_HH
26 #define SVGDATAIO_HH
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.hh>
30 #endif
31 
32 #include <QtGui/QDialog>
33 
34 #include <blitz/array.h>
35 
37 
38 #include <set>
39 
44 class IntControlElement;
46 class BoolControlElement;
47 
48 class SVGDataIOParametersDialog : public QDialog
49 {
50 
51  Q_OBJECT
52 
53  public:
54 
56  LabellingMainWidget *mainWidget,
57  QWidget *parent = NULL, Qt::WindowFlags f = 0);
59 
60  std::string fileName() const;
61  double widthCm() const;
62  double marginCm() const;
63  blitz::TinyVector<double,3> lowerBoundUm() const;
64  blitz::TinyVector<double,3> upperBoundUm() const;
65  double scaleBarLengthUm() const;
66  std::string font() const;
67  double fontSizePt() const;
68 
69 private slots:
70 
71  void updateLowerBoundControl();
72  void updateUpperBoundControl();
73  void checkAndAccept();
74 
75 private:
76 
77  double getNextAcceptableScaleBarLengthUm(double lengthUm);
78 
79  LabellingMainWidget *p_mainWidget;
80  FileNameSelectionControlElement *p_fileNameControl;
81  DoubleControlElement *p_widthCmControl;
82  DoubleControlElement *p_marginCmControl;
83  Double3ControlElement *p_lowerBoundUmControl, *p_upperBoundUmControl;
84  DoubleControlElement *p_scaleBarLengthUmControl;
85  StringSelectionControlElement *p_fontControl;
86  DoubleControlElement *p_fontSizePtControl;
87 
88  std::set<double> _acceptableScaleBarLengths;
89  blitz::TinyVector<double,3> _lbUm, _ubUm;
90 
91 };
92 
93 class SVGDataIO
94 {
95 
96  public:
97 
98  SVGDataIO(LabellingMainWidget *mainWidget);
99  ~SVGDataIO();
100 
101 /*======================================================================*/
125 /*======================================================================*/
126  void save(
127  std::string const &fileName, double widthCm, double marginCm,
128  blitz::TinyVector<double,3> const &lowerBoundUm,
129  blitz::TinyVector<double,3> const &upperBoundUm,
130  double scaleBarLengthUm, std::string const &font,
131  double fontSizePt) const;
132 
133 /*======================================================================*/
160 /*======================================================================*/
161  void saveXml(
162  std::string const &fileName, double widthCm, double marginCm,
163  blitz::TinyVector<double,3> const &lowerBoundUm,
164  blitz::TinyVector<double,3> const &upperBoundUm,
165  double scaleBarLengthUm, std::string const &font,
166  double fontSizePt, iRoCS::ProgressReporter *pr = NULL) const;
167 
168  void save();
169 
170 private:
171 
172  LabellingMainWidget *p_mainWidget;
173 
174 };
175 
176 #endif
double scaleBarLengthUm() const
blitz::TinyVector< double, 3 > upperBoundUm() const
double fontSizePt() const
SVGDataIOParametersDialog(LabellingMainWidget *mainWidget, QWidget *parent=NULL, Qt::WindowFlags f=0)
blitz::TinyVector< double, 3 > lowerBoundUm() const
std::string fileName() const
std::string font() const