public ColourScheme createColourSchemeFromString(EDataType eDataType, String initialValue) {
String[] parts = initialValue.split(";"); //$NON-NLS-1$
if (parts.length != 4) {
//something is wrong...
BrewerPalette palette = PlatformGIS.getColorBrewer().getPalette("Dark2"); //$NON-NLS-1$
return new ColourScheme(palette, 0);
}
String[] strap = parts[2].split(","); //$NON-NLS-1$
BrewerPalette palette = PlatformGIS.getColorBrewer().getPalette(parts[0]);
HashMap<Integer, Integer> colourMapping = new HashMap<Integer, Integer>();
for (int i = 0; i < strap.length; i++) {
colourMapping.put(i, Integer.parseInt(strap[i]));
}
String[] strap2 = parts[3].split(","); //$NON-NLS-1$
HashMap<String, Integer> idMapping = new HashMap<String, Integer>();
for (int i = 0; i < strap2.length; i++) {
idMapping.put(strap2[i], Integer.parseInt(strap2[++i]));
}
ColourScheme scheme = new ColourScheme(palette, colourMapping, idMapping, strap.length,
Integer.parseInt(parts[1]));
return scheme;
}