1+ /*
2+ * BioJava development code
3+ *
4+ * This code may be freely distributed and modified under the
5+ * terms of the GNU Lesser General Public Licence. This should
6+ * be distributed with the code. If you do not have a copy,
7+ * see:
8+ *
9+ * http://www.gnu.org/copyleft/lesser.html
10+ *
11+ * Copyright for this code is held jointly by the individual
12+ * authors. These should be listed in @author doc comments.
13+ *
14+ * For more information on the BioJava project and its aims,
15+ * or to join the biojava-l mailing list, visit the home page
16+ * at:
17+ *
18+ * http://www.biojava.org/
19+ *
20+ */
21+ package org .biojava .nbio .structure .symmetry ;
22+
23+ import static org .junit .Assert .assertEquals ;
24+
25+ import java .io .IOException ;
26+ import java .util .List ;
27+
28+ import org .biojava .nbio .structure .Structure ;
29+ import org .biojava .nbio .structure .StructureException ;
30+ import org .biojava .nbio .structure .StructureIO ;
31+ import org .biojava .nbio .structure .cluster .SubunitCluster ;
32+ import org .biojava .nbio .structure .cluster .SubunitClustererParameters ;
33+ import org .biojava .nbio .structure .symmetry .axis .RotationAxisAligner ;
34+ import org .biojava .nbio .structure .symmetry .core .QuatSymmetryDetector ;
35+ import org .biojava .nbio .structure .symmetry .core .QuatSymmetryParameters ;
36+ import org .biojava .nbio .structure .symmetry .core .QuatSymmetryResults ;
37+ import org .biojava .nbio .structure .symmetry .core .RotationGroup ;
38+ import org .biojava .nbio .structure .symmetry .core .Stoichiometry ;
39+ import org .biojava .nbio .structure .symmetry .core .SymmetryPerceptionMethod ;
40+ import org .biojava .nbio .structure .symmetry .jmolScript .JmolSymmetryScriptGeneratorDn ;
41+ import org .junit .Before ;
42+ import org .junit .Test ;
43+
44+ /**
45+ *
46+ * @author Spencer Bliven
47+ */
48+ public class TestJmolSymmetryScriptGenerator {
49+ @ Before
50+ public void setUp () {
51+ }
52+
53+ @ Test
54+ public void testPolygon () throws IOException , StructureException {
55+ Structure struc = StructureIO .getStructure ("4hhb" );
56+ QuatSymmetryParameters sp = new QuatSymmetryParameters ();
57+ SubunitClustererParameters cp = new SubunitClustererParameters ();
58+
59+ QuatSymmetryResults results = QuatSymmetryDetector .calcGlobalSymmetry (struc , sp , cp );
60+ RotationAxisAligner axis = new RotationAxisAligner (results );
61+ JmolSymmetryScriptGeneratorDn gen = new JmolSymmetryScriptGeneratorDn (axis , "D3" );
62+
63+ String poly = gen .drawPolyhedron ();
64+ String expected = "draw polyhedronD30 line{30.02,-39.95,0.59}{29.24,-0.53,40.00}{30.02,38.89,0.59}{30.80,-0.53,-38.82}{30.02,-39.95,0.59}{-30.00,-39.95,-0.60}{-30.79,-0.53,38.81}{-30.00,38.89,-0.60}{-29.22,-0.53,-40.01}{-30.00,-39.95,-0.60}width 0.45 color [x42ffd9] off;draw polyhedronD31 line{29.24,-0.53,40.00}{-30.79,-0.53,38.81}width 0.45 color [x42ffd9] off;draw polyhedronD32 line{30.02,38.89,0.59}{-30.00,38.89,-0.60}width 0.45 color [x42ffd9] off;draw polyhedronD33 line{30.80,-0.53,-38.82}{-29.22,-0.53,-40.01}width 0.45 color [x42ffd9] off;" ;
65+ assertEquals (expected , poly );
66+ }
67+ }
0 commit comments