001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.10 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span> 013 014 Representation of a line. 015 <p> 016 * The {@link LineSegment} class consists of the mandatory attribute xsi:type and two 017 * child elements of type {@link Point}. One is called 'start' and represents the 018 * starting point of the line, the other is called 'end' and represents the 019 * endpoint of the line. The {@link LineSegment} class is also the base class for 020 * {@link CubicBezier}, which represent curved lines instead of straight ones. 021 */ 022 023public class LineSegment extends SBase { 024 private long swigCPtr; 025 026 protected LineSegment(long cPtr, boolean cMemoryOwn) 027 { 028 super(libsbmlJNI.LineSegment_SWIGUpcast(cPtr), cMemoryOwn); 029 swigCPtr = cPtr; 030 } 031 032 protected static long getCPtr(LineSegment obj) 033 { 034 return (obj == null) ? 0 : obj.swigCPtr; 035 } 036 037 protected static long getCPtrAndDisown (LineSegment obj) 038 { 039 long ptr = 0; 040 041 if (obj != null) 042 { 043 ptr = obj.swigCPtr; 044 obj.swigCMemOwn = false; 045 } 046 047 return ptr; 048 } 049 050 protected void finalize() { 051 delete(); 052 } 053 054 public synchronized void delete() { 055 if (swigCPtr != 0) { 056 if (swigCMemOwn) { 057 swigCMemOwn = false; 058 libsbmlJNI.delete_LineSegment(swigCPtr); 059 } 060 swigCPtr = 0; 061 } 062 super.delete(); 063 } 064 065 066/** 067 * Creates a line segment with the given SBML level, version, and package version 068 * and both points set to (0.0,0.0,0.0) 069 <p> 070 * @param level the SBML Level. 071 * @param version the Version within the SBML Level. 072 * @param pkgVersion the version of the package. 073 <p> 074 * <p> 075 * @note Attempting to add an object to an {@link SBMLDocument} having a different 076 * combination of SBML Level, Version and XML namespaces than the object 077 * itself will result in an error at the time a caller attempts to make the 078 * addition. A parent object must have compatible Level, Version and XML 079 * namespaces. (Strictly speaking, a parent may also have more XML 080 * namespaces than a child, but the reverse is not permitted.) The 081 * restriction is necessary to ensure that an SBML model has a consistent 082 * overall structure. This requires callers to manage their objects 083 * carefully, but the benefit is increased flexibility in how models can be 084 * created by permitting callers to create objects bottom-up if desired. In 085 * situations where objects are not yet attached to parents (e.g., 086 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 087 * libSBML determine such things as whether it is valid to assign a 088 * particular value to an attribute. For packages, this means that the 089 * parent object to which this package element is being added must have 090 * been created with the package namespace, or that the package namespace 091 * was added to it, even if that parent is not a package object itself. 092 */ public 093 LineSegment(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 094 this(libsbmlJNI.new_LineSegment__SWIG_0(level, version, pkgVersion), true); 095 } 096 097 098/** 099 * Creates a line segment with the given SBML level, version, and package version 100 * and both points set to (0.0,0.0,0.0) 101 <p> 102 * @param level the SBML Level. 103 * @param version the Version within the SBML Level. 104 * @param pkgVersion the version of the package. 105 <p> 106 * <p> 107 * @note Attempting to add an object to an {@link SBMLDocument} having a different 108 * combination of SBML Level, Version and XML namespaces than the object 109 * itself will result in an error at the time a caller attempts to make the 110 * addition. A parent object must have compatible Level, Version and XML 111 * namespaces. (Strictly speaking, a parent may also have more XML 112 * namespaces than a child, but the reverse is not permitted.) The 113 * restriction is necessary to ensure that an SBML model has a consistent 114 * overall structure. This requires callers to manage their objects 115 * carefully, but the benefit is increased flexibility in how models can be 116 * created by permitting callers to create objects bottom-up if desired. In 117 * situations where objects are not yet attached to parents (e.g., 118 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 119 * libSBML determine such things as whether it is valid to assign a 120 * particular value to an attribute. For packages, this means that the 121 * parent object to which this package element is being added must have 122 * been created with the package namespace, or that the package namespace 123 * was added to it, even if that parent is not a package object itself. 124 */ public 125 LineSegment(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 126 this(libsbmlJNI.new_LineSegment__SWIG_1(level, version), true); 127 } 128 129 130/** 131 * Creates a line segment with the given SBML level, version, and package version 132 * and both points set to (0.0,0.0,0.0) 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 LineSegment(long level) throws org.sbml.libsbml.SBMLConstructorException { 158 this(libsbmlJNI.new_LineSegment__SWIG_2(level), true); 159 } 160 161 162/** 163 * Creates a line segment with the given SBML level, version, and package version 164 * and both points set to (0.0,0.0,0.0) 165 <p> 166 * @param level the SBML Level. 167 * @param version the Version within the SBML Level. 168 * @param pkgVersion the version of the package. 169 <p> 170 * <p> 171 * @note Attempting to add an object to an {@link SBMLDocument} having a different 172 * combination of SBML Level, Version and XML namespaces than the object 173 * itself will result in an error at the time a caller attempts to make the 174 * addition. A parent object must have compatible Level, Version and XML 175 * namespaces. (Strictly speaking, a parent may also have more XML 176 * namespaces than a child, but the reverse is not permitted.) The 177 * restriction is necessary to ensure that an SBML model has a consistent 178 * overall structure. This requires callers to manage their objects 179 * carefully, but the benefit is increased flexibility in how models can be 180 * created by permitting callers to create objects bottom-up if desired. In 181 * situations where objects are not yet attached to parents (e.g., 182 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 183 * libSBML determine such things as whether it is valid to assign a 184 * particular value to an attribute. For packages, this means that the 185 * parent object to which this package element is being added must have 186 * been created with the package namespace, or that the package namespace 187 * was added to it, even if that parent is not a package object itself. 188 */ public 189 LineSegment() throws org.sbml.libsbml.SBMLConstructorException { 190 this(libsbmlJNI.new_LineSegment__SWIG_3(), true); 191 } 192 193 194/** 195 * Creates a line segment with the {@link LayoutPkgNamespaces} and both points set to (0.0,0.0,0.0) 196 <p> 197 * <p> 198 * The package namespaces object used in this constructor is derived from a 199 * {@link SBMLNamespaces} object, which encapsulates SBML Level/Version/namespaces 200 * information. It is used to communicate the SBML Level, Version, and 201 * package version and name information used in addition to SBML Level 3 Core. A 202 * common approach to using libSBML's {@link SBMLNamespaces} facilities is to create an 203 * package namespace object somewhere in a program once, then hand that object 204 * as needed to object constructors of that package that accept it as and 205 * argument, such as this one. 206 <p> 207 * @param layoutns the {@link LayoutPkgNamespaces} object. 208 <p> 209 * <p> 210 * @note Attempting to add an object to an {@link SBMLDocument} having a different 211 * combination of SBML Level, Version and XML namespaces than the object 212 * itself will result in an error at the time a caller attempts to make the 213 * addition. A parent object must have compatible Level, Version and XML 214 * namespaces. (Strictly speaking, a parent may also have more XML 215 * namespaces than a child, but the reverse is not permitted.) The 216 * restriction is necessary to ensure that an SBML model has a consistent 217 * overall structure. This requires callers to manage their objects 218 * carefully, but the benefit is increased flexibility in how models can be 219 * created by permitting callers to create objects bottom-up if desired. In 220 * situations where objects are not yet attached to parents (e.g., 221 * {@link SBMLDocument}), knowledge of the intented SBML Level and Version help 222 * libSBML determine such things as whether it is valid to assign a 223 * particular value to an attribute. For packages, this means that the 224 * parent object to which this package element is being added must have 225 * been created with the package namespace, or that the package namespace 226 * was added to it, even if that parent is not a package object itself. 227 */ public 228 LineSegment(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 229 this(libsbmlJNI.new_LineSegment__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 230 } 231 232 233/** 234 * Creates a new line segment with the given 2D coordinates. 235 */ public 236 LineSegment(LayoutPkgNamespaces layoutns, double x1, double y1, double x2, double y2) throws org.sbml.libsbml.SBMLConstructorException { 237 this(libsbmlJNI.new_LineSegment__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, x2, y2), true); 238 } 239 240 241/** 242 * Copy constructor. 243 <p> 244 * @param orig the instance to copy. 245 */ public 246 LineSegment(LineSegment orig) throws org.sbml.libsbml.SBMLConstructorException { 247 this(libsbmlJNI.new_LineSegment__SWIG_6(LineSegment.getCPtr(orig), orig), true); 248 } 249 250 251/** 252 * Creates a new line segment with the given 3D coordinates. 253 */ public 254 LineSegment(LayoutPkgNamespaces layoutns, double x1, double y1, double z1, double x2, double y2, double z2) throws org.sbml.libsbml.SBMLConstructorException { 255 this(libsbmlJNI.new_LineSegment__SWIG_7(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, z1, x2, y2, z2), true); 256 } 257 258 259/** 260 * Creates a new line segment with the two given points. 261 */ public 262 LineSegment(LayoutPkgNamespaces layoutns, Point start, Point end) throws org.sbml.libsbml.SBMLConstructorException { 263 this(libsbmlJNI.new_LineSegment__SWIG_8(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, Point.getCPtr(start), start, Point.getCPtr(end), end), true); 264 } 265 266 267/** 268 * Creates a new {@link LineSegment} from the given {@link XMLNode} 269 */ public 270 LineSegment(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 271 this(libsbmlJNI.new_LineSegment__SWIG_9(XMLNode.getCPtr(node), node, l2version), true); 272 } 273 274 275/** 276 * Creates a new {@link LineSegment} from the given {@link XMLNode} 277 */ public 278 LineSegment(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 279 this(libsbmlJNI.new_LineSegment__SWIG_10(XMLNode.getCPtr(node), node), true); 280 } 281 282 283/** 284 * Returns the start point of the line. 285 */ public 286 Point getStart() { 287 long cPtr = libsbmlJNI.LineSegment_getStart(swigCPtr, this); 288 return (cPtr == 0) ? null : new Point(cPtr, false); 289 } 290 291 292/** 293 * Initializes the start point with a copy of the given {@link Point} object. 294 */ public 295 void setStart(Point start) { 296 libsbmlJNI.LineSegment_setStart__SWIG_0(swigCPtr, this, Point.getCPtr(start), start); 297 } 298 299 300/** 301 * Initializes the start point with the given coordinates. 302 */ public 303 void setStart(double x, double y, double z) { 304 libsbmlJNI.LineSegment_setStart__SWIG_1(swigCPtr, this, x, y, z); 305 } 306 307 308/** 309 * Initializes the start point with the given coordinates. 310 */ public 311 void setStart(double x, double y) { 312 libsbmlJNI.LineSegment_setStart__SWIG_2(swigCPtr, this, x, y); 313 } 314 315 316/** 317 * Returns the end point of the line. 318 */ public 319 Point getEnd() { 320 long cPtr = libsbmlJNI.LineSegment_getEnd(swigCPtr, this); 321 return (cPtr == 0) ? null : new Point(cPtr, false); 322 } 323 324 325/** 326 * Initializes the end point with a copy of the given {@link Point} object. 327 */ public 328 void setEnd(Point end) { 329 libsbmlJNI.LineSegment_setEnd__SWIG_0(swigCPtr, this, Point.getCPtr(end), end); 330 } 331 332 333/** 334 * Initializes the end point with the given coordinates. 335 */ public 336 void setEnd(double x, double y, double z) { 337 libsbmlJNI.LineSegment_setEnd__SWIG_1(swigCPtr, this, x, y, z); 338 } 339 340 341/** 342 * Initializes the end point with the given coordinates. 343 */ public 344 void setEnd(double x, double y) { 345 libsbmlJNI.LineSegment_setEnd__SWIG_2(swigCPtr, this, x, y); 346 } 347 348 349/** * @internal */ public 350 boolean getStartExplicitlySet() { 351 return libsbmlJNI.LineSegment_getStartExplicitlySet(swigCPtr, this); 352 } 353 354 355/** * @internal */ public 356 boolean getEndExplicitlySet() { 357 return libsbmlJNI.LineSegment_getEndExplicitlySet(swigCPtr, this); 358 } 359 360 361/** 362 * Does noting since no defaults are defined for {@link LineSegment}. 363 */ public 364 void initDefaults() { 365 libsbmlJNI.LineSegment_initDefaults(swigCPtr, this); 366 } 367 368 369/** 370 * Returns the XML element name of 371 * this SBML object. 372 <p> 373 * @return the string of the name of this element. 374 */ public 375 String getElementName() { 376 return libsbmlJNI.LineSegment_getElementName(swigCPtr, this); 377 } 378 379 380/** 381 * Creates and returns a deep copy of this {@link LineSegment}. 382 <p> 383 * @return a (deep) copy of this {@link LineSegment}. 384 */ public 385 LineSegment cloneObject() { 386 return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.LineSegment_cloneObject(swigCPtr, this), true); 387} 388 389 390/** 391 * Returns the libSBML type code of this object instance. 392 <p> 393 * <p> 394 * LibSBML attaches an identifying code to every kind of SBML object. These 395 * are integer constants known as <em>SBML type codes</em>. The names of all 396 * the codes begin with the characters <code>SBML_</code>. 397 * In the Java language interface for libSBML, the 398 * type codes are defined as static integer constants in the interface class 399 * {@link libsbmlConstants}. Note that different Level 3 400 * package plug-ins may use overlapping type codes; to identify the package 401 * to which a given object belongs, call the <code>getPackageName()</code> 402 * method on the object. 403 <p> 404 * @return the SBML type code for this object: 405 * {@link libsbmlConstants#SBML_LAYOUT_LINESEGMENT SBML_LAYOUT_LINESEGMENT} 406 <p> 407 * <p> 408 * @warning <span class='warning'>The specific integer values of the possible 409 * type codes may be reused by different libSBML plug-ins for SBML Level 3. 410 * packages, To fully identify the correct code, <strong>it is necessary to 411 * invoke both getTypeCode() and getPackageName()</strong>.</span> 412 <p> 413 * @see #getElementName() 414 * @see #getPackageName() 415 */ public 416 int getTypeCode() { 417 return libsbmlJNI.LineSegment_getTypeCode(swigCPtr, this); 418 } 419 420 421/** 422 * Creates an {@link XMLNode} object from this. 423 */ public 424 XMLNode toXML() { 425 return new XMLNode(libsbmlJNI.LineSegment_toXML(swigCPtr, this), true); 426 } 427 428 public void connectToChild() { 429 libsbmlJNI.LineSegment_connectToChild(swigCPtr, this); 430 } 431 432 433/** * @internal */ public 434 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 435 libsbmlJNI.LineSegment_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 436 } 437 438}