diff --git a/ImportPlugin/src/org/gephi/io/importer/plugin/file/Bundle.properties b/ImportPlugin/src/org/gephi/io/importer/plugin/file/Bundle.properties index 37b3f8450..560386865 100644 --- a/ImportPlugin/src/org/gephi/io/importer/plugin/file/Bundle.properties +++ b/ImportPlugin/src/org/gephi/io/importer/plugin/file/Bundle.properties @@ -27,6 +27,8 @@ importerNET_error_dataformat2 = Blank line detected at line {0} importerNET_error_dataformat3 = Unbalanced (or too many) quote marks at line {0} importerNET_error_dataformat4 = Vertex number ''{0}'' not in the range [1,{1}] importerNET_error_dataformat5 = Vertex coordinates conversion problem at line {0}. Must be float number. +importerNET_error_dataformat6 = Vertex size conversion problem at line {0}. Must be float number. +importerNET_error_dataformat7 = Edge weight parsing issue at line {0}. Must be a float number. importerGraphML_error_syntax1 = Syntax error, the file must start with the markup. importerGraphML_error_syntax2 = Syntax error, node ''{0}'' must be nested in a markup. diff --git a/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterPajek.java b/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterPajek.java index 2913b3e08..89748b889 100644 --- a/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterPajek.java +++ b/ImportPlugin/src/org/gephi/io/importer/plugin/file/ImporterPajek.java @@ -46,6 +46,7 @@ public class ImporterPajek implements FileImporter, LongTask { // Crayola colors used by Pajek private static final HashMap PAJEK_COLORS = new HashMap(); + static { PAJEK_COLORS.put("Apricot", 0xFDD9B5); PAJEK_COLORS.put("Aquamarine", 0x78DBE2); @@ -144,7 +145,6 @@ public class ImporterPajek implements FileImporter, LongTask { PAJEK_COLORS.put("YellowGreen", 0xC5E384); PAJEK_COLORS.put("YellowOrange", 0xFFB653); } - //Architecture private Reader reader; private LineNumberReader lineReader; @@ -308,6 +308,19 @@ private void readVertex(String curLine, int num_vertices) throws Exception { } } + //Size + if (i < parts.length - 1) { + try { + float size = Float.parseFloat(parts[i]); + + node.setSize(size); + + i++; + } catch (Exception e) { + report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat6", lineReader.getLineNumber()), Issue.Level.WARNING)); + } + } + // parse colors for (; i < parts.length - 1; i++) { // node's internal color @@ -315,6 +328,7 @@ private void readVertex(String curLine, int num_vertices) throws Exception { String colorName = parts[i + 1].replaceAll(" ", ""); // remove spaces from color's name so we can look it up Color color = getPajekColorFromName(colorName); node.setColor(color); + break; } } } @@ -383,7 +397,7 @@ private String readArcsOrEdges(String curLine, BufferedReader br) throws Excepti try { edgeWeight = new Float(st.nextToken()); } catch (Exception e) { - report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat5", lineReader.getLineNumber()), Issue.Level.WARNING)); + report.logIssue(new Issue(NbBundle.getMessage(ImporterPajek.class, "importerNET_error_dataformat7", lineReader.getLineNumber()), Issue.Level.WARNING)); } edge.setWeight(edgeWeight);