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