Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replaced IMolecule* by IAtomContainer*

Change-Id: I156f45c38baeea3405205fb2b7fdeef9e2398389
  • Loading branch information...
commit 50536d4c0c1569e3004893535a4e0863e0a07f40 1 parent c0eae9d
@egonw egonw authored
View
11 src/main/org/openscience/cdk/renderer/ChemModelRenderer.java
@@ -32,9 +32,8 @@
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemModel;
-import org.openscience.cdk.interfaces.IMolecule;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.interfaces.IReactionSet;
import org.openscience.cdk.renderer.elements.ElementGroup;
@@ -111,7 +110,7 @@
public class ChemModelRenderer extends AbstractRenderer<IChemModel>
implements IRenderer<IChemModel> {
- private IRenderer<IMoleculeSet> moleculeSetRenderer;
+ private IRenderer<IAtomContainerSet> moleculeSetRenderer;
private IRenderer<IReactionSet> reactionSetRenderer;
@@ -194,7 +193,7 @@ public void setScale(IChemModel chemModel) {
*/
public Rectangle paint(IChemModel chemModel, IDrawVisitor drawVisitor) {
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
IReactionSet reactionSet = chemModel.getReactionSet();
if (moleculeSet == null && reactionSet != null) {
@@ -283,7 +282,7 @@ public Rectangle paint(IChemModel chemModel, IDrawVisitor drawVisitor) {
public void paint(IChemModel chemModel,
IDrawVisitor drawVisitor, Rectangle2D bounds, boolean resetCenter) {
// check for an empty model
- IMoleculeSet moleculeSet = chemModel.getMoleculeSet();
+ IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
IReactionSet reactionSet = chemModel.getReactionSet();
// nasty, but it seems that reactions can be read in as ChemModels
@@ -324,7 +323,7 @@ public void repaint(IDrawVisitor drawVisitor) {
* @return a rectangle in screen space.
*/
public Rectangle calculateDiagramBounds(IChemModel model) {
- IMoleculeSet moleculeSet = model.getMoleculeSet();
+ IAtomContainerSet moleculeSet = model.getMoleculeSet();
IReactionSet reactionSet = model.getReactionSet();
if ((moleculeSet == null && reactionSet == null)) {
return new Rectangle();
View
25 src/main/org/openscience/cdk/renderer/MoleculeSetRenderer.java
@@ -32,9 +32,8 @@
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemModel;
-import org.openscience.cdk.interfaces.IMolecule;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.renderer.elements.ElementGroup;
import org.openscience.cdk.renderer.elements.IRenderingElement;
@@ -107,8 +106,8 @@
* @cdk.githash
*/
@TestClass("org.openscience.cdk.renderer.MoleculeSetRendererTest")
-public class MoleculeSetRenderer extends AbstractRenderer<IMoleculeSet>
- implements IRenderer<IMoleculeSet> {
+public class MoleculeSetRenderer extends AbstractRenderer<IAtomContainerSet>
+ implements IRenderer<IAtomContainerSet> {
private IRenderer<IAtomContainer> atomContainerRenderer;
@@ -142,7 +141,7 @@ public MoleculeSetRenderer(RendererModel rendererModel,List<IGenerator<IAtomCont
* @param moleculeSet the {@link IMoleculeSet} for what to set the scale
* @param screen the {@link Rectangle} for which to calculate the scale
*/
- public void setup(IMoleculeSet moleculeSet, Rectangle screen) {
+ public void setup(IAtomContainerSet moleculeSet, Rectangle screen) {
this.setScale(moleculeSet);
Rectangle2D bounds = BoundsCalculator.calculateBounds(moleculeSet);
if(bounds != null)
@@ -209,7 +208,7 @@ public Rectangle shift(Rectangle screenBounds, Rectangle diagramBounds) {
*
* @param moleculeSet the {@link IMoleculeSet} for what to set the scale
*/
- public void setScale(IMoleculeSet moleculeSet) {
+ public void setScale(IAtomContainerSet moleculeSet) {
double bondLength = AverageBondLengthCalculator.calculateAverageBondLength(moleculeSet);
double scale = this.calculateScaleForBondLength(bondLength);
@@ -218,7 +217,7 @@ public void setScale(IMoleculeSet moleculeSet) {
}
/** {@inheritDoc} */ @Override
- public Rectangle paint(IMoleculeSet moleculeSet, IDrawVisitor drawVisitor) {
+ public Rectangle paint(IAtomContainerSet moleculeSet, IDrawVisitor drawVisitor) {
// total up the bounding boxes
Rectangle2D totalBounds = BoundsCalculator.calculateBounds(moleculeSet);
@@ -240,7 +239,7 @@ public Rectangle paint(IMoleculeSet moleculeSet, IDrawVisitor drawVisitor) {
* @param resetCenter
* if true, set the draw center to be the center of bounds
*/
- public void paint(IMoleculeSet molecules,
+ public void paint(IAtomContainerSet molecules,
IDrawVisitor drawVisitor, Rectangle2D bounds, boolean resetCenter) {
// total up the bounding boxes
@@ -254,16 +253,16 @@ public void paint(IMoleculeSet molecules,
}
/** {@inheritDoc} */ @Override
- public IRenderingElement generateDiagram(IMoleculeSet molecules) {
+ public IRenderingElement generateDiagram(IAtomContainerSet molecules) {
ElementGroup diagram = new ElementGroup();
- for (IAtomContainer molecule : molecules.molecules()) {
+ for (IAtomContainer molecule : molecules.atomContainers()) {
diagram.add(atomContainerRenderer.generateDiagram(molecule));
}
return diagram;
}
/** {@inheritDoc} */ @Override
- public Rectangle calculateDiagramBounds(IMoleculeSet moleculeSet) {
+ public Rectangle calculateDiagramBounds(IAtomContainerSet moleculeSet) {
if(moleculeSet == null) return this.calculateScreenBounds(new Rectangle2D.Double());
return this.calculateScreenBounds(
BoundsCalculator.calculateBounds(moleculeSet));
@@ -288,8 +287,8 @@ public double calculateScaleForBondLength(double modelBondLength) {
/** {@inheritDoc} */
@Override
- public List<IGenerator<IMoleculeSet>> getGenerators() {
- return new ArrayList<IGenerator<IMoleculeSet>>(generators);
+ public List<IGenerator<IAtomContainerSet>> getGenerators() {
+ return new ArrayList<IGenerator<IAtomContainerSet>>(generators);
}
}
View
5 src/main/org/openscience/cdk/renderer/ReactionRenderer.java
@@ -31,9 +31,8 @@
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.interfaces.IAtomContainer;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IChemModel;
-import org.openscience.cdk.interfaces.IMolecule;
-import org.openscience.cdk.interfaces.IMoleculeSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.renderer.elements.ElementGroup;
import org.openscience.cdk.renderer.elements.IRenderingElement;
@@ -109,7 +108,7 @@
public class ReactionRenderer extends AbstractRenderer<IReaction>
implements IRenderer<IReaction> {
- private IRenderer<IMoleculeSet> moleculeSetRenderer;
+ private IRenderer<IAtomContainerSet> moleculeSetRenderer;
/**
* A renderer that generates diagrams using the specified
View
1  src/main/org/openscience/cdk/renderer/ReactionSetRenderer.java
@@ -31,7 +31,6 @@
import org.openscience.cdk.annotations.TestMethod;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IChemModel;
-import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.interfaces.IReactionSet;
import org.openscience.cdk.renderer.elements.ElementGroup;
View
8 src/main/org/openscience/cdk/renderer/generators/BoundsGenerator.java
@@ -27,7 +27,7 @@
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
-import org.openscience.cdk.interfaces.IMoleculeSet;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.renderer.BoundsCalculator;
import org.openscience.cdk.renderer.RendererModel;
@@ -67,12 +67,12 @@ public BoundsGenerator() {}
@TestMethod("testEmptyReaction")
public IRenderingElement generate(IReaction reaction, RendererModel model) {
ElementGroup elementGroup = new ElementGroup();
- IMoleculeSet reactants = reaction.getReactants();
+ IAtomContainerSet reactants = reaction.getReactants();
if (reactants != null) {
elementGroup.add(this.generate(reactants));
}
- IMoleculeSet products = reaction.getProducts();
+ IAtomContainerSet products = reaction.getProducts();
if (products != null) {
elementGroup.add(this.generate(products));
}
@@ -81,7 +81,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
}
private IRenderingElement generate(
- IMoleculeSet moleculeSet) {
+ IAtomContainerSet moleculeSet) {
Rectangle2D totalBounds = BoundsCalculator.calculateBounds(moleculeSet);
return new RectangleElement(totalBounds.getMinX(),
View
2  src/main/org/openscience/cdk/renderer/generators/ProductsBoxGenerator.java
@@ -60,7 +60,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
double distance = model.getParameter(BondLength.class)
.getValue() / model.getParameter(Scale.class).getValue() / 2;
Rectangle2D totalBounds = null;
- for (IAtomContainer molecule : reaction.getProducts().molecules()) {
+ for (IAtomContainer molecule : reaction.getProducts().atomContainers()) {
Rectangle2D bounds = BoundsCalculator.calculateBounds(molecule);
if (totalBounds == null) {
totalBounds = bounds;
View
6 src/main/org/openscience/cdk/renderer/generators/ReactionPlusGenerator.java
@@ -26,7 +26,7 @@
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
-import org.openscience.cdk.interfaces.IMoleculeSet;
+import org.openscience.cdk.interfaces.IAtomContainerSet;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.renderer.BoundsCalculator;
import org.openscience.cdk.renderer.RendererModel;
@@ -53,7 +53,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
Color color = model.getParameter(
BasicSceneGenerator.ForegroundColor.class
).getValue();
- IMoleculeSet reactants = reaction.getReactants();
+ IAtomContainerSet reactants = reaction.getReactants();
// only draw + signs when there are more than one reactant
if (reactants.getAtomContainerCount() > 1) {
@@ -70,7 +70,7 @@ public IRenderingElement generate(IReaction reaction, RendererModel model) {
}
// only draw + signs when there are more than one products
- IMoleculeSet products = reaction.getProducts();
+ IAtomContainerSet products = reaction.getProducts();
if (products.getAtomContainerCount() > 1) {
Rectangle2D totalBoundsProducts = BoundsCalculator.calculateBounds(products);
double axis = totalBoundsProducts.getCenterY();
Please sign in to comment.
Something went wrong with that request. Please try again.