
org.jmol.shape.Shape Maven / Gradle / Ivy
/* $RCSfile$
* $Author: hansonr $
* $Date: 2016-08-10 06:55:19 +0200 (Wed, 10 Aug 2016) $
* $Revision: 21195 $
*
* Copyright (C) 2003-2005 The Jmol Development Team
*
* Contact: [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jmol.shape;
import org.jmol.util.C;
import javajs.awt.Font;
import javajs.util.Lst;
import javajs.util.SB;
import javajs.util.T3;
import org.jmol.util.Logger;
import javajs.util.P3;
import javajs.util.P3i;
import org.jmol.viewer.JC;
import org.jmol.viewer.Viewer;
import org.jmol.atomdata.RadiusData;
import org.jmol.c.PAL;
import org.jmol.java.BS;
import org.jmol.modelset.Atom;
import org.jmol.modelset.Bond;
import org.jmol.modelset.Group;
import org.jmol.modelset.ModelSet;
import java.util.Map;
/**
* Shape now encompasses:
*
* AtomShape (abstract)
* |
* Balls, Dots, Ellipsoids, Halos, Labels, Polyhedra, Stars, Vectors
* |
* GeoSurface
*
* BioShapeCollection (abstract)
* |
* Backbone, Cartoon, MeshRibbon, Ribbons, Rockets, Strands, Trace
*
* Dipoles
*
* FontLineShape (abstract)
* |
* Axes, Bbcage, Frank, Uccage
*
* Measures
*
* MeshCollection (abstract)
* | |
* Draw Isosurface
* |
* LcaoCartoon, MolecularOrbital, Pmesh
*
* Sticks
* |
* Hsticks, Sssticks
*
* TextShape (abstract)
* |
* Echo, Hover
*
*/
public abstract class Shape {
public String myType;
abstract public String getShapeState();
abstract public void setProperty(String propertyName, Object value, BS bsSelected);
//public Shape () {
// System.out.println("Shape " + this + " constructed");
//}
//public void finalize() {
// System.out.println("Shape " + shapeID + " " + this + " finalized");
//}
public static final float RADIUS_MAX = 4;
public Viewer vwr; //public for now for Backbone
public ModelSet ms;
public int shapeID;
/**
* shape visibility flag
*/
public int vf;
// AtomShape: Balls, Dots, GeoSurface, Ellipsoids, Halos, Labels, Polyhedra, Stars, Vectors
// Sticks, Dipoles, BioShape
// MeshCollection: Draw, CGO, Isosurface, LcaoCartoon, MolecularOrbital, Pmesh
protected float translucentLevel;
public boolean translucentAllowed = true;
public boolean isBioShape;
public BS bsSizeSet;
public BS bsColixSet;
final public void initializeShape(Viewer vwr, ModelSet modelSet,
int shapeID) {
this.vwr = vwr;
this.shapeID = shapeID;
vf = JC.getShapeVisibilityFlag(shapeID);
setModelSet(modelSet);
initShape();
}
public abstract void initShape();
/**
* @param bsModels
*/
public void setModelVisibilityFlags(BS bsModels) {
// only some atom-based shapes implement this.
}
/**
* overridden in Dots, CGOMesh, and AtomShape
*
* @param atomIndex
* @return size
*/
public int getSize(int atomIndex) {
return 0;
}
/**
*
*
* @param group
* @return size
*/
public int getSizeG(Group group) {
return 0;
}
/**
* @param g0
* @param g1
*/
public void replaceGroup(Group g0, Group g1) {
//BioShapeCollection only; after MUTATE
}
public void setModelSet(ModelSet modelSet) {
this.ms = modelSet;
initModelSet();
}
protected void initModelSet() {
}
public void setShapeSizeRD(int size, RadiusData rd, BS bsSelected) {
if (rd == null)
setSize(size, bsSelected);
else
setSizeRD(rd, bsSelected);
}
/**
*
* @param size
* @param bsSelected
*/
protected void setSize(int size, BS bsSelected) {
// not for atoms except to turn off -- size = 0
}
/**
*
* @param rd
* @param bsSelected
*/
protected void setSizeRD(RadiusData rd, BS bsSelected) {
// balls, dots, other atomshapes
}
@SuppressWarnings("unchecked")
protected void setPropS(String propertyName, Object value, BS bsSelected) {
if (propertyName == "setProperties") {
if (bsSelected == null)
bsSelected = vwr.bsA();
Lst
© 2015 - 2025 Weber Informatics LLC | Privacy Policy