Change non numeric values to all nodes from graph instead of rows
@@ -288,15 +288,18 @@ public class FeatureNetworkPane extends NetworkPane {
// for non numeric values - give each Object an index
final Map<String, Integer> sizeValueMap = nodeAttSize.isNumber() ? null
: attributeCategoryValuesMap
- .computeIfAbsent(nodeAttSize, att -> indexAllValues(rows, nodeAttSize));
+ .computeIfAbsent(nodeAttSize, att -> indexAllValues(nodeAttSize));
final int numSizeValues = sizeValueMap == null ? 0 : sizeValueMap.size();
final Map<String, Integer> colorValueMap =
nodeAttColor.isNumber() ? null : attributeCategoryValuesMap
- .computeIfAbsent(nodeAttColor, att -> indexAllValues(rows, nodeAttColor));
+ .computeIfAbsent(nodeAttColor, att -> indexAllValues(nodeAttColor));
final int numColorValues = colorValueMap == null ? 0 : colorValueMap.size();
for (Node node : graph) {
+ NodeType type = (NodeType) node.getAttribute(NodeAtt.TYPE.toString());
+
+ if (type == NodeType.ION_FEATURE || type == NodeType.SINGLE_FEATURE) {
// label
try {
// make colors a gradient
@@ -318,7 +321,8 @@ public class FeatureNetworkPane extends NetworkPane {
node.setAttribute("ui.class", "GRADIENT");
// differentiate between numeric values and a list of discrete values
if (colorValueRange != null) {
- final float interpolated = interpolateIntensity(Float.valueOf(colorValue.toString()),
+ final float interpolated = interpolateIntensity(
+ Float.parseFloat(colorValue.toString()),
colorValueRange.lowerEndpoint(), colorValueRange.upperEndpoint());
node.setAttribute("ui.color", interpolated);
} else if (colorValueMap != null) {
@@ -341,7 +345,7 @@ public class FeatureNetworkPane extends NetworkPane {
// differentiate between numeric values and a list of discrete values
float size = 0;
if (sizeValueRange != null) {
- size = interpolateIntensity(Float.valueOf(sizeValue.toString()),
+ size = interpolateIntensity(Float.parseFloat(sizeValue.toString()),
sizeValueRange.lowerEndpoint(),
sizeValueRange.upperEndpoint());
} else if (sizeValueMap != null) {
@@ -359,20 +363,20 @@ public class FeatureNetworkPane extends NetworkPane {
}
}
}
+ }
/**
* Index all objects found in all rows for an attribute
*
- * @param rows all rows in the network
* @param attribute the node attribute for this row
* @return map of all objects found and their idexes in their original order
*/
- private Map<String, Integer> indexAllValues(FeatureListRow[] rows, NodeAtt attribute) {
+ private Map<String, Integer> indexAllValues(NodeAtt attribute) {
Map<String, Integer> map = new HashMap<>();
int currentIndex = 0;
- for (FeatureListRow row : rows) {
+ for (Node node : graph) {
try {
- String object = attribute.getValueString(row);
+ String object = node.getAttribute(attribute.toString()).toString();
if (object == null) {
continue;
}
@@ -397,7 +401,7 @@ public class FeatureNetworkPane extends NetworkPane {
if (object == null) {
continue;
}
- float value = Float.valueOf(object.toString());
+ float value = Float.parseFloat(object.toString());
if (value < min) {
min = value;
}
