Search in sources :

Example 1 with ColorModel

use of ffx.potential.bonded.RendererCache.ColorModel in project ffx by mjschnie.

the class GraphicsCanvas method setColorModel.

/**
 * **********************************************************************
 */
// Color Commands
/**
 * Operates on the Active nodes.
 *
 * @param model String
 */
public void setColorModel(String model) {
    if (!RendererCache.colorModelHash.containsKey(model.toUpperCase())) {
        return;
    }
    RendererCache.ColorModel colorModel = RendererCache.colorModelHash.get(model.toUpperCase());
    ArrayList<MSNode> active = mainPanel.getHierarchy().getActiveNodes();
    if (active == null) {
        return;
    }
    renderer.arm(active, false, false, null, true, colorModel);
}
Also used : MSNode(ffx.potential.bonded.MSNode) ColorModel(ffx.potential.bonded.RendererCache.ColorModel) RendererCache(ffx.potential.bonded.RendererCache)

Example 2 with ColorModel

use of ffx.potential.bonded.RendererCache.ColorModel in project ffx by mjschnie.

the class ModelingShell method initContext.

/**
 * Initialize access to Force Field X variables and methods from with the
 * Shell.
 */
private void initContext() {
    setVariable("dat", mainPanel.getHierarchy());
    setVariable("cmd", mainPanel);
    setVariable("vis", mainPanel.getGraphics3D());
    setVariable("sh", this);
    setVariable("active", mainPanel.getHierarchy().getActive());
    setVariable("logger", logger);
    // Timer
    setVariable("time", new MethodClosure(this, "time"));
    // File
    setVariable("open", new MethodClosure(mainPanel, "openWait"));
    setVariable("convertWait", new MethodClosure(mainPanel, "convertWait"));
    setVariable("save", new MethodClosure(mainPanel, "saveAsXYZ"));
    setVariable("saveAsXYZ", new MethodClosure(mainPanel, "saveAsXYZ"));
    setVariable("saveAsP1", new MethodClosure(mainPanel, "saveAsP1"));
    setVariable("saveAsPDB", new MethodClosure(mainPanel, "saveAsPDB"));
    setVariable("close", new MethodClosure(mainPanel, "closeWait"));
    setVariable("closeAll", new MethodClosure(mainPanel, "closeAll"));
    // Select
    setVariable("select", new MethodClosure(this, "select"));
    // Display and View menus.
    if (!headless) {
        GraphicsCanvas graphics = mainPanel.getGraphics3D();
        // Display
        int index = 0;
        for (ViewModel view : ViewModel.values()) {
            setVariable(view.name(), view);
            index++;
            if (index > 8) {
                break;
            }
        }
        setVariable("view", new MethodClosure(graphics, "viewWait"));
        // Color
        index = 0;
        for (ColorModel color : ColorModel.values()) {
            setVariable(color.name(), color);
            index++;
            if (index > 6) {
                break;
            }
        }
        setVariable("color", new MethodClosure(graphics, "colorWait"));
    }
    // Algorithms
    setVariable("returnEnergy", new MethodClosure(this, "returnEnergy"));
    setVariable("energy", new MethodClosure(this, "energy"));
    setVariable("analyze", new MethodClosure(this, "analyze"));
    setVariable("minimize", new MethodClosure(this, "minimize"));
    setVariable("minimize_2", new MethodClosure(this, "minimize_2"));
    setVariable("md", new MethodClosure(this, "md"));
    setVariable("potential", new MethodClosure(this, "potential"));
    setVariable("poledit", new MethodClosure(this, "poledit"));
    setVariable("superpose", new MethodClosure(this, "superpose"));
    // Obtain UIUtils object
    setVariable("getAlgorithmUtils", new MethodClosure(this, "getUIAlgorithmUtils"));
    setVariable("getPotentialsUtils", new MethodClosure(this, "getUIPotentialsUtils"));
}
Also used : ColorModel(ffx.potential.bonded.RendererCache.ColorModel) ViewModel(ffx.potential.bonded.RendererCache.ViewModel) MethodClosure(org.codehaus.groovy.runtime.MethodClosure) Point(java.awt.Point)

Example 3 with ColorModel

use of ffx.potential.bonded.RendererCache.ColorModel in project ffx by mjschnie.

the class GraphicsCanvas method colorWait.

/**
 * <p>
 * colorWait</p>
 *
 * @param colorMode a {@link java.lang.String} object.
 */
public void colorWait(String colorMode) {
    if (colorMode == null) {
        logger.info("Null color.");
        return;
    }
    try {
        ColorModel colorModel = ColorModel.valueOf(colorMode.toUpperCase());
        colorWait(colorModel);
    } catch (Exception e) {
        logger.info("Unknown color command.");
    }
}
Also used : ColorModel(ffx.potential.bonded.RendererCache.ColorModel) IOException(java.io.IOException)

Example 4 with ColorModel

use of ffx.potential.bonded.RendererCache.ColorModel in project ffx by mjschnie.

the class GraphicsCanvas method setColorModel.

/**
 * Operates on the passed node.
 *
 * @param model String
 * @param node a {@link ffx.potential.bonded.MSNode} object.
 */
public void setColorModel(String model, MSNode node) {
    if (node == null) {
        return;
    }
    if (!RendererCache.colorModelHash.containsKey(model.toUpperCase())) {
        return;
    }
    RendererCache.ColorModel colorModel = RendererCache.colorModelHash.get(model.toUpperCase());
    renderer.arm(node, false, false, null, true, colorModel);
}
Also used : ColorModel(ffx.potential.bonded.RendererCache.ColorModel) RendererCache(ffx.potential.bonded.RendererCache)

Aggregations

ColorModel (ffx.potential.bonded.RendererCache.ColorModel)4 RendererCache (ffx.potential.bonded.RendererCache)2 MSNode (ffx.potential.bonded.MSNode)1 ViewModel (ffx.potential.bonded.RendererCache.ViewModel)1 Point (java.awt.Point)1 IOException (java.io.IOException)1 MethodClosure (org.codehaus.groovy.runtime.MethodClosure)1