Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Replaced IMolecule* by IAtomContainer*

Change-Id: I156f45c38baeea3405205fb2b7fdeef9e2398389
  • Loading branch information...
commit 50536d4c0c1569e3004893535a4e0863e0a07f40 1 parent c0eae9d
Egon Willighagen authored March 26, 2012
11  src/main/org/openscience/cdk/renderer/ChemModelRenderer.java
@@ -32,9 +32,8 @@
32 32
 import org.openscience.cdk.annotations.TestClass;
33 33
 import org.openscience.cdk.annotations.TestMethod;
34 34
 import org.openscience.cdk.interfaces.IAtomContainer;
  35
+import org.openscience.cdk.interfaces.IAtomContainerSet;
35 36
 import org.openscience.cdk.interfaces.IChemModel;
36  
-import org.openscience.cdk.interfaces.IMolecule;
37  
-import org.openscience.cdk.interfaces.IMoleculeSet;
38 37
 import org.openscience.cdk.interfaces.IReaction;
39 38
 import org.openscience.cdk.interfaces.IReactionSet;
40 39
 import org.openscience.cdk.renderer.elements.ElementGroup;
@@ -111,7 +110,7 @@
111 110
 public class ChemModelRenderer extends AbstractRenderer<IChemModel>
112 111
   implements IRenderer<IChemModel> {
113 112
 
114  
-	private IRenderer<IMoleculeSet> moleculeSetRenderer;
  113
+	private IRenderer<IAtomContainerSet> moleculeSetRenderer;
115 114
 	
116 115
 	private IRenderer<IReactionSet> reactionSetRenderer;
117 116
 	
@@ -194,7 +193,7 @@ public void setScale(IChemModel chemModel) {
194 193
      */
195 194
     public Rectangle paint(IChemModel chemModel, IDrawVisitor drawVisitor) {
196 195
 
197  
-        IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
  196
+    	IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
198 197
         IReactionSet reactionSet = chemModel.getReactionSet();
199 198
 
200 199
         if (moleculeSet == null && reactionSet != null) {
@@ -283,7 +282,7 @@ public Rectangle paint(IChemModel chemModel, IDrawVisitor drawVisitor) {
283 282
     public void paint(IChemModel chemModel,
284 283
             IDrawVisitor drawVisitor, Rectangle2D bounds, boolean resetCenter) {
285 284
         // check for an empty model
286  
-        IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
  285
+    	IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
287 286
         IReactionSet reactionSet = chemModel.getReactionSet();
288 287
 
289 288
         // nasty, but it seems that reactions can be read in as ChemModels
@@ -324,7 +323,7 @@ public void repaint(IDrawVisitor drawVisitor) {
324 323
 	 * @return a rectangle in screen space.
325 324
 	 */
326 325
 	public Rectangle calculateDiagramBounds(IChemModel model) {
327  
-        IMoleculeSet moleculeSet = model.getMoleculeSet();
  326
+		IAtomContainerSet moleculeSet = model.getMoleculeSet();
328 327
         IReactionSet reactionSet = model.getReactionSet();
329 328
         if ((moleculeSet == null && reactionSet == null)) {
330 329
             return new Rectangle();
25  src/main/org/openscience/cdk/renderer/MoleculeSetRenderer.java
@@ -32,9 +32,8 @@
32 32
 import org.openscience.cdk.annotations.TestClass;
33 33
 import org.openscience.cdk.annotations.TestMethod;
34 34
 import org.openscience.cdk.interfaces.IAtomContainer;
  35
+import org.openscience.cdk.interfaces.IAtomContainerSet;
35 36
 import org.openscience.cdk.interfaces.IChemModel;
36  
-import org.openscience.cdk.interfaces.IMolecule;
37  
-import org.openscience.cdk.interfaces.IMoleculeSet;
38 37
 import org.openscience.cdk.interfaces.IReaction;
39 38
 import org.openscience.cdk.renderer.elements.ElementGroup;
40 39
 import org.openscience.cdk.renderer.elements.IRenderingElement;
@@ -107,8 +106,8 @@
107 106
  * @cdk.githash
108 107
  */
109 108
 @TestClass("org.openscience.cdk.renderer.MoleculeSetRendererTest")
110  
-public class MoleculeSetRenderer extends AbstractRenderer<IMoleculeSet>
111  
-  implements IRenderer<IMoleculeSet> {
  109
+public class MoleculeSetRenderer extends AbstractRenderer<IAtomContainerSet>
  110
+  implements IRenderer<IAtomContainerSet> {
112 111
 
113 112
     private IRenderer<IAtomContainer> atomContainerRenderer;
114 113
     
@@ -142,7 +141,7 @@ public MoleculeSetRenderer(RendererModel rendererModel,List<IGenerator<IAtomCont
142 141
 	 * @param moleculeSet the {@link IMoleculeSet} for what to set the scale
143 142
 	 * @param screen      the {@link Rectangle} for which to calculate the scale
144 143
 	 */
145  
-	public void setup(IMoleculeSet moleculeSet, Rectangle screen) {
  144
+	public void setup(IAtomContainerSet moleculeSet, Rectangle screen) {
146 145
 	    this.setScale(moleculeSet);
147 146
 	    Rectangle2D bounds = BoundsCalculator.calculateBounds(moleculeSet);
148 147
 	    if(bounds != null)
@@ -209,7 +208,7 @@ public Rectangle shift(Rectangle screenBounds, Rectangle diagramBounds) {
209 208
      * 
210 209
      * @param moleculeSet the {@link IMoleculeSet} for what to set the scale
211 210
      */
212  
-    public void setScale(IMoleculeSet moleculeSet) {
  211
+    public void setScale(IAtomContainerSet moleculeSet) {
213 212
         double bondLength = AverageBondLengthCalculator.calculateAverageBondLength(moleculeSet);
214 213
         double scale = this.calculateScaleForBondLength(bondLength);
215 214
 
@@ -218,7 +217,7 @@ public void setScale(IMoleculeSet moleculeSet) {
218 217
     }
219 218
 
220 219
     /** {@inheritDoc} */ @Override
221  
-	public Rectangle paint(IMoleculeSet moleculeSet, IDrawVisitor drawVisitor) {
  220
+	public Rectangle paint(IAtomContainerSet moleculeSet, IDrawVisitor drawVisitor) {
222 221
         // total up the bounding boxes
223 222
         Rectangle2D totalBounds = BoundsCalculator.calculateBounds(moleculeSet);
224 223
 
@@ -240,7 +239,7 @@ public Rectangle paint(IMoleculeSet moleculeSet, IDrawVisitor drawVisitor) {
240 239
      * @param resetCenter
241 240
      *     if true, set the draw center to be the center of bounds
242 241
      */
243  
-    public void paint(IMoleculeSet molecules,
  242
+    public void paint(IAtomContainerSet molecules,
244 243
             IDrawVisitor drawVisitor, Rectangle2D bounds, boolean resetCenter) {
245 244
 
246 245
         // total up the bounding boxes
@@ -254,16 +253,16 @@ public void paint(IMoleculeSet molecules,
254 253
     }
255 254
 
256 255
     /** {@inheritDoc} */ @Override
257  
-    public IRenderingElement generateDiagram(IMoleculeSet molecules) {
  256
+    public IRenderingElement generateDiagram(IAtomContainerSet molecules) {
258 257
         ElementGroup diagram = new ElementGroup();
259  
-        for (IAtomContainer molecule : molecules.molecules()) {
  258
+        for (IAtomContainer molecule : molecules.atomContainers()) {
260 259
             diagram.add(atomContainerRenderer.generateDiagram(molecule));
261 260
         }
262 261
         return diagram;
263 262
     }
264 263
 
265 264
     /** {@inheritDoc} */ @Override
266  
-	public Rectangle calculateDiagramBounds(IMoleculeSet moleculeSet) {
  265
+	public Rectangle calculateDiagramBounds(IAtomContainerSet moleculeSet) {
267 266
 		if(moleculeSet == null) return this.calculateScreenBounds(new Rectangle2D.Double());
268 267
 	    return this.calculateScreenBounds(
269 268
 	               BoundsCalculator.calculateBounds(moleculeSet));
@@ -288,8 +287,8 @@ public double calculateScaleForBondLength(double modelBondLength) {
288 287
 
289 288
 	/** {@inheritDoc} */
290 289
 	@Override
291  
-    public List<IGenerator<IMoleculeSet>> getGenerators() {
292  
-        return new ArrayList<IGenerator<IMoleculeSet>>(generators);
  290
+    public List<IGenerator<IAtomContainerSet>> getGenerators() {
  291
+        return new ArrayList<IGenerator<IAtomContainerSet>>(generators);
293 292
     }
294 293
    
295 294
 }
5  src/main/org/openscience/cdk/renderer/ReactionRenderer.java
@@ -31,9 +31,8 @@
31 31
 import org.openscience.cdk.annotations.TestClass;
32 32
 import org.openscience.cdk.annotations.TestMethod;
33 33
 import org.openscience.cdk.interfaces.IAtomContainer;
  34
+import org.openscience.cdk.interfaces.IAtomContainerSet;
34 35
 import org.openscience.cdk.interfaces.IChemModel;
35  
-import org.openscience.cdk.interfaces.IMolecule;
36  
-import org.openscience.cdk.interfaces.IMoleculeSet;
37 36
 import org.openscience.cdk.interfaces.IReaction;
38 37
 import org.openscience.cdk.renderer.elements.ElementGroup;
39 38
 import org.openscience.cdk.renderer.elements.IRenderingElement;
@@ -109,7 +108,7 @@
109 108
 public class ReactionRenderer extends AbstractRenderer<IReaction>
110 109
   implements IRenderer<IReaction> {
111 110
     
112  
-    private IRenderer<IMoleculeSet> moleculeSetRenderer;
  111
+    private IRenderer<IAtomContainerSet> moleculeSetRenderer;
113 112
 
114 113
     /**
115 114
      * A renderer that generates diagrams using the specified
1  src/main/org/openscience/cdk/renderer/ReactionSetRenderer.java
@@ -31,7 +31,6 @@
31 31
 import org.openscience.cdk.annotations.TestMethod;
32 32
 import org.openscience.cdk.interfaces.IAtomContainer;
33 33
 import org.openscience.cdk.interfaces.IChemModel;
34  
-import org.openscience.cdk.interfaces.IMolecule;
35 34
 import org.openscience.cdk.interfaces.IReaction;
36 35
 import org.openscience.cdk.interfaces.IReactionSet;
37 36
 import org.openscience.cdk.renderer.elements.ElementGroup;
8  src/main/org/openscience/cdk/renderer/generators/BoundsGenerator.java
@@ -27,7 +27,7 @@
27 27
 
28 28
 import org.openscience.cdk.annotations.TestClass;
29 29
 import org.openscience.cdk.annotations.TestMethod;
30  
-import org.openscience.cdk.interfaces.IMoleculeSet;
  30
+import org.openscience.cdk.interfaces.IAtomContainerSet;
31 31
 import org.openscience.cdk.interfaces.IReaction;
32 32
 import org.openscience.cdk.renderer.BoundsCalculator;
33 33
 import org.openscience.cdk.renderer.RendererModel;
@@ -67,12 +67,12 @@ public BoundsGenerator() {}
67 67
     @TestMethod("testEmptyReaction")
68 68
     public IRenderingElement generate(IReaction reaction, RendererModel model) {
69 69
         ElementGroup elementGroup = new ElementGroup();
70  
-        IMoleculeSet reactants = reaction.getReactants();
  70
+        IAtomContainerSet reactants = reaction.getReactants();
71 71
         if (reactants != null) {
72 72
             elementGroup.add(this.generate(reactants));
73 73
         }
74 74
         
75  
-        IMoleculeSet products = reaction.getProducts();
  75
+        IAtomContainerSet products = reaction.getProducts();
76 76
         if (products != null) {
77 77
             elementGroup.add(this.generate(products));
78 78
         }
@@ -81,7 +81,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
81 81
     }
82 82
 
83 83
     private IRenderingElement generate(
84  
-            IMoleculeSet moleculeSet) {
  84
+    		IAtomContainerSet moleculeSet) {
85 85
         Rectangle2D totalBounds = BoundsCalculator.calculateBounds(moleculeSet);
86 86
         
87 87
         return new RectangleElement(totalBounds.getMinX(),
2  src/main/org/openscience/cdk/renderer/generators/ProductsBoxGenerator.java
@@ -60,7 +60,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
60 60
 		double distance = model.getParameter(BondLength.class)
61 61
     		.getValue() / model.getParameter(Scale.class).getValue() / 2;
62 62
         Rectangle2D totalBounds = null;
63  
-        for (IAtomContainer molecule : reaction.getProducts().molecules()) {
  63
+        for (IAtomContainer molecule : reaction.getProducts().atomContainers()) {
64 64
             Rectangle2D bounds = BoundsCalculator.calculateBounds(molecule);
65 65
             if (totalBounds == null) {
66 66
                 totalBounds = bounds;
6  src/main/org/openscience/cdk/renderer/generators/ReactionPlusGenerator.java
@@ -26,7 +26,7 @@
26 26
 
27 27
 import org.openscience.cdk.annotations.TestClass;
28 28
 import org.openscience.cdk.annotations.TestMethod;
29  
-import org.openscience.cdk.interfaces.IMoleculeSet;
  29
+import org.openscience.cdk.interfaces.IAtomContainerSet;
30 30
 import org.openscience.cdk.interfaces.IReaction;
31 31
 import org.openscience.cdk.renderer.BoundsCalculator;
32 32
 import org.openscience.cdk.renderer.RendererModel;
@@ -53,7 +53,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
53 53
 		Color color = model.getParameter(
54 54
 			BasicSceneGenerator.ForegroundColor.class
55 55
 		).getValue();
56  
-		IMoleculeSet reactants = reaction.getReactants();
  56
+		IAtomContainerSet reactants = reaction.getReactants();
57 57
 
58 58
 		// only draw + signs when there are more than one reactant
59 59
 		if (reactants.getAtomContainerCount() > 1) {
@@ -70,7 +70,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
70 70
 		}
71 71
         
72 72
 		// only draw + signs when there are more than one products
73  
-        IMoleculeSet products = reaction.getProducts();
  73
+		IAtomContainerSet products = reaction.getProducts();
74 74
 		if (products.getAtomContainerCount() > 1) {
75 75
 			Rectangle2D totalBoundsProducts = BoundsCalculator.calculateBounds(products);
76 76
 			double axis = totalBoundsProducts.getCenterY();

0 notes on commit 50536d4

Please sign in to comment.
Something went wrong with that request. Please try again.