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 * a {@link LineEnding} is a decoration element for the start and/or end 013 * of curves in the SBML render extension, e.g. arrow heads 014 <p> 015 * LineEndings in the SBML render extension are used to apply certain decorations 016 * to the end of curves. Since many curves in layout diagrams use the same decoration 017 * for the beginnings and start of a line, it would be highly redundant to encode 018 * those decorations with each line. Therefor {@link LineEnding} objects can be defined which are 019 * then applied to the beginning or the ends of several curve objects. 020 <p> 021 * A {@link LineEnding} contains an id by which it can be referenced from curve styles, it contains 022 * a visual representation of the decoration in the form of a render extension Group object 023 * and it has some attributes that define the viewport and how the {@link LineEnding} is to be applied 024 * to a curve. 025 <p> 026 * A {@link LineEnding} object is only valid if it has an id, a viewport that has an area which is not 0 027 * and a valid group object. 028 */ 029 030public class LineEnding extends GraphicalPrimitive2D { 031 private long swigCPtr; 032 033 protected LineEnding(long cPtr, boolean cMemoryOwn) 034 { 035 super(libsbmlJNI.LineEnding_SWIGUpcast(cPtr), cMemoryOwn); 036 swigCPtr = cPtr; 037 } 038 039 protected static long getCPtr(LineEnding obj) 040 { 041 return (obj == null) ? 0 : obj.swigCPtr; 042 } 043 044 protected static long getCPtrAndDisown (LineEnding obj) 045 { 046 long ptr = 0; 047 048 if (obj != null) 049 { 050 ptr = obj.swigCPtr; 051 obj.swigCMemOwn = false; 052 } 053 054 return ptr; 055 } 056 057 protected void finalize() { 058 delete(); 059 } 060 061 public synchronized void delete() { 062 if (swigCPtr != 0) { 063 if (swigCMemOwn) { 064 swigCMemOwn = false; 065 libsbmlJNI.delete_LineEnding(swigCPtr); 066 } 067 swigCPtr = 0; 068 } 069 super.delete(); 070 } 071 072 073/** 074 * Creates a new {@link LineEnding} object with the given SBML level 075 * and SBML version. 076 <p> 077 * @param level SBML level of the new object 078 * @param level SBML version of the new object 079 */ public 080 LineEnding(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 081 this(libsbmlJNI.new_LineEnding__SWIG_0(level, version, pkgVersion), true); 082 } 083 084 085/** 086 * Creates a new {@link LineEnding} object with the given SBML level 087 * and SBML version. 088 <p> 089 * @param level SBML level of the new object 090 * @param level SBML version of the new object 091 */ public 092 LineEnding(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 093 this(libsbmlJNI.new_LineEnding__SWIG_1(level, version), true); 094 } 095 096 097/** 098 * Creates a new {@link LineEnding} object with the given SBML level 099 * and SBML version. 100 <p> 101 * @param level SBML level of the new object 102 * @param level SBML version of the new object 103 */ public 104 LineEnding(long level) throws org.sbml.libsbml.SBMLConstructorException { 105 this(libsbmlJNI.new_LineEnding__SWIG_2(level), true); 106 } 107 108 109/** 110 * Creates a new {@link LineEnding} object with the given SBML level 111 * and SBML version. 112 <p> 113 * @param level SBML level of the new object 114 * @param level SBML version of the new object 115 */ public 116 LineEnding() throws org.sbml.libsbml.SBMLConstructorException { 117 this(libsbmlJNI.new_LineEnding__SWIG_3(), true); 118 } 119 120 121/** 122 * Creates a new {@link LineEnding} object with the given {@link SBMLNamespaces}. 123 <p> 124 * @param sbmlns The SBML namespace for the object. 125 */ public 126 LineEnding(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException { 127 this(libsbmlJNI.new_LineEnding__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true); 128 } 129 130 131/** 132 * Creates a new {@link LineEnding} object from the given {@link XMLNode} object. 133 * The {@link XMLNode} object has to contain a valid XML representation of a 134 * {@link LineEnding} object as defined in the render extension specification. 135 * This method is normally called when render information is read from a file and 136 * should normally not have to be called explicitely. 137 <p> 138 * @param node the {@link XMLNode} object reference that describes the {@link LineEnding} 139 * object to be instantiated. 140 */ public 141 LineEnding(XMLNode node, long l2version) throws org.sbml.libsbml.SBMLConstructorException { 142 this(libsbmlJNI.new_LineEnding__SWIG_5(XMLNode.getCPtr(node), node, l2version), true); 143 } 144 145 146/** 147 * Copy constructor. 148 */ public 149 LineEnding(LineEnding other) throws org.sbml.libsbml.SBMLConstructorException { 150 this(libsbmlJNI.new_LineEnding__SWIG_6(LineEnding.getCPtr(other), other), true); 151 } 152 153 154/** 155 * Constructor which creates a {@link LineEnding} with an empty group object, 156 * and a viewport with a size of 0. 157 * The id is set to the given value. 158 * In order to get a valid object, the group object has to be valid, 159 * the group object has to have descendants other than groups and 160 * the viewport has to have a positive size. 161 <p> 162 * @param id The id for the {@link LineEnding}. 163 <p> 164 <p> 165 * This constructor is deprecated. The new libsbml API only has 166 * constructors which take the SBML level and version or one that takes 167 * an {@link SBMLNamespaces} object. 168 */ public 169 LineEnding(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException { 170 this(libsbmlJNI.new_LineEnding__SWIG_7(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true); 171 } 172 173 174/** 175 * Sets whether rotational mapping is to be done or not. 176 * This flag determines whether the {@link LineEnding} is rotated 177 * according to the direction of the curve when it is applied. 178 * For details on this, see the render extension specification. 179 <p> 180 * @param enable Boolean flag that specifies whether rotational mapping 181 * for the line ending is to be enabled or not. 182 */ public 183 void setEnableRotationalMapping(boolean enable) { 184 libsbmlJNI.LineEnding_setEnableRotationalMapping(swigCPtr, this, enable); 185 } 186 187 188/** 189 * Returns whether rotational mapping is enabled or not. 190 <p> 191 * @return boolean value that specifies if rotational mapping is 192 * enabled for the {@link LineEnding} or not. 193 */ public 194 boolean getIsEnabledRotationalMapping() { 195 return libsbmlJNI.LineEnding_getIsEnabledRotationalMapping(swigCPtr, this); 196 } 197 198 199/** 200 * Sets the viewport for the {@link LineEnding}. 201 <p> 202 * @param box The viewport bounding box for the {@link LineEnding}. 203 */ public 204 void setBoundingBox(BoundingBox box) { 205 libsbmlJNI.LineEnding_setBoundingBox(swigCPtr, this, BoundingBox.getCPtr(box), box); 206 } 207 208 209/** 210 * Returns a pointer to the viewport bounding box. 211 <p> 212 * @return pointer to the viewport bounding box. 213 */ public 214 BoundingBox getBoundingBox() { 215 long cPtr = libsbmlJNI.LineEnding_getBoundingBox__SWIG_0(swigCPtr, this); 216 return (cPtr == 0) ? null : new BoundingBox(cPtr, false); 217 } 218 219 220/** 221 * Sets the group of the {@link LineEnding} to a copy of the given group. 222 <p> 223 * @param group const pointer to the group to be set for the bounding box. 224 * The group object is copied. 225 */ public 226 void setGroup(RenderGroup group) { 227 libsbmlJNI.LineEnding_setGroup(swigCPtr, this, RenderGroup.getCPtr(group), group); 228 } 229 230 231/** 232 * Returns a const pointer to the group object. 233 <p> 234 * @return const pointer to the group object 235 */ public 236 RenderGroup getGroup() { 237 long cPtr = libsbmlJNI.LineEnding_getGroup__SWIG_0(swigCPtr, this); 238 return (cPtr == 0) ? null : new RenderGroup(cPtr, false); 239 } 240 241 242/** 243 * Creates and returns a deep copy of this {@link LineEnding} object. 244 <p> 245 * @return a (deep) copy of this {@link LineEnding} object 246 */ public 247 LineEnding cloneObject() { 248 long cPtr = libsbmlJNI.LineEnding_cloneObject(swigCPtr, this); 249 return (cPtr == 0) ? null : new LineEnding(cPtr, true); 250 } 251 252 253/** 254 * Returns the XML element name of this object. 255 <p> 256 * This is overridden by subclasses to return a string appropriate to the 257 * SBML component. For example, {@link Model} defines it as returning 'model', 258 * {@link CompartmentType} defines it as returning 'compartmentType', etc. 259 */ public 260 String getElementName() { 261 return libsbmlJNI.LineEnding_getElementName(swigCPtr, this); 262 } 263 264 265/** 266 * Creates an {@link XMLNode} object from this {@link LineEnding} object. 267 <p> 268 * @return the {@link XMLNode} with the XML representation for the 269 * {@link LineEnding} object. 270 */ public 271 XMLNode toXML() { 272 return new XMLNode(libsbmlJNI.LineEnding_toXML(swigCPtr, this), true); 273 } 274 275 276/** 277 * Sets this SBML object to child SBML objects (if any). 278 * (Creates a child-parent relationship by the parent) 279 <p> 280 * Subclasses must override this function if they define 281 * one ore more child elements. 282 * Basically, this function needs to be called in 283 * constructor, copy constructor, assignment operator. 284 <p> 285 * @see setSBMLDocument 286 * @see enablePackageInternal 287 * @internal 288 */ public 289 void connectToChild() { 290 libsbmlJNI.LineEnding_connectToChild(swigCPtr, this); 291 } 292 293 294/** 295 * Enables/Disables the given package with this element and child 296 * elements (if any). 297 * (This is an internal implementation for enablePakcage function) 298 <p> 299 * @note Subclasses in which one or more child elements are defined 300 * must override this function. 301 * @internal 302 */ public 303 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 304 libsbmlJNI.LineEnding_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 305 } 306 307 308/** 309 * Returns the libSBML type code for this SBML object. 310 <p> 311 * LibSBML attaches an 312 * identifying code to every kind of SBML object. These are known as 313 * <em>SBML type codes</em>. In other languages, the set of type codes 314 * is stored in an enumeration; in the Java language interface for 315 * libSBML, the type codes are defined as static integer constants in 316 * interface class {@link libsbmlConstants}. The names of the type codes 317 * all begin with the characters <code>SBML_.</code> 318 <p> 319 * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default). 320 <p> 321 * @see #getElementName() 322 */ public 323 int getTypeCode() { 324 return libsbmlJNI.LineEnding_getTypeCode(swigCPtr, this); 325 } 326 327 328/** 329 * Returns the value of the 'id' attribute of this GraphicalPrimitive. 330 <p> 331 * @return the id of the GraphicalPrimitive 332 */ public 333 String getId() { 334 return libsbmlJNI.LineEnding_getId(swigCPtr, this); 335 } 336 337 338/** 339 * Predicate returning <code>true</code> or <code>false</code> depending on whether this 340 * GraphicalPrimitive's 'id' attribute has been set. 341 <p> 342 * @return returns true or false depending on whether the id on the 343 * GraphicalPrimitive has been set. 344 */ public 345 boolean isSetId() { 346 return libsbmlJNI.LineEnding_isSetId(swigCPtr, this); 347 } 348 349 350/** 351 * Sets the value of the 'id' attribute of this GraphicalPrimitive. 352 <p> 353 * @param id the new id for the GraphicalPrimitive 354 <p> 355 * @return status if the operation succeeded 356 */ public 357 int setId(String id) { 358 return libsbmlJNI.LineEnding_setId(swigCPtr, this, id); 359 } 360 361 362/** 363 * Unsets the value of the 'id' attribute of this GraphicalPrimitive. 364 */ public 365 int unsetId() { 366 return libsbmlJNI.LineEnding_unsetId(swigCPtr, this); 367 } 368 369 370/** * @internal */ public 371 boolean hasRequiredAttributes() { 372 return libsbmlJNI.LineEnding_hasRequiredAttributes(swigCPtr, this); 373 } 374 375 376/** * @internal */ public 377 boolean hasRequiredElements() { 378 return libsbmlJNI.LineEnding_hasRequiredElements(swigCPtr, this); 379 } 380 381}