001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.12 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span> 013 014 A Cubic Bézier smooth curve. 015 <p> 016 * In order to be able to represent smooth curves the “layout” 017 * package defines the class {@link CubicBezier}. It represents a Bezier curve, and 018 * is readily available in most graphics APIs. The class {@link CubicBezier} is 019 * derived from {@link LineSegment}. It consists of four elements: the two inherited 020 * elements 'start' and 'end', which specify the starting point and the 021 * endpoint of the cubic bezier curve, and two elements 'basePoint1' and 022 * 'basePoint2', which specify the two additional base points that are needed 023 * to describe a cubic bezier curve. 024 */ 025 026public class CubicBezier extends LineSegment { 027 private long swigCPtr; 028 029 protected CubicBezier(long cPtr, boolean cMemoryOwn) 030 { 031 super(libsbmlJNI.CubicBezier_SWIGUpcast(cPtr), cMemoryOwn); 032 swigCPtr = cPtr; 033 } 034 035 protected static long getCPtr(CubicBezier obj) 036 { 037 return (obj == null) ? 0 : obj.swigCPtr; 038 } 039 040 protected static long getCPtrAndDisown (CubicBezier obj) 041 { 042 long ptr = 0; 043 044 if (obj != null) 045 { 046 ptr = obj.swigCPtr; 047 obj.swigCMemOwn = false; 048 } 049 050 return ptr; 051 } 052 053 protected void finalize() { 054 delete(); 055 } 056 057 public synchronized void delete() { 058 if (swigCPtr != 0) { 059 if (swigCMemOwn) { 060 swigCMemOwn = false; 061 libsbmlJNI.delete_CubicBezier(swigCPtr); 062 } 063 swigCPtr = 0; 064 } 065 super.delete(); 066 } 067 068 069/** 070 * Creates a {@link CubicBezier} and returns the pointer. 071 <p> 072 * @param level the SBML Level. 073 * @param version the Version within the SBML Level. 074 * @param pkgVersion the version of the package. 075 <p> 076 * <p> 077 * @note Attempting to add an object to an {@link SBMLDocument} having a different 078 * combination of SBML Level, Version and XML namespaces than the object 079 * itself will result in an error at the time a caller attempts to make the 080 * addition. A parent object must have compatible Level, Version and XML 081 * namespaces. (Strictly speaking, a parent may also have more XML 082 * namespaces than a child, but the reverse is not permitted.) The 083 * restriction is necessary to ensure that an SBML model has a consistent 084 * overall structure. This requires callers to manage their objects 085 * carefully, but the benefit is increased flexibility in how models can be 086 * created by permitting callers to create objects bottom-up if desired. In 087 * situations where objects are not yet attached to parents (e.g., 088 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 089 * libSBML determine such things as whether it is valid to assign a 090 * particular value to an attribute. For packages, this means that the 091 * parent object to which this package element is being added must have 092 * been created with the package namespace, or that the package namespace 093 * was added to it, even if that parent is not a package object itself. 094 */ public 095 CubicBezier(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 096 this(libsbmlJNI.new_CubicBezier__SWIG_0(level, version, pkgVersion), true); 097 } 098 099 100/** 101 * Creates a {@link CubicBezier} and returns the pointer. 102 <p> 103 * @param level the SBML Level. 104 * @param version the Version within the SBML Level. 105 * @param pkgVersion the version of the package. 106 <p> 107 * <p> 108 * @note Attempting to add an object to an {@link SBMLDocument} having a different 109 * combination of SBML Level, Version and XML namespaces than the object 110 * itself will result in an error at the time a caller attempts to make the 111 * addition. A parent object must have compatible Level, Version and XML 112 * namespaces. (Strictly speaking, a parent may also have more XML 113 * namespaces than a child, but the reverse is not permitted.) The 114 * restriction is necessary to ensure that an SBML model has a consistent 115 * overall structure. This requires callers to manage their objects 116 * carefully, but the benefit is increased flexibility in how models can be 117 * created by permitting callers to create objects bottom-up if desired. In 118 * situations where objects are not yet attached to parents (e.g., 119 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 120 * libSBML determine such things as whether it is valid to assign a 121 * particular value to an attribute. For packages, this means that the 122 * parent object to which this package element is being added must have 123 * been created with the package namespace, or that the package namespace 124 * was added to it, even if that parent is not a package object itself. 125 */ public 126 CubicBezier(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 127 this(libsbmlJNI.new_CubicBezier__SWIG_1(level, version), true); 128 } 129 130 131/** 132 * Creates a {@link CubicBezier} and returns the pointer. 133 <p> 134 * @param level the SBML Level. 135 * @param version the Version within the SBML Level. 136 * @param pkgVersion the version of the package. 137 <p> 138 * <p> 139 * @note Attempting to add an object to an {@link SBMLDocument} having a different 140 * combination of SBML Level, Version and XML namespaces than the object 141 * itself will result in an error at the time a caller attempts to make the 142 * addition. A parent object must have compatible Level, Version and XML 143 * namespaces. (Strictly speaking, a parent may also have more XML 144 * namespaces than a child, but the reverse is not permitted.) The 145 * restriction is necessary to ensure that an SBML model has a consistent 146 * overall structure. This requires callers to manage their objects 147 * carefully, but the benefit is increased flexibility in how models can be 148 * created by permitting callers to create objects bottom-up if desired. In 149 * situations where objects are not yet attached to parents (e.g., 150 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 151 * libSBML determine such things as whether it is valid to assign a 152 * particular value to an attribute. For packages, this means that the 153 * parent object to which this package element is being added must have 154 * been created with the package namespace, or that the package namespace 155 * was added to it, even if that parent is not a package object itself. 156 */ public 157 CubicBezier(long level) throws org.sbml.libsbml.SBMLConstructorException { 158 this(libsbmlJNI.new_CubicBezier__SWIG_2(level), true); 159 } 160 161 162/** 163 * Creates a {@link CubicBezier} and returns the pointer. 164 <p> 165 * @param level the SBML Level. 166 * @param version the Version within the SBML Level. 167 * @param pkgVersion the version of the package. 168 <p> 169 * <p> 170 * @note Attempting to add an object to an {@link SBMLDocument} having a different 171 * combination of SBML Level, Version and XML namespaces than the object 172 * itself will result in an error at the time a caller attempts to make the 173 * addition. A parent object must have compatible Level, Version and XML 174 * namespaces. (Strictly speaking, a parent may also have more XML 175 * namespaces than a child, but the reverse is not permitted.) The 176 * restriction is necessary to ensure that an SBML model has a consistent 177 * overall structure. This requires callers to manage their objects 178 * carefully, but the benefit is increased flexibility in how models can be 179 * created by permitting callers to create objects bottom-up if desired. In 180 * situations where objects are not yet attached to parents (e.g., 181 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 182 * libSBML determine such things as whether it is valid to assign a 183 * particular value to an attribute. For packages, this means that the 184 * parent object to which this package element is being added must have 185 * been created with the package namespace, or that the package namespace 186 * was added to it, even if that parent is not a package object itself. 187 */ public 188 CubicBezier() throws org.sbml.libsbml.SBMLConstructorException { 189 this(libsbmlJNI.new_CubicBezier__SWIG_3(), true); 190 } 191 192 193/** 194 * Constructor. 195 <p> 196 * <p> 197 * The package namespaces object used in this constructor is derived from a 198 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 199 * information. It is used to communicate the SBML Level, Version, and 200 * package version and name information used in addition to SBML Level 3 Core. A 201 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 202 * package namespace object somewhere in a program once, then hand that object 203 * as needed to object constructors of that package that accept it as and 204 * argument, such as this one. 205 <p> 206 * @param layoutns the {@link LayoutPkgNamespaces} object. 207 <p> 208 * <p> 209 * @note Attempting to add an object to an {@link SBMLDocument} having a different 210 * combination of SBML Level, Version and XML namespaces than the object 211 * itself will result in an error at the time a caller attempts to make the 212 * addition. A parent object must have compatible Level, Version and XML 213 * namespaces. (Strictly speaking, a parent may also have more XML 214 * namespaces than a child, but the reverse is not permitted.) The 215 * restriction is necessary to ensure that an SBML model has a consistent 216 * overall structure. This requires callers to manage their objects 217 * carefully, but the benefit is increased flexibility in how models can be 218 * created by permitting callers to create objects bottom-up if desired. In 219 * situations where objects are not yet attached to parents (e.g., 220 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 221 * libSBML determine such things as whether it is valid to assign a 222 * particular value to an attribute. For packages, this means that the 223 * parent object to which this package element is being added must have 224 * been created with the package namespace, or that the package namespace 225 * was added to it, even if that parent is not a package object itself. 226 */ public 227 CubicBezier(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 228 this(libsbmlJNI.new_CubicBezier__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 229 } 230 231 232/** 233 * Creates a {@link CubicBezier} with the given 2D coordinates and returns the 234 * pointer. 235 <p> 236 * (FOR BACKWARD COMPATIBILITY) 237 */ public 238 CubicBezier(LayoutPkgNamespaces layoutns, double x1, double y1, double x2, double y2) throws org.sbml.libsbml.SBMLConstructorException { 239 this(libsbmlJNI.new_CubicBezier__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, x2, y2), true); 240 } 241 242 243/** 244 * Creates a {@link CubicBezier} with the given 3D coordinates and returns the 245 * pointer. 246 <p> 247 * (FOR BACKWARD COMPATIBILITY) 248 */ public 249 CubicBezier(LayoutPkgNamespaces layoutns, double x1, double y1, double z1, double x2, double y2, double z2) throws org.sbml.libsbml.SBMLConstructorException { 250 this(libsbmlJNI.new_CubicBezier__SWIG_6(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, z1, x2, y2, z2), true); 251 } 252 253 254/** 255 * Copy constructor. 256 <p> 257 * (FOR BACKWARD COMPATIBILITY) 258 */ public 259 CubicBezier(CubicBezier orig) throws org.sbml.libsbml.SBMLConstructorException { 260 this(libsbmlJNI.new_CubicBezier__SWIG_7(CubicBezier.getCPtr(orig), orig), true); 261 } 262 263 264/** 265 * Creates a {@link CubicBezier} with the given points and returns the pointer. 266 <p> 267 * (FOR BACKWARD COMPATIBILITY) 268 */ public 269 CubicBezier(LayoutPkgNamespaces layoutns, Point start, Point end) throws org.sbml.libsbml.SBMLConstructorException { 270 this(libsbmlJNI.new_CubicBezier__SWIG_8(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, Point.getCPtr(start), start, Point.getCPtr(end), end), true); 271 } 272 273 274/** 275 * Creates a {@link CubicBezier} with the given points and returns the pointer. 276 <p> 277 * (FOR BACKWARD COMPATIBILITY) 278 */ public 279 CubicBezier(LayoutPkgNamespaces layoutns, Point start, Point base1, Point base2, Point end) throws org.sbml.libsbml.SBMLConstructorException { 280 this(libsbmlJNI.new_CubicBezier__SWIG_9(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, Point.getCPtr(start), start, Point.getCPtr(base1), base1, Point.getCPtr(base2), base2, Point.getCPtr(end), end), true); 281 } 282 283 284/** 285 * Creates a new {@link Layout} from the given {@link XMLNode} 286 <p> 287 * (FOR BACKWARD COMPATIBILITY) 288 */ public 289 CubicBezier(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 290 this(libsbmlJNI.new_CubicBezier__SWIG_10(XMLNode.getCPtr(node), node, l2version), true); 291 } 292 293 294/** 295 * Creates a new {@link Layout} from the given {@link XMLNode} 296 <p> 297 * (FOR BACKWARD COMPATIBILITY) 298 */ public 299 CubicBezier(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 300 this(libsbmlJNI.new_CubicBezier__SWIG_11(XMLNode.getCPtr(node), node), true); 301 } 302 303 304/** 305 * Returns the first base point of the curve (the one closer to the 306 * starting point). 307 <p> 308 * @return the {@link Point} child 'basePoint1'. Will always return an 309 * actual object: if previously unset, the {@link Point} will exist, but 310 * have no set attributes nor children. 311 */ public 312 Point getBasePoint1() { 313 long cPtr = libsbmlJNI.CubicBezier_getBasePoint1(swigCPtr, this); 314 return (cPtr == 0) ? null : new Point(cPtr, false); 315 } 316 317 318/** 319 * Initializes first base point with a copy of the given point. 320 <p> 321 * @param p the {@link Point} to use as 'basePoint1' (creates a copy). 322 */ public 323 void setBasePoint1(Point p) { 324 libsbmlJNI.CubicBezier_setBasePoint1__SWIG_0(swigCPtr, this, Point.getCPtr(p), p); 325 } 326 327 328/** 329 * Initializes first base point with the given coordinates. It is impossible to create a {@link Point} with <em>no</em> 'z' attribute in this way; if no value is supplied, '0.0' will be used. 330 <p> 331 * @param x the value to use for the 'x' attribute of the basePoint1 {@link Point}. 332 * @param y the value to use for the 'y' attribute of the basePoint1 {@link Point}. 333 * @param z the value to use for the 'z' attribute of the basePoint1 {@link Point}. 334 */ public 335 void setBasePoint1(double x, double y, double z) { 336 libsbmlJNI.CubicBezier_setBasePoint1__SWIG_1(swigCPtr, this, x, y, z); 337 } 338 339 340/** 341 * Initializes first base point with the given coordinates. It is impossible to create a {@link Point} with <em>no</em> 'z' attribute in this way; if no value is supplied, '0.0' will be used. 342 <p> 343 * @param x the value to use for the 'x' attribute of the basePoint1 {@link Point}. 344 * @param y the value to use for the 'y' attribute of the basePoint1 {@link Point}. 345 * @param z the value to use for the 'z' attribute of the basePoint1 {@link Point}. 346 */ public 347 void setBasePoint1(double x, double y) { 348 libsbmlJNI.CubicBezier_setBasePoint1__SWIG_2(swigCPtr, this, x, y); 349 } 350 351 352/** 353 * Returns the second base point of the curve (the one closer to the end 354 * point). 355 <p> 356 * @return the {@link Point} child 'basePoint2'. Will always return an 357 * actual object: if previously unset, the {@link Point} will exist, but 358 * have no set attributes nor children. 359 */ public 360 Point getBasePoint2() { 361 long cPtr = libsbmlJNI.CubicBezier_getBasePoint2(swigCPtr, this); 362 return (cPtr == 0) ? null : new Point(cPtr, false); 363 } 364 365 366/** 367 * Initializes second base point with a copy of the given point. 368 <p> 369 * @param p the {@link Point} to use as 'basePoint2' (creates a copy). 370 */ public 371 void setBasePoint2(Point p) { 372 libsbmlJNI.CubicBezier_setBasePoint2__SWIG_0(swigCPtr, this, Point.getCPtr(p), p); 373 } 374 375 376/** 377 * Initializes second base point with the given coordinates. It is impossible to create a {@link Point} with <em>no</em> 'z' attribute in this way; if no value is supplied, '0.0' will be used. 378 <p> 379 * @param x the value to use for the 'x' attribute of the basePoint2 {@link Point}. 380 * @param y the value to use for the 'y' attribute of the basePoint2 {@link Point}. 381 * @param z the value to use for the 'z' attribute of the basePoint2 {@link Point}. 382 */ public 383 void setBasePoint2(double x, double y, double z) { 384 libsbmlJNI.CubicBezier_setBasePoint2__SWIG_1(swigCPtr, this, x, y, z); 385 } 386 387 388/** 389 * Initializes second base point with the given coordinates. It is impossible to create a {@link Point} with <em>no</em> 'z' attribute in this way; if no value is supplied, '0.0' will be used. 390 <p> 391 * @param x the value to use for the 'x' attribute of the basePoint2 {@link Point}. 392 * @param y the value to use for the 'y' attribute of the basePoint2 {@link Point}. 393 * @param z the value to use for the 'z' attribute of the basePoint2 {@link Point}. 394 */ public 395 void setBasePoint2(double x, double y) { 396 libsbmlJNI.CubicBezier_setBasePoint2__SWIG_2(swigCPtr, this, x, y); 397 } 398 399 400/** * @internal */ public 401 boolean getBasePt1ExplicitlySet() { 402 return libsbmlJNI.CubicBezier_getBasePt1ExplicitlySet(swigCPtr, this); 403 } 404 405 406/** * @internal */ public 407 boolean getBasePt2ExplicitlySet() { 408 return libsbmlJNI.CubicBezier_getBasePt2ExplicitlySet(swigCPtr, this); 409 } 410 411 412/** 413 * Calls initDefaults from {@link LineSegment}. 414 */ public 415 void initDefaults() { 416 libsbmlJNI.CubicBezier_initDefaults(swigCPtr, this); 417 } 418 419 420/** 421 * Turns the {@link CubicBezier} into a line by setting both 'basepoint1' and 422 * 'basepoint2' children to the midpoint between the 'start' and the 423 * 'end' points. 424 */ public 425 void straighten() { 426 libsbmlJNI.CubicBezier_straighten(swigCPtr, this); 427 } 428 429 430/** 431 * Returns the XML element name of 432 * this SBML object. 433 <p> 434 * @return the string of the name of this element. 435 */ public 436 String getElementName() { 437 return libsbmlJNI.CubicBezier_getElementName(swigCPtr, this); 438 } 439 440 441/** 442 * Creates and returns a deep copy of this {@link CubicBezier}. 443 <p> 444 * @return a (deep) copy of this {@link CubicBezier}. 445 */ public 446 CubicBezier cloneObject() { 447 long cPtr = libsbmlJNI.CubicBezier_cloneObject(swigCPtr, this); 448 return (cPtr == 0) ? null : new CubicBezier(cPtr, true); 449 } 450 451 452/** 453 * Returns the libSBML type code of this object instance. 454 <p> 455 * <p> 456 * LibSBML attaches an identifying code to every kind of SBML object. These 457 * are integer constants known as <em>SBML type codes</em>. The names of all 458 * the codes begin with the characters <code>SBML_</code>. 459 * In the Java language interface for libSBML, the 460 * type codes are defined as static integer constants in the interface class 461 * {@link libsbmlConstants}. Note that different Level 3 462 * package plug-ins may use overlapping type codes; to identify the package 463 * to which a given object belongs, call the 464 * <code>{@link SBase#getPackageName()} 465 * </code> 466 * method on the object. 467 <p> 468 * @return the SBML type code for this object: 469 * {@link libsbmlConstants#SBML_LAYOUT_CUBICBEZIER SBML_LAYOUT_CUBICBEZIER}. 470 <p> 471 * <p> 472 * @warning <span class='warning'>The specific integer values of the possible 473 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 474 * packages, To fully identify the correct code, <strong>it is necessary to 475 * invoke both getTypeCode() and getPackageName()</strong>.</span> 476 <p> 477 * @see #getElementName() 478 * @see #getPackageName() 479 */ public 480 int getTypeCode() { 481 return libsbmlJNI.CubicBezier_getTypeCode(swigCPtr, this); 482 } 483 484 485/** 486 * Creates an {@link XMLNode} object from this. 487 */ public 488 XMLNode toXML() { 489 return new XMLNode(libsbmlJNI.CubicBezier_toXML(swigCPtr, this), true); 490 } 491 492 public void connectToChild() { 493 libsbmlJNI.CubicBezier_connectToChild(swigCPtr, this); 494 } 495 496 497/** * @internal */ public 498 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 499 libsbmlJNI.CubicBezier_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 500 } 501 502}