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 tlp;
using namespace std;
class CliqueImport: public tlp::ImportModule {
public:
PLUGININFORMATIONS(
"Clique",
"Tulip Team",
"05/10/2012",
"Clique Import Plugin",
"1.0",
"Graph")
~CliqueImport();
};
const char * nodeCountDescription =
HTML_HELP_OPEN() \
HTML_HELP_DEF( "type", "unsigned int" ) \
HTML_HELP_BODY() \
"How many nodes the clique will contain" \
HTML_HELP_CLOSE();
CliqueImport::CliqueImport(tlp::
PluginContext* context):ImportModule(context) {
addInParameter<uint>("nodeCount", nodeCountDescription, "5");
addDependency("Circular", "1.1");
}
CliqueImport::~CliqueImport() {
}
uint nodeCount = 5;
dataSet->get("nodeCount", nodeCount);
for(uint i = 0; i < nodeCount; ++i) {
}
forEach(current, graph->getNodes()) {
forEach(other, graph->getNodes()) {
if(current != other) {
graph->addEdge(current, other);
}
}
}
string message;
graph->applyPropertyAlgorithm("Circular", layout, message);
return true;
}