use of org.gephi.io.importer.api.ContainerUnloader in project gephi-plugins-bootcamp by gephi.
the class InitalPositionProcessor method process.
@Override
public void process() {
if (containers.length > 1) {
throw new RuntimeException("This processor can only handle single containers");
}
ContainerUnloader container = containers[0];
long hash = 0;
//Calculate the hash of the current graph
for (NodeDraft nodeDraft : container.getNodes()) {
String id = nodeDraft.getId();
hash += id.hashCode();
}
//Create a random with this seed
Random random = new Random(hash);
for (NodeDraft nodeDraft : container.getNodes()) {
nodeDraft.setX((float) ((0.01 + random.nextDouble()) * 1000) - 500);
nodeDraft.setY((float) ((0.01 + random.nextDouble()) * 1000) - 500);
}
//Call default processor
super.process();
}
use of org.gephi.io.importer.api.ContainerUnloader in project gephi by gephi.
the class AppendProcessor method process.
@Override
public void process() {
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
if (containers.length > 1) {
throw new RuntimeException("This processor can only handle single containers");
}
ContainerUnloader container = containers[0];
//Workspace
if (workspace == null) {
workspace = pc.getCurrentWorkspace();
if (workspace == null) {
//Append mode but no workspace
workspace = pc.newWorkspace(pc.getCurrentProject());
pc.openWorkspace(workspace);
processConfiguration(container, workspace);
}
}
if (container.getSource() != null) {
pc.setSource(workspace, container.getSource());
}
process(container, workspace);
//Clean
workspace = null;
graphModel = null;
containers = null;
progressTicket = null;
}
use of org.gephi.io.importer.api.ContainerUnloader in project gephi by gephi.
the class MergeProcessor method process.
@Override
public void process() {
if (containers.length <= 1) {
throw new RuntimeException("This processor can only handle multiple containers");
}
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
//Workspace
if (workspace == null) {
workspace = pc.newWorkspace(pc.getCurrentProject());
pc.openWorkspace(workspace);
}
processConfiguration(containers[0], workspace);
for (ContainerUnloader container : containers) {
process(container, workspace);
}
//Clean
workspace = null;
graphModel = null;
containers = null;
progressTicket = null;
}
use of org.gephi.io.importer.api.ContainerUnloader in project gephi by gephi.
the class MultiProcessor method process.
@Override
public void process() {
if (containers.length <= 1) {
throw new RuntimeException("This processor can only handle multiple containers");
}
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
for (ContainerUnloader container : containers) {
if (workspace != null) {
pc.openWorkspace(workspace);
} else {
workspace = pc.newWorkspace(pc.getCurrentProject());
}
processConfiguration(container, workspace);
process(container, workspace);
workspace = null;
}
//Clean
workspace = null;
graphModel = null;
containers = null;
progressTicket = null;
}
use of org.gephi.io.importer.api.ContainerUnloader in project gephi by gephi.
the class DefaultProcessor method process.
@Override
public void process() {
if (containers.length > 1) {
throw new RuntimeException("This processor can only handle single containers");
}
ContainerUnloader container = containers[0];
//Workspace
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
if (workspace == null) {
workspace = pc.newWorkspace(pc.getCurrentProject());
pc.openWorkspace(workspace);
}
processConfiguration(container, workspace);
if (container.getSource() != null) {
pc.setSource(workspace, container.getSource());
}
process(container, workspace);
//Clean
workspace = null;
graphModel = null;
containers = null;
progressTicket = null;
}
Aggregations