Developer Documentation
Ruler.hh
1/*===========================================================================*\
2* *
3* OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39* *
40\*===========================================================================*/
41
42
43
44#pragma once
45#include <QObject>
46#include <QString>
47
48#include <ACG/Scenegraph/LineNode.hh>
49#include <ACG/Scenegraph/TextNode.hh>
51
52class Ruler : public QObject
53{
54 Q_OBJECT
55signals:
56 void updateView();
57
58public:
65 Ruler(BaseObjectData *_obj,const QString &_pluginName, unsigned _index);
66 ~Ruler();
67
68 void setPoints(const ACG::Vec3d& _start,const ACG::Vec3d& _end);
69 void setStartPoint(const ACG::Vec3d& _start);
70 void setEndPoint(const ACG::Vec3d& _end);
71 void setTextOffset(const ACG::Vec3d& offset);
72
73 const ACG::Vec3d* points() const{return points_;}
74
75 const BaseObject* getBaseObj(){return obj_;}
76
77 float textScale(){return textNode_->lastScale();}
78
79public slots:
80
81 // set text size in pixels
82 void setTextSize(const unsigned _size){textNode_->setPixelSize(_size); emit updateView();}
83
84private:
85
86 void updateNodes();
87
88 const QString pluginName_;
89 const std::string lineNodeName_;
90 const std::string textNodeName_;
91 const std::string textTransformNodeName_;
92
95 ACG::SceneGraph::TransformNode* textTransformNode_;
96
97 ACG::Vec3d points_[2];
98 ACG::Vec3d offset_;
99 BaseObjectData* obj_;
100};
void setPixelSize(const unsigned int _size)
sets the pixelsize of the text (only available for the SCREEN_ALIGNED_STATIC_SIZE mode and only works...
Definition: TextNode.cc:732
float lastScale()
returns the scaling factor for screen aligned text the text. returns 0, if textmode is not SCREEN_ALI...
Definition: TextNode.hh:166
Definition: Ruler.hh:53
Ruler(BaseObjectData *_obj, const QString &_pluginName, unsigned _index)
Definition: Ruler.cc:50