Search in sources :

Example 1 with ViewModel

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

the class GraphicsCanvas method setViewModel.

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

Example 2 with ViewModel

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

the class GraphicsCanvas method setViewModel.

/**
 * Operates on the active nodes.
 *
 * @param model String
 */
public void setViewModel(String model) {
    if (!RendererCache.viewModelHash.containsKey(model.toUpperCase())) {
        return;
    }
    RendererCache.ViewModel viewModel = RendererCache.viewModelHash.get(model.toUpperCase());
    if (viewModel == RendererCache.ViewModel.RESTRICT) {
        renderer.arm(mainPanel.getDataRoot(), false, true, viewModel, false, null);
        return;
    }
    ArrayList<MSNode> active = mainPanel.getHierarchy().getActiveNodes();
    if (active == null) {
        return;
    }
    renderer.arm(active, false, true, viewModel, false, null);
}
Also used : MSNode(ffx.potential.bonded.MSNode) RendererCache(ffx.potential.bonded.RendererCache) ViewModel(ffx.potential.bonded.RendererCache.ViewModel)

Example 3 with ViewModel

use of ffx.potential.bonded.RendererCache.ViewModel 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 4 with ViewModel

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

the class GraphicsCanvas method viewWait.

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

Aggregations

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