private String getMoState(int modelIndex) { strID = getId(modelIndex); if (!getSettings(strID)) return ""; SB s = new SB(); int modelCount = vwr.getModelCount(); if (modelCount > 1) appendCmd(s, "frame " + vwr.getModelNumberDotted(modelIndex)); if (moCutoff != null) appendCmd(s, "mo cutoff " + (sg.getIsPositiveOnly() ? "+" : "") + moCutoff); if (moScale != null) appendCmd(s, "mo scale " + moScale); if (moMonteCarloCount != null) appendCmd(s, "mo points " + moMonteCarloCount + " " + moRandomSeed); if (moResolution != null) appendCmd(s, "mo resolution " + moResolution); if (moPlane != null) appendCmd( s, "mo plane {" + moPlane.x + " " + moPlane.y + " " + moPlane.z + " " + moPlane.w + "}"); if (moTitleFormat != null) appendCmd(s, "mo titleFormat " + PT.esc(moTitleFormat)); // the following is a correct object==object test if (moColorNeg != null) appendCmd( s, "mo color " + Escape.escapeColor(moColorNeg.intValue()) + (moColorNeg.equals(moColorPos) ? "" : " " + Escape.escapeColor(moColorPos.intValue()))); if (moSlab != null) { if (thisMesh.slabOptions != null) appendCmd(s, thisMesh.slabOptions.toString()); if (thisMesh.jvxlData.slabValue != Integer.MIN_VALUE) appendCmd(s, "mo slab " + thisMesh.jvxlData.slabValue); } if (moLinearCombination == null) { appendCmd(s, "mo " + (moSquareData == Boolean.TRUE ? "squared " : "") + moNumber); } else { appendCmd( s, "mo " + QS.getMOString(moLinearCombination) + (moSquareLinear == Boolean.TRUE ? " squared" : "")); } if (moTranslucency != null) appendCmd(s, "mo translucent " + moTranslucentLevel); appendCmd(s, ((IsosurfaceMesh) thisModel.get("mesh")).getState("mo")); return s.toString(); }
protected void jvxlDecodeContourData(JvxlData jvxlData, String data) throws Exception { List<List<Object>> vs = new List<List<Object>>(); SB values = new SB(); SB colors = new SB(); int pt = -1; jvxlData.vContours = null; if (data == null) return; while ((pt = data.indexOf("<jvxlContour", pt + 1)) >= 0) { List<Object> v = new List<Object>(); String s = xr.getXmlData("jvxlContour", data.substring(pt), true, false); float value = parseFloatStr(XmlReader.getXmlAttrib(s, "value")); values.append(" ").appendF(value); int color = getColor(XmlReader.getXmlAttrib(s, "color")); short colix = C.getColix(color); colors.append(" ").append(Escape.escapeColor(color)); String fData = JvxlCoder.jvxlDecompressString(XmlReader.getXmlAttrib(s, "data")); BS bs = JvxlCoder.jvxlDecodeBitSet(xr.getXmlData("jvxlContour", s, false, false)); int n = bs.length(); IsosurfaceMesh.setContourVector(v, n, bs, value, colix, color, SB.newS(fData)); vs.addLast(v); } int n = vs.size(); if (n > 0) { jvxlData.vContours = AU.createArrayOfArrayList(n); // 3D contour values and colors jvxlData.contourColixes = params.contourColixes = new short[n]; jvxlData.contourValues = params.contoursDiscrete = new float[n]; for (int i = 0; i < n; i++) { jvxlData.vContours[i] = vs.get(i); jvxlData.contourValues[i] = ((Float) jvxlData.vContours[i].get(2)).floatValue(); jvxlData.contourColixes[i] = ((short[]) jvxlData.vContours[i].get(3))[0]; } jvxlData.contourColors = C.getHexCodes(jvxlData.contourColixes); Logger.info("JVXL read: " + n + " discrete contours"); Logger.info("JVXL read: contour values: " + values); Logger.info("JVXL read: contour colors: " + colors); } }