001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.7
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 * Representation of a radial gradient object from the SBML render extension.
013 <p>
014 * The concept of a radial gradient is more or or less taken from SVG.
015 * A radial gradient is defined by a center point, a radius and an optional focal point.
016 * So for a valid gradient the radius should have a positive length different from 0 and
017 * the focal point should be within the circle defined by the center point and the radius.
018 * Otherwise all restrictions for the {@link GradientBase} class apply. (
019 * The center and the focal point of a radial gradient are defined by three pairs of
020 * absolute-relative value. (@see RelAbsVector)
021 * The radius is also defined asn an absolute-relative value pair.
022 <p>
023 * For examples of RadialGradients see the render extension specification and/or
024 * the SVG specification.
025 <p>
026   * @see GradientBase)
027 */
028
029public class RadialGradient extends GradientBase {
030   private long swigCPtr;
031
032   protected RadialGradient(long cPtr, boolean cMemoryOwn)
033   {
034     super(libsbmlJNI.RadialGradient_SWIGUpcast(cPtr), cMemoryOwn);
035     swigCPtr = cPtr;
036   }
037
038   protected static long getCPtr(RadialGradient obj)
039   {
040     return (obj == null) ? 0 : obj.swigCPtr;
041   }
042
043   protected static long getCPtrAndDisown (RadialGradient obj)
044   {
045     long ptr = 0;
046
047     if (obj != null)
048     {
049       ptr             = obj.swigCPtr;
050       obj.swigCMemOwn = false;
051     }
052
053     return ptr;
054   }
055
056  protected void finalize() {
057    delete();
058  }
059
060  public synchronized void delete() {
061    if (swigCPtr != 0) {
062      if (swigCMemOwn) {
063        swigCMemOwn = false;
064        libsbmlJNI.delete_RadialGradient(swigCPtr);
065      }
066      swigCPtr = 0;
067    }
068    super.delete();
069  }
070
071  
072/**
073   * Creates a new {@link RadialGradient} object with the given SBML level
074   * and SBML version.
075   <p>
076   * @param level SBML level of the new object
077   * @param level SBML version of the new object
078   */ public
079 RadialGradient(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
080    this(libsbmlJNI.new_RadialGradient__SWIG_0(level, version, pkgVersion), true);
081  }
082
083  
084/**
085   * Creates a new {@link RadialGradient} object with the given SBML level
086   * and SBML version.
087   <p>
088   * @param level SBML level of the new object
089   * @param level SBML version of the new object
090   */ public
091 RadialGradient(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
092    this(libsbmlJNI.new_RadialGradient__SWIG_1(level, version), true);
093  }
094
095  
096/**
097   * Creates a new {@link RadialGradient} object with the given SBML level
098   * and SBML version.
099   <p>
100   * @param level SBML level of the new object
101   * @param level SBML version of the new object
102   */ public
103 RadialGradient(long level) throws org.sbml.libsbml.SBMLConstructorException {
104    this(libsbmlJNI.new_RadialGradient__SWIG_2(level), true);
105  }
106
107  
108/**
109   * Creates a new {@link RadialGradient} object with the given SBML level
110   * and SBML version.
111   <p>
112   * @param level SBML level of the new object
113   * @param level SBML version of the new object
114   */ public
115 RadialGradient() throws org.sbml.libsbml.SBMLConstructorException {
116    this(libsbmlJNI.new_RadialGradient__SWIG_3(), true);
117  }
118
119  
120/**
121   * Creates a new {@link RadialGradient} object with the given {@link SBMLNamespaces}.
122   <p>
123   * @param sbmlns The SBML namespace for the object.
124   */ public
125 RadialGradient(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
126    this(libsbmlJNI.new_RadialGradient__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
127  }
128
129  
130/**
131   * Creates a new {@link RadialGradient} object from the given {@link XMLNode} object.
132   * The {@link XMLNode} object has to contain a valid XML representation of a 
133   * {@link RadialGradient} object as defined in the render extension specification.
134   * This method is normally called when render information is read from a file and 
135   * should normally not have to be called explicitly.
136   <p>
137   * @param node the {@link XMLNode} object reference that describes the {@link RadialGradient}
138   * object to be instantiated.
139   */ public
140 RadialGradient(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
141    this(libsbmlJNI.new_RadialGradient__SWIG_5(XMLNode.getCPtr(node), node, l2version), true);
142  }
143
144  
145/**
146   * Constructor which creates a {@link RadialGradient} with no gradient stops.
147   * The id is set to the given value.
148   * The {@link RadialGradient} object is invalid until it has an id and at least two 
149   * gradient stops.
150   * The start and the end of the linear gradient vector are set to (0,0,0).
151   * A linear gradient with a vector of length zero should also be considered invalid.
152   <p>
153   * @param id the new id for the {@link RadialGradient}.
154   <p>
155   * This constructor is deprecated. The new libsbml API only has
156   * constructors which take the SBML level and version or one that takes
157   * an {@link SBMLNamespaces} object.
158   */ public
159 RadialGradient(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException {
160    this(libsbmlJNI.new_RadialGradient__SWIG_6(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true);
161  }
162
163  
164/**
165   * Sets the 3D coordinates for the center and the focal
166   * point as well as the radius.
167   * Each value can be a combination of absolute and relative value and is represented by 
168   * a {@link RelAbsVector} object.
169   <p>
170   * @param x x value of the center point of the radial gradient vector
171   * @param y y value of the center point of the radial gradient vector
172   * @param z z value of the center point of the radial gradient vector
173   * @param r x value of the radius of the radial gradient vector
174   * @param fx x value of the focal point of the radial gradient vector
175   * @param fy y value of the focal point of the radial gradient vector
176   * @param fz z value of the focal point of the radial gradient vector
177   */ public
178 void setCoordinates(RelAbsVector x, RelAbsVector y, RelAbsVector z, RelAbsVector r, RelAbsVector fx, RelAbsVector fy, RelAbsVector fz) {
179    libsbmlJNI.RadialGradient_setCoordinates__SWIG_0(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(z), z, RelAbsVector.getCPtr(r), r, RelAbsVector.getCPtr(fx), fx, RelAbsVector.getCPtr(fy), fy, RelAbsVector.getCPtr(fz), fz);
180  }
181
182  
183/**
184   * Sets the 2D coordinates for the center and the focal
185   * point as well as the radius.
186   * The z values are automatically set to 0.
187   * Each value can be a combination of absolute and relative value and is represented by 
188   * a {@link RelAbsVector} object.
189   <p>
190   * @param x x value of the center point of the radial gradient vector
191   * @param y y value of the center point of the radial gradient vector
192   * @param r x value of the radius of the radial gradient vector
193   * @param fx x value of the focal point of the radial gradient vector
194   * @param fy y value of the focal point of the radial gradient vector
195   */ public
196 void setCoordinates(RelAbsVector x, RelAbsVector y, RelAbsVector r, RelAbsVector fx, RelAbsVector fy) {
197    libsbmlJNI.RadialGradient_setCoordinates__SWIG_1(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(r), r, RelAbsVector.getCPtr(fx), fx, RelAbsVector.getCPtr(fy), fy);
198  }
199
200  
201/**
202   * Sets the coordinates for the center point.
203   <p>
204   * @param x x value of the center point of the radial gradient vector
205   * @param y y value of the center point of the radial gradient vector
206   * @param z z value of the center point of the radial gradient vector
207   * The z argument can be omitted. In that case it is set to 0.
208   */ public
209 void setCenter(RelAbsVector x, RelAbsVector y, RelAbsVector z) {
210    libsbmlJNI.RadialGradient_setCenter__SWIG_0(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(z), z);
211  }
212
213  
214/**
215   * Sets the coordinates for the center point.
216   <p>
217   * @param x x value of the center point of the radial gradient vector
218   * @param y y value of the center point of the radial gradient vector
219   * @param z z value of the center point of the radial gradient vector
220   * The z argument can be omitted. In that case it is set to 0.
221   */ public
222 void setCenter(RelAbsVector x, RelAbsVector y) {
223    libsbmlJNI.RadialGradient_setCenter__SWIG_1(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y);
224  }
225
226  
227/**
228   * Sets the coordinates for the focal point.
229   <p>
230   * @param x x value of the focal point of the radial gradient vector
231   * @param y y value of the focal point of the radial gradient vector
232   * @param z z value of the focal point of the radial gradient vector.
233   * The z argument can be omitted. In that case it is set to 0.
234   */ public
235 void setFocalPoint(RelAbsVector x, RelAbsVector y, RelAbsVector z) {
236    libsbmlJNI.RadialGradient_setFocalPoint__SWIG_0(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(z), z);
237  }
238
239  
240/**
241   * Sets the coordinates for the focal point.
242   <p>
243   * @param x x value of the focal point of the radial gradient vector
244   * @param y y value of the focal point of the radial gradient vector
245   * @param z z value of the focal point of the radial gradient vector.
246   * The z argument can be omitted. In that case it is set to 0.
247   */ public
248 void setFocalPoint(RelAbsVector x, RelAbsVector y) {
249    libsbmlJNI.RadialGradient_setFocalPoint__SWIG_1(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y);
250  }
251
252  
253/**
254   * Sets the radius of the radial gradient.
255   <p>
256   * @param r radius of the radial gradient vector.
257   */ public
258 void setRadius(RelAbsVector r) {
259    libsbmlJNI.RadialGradient_setRadius(swigCPtr, this, RelAbsVector.getCPtr(r), r);
260  }
261
262  
263/**
264   * Returns the x coordinate for the center point as a  reference.
265   <p>
266   * @return  reference to the x coordinatee of the center point.
267   */ public
268 RelAbsVector getCenterX() {
269    return new RelAbsVector(libsbmlJNI.RadialGradient_getCenterX__SWIG_0(swigCPtr, this), false);
270  }
271
272  
273/**
274   * Returns the y coordinate for the center point as a  reference.
275   <p>
276   * @return  reference to the y coordinatee of the center point.
277   */ public
278 RelAbsVector getCenterY() {
279    return new RelAbsVector(libsbmlJNI.RadialGradient_getCenterY__SWIG_0(swigCPtr, this), false);
280  }
281
282  
283/**
284   * Returns the z coordinate for the center point as a  reference.
285   <p>
286   * @return  reference to the z coordinatee of the center point.
287   */ public
288 RelAbsVector getCenterZ() {
289    return new RelAbsVector(libsbmlJNI.RadialGradient_getCenterZ__SWIG_0(swigCPtr, this), false);
290  }
291
292  
293/**
294   * Returns the x coordinate for the focal point as a  reference.
295   <p>
296   * @return  reference to the x coordinatee of the focal point.
297   */ public
298 RelAbsVector getFocalPointX() {
299    return new RelAbsVector(libsbmlJNI.RadialGradient_getFocalPointX__SWIG_0(swigCPtr, this), false);
300  }
301
302  
303/**
304   * Returns the y coordinate for the focal point as a  reference.
305   <p>
306   * @return  reference to the y coordinatee of the focal point.
307   */ public
308 RelAbsVector getFocalPointY() {
309    return new RelAbsVector(libsbmlJNI.RadialGradient_getFocalPointY__SWIG_0(swigCPtr, this), false);
310  }
311
312  
313/**
314   * Returns the z coordinate for the focal point as a  reference.
315   <p>
316   * @return  reference to the z coordinatee of the focal point.
317   */ public
318 RelAbsVector getFocalPointZ() {
319    return new RelAbsVector(libsbmlJNI.RadialGradient_getFocalPointZ__SWIG_0(swigCPtr, this), false);
320  }
321
322  
323/**
324   * Returns the radius as a  reference.
325   <p>
326   * @return  reference to the radius 
327   */ public
328 RelAbsVector getRadius() {
329    return new RelAbsVector(libsbmlJNI.RadialGradient_getRadius__SWIG_0(swigCPtr, this), false);
330  }
331
332  
333/**
334   * Creates and returns a deep copy of this {@link RadialGradient} object.
335   <p>
336   * @return a (deep) copy of this {@link RadialGradient} object
337   */ public
338 RadialGradient cloneObject() {
339    long cPtr = libsbmlJNI.RadialGradient_cloneObject(swigCPtr, this);
340    return (cPtr == 0) ? null : new RadialGradient(cPtr, true);
341  }
342
343  
344/**
345   * Returns the XML element name of this object.
346   <p>
347   * This is overridden by subclasses to return a string appropriate to the
348   * SBML component.  For example, {@link Model} defines it as returning 'model',
349   * {@link CompartmentType} defines it as returning 'compartmentType', etc.
350   */ public
351 String getElementName() {
352    return libsbmlJNI.RadialGradient_getElementName(swigCPtr, this);
353  }
354
355  
356/**
357   * Returns the libSBML type code for this SBML object.
358   <p>
359   * LibSBML attaches an
360   * identifying code to every kind of SBML object.  These are known as
361   * <em>SBML type codes</em>.  In other languages, the set of type codes
362   * is stored in an enumeration; in the Java language interface for
363   * libSBML, the type codes are defined as static integer constants in
364   * interface class {@link libsbmlConstants}.  The names of the type codes
365   * all begin with the characters <code>SBML_.</code> 
366   <p>
367   * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
368   <p>
369   * @see #getElementName()
370   */ public
371 int getTypeCode() {
372    return libsbmlJNI.RadialGradient_getTypeCode(swigCPtr, this);
373  }
374
375  
376/**
377   * Creates an {@link XMLNode} object from this {@link RadialGradient} object.
378   <p>
379   * @return the {@link XMLNode} with the XML representation for the 
380   * {@link RadialGradient} object.
381   */ public
382 XMLNode toXML() {
383    return new XMLNode(libsbmlJNI.RadialGradient_toXML(swigCPtr, this), true);
384  }
385
386}