Package org.jmol.util

Examples of org.jmol.util.ColorEncoder


  }

  public ColorEncoder getColorEncoder(String colorScheme) {
    if (colorScheme == null || colorScheme.length() == 0)
      return propertyColorEncoder;
    ColorEncoder ce = new ColorEncoder(propertyColorEncoder);
    ce.currentPalette = ce.getColorScheme(colorScheme, false, true);
    return (ce.currentPalette == Integer.MAX_VALUE ? null : ce);
  }
View Full Code Here


    // color("$isosurfaceId", value) # color for a given mapped isosurface value
   
    String colorScheme = (args.length > 0 ? ScriptVariable.sValue(args[0])
        : "");
    boolean isIsosurface = colorScheme.startsWith("$");
    ColorEncoder ce = (isIsosurface ? null : viewer.getColorEncoder(colorScheme));
    if (!isIsosurface && ce == null)
      return addX("");
    float lo = (args.length > 1 ? ScriptVariable.fValue(args[1])
        : Float.MAX_VALUE);
    float hi = (args.length > 2 ? ScriptVariable.fValue(args[2])
        : Float.MAX_VALUE);
    float value = (args.length > 3 ? ScriptVariable.fValue(args[3])
        : Float.MAX_VALUE);
    boolean getValue = (value != Float.MAX_VALUE || lo != Float.MAX_VALUE
        && hi == Float.MAX_VALUE);
    boolean haveRange = (hi != Float.MAX_VALUE);
    if (!haveRange && colorScheme.length() == 0) {
      value = lo;
      float[] range = viewer.getCurrentColorRange();
      lo = range[0];
      hi = range[1];
    }
    if (isIsosurface) {
      // isosurface color scheme     
      String id = colorScheme.substring(1);
      Object[] data = new Object[] { id, null};
      if (!viewer.getShapeProperty(JmolConstants.SHAPE_ISOSURFACE, "colorEncoder", data))
        return addX("");
      ce = (ColorEncoder) data[1];
    } else {
      ce.setRange(lo, hi, lo > hi);
    }
    Map key = ce.getColorKey();
    if (getValue)
      return addX(Graphics3D.colorPointFromInt2(ce
          .getArgb(hi == Float.MAX_VALUE ? lo : value)));
    return addX(ScriptVariable.getVariable(key));
  }
View Full Code Here

              viewer.setCurrentColorRange((float[]) data, bsSelected);
            }
            if (isIsosurface) {
              checkLength(index);
              isColor = false;
              ColorEncoder ce = viewer.getColorEncoder(scheme);
              if (ce == null)
                return;
              ce.isTranslucent = (isTranslucent && translucentLevel == Float.MAX_VALUE);
              ce.setRange(min, max, min > max);
              if (max == Float.MAX_VALUE)
                ce.hi = max;
              setShapeProperty(shapeType, "remapColor", ce);
              showString(getIsosurfaceDataRange(shapeType, ""));
              if (translucentLevel == Float.MAX_VALUE)
View Full Code Here

      addShapeProperty(propertyList, "colorDiscrete", discreteColixes);
    } else if ("sets".equals(colorScheme)) {
      addShapeProperty(propertyList, "setColorScheme",
          isColorSchemeTranslucent ? Boolean.TRUE : Boolean.FALSE);
    } else if (colorScheme != null) {
      ColorEncoder ce = viewer.getColorEncoder(colorScheme);
      if (ce != null) {
        ce.isTranslucent = isColorSchemeTranslucent;
        ce.hi = Float.MAX_VALUE;
        addShapeProperty(propertyList, "remapColor", ce);
      }
View Full Code Here

          .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 (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 "
View Full Code Here

TOP

Related Classes of org.jmol.util.ColorEncoder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.