001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
004 *
005 * Do not make changes to this file unless you know what you are doing--modify
006 * the SWIG interface file instead.
007 * ----------------------------------------------------------------------------- */
008
009package org.sbml.libsbml;
010
011/** 
012 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span>
013
014 A Cubic B&eacute;zier smooth curve.
015 <p>
016 * In order to be able to represent smooth curves the &ldquo;layout&rdquo;
017 * package defines the class {@link CubicBezier}. It represents a Bezier curve, and
018 * is readily available in most graphics APIs.  The class {@link CubicBezier} is
019 * derived from {@link LineSegment}. It consists of four elements: the two inherited
020 * elements 'start' and 'end', which specify the starting point and the
021 * endpoint of the cubic bezier curve, and two elements 'basePoint1' and
022 * 'basePoint2', which specify the two additional base points that are needed
023 * to describe a cubic bezier curve.
024 */
025
026public class CubicBezier extends LineSegment {
027   private long swigCPtr;
028
029   protected CubicBezier(long cPtr, boolean cMemoryOwn)
030   {
031     super(libsbmlJNI.CubicBezier_SWIGUpcast(cPtr), cMemoryOwn);
032     swigCPtr = cPtr;
033   }
034
035   protected static long getCPtr(CubicBezier obj)
036   {
037     return (obj == null) ? 0 : obj.swigCPtr;
038   }
039
040   protected static long getCPtrAndDisown (CubicBezier obj)
041   {
042     long ptr = 0;
043
044     if (obj != null)
045     {
046       ptr             = obj.swigCPtr;
047       obj.swigCMemOwn = false;
048     }
049
050     return ptr;
051   }
052
053  protected void finalize() {
054    delete();
055  }
056
057  public synchronized void delete() {
058    if (swigCPtr != 0) {
059      if (swigCMemOwn) {
060        swigCMemOwn = false;
061        libsbmlJNI.delete_CubicBezier(swigCPtr);
062      }
063      swigCPtr = 0;
064    }
065    super.delete();
066  }
067
068  
069/**
070   * Creates a {@link CubicBezier} and returns the pointer.
071   */ public
072 CubicBezier(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
073    this(libsbmlJNI.new_CubicBezier__SWIG_0(level, version, pkgVersion), true);
074  }
075
076  
077/**
078   * Creates a {@link CubicBezier} and returns the pointer.
079   */ public
080 CubicBezier(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
081    this(libsbmlJNI.new_CubicBezier__SWIG_1(level, version), true);
082  }
083
084  
085/**
086   * Creates a {@link CubicBezier} and returns the pointer.
087   */ public
088 CubicBezier(long level) throws org.sbml.libsbml.SBMLConstructorException {
089    this(libsbmlJNI.new_CubicBezier__SWIG_2(level), true);
090  }
091
092  
093/**
094   * Creates a {@link CubicBezier} and returns the pointer.
095   */ public
096 CubicBezier() throws org.sbml.libsbml.SBMLConstructorException {
097    this(libsbmlJNI.new_CubicBezier__SWIG_3(), true);
098  }
099
100  
101/**
102   * Ctor.
103   */ public
104 CubicBezier(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
105    this(libsbmlJNI.new_CubicBezier__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
106  }
107
108  
109/**
110   * Creates a {@link CubicBezier} with the given 2D coordinates and returns the
111   * pointer.
112   <p>
113   * (FOR BACKWARD COMPATIBILITY)
114   */ public
115 CubicBezier(LayoutPkgNamespaces layoutns, double x1, double y1, double x2, double y2) throws org.sbml.libsbml.SBMLConstructorException {
116    this(libsbmlJNI.new_CubicBezier__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, x2, y2), true);
117  }
118
119  
120/**
121   * Creates a {@link CubicBezier} with the given 3D coordinates and returns the
122   * pointer.
123   <p>
124   * (FOR BACKWARD COMPATIBILITY)
125   */ public
126 CubicBezier(LayoutPkgNamespaces layoutns, double x1, double y1, double z1, double x2, double y2, double z2) throws org.sbml.libsbml.SBMLConstructorException {
127    this(libsbmlJNI.new_CubicBezier__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, z1, x2, y2, z2), true);
128  }
129
130  
131/**
132   * Copy constructor.
133   <p>
134   * (FOR BACKWARD COMPATIBILITY)
135   */ public
136 CubicBezier(CubicBezier orig) throws org.sbml.libsbml.SBMLConstructorException {
137    this(libsbmlJNI.new_CubicBezier__SWIG_7(CubicBezier.getCPtr(orig), orig), true);
138  }
139
140  
141/**
142   * Creates a {@link CubicBezier} with the given points and returns the pointer.
143   <p>
144   * (FOR BACKWARD COMPATIBILITY)
145   */ public
146 CubicBezier(LayoutPkgNamespaces layoutns, Point start, Point end) throws org.sbml.libsbml.SBMLConstructorException {
147    this(libsbmlJNI.new_CubicBezier__SWIG_8(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, Point.getCPtr(start), start, Point.getCPtr(end), end), true);
148  }
149
150  
151/**
152   * Creates a {@link CubicBezier} with the given points and returns the pointer.
153   <p>
154   * (FOR BACKWARD COMPATIBILITY)
155   */ public
156 CubicBezier(LayoutPkgNamespaces layoutns, Point start, Point base1, Point base2, Point end) throws org.sbml.libsbml.SBMLConstructorException {
157    this(libsbmlJNI.new_CubicBezier__SWIG_9(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, Point.getCPtr(start), start, Point.getCPtr(base1), base1, Point.getCPtr(base2), base2, Point.getCPtr(end), end), true);
158  }
159
160  
161/**
162   * Creates a new {@link Layout} from the given {@link XMLNode}
163   <p>
164   * (FOR BACKWARD COMPATIBILITY)
165   */ public
166 CubicBezier(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
167    this(libsbmlJNI.new_CubicBezier__SWIG_10(XMLNode.getCPtr(node), node, l2version), true);
168  }
169
170  
171/**
172   * Creates a new {@link Layout} from the given {@link XMLNode}
173   <p>
174   * (FOR BACKWARD COMPATIBILITY)
175   */ public
176 CubicBezier(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
177    this(libsbmlJNI.new_CubicBezier__SWIG_11(XMLNode.getCPtr(node), node), true);
178  }
179
180  
181/**
182   * Returns the first base point of the curve (the one closer to the
183   * starting point).
184   */ public
185 Point getBasePoint1() {
186    long cPtr = libsbmlJNI.CubicBezier_getBasePoint1(swigCPtr, this);
187    return (cPtr == 0) ? null : new Point(cPtr, false);
188  }
189
190  
191/**
192   * Initializes first base point with a copy of the given point.
193   */ public
194 void setBasePoint1(Point p) {
195    libsbmlJNI.CubicBezier_setBasePoint1__SWIG_0(swigCPtr, this, Point.getCPtr(p), p);
196  }
197
198  
199/**
200   * Initializes first base point with the given coordinates.
201   */ public
202 void setBasePoint1(double x, double y, double z) {
203    libsbmlJNI.CubicBezier_setBasePoint1__SWIG_1(swigCPtr, this, x, y, z);
204  }
205
206  
207/**
208   * Initializes first base point with the given coordinates.
209   */ public
210 void setBasePoint1(double x, double y) {
211    libsbmlJNI.CubicBezier_setBasePoint1__SWIG_2(swigCPtr, this, x, y);
212  }
213
214  
215/**
216   * Returns the second base point of the curve (the one closer to the end
217   * point).
218   */ public
219 Point getBasePoint2() {
220    long cPtr = libsbmlJNI.CubicBezier_getBasePoint2(swigCPtr, this);
221    return (cPtr == 0) ? null : new Point(cPtr, false);
222  }
223
224  
225/**
226   * Initializes second base point with a copy of the given point.
227   */ public
228 void setBasePoint2(Point p) {
229    libsbmlJNI.CubicBezier_setBasePoint2__SWIG_0(swigCPtr, this, Point.getCPtr(p), p);
230  }
231
232  
233/**
234   * Initializes second base point with the given coordinates.
235   */ public
236 void setBasePoint2(double x, double y, double z) {
237    libsbmlJNI.CubicBezier_setBasePoint2__SWIG_1(swigCPtr, this, x, y, z);
238  }
239
240  
241/**
242   * Initializes second base point with the given coordinates.
243   */ public
244 void setBasePoint2(double x, double y) {
245    libsbmlJNI.CubicBezier_setBasePoint2__SWIG_2(swigCPtr, this, x, y);
246  }
247
248  
249/** * @internal */ public
250 boolean getBasePt1ExplicitlySet() {
251    return libsbmlJNI.CubicBezier_getBasePt1ExplicitlySet(swigCPtr, this);
252  }
253
254  
255/** * @internal */ public
256 boolean getBasePt2ExplicitlySet() {
257    return libsbmlJNI.CubicBezier_getBasePt2ExplicitlySet(swigCPtr, this);
258  }
259
260  
261/**
262   * Calls initDefaults from {@link LineSegment}.
263   */ public
264 void initDefaults() {
265    libsbmlJNI.CubicBezier_initDefaults(swigCPtr, this);
266  }
267
268  
269/**
270   * Makes a line from a {@link CubicBezier} by setting both base points into the
271   * middle between the start and the end point.
272   */ public
273 void straighten() {
274    libsbmlJNI.CubicBezier_straighten(swigCPtr, this);
275  }
276
277  
278/**
279   * Returns the XML element name of
280   * this SBML object.
281   <p>
282   * @return the string of the name of this element
283   */ public
284 String getElementName() {
285    return libsbmlJNI.CubicBezier_getElementName(swigCPtr, this);
286  }
287
288  
289/**
290   * Creates and returns a deep copy of this {@link CubicBezier}.
291   <p>
292   * @return a (deep) copy of this {@link CubicBezier}.
293   */ public
294 CubicBezier cloneObject() {
295    long cPtr = libsbmlJNI.CubicBezier_cloneObject(swigCPtr, this);
296    return (cPtr == 0) ? null : new CubicBezier(cPtr, true);
297  }
298
299  
300/**
301   * Returns the libSBML type code of this object instance.
302   <p>
303   * <p>
304 * LibSBML attaches an identifying code to every kind of SBML object.  These
305 * are integer constants known as <em>SBML type codes</em>.  The names of all
306 * the codes begin with the characters <code>SBML_</code>.
307 * In the Java language interface for libSBML, the
308 * type codes are defined as static integer constants in the interface class
309 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
310 * package plug-ins may use overlapping type codes; to identify the package
311 * to which a given object belongs, call the <code>getPackageName()</code>
312 * method on the object.
313   <p>
314   * @return the SBML type code for this object:
315   * {@link libsbmlConstants#SBML_LAYOUT_CUBICBEZIER SBML_LAYOUT_CUBICBEZIER}
316   <p>
317   * <p>
318 * @warning <span class='warning'>The specific integer values of the possible
319 * type codes may be reused by different Level&nbsp;3 package plug-ins.
320 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
321 * both getTypeCode() and getPackageName()</strong>.</span>
322   <p>
323   * @see #getElementName()
324   * @see #getPackageName()
325   */ public
326 int getTypeCode() {
327    return libsbmlJNI.CubicBezier_getTypeCode(swigCPtr, this);
328  }
329
330  
331/**
332    * Creates an {@link XMLNode} object from this.
333    */ public
334 XMLNode toXML() {
335    return new XMLNode(libsbmlJNI.CubicBezier_toXML(swigCPtr, this), true);
336  }
337
338  public void connectToChild() {
339    libsbmlJNI.CubicBezier_connectToChild(swigCPtr, this);
340  }
341
342  
343/** * @internal */ public
344 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
345    libsbmlJNI.CubicBezier_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
346  }
347
348}