001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.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
011public class Rectangle extends GraphicalPrimitive2D {
012   private long swigCPtr;
013
014   protected Rectangle(long cPtr, boolean cMemoryOwn)
015   {
016     super(libsbmlJNI.Rectangle_SWIGUpcast(cPtr), cMemoryOwn);
017     swigCPtr = cPtr;
018   }
019
020   protected static long getCPtr(Rectangle obj)
021   {
022     return (obj == null) ? 0 : obj.swigCPtr;
023   }
024
025   protected static long getCPtrAndDisown (Rectangle obj)
026   {
027     long ptr = 0;
028
029     if (obj != null)
030     {
031       ptr             = obj.swigCPtr;
032       obj.swigCMemOwn = false;
033     }
034
035     return ptr;
036   }
037
038  protected void finalize() {
039    delete();
040  }
041
042  public synchronized void delete() {
043    if (swigCPtr != 0) {
044      if (swigCMemOwn) {
045        swigCMemOwn = false;
046        libsbmlJNI.delete_Rectangle(swigCPtr);
047      }
048      swigCPtr = 0;
049    }
050    super.delete();
051  }
052
053  
054/**
055   * Creates a new Rectangle object with the given SBML level
056   * and SBML version.
057   <p>
058   * @param level SBML level of the new object
059   * @param level SBML version of the new object
060   */ public
061 Rectangle(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
062    this(libsbmlJNI.new_Rectangle__SWIG_0(level, version, pkgVersion), true);
063  }
064
065  
066/**
067   * Creates a new Rectangle object with the given SBML level
068   * and SBML version.
069   <p>
070   * @param level SBML level of the new object
071   * @param level SBML version of the new object
072   */ public
073 Rectangle(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
074    this(libsbmlJNI.new_Rectangle__SWIG_1(level, version), true);
075  }
076
077  
078/**
079   * Creates a new Rectangle object with the given SBML level
080   * and SBML version.
081   <p>
082   * @param level SBML level of the new object
083   * @param level SBML version of the new object
084   */ public
085 Rectangle(long level) throws org.sbml.libsbml.SBMLConstructorException {
086    this(libsbmlJNI.new_Rectangle__SWIG_2(level), true);
087  }
088
089  
090/**
091   * Creates a new Rectangle object with the given SBML level
092   * and SBML version.
093   <p>
094   * @param level SBML level of the new object
095   * @param level SBML version of the new object
096   */ public
097 Rectangle() throws org.sbml.libsbml.SBMLConstructorException {
098    this(libsbmlJNI.new_Rectangle__SWIG_3(), true);
099  }
100
101  
102/**
103   * Creates a new Rectangle object with the given {@link SBMLNamespaces}.
104   <p>
105   * @param sbmlns The SBML namespace for the object.
106   */ public
107 Rectangle(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
108    this(libsbmlJNI.new_Rectangle__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
109  }
110
111  
112/**
113   * Creates a new Rectangle object from the given {@link XMLNode} object.
114   * The {@link XMLNode} object has to contain a valid XML representation of a 
115   * Rectangle object as defined in the render extension specification.
116   * This method is normally called when render information is read from a file and 
117   * should normally not have to be called explicitly.
118   <p>
119   * @param node the {@link XMLNode} object reference that describes the Rectangle
120   * object to be instantiated.
121   */ public
122 Rectangle(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
123    this(libsbmlJNI.new_Rectangle__SWIG_5(XMLNode.getCPtr(node), node, l2version), true);
124  }
125
126  
127/**
128   * Creates a new Rectangle object from the given {@link XMLNode} object.
129   * The {@link XMLNode} object has to contain a valid XML representation of a 
130   * Rectangle object as defined in the render extension specification.
131   * This method is normally called when render information is read from a file and 
132   * should normally not have to be called explicitly.
133   <p>
134   * @param node the {@link XMLNode} object reference that describes the Rectangle
135   * object to be instantiated.
136   */ public
137 Rectangle(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
138    this(libsbmlJNI.new_Rectangle__SWIG_6(XMLNode.getCPtr(node), node), true);
139  }
140
141  
142/**
143   * Instantiates a new Rectangle object.
144   * All attributes are set as described for the default constructor
145   * of {@link GraphicalPrimitive2D}.
146   <p>
147   * The id is set to the given string and all rectangle specific attributes are set to 0.
148   <p>
149   * @param id id string for the rectangle
150   <p>
151   * This constructor is deprecated. The new libsbml API only has
152   * constructors which take the SBML level and version or one that takes
153   * an {@link SBMLNamespaces} object.
154   */ public
155 Rectangle(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException {
156    this(libsbmlJNI.new_Rectangle__SWIG_7(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true);
157  }
158
159  
160/**
161   * Instantiates a new Rectangle object.
162   * All attributes are set as described for the default constructor
163   * of {@link GraphicalPrimitive2D}.
164   <p>
165   * The id is set to the given string and all rectangle specific attributes
166   * are set to the given values.
167   <p>
168   * @param id id string for the rectangle
169   * @param x x coordinate of the position 
170   * @param y y coordinate of the position 
171   * @param z z coordinate of the position 
172   * @param w w width
173   * @param h h height
174   <p>
175   * This constructor is deprecated. The new libsbml API only has
176   * constructors which take the SBML level and version or one that takes
177   * an {@link SBMLNamespaces} object.
178   */ public
179 Rectangle(RenderPkgNamespaces renderns, String id, RelAbsVector x, RelAbsVector y, RelAbsVector z, RelAbsVector w, RelAbsVector h) throws org.sbml.libsbml.SBMLConstructorException {
180    this(libsbmlJNI.new_Rectangle__SWIG_8(RenderPkgNamespaces.getCPtr(renderns), renderns, id, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(z), z, RelAbsVector.getCPtr(w), w, RelAbsVector.getCPtr(h), h), true);
181  }
182
183  
184/**
185   * Instantiates a new Rectangle object.
186   * All attributes are set as described for the default constructor
187   * of {@link GraphicalPrimitive2D}.
188   <p>
189   * The id is set to the given string and all rectangle specific attributes
190   * are set to the given values. The z coordinate of the position is set to 0.
191   <p>
192   * @param id id string for the rectangle
193   * @param x x coordinate of the position 
194   * @param y y coordinate of the position 
195   * @param w w width
196   * @param h h height
197   <p>
198   * This constructor is deprecated. The new libsbml API only has
199   * constructors which take the SBML level and version or one that takes
200   * an {@link SBMLNamespaces} object.
201   */ public
202 Rectangle(RenderPkgNamespaces renderns, String id, RelAbsVector x, RelAbsVector y, RelAbsVector w, RelAbsVector h) throws org.sbml.libsbml.SBMLConstructorException {
203    this(libsbmlJNI.new_Rectangle__SWIG_9(RenderPkgNamespaces.getCPtr(renderns), renderns, id, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(w), w, RelAbsVector.getCPtr(h), h), true);
204  }
205
206  
207/**
208  * Returns the value of the 'ratio' attribute of this Rectangle.
209  <p>
210  * @return the value of the 'ratio' attribute of this Rectangle as a double.
211  */ public
212 double getRatio() {
213    return libsbmlJNI.Rectangle_getRatio(swigCPtr, this);
214  }
215
216  
217/**
218  * Predicate returning <code>true</code> if this Rectangle's 'ratio' attribute is set.
219  <p>
220  * @return <code>true</code> if this Rectangle's 'ratio' attribute has been set,
221  * otherwise <code>false</code> is returned.
222  */ public
223 boolean isSetRatio() {
224    return libsbmlJNI.Rectangle_isSetRatio(swigCPtr, this);
225  }
226
227  
228/**
229  * Sets the value of the 'ratio' attribute of this Rectangle.
230  <p>
231  * @param ratio double value of the 'ratio' attribute to be set.
232  <p>
233  * <p>
234 * @return integer value indicating success/failure of the
235 * function.   The possible values
236 * returned by this function are:
237  * <ul>
238  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
239  * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
240  * </ul>
241  */ public
242 int setRatio(double ratio) {
243    return libsbmlJNI.Rectangle_setRatio(swigCPtr, this, ratio);
244  }
245
246  
247/**
248  * Unsets the value of the 'ratio' attribute of this Rectangle.
249  <p>
250  * <p>
251 * @return integer value indicating success/failure of the
252 * function.   The possible values
253 * returned by this function are:
254  * <ul>
255  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
256  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
257  * </ul>
258  */ public
259 int unsetRatio() {
260    return libsbmlJNI.Rectangle_unsetRatio(swigCPtr, this);
261  }
262
263  
264/**
265   * Sets the position and the size of the Rectangle within the viewport.
266   <p>
267   * @param x x coordinate of the position 
268   * @param y y coordinate of the position 
269   * @param z z coordinate of the position 
270   * @param w w width
271   * @param h h height
272   */ public
273 void setCoordinatesAndSize(RelAbsVector x, RelAbsVector y, RelAbsVector z, RelAbsVector w, RelAbsVector h) {
274    libsbmlJNI.Rectangle_setCoordinatesAndSize(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(z), z, RelAbsVector.getCPtr(w), w, RelAbsVector.getCPtr(h), h);
275  }
276
277  
278/**
279   * Sets the position of the Rectangle within the viewport.
280   <p>
281   * @param x x coordinate of the position 
282   * @param y y coordinate of the position 
283   * @param z z coordinate of the position 
284   */ public
285 void setCoordinates(RelAbsVector x, RelAbsVector y, RelAbsVector z) {
286    libsbmlJNI.Rectangle_setCoordinates(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(z), z);
287  }
288
289  
290/**
291   * Sets the size of the Rectangle 
292   <p>
293   * @param w w width
294   * @param h h height
295   */ public
296 void setSize(RelAbsVector w, RelAbsVector h) {
297    libsbmlJNI.Rectangle_setSize(swigCPtr, this, RelAbsVector.getCPtr(w), w, RelAbsVector.getCPtr(h), h);
298  }
299
300  
301/**
302   * Sets the siwidth of the Rectangle 
303   <p>
304   * @param w w width
305   */ public
306 void setWidth(RelAbsVector w) {
307    libsbmlJNI.Rectangle_setWidth(swigCPtr, this, RelAbsVector.getCPtr(w), w);
308  }
309
310  
311/**
312   * Sets the height of the Rectangle 
313   <p>
314   * @param h h height
315   */ public
316 void setHeight(RelAbsVector h) {
317    libsbmlJNI.Rectangle_setHeight(swigCPtr, this, RelAbsVector.getCPtr(h), h);
318  }
319
320  
321/**
322   * Sets the two corner radii of the rectangle
323   <p>
324   * @param rx corner radius along the x axis
325   * @param ry corner radius along the y axis
326   */ public
327 void setRadii(RelAbsVector rx, RelAbsVector ry) {
328    libsbmlJNI.Rectangle_setRadii(swigCPtr, this, RelAbsVector.getCPtr(rx), rx, RelAbsVector.getCPtr(ry), ry);
329  }
330
331  
332/**
333   * Sets the corner radius along the x axis
334   <p>
335   * @param rx corner radius along the x axis
336   */ public
337 void setRadiusX(RelAbsVector rx) {
338    libsbmlJNI.Rectangle_setRadiusX(swigCPtr, this, RelAbsVector.getCPtr(rx), rx);
339  }
340
341  
342/**
343   * Sets the corner radius along the y axis
344   <p>
345   * @param ry corner radius along the y axis
346   */ public
347 void setRadiusY(RelAbsVector ry) {
348    libsbmlJNI.Rectangle_setRadiusY(swigCPtr, this, RelAbsVector.getCPtr(ry), ry);
349  }
350
351  
352/**
353   * Sets the x position of the Rectangle within the viewport.
354   <p>
355   * @param x x coordinate of the position 
356   */ public
357 void setX(RelAbsVector x) {
358    libsbmlJNI.Rectangle_setX(swigCPtr, this, RelAbsVector.getCPtr(x), x);
359  }
360
361  
362/**
363   * Sets the y position of the Rectangle within the viewport.
364   <p>
365   * @param y y coordinate of the position 
366   */ public
367 void setY(RelAbsVector y) {
368    libsbmlJNI.Rectangle_setY(swigCPtr, this, RelAbsVector.getCPtr(y), y);
369  }
370
371  
372/**
373   * Sets the z position of the Rectangle within the viewport.
374   <p>
375   * @param z z coordinate of the position 
376   */ public
377 void setZ(RelAbsVector z) {
378    libsbmlJNI.Rectangle_setZ(swigCPtr, this, RelAbsVector.getCPtr(z), z);
379  }
380
381  
382/**
383   * Returns the x coordinate of the rectangles position
384   <p>
385   * @return  reference to {@link RelAbsVector} that represents the x position
386   */ public
387 RelAbsVector getX() {
388    return new RelAbsVector(libsbmlJNI.Rectangle_getX__SWIG_0(swigCPtr, this), false);
389  }
390
391  
392/**
393   * Returns the y coordinate of the rectangles position
394   <p>
395   * @return  reference to {@link RelAbsVector} that represents the y position
396   */ public
397 RelAbsVector getY() {
398    return new RelAbsVector(libsbmlJNI.Rectangle_getY__SWIG_0(swigCPtr, this), false);
399  }
400
401  
402/**
403   * Returns the z coordinate of the rectangles position
404   <p>
405   * @return  reference to {@link RelAbsVector} that represents the z position
406   */ public
407 RelAbsVector getZ() {
408    return new RelAbsVector(libsbmlJNI.Rectangle_getZ__SWIG_0(swigCPtr, this), false);
409  }
410
411  
412/**
413   * Returns the with of the rectangle
414   <p>
415   * @return  reference to the {@link RelAbsVector} that represents the width
416   */ public
417 RelAbsVector getWidth() {
418    return new RelAbsVector(libsbmlJNI.Rectangle_getWidth__SWIG_0(swigCPtr, this), false);
419  }
420
421  
422/**
423   * Returns the height of the rectangle
424   <p>
425   * @return  reference to the {@link RelAbsVector} that represents the height
426   */ public
427 RelAbsVector getHeight() {
428    return new RelAbsVector(libsbmlJNI.Rectangle_getHeight__SWIG_0(swigCPtr, this), false);
429  }
430
431  
432/**
433   * Returns the corner radius along the x axis
434   <p>
435   * @return  reference to the {@link RelAbsVector} that corner radius along the x axis
436   */ public
437 RelAbsVector getRadiusX() {
438    return new RelAbsVector(libsbmlJNI.Rectangle_getRadiusX__SWIG_0(swigCPtr, this), false);
439  }
440
441  
442/**
443   * Returns the corner radius along the y axis
444   <p>
445   * @return  reference to the {@link RelAbsVector} that corner radius along the y axis
446   */ public
447 RelAbsVector getRadiusY() {
448    return new RelAbsVector(libsbmlJNI.Rectangle_getRadiusY__SWIG_0(swigCPtr, this), false);
449  }
450
451  
452/**
453   * Creates and returns a deep copy of this Rectangle object.
454   <p>
455   * @return a (deep) copy of this Rectangle object
456   */ public
457 Rectangle cloneObject() {
458    long cPtr = libsbmlJNI.Rectangle_cloneObject(swigCPtr, this);
459    return (cPtr == 0) ? null : new Rectangle(cPtr, true);
460  }
461
462  
463/**
464   * Returns the XML element name of this object.
465   <p>
466   * This is overridden by subclasses to return a string appropriate to the
467   * SBML component.  For example, {@link Model} defines it as returning 'model',
468   * {@link CompartmentType} defines it as returning 'compartmentType', etc.
469   */ public
470 String getElementName() {
471    return libsbmlJNI.Rectangle_getElementName(swigCPtr, this);
472  }
473
474  
475/**
476   * Returns the libSBML type code for this SBML object.
477   <p>
478   * LibSBML attaches an
479   * identifying code to every kind of SBML object.  These are known as
480   * <em>SBML type codes</em>.  In other languages, the set of type codes
481   * is stored in an enumeration; in the Java language interface for
482   * libSBML, the type codes are defined as static integer constants in
483   * interface class {@link libsbmlConstants}.  The names of the type codes
484   * all begin with the characters <code>SBML_.</code> 
485   <p>
486   * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
487   <p>
488   * @see #getElementName()
489   */ public
490 int getTypeCode() {
491    return libsbmlJNI.Rectangle_getTypeCode(swigCPtr, this);
492  }
493
494  
495/**
496   * Creates an {@link XMLNode} object from this Rectangle object.
497   <p>
498   * @return the {@link XMLNode} with the XML representation for the 
499   * Rectangle object.
500   */ public
501 XMLNode toXML() {
502    return new XMLNode(libsbmlJNI.Rectangle_toXML(swigCPtr, this), true);
503  }
504
505  
506/** * @internal */ public
507 boolean hasRequiredAttributes() {
508    return libsbmlJNI.Rectangle_hasRequiredAttributes(swigCPtr, this);
509  }
510
511  
512/** * @internal */ public
513 boolean hasRequiredElements() {
514    return libsbmlJNI.Rectangle_hasRequiredElements(swigCPtr, this);
515  }
516
517}