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