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