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