Skip to content
Snippets Groups Projects
Commit 458aeb1a authored by Mirko Wächter's avatar Mirko Wächter
Browse files

added debugdrawer viewer gui that runs without any other component

parent cb5b7262
No related branches found
No related tags found
No related merge requests found
......@@ -7,3 +7,5 @@ add_subdirectory(RobotViewerPlugin)
add_subdirectory(DebugDrawerViewer)
\ No newline at end of file
armarx_set_target("DebugDrawerViewerGuiPlugin")
find_package(Qt4 COMPONENTS QtCore QtGui QtDesigner)
armarx_build_if(QT_FOUND "Qt not available")
# ArmarXGui gets included through depends_on_armarx_package(ArmarXGui "OPTIONAL")
# in the toplevel CMakeLists.txt
armarx_build_if(ArmarXGui_FOUND "ArmarXGui not available")
# all include_directories must be guarded by if(Xyz_FOUND)
# for multiple libraries write: if(X_FOUND AND Y_FOUND)....
if(QT_FOUND)
include(${QT_USE_FILE})
endif()
set(SOURCES
./DebugDrawerViewerGuiPlugin.cpp ./DebugDrawerViewerWidgetController.cpp
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@GuiPlugin.cpp @COMPONENT_PATH@/@COMPONENT_NAME@WidgetController.cpp
)
set(HEADERS
./DebugDrawerViewerGuiPlugin.h ./DebugDrawerViewerWidgetController.h
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@GuiPlugin.h @COMPONENT_PATH@/@COMPONENT_NAME@WidgetController.h
)
set(GUI_MOC_HDRS ${HEADERS})
set(GUI_UIS
./DebugDrawerViewerWidget.ui
#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@Widget.ui
)
# Add more libraries you depend on here, e.g. ${QT_LIBRARIES}.
set(COMPONENT_LIBS DebugDrawer ${QT_LIBRARIES})
if(ArmarXGui_FOUND)
armarx_gui_library(DebugDrawerViewerGuiPlugin "${SOURCES}" "${GUI_MOC_HDRS}" "${GUI_UIS}" "" "${COMPONENT_LIBS}")
endif()
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* \package RobotAPI::gui-plugins::DebugDrawerViewerGuiPlugin
* \author Mirko Waechter ( mirko dot waechter at kit dot edu )
* \date 2016
* \copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "DebugDrawerViewerGuiPlugin.h"
#include "DebugDrawerViewerWidgetController.h"
using namespace armarx;
DebugDrawerViewerGuiPlugin::DebugDrawerViewerGuiPlugin()
{
addWidget < DebugDrawerViewerWidgetController > ();
}
Q_EXPORT_PLUGIN2(armarx_gui_DebugDrawerViewerGuiPlugin, DebugDrawerViewerGuiPlugin)
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* \package RobotAPI::gui-plugins::DebugDrawerViewer
* \author Mirko Waechter ( mirko dot waechter at kit dot edu )
* \date 2016
* \copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_RobotAPI_DebugDrawerViewer_GuiPlugin_H
#define _ARMARX_RobotAPI_DebugDrawerViewer_GuiPlugin_H
#include <ArmarXCore/core/system/ImportExportComponent.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h>
namespace armarx
{
/**
* \class DebugDrawerViewerGuiPlugin
* \ingroup ArmarXGuiPlugins
* \brief DebugDrawerViewerGuiPlugin brief description
*
* Detailed description
*/
class ARMARXCOMPONENT_IMPORT_EXPORT DebugDrawerViewerGuiPlugin:
public armarx::ArmarXGuiPlugin
{
public:
/**
* All widgets exposed by this plugin are added in the constructor
* via calls to addWidget()
*/
DebugDrawerViewerGuiPlugin();
};
}
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DebugDrawerViewerWidget</class>
<widget class="QWidget" name="DebugDrawerViewerWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>DebugDrawerViewerWidget</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="btnClearAll">
<property name="text">
<string>Remove All Visualizations</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* \package RobotAPI::gui-plugins::DebugDrawerViewerWidgetController
* \author Mirko Waechter ( mirko dot waechter at kit dot edu )
* \date 2016
* \copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "DebugDrawerViewerWidgetController.h"
#include <ArmarXCore/core/ArmarXManager.h>
#include <string>
using namespace armarx;
DebugDrawerViewerWidgetController::DebugDrawerViewerWidgetController()
{
rootVisu = NULL;
widget.setupUi(getWidget());
}
DebugDrawerViewerWidgetController::~DebugDrawerViewerWidgetController()
{
}
void DebugDrawerViewerWidgetController::loadSettings(QSettings* settings)
{
}
void DebugDrawerViewerWidgetController::saveSettings(QSettings* settings)
{
}
void DebugDrawerViewerWidgetController::onInitComponent()
{
rootVisu = new SoSeparator;
rootVisu->ref();
enableMainWidgetAsync(false);
connect(widget.btnClearAll, SIGNAL(clicked()), this, SLOT(on_btnClearAll_clicked()), Qt::UniqueConnection);
}
void DebugDrawerViewerWidgetController::onConnectComponent()
{
// create the debugdrawer component
std::string debugDrawerComponentName = "GUIDebugDrawer_" + getName();
ARMARX_INFO << "Creating component " << debugDrawerComponentName;
debugDrawer = Component::create<DebugDrawerComponent>(properties, debugDrawerComponentName);
if (mutex3D)
{
//ARMARX_IMPORTANT << "mutex3d:" << mutex3D.get();
debugDrawer->setMutex(mutex3D);
}
else
{
ARMARX_ERROR << " No 3d mutex available...";
}
ArmarXManagerPtr m = getArmarXManager();
m->addObject(debugDrawer, false);
{
boost::recursive_mutex::scoped_lock lock(*mutex3D);
rootVisu->addChild(debugDrawer->getVisualization());
}
enableMainWidgetAsync(true);
}
SoNode *DebugDrawerViewerWidgetController::getScene()
{
return rootVisu;
}
void armarx::DebugDrawerViewerWidgetController::onExitComponent()
{
if (rootVisu)
{
rootVisu->removeAllChildren();
rootVisu->unref();
rootVisu = NULL;
}
}
void armarx::DebugDrawerViewerWidgetController::on_btnClearAll_clicked()
{
ARMARX_INFO << "Clearing visu";
if(debugDrawer)
{
debugDrawer->clearAll();
}
}
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::gui-plugins::DebugDrawerViewerWidgetController
* @author Mirko Waechter ( mirko dot waechter at kit dot edu )
* @date 2016
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#ifndef _ARMARX_RobotAPI_DebugDrawerViewer_WidgetController_H
#define _ARMARX_RobotAPI_DebugDrawerViewer_WidgetController_H
#include "ui_DebugDrawerViewerWidget.h"
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXGuiPlugin.h>
#include <ArmarXGui/libraries/ArmarXGuiBase/ArmarXComponentWidgetController.h>
#include <RobotAPI/components/DebugDrawer/DebugDrawerComponent.h>
#include <ArmarXCore/core/system/ImportExportComponent.h>
namespace armarx
{
/**
\page ArmarXGui-GuiPlugins-DebugDrawerViewer DebugDrawerViewer
\brief The DebugDrawerViewer listens on the DebugDrawer topic and visualizes all the data coming in.
This GUI only display the DebugDrawer content and nothing else.
The content is shown in the 3D Viewer Widget.
API Documentation \ref DebugDrawerViewerWidgetController
\see DebugDrawerViewerGuiPlugin
*/
/**
* \class DebugDrawerViewerWidgetController
* \brief DebugDrawerViewerWidgetController
*
* Detailed description
*/
class ARMARXCOMPONENT_IMPORT_EXPORT
DebugDrawerViewerWidgetController:
public armarx::ArmarXComponentWidgetController
{
Q_OBJECT
public:
/**
* Controller Constructor
*/
explicit DebugDrawerViewerWidgetController();
/**
* Controller destructor
*/
virtual ~DebugDrawerViewerWidgetController();
/**
* @see ArmarXWidgetController::loadSettings()
*/
virtual void loadSettings(QSettings* settings);
/**
* @see ArmarXWidgetController::saveSettings()
*/
virtual void saveSettings(QSettings* settings);
/**
* Returns the Widget name displayed in the ArmarXGui to create an
* instance of this class.
*/
virtual QString getWidgetName() const
{
return "DebugDrawerViewer";
}
/**
* \see armarx::Component::onInitComponent()
*/
virtual void onInitComponent();
/**
* \see armarx::Component::onConnectComponent()
*/
virtual void onConnectComponent();
void onExitComponent();
public slots:
/* QT slot declarations */
signals:
/* QT signal declarations */
private:
/**
* Widget Form
*/
Ui::DebugDrawerViewerWidget widget;
armarx::DebugDrawerComponentPtr debugDrawer;
SoSeparator* rootVisu;
// ArmarXWidgetController interface
public:
SoNode *getScene();
private slots:
void on_btnClearAll_clicked();
};
}
#endif
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