From: <ha...@us...> - 2007-10-08 01:10:20
|
Revision: 8384 http://jmol.svn.sourceforge.net/jmol/?rev=8384&view=rev Author: hansonr Date: 2007-10-07 18:10:15 -0700 (Sun, 07 Oct 2007) Log Message: ----------- last of standard shape generators -- stars, halos, measures Modified Paths: -------------- trunk/Jmol/src/org/jmol/api/JmolExportInterface.java trunk/Jmol/src/org/jmol/export/MayaExporter.java trunk/Jmol/src/org/jmol/export/PovrayExporter.java trunk/Jmol/src/org/jmol/export/VrmlExporter.java trunk/Jmol/src/org/jmol/g3d/Graphics3D.java trunk/Jmol/src/org/jmol/shape/HalosRenderer.java trunk/Jmol/src/org/jmol/shape/MeasuresRenderer.java trunk/Jmol/src/org/jmol/shape/StarsRenderer.java Added Paths: ----------- trunk/Jmol/src/org/jmol/export/HalosGenerator.java trunk/Jmol/src/org/jmol/export/MeasuresGenerator.java trunk/Jmol/src/org/jmol/export/StarsGenerator.java Modified: trunk/Jmol/src/org/jmol/api/JmolExportInterface.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolExportInterface.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/api/JmolExportInterface.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -50,8 +50,16 @@ abstract void fillCylinder(short colix, byte endcaps, int diameter, Point3i screenA, Point3i screenB); - abstract void drawDottedLine(short colix, Point3i pointA, Point3i pointB); + abstract void drawDottedLine(short colix, Point3i pointA, Point3i pointB); //axes - abstract void drawPoints(short colix, int count, int[] coordinates); //for dots + abstract void drawPoints(short colix, int count, int[] coordinates); //dots + abstract void drawLine(short colix, Point3i pointA, Point3i pointB); //stars + + abstract void fillScreenedCircleCentered(short colix, int diameter, int x, + int y, int z); //halos + + abstract void drawPixel(short colix, int x, int y, int z); //measures + abstract void drawDashedLine(short colix, int run, int rise, Point3i ptA, Point3i ptB); //measures + } \ No newline at end of file Added: trunk/Jmol/src/org/jmol/export/HalosGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/export/HalosGenerator.java (rev 0) +++ trunk/Jmol/src/org/jmol/export/HalosGenerator.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -0,0 +1,46 @@ +/* $RCSfile$ + * $Author: hansonr $ + * $Date: 2007-05-18 15:41:42 -0500 (Fri, 18 May 2007) $ + * $Revision: 7752 $ + + * + * Copyright (C) 2003-2005 The Jmol Development Team + * + * Contact: jmo...@li... + * + * 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.export; + + +import org.jmol.shape.*; + +public class HalosGenerator extends HalosRenderer { + + private Exporter exporter; + + public void initializeGenerator(Object exporter, String type, StringBuffer output) { + super.initializeGenerator(exporter, type, output); + isGenerator = true; + this.exporter = (Exporter)exporter; + } + + public void fillScreenedCircleCentered(short colix, int diameter, int x, + int y, int z) { + exporter.fillScreenedCircleCentered(colix, diameter, x, y, z); + } + +} Modified: trunk/Jmol/src/org/jmol/export/MayaExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/MayaExporter.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/export/MayaExporter.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -170,9 +170,28 @@ } public void drawDottedLine(short colix, Point3i pointA, Point3i pointB) { + //axes } - public void drawPoints(short colix, int count, int[] coordinates) { + public void drawPoints(short colix, int count, int[] coordinates) { + //dots } + public void drawLine(short colix, Point3i pointA, Point3i pointB) { + //stars + } + + public void fillScreenedCircleCentered(short colix, int diameter, int x, + int y, int z) { + //halos + } + + public void drawPixel(short colix, int x, int y, int z) { + //measures + } + + public void drawDashedLine(short colix, int run, int rise, Point3i ptA, Point3i ptB) { + //measures + } + } Added: trunk/Jmol/src/org/jmol/export/MeasuresGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/export/MeasuresGenerator.java (rev 0) +++ trunk/Jmol/src/org/jmol/export/MeasuresGenerator.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -0,0 +1,50 @@ +/* $RCSfile$ + * $Author: hansonr $ + * $Date: 2007-05-18 15:41:42 -0500 (Fri, 18 May 2007) $ + * $Revision: 7752 $ + + * + * Copyright (C) 2003-2005 The Jmol Development Team + * + * Contact: jmo...@li... + * + * 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.export; + +import javax.vecmath.Point3i; + +import org.jmol.shape.*; + +public class MeasuresGenerator extends MeasuresRenderer { + + private Exporter exporter; + + public void initializeGenerator(Object exporter, String type, StringBuffer output) { + super.initializeGenerator(exporter, type, output); + isGenerator = true; + this.exporter = (Exporter)exporter; + } + + protected void drawPixel(int x, int y, int z) { + exporter.drawPixel(colix, x, y, z); + } + + protected void drawDashedLine(int run, int rise, Point3i ptA, Point3i ptB) { + exporter.drawDashedLine(colix, run, rise, ptA, ptB); + } + +} Modified: trunk/Jmol/src/org/jmol/export/PovrayExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/PovrayExporter.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/export/PovrayExporter.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -293,8 +293,28 @@ } public void drawDottedLine(short colix, Point3i pointA, Point3i pointB) { + //axes } - public void drawPoints(short colix, int count, int[] coordinates) { + public void drawPoints(short colix, int count, int[] coordinates) { + //dots } + + public void drawLine(short colix, Point3i pointA, Point3i pointB) { + //stars + } + + public void fillScreenedCircleCentered(short colix, int diameter, int x, + int y, int z) { + //halos + } + + public void drawPixel(short colix, int x, int y, int z) { + //measures + } + + public void drawDashedLine(short colix, int run, int rise, Point3i ptA, Point3i ptB) { + //measures + } + } Added: trunk/Jmol/src/org/jmol/export/StarsGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/export/StarsGenerator.java (rev 0) +++ trunk/Jmol/src/org/jmol/export/StarsGenerator.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -0,0 +1,51 @@ +/* $RCSfile$ + * $Author: hansonr $ + * $Date: 2007-05-18 15:41:42 -0500 (Fri, 18 May 2007) $ + * $Revision: 7752 $ + + * + * Copyright (C) 2003-2005 The Jmol Development Team + * + * Contact: jmo...@li... + * + * 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.export; + +import javax.vecmath.Point3i; + +import org.jmol.shape.*; + +public class StarsGenerator extends StarsRenderer { + + private Exporter exporter; + + public void initializeGenerator(Object exporter, String type, StringBuffer output) { + super.initializeGenerator(exporter, type, output); + isGenerator = true; + this.exporter = (Exporter)exporter; + } + + Point3i p1 = new Point3i(); + Point3i p2 = new Point3i(); + + protected void drawLine(int x1, int y1, int z1, int x2, int y2, int z2) { + p1.set(x1, y1, z1); + p2.set(x2, y2, z2); + exporter.drawLine(colix, p1, p2); + } + +} Modified: trunk/Jmol/src/org/jmol/export/VrmlExporter.java =================================================================== --- trunk/Jmol/src/org/jmol/export/VrmlExporter.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/export/VrmlExporter.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -168,9 +168,28 @@ } public void drawDottedLine(short colix, Point3i pointA, Point3i pointB) { + //axes } - public void drawPoints(short colix, int count, int[] coordinates) { + public void drawPoints(short colix, int count, int[] coordinates) { + //dots } + public void drawLine(short colix, Point3i pointA, Point3i pointB) { + //stars + } + + public void fillScreenedCircleCentered(short colix, int diameter, int x, + int y, int z) { + //halos + } + + public void drawPixel(short colix, int x, int y, int z) { + //measures + } + + public void drawDashedLine(short colix, int run, int rise, Point3i ptA, Point3i ptB) { + //measures + } + } Modified: trunk/Jmol/src/org/jmol/g3d/Graphics3D.java =================================================================== --- trunk/Jmol/src/org/jmol/g3d/Graphics3D.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/g3d/Graphics3D.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -856,11 +856,11 @@ * lines and cylinders * ***************************************************************/ - public void drawDashedLine(int run, int rise, - int x1, int y1, int z1, int x2, int y2, int z2) { + public void drawDashedLine(int run, int rise, Point3i pointA, Point3i pointB) { // measures only - line3d.plotDashedLine(argbCurrent, !addAllPixels, - run, rise, x1, y1, z1, x2, y2, z2, false); + line3d.plotDashedLine(argbCurrent, !addAllPixels, run, rise, + pointA.x, pointA.y, pointA.z, + pointB.x, pointB.y, pointB.z, false); } public void drawDottedLine(Point3i pointA, Point3i pointB) { Modified: trunk/Jmol/src/org/jmol/shape/HalosRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/HalosRenderer.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/shape/HalosRenderer.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -88,7 +88,12 @@ int haloDiameter = diameter + 2 * halowidth; if (haloDiameter <= 0) return; - g3d.fillScreenedCircleCentered(colix, haloDiameter, atom.screenX, + fillScreenedCircleCentered(colix, haloDiameter, atom.screenX, atom.screenY, atom.screenZ); } + + protected void fillScreenedCircleCentered(short colix, int diameter, int x, + int y, int z) { + g3d.fillScreenedCircleCentered(colix, diameter, x, y, z); + } } Modified: trunk/Jmol/src/org/jmol/shape/MeasuresRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/MeasuresRenderer.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/shape/MeasuresRenderer.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -34,16 +34,15 @@ import javax.vecmath.Matrix3f; import javax.vecmath.AxisAngle4f; -public class MeasuresRenderer extends ShapeRenderer { +public class MeasuresRenderer extends FontLineShapeRenderer { boolean showMeasurementNumbers; short measurementMad; Font3D font3d; Measurement measurement; boolean doJustify; - short colix; protected void render() { - if (!viewer.getShowMeasurements() || !g3d.checkTranslucent(false)) + if (!viewer.getShowMeasurements() || !isGenerator && !g3d.checkTranslucent(false)) return; Measures measures = (Measures) shape; @@ -64,7 +63,8 @@ colix = measures.colix; if (colix == 0) colix = viewer.getColixBackgroundContrast(); - g3d.setColix(colix); + if (!isGenerator) + g3d.setColix(colix); renderMeasurement(m); } renderPendingMeasurement(measures.pendingMeasurement); @@ -91,16 +91,20 @@ } } + Point3i ptA = new Point3i(); + Point3i ptB = new Point3i(); + int drawSegment(int x1, int y1, int z1, int x2, int y2, int z2) { if (measurementMad < 0) { - g3d.drawDashedLine(4, 2, x1, y1, z1, x2, y2, z2); + ptA.set(x1, y1, z1); + ptB.set(x2, y2, z2); + drawDashedLine(4, 2, ptA, ptB); return 1; } int widthPixels = measurementMad; if (measurementMad >= 20) widthPixels = viewer.scaleToScreen((z1 + z2) / 2, measurementMad); - g3d.fillCylinder(Graphics3D.ENDCAPS_FLAT, - widthPixels, x1, y1, z1, x2, y2, z2); + fillCylinder(Graphics3D.ENDCAPS_FLAT, widthPixels, ptA, ptB); return (widthPixels + 1) / 2; } @@ -176,7 +180,7 @@ Point3i screenArc = viewer.transformPoint(pointT); int zArc = screenArc.z - zOffset; if (zArc < 0) zArc = 0; - g3d.drawPixel(screenArc.x, screenArc.y, zArc); + drawPixel(screenArc.x, screenArc.y, zArc); if (i == iMid) { pointT.set(ptArc); pointT.scale(1.1f); @@ -234,10 +238,12 @@ int zT = z - radius - 2; if (zT < 1) zT = 1; - g3d.drawString(strMeasurement, font3d, xT, yT, zT, zT); + drawString(strMeasurement, font3d, xT, yT, zT, zT); } void renderPendingMeasurement(MeasurementPending pendingMeasurement) { + if (isGenerator) + return; int count = pendingMeasurement.getCount(); if (! pendingMeasurement.getIsActive() || count < 2) return; @@ -259,4 +265,13 @@ drawSegment(atomLast.screenX, atomLast.screenY, lastZ, viewer.getCursorX(), viewer.getCursorY(), 0); } + + protected void drawPixel(int x, int y, int z) { + g3d.drawPixel(x, y, z); + } + + protected void drawDashedLine(int run, int rise, Point3i ptA, Point3i ptB) { + g3d.drawDashedLine(run, rise, ptA, ptB); + } + } Modified: trunk/Jmol/src/org/jmol/shape/StarsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/StarsRenderer.java 2007-10-07 23:21:42 UTC (rev 8383) +++ trunk/Jmol/src/org/jmol/shape/StarsRenderer.java 2007-10-08 01:10:15 UTC (rev 8384) @@ -29,6 +29,8 @@ public class StarsRenderer extends ShapeRenderer { + protected short colix; + protected void render() { Stars stars = (Stars) shape; if (stars.mads == null) @@ -36,9 +38,11 @@ Atom[] atoms = modelSet.atoms; for (int i = modelSet.getAtomCount(); --i >= 0;) { Atom atom = atoms[i]; - if (!atom.isShapeVisible(myVisibilityFlag) || modelSet.isAtomHidden(i) - || !g3d.setColix(Shape.getColix(stars.colixes, i, atom))) + if (!atom.isShapeVisible(myVisibilityFlag) || modelSet.isAtomHidden(i)) continue; + colix = Shape.getColix(stars.colixes, i, atom); + if (!isGenerator && !g3d.setColix(colix)) + continue; render1(atom, stars.mads[i]); } } @@ -50,8 +54,11 @@ int d = viewer.scaleToScreen(z, mad); d -= (d & 1) ^ 1; // round down to odd value int r = d / 2; - g3d.drawLine(x - r, y, z, x - r + d, y, z); - g3d.drawLine(x, y - r, z, x, y - r + d, z); + drawLine(x - r, y, z, x - r + d, y, z); + drawLine(x, y - r, z, x, y - r + d, z); } + protected void drawLine(int x1, int y1, int z1, int x2, int y2, int z2) { + g3d.drawLine(x1, y1, z1, x2, y2, z2); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |