This example shows a simple graph import plug-in.It details the different functions and possibilities of a Graph import plug-in.
#include <string>
#include <tulip/TulipPluginHeaders.h>
using namespace std;
class CliqueImport : public tlp::ImportModule {
public:
PLUGININFORMATION(
"Clique",
"Tulip Team",
"05/10/2012",
"Clique Import Plugin",
"1.0",
"Graph")
~CliqueImport();
};
const char *nodeCountDescription = "How many nodes the clique will contain";
addInParameter<unsigned int>("nodeCount", nodeCountDescription, "5");
addDependency("Circular", "1.1");
}
CliqueImport::~CliqueImport() {}
unsigned int nodeCount = 5;
dataSet->get("nodeCount", nodeCount);
for (unsigned int i = 0; i < nodeCount; ++i) {
}
for (auto current : graph->nodes()) {
for (auto other : graph->nodes()) {
if (current != other) {
graph->addEdge(current, other);
}
}
}
LayoutProperty *layout = graph->getProperty<LayoutProperty>("viewLayout");
string message;
graph->applyPropertyAlgorithm("Circular", layout, message);
return true;
}
virtual node addNode()=0
Adds a new node in the graph and returns it. This node is also added in all the ancestor graphs.
Contains runtime parameters for a plugin.
Graph * importGraph(const std::string &format, DataSet &dataSet, PluginProgress *progress=nullptr, Graph *newGraph=nullptr)
Imports a graph using the specified import plugin with the parameters stored in the DataSet.
#define PLUGIN(C)
Register a plugin into the plugin system. This macro is mandatory in order to register a plugin into ...
#define PLUGININFORMATION(NAME, AUTHOR, DATE, INFO, RELEASE, GROUP)
Declare meta-information for a plugin This is an helper macro that defines every function related to ...