Files
OpenSpace/modules/vislab/rendering/renderabledistancelabel.cpp
2020-01-09 09:59:38 +01:00

80 lines
4.0 KiB
C++

/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2020 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/vislab/rendering/renderabledistancelabel.h>
#include <openspace/documentation/documentation.h>
//#include <openspace/documentation/verifier.h>
namespace openspace {
documentation::Documentation RenderableDistanceLabel::Documentation() {
using namespace documentation;
return {
"Renderable Distance Label",
"vislab_renderable_distance_label",
{
}
};
}
RenderableDistanceLabel::RenderableDistanceLabel(const ghoul::Dictionary& dictionary)
: RenderableLabels(dictionary)
{
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"RenderableDistanceLabel"
);
}
//void RenderableDistanceLabel::update(const UpdateData& data) {
//
// if (global::renderEngine.scene()->sceneGraphNode(_nodeLine)) {
//
// // Calculate distance
// SceneGraphNode* nodelineNode = global::renderEngine.scene()->sceneGraphNode(_nodeLine);
// RenderableNodeLine* nodeline = dynamic_cast<RenderableNodeLine*>(nodelineNode->renderable());
// double myDistance = nodeline->getDistance();
//
// // format string
// float scale = getUnit(Kilometer);
// std::string distanceText = std::to_string(std::round(myDistance / scale));
// int pos = distanceText.find(".");
// std::string subStr = distanceText.substr(pos);
// distanceText.erase(pos, subStr.size());
// std::string finalText = distanceText + " " + KilometerUnit;
// setLabelText(finalText);
//
// // Update placement of label with transformation matrix
// glm::dvec3 start = global::renderEngine.scene()->sceneGraphNode(nodeline->_start)->worldPosition();
// glm::dvec3 end = global::renderEngine.scene()->sceneGraphNode(nodeline->_end)->worldPosition();
// glm::dvec3 goalPos = start + (end - start) / 2.0;
// _transformationMatrix = glm::translate(glm::dmat4(1.0), goalPos);
// }
//}
} // namespace openspace