1 /** 2 * @file Text.h 3 * @brief Definition of the Text class. 4 * @author Ralph Gauges 5 * @author Frank T. Bergmann 6 * 7 * <!-------------------------------------------------------------------------- 8 * This file is part of libSBML. Please visit http://sbml.org for more 9 * information about SBML, and the latest version of libSBML. 10 * 11 * Copyright (C) 2020 jointly by the following organizations: 12 * 1. California Institute of Technology, Pasadena, CA, USA 13 * 2. University of Heidelberg, Heidelberg, Germany 14 * 3. University College London, London, UK 15 * 16 * Copyright (C) 2019 jointly by the following organizations: 17 * 1. California Institute of Technology, Pasadena, CA, USA 18 * 2. University of Heidelberg, Heidelberg, Germany 19 * 20 * Copyright (C) 2013-2018 jointly by the following organizations: 21 * 1. California Institute of Technology, Pasadena, CA, USA 22 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 23 * 3. University of Heidelberg, Heidelberg, Germany 24 * 25 * Copyright (C) 2011-2013 jointly by the following organizations: 26 * 1. California Institute of Technology, Pasadena, CA, USA 27 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 28 * 29 * Copyright 2010 Ralph Gauges 30 * Group for the modeling of biological processes 31 * University of Heidelberg 32 * Im Neuenheimer Feld 267 33 * 69120 Heidelberg 34 * Germany 35 * 36 * This library is free software; you can redistribute it and/or modify it 37 * under the terms of the GNU Lesser General Public License as published by 38 * the Free Software Foundation. A copy of the license agreement is provided 39 * in the file named "LICENSE.txt" included with this software distribution 40 * and also available online as http://sbml.org/software/libsbml/license.html 41 * ------------------------------------------------------------------------ --> 42 * 43 * @class Text 44 * @sbmlbrief{render} Representation of text elements. 45 * 46 * The Text class represents text to be rendered in the context of a style. 47 * The Text class inherits all attributes and methods from its base class 48 * GraphicalPrimitive1D. 49 * 50 * The text also holds a string for the actual text that is to be rendered 51 * for the Text object. 52 * 53 * Additional attributes specify how the text is to be rendered, for example 54 * which font family is to be used and how the text is to be aligned within 55 * the viewport. 56 */ 57 58 #ifndef Text_H__ 59 #define Text_H__ 60 61 62 #include <sbml/common/extern.h> 63 #include <sbml/common/sbmlfwd.h> 64 #include <sbml/packages/render/common/renderfwd.h> 65 66 67 #ifdef __cplusplus 68 69 70 #include <string> 71 72 73 #include <sbml/packages/render/sbml/GraphicalPrimitive1D.h> 74 #include <sbml/packages/render/extension/RenderExtension.h> 75 #include <sbml/packages/render/sbml/RelAbsVector.h> 76 #include <sbml/xml/XMLNode.h> 77 #include <sbml/xml/XMLAttributes.h> 78 79 80 LIBSBML_CPP_NAMESPACE_BEGIN 81 82 83 class LIBSBML_EXTERN Text : public GraphicalPrimitive1D 84 { 85 public: 86 /** @cond doxygenLibsbmlInternal */ 87 enum FONT_WEIGHT 88 { 89 WEIGHT_UNSET, /*!<The weight is not set, and may be anything.*/ 90 WEIGHT_NORMAL, /*!<The weight is 'normal', thinner and/or lighter than bold text.*/ 91 WEIGHT_BOLD, /*!<The weight is 'bold', thicker and/or darker than normal text.*/ 92 WEIGHT_INVALID /*!<The weight is an unknown or invalid value.*/ 93 }; 94 /** @endcond */ 95 96 /** @cond doxygenLibsbmlInternal */ 97 enum FONT_STYLE 98 { 99 STYLE_UNSET, /*!<The font style is not set, and may be anything. */ 100 STYLE_NORMAL, /*!<The font style is 'normal', or upright and not slanted. */ 101 STYLE_ITALIC, /*!<The font style is 'italic', or slanted. */ 102 STYLE_INVALID /*!<The font style is an unknown or invalid value. */ 103 }; 104 /** @endcond */ 105 106 /** @cond doxygenLibsbmlInternal */ 107 enum TEXT_ANCHOR 108 { 109 ANCHOR_UNSET=0, /*!<The text anchor is unset. */ 110 ANCHOR_START=1, /*!<The text anchor is "start": the start of the text is aligned to the horizontal center of the box.*/ 111 ANCHOR_MIDDLE=2, /*!<The text anchor is "middle": the horizontal center of the text is aligned with the horizontal center of the box. */ 112 ANCHOR_END=3, /*!<The text anchor is "end": the end of the text is aligned with the horizontal center of the box. */ 113 ANCHOR_TOP=1, /*!<The text anchor is "top": the top of the text is aligned with the vertical center of the box. */ 114 ANCHOR_BOTTOM=3, /*!<The text anchor is "bottom": the bottom of the text is aligned with the vertical center of the box. */ 115 ANCHOR_BASELINE=4, /*!<The text anchor is "baseline": the baseline of the text is aligned with the vertical center of the box. */ 116 ANCHOR_INVALID /*!<The text anchor is an unknown or invalid value. */ 117 }; 118 /** @endcond */ 119 120 121 protected: 122 /** @cond doxygenLibsbmlInternal */ 123 RelAbsVector mX; 124 RelAbsVector mY; 125 RelAbsVector mZ; 126 std::string mFontFamily; 127 RelAbsVector mFontSize; 128 int mFontWeight; 129 int mFontStyle; 130 int mTextAnchor; 131 int mVTextAnchor; 132 std::string mText; 133 134 /** @endcond */ 135 136 public: 137 138 /** 139 * Creates a new Text using the given SBML Level, Version and 140 * “render” package version. 141 * 142 * @param level an unsigned int, the SBML Level to assign to this Text. 143 * 144 * @param version an unsigned int, the SBML Version to assign to this Text. 145 * 146 * @param pkgVersion an unsigned int, the SBML Render Version to assign to 147 * this Text. 148 * 149 * @copydetails doc_note_setting_lv_pkg 150 */ 151 Text(unsigned int level = RenderExtension::getDefaultLevel(), 152 unsigned int version = RenderExtension::getDefaultVersion(), 153 unsigned int pkgVersion = RenderExtension::getDefaultPackageVersion()); 154 155 156 /** 157 * Creates a new Text using the given RenderPkgNamespaces object. 158 * 159 * @copydetails doc_what_are_sbml_package_namespaces 160 * 161 * @param renderns the RenderPkgNamespaces object. 162 * 163 * @copydetails doc_note_setting_lv_pkg 164 */ 165 Text(RenderPkgNamespaces *renderns); 166 167 168 /** 169 * Creates a new Text object from the given XMLNode object. 170 * The XMLNode object has to contain a valid XML representation of a 171 * Text object as defined in the render extension specification. 172 * This method is normally called when render information is read from a file and 173 * should normally not have to be called explicitly. 174 * 175 * @param node the XMLNode object reference that describes the Text 176 * object to be instantiated. 177 * 178 * @param l2version an integer indicating the version of SBML Level 2 179 */ 180 Text(const XMLNode& node, unsigned int l2version=4); 181 182 183 #ifndef OMIT_DEPRECATED 184 /** 185 * Instantiates a new Text object with the given @p id and position offset. 186 * The position offset coordinates can be omitted and will be set to 0 in 187 * that case. 188 * 189 * All attributes are set as described for the default constructor 190 * of GraphicalPrimitive1D. 191 * All the font rendering attributes as well 192 * as the text to be rendered are unset. 193 * 194 * @param renderns the SBMLNamespaces object for the SBML "render" package 195 * @param id id string for the Text object 196 * @param x x coordinate of the position offset 197 * @param y y coordinate of the position offset 198 * @param z z coordinate of the position offset 199 * 200 * @copydetails doc_warning_deprecated_constructor 201 */ 202 Text(RenderPkgNamespaces* renderns, const std::string& id,const RelAbsVector& x=RelAbsVector(0.0,0.0),const RelAbsVector& y=RelAbsVector(0.0,0.0),const RelAbsVector& z=RelAbsVector(0.0,0.0)); 203 #endif // OMIT_DEPRECATED 204 205 /** 206 * Copy constructor for Text. 207 * 208 * @param orig the Text instance to copy. 209 */ 210 Text(const Text& orig); 211 212 213 /** 214 * Assignment operator for Text. 215 * 216 * @param rhs the Text object whose values are to be used as the basis of the 217 * assignment. 218 */ 219 Text& operator=(const Text& rhs); 220 221 222 /** 223 * Creates and returns a deep copy of this Text object. 224 * 225 * @return a (deep) copy of this Text object. 226 */ 227 virtual Text* clone() const; 228 229 230 /** 231 * Destructor for Text. 232 */ 233 virtual ~Text(); 234 235 236 /** 237 * Returns the value of the "font-family" attribute of this Text. 238 * 239 * @return the value of the "font-family" attribute of this Text as a string. 240 */ 241 const std::string& getFontFamily() const; 242 243 244 /** 245 * Returns the value of the "font-weight" attribute of this Text. 246 * 247 * @copydetails doc_render_font_weight 248 * 249 * @return the value of the "font-weight" attribute of this Text object. 250 * @if clike The value is drawn from the enumeration #FontWeight_t.@endif@~ 251 * The possible values returned by this method are: 252 * @li @sbmlconstant{FONT_WEIGHT_BOLD, FontWeight_t} 253 * @li @sbmlconstant{FONT_WEIGHT_NORMAL, FontWeight_t} 254 */ 255 int getFontWeight() const; 256 257 258 /** 259 * Returns the value of the "font-weight" attribute of this Text. 260 * 261 * @copydetails doc_render_font_weight 262 * 263 * @return the value of the "font-weight" attribute of this Text as a string. 264 * The possible values returned by this method are: 265 * @li @c "bold" 266 * @li @c "normal" 267 * @li @c "(Unknown FontWeight value)" 268 */ 269 std::string getFontWeightAsString() const; 270 271 272 /** 273 * Returns the value of the "font-style" attribute of this Text. 274 * 275 * @copydetails doc_render_font_style 276 * 277 * @return the value of the "font-style" attribute of this Text object. 278 * @if clike The value is drawn from the enumeration #FontStyle_t.@endif@~ 279 * The possible values returned by this method are: 280 * @li @sbmlconstant{FONT_STYLE_ITALIC, FontStyle_t} 281 * @li @sbmlconstant{FONT_STYLE_NORMAL, FontStyle_t} 282 */ 283 int getFontStyle() const; 284 285 286 /** 287 * Returns the value of the "font-style" attribute of this Text. 288 * 289 * @copydetails doc_render_font_style 290 * 291 * @return the value of the "font-style" attribute of this Text as a string. 292 * The possible values returned by this method are: 293 * @li @c "italic" 294 * @li @c "normal" 295 * @li @c "(Unknown FontStyle value)" 296 */ 297 std::string getFontStyleAsString() const; 298 299 300 /** 301 * Returns the value of the "text-anchor" attribute of this Text. 302 * 303 * @copydetails doc_render_text_anchor 304 * 305 * @return the value of the "text-anchor" attribute of this Text object. 306 * @if clike The value is drawn from the enumeration #HTextAnchor_t. 307 * @endif@~ The possible values returned by this method are: 308 * @li @sbmlconstant{H_TEXTANCHOR_START, HTextAnchor_t} 309 * @li @sbmlconstant{H_TEXTANCHOR_MIDDLE, HTextAnchor_t} 310 * @li @sbmlconstant{H_TEXTANCHOR_END, HTextAnchor_t} 311 */ 312 int getTextAnchor() const; 313 314 315 /** 316 * Returns the value of the "text-anchor" attribute of this Text. 317 * 318 * @copydetails doc_render_text_anchor 319 * 320 * @return the value of the "text-anchor" attribute of this Text as a string. 321 * The possible values returned by this method are: 322 * @li @c "start" 323 * @li @c "middle" 324 * @li @c "end" 325 * @li @c "(Unknown HTextAnchor value)" 326 */ 327 std::string getTextAnchorAsString() const; 328 329 330 /** 331 * Returns the value of the "vtext-anchor" attribute of this Text. 332 * 333 * @copydetails doc_render_vtext_anchor 334 * 335 * @return the value of the "vtext-anchor" attribute of this Text object. 336 * @if clike The value is drawn from the enumeration #VTextAnchor_t. 337 * @endif@~ The possible values returned by this method are: 338 * @li @sbmlconstant{V_TEXTANCHOR_TOP, VTextAnchor_t} 339 * @li @sbmlconstant{V_TEXTANCHOR_MIDDLE, VTextAnchor_t} 340 * @li @sbmlconstant{V_TEXTANCHOR_BOTTOM, VTextAnchor_t} 341 * @li @sbmlconstant{V_TEXTANCHOR_BASELINE, VTextAnchor_t} 342 */ 343 int getVTextAnchor() const; 344 345 346 /** 347 * Returns the value of the "vtext-anchor" attribute of this Text. 348 * 349 * @copydetails doc_render_vtext_anchor 350 * 351 * @return the value of the "vtext-anchor" attribute of this Text as a 352 * string. 353 * The possible values returned by this method are: 354 * @li @c "top" 355 * @li @c "middle" 356 * @li @c "bottom" 357 * @li @c "baseline" 358 * @li @c "(Unknown VTextAnchor value)" 359 */ 360 std::string getVTextAnchorAsString() const; 361 362 363 /** 364 * Predicate returning @c true if this Text's "font-family" attribute is set. 365 * 366 * @return @c true if this Text's "font-family" attribute has been set, 367 * otherwise @c false is returned. 368 */ 369 bool isSetFontFamily() const; 370 371 372 /** 373 * Predicate returning @c true if this Text's "font-weight" attribute is set. 374 * 375 * @copydetails doc_render_font_weight 376 * 377 * @return @c true if this Text's "font-weight" attribute has been set, 378 * otherwise @c false is returned. 379 */ 380 bool isSetFontWeight() const; 381 382 383 /** 384 * Predicate returning @c true if this Text's "font-style" attribute is set. 385 * 386 * @copydetails doc_render_font_style 387 * 388 * @return @c true if this Text's "font-style" attribute has been set, 389 * otherwise @c false is returned. 390 */ 391 bool isSetFontStyle() const; 392 393 394 /** 395 * Predicate returning @c true if this Text's "text-anchor" attribute is set. 396 * 397 * @copydetails doc_render_text_anchor 398 * 399 * @return @c true if this Text's "text-anchor" attribute has been set, 400 * otherwise @c false is returned. 401 */ 402 bool isSetTextAnchor() const; 403 404 405 /** 406 * Predicate returning @c true if this Text's "vtext-anchor" attribute is 407 * set. 408 * 409 * @copydetails doc_render_vtext_anchor 410 * 411 * @return @c true if this Text's "vtext-anchor" attribute has been set, 412 * otherwise @c false is returned. 413 */ 414 bool isSetVTextAnchor() const; 415 416 417 /** 418 * Sets the value of the "font-family" attribute of this Text. 419 * 420 * @param fontFamily std::string& value of the "font-family" attribute to be 421 * set. 422 * Calling this function with @p fontFamily = @c NULL or an empty string is 423 * equivalent to calling unsetFontFamily(). 424 * 425 * @copydetails doc_returns_one_success_code 426 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 427 */ 428 int setFontFamily(const std::string& fontFamily); 429 430 431 /** 432 * Sets the value of the "font-weight" attribute of this Text. 433 * 434 * @copydetails doc_render_font_weight 435 * 436 * @param fontWeight @if clike #FontWeight_t@else int@endif@~ value of the 437 * "font-weight" attribute to be set. 438 * 439 * @copydetails doc_returns_success_code 440 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 441 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 442 * OperationReturnValues_t} 443 */ 444 int setFontWeight(const FontWeight_t fontWeight); 445 446 /** @cond doxygenLibsbmlInternal */ 447 448 void setFontWeight(Text::FONT_WEIGHT weight); 449 450 /** @endcond */ 451 452 453 /** 454 * Sets the value of the "font-weight" attribute of this Text. 455 * 456 * @copydetails doc_render_font_weight 457 * 458 * @param fontWeight the value of the "font-weight" attribute to be set. 459 * 460 * @copydetails doc_returns_success_code 461 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 462 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 463 * OperationReturnValues_t} 464 */ 465 int setFontWeight(const std::string& fontWeight); 466 467 468 /** 469 * Sets the value of the "font-style" attribute of this Text. 470 * 471 * @copydetails doc_render_font_style 472 * 473 * @param fontStyle @if clike #FontStyle_t@else int@endif@~ value of the 474 * "font-style" attribute to be set. 475 * 476 * @copydetails doc_returns_success_code 477 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 478 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 479 * OperationReturnValues_t} 480 */ 481 int setFontStyle(const FontStyle_t fontStyle); 482 483 484 /** @cond doxygenLibsbmlInternal */ 485 486 void setFontStyle(Text::FONT_STYLE style); 487 488 /** @endcond */ 489 /** 490 * Sets the value of the "font-style" attribute of this Text. 491 * 492 * @copydetails doc_render_font_style 493 * 494 * @param fontStyle the "font-style" attribute to be set. 495 * 496 * @copydetails doc_returns_success_code 497 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 498 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 499 * OperationReturnValues_t} 500 */ 501 int setFontStyle(const std::string& fontStyle); 502 503 504 /** 505 * Sets the value of the "text-anchor" attribute of this Text. 506 * 507 * @copydetails doc_render_text_anchor 508 * 509 * @param textAnchor @if clike #HTextAnchor_t@else int@endif@~ value of the 510 * "text-anchor" attribute to be set. 511 * 512 * @copydetails doc_returns_success_code 513 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 514 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 515 * OperationReturnValues_t} 516 */ 517 int setTextAnchor(const HTextAnchor_t textAnchor); 518 519 520 /** @cond doxygenLibsbmlInternal */ 521 522 void setTextAnchor(Text::TEXT_ANCHOR anchor); 523 524 /** @endcond */ 525 526 /** 527 * Sets the value of the "text-anchor" attribute of this Text. 528 * 529 * @copydetails doc_render_text_anchor 530 * 531 * @param textAnchor the value of the "text-anchor" attribute to be set. 532 * 533 * @copydetails doc_returns_success_code 534 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 535 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 536 * OperationReturnValues_t} 537 */ 538 int setTextAnchor(const std::string& textAnchor); 539 540 541 /** 542 * Sets the value of the "vtext-anchor" attribute of this Text. 543 * 544 * @copydetails doc_render_vtext_anchor 545 * 546 * @param vtextAnchor @if clike #VTextAnchor_t@else int@endif@~ value of the 547 * "vtext-anchor" attribute to be set. 548 * 549 * @copydetails doc_returns_success_code 550 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 551 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 552 * OperationReturnValues_t} 553 */ 554 int setVTextAnchor(const VTextAnchor_t vtextAnchor); 555 556 557 /** @cond doxygenLibsbmlInternal */ 558 559 void setVTextAnchor(Text::TEXT_ANCHOR anchor); 560 561 /** @endcond */ 562 563 /** 564 * Sets the value of the "vtext-anchor" attribute of this Text. 565 * 566 * @copydetails doc_render_vtext_anchor 567 * 568 * @param vtextAnchor the value of the "vtext-anchor" attribute to be 569 * set. 570 * 571 * @copydetails doc_returns_success_code 572 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 573 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 574 * OperationReturnValues_t} 575 */ 576 int setVTextAnchor(const std::string& vtextAnchor); 577 578 579 /** 580 * Unsets the value of the "font-family" attribute of this Text. 581 * 582 * @copydetails doc_returns_success_code 583 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 584 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 585 */ 586 int unsetFontFamily(); 587 588 589 /** 590 * Unsets the value of the "font-weight" attribute of this Text. 591 * 592 * @copydetails doc_render_font_weight 593 * 594 * @copydetails doc_returns_one_success_code 595 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 596 */ 597 int unsetFontWeight(); 598 599 600 /** 601 * Unsets the value of the "font-style" attribute of this Text. 602 * 603 * @copydetails doc_render_font_style 604 * 605 * @copydetails doc_returns_one_success_code 606 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 607 */ 608 int unsetFontStyle(); 609 610 611 /** 612 * Unsets the value of the "text-anchor" attribute of this Text. 613 * 614 * @copydetails doc_render_text_anchor 615 * 616 * @copydetails doc_returns_one_success_code 617 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 618 */ 619 int unsetTextAnchor(); 620 621 622 /** 623 * Unsets the value of the "vtext-anchor" attribute of this Text. 624 * 625 * @copydetails doc_render_vtext_anchor 626 * 627 * @copydetails doc_returns_one_success_code 628 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 629 */ 630 int unsetVTextAnchor(); 631 632 633 /** 634 * Returns the x position offset as a const reference. 635 * This offset is applied after alignment. 636 * 637 * @return const reference of x position offset 638 */ 639 const RelAbsVector& getX() const; 640 641 642 /** 643 * Returns the x position offset as a reference. 644 * This offset is applied after alignment. 645 * 646 * @return reference of x position offset 647 */ 648 RelAbsVector& getX(); 649 650 651 /** 652 * Returns the y position offset as a const reference. 653 * This offset is applied after alignment. 654 * 655 * @return const reference of y position offset 656 */ 657 const RelAbsVector& getY() const; 658 659 660 /** 661 * Returns the y position offset as a reference. 662 * This offset is applied after alignment. 663 * 664 * @return reference of y position offset 665 */ 666 RelAbsVector& getY(); 667 668 669 /** 670 * Returns the z position offset as a const reference. 671 * This offset is applied after alignment. 672 * 673 * @return const reference of z position offset 674 */ 675 const RelAbsVector& getZ() const; 676 677 678 /** 679 * Returns the z position offset as a reference. 680 * This offset is applied after alignment. 681 * 682 * @return reference of z position offset 683 */ 684 RelAbsVector& getZ(); 685 686 687 /** 688 * Returns the font size as a const reference. 689 * 690 * @return const reference to the size to be used for rendering text. 691 */ 692 const RelAbsVector& getFontSize() const; 693 694 695 /** 696 * Returns the font size as a reference. 697 * 698 * @return A reference to the size to be used for rendering text. 699 */ 700 RelAbsVector& getFontSize(); 701 702 703 /** 704 * Predicate returning @c true if this Text's "x" element is set. 705 * 706 * @return @c true if this Text's "x" element has been set, otherwise 707 * @c false is returned. 708 */ 709 bool isSetX() const; 710 711 712 /** 713 * Predicate returning @c true if this Text's "y" element is set. 714 * 715 * @return @c true if this Text's "y" element has been set, otherwise 716 * @c false is returned. 717 */ 718 bool isSetY() const; 719 720 721 /** 722 * Predicate returning @c true if this Text's "z" element is set. 723 * 724 * @return @c true if this Text's "z" element has been set, otherwise 725 * @c false is returned. 726 */ 727 bool isSetZ() const; 728 729 730 /** 731 * Predicate returning @c true if this Text's "font-size" element is set. 732 * 733 * @return @c true if this Text's "font-size" element has been set, otherwise 734 * @c false is returned. 735 */ 736 bool isSetFontSize() const; 737 738 739 /** 740 * Sets the position of the text within the viewport. 741 * This is like an offset that is applied after alignment. 742 * If the z coordinate is omitted, it is set to 0. 743 * 744 * @param x x coordinate of the position offset 745 * @param y y coordinate of the position offset 746 * @param z z coordinate of the position offset 747 */ 748 void setCoordinates(const RelAbsVector& x,const RelAbsVector& y,const RelAbsVector& z=RelAbsVector(0.0,0.0)); 749 750 /** 751 * Sets the x position of the text within the viewport. 752 * This is like an offset that is applied after alignment. 753 * 754 * @param x x coordinate of the position offset 755 */ 756 int setX(const RelAbsVector& x); 757 758 /** 759 * Sets the y position of the text within the viewport. 760 * This is like an offset that is applied after alignment. 761 * 762 * @param y y coordinate of the position offset 763 */ 764 int setY(const RelAbsVector& y); 765 766 /** 767 * Sets the z position of the text within the viewport. 768 * This is like an offset that is applied after alignment. 769 * 770 * @param z z coordinate of the position offset 771 */ 772 int setZ(const RelAbsVector& z); 773 774 /** 775 * Sets the font size. 776 * Normally this is an absolute value, e.g. 18 for a 18pt font. 777 * It is however allowed the specify the font size in terms of relative values 778 * in relation to the current viewport. In most cases the viewport will be the 779 * dimensions of a bounding box of a layout object. 780 * 781 * @param size the new font size. 782 */ 783 int setFontSize(const RelAbsVector& size); 784 785 /** 786 * Unsets the value of the "x" element of this Text. 787 * 788 * @copydetails doc_returns_success_code 789 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 790 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 791 */ 792 int unsetX(); 793 794 795 /** 796 * Unsets the value of the "y" element of this Text. 797 * 798 * @copydetails doc_returns_success_code 799 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 800 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 801 */ 802 int unsetY(); 803 804 805 /** 806 * Unsets the value of the "z" element of this Text. 807 * 808 * @copydetails doc_returns_success_code 809 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 810 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 811 */ 812 int unsetZ(); 813 814 815 /** 816 * Unsets the value of the "font-size" element of this Text. 817 * 818 * @copydetails doc_returns_success_code 819 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 820 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 821 */ 822 int unsetFontSize(); 823 824 825 /** 826 * Returns the text for the Text object. 827 * 828 * @return the text string to be rendered for the Text object. 829 */ 830 const std::string& getText() const; 831 832 833 /** 834 * Returns @c true if the text is set to something else than the empty string. 835 * 836 * @return @c true if the text is not empty. 837 */ 838 bool isSetText() const; 839 840 841 /** 842 * Sets the text for the text element. 843 * 844 * @param text The text to be rendered for the Text object. 845 */ 846 int setText(const std::string& text); 847 848 849 /** 850 * Unsets the text for the text element. 851 */ 852 int unsetText(); 853 854 /** 855 * Returns the XML element name of this Text object. 856 * 857 * For Text, the XML element name is always @c "text". 858 * 859 * @return the name of this element, i.e. @c "text". 860 */ 861 virtual const std::string& getElementName() const; 862 863 864 /** 865 * Returns the libSBML type code for this Text object. 866 * 867 * @copydetails doc_what_are_typecodes 868 * 869 * @return the SBML type code for this object: 870 * @sbmlconstant{SBML_RENDER_TEXT, SBMLRenderTypeCode_t}. 871 * 872 * @copydetails doc_warning_typecodes_not_unique 873 * 874 * @see getElementName() 875 * @see getPackageName() 876 */ 877 virtual int getTypeCode() const; 878 879 880 /** 881 * Predicate returning @c true if all the required attributes for this Text 882 * object have been set. 883 * 884 * @return @c true to indicate that all the required attributes of this Text 885 * have been set, otherwise @c false is returned. 886 */ 887 virtual bool hasRequiredAttributes() const; 888 889 890 /** @cond doxygenLibsbmlInternal */ 891 892 /** 893 * Accepts the given SBMLVisitor 894 */ 895 virtual bool accept(SBMLVisitor& v) const; 896 897 /** @endcond */ 898 /** 899 * Creates an Text object from this Group object. 900 * 901 * @return the XMLNode with the XML representation for the 902 * Text object. 903 */ 904 XMLNode toXML() const; 905 906 907 protected: 908 909 910 /** @cond doxygenLibsbmlInternal */ 911 912 /** 913 * Adds the expected attributes for this element 914 */ 915 virtual void addExpectedAttributes(ExpectedAttributes& attributes); 916 917 /** @endcond */ 918 919 920 921 /** @cond doxygenLibsbmlInternal */ 922 923 /** 924 * Reads the expected attributes into the member data variables 925 */ 926 virtual void readAttributes(const XMLAttributes& attributes, 927 const ExpectedAttributes& expectedAttributes); 928 929 /** @endcond */ 930 931 932 933 /** @cond doxygenLibsbmlInternal */ 934 935 /** 936 * Writes the attributes to the stream 937 */ 938 virtual void writeAttributes(XMLOutputStream& stream) const; 939 940 /** @endcond */ 941 942 /** @cond doxygenLibsbmlInternal */ 943 /** 944 * When overridden allows SBase elements to use the text included in between 945 * the elements tags. The default implementation does nothing. 946 * 947 * @param text the text string found between the element tags. 948 */ 949 virtual void setElementText(const std::string &text); 950 951 /** @cond doxygenLibsbmlInternal */ 952 /* 953 * Writes (serializes) this SBML object by writing it to XMLOutputStream. 954 */ 955 void write (XMLOutputStream& stream) const; 956 /** @endcond */ 957 958 /** 959 * Adds the text rendering attributes of the given Text object 960 * to the given XMLAttributes object. 961 */ 962 static void addTextAttributes(const Text& text,XMLAttributes& att); 963 /** @endcond */ 964 965 966 /** @cond doxygenLibsbmlInternal */ 967 /** 968 * Subclasses should override this method to write out their contained 969 * SBML objects as XML elements. Be sure to call your parents 970 * implementation of this method as well. For example: 971 * 972 * SBase::writeElements(stream); 973 * mReactants.write(stream); 974 * mProducts.write(stream); 975 * ... 976 */ 977 virtual void writeElements (XMLOutputStream& stream) const; 978 /** @endcond */ 979 }; 980 981 LIBSBML_CPP_NAMESPACE_END 982 983 #endif /* __cplusplus */ 984 985 986 987 988 #ifndef SWIG 989 990 991 992 993 LIBSBML_CPP_NAMESPACE_BEGIN 994 995 996 997 998 BEGIN_C_DECLS 999 1000 1001 /** 1002 * Creates a new Text_t using the given SBML Level, Version and 1003 * “render” package version. 1004 * 1005 * @param level an unsigned int, the SBML Level to assign to this Text_t. 1006 * 1007 * @param version an unsigned int, the SBML Version to assign to this Text_t. 1008 * 1009 * @param pkgVersion an unsigned int, the SBML Render Version to assign to this 1010 * Text_t. 1011 * 1012 * @copydetails doc_note_setting_lv_pkg 1013 * 1014 * @copydetails doc_warning_returns_owned_pointer 1015 * 1016 * @memberof Text_t 1017 */ 1018 LIBSBML_EXTERN 1019 Text_t * 1020 Text_create(unsigned int level, 1021 unsigned int version, 1022 unsigned int pkgVersion); 1023 1024 1025 /** 1026 * Creates and returns a deep copy of this Text_t object. 1027 * 1028 * @param t the Text_t structure. 1029 * 1030 * @return a (deep) copy of this Text_t object. 1031 * 1032 * @copydetails doc_warning_returns_owned_pointer 1033 * 1034 * @memberof Text_t 1035 */ 1036 LIBSBML_EXTERN 1037 Text_t* 1038 Text_clone(const Text_t* t); 1039 1040 1041 /** 1042 * Frees this Text_t object. 1043 * 1044 * @param t the Text_t structure. 1045 * 1046 * @memberof Text_t 1047 */ 1048 LIBSBML_EXTERN 1049 void 1050 Text_free(Text_t* t); 1051 1052 1053 /** 1054 * Returns the value of the "font-family" attribute of this Text_t. 1055 * 1056 * @param t the Text_t structure whose font-family is sought. 1057 * 1058 * @return the value of the "font-family" attribute of this Text_t as a pointer 1059 * to a string. 1060 * 1061 * @copydetails doc_warning_returns_owned_char 1062 * 1063 * @memberof Text_t 1064 */ 1065 LIBSBML_EXTERN 1066 char * 1067 Text_getFontFamily(const Text_t * t); 1068 1069 1070 /** 1071 * Returns the value of the "font-weight" attribute of this Text_t. 1072 * 1073 * @copydetails doc_render_font_weight 1074 * 1075 * @param t the Text_t structure whose font-weight is sought. 1076 * 1077 * @return the value of the "font-weight" attribute of this Text_t as a 1078 * #FontWeight_t. 1079 * The possible values returned by this method are: 1080 * @li @sbmlconstant{FONT_WEIGHT_UNSET, FontWeight_t} 1081 * @li @sbmlconstant{FONT_WEIGHT_BOLD, FontWeight_t} 1082 * @li @sbmlconstant{FONT_WEIGHT_NORMAL, FontWeight_t} 1083 * @li @sbmlconstant{FONT_WEIGHT_INVALID, FontWeight_t} 1084 * 1085 * @memberof Text_t 1086 */ 1087 LIBSBML_EXTERN 1088 FontWeight_t 1089 Text_getFontWeight(const Text_t * t); 1090 1091 1092 /** 1093 * Returns the value of the "font-weight" attribute of this Text_t. 1094 * 1095 * @copydetails doc_render_font_weight 1096 * 1097 * @param t the Text_t structure whose font-weight is sought. 1098 * 1099 * @return the value of the "font-weight" attribute of this Text_t as a const 1100 * char *. 1101 * The possible values returned by this method are: 1102 * @li @c "bold" 1103 * @li @c "normal" 1104 * @li @c "(Unknown FontWeight value)" 1105 * 1106 * @copydetails doc_returned_unowned_char 1107 * 1108 * @memberof Text_t 1109 */ 1110 LIBSBML_EXTERN 1111 char * 1112 Text_getFontWeightAsString(const Text_t * t); 1113 1114 1115 /** 1116 * Returns the value of the "font-style" attribute of this Text_t. 1117 * 1118 * @copydetails doc_render_font_style 1119 * 1120 * @param t the Text_t structure whose font-style is sought. 1121 * 1122 * @return the value of the "font-style" attribute of this Text_t as a 1123 * #FontStyle_t. 1124 * The possible values returned by this method are: 1125 * @li @sbmlconstant{FONT_STYLE_UNSET, FontStyle_t} 1126 * @li @sbmlconstant{FONT_STYLE_ITALIC, FontStyle_t} 1127 * @li @sbmlconstant{FONT_STYLE_NORMAL, FontStyle_t} 1128 * @li @sbmlconstant{FONT_STYLE_INVALID, FontStyle_t} 1129 * 1130 * @memberof Text_t 1131 */ 1132 LIBSBML_EXTERN 1133 FontStyle_t 1134 Text_getFontStyle(const Text_t * t); 1135 1136 1137 /** 1138 * Returns the value of the "font-style" attribute of this Text_t. 1139 * 1140 * @copydetails doc_render_font_style 1141 * 1142 * @param t the Text_t structure whose font-style is sought. 1143 * 1144 * @return the value of the "font-style" attribute of this Text_t as a 1145 * <code>const char *</code>. 1146 * The possible values returned by this method are: 1147 * @li @c "italic" 1148 * @li @c "normal" 1149 * @li @c "(Unknown FontStyle value)" 1150 * 1151 * @copydetails doc_returned_unowned_char 1152 * 1153 * @memberof Text_t 1154 */ 1155 LIBSBML_EXTERN 1156 char * 1157 Text_getFontStyleAsString(const Text_t * t); 1158 1159 1160 /** 1161 * Returns the value of the "text-anchor" attribute of this Text_t. 1162 * 1163 * @copydetails doc_render_text_anchor 1164 * 1165 * @param t the Text_t structure whose text-anchor is sought. 1166 * 1167 * @return the value of the "text-anchor" attribute of this Text_t as a 1168 * #HTextAnchor_t. 1169 * The possible values returned by this method are: 1170 * @li @sbmlconstant{H_TEXTANCHOR_UNSET, HTextAnchor_t} 1171 * @li @sbmlconstant{H_TEXTANCHOR_START, HTextAnchor_t} 1172 * @li @sbmlconstant{H_TEXTANCHOR_MIDDLE, HTextAnchor_t} 1173 * @li @sbmlconstant{H_TEXTANCHOR_END, HTextAnchor_t} 1174 * @li @sbmlconstant{H_TEXTANCHOR_INVALID, HTextAnchor_t} 1175 * 1176 * @memberof Text_t 1177 */ 1178 LIBSBML_EXTERN 1179 HTextAnchor_t 1180 Text_getTextAnchor(const Text_t * t); 1181 1182 1183 /** 1184 * Returns the value of the "text-anchor" attribute of this Text_t. 1185 * 1186 * @copydetails doc_render_text_anchor 1187 * 1188 * @param t the Text_t structure whose text-anchor is sought. 1189 * 1190 * @return the value of the "text-anchor" attribute of this Text_t as a 1191 * <code>const char *</code>. 1192 * The possible values returned by this method are: 1193 * @li @c "start" 1194 * @li @c "middle" 1195 * @li @c "end" 1196 * @li @c "(Unknown HTextAnchor value)" 1197 * 1198 * @copydetails doc_returned_unowned_char 1199 * 1200 * @memberof Text_t 1201 */ 1202 LIBSBML_EXTERN 1203 char * 1204 Text_getTextAnchorAsString(const Text_t * t); 1205 1206 1207 /** 1208 * Returns the value of the "vtext-anchor" attribute of this Text_t. 1209 * 1210 * @copydetails doc_render_vtext_anchor 1211 * 1212 * @param t the Text_t structure whose vtext-anchor is sought. 1213 * 1214 * @return the value of the "vtext-anchor" attribute of this Text_t as a 1215 * #VTextAnchor_t. 1216 * The possible values returned by this method are: 1217 * @li @sbmlconstant{V_TEXTANCHOR_UNSET, VTextAnchor_t} 1218 * @li @sbmlconstant{V_TEXTANCHOR_TOP, VTextAnchor_t} 1219 * @li @sbmlconstant{V_TEXTANCHOR_MIDDLE, VTextAnchor_t} 1220 * @li @sbmlconstant{V_TEXTANCHOR_BOTTOM, VTextAnchor_t} 1221 * @li @sbmlconstant{V_TEXTANCHOR_BASELINE, VTextAnchor_t} 1222 * @li @sbmlconstant{V_TEXTANCHOR_INVALID, VTextAnchor_t} 1223 * 1224 * @memberof Text_t 1225 */ 1226 LIBSBML_EXTERN 1227 VTextAnchor_t 1228 Text_getVTextAnchor(const Text_t * t); 1229 1230 1231 /** 1232 * Returns the value of the "vtext-anchor" attribute of this Text_t. 1233 * 1234 * @copydetails doc_render_vtext_anchor 1235 * 1236 * @param t the Text_t structure whose vtext-anchor is sought. 1237 * 1238 * @return the value of the "vtext-anchor" attribute of this Text_t as a const 1239 * char *. 1240 * The possible values returned by this method are: 1241 * @li @c "top" 1242 * @li @c "middle" 1243 * @li @c "bottom" 1244 * @li @c "baseline" 1245 * @li @c "(Unknown VTextAnchor value)" 1246 * 1247 * @copydetails doc_returned_unowned_char 1248 * 1249 * @memberof Text_t 1250 */ 1251 LIBSBML_EXTERN 1252 char * 1253 Text_getVTextAnchorAsString(const Text_t * t); 1254 1255 1256 /** 1257 * Predicate returning @c 1 (true) if this Text_t's "font-family" attribute is 1258 * set. 1259 * 1260 * @param t the Text_t structure. 1261 * 1262 * @return @c 1 (true) if this Text_t's "font-family" attribute has been set, 1263 * otherwise @c 0 (false) is returned. 1264 * 1265 * @memberof Text_t 1266 */ 1267 LIBSBML_EXTERN 1268 int 1269 Text_isSetFontFamily(const Text_t * t); 1270 1271 1272 /** 1273 * Predicate returning @c 1 (true) if this Text_t's "font-weight" attribute is 1274 * set. 1275 * 1276 * @copydetails doc_render_font_weight 1277 * 1278 * @param t the Text_t structure. 1279 * 1280 * @return @c 1 (true) if this Text_t's "font-weight" attribute has been set, 1281 * otherwise @c 0 (false) is returned. 1282 * 1283 * @memberof Text_t 1284 */ 1285 LIBSBML_EXTERN 1286 int 1287 Text_isSetFontWeight(const Text_t * t); 1288 1289 1290 /** 1291 * Predicate returning @c 1 (true) if this Text_t's "font-style" attribute is 1292 * set. 1293 * 1294 * @copydetails doc_render_font_style 1295 * 1296 * @param t the Text_t structure. 1297 * 1298 * @return @c 1 (true) if this Text_t's "font-style" attribute has been set, 1299 * otherwise @c 0 (false) is returned. 1300 * 1301 * @memberof Text_t 1302 */ 1303 LIBSBML_EXTERN 1304 int 1305 Text_isSetFontStyle(const Text_t * t); 1306 1307 1308 /** 1309 * Predicate returning @c 1 (true) if this Text_t's "text-anchor" attribute is 1310 * set. 1311 * 1312 * @copydetails doc_render_text_anchor 1313 * 1314 * @param t the Text_t structure. 1315 * 1316 * @return @c 1 (true) if this Text_t's "text-anchor" attribute has been set, 1317 * otherwise @c 0 (false) is returned. 1318 * 1319 * @memberof Text_t 1320 */ 1321 LIBSBML_EXTERN 1322 int 1323 Text_isSetTextAnchor(const Text_t * t); 1324 1325 1326 /** 1327 * Predicate returning @c 1 (true) if this Text_t's "vtext-anchor" attribute is 1328 * set. 1329 * 1330 * @copydetails doc_render_vtext_anchor 1331 * 1332 * @param t the Text_t structure. 1333 * 1334 * @return @c 1 (true) if this Text_t's "vtext-anchor" attribute has been set, 1335 * otherwise @c 0 (false) is returned. 1336 * 1337 * @memberof Text_t 1338 */ 1339 LIBSBML_EXTERN 1340 int 1341 Text_isSetVTextAnchor(const Text_t * t); 1342 1343 1344 /** 1345 * Sets the value of the "font-family" attribute of this Text_t. 1346 * 1347 * @param t the Text_t structure. 1348 * 1349 * @param fontFamily const char * value of the "font-family" attribute to be 1350 * set. 1351 * Calling this function with @p fontFamily = @c NULL or an empty string is 1352 * equivalent to calling Text_unsetFontFamily(). 1353 * 1354 * @copydetails doc_returns_success_code 1355 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1356 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1357 * 1358 * @memberof Text_t 1359 */ 1360 LIBSBML_EXTERN 1361 int 1362 Text_setFontFamily(Text_t * t, const char * fontFamily); 1363 1364 1365 /** 1366 * Sets the value of the "font-weight" attribute of this Text_t. 1367 * 1368 * @copydetails doc_render_font_weight 1369 * 1370 * @param t the Text_t structure. 1371 * 1372 * @param fontWeight FontWeight_t value of the "font-weight" attribute to be 1373 * set. 1374 * 1375 * @copydetails doc_returns_success_code 1376 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1377 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1378 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1379 * 1380 * @memberof Text_t 1381 */ 1382 LIBSBML_EXTERN 1383 int 1384 Text_setFontWeight(Text_t * t, FontWeight_t fontWeight); 1385 1386 1387 /** 1388 * Sets the value of the "font-weight" attribute of this Text_t. 1389 * 1390 * @copydetails doc_render_font_weight 1391 * 1392 * @param t the Text_t structure. 1393 * 1394 * @param fontWeight const char * of the "font-weight" attribute to be set. 1395 * 1396 * @copydetails doc_returns_success_code 1397 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1398 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1399 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1400 * 1401 * @memberof Text_t 1402 */ 1403 LIBSBML_EXTERN 1404 int 1405 Text_setFontWeightAsString(Text_t * t, const char * fontWeight); 1406 1407 1408 /** 1409 * Sets the value of the "font-style" attribute of this Text_t. 1410 * 1411 * @copydetails doc_render_font_style 1412 * 1413 * @param t the Text_t structure. 1414 * 1415 * @param fontStyle #FontStyle_t value of the "font-style" attribute to be set. 1416 * 1417 * @copydetails doc_returns_success_code 1418 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1419 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1420 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1421 * 1422 * @memberof Text_t 1423 */ 1424 LIBSBML_EXTERN 1425 int 1426 Text_setFontStyle(Text_t * t, FontStyle_t fontStyle); 1427 1428 1429 /** 1430 * Sets the value of the "font-style" attribute of this Text_t. 1431 * 1432 * @copydetails doc_render_font_style 1433 * 1434 * @param t the Text_t structure. 1435 * 1436 * @param fontStyle const char * of the "font-style" attribute to be set. 1437 * 1438 * @copydetails doc_returns_success_code 1439 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1440 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1441 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1442 * 1443 * @memberof Text_t 1444 */ 1445 LIBSBML_EXTERN 1446 int 1447 Text_setFontStyleAsString(Text_t * t, const char * fontStyle); 1448 1449 1450 /** 1451 * Sets the value of the "text-anchor" attribute of this Text_t. 1452 * 1453 * @copydetails doc_render_text_anchor 1454 * 1455 * @param t the Text_t structure. 1456 * 1457 * @param textAnchor #HTextAnchor_t value of the "text-anchor" attribute to be 1458 * set. 1459 * 1460 * @copydetails doc_returns_success_code 1461 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1462 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1463 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1464 * 1465 * @memberof Text_t 1466 */ 1467 LIBSBML_EXTERN 1468 int 1469 Text_setTextAnchor(Text_t * t, HTextAnchor_t textAnchor); 1470 1471 1472 /** 1473 * Sets the value of the "text-anchor" attribute of this Text_t. 1474 * 1475 * @copydetails doc_render_text_anchor 1476 * 1477 * @param t the Text_t structure. 1478 * 1479 * @param textAnchor const char * of the "text-anchor" attribute to be set. 1480 * 1481 * @copydetails doc_returns_success_code 1482 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1483 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1484 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1485 * 1486 * @memberof Text_t 1487 */ 1488 LIBSBML_EXTERN 1489 int 1490 Text_setTextAnchorAsString(Text_t * t, const char * textAnchor); 1491 1492 1493 /** 1494 * Sets the value of the "vtext-anchor" attribute of this Text_t. 1495 * 1496 * @copydetails doc_render_vtext_anchor 1497 * 1498 * @param t the Text_t structure. 1499 * 1500 * @param vtextAnchor #VTextAnchor_t value of the "vtext-anchor" attribute to be 1501 * set. 1502 * 1503 * @copydetails doc_returns_success_code 1504 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1505 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1506 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1507 * 1508 * @memberof Text_t 1509 */ 1510 LIBSBML_EXTERN 1511 int 1512 Text_setVTextAnchor(Text_t * t, VTextAnchor_t vtextAnchor); 1513 1514 1515 /** 1516 * Sets the value of the "vtext-anchor" attribute of this Text_t. 1517 * 1518 * @copydetails doc_render_vtext_anchor 1519 * 1520 * @param t the Text_t structure. 1521 * 1522 * @param vtextAnchor const char * of the "vtext-anchor" attribute to be set. 1523 * 1524 * @copydetails doc_returns_success_code 1525 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1526 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1527 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1528 * 1529 * @memberof Text_t 1530 */ 1531 LIBSBML_EXTERN 1532 int 1533 Text_setVTextAnchorAsString(Text_t * t, const char * vtextAnchor); 1534 1535 1536 /** 1537 * Unsets the value of the "font-family" attribute of this Text_t. 1538 * 1539 * @param t the Text_t structure. 1540 * 1541 * @copydetails doc_returns_success_code 1542 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1543 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1544 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1545 * 1546 * @memberof Text_t 1547 */ 1548 LIBSBML_EXTERN 1549 int 1550 Text_unsetFontFamily(Text_t * t); 1551 1552 1553 /** 1554 * Unsets the value of the "font-weight" attribute of this Text_t. 1555 * 1556 * @copydetails doc_render_font_weight 1557 * 1558 * @param t the Text_t structure. 1559 * 1560 * @copydetails doc_returns_success_code 1561 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1562 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1563 * 1564 * @memberof Text_t 1565 */ 1566 LIBSBML_EXTERN 1567 int 1568 Text_unsetFontWeight(Text_t * t); 1569 1570 1571 /** 1572 * Unsets the value of the "font-style" attribute of this Text_t. 1573 * 1574 * @copydetails doc_render_font_style 1575 * 1576 * @param t the Text_t structure. 1577 * 1578 * @copydetails doc_returns_success_code 1579 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1580 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1581 * 1582 * @memberof Text_t 1583 */ 1584 LIBSBML_EXTERN 1585 int 1586 Text_unsetFontStyle(Text_t * t); 1587 1588 1589 /** 1590 * Unsets the value of the "text-anchor" attribute of this Text_t. 1591 * 1592 * @copydetails doc_render_text_anchor 1593 * 1594 * @param t the Text_t structure. 1595 * 1596 * @copydetails doc_returns_success_code 1597 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1598 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1599 * 1600 * @memberof Text_t 1601 */ 1602 LIBSBML_EXTERN 1603 int 1604 Text_unsetTextAnchor(Text_t * t); 1605 1606 1607 /** 1608 * Unsets the value of the "vtext-anchor" attribute of this Text_t. 1609 * 1610 * @copydetails doc_render_vtext_anchor 1611 * 1612 * @param t the Text_t structure. 1613 * 1614 * @copydetails doc_returns_success_code 1615 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1616 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1617 * 1618 * @memberof Text_t 1619 */ 1620 LIBSBML_EXTERN 1621 int 1622 Text_unsetVTextAnchor(Text_t * t); 1623 1624 1625 /** 1626 * Returns the value of the "x" element of this Text_t. 1627 * 1628 * @param t the Text_t structure whose x is sought. 1629 * 1630 * @return the value of the "x" element of this Text_t as a RelAbsVector_t. 1631 * 1632 * @memberof Text_t 1633 */ 1634 LIBSBML_EXTERN 1635 RelAbsVector_t* 1636 Text_getX(const Text_t * t); 1637 1638 1639 /** 1640 * Returns the value of the "y" element of this Text_t. 1641 * 1642 * @param t the Text_t structure whose y is sought. 1643 * 1644 * @return the value of the "y" element of this Text_t as a RelAbsVector_t. 1645 * 1646 * @memberof Text_t 1647 */ 1648 LIBSBML_EXTERN 1649 RelAbsVector_t* 1650 Text_getY(const Text_t * t); 1651 1652 1653 /** 1654 * Returns the value of the "z" element of this Text_t. 1655 * 1656 * @param t the Text_t structure whose z is sought. 1657 * 1658 * @return the value of the "z" element of this Text_t as a RelAbsVector_t. 1659 * 1660 * @memberof Text_t 1661 */ 1662 LIBSBML_EXTERN 1663 RelAbsVector_t* 1664 Text_getZ(const Text_t * t); 1665 1666 1667 /** 1668 * Returns the value of the "font-size" element of this Text_t. 1669 * 1670 * @param t the Text_t structure whose font-size is sought. 1671 * 1672 * @return the value of the "font-size" element of this Text_t as a 1673 * RelAbsVector_t. 1674 * 1675 * @memberof Text_t 1676 */ 1677 LIBSBML_EXTERN 1678 RelAbsVector_t* 1679 Text_getFontSize(const Text_t * t); 1680 1681 1682 /** 1683 * Predicate returning @c 1 (true) if this Text_t's "x" element is set. 1684 * 1685 * @param t the Text_t structure. 1686 * 1687 * @return @c 1 (true) if this Text_t's "x" element has been set, otherwise 1688 * @c 0 (false) is returned. 1689 * 1690 * @memberof Text_t 1691 */ 1692 LIBSBML_EXTERN 1693 int 1694 Text_isSetX(const Text_t * t); 1695 1696 1697 /** 1698 * Predicate returning @c 1 (true) if this Text_t's "y" element is set. 1699 * 1700 * @param t the Text_t structure. 1701 * 1702 * @return @c 1 (true) if this Text_t's "y" element has been set, otherwise 1703 * @c 0 (false) is returned. 1704 * 1705 * @memberof Text_t 1706 */ 1707 LIBSBML_EXTERN 1708 int 1709 Text_isSetY(const Text_t * t); 1710 1711 1712 /** 1713 * Predicate returning @c 1 (true) if this Text_t's "z" element is set. 1714 * 1715 * @param t the Text_t structure. 1716 * 1717 * @return @c 1 (true) if this Text_t's "z" element has been set, otherwise 1718 * @c 0 (false) is returned. 1719 * 1720 * @memberof Text_t 1721 */ 1722 LIBSBML_EXTERN 1723 int 1724 Text_isSetZ(const Text_t * t); 1725 1726 1727 /** 1728 * Predicate returning @c 1 (true) if this Text_t's "font-size" element is set. 1729 * 1730 * @param t the Text_t structure. 1731 * 1732 * @return @c 1 (true) if this Text_t's "font-size" element has been set, 1733 * otherwise @c 0 (false) is returned. 1734 * 1735 * @memberof Text_t 1736 */ 1737 LIBSBML_EXTERN 1738 int 1739 Text_isSetFontSize(const Text_t * t); 1740 1741 1742 /** 1743 * Sets the value of the "x" element of this Text_t. 1744 * 1745 * @param t the Text_t structure. 1746 * 1747 * @param x RelAbsVector_t value of the "x" element to be set. 1748 * 1749 * @copydetails doc_returns_success_code 1750 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1751 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1752 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1753 * 1754 * @memberof Text_t 1755 */ 1756 LIBSBML_EXTERN 1757 int 1758 Text_setX(Text_t * t, const RelAbsVector_t* x); 1759 1760 1761 /** 1762 * Sets the value of the "y" element of this Text_t. 1763 * 1764 * @param t the Text_t structure. 1765 * 1766 * @param y RelAbsVector_t value of the "y" element to be set. 1767 * 1768 * @copydetails doc_returns_success_code 1769 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1770 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1771 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1772 * 1773 * @memberof Text_t 1774 */ 1775 LIBSBML_EXTERN 1776 int 1777 Text_setY(Text_t * t, const RelAbsVector_t* y); 1778 1779 1780 /** 1781 * Sets the value of the "z" element of this Text_t. 1782 * 1783 * @param t the Text_t structure. 1784 * 1785 * @param z RelAbsVector_t value of the "z" element to be set. 1786 * 1787 * @copydetails doc_returns_success_code 1788 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1789 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1790 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1791 * 1792 * @memberof Text_t 1793 */ 1794 LIBSBML_EXTERN 1795 int 1796 Text_setZ(Text_t * t, const RelAbsVector_t* z); 1797 1798 1799 /** 1800 * Sets the value of the "font-size" element of this Text_t. 1801 * 1802 * @param t the Text_t structure. 1803 * 1804 * @param fontSize RelAbsVector_t value of the "font-size" element to be set. 1805 * 1806 * @copydetails doc_returns_success_code 1807 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1808 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1809 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1810 * 1811 * @memberof Text_t 1812 */ 1813 LIBSBML_EXTERN 1814 int 1815 Text_setFontSize(Text_t * t, const RelAbsVector_t* fontSize); 1816 1817 1818 /** 1819 * Unsets the value of the "x" element of this Text_t. 1820 * 1821 * @param t the Text_t structure. 1822 * 1823 * @copydetails doc_returns_success_code 1824 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1825 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1826 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1827 * 1828 * @memberof Text_t 1829 */ 1830 LIBSBML_EXTERN 1831 int 1832 Text_unsetX(Text_t * t); 1833 1834 1835 /** 1836 * Unsets the value of the "y" element of this Text_t. 1837 * 1838 * @param t the Text_t structure. 1839 * 1840 * @copydetails doc_returns_success_code 1841 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1842 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1843 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1844 * 1845 * @memberof Text_t 1846 */ 1847 LIBSBML_EXTERN 1848 int 1849 Text_unsetY(Text_t * t); 1850 1851 1852 /** 1853 * Unsets the value of the "z" element of this Text_t. 1854 * 1855 * @param t the Text_t structure. 1856 * 1857 * @copydetails doc_returns_success_code 1858 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1859 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1860 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1861 * 1862 * @memberof Text_t 1863 */ 1864 LIBSBML_EXTERN 1865 int 1866 Text_unsetZ(Text_t * t); 1867 1868 1869 /** 1870 * Unsets the value of the "font-size" element of this Text_t. 1871 * 1872 * @param t the Text_t structure. 1873 * 1874 * @copydetails doc_returns_success_code 1875 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1876 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1877 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1878 * 1879 * @memberof Text_t 1880 */ 1881 LIBSBML_EXTERN 1882 int 1883 Text_unsetFontSize(Text_t * t); 1884 1885 1886 /** 1887 * Predicate returning @c 1 (true) if all the required attributes for this 1888 * Text_t object have been set. 1889 * 1890 * @param t the Text_t structure. 1891 * 1892 * @return @c 1 (true) to indicate that all the required attributes of this 1893 * Text_t have been set, otherwise @c 0 (false) is returned. 1894 * 1895 * @note The required attributes for the Text_t object are: 1896 * @li "x" 1897 * @li "y" 1898 * 1899 * @memberof Text_t 1900 */ 1901 LIBSBML_EXTERN 1902 int 1903 Text_hasRequiredAttributes(const Text_t * t); 1904 1905 1906 1907 1908 END_C_DECLS 1909 1910 1911 1912 1913 LIBSBML_CPP_NAMESPACE_END 1914 1915 1916 1917 1918 #endif /* !SWIG */ 1919 LIBSBML_CPP_NAMESPACE_BEGIN 1920 BEGIN_C_DECLS 1921 1922 LIBSBML_EXTERN 1923 Text::TEXT_ANCHOR 1924 TextAnchor_fromString(const char* str); 1925 1926 LIBSBML_EXTERN 1927 const char * 1928 TextAnchor_toString(Text::TEXT_ANCHOR anchor); 1929 1930 END_C_DECLS 1931 LIBSBML_CPP_NAMESPACE_END 1932 1933 1934 #endif /* Text_H__ */ 1935