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