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