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 * 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   * (@see ColorDefinition)
071   <p>
072   * @param stroke id of a {@link ColorDefinition} object or a valid color value string.
073   */ public
074 void setStroke(String stroke) {
075    libsbmlJNI.GraphicalPrimitive1D_setStroke(swigCPtr, this, stroke);
076  }
077
078  
079/**
080   * Sets the stroke width.
081   <p>
082   * @param width New width for strokes. Should be a positive value.
083   */ public
084 void setStrokeWidth(double width) {
085    libsbmlJNI.GraphicalPrimitive1D_setStrokeWidth(swigCPtr, this, width);
086  }
087
088  
089/**
090   * Returns the stroke color.
091   <p>
092   * @return the id of the color definition or a color value string.
093   */ public
094 String getStroke() {
095    return libsbmlJNI.GraphicalPrimitive1D_getStroke(swigCPtr, this);
096  }
097
098  
099/**
100   * Returns the stroke width.
101   <p>
102   * @return the stroke width
103   */ public
104 double getStrokeWidth() {
105    return libsbmlJNI.GraphicalPrimitive1D_getStrokeWidth(swigCPtr, this);
106  }
107
108  
109/**
110   * Returns true is the stroke width has been set or false otherwise.
111   * The stroke width is considered set if it is not NaN.
112   <p>
113   * @return true is the stroke width is set.
114   */ public
115 boolean isSetStrokeWidth() {
116    return libsbmlJNI.GraphicalPrimitive1D_isSetStrokeWidth(swigCPtr, this);
117  }
118
119  
120/**
121   * Returns true is the stroke has been set or false otherwise.
122   * The stroke color is considered set if the string is not empty.
123   <p>
124   * @return true if the stroke color is set.
125   */ public
126 boolean isSetStroke() {
127    return libsbmlJNI.GraphicalPrimitive1D_isSetStroke(swigCPtr, this);
128  }
129
130  
131/**
132   * Returns true is the dash array has been set or false otherwise.
133   * The array is considered set if it is not empty and if the first entry is
134   * not NaN.
135   <p>
136   * @true if the dasharray is set.
137   */ public
138 boolean isSetDashArray() {
139    return libsbmlJNI.GraphicalPrimitive1D_isSetDashArray(swigCPtr, this);
140  }
141
142  
143/** 
144   * Returns the number of defined dashes.
145   */ public
146 long getNumDashes() {
147    return libsbmlJNI.GraphicalPrimitive1D_getNumDashes(swigCPtr, this);
148  }
149
150  
151/**
152   * Returns the dash at the given index. 
153   */ public
154 long getDashByIndex(long index) {
155    return libsbmlJNI.GraphicalPrimitive1D_getDashByIndex(swigCPtr, this, index);
156  }
157
158  
159/**
160   * Adds a dash at the end of the current list
161   */ public
162 void addDash(long dash) {
163    libsbmlJNI.GraphicalPrimitive1D_addDash(swigCPtr, this, dash);
164  }
165
166  
167/**
168   * Clears all defined dashes.
169   */ public
170 void clearDashes() {
171    libsbmlJNI.GraphicalPrimitive1D_clearDashes(swigCPtr, this);
172  }
173
174  
175/** 
176   * Sets the dash at the given position.
177   */ public
178 void setDashByIndex(long index, long dash) {
179    libsbmlJNI.GraphicalPrimitive1D_setDashByIndex(swigCPtr, this, index, dash);
180  }
181
182  
183/** 
184   * Inserts the dash at the given position.
185   */ public
186 void insertDash(long index, long dash) {
187    libsbmlJNI.GraphicalPrimitive1D_insertDash(swigCPtr, this, index, dash);
188  }
189
190  
191/**
192   * Removes the dash at the given index
193   */ public
194 void removeDash(long index) {
195    libsbmlJNI.GraphicalPrimitive1D_removeDash(swigCPtr, this, index);
196  }
197
198  
199/**
200   * Creates an {@link XMLNode} object from this {@link GraphicalPrimitive1D} object.
201   <p>
202   * @return the {@link XMLNode} with the XML representation for the 
203   * {@link GraphicalPrimitive1D} object.
204   <p>
205   * This method is purely virtual and has to be implemented by subclasses.
206   */ public
207 XMLNode toXML() {
208    return new XMLNode(libsbmlJNI.GraphicalPrimitive1D_toXML(swigCPtr, this), true);
209  }
210
211  
212/**
213   * Returns the value of the 'id' attribute of this GraphicalPrimitive.
214   <p>
215   * @return the id of the GraphicalPrimitive
216   */ public
217 String getId() {
218    return libsbmlJNI.GraphicalPrimitive1D_getId(swigCPtr, this);
219  }
220
221  
222/**
223   * Predicate returning <code>true</code> or <code>false</code> depending on whether this
224   * GraphicalPrimitive's 'id' attribute has been set.
225   <p>
226   * @return returns true or false depending on whether the id on the 
227   * GraphicalPrimitive has been set.
228   */ public
229 boolean isSetId() {
230    return libsbmlJNI.GraphicalPrimitive1D_isSetId(swigCPtr, this);
231  }
232
233  
234/**
235   * Sets the value of the 'id' attribute of this GraphicalPrimitive.
236   <p>
237   * @param id the new id for the GraphicalPrimitive 
238   <p>
239   * @return status if the operation succeeded
240   */ public
241 int setId(String id) {
242    return libsbmlJNI.GraphicalPrimitive1D_setId(swigCPtr, this, id);
243  }
244
245  
246/**
247   * Unsets the value of the 'id' attribute of this GraphicalPrimitive.
248   */ public
249 int unsetId() {
250    return libsbmlJNI.GraphicalPrimitive1D_unsetId(swigCPtr, this);
251  }
252
253}