@Override protected String readColorData() { if (!jvxlDataIsColorMapped) return ""; // overloads SurfaceReader // standard jvxl file read for color int vertexCount = jvxlData.vertexCount = meshData.vertexCount; // the problem is that the new way to read data in Marching Cubes // is to ignore all points that are NaN. But then we also have to // remove those points from the color string. short[] colixes = meshData.vertexColixes; float[] vertexValues = meshData.vertexValues; /* * haveReadColorData? = (isJvxl ? jvxlColorDataRead : ""); if (isJvxl && strValueTemp.length() == 0) { Logger .error("You cannot use JVXL data to map onto OTHER data, because it only contains the data for one surface. Use ISOSURFACE \"file.jvxl\" not ISOSURFACE .... MAP \"file.jvxl\"."); return ""; } */ if ("none".equals(jvxlColorEncodingRead)) { jvxlData.vertexColors = new int[vertexCount]; int[] nextc = new int[1]; int n = PT.parseIntNext(jvxlColorDataRead, nextc); n = Math.min(n, vertexCount); String[] tokens = PT.getTokens(jvxlColorDataRead.substring(nextc[0])); boolean haveTranslucent = false; float trans = jvxlData.translucency; int lastColor = 0; for (int i = 0; i < n; i++) // colix will be one of 8 shades of translucent if A in ARGB is not FF. try { int c = getColor(tokens[i]); if (c == 0) c = lastColor; else lastColor = c; colixes[i] = C.getColixTranslucent(jvxlData.vertexColors[i] = c); if (C.isColixTranslucent(colixes[i])) haveTranslucent = true; else if (trans != 0) colixes[i] = C.getColixTranslucent3(colixes[i], true, trans); } catch (Exception e) { Logger.info("JvxlXmlReader: Cannot interpret color code: " + tokens[i]); // ignore this color if parsing error } if (haveTranslucent && trans == 0) { // set to show in pass2 jvxlData.translucency = 0.5f; } return "-"; } if (params.colorEncoder == null) params.colorEncoder = new ColorEncoder(null); params.colorEncoder.setColorScheme(null, false); params.colorEncoder.setRange( params.valueMappedToRed, params.valueMappedToBlue, params.isColorReversed); Logger.info( "JVXL reading color data mapped min/max: " + params.mappedDataMin + "/" + params.mappedDataMax + " for " + vertexCount + " vertices." + " using encoding keys " + colorFractionBase + " " + colorFractionRange); Logger.info( "mapping red-->blue for " + params.valueMappedToRed + " to " + params.valueMappedToBlue + " colorPrecision:" + jvxlData.isJvxlPrecisionColor); boolean getValues = (Float.isNaN(valueMin)); if (getValues) setValueMinMax(); float contourPlaneMinimumValue = Float.MAX_VALUE; float contourPlaneMaximumValue = -Float.MAX_VALUE; if (colixes == null || colixes.length < vertexCount) meshData.vertexColixes = colixes = new short[vertexCount]; // hasColorData = true; short colixNeg = 0, colixPos = 0; if (params.colorBySign) { colixPos = C.getColix(params.isColorReversed ? params.colorNeg : params.colorPos); colixNeg = C.getColix(params.isColorReversed ? params.colorPos : params.colorNeg); } int vertexIncrement = meshData.vertexIncrement; // here's the problem: we are assuming here that vertexCount == nPointsRead boolean needContourMinMax = (params.mappedDataMin == Float.MAX_VALUE); for (int i = 0; i < vertexCount; i += vertexIncrement) { float value; if (getValues) value = vertexValues[i] = getNextValue(); else value = vertexValues[i]; if (needContourMinMax) { if (value < contourPlaneMinimumValue) contourPlaneMinimumValue = value; if (value > contourPlaneMaximumValue) contourPlaneMaximumValue = value; } } if (needContourMinMax) { params.mappedDataMin = contourPlaneMinimumValue; params.mappedDataMax = contourPlaneMaximumValue; } if (jvxlData.colorScheme != null) for (int i = 0; i < vertexCount; i += vertexIncrement) { float value = vertexValues[i]; // note: these are just default colorings // orbital color had a bug through 11.2.6/11.3.6 if (marchingSquares != null && params.isContoured) { marchingSquares.setContourData(i, value); continue; } short colix = (!params.colorBySign ? params.colorEncoder.getColorIndex(value) : (params.isColorReversed ? value > 0 : value <= 0) ? colixNeg : colixPos); colixes[i] = C.getColixTranslucent3(colix, true, jvxlData.translucency); } return jvxlColorDataRead + "\n"; }