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