Commit [r12619] Maximize Restore History

Changed module structure.

Collapsed all line elements in to one.

goglepox 2008-10-13

changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/IRenderingModule.java
changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/IRenderingVisitor.java
changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/OvalElement.java
changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/IRenderingElement.java
changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/LineElement.java
changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/AtomModule.java
changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/BondModule.java
changed /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/AbstractModule.java
copied /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/DoubleLineElement.java -> /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/TextElement.java
copied /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/TripleLineElement.java -> /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/AtomSymbolModule.java
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/IRenderingModule.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/IRenderingVisitor.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/OvalElement.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/IRenderingElement.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/LineElement.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/AtomModule.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/BondModule.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/AbstractModule.java Diff Switch to side-by-side view
Loading...
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/DoubleLineElement.java to /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/TextElement.java
--- a/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/DoubleLineElement.java
+++ b/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/TextElement.java
@@ -20,18 +20,42 @@
  */
 package org.openscience.cdk.renderer.elements;
 
+import java.awt.Color;
 import java.awt.Point;
+import java.awt.geom.Point2D;
 
 import org.openscience.cdk.renderer.IRenderingVisitor;
 
-public class DoubleLineElement extends LineElement {
 
-    public DoubleLineElement(Point p1, Point p2) {
-        super( p1, p2 );
+public class TextElement implements IRenderingElement {
+
+    Point2D positon;
+    String text;
+    Color color;
+    
+    public TextElement(Point pos,String text) {
+        this(pos.x,pos.y,text, defaultColor);
     }
-
-    @Override
+    
+    public TextElement(double x, double y, String symbol, Color color) {
+        positon = new Point2D.Double(x,y);
+        text = symbol;
+        this.color = color;
+    }
     public void accept( IRenderingVisitor v ) {
-        v.visitDoubleLine( this );
+        
+        v.visitText(this);
+    }
+    public Point2D getPosition() {
+        return new Point2D.Double(positon.getX(),positon.getY());
+    }
+    
+    public String getText() {
+        
+        return text;
+    }
+    
+    public Color getColor() {
+        return color;
     }
 }
/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/TripleLineElement.java to /cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/AtomSymbolModule.java
--- a/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/elements/TripleLineElement.java
+++ b/cdk/branches/goglepox-jchempaint/src/main/org/openscience/cdk/renderer/modules/AtomSymbolModule.java
@@ -18,29 +18,36 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-package org.openscience.cdk.renderer.elements;
+package org.openscience.cdk.renderer.modules;
 
-import java.awt.Point;
+import java.awt.Color;
 
-import org.openscience.cdk.renderer.IRenderingVisitor;
+import org.openscience.cdk.interfaces.IAtom;
+import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.renderer.elements.IRenderingElement;
+import org.openscience.cdk.renderer.elements.RenderingModel;
+import org.openscience.cdk.renderer.elements.TextElement;
 
 
-public class TripleLineElement extends LineElement {
+public class AtomSymbolModule extends AbstractModule {
 
-    public TripleLineElement(int x, int y, int x1, int y1) {
-
-        super( x, y, x1, y1 );
-    }
     
-    
-    public TripleLineElement(Point p1, Point p2) {
-        super( p1, p2);
+    public AtomSymbolModule(AbstractModule module) {
+        this.module = module;
     }
     
     @Override
-    public void accept( IRenderingVisitor v ) {
-    
-        v.visitTripleLine(this);
+    public IRenderingElement accept( IAtomContainer ac, IAtom atom,
+                                     IRenderingElement element ) {
+
+        Color color = getModel().getAtomColor( atom,getModel().getBackColor() );
+        if(!getModel().getIsCompact())
+            element = new TextElement( atom.getPoint2d().x, 
+                                       atom.getPoint2d().y,
+                                       atom.getSymbol(),
+                                       color);
+        
+        return super.accept( ac, atom, element );        
     }
-
+      
 }