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
011public class RenderExtension extends SBMLExtension {
012   private long swigCPtr;
013
014   protected RenderExtension(long cPtr, boolean cMemoryOwn)
015   {
016     super(libsbmlJNI.RenderExtension_SWIGUpcast(cPtr), cMemoryOwn);
017     swigCPtr = cPtr;
018   }
019
020   protected static long getCPtr(RenderExtension obj)
021   {
022     return (obj == null) ? 0 : obj.swigCPtr;
023   }
024
025   protected static long getCPtrAndDisown (RenderExtension obj)
026   {
027     long ptr = 0;
028
029     if (obj != null)
030     {
031       ptr             = obj.swigCPtr;
032       obj.swigCMemOwn = false;
033     }
034
035     return ptr;
036   }
037
038  protected void finalize() {
039    delete();
040  }
041
042  public synchronized void delete() {
043    if (swigCPtr != 0) {
044      if (swigCMemOwn) {
045        swigCMemOwn = false;
046        libsbmlJNI.delete_RenderExtension(swigCPtr);
047      }
048      swigCPtr = 0;
049    }
050    super.delete();
051  }
052
053    public SBasePlugin DowncastSBasePlugin(long cPtr, boolean owner)
054    {
055        if (cPtr == 0) return null;
056        
057        SBasePlugin sbp = new SBasePlugin(cPtr, false);
058        SBase sb = sbp.getParentSBMLObject();
059        
060        switch( sb.getTypeCode() )
061        {
062            case (int) libsbml.SBML_LIST_OF:
063                 String name = sb.getElementName();
064                 if(name =="listOfLayouts")
065                 {
066                    return new RenderListOfLayoutsPlugin(cPtr, owner);
067                 }
068                return new SBasePlugin(cPtr,owner);
069            case (int) libsbml.SBML_LAYOUT_LAYOUT:
070                return new RenderLayoutPlugin(cPtr, owner);
071            case (int) libsbml.SBML_LAYOUT_GRAPHICALOBJECT:
072                return new RenderGraphicalObjectPlugin(cPtr, owner);
073            default:
074                return new SBasePlugin(cPtr,owner);
075        }
076    }
077    
078    public SBase DowncastSBase(long cPtr, boolean owner)
079    {
080        if (cPtr == 0) return null;
081        
082        SBase sb = new SBase(cPtr, false);
083        switch( sb.getTypeCode() )
084        {
085            case (int) libsbml.SBML_LIST_OF:
086                 String name = sb.getElementName();
087                 int itemType = ((ListOf)sb).getItemTypeCode();
088                 if(name =="listOfColorDefinitions")
089                 {
090                    return new ListOfColorDefinitions(cPtr, owner);
091                 }
092                 else if(name =="listOfGlobalRenderInformation")
093                 {
094                    return new ListOfGlobalRenderInformation(cPtr, owner);
095                 }
096                 else if(name =="listOfStyles")
097                 {
098                    if (itemType == libsbml.SBML_RENDER_LOCALSTYLE)
099                      return new ListOfLocalStyles(cPtr, owner);
100                    else 
101                      return new ListOfGlobalStyles(cPtr, owner);
102                 }
103                 else if(name =="listOfGradientDefinitions")
104                 {
105                    return new ListOfGradientDefinitions(cPtr, owner);
106                 }
107                 else if(name =="listOfLineEndings")
108                 {
109                    return new ListOfLineEndings(cPtr, owner);
110                 }
111                 else if(name =="listOfElements")
112                 {
113                    return new ListOfCurveElements(cPtr, owner);
114                 }
115                 else if(name =="listOfRenderInformation")
116                 {
117                    return new ListOfLocalRenderInformation(cPtr, owner);
118                 }
119                 else if(name =="listOfDrawables")
120                 {
121                    return new ListOfDrawables(cPtr, owner);
122                 }
123                 else if(name =="listOfGradientStops")
124                 {
125                    return new ListOfGradientStops(cPtr, owner);
126                 }
127                 return new ListOf(cPtr, owner);
128                
129            case (int) libsbml.SBML_RENDER_COLORDEFINITION:
130                return new ColorDefinition(cPtr, owner);
131                
132            case (int) libsbml.SBML_RENDER_ELLIPSE:
133                return new Ellipse(cPtr, owner);
134
135            case (int) libsbml.SBML_RENDER_GLOBALRENDERINFORMATION:
136                return new GlobalRenderInformation(cPtr, owner);
137                
138            case (int) libsbml.SBML_RENDER_GLOBALSTYLE:
139                return new GlobalStyle(cPtr, owner);
140            
141            case (int) libsbml.SBML_RENDER_GROUP:
142                return new RenderGroup(cPtr, owner);
143            
144            case (int) libsbml.SBML_RENDER_IMAGE:
145                return new Image(cPtr, owner);
146            
147            case (int) libsbml.SBML_RENDER_LINEENDING:
148                return new LineEnding(cPtr, owner);
149            
150            case (int) libsbml.SBML_RENDER_LINEARGRADIENT:
151                return new LinearGradient(cPtr, owner);
152            
153            case (int) libsbml.SBML_RENDER_LOCALRENDERINFORMATION:
154                return new LocalRenderInformation(cPtr, owner);
155            
156            case (int) libsbml.SBML_RENDER_LOCALSTYLE:
157                return new LocalStyle(cPtr, owner);
158            
159            case (int) libsbml.SBML_RENDER_POLYGON:
160                return new Polygon(cPtr, owner);
161            
162            case (int) libsbml.SBML_RENDER_RADIALGRADIENT:
163                return new RadialGradient(cPtr, owner);
164            
165            case (int) libsbml.SBML_RENDER_RECTANGLE:
166                return new Rectangle(cPtr, owner);
167            
168            case (int) libsbml.SBML_RENDER_CUBICBEZIER:
169                return new RenderCubicBezier(cPtr, owner);
170            
171            case (int) libsbml.SBML_RENDER_CURVE:
172                return new RenderCurve(cPtr, owner);
173            
174            case (int) libsbml.SBML_RENDER_POINT:
175                return new RenderPoint(cPtr, owner);
176            
177            case (int) libsbml.SBML_RENDER_TEXT:
178                return new Text(cPtr, owner);
179            
180            default:
181                return new SBase(cPtr, owner);
182        }
183    }
184    
185    
186  
187/**
188   * Returns the package name of this extension.
189   */ public
190 static String getPackageName() {
191    return libsbmlJNI.RenderExtension_getPackageName();
192  }
193
194  
195/**
196   * Returns the default SBML Level this extension.
197   */ public
198 static long getDefaultLevel() {
199    return libsbmlJNI.RenderExtension_getDefaultLevel();
200  }
201
202  
203/**
204   * Returns the default SBML Version this extension.
205   */ public
206 static long getDefaultVersion() {
207    return libsbmlJNI.RenderExtension_getDefaultVersion();
208  }
209
210  
211/**
212   * Returns the default SBML version this extension.
213   */ public
214 static long getDefaultPackageVersion() {
215    return libsbmlJNI.RenderExtension_getDefaultPackageVersion();
216  }
217
218  
219/**
220   * Returns URI of supported versions of this package.
221   */ public
222 static String getXmlnsL3V1V1() {
223    return libsbmlJNI.RenderExtension_getXmlnsL3V1V1();
224  }
225
226  
227/** */ public
228 static String getXmlnsL2() {
229    return libsbmlJNI.RenderExtension_getXmlnsL2();
230  }
231
232  
233/**
234   * Constructor
235   */ public
236 RenderExtension() {
237    this(libsbmlJNI.new_RenderExtension__SWIG_0(), true);
238  }
239
240  
241/**
242   * Copy constructor.
243   */ public
244 RenderExtension(RenderExtension arg0) {
245    this(libsbmlJNI.new_RenderExtension__SWIG_1(RenderExtension.getCPtr(arg0), arg0), true);
246  }
247
248  
249/**
250   * Creates and returns a deep copy of this RenderExtension object.
251   <p>
252   * @return a (deep) copy of this RenderExtension object
253   */ public
254 RenderExtension cloneObject() {
255    long cPtr = libsbmlJNI.RenderExtension_cloneObject(swigCPtr, this);
256    return (cPtr == 0) ? null : new RenderExtension(cPtr, true);
257  }
258
259  
260/**
261   * Returns the name of this package ('fbc')
262   <p>
263   * @pram the name of this package ('fbc')
264   */ public
265 String getName() {
266    return libsbmlJNI.RenderExtension_getName(swigCPtr, this);
267  }
268
269  
270/**
271   * Returns the URI (namespace) of the package corresponding to the combination of 
272   * the given sbml level, sbml version, and package version.
273   * Empty string will be returned if no corresponding URI exists.
274   <p>
275   * @param sbmlLevel the level of SBML
276   * @param sbmlVersion the version of SBML
277   * @param pkgVersion the version of package
278   <p>
279   * @return a string of the package URI
280   */ public
281 String getURI(long sbmlLevel, long sbmlVersion, long pkgVersion) {
282    return libsbmlJNI.RenderExtension_getURI(swigCPtr, this, sbmlLevel, sbmlVersion, pkgVersion);
283  }
284
285  
286/**
287   * Returns the SBML level with the given URI of this package.
288   <p>
289   * @param uri the string of URI that represents one of versions of layout package
290   <p>
291   * @return the SBML level with the given URI of this package. 0 will be returned
292   * if the given URI is invalid.
293   */ public
294 long getLevel(String uri) {
295    return libsbmlJNI.RenderExtension_getLevel(swigCPtr, this, uri);
296  }
297
298  
299/**
300   * Returns the SBML version with the given URI of this package.
301   <p>
302   * @param uri the string of URI that represents one of versions of layout package
303   <p>
304   * @return the SBML version with the given URI of this package. 0 will be returned
305   * if the given URI is invalid.
306   */ public
307 long getVersion(String uri) {
308    return libsbmlJNI.RenderExtension_getVersion(swigCPtr, this, uri);
309  }
310
311  
312/**
313   * Returns the package version with the given URI of this package.
314   <p>
315   * @param uri the string of URI that represents one of versions of layout package
316   <p>
317   * @return the package version with the given URI of this package. 0 will be returned
318   * if the given URI is invalid.
319   */ public
320 long getPackageVersion(String uri) {
321    return libsbmlJNI.RenderExtension_getPackageVersion(swigCPtr, this, uri);
322  }
323
324  
325/**
326   * Returns an {@link SBMLExtensionNamespaces}<GroupsExtension> object whose alias type is 
327   * LayoutPkgNamespace.
328   * Null will be returned if the given uri is not defined in the layout package.
329   <p>
330   * @param uri the string of URI that represents one of versions of layout package
331   <p>
332   * @return an LayoutPkgNamespace object corresponding to the given uri. null will
333   * be returned if the given URI is not defined in layout package.
334   */ public
335 SBMLNamespaces getSBMLExtensionNamespaces(String uri) {
336  return libsbml.DowncastSBMLNamespaces(libsbmlJNI.RenderExtension_getSBMLExtensionNamespaces(swigCPtr, this, uri), false);
337}
338
339  
340/**
341   * This method takes a type code of groups package and returns a string representing 
342   * the code.
343   */ public
344 String getStringFromTypeCode(int typeCode) {
345    return libsbmlJNI.RenderExtension_getStringFromTypeCode(swigCPtr, this, typeCode);
346  }
347
348  
349/** * @internal */ public
350 static void init() {
351    libsbmlJNI.RenderExtension_init();
352  }
353
354  
355/**
356   * Removes the L2 Namespace from a document. 
357   <p>
358   * This method should be overridden by all extensions that want to serialize
359   * to an L2 annotation.
360   */ public
361 void removeL2Namespaces(XMLNamespaces xmlns) {
362    libsbmlJNI.RenderExtension_removeL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns);
363  }
364
365  
366/**
367   * adds all L2 Extension namespaces to the namespace list. 
368   <p>
369   * This method should be overridden by all extensions that want to serialize
370   * to an L2 annotation.
371   */ public
372 void addL2Namespaces(XMLNamespaces xmlns) {
373    libsbmlJNI.RenderExtension_addL2Namespaces(swigCPtr, this, XMLNamespaces.getCPtr(xmlns), xmlns);
374  }
375
376  
377/**
378   * Adds the L2 Namespace to the document and enables the extension.
379   <p>
380   * If the extension supports serialization to SBML L2 Annotations, this 
381   * method should be overrridden, so it will be activated.
382   */ public
383 void enableL2NamespaceForDocument(SBMLDocument doc) {
384    libsbmlJNI.RenderExtension_enableL2NamespaceForDocument(swigCPtr, this, SBMLDocument.getCPtr(doc), doc);
385  }
386
387  
388/** 
389   * Determines whether this extension is being used by the given {@link SBMLDocument}
390   <p>
391   * The implementation returns true if the list of layouts contains a global render information,
392   * or a layout object contains a local render information object. 
393   <p>
394   * @param doc the sbml document to test. 
395   <p>
396   * @return a boolean indicating whether the extension is actually being used
397   *         byy the document. 
398   */ public
399 boolean isInUse(SBMLDocument doc) {
400    return libsbmlJNI.RenderExtension_isInUse(swigCPtr, this, SBMLDocument.getCPtr(doc), doc);
401  }
402
403}