001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.8
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   */ public
070 LineSegment(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException {
071    this(libsbmlJNI.new_LineSegment__SWIG_0(level, version, pkgVersion), true);
072  }
073
074  
075/**
076   * Creates a line segment with the given SBML level, version, and package version
077   * and both points set to (0.0,0.0,0.0)
078   */ public
079 LineSegment(long level, long version) throws org.sbml.libsbml.SBMLConstructorException {
080    this(libsbmlJNI.new_LineSegment__SWIG_1(level, version), true);
081  }
082
083  
084/**
085   * Creates a line segment with the given SBML level, version, and package version
086   * and both points set to (0.0,0.0,0.0)
087   */ public
088 LineSegment(long level) throws org.sbml.libsbml.SBMLConstructorException {
089    this(libsbmlJNI.new_LineSegment__SWIG_2(level), true);
090  }
091
092  
093/**
094   * Creates a line segment with the given SBML level, version, and package version
095   * and both points set to (0.0,0.0,0.0)
096   */ public
097 LineSegment() throws org.sbml.libsbml.SBMLConstructorException {
098    this(libsbmlJNI.new_LineSegment__SWIG_3(), true);
099  }
100
101  
102/**
103   * Creates a line segment with the {@link LayoutPkgNamespaces} and both points set to (0.0,0.0,0.0)
104   */ public
105 LineSegment(LayoutPkgNamespaces layoutns) throws org.sbml.libsbml.SBMLConstructorException {
106    this(libsbmlJNI.new_LineSegment__SWIG_4(LayoutPkgNamespaces.getCPtr(layoutns), layoutns), true);
107  }
108
109  
110/**
111   * Creates a new line segment with the given 2D coordinates.
112   */ public
113 LineSegment(LayoutPkgNamespaces layoutns, double x1, double y1, double x2, double y2) throws org.sbml.libsbml.SBMLConstructorException {
114    this(libsbmlJNI.new_LineSegment__SWIG_5(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, x2, y2), true);
115  }
116
117  
118/**
119   * Copy constructor.
120   */ public
121 LineSegment(LineSegment orig) throws org.sbml.libsbml.SBMLConstructorException {
122    this(libsbmlJNI.new_LineSegment__SWIG_6(LineSegment.getCPtr(orig), orig), true);
123  }
124
125  
126/**
127   * Creates a new line segment with the given 3D coordinates.
128   */ public
129 LineSegment(LayoutPkgNamespaces layoutns, double x1, double y1, double z1, double x2, double y2, double z2) throws org.sbml.libsbml.SBMLConstructorException {
130    this(libsbmlJNI.new_LineSegment__SWIG_7(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, x1, y1, z1, x2, y2, z2), true);
131  }
132
133  
134/**
135   * Creates a new line segment with the two given points.
136   */ public
137 LineSegment(LayoutPkgNamespaces layoutns, Point start, Point end) throws org.sbml.libsbml.SBMLConstructorException {
138    this(libsbmlJNI.new_LineSegment__SWIG_8(LayoutPkgNamespaces.getCPtr(layoutns), layoutns, Point.getCPtr(start), start, Point.getCPtr(end), end), true);
139  }
140
141  
142/**
143   * Creates a new {@link LineSegment} from the given {@link XMLNode}
144   */ public
145 LineSegment(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException {
146    this(libsbmlJNI.new_LineSegment__SWIG_9(XMLNode.getCPtr(node), node, l2version), true);
147  }
148
149  
150/**
151   * Creates a new {@link LineSegment} from the given {@link XMLNode}
152   */ public
153 LineSegment(XMLNode node) throws org.sbml.libsbml.SBMLConstructorException {
154    this(libsbmlJNI.new_LineSegment__SWIG_10(XMLNode.getCPtr(node), node), true);
155  }
156
157  
158/**
159   * Returns the start point of the line.
160   */ public
161 Point getStart() {
162    long cPtr = libsbmlJNI.LineSegment_getStart(swigCPtr, this);
163    return (cPtr == 0) ? null : new Point(cPtr, false);
164  }
165
166  
167/**
168   * Initializes the start point with a copy of the given {@link Point} object.
169   */ public
170 void setStart(Point start) {
171    libsbmlJNI.LineSegment_setStart__SWIG_0(swigCPtr, this, Point.getCPtr(start), start);
172  }
173
174  
175/**
176   * Initializes the start point with the given coordinates.
177   */ public
178 void setStart(double x, double y, double z) {
179    libsbmlJNI.LineSegment_setStart__SWIG_1(swigCPtr, this, x, y, z);
180  }
181
182  
183/**
184   * Initializes the start point with the given coordinates.
185   */ public
186 void setStart(double x, double y) {
187    libsbmlJNI.LineSegment_setStart__SWIG_2(swigCPtr, this, x, y);
188  }
189
190  
191/**
192   * Returns the end point of the line.
193   */ public
194 Point getEnd() {
195    long cPtr = libsbmlJNI.LineSegment_getEnd(swigCPtr, this);
196    return (cPtr == 0) ? null : new Point(cPtr, false);
197  }
198
199  
200/**
201   * Initializes the end point with a copy of the given {@link Point} object.
202   */ public
203 void setEnd(Point end) {
204    libsbmlJNI.LineSegment_setEnd__SWIG_0(swigCPtr, this, Point.getCPtr(end), end);
205  }
206
207  
208/**
209   * Initializes the end point with the given coordinates.
210   */ public
211 void setEnd(double x, double y, double z) {
212    libsbmlJNI.LineSegment_setEnd__SWIG_1(swigCPtr, this, x, y, z);
213  }
214
215  
216/**
217   * Initializes the end point with the given coordinates.
218   */ public
219 void setEnd(double x, double y) {
220    libsbmlJNI.LineSegment_setEnd__SWIG_2(swigCPtr, this, x, y);
221  }
222
223  
224/** * @internal */ public
225 boolean getStartExplicitlySet() {
226    return libsbmlJNI.LineSegment_getStartExplicitlySet(swigCPtr, this);
227  }
228
229  
230/** * @internal */ public
231 boolean getEndExplicitlySet() {
232    return libsbmlJNI.LineSegment_getEndExplicitlySet(swigCPtr, this);
233  }
234
235  
236/**
237   * Does noting since no defaults are defined for {@link LineSegment}.
238   */ public
239 void initDefaults() {
240    libsbmlJNI.LineSegment_initDefaults(swigCPtr, this);
241  }
242
243  
244/**
245   * Returns the XML element name of
246   * this SBML object.
247   <p>
248   * @return the string of the name of this element
249   */ public
250 String getElementName() {
251    return libsbmlJNI.LineSegment_getElementName(swigCPtr, this);
252  }
253
254  
255/**
256   * Creates and returns a deep copy of this {@link LineSegment}.
257   <p>
258   * @return a (deep) copy of this {@link LineSegment}.
259   */ public
260 LineSegment cloneObject() {
261    return (LineSegment) libsbml.DowncastSBase(libsbmlJNI.LineSegment_cloneObject(swigCPtr, this), true);
262}
263
264  
265/**
266   * Returns the libSBML type code of this object instance.
267   <p>
268   * <p>
269 * LibSBML attaches an identifying code to every kind of SBML object.  These
270 * are integer constants known as <em>SBML type codes</em>.  The names of all
271 * the codes begin with the characters <code>SBML_</code>.
272 * In the Java language interface for libSBML, the
273 * type codes are defined as static integer constants in the interface class
274 * {@link libsbmlConstants}.    Note that different Level&nbsp;3
275 * package plug-ins may use overlapping type codes; to identify the package
276 * to which a given object belongs, call the <code>getPackageName()</code>
277 * method on the object.
278   <p>
279   * @return the SBML type code for this object:
280   * {@link libsbmlConstants#SBML_LAYOUT_LINESEGMENT SBML_LAYOUT_LINESEGMENT}
281   <p>
282   * <p>
283 * @warning <span class='warning'>The specific integer values of the possible
284 * type codes may be reused by different Level&nbsp;3 package plug-ins.
285 * Thus, to identifiy the correct code, <strong>it is necessary to invoke
286 * both getTypeCode() and getPackageName()</strong>.</span>
287   <p>
288   * @see #getElementName()
289   * @see #getPackageName()
290   */ public
291 int getTypeCode() {
292    return libsbmlJNI.LineSegment_getTypeCode(swigCPtr, this);
293  }
294
295  
296/**
297    * Creates an {@link XMLNode} object from this.
298    */ public
299 XMLNode toXML() {
300    return new XMLNode(libsbmlJNI.LineSegment_toXML(swigCPtr, this), true);
301  }
302
303  public void connectToChild() {
304    libsbmlJNI.LineSegment_connectToChild(swigCPtr, this);
305  }
306
307  
308/** * @internal */ public
309 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) {
310    libsbmlJNI.LineSegment_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag);
311  }
312
313}