/** array of y2 coordinate. * * Normally used in CML2 array mode. Used for displaying the object in 2 dimensions. Unrelated to the 3-D coordinates for the object. The orientation of the axes matters as it can affect the chirality of object. * --type info-- * * An array of coordinateComponents for a single coordinate. * An array of coordinateComponents for a single coordinate * where these all refer to an X-coordinate (NOT x,y,z).Instances of this type will be * used in array-style representation of 2-D or 3-D coordinates. Currently no machine * validation. Currently not used in STMML, but re-used by CML (see example). * @param value y2 value * @throws RuntimeException attribute wrong value/type */ public void setY2(double[] value) throws RuntimeException { if (value == null) { throw new RuntimeException("null y2"); } List<CMLAtom> atomList = this.getAtoms(value.length, "y2"); int i = 0; for (CMLAtom atom : atomList) { atom.setY2(value[i++]); } } /** Normally used in CML2 array mode.
/** * sets vector of 2D coordinates. * * must be same length as atom set * * @param p2Vector * the vector * @throws CMLException * vector of wrong length */ public void setVector2D(List<Real2> p2Vector) { List<CMLAtom> atoms = this.getAtoms(); if (p2Vector.size() != atoms.size()) { throw new RuntimeException("Vector (" + p2Vector.size() + ") not same length as atoms (" + atoms.size() + CMLConstants.S_RBRAK); } for (int i = 0; i < atoms.size(); i++) { CMLAtom atom = atoms.get(i); Real2 coord = p2Vector.get(i); atom.setX2(coord.getX()); atom.setY2(coord.getY()); } }
/** * sets Real2 for x2 y2. * * @param point */ public void setXY2(Real2 point) { this.setX2(point.getX()); this.setY2(point.getY()); }
private void map2DCoordsToCML(CMLAtom cmlAtom, IAtom cdkAtom) { if (cdkAtom.getPoint2d() != null) { cmlAtom.setX2(cdkAtom.getPoint2d().x); cmlAtom.setY2(cdkAtom.getPoint2d().y); } }
private void map2DCoordsToCML(CMLAtom cmlAtom, IAtom cdkAtom) { if (cdkAtom.getPoint2d() != null) { cmlAtom.setX2(cdkAtom.getPoint2d().x); cmlAtom.setY2(cdkAtom.getPoint2d().y); } }
/** * increase x2 and y2 coordinates. * * if x2 or y2 is unset, no action (to avoid a default of zero) * * @param dx * amount to add * @param dy * amount to add */ public void increaseXY2(double dx, double dy) { if (hasCoordinates(CoordinateType.TWOD)) { this.setX2(this.getX2() + dx); this.setY2(this.getY2() + dy); } }
/** * translate molecule in 2D. * * @param delta2 * add to all 2D coordinates */ public void translate2D(Real2 delta2) { List<CMLAtom> atoms = this.getAtoms(); for (int i = 0; i < atoms.size(); i++) { CMLAtom atom = atoms.get(i); if (atom.getX2Attribute() != null && atom.getY2Attribute() != null) { atom.setX2(atom.getX2() + delta2.getX()); atom.setY2(atom.getY2() + delta2.getY()); } } }
/** * translate molecule in 2D. * * @param delta2 * add to all 2D coordinates */ public void translate2D(Real2 delta2) { for (CMLAtom atom : getAtoms()) { if (atom.hasCoordinates(CoordinateType.TWOD)) { atom.setX2(atom.getX2() + delta2.x); atom.setY2(atom.getY2() + delta2.y); } } }
/** * transforms 2D coordinates of atom. * * if x2 or y2 is unset take no action * * @param t2 * transformation */ public void transform(Transform2 t2) { if (hasCoordinates(CoordinateType.TWOD)) { Real2 xy = new Real2(this.getX2(), this.getY2()); xy.transformBy(t2); this.setX2(xy.getX()); this.setY2(xy.getY()); } }
this.setX2(((double) i) * epsilon); i = (int) (this.getY2() * factor); this.setY2(((double) i) * epsilon);