use of org.gephi.io.importer.api.Issue in project gephi by gephi.
the class ImporterTLP method parseEdge.
private void parseEdge(String[] tokens, int cptLine) {
if (tokens.length != 4) {
report.logIssue(new Issue(NbBundle.getMessage(ImporterGDF.class, "importerTPL_error_dataformat1", cptLine), Issue.Level.WARNING));
}
String id = tokens[1];
EdgeDraft edge = container.factory().newEdgeDraft(id);
NodeDraft source = container.getNode(tokens[2]);
NodeDraft target = container.getNode(tokens[3]);
edge.setSource(source);
edge.setTarget(target);
container.addEdge(edge);
}
use of org.gephi.io.importer.api.Issue in project gephi by gephi.
the class ImporterVNA method addEdge.
private void addEdge(String[] edgeData) {
NodeDraft sourceNode;
if (!container.nodeExists(edgeData[0])) {
sourceNode = container.factory().newNodeDraft(edgeData[0]);
container.addNode(sourceNode);
} else {
sourceNode = container.getNode(edgeData[0]);
}
NodeDraft targetNode;
if (!container.nodeExists(edgeData[1])) {
targetNode = container.factory().newNodeDraft(edgeData[1]);
container.addNode(targetNode);
} else {
targetNode = container.getNode(edgeData[1]);
}
EdgeDraft edge = container.factory().newEdgeDraft();
edge.setSource(sourceNode);
edge.setTarget(targetNode);
int i = 0;
try {
for (i = 2; i < edgeData.length; i++) {
switch(tieAttributes[i]) {
case EDGE_STRENGTH:
float weight = Float.parseFloat(edgeData[i]);
if (edgeWidthFunction != null) {
weight = edgeWidthFunction.computeTransformation(weight);
}
edge.setWeight(weight);
break;
case OTHER:
edge.parseAndSetValue(tieDataColumns[i].getId(), edgeData[i]);
break;
}
}
} catch (NumberFormatException e) {
report.logIssue(new Issue("Error parsing numerical value at '" + edgeData[i] + "'.", Issue.Level.WARNING));
}
container.addEdge(edge);
}
use of org.gephi.io.importer.api.Issue in project gephi by gephi.
the class ImporterVNA method addNodeProperties.
private void addNodeProperties(String[] nodeProperties) {
NodeDraft node;
String id = nodeProperties[0];
if (!container.nodeExists(id)) {
node = container.factory().newNodeDraft(id);
container.addNode(node);
} else {
node = container.getNode(id);
}
int i = 0;
try {
for (i = 1; i < nodeProperties.length; i++) {
switch(nodeDataAttributes[i]) {
case NODE_X:
node.setX(Float.parseFloat(nodeProperties[i]));
break;
case NODE_Y:
node.setY(Float.parseFloat(nodeProperties[i]));
break;
case NODE_COLOR:
node.setColor(nodeProperties[i]);
break;
case NODE_SIZE:
node.setSize(Float.parseFloat(nodeProperties[i]));
break;
case NODE_SHORT_LABEL:
node.setLabel(nodeProperties[i]);
break;
}
}
} catch (NumberFormatException e) {
report.logIssue(new Issue("Error parsing numerical value at '" + nodeProperties[i] + "'.", Issue.Level.WARNING));
}
}
use of org.gephi.io.importer.api.Issue in project gephi by gephi.
the class ElementDraftImpl method setColor.
@Override
public void setColor(String color) {
Color cl = ImportUtils.parseColor(color);
if (cl != null) {
setColor(cl);
} else {
String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_ColorParse", color, id);
container.getReport().logIssue(new Issue(message, Issue.Level.WARNING));
}
}
use of org.gephi.io.importer.api.Issue in project gephi by gephi.
the class ElementDraftImpl method addTimestamps.
@Override
public void addTimestamps(String timestamps) {
if (!container.getTimeRepresentation().equals(TimeRepresentation.TIMESTAMP)) {
String message = NbBundle.getMessage(ElementDraftImpl.class, "ElementDraftException_NotTimestampRepresentation", id);
container.getReport().logIssue(new Issue(message, Issue.Level.SEVERE));
return;
}
TimestampSet t = (TimestampSet) AttributeUtils.parse(timestamps, TimestampSet.class);
if (timeSet == null) {
timeSet = t;
} else {
for (Double d : t.toArray()) {
timeSet.add(d);
}
}
}
Aggregations