Skip to content
Snippets Groups Projects
Commit ff5b84a7 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Tweak MemoryViewer

parent 3f264804
No related branches found
No related tags found
2 merge requests!140armem/dev -> master,!133Add Object Memory with Class and Instance Segments
...@@ -257,7 +257,7 @@ namespace armarx::armem::gui ...@@ -257,7 +257,7 @@ namespace armarx::armem::gui
void MemoryViewer::loadSettings(QSettings* settings) void MemoryViewer::loadSettings(QSettings* settings)
{ {
mnsName = settings->value(QString::fromStdString(CONFIG_KEY_MEMORY), "ArMemMemoryNameSystem").toString().toStdString(); mnsName = settings->value(QString::fromStdString(CONFIG_KEY_MEMORY), "MemoryNameSystem").toString().toStdString();
debugObserverName = settings->value(QString::fromStdString(CONFIG_KEY_DEBUG_OBSERVER), "DebugObserver").toString().toStdString(); debugObserverName = settings->value(QString::fromStdString(CONFIG_KEY_DEBUG_OBSERVER), "DebugObserver").toString().toStdString();
} }
void MemoryViewer::saveSettings(QSettings* settings) void MemoryViewer::saveSettings(QSettings* settings)
...@@ -268,12 +268,18 @@ namespace armarx::armem::gui ...@@ -268,12 +268,18 @@ namespace armarx::armem::gui
void MemoryViewer::writeConfigDialog(SimpleConfigDialog* dialog) void MemoryViewer::writeConfigDialog(SimpleConfigDialog* dialog)
{ {
dialog->addProxyFinder<armarx::armem::mns::MemoryNameSystemInterfacePrx>({CONFIG_KEY_MEMORY, "ArMemMemoryNameSystem", "*"}); dialog->addProxyFinder<armarx::armem::mns::MemoryNameSystemInterfacePrx>({CONFIG_KEY_MEMORY, "MemoryNameSystem", "*"});
dialog->addProxyFinder<armarx::DebugObserverInterfacePrx>({CONFIG_KEY_DEBUG_OBSERVER, "Debug Observer", "DebugObserver"}); dialog->addProxyFinder<armarx::DebugObserverInterfacePrx>({CONFIG_KEY_DEBUG_OBSERVER, "Debug Observer", "DebugObserver"});
} }
void MemoryViewer::readConfigDialog(SimpleConfigDialog* dialog) void MemoryViewer::readConfigDialog(SimpleConfigDialog* dialog)
{ {
mnsName = dialog->getProxyName(CONFIG_KEY_MEMORY); mnsName = dialog->getProxyName(CONFIG_KEY_MEMORY);
ARMARX_IMPORTANT << VAROUT(mnsName);
if (mnsName.empty())
{
mnsName = "MemoryNameSystem";
}
ARMARX_IMPORTANT << VAROUT(mnsName);
debugObserverName = dialog->getProxyName(CONFIG_KEY_DEBUG_OBSERVER); debugObserverName = dialog->getProxyName(CONFIG_KEY_DEBUG_OBSERVER);
} }
......
#include "sanitize_typename.h" #include "sanitize_typename.h"
#include <sstream>
#include <SimoxUtility/algorithm/string.h> #include <SimoxUtility/algorithm/string.h>
#include <RobotAPI/libraries/armem/aron/MemoryID.aron.generated.h>
static const std::string MemoryIDTypeName = armarx::armem::arondto::MemoryID::toInitialAronType()->getName();
std::string armarx::armem::gui::instance::sanitizeTypeName(const std::string& typeName) std::string armarx::armem::gui::instance::sanitizeTypeName(const std::string& typeName)
{ {
if (typeName == MemoryIDTypeName)
{
return "MemoryID";
}
namespace s = simox::alg; namespace s = simox::alg;
std::string n = typeName; std::string n = typeName;
n = s::replace_all(n, "Aron", ""); n = s::replace_all(n, "Aron", "");
...@@ -16,6 +27,20 @@ std::string armarx::armem::gui::instance::sanitizeTypeName(const std::string& ty ...@@ -16,6 +27,20 @@ std::string armarx::armem::gui::instance::sanitizeTypeName(const std::string& ty
std::string end = ">"; std::string end = ">";
n = n.substr(begin.size(), n.size() - begin.size() - end.size()); n = n.substr(begin.size(), n.size() - begin.size() - end.size());
} }
if (true)
{
const std::string del = "::";
size_t find = n.rfind(del);
if (find != n.npos)
{
find += del.size(); // include del
std::stringstream ss;
ss << n.substr(find) << " (" << n.substr(0, find - del.size()) << ")";
n = ss.str();
}
}
return n; return n;
} }
#include "TreeWidget.h" #include "TreeWidget.h"
#include <RobotAPI/libraries/armem_gui/instance/sanitize_typename.h>
#include <RobotAPI/libraries/aron/core/navigator/type/container/Object.h> #include <RobotAPI/libraries/aron/core/navigator/type/container/Object.h>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h> #include <ArmarXCore/core/exceptions/local/ExpressionException.h>
...@@ -292,16 +294,7 @@ namespace armarx::armem::gui::memory ...@@ -292,16 +294,7 @@ namespace armarx::armem::gui::memory
if (container.aronType()) if (container.aronType())
{ {
typeName = container.aronType()->getName(); typeName = container.aronType()->getName();
typeName = instance::sanitizeTypeName(typeName);
std::string del = "::";
size_t find = typeName.rfind(del);
if (find != typeName.npos)
{
find += del.size(); // include del
std::stringstream ss;
ss << typeName.substr(find) << " (" << typeName.substr(0, find) << ")";
typeName = ss.str();
}
} }
else else
{ {
......
...@@ -122,14 +122,10 @@ namespace armarx::armem::server::obj::clazz ...@@ -122,14 +122,10 @@ namespace armarx::armem::server::obj::clazz
toAron(data.meshWrlPath, info.file(".wrl")); toAron(data.meshWrlPath, info.file(".wrl"));
} }
if (auto aabb = info.loadAABB()) auto aabb = info.loadAABB();
{ toAron(data.aabb, aabb ? aabb.value() : simox::AxisAlignedBoundingBox());
toAron(data.aabb, aabb.value()); auto oobb = info.loadOOBB();
} toAron(data.oobb, oobb ? oobb.value() : simox::OrientedBoxf());
if (auto oobb = info.loadOOBB())
{
toAron(data.oobb, oobb.value());
}
if (auto recogNames = info.loadRecognizedNames()) if (auto recogNames = info.loadRecognizedNames())
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment