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 =
HTML_HELP_OPEN() \
HTML_HELP_DEF( "type", "unsigned int" ) \
HTML_HELP_BODY() \
"How many nodes the clique will contain" \
HTML_HELP_CLOSE();
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) {
}
forEach(current, graph->getNodes()) {
forEach(other, graph->getNodes()) {
if(current != other) {
graph->addEdge(current, other);
}
}
}
string message;
graph->applyPropertyAlgorithm("Circular", layout, message);
return true;
}