001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.12 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * <span class="pkg-marker pkg-color-layout"><a href="group__layout.html">layout</a></span> 013 014 The representation of a line in the 015 * “layout” package. 016 <p> 017 * The {@link LineSegment} class consists of the mandatory attribute xsi:type and two 018 * child elements of type {@link Point}. One is called 'start' and represents the 019 * starting point of the line, the other is called 'end' and represents the 020 * endpoint of the line. The {@link LineSegment} class is also the base class for 021 * {@link CubicBezier}, which represent curved lines instead of straight ones. 022 */ 023 024public class LineSegment extends SBase { 025 private long swigCPtr; 026 027 protected LineSegment(long cPtr, boolean cMemoryOwn) 028 { 029 super(libsbmlJNI.LineSegment_SWIGUpcast(cPtr), cMemoryOwn); 030 swigCPtr = cPtr; 031 } 032 033 protected static long getCPtr(LineSegment obj) 034 { 035 return (obj == null) ? 0 : obj.swigCPtr; 036 } 037 038 protected static long getCPtrAndDisown (LineSegment obj) 039 { 040 long ptr = 0; 041 042 if (obj != null) 043 { 044 ptr = obj.swigCPtr; 045 obj.swigCMemOwn = false; 046 } 047 048 return ptr; 049 } 050 051 protected void finalize() { 052 delete(); 053 } 054 055 public synchronized void delete() { 056 if (swigCPtr != 0) { 057 if (swigCMemOwn) { 058 swigCMemOwn = false; 059 libsbmlJNI.delete_LineSegment(swigCPtr); 060 } 061 swigCPtr = 0; 062 } 063 super.delete(); 064 } 065 066 067/** 068 * Creates a line segment with the given SBML level, version, and package version 069 * and both points set to (0.0,0.0,0.0) 070 */ public 071 LineSegment(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 072 this(libsbmlJNI.new_LineSegment__SWIG_0(level, version, pkgVersion), true); 073 } 074 075 076/** 077 * Creates a line segment with the given SBML level, version, and package version 078 * and both points set to (0.0,0.0,0.0) 079 */ public 080 LineSegment(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 081 this(libsbmlJNI.new_LineSegment__SWIG_1(level, version), true); 082 } 083 084 085/** 086 * Creates a line segment with the given SBML level, version, and package version 087 * and both points set to (0.0,0.0,0.0) 088 */ public 089 LineSegment(long level) throws org.sbml.libsbml.SBMLConstructorException { 090 this(libsbmlJNI.new_LineSegment__SWIG_2(level), true); 091 } 092 093 094/** 095 * Creates a line segment with the given SBML level, version, and package version 096 * and both points set to (0.0,0.0,0.0) 097 */ public 098 LineSegment() throws org.sbml.libsbml.SBMLConstructorException { 099 this(libsbmlJNI.new_LineSegment__SWIG_3(), true); 100 } 101 102 103/** 104 * Creates a line segment with the {@link LayoutPkgNamespaces} and both points set to (0.0,0.0,0.0) 105 */ public 106 LineSegment(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException { 107 this(libsbmlJNI.new_LineSegment__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true); 108 } 109 110 111/** 112 * Creates a new line segment with the given 2D coordinates. 113 */ public 114 LineSegment(LayoutPkgNamespaces layoutns, double x1, double y1, double x2, double y2) throws org.sbml.libsbml.SBMLConstructorException { 115 this(libsbmlJNI.new_LineSegment__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, x2, y2), true); 116 } 117 118 119/** 120 * Copy constructor. 121 */ public 122 LineSegment(LineSegment orig) throws org.sbml.libsbml.SBMLConstructorException { 123 this(libsbmlJNI.new_LineSegment__SWIG_6(LineSegment.getCPtr(orig), orig), true); 124 } 125 126 127/** 128 * Creates a new line segment with the given 3D coordinates. 129 */ public 130 LineSegment(LayoutPkgNamespaces layoutns, double x1, double y1, double z1, double x2, double y2, double z2) throws org.sbml.libsbml.SBMLConstructorException { 131 this(libsbmlJNI.new_LineSegment__SWIG_7(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, z1, x2, y2, z2), true); 132 } 133 134 135/** 136 * Creates a new line segment with the two given points. 137 */ public 138 LineSegment(LayoutPkgNamespaces layoutns, Point start, Point end) throws org.sbml.libsbml.SBMLConstructorException { 139 this(libsbmlJNI.new_LineSegment__SWIG_8(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, Point.getCPtr(start), start, Point.getCPtr(end), end), true); 140 } 141 142 143/** 144 * Creates a new {@link LineSegment} from the given {@link XMLNode} 145 */ public 146 LineSegment(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 147 this(libsbmlJNI.new_LineSegment__SWIG_9(XMLNode.getCPtr(node), node, l2version), true); 148 } 149 150 151/** 152 * Creates a new {@link LineSegment} from the given {@link XMLNode} 153 */ public 154 LineSegment(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException { 155 this(libsbmlJNI.new_LineSegment__SWIG_10(XMLNode.getCPtr(node), node), true); 156 } 157 158 159/** 160 * Returns the start point of the line. 161 */ public 162 Point getStart() { 163 long cPtr = libsbmlJNI.LineSegment_getStart(swigCPtr, this); 164 return (cPtr == 0) ? null : new Point(cPtr, false); 165 } 166 167 168/** 169 * Initializes the start point with a copy of the given {@link Point} object. 170 */ public 171 void setStart(Point start) { 172 libsbmlJNI.LineSegment_setStart__SWIG_0(swigCPtr, this, Point.getCPtr(start), start); 173 } 174 175 176/** 177 * Initializes the start point with the given coordinates. 178 */ public 179 void setStart(double x, double y, double z) { 180 libsbmlJNI.LineSegment_setStart__SWIG_1(swigCPtr, this, x, y, z); 181 } 182 183 184/** 185 * Initializes the start point with the given coordinates. 186 */ public 187 void setStart(double x, double y) { 188 libsbmlJNI.LineSegment_setStart__SWIG_2(swigCPtr, this, x, y); 189 } 190 191 192/** 193 * Returns the end point of the line. 194 */ public 195 Point getEnd() { 196 long cPtr = libsbmlJNI.LineSegment_getEnd(swigCPtr, this); 197 return (cPtr == 0) ? null : new Point(cPtr, false); 198 } 199 200 201/** 202 * Initializes the end point with a copy of the given {@link Point} object. 203 */ public 204 void setEnd(Point end) { 205 libsbmlJNI.LineSegment_setEnd__SWIG_0(swigCPtr, this, Point.getCPtr(end), end); 206 } 207 208 209/** 210 * Initializes the end point with the given coordinates. 211 */ public 212 void setEnd(double x, double y, double z) { 213 libsbmlJNI.LineSegment_setEnd__SWIG_1(swigCPtr, this, x, y, z); 214 } 215 216 217/** 218 * Initializes the end point with the given coordinates. 219 */ public 220 void setEnd(double x, double y) { 221 libsbmlJNI.LineSegment_setEnd__SWIG_2(swigCPtr, this, x, y); 222 } 223 224 225/** * @internal */ public 226 boolean getStartExplicitlySet() { 227 return libsbmlJNI.LineSegment_getStartExplicitlySet(swigCPtr, this); 228 } 229 230 231/** * @internal */ public 232 boolean getEndExplicitlySet() { 233 return libsbmlJNI.LineSegment_getEndExplicitlySet(swigCPtr, this); 234 } 235 236 237/** 238 * Does noting since no defaults are defined for {@link LineSegment}. 239 */ public 240 void initDefaults() { 241 libsbmlJNI.LineSegment_initDefaults(swigCPtr, this); 242 } 243 244 245/** 246 * Returns the XML element name of 247 * this SBML object. 248 */ public 249 String getElementName() { 250 return libsbmlJNI.LineSegment_getElementName(swigCPtr, this); 251 } 252 253 254/** 255 * Creates and returns a deep copy of this {@link LineSegment}. 256 <p> 257 * @return a (deep) copy of this {@link LineSegment}. 258 */ public 259 LineSegment cloneObject() { 260 return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.LineSegment_cloneObject(swigCPtr, this), true); 261} 262 263 264/** 265 * Returns the libSBML type code of this object instance. 266 <p> 267 * <p> 268 * LibSBML attaches an identifying code to every kind of SBML object. These 269 * are integer constants known as <em>SBML type codes</em>. The names of all 270 * the codes begin with the characters “<code>SBML_</code>”. 271 * In the Java language interface for libSBML, the 272 * type codes are defined as static integer constants in the interface class 273 * {@link libsbmlConstants}. Note that different Level 3 274 * package plug-ins may use overlapping type codes; to identify the package 275 * to which a given object belongs, call the <code>getPackageName()</code> 276 * method on the object. 277 <p> 278 * @return the SBML type code for this object: 279 * {@link libsbmlConstants#SBML_LAYOUT_LINESEGMENT SBML_LAYOUT_LINESEGMENT} 280 <p> 281 * <p> 282 * @warning <span class='warning'>The specific integer values of the possible 283 * type codes may be reused by different Level 3 package plug-ins. 284 * Thus, to identifiy the correct code, <strong>it is necessary to invoke 285 * both getTypeCode() and getPackageName()</strong>.</span> 286 <p> 287 * @see #getElementName() 288 * @see #getPackageName() 289 */ public 290 int getTypeCode() { 291 return libsbmlJNI.LineSegment_getTypeCode(swigCPtr, this); 292 } 293 294 295/** 296 * Creates an {@link XMLNode} object from this. 297 */ public 298 XMLNode toXML() { 299 return new XMLNode(libsbmlJNI.LineSegment_toXML(swigCPtr, this), true); 300 } 301 302 303/** 304 * Sets this SBML object to child SBML objects (if any). 305 * (Creates a child-parent relationship by the parent) 306 <p> 307 * Subclasses must override this function if they define 308 * one ore more child elements. 309 * Basically, this function needs to be called in 310 * constructor, copy constructor, assignment operator. 311 <p> 312 * @see setSBMLDocument 313 * @see enablePackageInternal 314 * @internal 315 */ public 316 void connectToChild() { 317 libsbmlJNI.LineSegment_connectToChild(swigCPtr, this); 318 } 319 320 321/** 322 * Enables/Disables the given package with this element and child 323 * elements (if any). 324 * (This is an internal implementation for enablePakcage function) 325 <p> 326 * @note Subclasses in which one or more child elements are defined 327 * must override this function. 328 * @internal 329 */ public 330 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 331 libsbmlJNI.LineSegment_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 332 } 333 334}