use of javax.media.j3d.Transform3D in project ffx by mjschnie.
the class GraphicsCanvas method resetGlobalView.
/**
* This functions centers the scene.
*/
public void resetGlobalView() {
double radius = mainPanel.getDataRoot().getExtent();
Transform3D t3d = new Transform3D();
t3d.setScale(1.0d / (1.2d * radius));
baseTransformGroup.setTransform(t3d);
graphicsEvents.centerView(true, true, true);
}
use of javax.media.j3d.Transform3D in project ffx by mjschnie.
the class MouseBehavior method setTransformGroup.
/**
* <p>
* Setter for the field <code>transformGroup</code>.</p>
*
* @param t a {@link javax.media.j3d.TransformGroup} object.
*/
public void setTransformGroup(TransformGroup t) {
transformGroup = t;
currXform = new Transform3D();
transformX = new Transform3D();
transformY = new Transform3D();
reset = true;
}
use of javax.media.j3d.Transform3D in project ffx by mjschnie.
the class MouseOrbit method setTransformGroups.
/**
* <p>
* setTransformGroups</p>
*
* @param tg a {@link javax.media.j3d.TransformGroup} object.
* @param VPTG a {@link javax.media.j3d.TransformGroup} object.
*/
public void setTransformGroups(TransformGroup tg, TransformGroup VPTG) {
super.ViewerTG = VPTG;
tg_ghost = new TransformGroup();
Transform3D tgT3D = new Transform3D();
tg.getTransform(tgT3D);
// Make a ghost TG since no transform on
tg_ghost.setTransform(tgT3D);
// object is to occur
}
use of javax.media.j3d.Transform3D in project ffx by mjschnie.
the class RendererCache method transform3DFactory.
/**
* <p>
* transform3DFactory</p>
*
* @return a {@link javax.media.j3d.Transform3D} object.
*/
public static final Transform3D transform3DFactory() {
Transform3D transform3D;
if (transform3DPool.size() > 0) {
transform3D = transform3DPool.get(0);
if (transform3D != null) {
return transform3D;
}
}
transform3D = new Transform3D();
return transform3D;
}
use of javax.media.j3d.Transform3D in project ffx by mjschnie.
the class MainPanel method merge.
/**
* Merge two or more selected FSystem Nodes into one FSystem node. There are
* a few gotchas that need to be fixed
*
* @param nodesToMerge a {@link java.util.ArrayList} object.
*/
public void merge(ArrayList<MSNode> nodesToMerge) {
ArrayList<MSNode> activeNodes = new ArrayList<MSNode>();
for (MSNode node : nodesToMerge) {
if (node != null && !(node instanceof MSRoot)) {
activeNodes.add(node);
}
}
if (activeNodes.size() <= 1) {
return;
}
// Set up a structure to hold the new system
FFXSystem active = hierarchy.getActive();
File file = SystemFilter.version(hierarchy.getActive().getFile());
FFXSystem system = new FFXSystem(file, "Merge Result", active.getProperties());
system.setKeyFile(active.getKeyFile());
system.setKeywords(KeyFilter.open(active.getKeyFile()));
// Fill arrays with the atoms and bonds from the systems to be combined
ArrayList<Atom> mergedAtoms = new ArrayList<Atom>();
ArrayList<Bond> mergedBonds = new ArrayList<Bond>();
ArrayList<FFXSystem> systems = new ArrayList<FFXSystem>();
TransformGroup parentTransformGroup = null;
FFXSystem parentSystem;
Transform3D parentTransform3D = new Transform3D();
Vector3d parentPosition = new Vector3d();
Vector3d atomPosition = new Vector3d();
// TINKER Atom Numbers start at 1
int atomNum = 1;
Vector3d zero = new Vector3d(0.0, 0.0, 0.0);
for (MSNode m : activeNodes) {
parentSystem = (FFXSystem) m.getMSNode(FFXSystem.class);
if (parentSystem == null) {
return;
}
if (!systems.contains(parentSystem)) {
graphicsCanvas.updateSceneWait(parentSystem, false, true, RendererCache.ViewModel.WIREFRAME, false, null);
systems.add(parentSystem);
}
// Move each atom into the global frame by applying the System
// Transform to
// relative atomic position
parentTransformGroup = parentSystem.getOriginToRot();
parentTransformGroup.getTransform(parentTransform3D);
parentTransform3D.get(parentPosition);
parentTransform3D.setTranslation(zero);
// parentTransform3D.setScale(1.0d);
ArrayList<Atom> atoms = m.getAtomList();
ArrayList<ROLS> bonds = m.getBondList();
for (Atom atom : atoms) {
atom.removeFromParent();
atom.setXyzIndex(atomNum++);
mergedAtoms.add(atom);
atom.getV3D(atomPosition);
parentTransform3D.transform(atomPosition);
atomPosition.add(parentPosition);
atom.moveTo(atomPosition);
}
for (ROLS msm : bonds) {
Bond bond = (Bond) msm;
bond.removeFromParent();
mergedBonds.add((Bond) msm);
}
}
for (FFXSystem sys : systems) {
close(sys);
}
MergeFilter mergeFilter = new MergeFilter(system, mergedAtoms, mergedBonds);
UIFileOpener fileOpener = new UIFileOpener(mergeFilter, this);
if (fileOpenerThreads > 0) {
fileOpener.setNThreads(fileOpenerThreads);
}
Thread thread = new Thread(fileOpener);
thread.start();
}
Aggregations