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 * base class for all graphical primitives which implements all 1D attributes
013 <p>
014 * The {@link GraphicalPrimitive1D} class implements attributes and methods necessary for 1D objects
015 * like lines. The attributes that are implemented are a stroke color, a stroke width and 
016 * a stroke dasharray for dashed line drawing.
017 <p>
018 * Additionally this class adds an id attribute with which all graphical primitives can be
019 * referenced.
020 <p>
021 * The {@link GraphicalPrimitive1D} class is derived from {@link Transformation2D} and inherits all its methods
022 * and attributes.
023 */
024
025public class GraphicalPrimitive1D extends Transformation2D {
026   private long swigCPtr;
027
028   protected GraphicalPrimitive1D(long cPtr, boolean cMemoryOwn)
029   {
030     super(libsbmlJNI.GraphicalPrimitive1D_SWIGUpcast(cPtr), cMemoryOwn);
031     swigCPtr = cPtr;
032   }
033
034   protected static long getCPtr(GraphicalPrimitive1D obj)
035   {
036     return (obj == null) ? 0 : obj.swigCPtr;
037   }
038
039   protected static long getCPtrAndDisown (GraphicalPrimitive1D obj)
040   {
041     long ptr = 0;
042
043     if (obj != null)
044     {
045       ptr             = obj.swigCPtr;
046       obj.swigCMemOwn = false;
047     }
048
049     return ptr;
050   }
051
052  protected void finalize() {
053    delete();
054  }
055
056  public synchronized void delete() {
057    if (swigCPtr != 0) {
058      if (swigCMemOwn) {
059        swigCMemOwn = false;
060        libsbmlJNI.delete_GraphicalPrimitive1D(swigCPtr);
061      }
062      swigCPtr = 0;
063    }
064    super.delete();
065  }
066
067  
068/**
069   * Sets the stroke color to the given color definition id or color value string.
070   * (
071   * @param stroke id of a {@link ColorDefinition} object or a valid color value string.
072   <p>
073   * @see ColorDefinition)
074   */ public
075 void setStroke(String stroke) {
076    libsbmlJNI.GraphicalPrimitive1D_setStroke(swigCPtr, this, stroke);
077  }
078
079  
080/**
081   * Sets the stroke width.
082   <p>
083   * @param width New width for strokes. Should be a positive value.
084   */ public
085 void setStrokeWidth(double width) {
086    libsbmlJNI.GraphicalPrimitive1D_setStrokeWidth(swigCPtr, this, width);
087  }
088
089  
090/**
091   * Returns the stroke color.
092   <p>
093   * @return the id of the color definition or a color value string.
094   */ public
095 String getStroke() {
096    return libsbmlJNI.GraphicalPrimitive1D_getStroke(swigCPtr, this);
097  }
098
099  
100/**
101   * Returns the stroke width.
102   <p>
103   * @return the stroke width
104   */ public
105 double getStrokeWidth() {
106    return libsbmlJNI.GraphicalPrimitive1D_getStrokeWidth(swigCPtr, this);
107  }
108
109  
110/**
111   * Returns true is the stroke width has been set or false otherwise.
112   * The stroke width is considered set if it is not NaN.
113   <p>
114   * @return true is the stroke width is set.
115   */ public
116 boolean isSetStrokeWidth() {
117    return libsbmlJNI.GraphicalPrimitive1D_isSetStrokeWidth(swigCPtr, this);
118  }
119
120  
121/**
122   * Returns true is the stroke has been set or false otherwise.
123   * The stroke color is considered set if the string is not empty.
124   <p>
125   * @return true if the stroke color is set.
126   */ public
127 boolean isSetStroke() {
128    return libsbmlJNI.GraphicalPrimitive1D_isSetStroke(swigCPtr, this);
129  }
130
131  
132/**
133   * Returns true is the dash array has been set or false otherwise.
134   * The array is considered set if it is not empty and if the first entry is
135   * not NaN.
136   <p>
137   * @true if the dasharray is set.
138   */ public
139 boolean isSetDashArray() {
140    return libsbmlJNI.GraphicalPrimitive1D_isSetDashArray(swigCPtr, this);
141  }
142
143  
144/** 
145   * Returns the number of defined dashes.
146   */ public
147 long getNumDashes() {
148    return libsbmlJNI.GraphicalPrimitive1D_getNumDashes(swigCPtr, this);
149  }
150
151  
152/**
153   * Returns the dash at the given index. 
154   */ public
155 long getDashByIndex(long index) {
156    return libsbmlJNI.GraphicalPrimitive1D_getDashByIndex(swigCPtr, this, index);
157  }
158
159  
160/**
161   * Adds a dash at the end of the current list
162   */ public
163 void addDash(long dash) {
164    libsbmlJNI.GraphicalPrimitive1D_addDash(swigCPtr, this, dash);
165  }
166
167  
168/**
169   * Clears all defined dashes.
170   */ public
171 void clearDashes() {
172    libsbmlJNI.GraphicalPrimitive1D_clearDashes(swigCPtr, this);
173  }
174
175  
176/** 
177   * Sets the dash at the given position.
178   */ public
179 void setDashByIndex(long index, long dash) {
180    libsbmlJNI.GraphicalPrimitive1D_setDashByIndex(swigCPtr, this, index, dash);
181  }
182
183  
184/** 
185   * Inserts the dash at the given position.
186   */ public
187 void insertDash(long index, long dash) {
188    libsbmlJNI.GraphicalPrimitive1D_insertDash(swigCPtr, this, index, dash);
189  }
190
191  
192/**
193   * Removes the dash at the given index
194   */ public
195 void removeDash(long index) {
196    libsbmlJNI.GraphicalPrimitive1D_removeDash(swigCPtr, this, index);
197  }
198
199  
200/**
201   * Creates an {@link XMLNode} object from this {@link GraphicalPrimitive1D} object.
202   <p>
203   * @return the {@link XMLNode} with the XML representation for the 
204   * {@link GraphicalPrimitive1D} object.
205   <p>
206   * This method is purely virtual and has to be implemented by subclasses.
207   */ public
208 XMLNode toXML() {
209    return new XMLNode(libsbmlJNI.GraphicalPrimitive1D_toXML(swigCPtr, this), true);
210  }
211
212  
213/**
214   * Returns the value of the 'id' attribute of this GraphicalPrimitive.
215   <p>
216   * @return the id of the GraphicalPrimitive
217   */ public
218 String getId() {
219    return libsbmlJNI.GraphicalPrimitive1D_getId(swigCPtr, this);
220  }
221
222  
223/**
224   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
225   * GraphicalPrimitive's 'id' attribute has been set.
226   <p>
227   * @return returns true or false depending on whether the id on the 
228   * GraphicalPrimitive has been set.
229   */ public
230 boolean isSetId() {
231    return libsbmlJNI.GraphicalPrimitive1D_isSetId(swigCPtr, this);
232  }
233
234  
235/**
236   * Sets the value of the 'id' attribute of this GraphicalPrimitive.
237   <p>
238   * @param id the new id for the GraphicalPrimitive 
239   <p>
240   * @return status if the operation succeeded
241   */ public
242 int setId(String id) {
243    return libsbmlJNI.GraphicalPrimitive1D_setId(swigCPtr, this, id);
244  }
245
246  
247/**
248   * Unsets the value of the 'id' attribute of this GraphicalPrimitive.
249   */ public
250 int unsetId() {
251    return libsbmlJNI.GraphicalPrimitive1D_unsetId(swigCPtr, this);
252  }
253
254}