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 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span>
013
014 The basic &ldquo;layout&rdquo; package element for
015 * storing layout information.
016 <p>
017 * All the more specific layout elements (CompartmentGlyph, {@link GeneralGlyph},
018 * {@link SpeciesGlyph}, {@link ReactionGlyph}, {@link ReferenceGlyph}, {@link TextGlyph}, and
019 * {@link SpeciesReferenceGlyph}) are derived from the class {@link GraphicalObject}. Each
020 * object of class {@link GraphicalObject} has a mandatory {@link BoundingBox}, which
021 * specifies the position and the size of the object.  While {@link GraphicalObject}
022 * is the base class for most elements in the &ldquo;layout&rdquo; package,
023 * it is not an abstract class. It can be instantiated when used in the
024 * listOfAdditionalGraphicalObjects to describe additional elements and
025 * relationships. Since it only describes a {@link BoundingBox}, programs are
026 * encouraged to add Annotation objects that describe program-specific
027 * graphical information.
028 */
029
030public class GraphicalObject extends SBase {
031   private long swigCPtr;
032
033   protected GraphicalObject(long cPtr, boolean cMemoryOwn)
034   {
035     super(libsbmlJNI.GraphicalObject_SWIGUpcast(cPtr), cMemoryOwn);
036     swigCPtr = cPtr;
037   }
038
039   protected static long getCPtr(GraphicalObject obj)
040   {
041     return (obj == null) ? 0 : obj.swigCPtr;
042   }
043
044   protected static long getCPtrAndDisown (GraphicalObject obj)
045   {
046     long ptr = 0;
047
048     if (obj != null)
049     {
050       ptr             = obj.swigCPtr;
051       obj.swigCMemOwn = false;
052     }
053
054     return ptr;
055   }
056
057  protected void finalize() {
058    delete();
059  }
060
061  public synchronized void delete() {
062    if (swigCPtr != 0) {
063      if (swigCMemOwn) {
064        swigCMemOwn = false;
065        libsbmlJNI.delete_GraphicalObject(swigCPtr);
066      }
067      swigCPtr = 0;
068    }
069    super.delete();
070  }
071
072  
073/**
074   * Creates a new {@link GraphicalObject}.
075   */ public
076 GraphicalObject(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
077    this(libsbmlJNI.new_GraphicalObject__SWIG_0(level, version, pkgVersion), true);
078  }
079
080  
081/**
082   * Creates a new {@link GraphicalObject}.
083   */ public
084 GraphicalObject(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
085    this(libsbmlJNI.new_GraphicalObject__SWIG_1(level, version), true);
086  }
087
088  
089/**
090   * Creates a new {@link GraphicalObject}.
091   */ public
092 GraphicalObject(long level) throws org.sbml.libsbml.SBMLConstructorException {
093    this(libsbmlJNI.new_GraphicalObject__SWIG_2(level), true);
094  }
095
096  
097/**
098   * Creates a new {@link GraphicalObject}.
099   */ public
100 GraphicalObject() throws org.sbml.libsbml.SBMLConstructorException {
101    this(libsbmlJNI.new_GraphicalObject__SWIG_3(), true);
102  }
103
104  
105/**
106   * Creates a new {@link GraphicalObject} with the given {@link LayoutPkgNamespaces}
107   */ public
108 GraphicalObject(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
109    this(libsbmlJNI.new_GraphicalObject__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
110  }
111
112  
113/**
114   * Creates a new {@link GraphicalObject} with the given <code>id</code>.
115   <p>
116   * (FOR BACKWARD COMPATIBILITY)
117   */ public
118 GraphicalObject(LayoutPkgNamespaces layoutns, String id) throws org.sbml.libsbml.SBMLConstructorException {
119    this(libsbmlJNI.new_GraphicalObject__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id), true);
120  }
121
122  
123/**
124   * Creates a new {@link GraphicalObject} with the given <code>id</code> and 2D coordinates for
125   * the bounding box.
126   <p>
127   * (FOR BACKWARD COMPATIBILITY)
128   */ public
129 GraphicalObject(LayoutPkgNamespaces layoutns, String id, double x, double y, double w, double h) throws org.sbml.libsbml.SBMLConstructorException {
130    this(libsbmlJNI.new_GraphicalObject__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, x, y, w, h), true);
131  }
132
133  
134/**
135   * Creates a new {@link GraphicalObject} with the given <code>id</code> and 3D coordinates for
136   * the bounding box.
137   <p>
138   * (FOR BACKWARD COMPATIBILITY)
139   */ public
140 GraphicalObject(LayoutPkgNamespaces layoutns, String id, double x, double y, double z, double w, double h, double d) throws org.sbml.libsbml.SBMLConstructorException {
141    this(libsbmlJNI.new_GraphicalObject__SWIG_7(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, x, y, z, w, h, d), true);
142  }
143
144  
145/**
146   * Creates a new {@link GraphicalObject} with the given <code>id</code> and 3D coordinates for
147   * the bounding box.
148   <p>
149   * (FOR BACKWARD COMPATIBILITY)
150   */ public
151 GraphicalObject(LayoutPkgNamespaces layoutns, String id, Point p, Dimensions d) throws org.sbml.libsbml.SBMLConstructorException {
152    this(libsbmlJNI.new_GraphicalObject__SWIG_8(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, Point.getCPtr(p), p, Dimensions.getCPtr(d), d), true);
153  }
154
155  
156/**
157   * Creates a new {@link GraphicalObject} with the given <code>id</code> and 3D coordinates for
158   * the bounding box.
159   <p>
160   * (FOR BACKWARD COMPATIBILITY)
161   */ public
162 GraphicalObject(LayoutPkgNamespaces layoutns, String id, BoundingBox bb) throws org.sbml.libsbml.SBMLConstructorException {
163    this(libsbmlJNI.new_GraphicalObject__SWIG_9(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, id, BoundingBox.getCPtr(bb), bb), true);
164  }
165
166  
167/**
168   * Creates a new {@link GraphicalObject} from the given {@link XMLNode}
169   <p>
170   * (FOR BACKWARD COMPATIBILITY)
171   */ public
172 GraphicalObject(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
173    this(libsbmlJNI.new_GraphicalObject__SWIG_10(XMLNode.getCPtr(node), node, l2version), true);
174  }
175
176  
177/**
178   * Creates a new {@link GraphicalObject} from the given {@link XMLNode}
179   <p>
180   * (FOR BACKWARD COMPATIBILITY)
181   */ public
182 GraphicalObject(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
183    this(libsbmlJNI.new_GraphicalObject__SWIG_11(XMLNode.getCPtr(node), node), true);
184  }
185
186  
187/**
188   * Copy constructor.
189   */ public
190 GraphicalObject(GraphicalObject source) throws org.sbml.libsbml.SBMLConstructorException {
191    this(libsbmlJNI.new_GraphicalObject__SWIG_12(GraphicalObject.getCPtr(source), source), true);
192  }
193
194  
195/**
196   * Does nothing. No defaults are defined for {@link GraphicalObject}.
197   */ public
198 void initDefaults() {
199    libsbmlJNI.GraphicalObject_initDefaults(swigCPtr, this);
200  }
201
202  
203/**
204   * Renames all the <code>MetaIdRef</code> attributes on this element.
205   <p>
206   * This method works by looking at all meta-attribute values, comparing
207   * the identifiers to the value of <code>oldid</code>.  If any matches are found,
208   * the matching identifiers are replaced with <code>newid</code>.  The method does
209   * <em>not</em> descend into child elements.
210   <p>
211   * @param oldid the old identifier
212   * @param newid the new identifier
213   */ public
214 void renameMetaIdRefs(String oldid, String newid) {
215    libsbmlJNI.GraphicalObject_renameMetaIdRefs(swigCPtr, this, oldid, newid);
216  }
217
218  
219/**
220   * Returns the value of the 'id' attribute of this {@link GraphicalObject}.
221   */ public
222 String getId() {
223    return libsbmlJNI.GraphicalObject_getId(swigCPtr, this);
224  }
225
226  
227/**
228   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
229   * {@link GraphicalObject}'s 'id' attribute has been set.
230   */ public
231 boolean isSetId() {
232    return libsbmlJNI.GraphicalObject_isSetId(swigCPtr, this);
233  }
234
235  
236/**
237   * Sets the value of the 'id' attribute of this {@link GraphicalObject}.
238   */ public
239 int setId(String id) {
240    return libsbmlJNI.GraphicalObject_setId(swigCPtr, this, id);
241  }
242
243  
244/**
245   * Unsets the value of the 'id' attribute of this {@link GraphicalObject}.
246   */ public
247 int unsetId() {
248    return libsbmlJNI.GraphicalObject_unsetId(swigCPtr, this);
249  }
250
251  
252/**
253   * Returns the value of the 'metaidRef' attribute of this {@link GraphicalObject}.
254   */ public
255 String getMetaIdRef() {
256    return libsbmlJNI.GraphicalObject_getMetaIdRef(swigCPtr, this);
257  }
258
259  
260/**
261   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
262   * {@link GraphicalObject}'s 'metaidRef' attribute has been set.
263   */ public
264 boolean isSetMetaIdRef() {
265    return libsbmlJNI.GraphicalObject_isSetMetaIdRef(swigCPtr, this);
266  }
267
268  
269/**
270   * Sets the value of the 'metaidRef' attribute of this {@link GraphicalObject}.
271   */ public
272 int setMetaIdRef(String metaid) {
273    return libsbmlJNI.GraphicalObject_setMetaIdRef(swigCPtr, this, metaid);
274  }
275
276  
277/**
278   * Unsets the value of the 'metaidRef' attribute of this {@link GraphicalObject}.
279   */ public
280 int unsetMetaIdRef() {
281    return libsbmlJNI.GraphicalObject_unsetMetaIdRef(swigCPtr, this);
282  }
283
284  
285/**
286   * Sets the boundingbox for the {@link GraphicalObject}.
287   */ public
288 void setBoundingBox(BoundingBox bb) {
289    libsbmlJNI.GraphicalObject_setBoundingBox(swigCPtr, this, BoundingBox.getCPtr(bb), bb);
290  }
291
292  
293/**
294   * Returns the bounding box for the {@link GraphicalObject}.
295   */ public
296 BoundingBox getBoundingBox() {
297    long cPtr = libsbmlJNI.GraphicalObject_getBoundingBox(swigCPtr, this);
298    return (cPtr == 0) ? null : new BoundingBox(cPtr, false);
299  }
300
301  
302/** */ public
303 boolean getBoundingBoxExplicitlySet() {
304    return libsbmlJNI.GraphicalObject_getBoundingBoxExplicitlySet(swigCPtr, this);
305  }
306
307  
308/**
309   * Returns the XML element name of
310   * this SBML object.
311   */ public
312 String getElementName() {
313    return libsbmlJNI.GraphicalObject_getElementName(swigCPtr, this);
314  }
315
316  
317/**
318   * Creates and returns a deep copy of this {@link GraphicalObject}.
319   <p>
320   * @return a (deep) copy of this {@link GraphicalObject}.
321   */ public
322 GraphicalObject cloneObject() {
323    return (GraphicalObject) libsbml.DowncastSBase(libsbmlJNI.GraphicalObject_cloneObject(swigCPtr, this), true);
324}
325
326  
327/**
328   * Returns the libSBML type code of this object instance.
329   <p>
330   * <p>
331 * LibSBML attaches an identifying code to every kind of SBML object.  These
332 * are integer constants known as <em>SBML type codes</em>.  The names of all
333 * the codes begin with the characters &ldquo;<code>SBML_</code>&rdquo;. 
334 * In the Java language interface for libSBML, the
335 * type codes are defined as static integer constants in the interface class
336 * {@link libsbmlConstants}.    Note that different Level&nbsp;3 
337 * package plug-ins may use overlapping type codes; to identify the package
338 * to which a given object belongs, call the <code>getPackageName()</code>
339 * method on the object.
340   <p>
341   * @return the SBML type code for this object:
342   * {@link  libsbmlConstants#SBML_LAYOUT_GRAPHICALOBJECT SBML_LAYOUT_GRAPHICALOBJECT}
343   <p>
344   * <p>
345 * @warning <span class='warning'>The specific integer values of the possible
346 * type codes may be reused by different Level&nbsp;3 package plug-ins.
347 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
348 * both getTypeCode() and getPackageName()</strong>.</span>
349   <p>
350   * @see #getElementName()
351   * @see #getPackageName()
352   */ public
353 int getTypeCode() {
354    return libsbmlJNI.GraphicalObject_getTypeCode(swigCPtr, this);
355  }
356
357  
358/**
359    * Creates an {@link XMLNode} object from this.
360    */ public
361 XMLNode toXML() {
362    return new XMLNode(libsbmlJNI.GraphicalObject_toXML(swigCPtr, this), true);
363  }
364
365  
366/**
367   * Sets this SBML object to child SBML objects (if any).
368   * (Creates a child-parent relationship by the parent)
369   <p>
370   * Subclasses must override this function if they define
371   * one ore more child elements.
372   * Basically, this function needs to be called in
373   * constructor, copy constructor, assignment operator.
374   <p>
375   * @see setSBMLDocument
376   * @see enablePackageInternal
377   * @internal
378   */ public
379 void connectToChild() {
380    libsbmlJNI.GraphicalObject_connectToChild(swigCPtr, this);
381  }
382
383  
384/**
385   * Enables/Disables the given package with this element and child
386   * elements (if any).
387   * (This is an internal implementation for enablePakcage function)
388   <p>
389   * @note Subclasses in which one or more child elements are defined
390   * must override this function.
391   * @internal
392   */ public
393 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
394    libsbmlJNI.GraphicalObject_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
395  }
396
397}