Skip to content
Snippets Groups Projects
Commit f29a7c33 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Add pyqgv plugin.

parent 4c81f2fc
No related branches found
No related tags found
No related merge requests found
...@@ -132,6 +132,7 @@ ADD_SUBDIRECTORY(src) ...@@ -132,6 +132,7 @@ ADD_SUBDIRECTORY(src)
IF(NOT CLIENT_ONLY) IF(NOT CLIENT_ONLY)
ADD_SUBDIRECTORY(src/gui) ADD_SUBDIRECTORY(src/gui)
ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(pyplugins) ADD_SUBDIRECTORY(pyplugins)
ADD_SUBDIRECTORY(blender) ADD_SUBDIRECTORY(blender)
ADD_SUBDIRECTORY(examples EXCLUDE_FROM_ALL) ADD_SUBDIRECTORY(examples EXCLUDE_FROM_ALL)
......
#
# Copyright (c) 2018 CNRS
# Authors: Joseph Mirabel
#
#
# This file is part of gepetto-viewer-corba
# gepetto-viewer-corba is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# gepetto-viewer-corba 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 Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# gepetto-viewer-corba If not, see
# <http://www.gnu.org/licenses/>.
#ADD_SUBDIRECTORY(plugin-skeleton)
IF(PYTHONQT_FOUND)
ADD_OPTIONAL_DEPENDENCY("QGVCore")
SET(BUILD_PY_QGV ${QGVCORE_FOUND}
CACHE BOOL "Build PyQGV plugin")
ENDIF(PYTHONQT_FOUND)
IF(BUILD_PY_QGV)
ADD_SUBDIRECTORY(pyqgv)
ENDIF(BUILD_PY_QGV)
# Copyright (c) 2018 CNRS
# Authors: Joseph Mirabel
#
#
# This file is part of gepetto-viewer-corba
# gepetto-viewer-corba is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
# gepetto-viewer-corba 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 Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# gepetto-viewer-corba If not, see
# <http://www.gnu.org/licenses/>.
SET(PLUGIN_NAME pyqgv)
SET(${PLUGIN_NAME}_HEADERS_NO_MOC
)
SET(${PLUGIN_NAME}_HEADERS
plugin.hh
decorator.hh
)
SET(${PLUGIN_NAME}_FORMS
)
SET(${PLUGIN_NAME}_RESOURCES
)
QT4_WRAP_CPP(${PLUGIN_NAME}_HEADERS_MOC ${${PLUGIN_NAME}_HEADERS})
QT4_WRAP_UI(${PLUGIN_NAME}_FORMS_HEADERS ${${PLUGIN_NAME}_FORMS})
QT4_ADD_RESOURCES(${PLUGIN_NAME}_RESOURCES_RCC ${${PLUGIN_NAME}_RESOURCES})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${PYTHON_INCLUDE_PATH})
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)
SET (${PLUGIN_NAME}_SOURCES
plugin.cc
decorator.cc
)
ADD_LIBRARY(${PLUGIN_NAME} SHARED ${${PLUGIN_NAME}_SOURCES}
${${PLUGIN_NAME}_HEADERS_NO_MOC}
${${PLUGIN_NAME}_HEADERS_MOC}
${${PLUGIN_NAME}_FORMS_HEADERS}
${${PLUGIN_NAME}_RESOURCES_RCC}
)
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${QT_LIBRARIES} ${PYTHONQT_LIBRARIES})
PKG_CONFIG_USE_DEPENDENCY(${PLUGIN_NAME} "QGVCore")
# Uncomment to install
INSTALL(TARGETS ${PLUGIN_NAME} DESTINATION lib/gepetto-gui-plugins)
// Copyright (c) 2018, Joseph Mirabel
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
//
// This file is part of gepetto-viewer-corba.
// gepetto-viewer-corba is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// gepetto-viewer-corba 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 Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>.
#include <decorator.hh>
#include <PythonQt/PythonQt.h>
#include <QGVScene.h>
// ------- QGVScene ------------------------------------------- //
QGVScene* QGVDecorator::new_QGVScene(const QString &name) { return new QGVScene(name); }
QGVScene* QGVDecorator::new_QGVScene(const QString &name, QObject *parent) { return new QGVScene(name, parent); }
void QGVDecorator::delete_QGVScene(QGVScene* s) { delete s; }
void QGVDecorator::setGraphAttribute(QGVScene* s, const QString &name, const QString &value) { s->setGraphAttribute(name, value); }
void QGVDecorator::setNodeAttribute (QGVScene* s, const QString &name, const QString &value) { s->setNodeAttribute (name, value); }
void QGVDecorator::setEdgeAttribute (QGVScene* s, const QString &name, const QString &value) { s->setEdgeAttribute (name, value); }
QGVNode* QGVDecorator::addNode(QGVScene* s, const QString& label) { return s->addNode (label); }
QGVEdge* QGVDecorator::addEdge(QGVScene* s, QGVNode* source, QGVNode* target) { return s->addEdge (source, target); }
QGVEdge* QGVDecorator::addEdge(QGVScene* s, QGVNode* source, QGVNode* target, const QString& label) { return s->addEdge (source, target, label); }
// QGVSubGraph* QGVDecorator::addSubGraph(const QString& name, bool cluster=true);
void QGVDecorator::setRootNode(QGVScene* s, QGVNode *node) { s->setRootNode (node); }
// void QGVDecorator::setNodePositionAttribute();
void QGVDecorator::loadLayout (QGVScene* s, const QString &text) { s->loadLayout(text); }
void QGVDecorator::applyLayout(QGVScene* s, const QString &algorithm) { s->applyLayout(algorithm); }
void QGVDecorator::render (QGVScene* s, const QString &algorithm) { s->render(algorithm); }
void QGVDecorator::render (QGVScene* s, const QString &algorithm, const QString file) { s->render(algorithm, file); }
void QGVDecorator::freeLayout (QGVScene* s) { s->freeLayout(); }
void QGVDecorator::clear (QGVScene* s) { s->clear(); }
// ------- QGVScene ------------------------------------------- //
void registerQGV ()
{
PythonQt::self()->addDecorators (new QGVDecorator ());
PythonQt::self()->registerCPPClass ("QGVScene", "QGraphicsScene", "qgv");
PythonQt::self()->registerCPPClass ("QGVNode" , "QGraphicsItem" , "qgv");
PythonQt::self()->registerCPPClass ("QGVEdge" , "QGraphicsItem" , "qgv");
}
// Copyright (c) 2018, Joseph Mirabel
// Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
//
// This file is part of gepetto-viewer-corba.
// gepetto-viewer-corba is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// gepetto-viewer-corba 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 Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// gepetto-viewer-corba. If not, see <http://www.gnu.org/licenses/>.
#include "qgv.h"
#include <QObject>
class QGVScene;
class QGVNode;
class QGVEdge;
class QGVCORE_EXPORT QGVDecorator : public QObject
{
Q_OBJECT
public slots:
// ------- QGVScene ------------------------------------------- //
QGVScene* new_QGVScene(const QString &name);
QGVScene* new_QGVScene(const QString &name, QObject *parent);
void delete_QGVScene(QGVScene* s);
void setGraphAttribute(QGVScene* s, const QString &name, const QString &value);
void setNodeAttribute (QGVScene* s, const QString &name, const QString &value);
void setEdgeAttribute (QGVScene* s, const QString &name, const QString &value);
QGVNode* addNode(QGVScene* s, const QString& label);
QGVEdge* addEdge(QGVScene* s, QGVNode* source, QGVNode* target);
QGVEdge* addEdge(QGVScene* s, QGVNode* source, QGVNode* target, const QString& label);
// QGVSubGraph* addSubGraph(const QString& name, bool cluster=true);
void setRootNode(QGVScene* s, QGVNode *node);
// void setNodePositionAttribute();
void loadLayout (QGVScene* s, const QString &text);
void applyLayout(QGVScene* s, const QString &algorithm);
void render (QGVScene* s, const QString &algorithm);
void render (QGVScene* s, const QString &algorithm, const QString file);
void freeLayout (QGVScene* s);
void clear (QGVScene* s);
// ------- QGVScene ------------------------------------------- //
};
void registerQGV ();
// Copyright (c) 2018 CNRS
// Authors: Joseph Mirabel
//
//
// This file is part of gepetto-viewer-corba
// gepetto-viewer-corba is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// gepetto-viewer-corba 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 Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// gepetto-viewer-corba If not, see
// <http://www.gnu.org/licenses/>.
#include <plugin.hh>
#include <decorator.hh>
void PyQGV::init() {
registerQGV();
}
Q_EXPORT_PLUGIN2 (pyqgv, PyQGV)
// Copyright (c) 2018 CNRS
// Authors: Joseph Mirabel
//
//
// This file is part of gepetto-viewer-corba
// gepetto-viewer-corba is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// gepetto-viewer-corba 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 Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// gepetto-viewer-corba If not, see
// <http://www.gnu.org/licenses/>.
#include <QObject>
#include <gepetto/gui/plugin-interface.hh>
class PyQGV : public QObject, public gepetto::gui::PluginInterface {
Q_OBJECT
Q_INTERFACES (gepetto::gui::PluginInterface)
public:
QString name () const { return QString("PyQGV"); }
void init();
};
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