45 #include <ACG/Scenegraph/LineNode.hh> 46 #include <ACG/Scenegraph/SeparatorNode.hh> 47 #include <ACG/QtScenegraph/QtTranslationManipulatorNode.hh> 51 :pluginName_(_pluginName),
52 lineNodeName_(QString(
"Ruler-Plugin LineNode%1").arg(index).toStdString()),
53 textNodeName_(QString(
"Ruler-Plugin TextNode%1").arg(index).toStdString()),
54 textTransformNodeName_(QString(
"Ruler-Plugin TransformNode%1").arg(index).toStdString()),
57 textTransformNode_(0),
61 points_[0] = points_[1] =
ACG::Vec3d(0.0,0.0,0.0);
71 if (!_obj->
getAdditionalNode(textTransformNode_,_pluginName,textTransformNodeName_.c_str()))
74 _obj->
addAdditionalNode(textTransformNode_,_pluginName,textTransformNodeName_.c_str());
91 if (obj_->
getAdditionalNode(textTransformNode_,pluginName_,textTransformNodeName_.c_str()))
108 void Ruler::setStartPoint(
const ACG::Vec3d& _start)
114 void Ruler::setEndPoint(
const ACG::Vec3d& _end)
121 void Ruler::updateNodes()
135 QString distanceStr = QString().number(distVec.
length());
136 textNode_->
setText(distanceStr.toStdString());
140 setTextOffset(offset_);
145 void Ruler::setTextOffset(
const ACG::Vec3d& offset)
152 textTransformNode_->
translate((points_[0]-halfDist)+offset_);
void translate(const Vec3d &_v)
Add a translation to the current Transformation.
void setText(std::string _text)
sets the string that will be rendered
Ruler(BaseObjectData *_obj, const QString &_pluginName, unsigned _index)
void clear_points()
clear points/lines
bool getAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
get an addition node from the object
bool addAdditionalNode(NodeT *_node, QString _pluginName, QString _nodeName, int _id=0)
add an additional node to the object
bool removeAdditionalNode(NodeT *&_node, QString _pluginName, QString _nodeName, int _id=0)
remove an additional node from the object
void add_line(const Vec3d &_v0, const Vec3d &_v1)
add line (for LineMode == LineSegmentsMode)
VectorT< double, 3 > Vec3d
void set_line_width(float _sz)
set line width (default: 1.0)
Text will always stay parallel to screen.
auto length() const -> decltype(std::declval< VectorT< S, DIM >>().norm())
compute squared euclidean norm
void set_color(const Vec4f &_c)
Override material node's set color function in order to locally add color.
void multipassNodeSetActive(const unsigned int _i, bool _active)
Set Node status to traverse in a specific pass.
bool & alwaysOnTop()
get and set always on top
QtTranslationManipulatorNode * manipulatorNode()