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 * The {@link RenderGroup} concept from the SBML render extension is used to group graphical primitives together
013 * to create composite representations from simple primitives.
014 <p>
015 * The {@link RenderGroup} class is derived from GrphicalPrimitive2D and inherits all its methods and attributes.
016 * In addition to those, the class defines attributes to specify text render properties (
017 * The attributes of a group are inherited by all children of the group unless they specify 
018 * the attribute themselves.
019 <p>
020   * @see Text),
021 * curve decorations (@see RenderCurve) an id and a list of child elements which can be any 
022 * graphical primitive or other groups.
023 */
024
025public class RenderGroup extends GraphicalPrimitive2D {
026   private long swigCPtr;
027
028   protected RenderGroup(long cPtr, boolean cMemoryOwn)
029   {
030     super(libsbmlJNI.RenderGroup_SWIGUpcast(cPtr), cMemoryOwn);
031     swigCPtr = cPtr;
032   }
033
034   protected static long getCPtr(RenderGroup obj)
035   {
036     return (obj == null) ? 0 : obj.swigCPtr;
037   }
038
039   protected static long getCPtrAndDisown (RenderGroup obj)
040   {
041     long ptr = 0;
042
043     if (obj != null)
044     {
045       ptr             = obj.swigCPtr;
046       obj.swigCMemOwn = false;
047     }
048
049     return ptr;
050   }
051
052  protected void finalize() {
053    delete();
054  }
055
056  public synchronized void delete() {
057    if (swigCPtr != 0) {
058      if (swigCMemOwn) {
059        swigCMemOwn = false;
060        libsbmlJNI.delete_RenderGroup(swigCPtr);
061      }
062      swigCPtr = 0;
063    }
064    super.delete();
065  }
066
067  
068/**
069   * Creates a new {@link RenderGroup} object with the given SBML level
070   * and SBML version.
071   <p>
072   * @param level SBML level of the new object
073   * @param level SBML version of the new object
074   */ public
075 RenderGroup(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
076    this(libsbmlJNI.new_RenderGroup__SWIG_0(level, version, pkgVersion), true);
077  }
078
079  
080/**
081   * Creates a new {@link RenderGroup} object with the given SBML level
082   * and SBML version.
083   <p>
084   * @param level SBML level of the new object
085   * @param level SBML version of the new object
086   */ public
087 RenderGroup(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
088    this(libsbmlJNI.new_RenderGroup__SWIG_1(level, version), true);
089  }
090
091  
092/**
093   * Creates a new {@link RenderGroup} object with the given SBML level
094   * and SBML version.
095   <p>
096   * @param level SBML level of the new object
097   * @param level SBML version of the new object
098   */ public
099 RenderGroup(long level) throws org.sbml.libsbml.SBMLConstructorException {
100    this(libsbmlJNI.new_RenderGroup__SWIG_2(level), true);
101  }
102
103  
104/**
105   * Creates a new {@link RenderGroup} object with the given SBML level
106   * and SBML version.
107   <p>
108   * @param level SBML level of the new object
109   * @param level SBML version of the new object
110   */ public
111 RenderGroup() throws org.sbml.libsbml.SBMLConstructorException {
112    this(libsbmlJNI.new_RenderGroup__SWIG_3(), true);
113  }
114
115  
116/**
117   * Creates a new {@link RenderGroup} object with the given {@link SBMLNamespaces}.
118   <p>
119   * @param sbmlns The SBML namespace for the object.
120   */ public
121 RenderGroup(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException {
122    this(libsbmlJNI.new_RenderGroup__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true);
123  }
124
125  
126/**
127   * Creates a new {@link RenderGroup} object from the given {@link XMLNode} object.
128   * The {@link XMLNode} object has to contain a valid XML representation of a 
129   * {@link RenderGroup} object as defined in the render extension specification.
130   * This method is normally called when render information is read from a file and 
131   * should normally not have to be called explicitly.
132   <p>
133   * @param node the {@link XMLNode} object reference that describes the {@link RenderGroup}
134   * object to be instantiated.
135   */ public
136 RenderGroup(XMLNode group, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
137    this(libsbmlJNI.new_RenderGroup__SWIG_5(XMLNode.getCPtr(group), group, l2version), true);
138  }
139
140  
141/**
142   * Creates a new {@link RenderGroup} object from the given {@link XMLNode} object.
143   * The {@link XMLNode} object has to contain a valid XML representation of a 
144   * {@link RenderGroup} object as defined in the render extension specification.
145   * This method is normally called when render information is read from a file and 
146   * should normally not have to be called explicitly.
147   <p>
148   * @param node the {@link XMLNode} object reference that describes the {@link RenderGroup}
149   * object to be instantiated.
150   */ public
151 RenderGroup(XMLNode group) throws org.sbml.libsbml.SBMLConstructorException {
152    this(libsbmlJNI.new_RenderGroup__SWIG_6(XMLNode.getCPtr(group), group), true);
153  }
154
155  
156/**
157   * Instantiates a new {@link RenderGroup} object.
158   * All attributes are set as described for the default constructor
159   * of {@link GraphicalPrimitive2D}.
160   * All the font rendering attributes and the curve decorations
161   * are unset. The id is set to the given string.
162   <p>
163   * @param id the id for the {@link RenderGroup} object.
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 RenderGroup(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException {
170    this(libsbmlJNI.new_RenderGroup__SWIG_7(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true);
171  }
172
173  
174/**
175   * Sets the font family.
176   <p>
177   * @param family The name of the font family, e.g. Helvetica
178   */ public
179 void setFontFamily(String family) {
180    libsbmlJNI.RenderGroup_setFontFamily(swigCPtr, this, family);
181  }
182
183  
184/**
185   * Sets the font size.
186   * Normally this is an absolute value, e.g. 18 for a 18pt font.
187   * It is however allowed the specify the font size in terms of relative values
188   * in relation to the current viewport. In most cases the viewport will be the 
189   * dimensions of a bounding box of a layout object.
190   <p>
191   * @param size the new font size.
192   */ public
193 void setFontSize(RelAbsVector size) {
194    libsbmlJNI.RenderGroup_setFontSize(swigCPtr, this, RelAbsVector.getCPtr(size), size);
195  }
196
197  
198/**
199   * Sets the font weight.
200   * Valid values are Text.WEIGHT_UNSET, Text.WEIGHT_NORMAL or
201   * Text.WEIGHT_BOLD.
202   <p>
203   * @param weight The new text weight to be set.
204   */ public
205 void setFontWeight(int weight) {
206    libsbmlJNI.RenderGroup_setFontWeight(swigCPtr, this, weight);
207  }
208
209  
210/**
211   * Sets the font style.
212   * Valid values are Text.STYLE_UNSET, Text.STYLE_NORMAL or
213   * Text.STYLE_ITALIC
214   <p>
215   * @param style The new font style to be set.
216   */ public
217 void setFontStyle(int style) {
218    libsbmlJNI.RenderGroup_setFontStyle(swigCPtr, this, style);
219  }
220
221  
222/**
223   * Sets the text anchor.
224   * This is defines the horizontal text position.
225   * Valid values are Text.ANCHOR_UNSET, Text.ANCHOR_START,
226   * Text.ANCHOR_MIDDLE and Text_ANCHOR_END.
227   * Text.ANCHOR_BASELINE is not a valid value
228   * for the text-anchor attribute. If you set the text anchor to 
229   * Text.ANCHOR_BASELINE, it will be set to Text.ANCHOR_UNSET.
230   <p>
231   * @param anchor The new horizontal alignment flag.
232   */ public
233 void setTextAnchor(int anchor) {
234    libsbmlJNI.RenderGroup_setTextAnchor(swigCPtr, this, anchor);
235  }
236
237  
238/**
239   * Sets the vertical text anchor.
240   * This is defines the vertical text position.
241   * Valid values are Text.ANCHOR_UNSET, Text.ANCHOR_TOP,
242   * Text.ANCHOR_MIDDLE and Text_ANCHOR_BOTTOM.
243   <p>
244   * @param anchor The new vertical alignment flag.
245   */ public
246 void setVTextAnchor(int anchor) {
247    libsbmlJNI.RenderGroup_setVTextAnchor(swigCPtr, this, anchor);
248  }
249
250  
251/**
252   * Sets the id of the start head.
253   <p>
254   * @param The id of a {@link LineEnding} object to be applied to the start of curve children.
255   */ public
256 void setStartHead(String id) {
257    libsbmlJNI.RenderGroup_setStartHead(swigCPtr, this, id);
258  }
259
260  
261/**
262   * Sets the id of the end head.
263   <p>
264   * @param The id of a {@link LineEnding} object to be applied to the end of curve children. 
265   */ public
266 void setEndHead(String id) {
267    libsbmlJNI.RenderGroup_setEndHead(swigCPtr, this, id);
268  }
269
270  
271/**
272   * Returns the font family.
273   <p>
274   * @return The name of the font family to be used for text rendering.
275   */ public
276 String getFontFamily() {
277    return libsbmlJNI.RenderGroup_getFontFamily(swigCPtr, this);
278  }
279
280  
281/**
282   * Returns the font size as a reference.
283   <p>
284   * @return A reference to the size to be used for rendering text.
285   */ public
286 RelAbsVector getFontSize() {
287    return new RelAbsVector(libsbmlJNI.RenderGroup_getFontSize__SWIG_0(swigCPtr, this), false);
288  }
289
290  
291/**
292   * Returns the font weight.
293   <p>
294   * @return font weight used to render text children
295   */ public
296 int getFontWeight() {
297    return libsbmlJNI.RenderGroup_getFontWeight(swigCPtr, this);
298  }
299
300  
301/**
302   * Returns the font style.
303   <p>
304   * @return font style used to render text children
305   */ public
306 int getFontStyle() {
307    return libsbmlJNI.RenderGroup_getFontStyle(swigCPtr, this);
308  }
309
310  
311/**
312   * Returns the text anchor.
313   <p>
314   * @return the horizontal text alignment flag
315   */ public
316 int getTextAnchor() {
317    return libsbmlJNI.RenderGroup_getTextAnchor(swigCPtr, this);
318  }
319
320  
321/**
322   * Returns the vertical text anchor.
323   <p>
324   * @return the vertical text alignment flag
325   */ public
326 int getVTextAnchor() {
327    return libsbmlJNI.RenderGroup_getVTextAnchor(swigCPtr, this);
328  }
329
330  
331/**
332   * Returns the id of the {@link LineEnding} object to be applied to the start of the curve.
333   <p>
334   * @return id of the {@link LineEnding} for the start of curves.
335   */ public
336 String getStartHead() {
337    return libsbmlJNI.RenderGroup_getStartHead(swigCPtr, this);
338  }
339
340  
341/**
342   * Returns the id of the {@link LineEnding} object to be applied to the end of the curve.
343   <p>
344   * @return id of the {@link LineEnding} for the end of curves.
345   */ public
346 String getEndHead() {
347    return libsbmlJNI.RenderGroup_getEndHead(swigCPtr, this);
348  }
349
350  
351/**
352   * Returns the number of children in the group.
353   <p>
354   * @return The number of child elements in the group.
355   */ public
356 long getNumElements() {
357    return libsbmlJNI.RenderGroup_getNumElements(swigCPtr, this);
358  }
359
360  
361/**
362   * Returns a  pointer to the list of  elements.
363   <p>
364   * @return  pointer to the list of children
365   */ public
366 ListOfDrawables getListOfElements() {
367    long cPtr = libsbmlJNI.RenderGroup_getListOfElements__SWIG_0(swigCPtr, this);
368    return (cPtr == 0) ? null : new ListOfDrawables(cPtr, false);
369  }
370
371  
372/**
373   * Returns pointer to the element with index n.
374   * If there is no such element, <code>null</code> is returned.
375   <p>
376   * @param index index of element to be returned
377   <p>
378   * @return pointer to element with index index or null if
379   * index is out of bounds.
380   */ public
381 Transformation2D getElement(long index) {
382    long cPtr = libsbmlJNI.RenderGroup_getElement__SWIG_0(swigCPtr, this, index);
383    return (cPtr == 0) ? null : new Transformation2D(cPtr, false);
384  }
385
386  
387/**
388   * Returns pointer to the element with the given <code>id</code>.
389   * If there is no such element, <code>null</code> is returned.
390   * Since the id on all those object is optional, this routine
391   * might not be as helpful as similar routines in other classes.
392   <p>
393   * @param id id of element to be returned
394   <p>
395   * @return pointer to element with id or null if
396   * there is no object with that id
397   */ public
398 Transformation2D getElement(String id) {
399    long cPtr = libsbmlJNI.RenderGroup_getElement__SWIG_2(swigCPtr, this, id);
400    return (cPtr == 0) ? null : new Transformation2D(cPtr, false);
401  }
402
403  
404/**
405   * Returns true if the horizonal alignment attribute has been set.
406   <p>
407   * @return true is flag is not Text.ANCHOR_UNSET
408   */ public
409 boolean isSetTextAnchor() {
410    return libsbmlJNI.RenderGroup_isSetTextAnchor(swigCPtr, this);
411  }
412
413  
414/**
415   * Returns true if the vertical alignment attribute has been set.
416   <p>
417   * @return true is flag is not Text.ANCHOR_UNSET
418   */ public
419 boolean isSetVTextAnchor() {
420    return libsbmlJNI.RenderGroup_isSetVTextAnchor(swigCPtr, this);
421  }
422
423  
424/**
425   * Creates and returns a deep copy of this {@link RenderGroup} object.
426   <p>
427   * @return a (deep) copy of this {@link RenderGroup} object
428   */ public
429 SBase cloneObject() {
430    long cPtr = libsbmlJNI.RenderGroup_cloneObject(swigCPtr, this);
431    return (cPtr == 0) ? null : new RenderGroup(cPtr, true);
432  }
433
434  
435/**
436   * Returns the XML element name of this object, which for
437   * {@link RenderGroup}, is always <code>'g'.</code>
438   <p>
439   * @return the name of this element, i.e., <code>'g'.</code>
440   */ public
441 String getElementName() {
442    return libsbmlJNI.RenderGroup_getElementName(swigCPtr, this);
443  }
444
445  
446/**
447   * Creates an image object and adds it to the end of the list of child
448   * elements. The new element is owned by the group.
449   <p>
450   * @return pointer to the new {@link Image} child.
451   */ public
452 Image createImage() {
453    long cPtr = libsbmlJNI.RenderGroup_createImage(swigCPtr, this);
454    return (cPtr == 0) ? null : new Image(cPtr, false);
455  }
456
457  
458/**
459   * Creates an group object and adds it to the end of the list of child
460   * elements The new element is owned by the group..
461   <p>
462   * @return pointer to the new {@link RenderGroup} child.
463   */ public
464 RenderGroup createGroup() {
465    long cPtr = libsbmlJNI.RenderGroup_createGroup(swigCPtr, this);
466    return (cPtr == 0) ? null : new RenderGroup(cPtr, false);
467  }
468
469  
470/**
471   * Creates a rectangle object and adds it to the end of the list of child
472   * elements The new element is owned by the group..
473   <p>
474   * @return pointer to the new Rectangle child.
475   */ public
476 Rectangle createRectangle() {
477    long cPtr = libsbmlJNI.RenderGroup_createRectangle(swigCPtr, this);
478    return (cPtr == 0) ? null : new Rectangle(cPtr, false);
479  }
480
481  
482/**
483   * Creates an ellipse object and adds it to the end of the list of child
484   * elements The new element is owned by the group..
485   <p>
486   * @return pointer to the new {@link Ellipse} child.
487   */ public
488 Ellipse createEllipse() {
489    long cPtr = libsbmlJNI.RenderGroup_createEllipse(swigCPtr, this);
490    return (cPtr == 0) ? null : new Ellipse(cPtr, false);
491  }
492
493  
494/**
495   * Creates a curve object and adds it to the end of the list of child
496   * elements The new element is owned by the group..
497   <p>
498   * @return pointer to the new {@link RenderCurve} child.
499   */ public
500 RenderCurve createCurve() {
501    long cPtr = libsbmlJNI.RenderGroup_createCurve(swigCPtr, this);
502    return (cPtr == 0) ? null : new RenderCurve(cPtr, false);
503  }
504
505  
506/**
507   * Creates a polygon object and adds it to the end of the list of child
508   * elements The new element is owned by the group..
509   <p>
510   * @return pointer to the new {@link Polygon} child.
511   */ public
512 Polygon createPolygon() {
513    long cPtr = libsbmlJNI.RenderGroup_createPolygon(swigCPtr, this);
514    return (cPtr == 0) ? null : new Polygon(cPtr, false);
515  }
516
517  
518/**
519   * Creates a text object and adds it to the end of the list of child
520   * elements The new element is owned by the group..
521   <p>
522   * @return pointer to the new {@link Text} child.
523   */ public
524 Text createText() {
525    long cPtr = libsbmlJNI.RenderGroup_createText(swigCPtr, this);
526    return (cPtr == 0) ? null : new Text(cPtr, false);
527  }
528
529  
530/**
531   * Adds a copy of the given element to the end of the list of children elements.
532   <p>
533   * @return integer value indicating success/failure of the
534   * function.   The possible values
535   * returned by this function are:
536   * <ul>
537   * <li> LIBSBML_OPERATION_SUCCESS
538   * <li> LIBSBML_LEVEL_MISMATCH
539   * <li> LIBSBML_VERSION_MISMATCH
540   * <li> LIBSBML_OPERATION_FAILED
541   *
542   * </ul> <p>
543   * @note This method should be used with some caution.  The fact that
544   * this method <em>copies</em> the object passed to it means that the caller
545   * will be left holding a physically different object instance than the
546   * one contained in this {@link RenderGroup}.  Changes made to the original object
547   * instance (such as resetting attribute values) will <em>not affect the
548   * instance in the {@link RenderGroup}</em>.  In addition, the caller should make
549   * sure to free the original object if it is no longer being used, or
550   * else a memory leak will result.  Please see {@link RenderGroup#createXXX()}
551   * for methods that do not lead to these issues.
552   <p>
553   * @see #createEllipse()
554   * @see #createRectangle()
555   * @see #createPolygon()
556   * @see #createText()
557   * @see #createCurve()
558   * @see #createRenderGroup()
559   * @see #createImage()
560   */ public
561 int addChildElement(Transformation2D pChild) {
562    return libsbmlJNI.RenderGroup_addChildElement(swigCPtr, this, Transformation2D.getCPtr(pChild), pChild);
563  }
564
565  
566/**
567   * Returns true if the start head is set or false otherwise.
568   * The start decoration is considered set if the string is not empty and if
569   * it is not the string 'none'
570   <p>
571   * @return true is the start decoration id is set
572   */ public
573 boolean isSetStartHead() {
574    return libsbmlJNI.RenderGroup_isSetStartHead(swigCPtr, this);
575  }
576
577  
578/**
579   * Returns true if the end head is set or false otherwise.
580   * The end decoration is considered set if the string is not empty and if
581   * it is not the string 'none'
582   <p>
583   * @return true is the end decoration id is set
584   */ public
585 boolean isSetEndHead() {
586    return libsbmlJNI.RenderGroup_isSetEndHead(swigCPtr, this);
587  }
588
589  
590/**
591   * Returns true if the font family has been set or false otherwise.
592   <p>
593   * @return true if the font family string is not empty
594   */ public
595 boolean isSetFontFamily() {
596    return libsbmlJNI.RenderGroup_isSetFontFamily(swigCPtr, this);
597  }
598
599  
600/**
601   * Returns true if the font size has been set or false otherwise.
602   <p>
603   * @return true if the {@link RelAbsVector} specifying the font size does not
604   * contain NaN either as the absolute or the relative value.
605   */ public
606 boolean isSetFontSize() {
607    return libsbmlJNI.RenderGroup_isSetFontSize(swigCPtr, this);
608  }
609
610  
611/**
612   * Returns true if the font weight has been set or false otherwise.
613   <p>
614   * @return true is the flag is not Text.WEIGHT_UNSET
615   */ public
616 boolean isSetFontWeight() {
617    return libsbmlJNI.RenderGroup_isSetFontWeight(swigCPtr, this);
618  }
619
620  
621/**
622   * Returns true if the font style has been set or false otherwise.
623   <p>
624   * @return true is the flag is not Text.STYLE_UNSET
625   */ public
626 boolean isSetFontStyle() {
627    return libsbmlJNI.RenderGroup_isSetFontStyle(swigCPtr, this);
628  }
629
630  
631/**
632   * Creates an {@link XMLNode} object from this {@link RenderGroup} object.
633   <p>
634   * @return the {@link XMLNode} with the XML representation for the 
635   * {@link RenderGroup} object.
636   */ public
637 XMLNode toXML() {
638    return new XMLNode(libsbmlJNI.RenderGroup_toXML(swigCPtr, this), true);
639  }
640
641  public void connectToChild() {
642    libsbmlJNI.RenderGroup_connectToChild(swigCPtr, this);
643  }
644
645  
646/** * @internal */ public
647 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
648    libsbmlJNI.RenderGroup_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
649  }
650
651  
652/**
653   * Returns the libSBML type code for this SBML object.
654   <p>
655   * LibSBML attaches an
656   * identifying code to every kind of SBML object.  These are known as
657   * <em>SBML type codes</em>.  In other languages, the set of type codes
658   * is stored in an enumeration; in the Java language interface for
659   * libSBML, the type codes are defined as static integer constants in
660   * interface class {@link libsbmlConstants}.  The names of the type codes
661   * all begin with the characters <code>SBML_.</code> 
662   <p>
663   * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default).
664   <p>
665   * @see #getElementName()
666   */ public
667 int getTypeCode() {
668    return libsbmlJNI.RenderGroup_getTypeCode(swigCPtr, this);
669  }
670
671}