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 * implementation of the {@link Image} concept from the SBML
013 * render extension
014 <p>
015 * The image class represents a bitmap image representation. It is derived from {@link Transformation2D}
016 * and inherits all its attributes.
017 <p>
018 * There is an attribute that can be used to specify a file URL where that specifies where the image 
019 * data can be found. If the URL is a relative path, it is considered to be relative to
020 * the document that contains the render extension info.
021 * The path should be the location of a JPEG or PNG image, other image formats are currently not supported
022 * by the SBML render extension.
023 <p>
024 * Additionally it provides an id attribute as well as attributes that determine the dimensions
025 * and the position of the image relative to its viewport.
026 */
027
028public class Image extends Transformation2D {
029   private long swigCPtr;
030
031   protected Image(long cPtr, boolean cMemoryOwn)
032   {
033     super(libsbmlJNI.Image_SWIGUpcast(cPtr), cMemoryOwn);
034     swigCPtr = cPtr;
035   }
036
037   protected static long getCPtr(Image obj)
038   {
039     return (obj == null) ? 0 : obj.swigCPtr;
040   }
041
042   protected static long getCPtrAndDisown (Image obj)
043   {
044     long ptr = 0;
045
046     if (obj != null)
047     {
048       ptr             = obj.swigCPtr;
049       obj.swigCMemOwn = false;
050     }
051
052     return ptr;
053   }
054
055  protected void finalize() {
056    delete();
057  }
058
059  public synchronized void delete() {
060    if (swigCPtr != 0) {
061      if (swigCMemOwn) {
062        swigCMemOwn = false;
063        libsbmlJNI.delete_Image(swigCPtr);
064      }
065      swigCPtr = 0;
066    }
067    super.delete();
068  }
069
070  
071/**
072   * Creates a new {@link Image} object with the given SBML level
073   * and SBML version.
074   <p>
075   * @param level SBML level of the new object
076   * @param level SBML version of the new object
077   */ public
078 Image(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
079    this(libsbmlJNI.new_Image__SWIG_0(level, version, pkgVersion), true);
080  }
081
082  
083/**
084   * Creates a new {@link Image} object with the given SBML level
085   * and SBML version.
086   <p>
087   * @param level SBML level of the new object
088   * @param level SBML version of the new object
089   */ public
090 Image(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
091    this(libsbmlJNI.new_Image__SWIG_1(level, version), true);
092  }
093
094  
095/**
096   * Creates a new {@link Image} object with the given SBML level
097   * and SBML version.
098   <p>
099   * @param level SBML level of the new object
100   * @param level SBML version of the new object
101   */ public
102 Image(long level) throws org.sbml.libsbml.SBMLConstructorException {
103    this(libsbmlJNI.new_Image__SWIG_2(level), true);
104  }
105
106  
107/**
108   * Creates a new {@link Image} object with the given SBML level
109   * and SBML version.
110   <p>
111   * @param level SBML level of the new object
112   * @param level SBML version of the new object
113   */ public
114 Image() throws org.sbml.libsbml.SBMLConstructorException {
115    this(libsbmlJNI.new_Image__SWIG_3(), true);
116  }
117
118  
119/**
120   * Creates a new {@link Image} object with the given {@link SBMLNamespaces}.
121   <p>
122   * @param sbmlns The SBML namespace for the object.
123   */ public
124 Image(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
125    this(libsbmlJNI.new_Image__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
126  }
127
128  
129/**
130   * Creates a new {@link Image} object from the given {@link XMLNode} object.
131   * The {@link XMLNode} object has to contain a valid XML representation of a 
132   * {@link Image} object as defined in the render extension specification.
133   * This method is normally called when render information is read from a file and 
134   * should normally not have to be called explicitly.
135   <p>
136   * @param node the {@link XMLNode} object reference that describes the {@link Image}
137   * object to be instantiated.
138   */ public
139 Image(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
140    this(libsbmlJNI.new_Image__SWIG_5(XMLNode.getCPtr(node), node, l2version), true);
141  }
142
143  
144/**
145   * Creates a new {@link Image} object from the given {@link XMLNode} object.
146   * The {@link XMLNode} object has to contain a valid XML representation of a 
147   * {@link Image} object as defined in the render extension specification.
148   * This method is normally called when render information is read from a file and 
149   * should normally not have to be called explicitly.
150   <p>
151   * @param node the {@link XMLNode} object reference that describes the {@link Image}
152   * object to be instantiated.
153   */ public
154 Image(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
155    this(libsbmlJNI.new_Image__SWIG_6(XMLNode.getCPtr(node), node), true);
156  }
157
158  
159/**
160   * Instantiates an {@link Image} object with the given <code>id</code>.
161   * The image reference is unset, the position and the dimensions
162   * values of the image are set to 0.
163   <p>
164   * For the image to be valid, the reference has to be set and it has to 
165   * have dimensions different from and larger than 0.
166   <p>
167   * This constructor is deprecated. The new libsbml API only has
168   * constructors which take the SBML level and version or one that takes
169   * an {@link SBMLNamespaces} object.
170   */ public
171 Image(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException {
172    this(libsbmlJNI.new_Image__SWIG_7(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true);
173  }
174
175  
176/**
177   * Sets the position of the image relative to its viewport.
178   * The position can either be specified in relative or in absolute coordinates
179   * or a combination of both.
180   * The z coordinatee can be omitted. In that case it is set to 0.
181   <p>
182   * @param x x coordinate of the image position
183   * @param y y coordinate of the image position
184   * @param z z coordinate of the image position
185   */ public
186 void setCoordinates(RelAbsVector x, RelAbsVector y, RelAbsVector z) {
187    libsbmlJNI.Image_setCoordinates__SWIG_0(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y, RelAbsVector.getCPtr(z), z);
188  }
189
190  
191/**
192   * Sets the position of the image relative to its viewport.
193   * The position can either be specified in relative or in absolute coordinates
194   * or a combination of both.
195   * The z coordinatee can be omitted. In that case it is set to 0.
196   <p>
197   * @param x x coordinate of the image position
198   * @param y y coordinate of the image position
199   * @param z z coordinate of the image position
200   */ public
201 void setCoordinates(RelAbsVector x, RelAbsVector y) {
202    libsbmlJNI.Image_setCoordinates__SWIG_1(swigCPtr, this, RelAbsVector.getCPtr(x), x, RelAbsVector.getCPtr(y), y);
203  }
204
205  
206/**
207   * Sets the x coordinate of the image position.
208   * The position can either be specified in relative or in absolute coordinates
209   * or a combination of both.
210   <p>
211   * @param x x coordinate of the image position
212   */ public
213 void setX(RelAbsVector coord) {
214    libsbmlJNI.Image_setX(swigCPtr, this, RelAbsVector.getCPtr(coord), coord);
215  }
216
217  
218/**
219   * Sets the y coordinate of the image position.
220   * The position can either be specified in relative or in absolute coordinates
221   * or a combination of both.
222   <p>
223   * @param y y coordinate of the image position
224   */ public
225 void setY(RelAbsVector coord) {
226    libsbmlJNI.Image_setY(swigCPtr, this, RelAbsVector.getCPtr(coord), coord);
227  }
228
229  
230/**
231   * Sets the z coordinate of the image position.
232   * The position can either be specified in relative or in absolute coordinates
233   * or a combination of both.
234   <p>
235   * @param z z coordinate of the image position
236   */ public
237 void setZ(RelAbsVector coord) {
238    libsbmlJNI.Image_setZ(swigCPtr, this, RelAbsVector.getCPtr(coord), coord);
239  }
240
241  
242/**
243   * Returns a reference to the x coordinate of the image position.
244   <p>
245   * @return reference to the x coordinate of the image position.
246   */ public
247 RelAbsVector getX() {
248    return new RelAbsVector(libsbmlJNI.Image_getX__SWIG_0(swigCPtr, this), false);
249  }
250
251  
252/**
253   * Returns a reference to the y coordinate of the image position.
254   <p>
255   * @return reference to the y coordinate of the image position.
256   */ public
257 RelAbsVector getY() {
258    return new RelAbsVector(libsbmlJNI.Image_getY__SWIG_0(swigCPtr, this), false);
259  }
260
261  
262/**
263   * Returns a reference to the z coordinate of the image position.
264   <p>
265   * @return reference to the z coordinate of the image position.
266   */ public
267 RelAbsVector getZ() {
268    return new RelAbsVector(libsbmlJNI.Image_getZ__SWIG_0(swigCPtr, this), false);
269  }
270
271  
272/**
273   * Sets the dimensions of the image.
274   * The dimensions can be set as relative values or absolute values, or 
275   * a combination of both.
276   <p>
277   * @param width the width of the image when rendered
278   * @param height the height of the image when rendered
279   */ public
280 void setDimensions(RelAbsVector width, RelAbsVector height) {
281    libsbmlJNI.Image_setDimensions(swigCPtr, this, RelAbsVector.getCPtr(width), width, RelAbsVector.getCPtr(height), height);
282  }
283
284  
285/**
286   * Sets the width of the image when rendered.
287   * The width can be set as relative values or absolute values, or 
288   * a combination of both.
289   <p>
290   * @param width the width of the image when rendered
291   */ public
292 void setWidth(RelAbsVector width) {
293    libsbmlJNI.Image_setWidth(swigCPtr, this, RelAbsVector.getCPtr(width), width);
294  }
295
296  
297/**
298   * Sets the height of the image when rendered.
299   * The height can be set as relative values or absolute values, or 
300   * a combination of both.
301   <p>
302   * @param height the height of the image when rendered
303   */ public
304 void setHeight(RelAbsVector height) {
305    libsbmlJNI.Image_setHeight(swigCPtr, this, RelAbsVector.getCPtr(height), height);
306  }
307
308  
309/**
310   * Returns a reference to the width of the image.
311   <p>
312   * @return reference to the width
313   */ public
314 RelAbsVector getWidth() {
315    return new RelAbsVector(libsbmlJNI.Image_getWidth__SWIG_0(swigCPtr, this), false);
316  }
317
318  
319/**
320   * Returns a reference to the height of the image.
321   <p>
322   * @return reference to the height
323   */ public
324 RelAbsVector getHeight() {
325    return new RelAbsVector(libsbmlJNI.Image_getHeight__SWIG_0(swigCPtr, this), false);
326  }
327
328  
329/**
330   * Sets the reference to the image location.
331   * Relative paths are relative to the document that contains the render information.
332   * The path should be the location to a JPEG or PNG bitmap image, other formats are
333   * currently not supported.
334   <p>
335   * @param ref A URL string that specifies where the image is located on the disk.
336   */ public
337 void setImageReference(String ref) {
338    libsbmlJNI.Image_setImageReference(swigCPtr, this, ref);
339  }
340
341  
342/**
343   * Returns the image reference URL string.
344   <p>
345   * @return THe path to the image data as a string.
346   */ public
347 String getImageReference() {
348    return libsbmlJNI.Image_getImageReference(swigCPtr, this);
349  }
350
351  
352/**
353   * Returns true if the image reference has been set.
354   * The image reference is considered set if the string does not
355   * only contain whitespace characters.
356   <p>
357   * @return true if the image reference has been set.
358   */ public
359 boolean isSetImageReference() {
360    return libsbmlJNI.Image_isSetImageReference(swigCPtr, this);
361  }
362
363  
364/**
365   * Creates and returns a deep copy of this {@link Image} object.
366   <p>
367   * @return a (deep) copy of this {@link Image}.
368   */ public
369 Image cloneObject() {
370    long cPtr = libsbmlJNI.Image_cloneObject(swigCPtr, this);
371    return (cPtr == 0) ? null : new Image(cPtr, true);
372  }
373
374  
375/**
376   * Returns the XML element name of this object, which for
377   * {@link Image}, is always <code>'image'.</code>
378   <p>
379   * @return the name of this element, i.e., <code>'image'.</code>
380   */ public
381 String getElementName() {
382    return libsbmlJNI.Image_getElementName(swigCPtr, this);
383  }
384
385  
386/**
387   * Returns the libSBML type code for this SBML object.
388   <p>
389   * LibSBML attaches an
390   * identifying code to every kind of SBML object.  These are known as
391   * <em>SBML type codes</em>.  In other languages, the set of type codes
392   * is stored in an enumeration; in the Java language interface for
393   * libSBML, the type codes are defined as static integer constants in
394   * interface class {@link libsbmlConstants}.  The names of the type codes
395   * all begin with the characters <code>SBML_.</code> 
396   <p>
397   * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
398   <p>
399   * @see #getElementName()
400   */ public
401 int getTypeCode() {
402    return libsbmlJNI.Image_getTypeCode(swigCPtr, this);
403  }
404
405  
406/**
407   * Creates an {@link XMLNode} object from this {@link Image} object.
408   <p>
409   * @return the {@link XMLNode} with the XML representation for the 
410   * {@link Image} object.
411   */ public
412 XMLNode toXML() {
413    return new XMLNode(libsbmlJNI.Image_toXML(swigCPtr, this), true);
414  }
415
416  
417/**
418   * Returns the value of the 'id' attribute of this {@link Image}.
419   <p>
420   * @return the id of the {@link Image}
421   */ public
422 String getId() {
423    return libsbmlJNI.Image_getId(swigCPtr, this);
424  }
425
426  
427/**
428   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
429   * {@link Image}'s 'id' attribute has been set.
430   <p>
431   * @return returns true or false depending on whether the id on the 
432   * {@link Image} has been set.
433   */ public
434 boolean isSetId() {
435    return libsbmlJNI.Image_isSetId(swigCPtr, this);
436  }
437
438  
439/**
440   * Sets the value of the 'id' attribute of this {@link Image}.
441   <p>
442   * @param id the new id for the {@link Image} 
443   <p>
444   * @return status if the operation succeeded
445   */ public
446 int setId(String id) {
447    return libsbmlJNI.Image_setId(swigCPtr, this, id);
448  }
449
450  
451/**
452   * Unsets the value of the 'id' attribute of this {@link Image}.
453   */ public
454 int unsetId() {
455    return libsbmlJNI.Image_unsetId(swigCPtr, this);
456  }
457
458  
459/** * @internal */ public
460 boolean hasRequiredAttributes() {
461    return libsbmlJNI.Image_hasRequiredAttributes(swigCPtr, this);
462  }
463
464  
465/** * @internal */ public
466 boolean hasRequiredElements() {
467    return libsbmlJNI.Image_hasRequiredElements(swigCPtr, this);
468  }
469
470}