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 * {@link LocalRenderInformation} is the render information stored in Layouts. 013 * {@link LocalRenderInformation} can be applied to all layouts. 014 <p> 015 * {@link LocalRenderInformation} is one of the subclasses of {@link RenderInformationBase}. A local render information object 016 * contains color definitions, gradient definitions and line endings as defined in {@link RenderInformationBase}. 017 * Additionally it has a list of local styles which specifies type, role and id based render information. 018 * Local render information can specify id based render information because it does belong to a certain layout and it can reference ids of object in that layout. 019 */ 020 021public class LocalRenderInformation extends RenderInformationBase { 022 private long swigCPtr; 023 024 protected LocalRenderInformation(long cPtr, boolean cMemoryOwn) 025 { 026 super(libsbmlJNI.LocalRenderInformation_SWIGUpcast(cPtr), cMemoryOwn); 027 swigCPtr = cPtr; 028 } 029 030 protected static long getCPtr(LocalRenderInformation obj) 031 { 032 return (obj == null) ? 0 : obj.swigCPtr; 033 } 034 035 protected static long getCPtrAndDisown (LocalRenderInformation obj) 036 { 037 long ptr = 0; 038 039 if (obj != null) 040 { 041 ptr = obj.swigCPtr; 042 obj.swigCMemOwn = false; 043 } 044 045 return ptr; 046 } 047 048 protected void finalize() { 049 delete(); 050 } 051 052 public synchronized void delete() { 053 if (swigCPtr != 0) { 054 if (swigCMemOwn) { 055 swigCMemOwn = false; 056 libsbmlJNI.delete_LocalRenderInformation(swigCPtr); 057 } 058 swigCPtr = 0; 059 } 060 super.delete(); 061 } 062 063 064/** 065 * Creates a new {@link LocalRenderInformation} object with the given SBML level 066 * and SBML version. 067 <p> 068 * @param level SBML level of the new object 069 * @param level SBML version of the new object 070 */ public 071 LocalRenderInformation(long level, long version, long pkgVersion) throws org.sbml.libsbml.SBMLConstructorException { 072 this(libsbmlJNI.new_LocalRenderInformation__SWIG_0(level, version, pkgVersion), true); 073 } 074 075 076/** 077 * Creates a new {@link LocalRenderInformation} object with the given SBML level 078 * and SBML version. 079 <p> 080 * @param level SBML level of the new object 081 * @param level SBML version of the new object 082 */ public 083 LocalRenderInformation(long level, long version) throws org.sbml.libsbml.SBMLConstructorException { 084 this(libsbmlJNI.new_LocalRenderInformation__SWIG_1(level, version), true); 085 } 086 087 088/** 089 * Creates a new {@link LocalRenderInformation} object with the given SBML level 090 * and SBML version. 091 <p> 092 * @param level SBML level of the new object 093 * @param level SBML version of the new object 094 */ public 095 LocalRenderInformation(long level) throws org.sbml.libsbml.SBMLConstructorException { 096 this(libsbmlJNI.new_LocalRenderInformation__SWIG_2(level), true); 097 } 098 099 100/** 101 * Creates a new {@link LocalRenderInformation} object with the given SBML level 102 * and SBML version. 103 <p> 104 * @param level SBML level of the new object 105 * @param level SBML version of the new object 106 */ public 107 LocalRenderInformation() throws org.sbml.libsbml.SBMLConstructorException { 108 this(libsbmlJNI.new_LocalRenderInformation__SWIG_3(), true); 109 } 110 111 112/** 113 * Creates a new {@link LocalRenderInformation} object with the given {@link SBMLNamespaces}. 114 <p> 115 * @param sbmlns The SBML namespace for the object. 116 */ public 117 LocalRenderInformation(RenderPkgNamespaces renderns) throws org.sbml.libsbml.SBMLConstructorException { 118 this(libsbmlJNI.new_LocalRenderInformation__SWIG_4(RenderPkgNamespaces.getCPtr(renderns), renderns), true); 119 } 120 121 122/** 123 * Parses the xml information in the given node and sets the attributes. 124 * This method should never be called by the user. It is only used to read render 125 * information from annotations. 126 <p> 127 * @param node the {@link XMLNode} object reference that describes the {@link LocalRenderInformation} 128 * object to be instantiated. 129 */ public 130 void parseXML(XMLNode node) { 131 libsbmlJNI.LocalRenderInformation_parseXML(swigCPtr, this, XMLNode.getCPtr(node), node); 132 } 133 134 135/** 136 * Constructor which creates a {@link LocalRenderInformation} with the given <code>id</code> 137 * and all lists empty. 138 <p> 139 * @param id the new id for the {@link LocalRenderInformation}. 140 <p> 141 * This constructor is deprecated. The new libsbml API only has 142 * constructors which take the SBML level and version or one that takes 143 * an {@link SBMLNamespaces} object. 144 */ public 145 LocalRenderInformation(RenderPkgNamespaces renderns, String id) throws org.sbml.libsbml.SBMLConstructorException { 146 this(libsbmlJNI.new_LocalRenderInformation__SWIG_5(RenderPkgNamespaces.getCPtr(renderns), renderns, id), true); 147 } 148 149 150/** 151 * Returns the number of styles. 152 <p> 153 * @return the number of local styles in the global render information object 154 */ public 155 long getNumStyles() { 156 return libsbmlJNI.LocalRenderInformation_getNumStyles(swigCPtr, this); 157 } 158 159 160/** 161 * Creates and returns a deep copy of this {@link LocalRenderInformation} object. 162 <p> 163 * @return a (deep) copy of this {@link LocalRenderInformation}. 164 */ public 165 LocalRenderInformation cloneObject() { 166 long cPtr = libsbmlJNI.LocalRenderInformation_cloneObject(swigCPtr, this); 167 return (cPtr == 0) ? null : new LocalRenderInformation(cPtr, true); 168 } 169 170 171/** 172 * Returns a pointer to the {@link ListOfLocalStyles} object. 173 <p> 174 * @return pointer to the list of local styles. 175 */ public 176 ListOfLocalStyles getListOfStyles() { 177 long cPtr = libsbmlJNI.LocalRenderInformation_getListOfStyles__SWIG_0(swigCPtr, this); 178 return (cPtr == 0) ? null : new ListOfLocalStyles(cPtr, false); 179 } 180 181 182/** 183 * Returns a pointer to the style with the given index. 184 * If the index is invalid, <code>null</code> is returned. 185 <p> 186 * @param i index of the {@link LocalStyle} to be returned. 187 <p> 188 * @return pointer to the style with the given index or null 189 */ public 190 LocalStyle getStyle(long i) { 191 long cPtr = libsbmlJNI.LocalRenderInformation_getStyle__SWIG_0(swigCPtr, this, i); 192 return (cPtr == 0) ? null : new LocalStyle(cPtr, false); 193 } 194 195 196/** 197 * Returns a pointer to the style with the given <code>id</code>. 198 * If the id is invalid, <code>null</code> is returned. 199 <p> 200 * @param id id of the {@link LocalStyle} to be returned. 201 <p> 202 * @return pointer to the style with the given <code>id</code> or <code>null</code> 203 */ public 204 LocalStyle getStyle(String id) { 205 long cPtr = libsbmlJNI.LocalRenderInformation_getStyle__SWIG_2(swigCPtr, this, id); 206 return (cPtr == 0) ? null : new LocalStyle(cPtr, false); 207 } 208 209 210/** 211 * Creates a new {@link LocalStyle} object. The object is added to and owned 212 * by the {@link LocalRenderInformation} object. 213 <p> 214 * @param id for the new style. 215 <p> 216 * @ return a pointer to the newly created {@link LocalStyle} object. 217 */ public 218 LocalStyle createStyle(String id) { 219 long cPtr = libsbmlJNI.LocalRenderInformation_createStyle(swigCPtr, this, id); 220 return (cPtr == 0) ? null : new LocalStyle(cPtr, false); 221 } 222 223 224/** 225 * Adds a copy of a {@link LocalStyle} to the {@link GlobalRenderInformation} object. 226 * The style is only added if it is valid, i.e. it has to have an id and 227 * a valid group. 228 <p> 229 * @param pointer to the local style object to be added. 230 <p> 231 * @return integer value indicating success/failure of the 232 * function. The possible values 233 * returned by this function are: 234 * <ul> 235 * <li> LIBSBML_OPERATION_SUCCESS 236 * <li> LIBSBML_LEVEL_MISMATCH 237 * <li> LIBSBML_VERSION_MISMATCH 238 * <li> LIBSBML_OPERATION_FAILED 239 * 240 * </ul> <p> 241 * @note This method should be used with some caution. The fact that 242 * this method <em>copies</em> the object passed to it means that the caller 243 * will be left holding a physically different object instance than the 244 * one contained in this {@link LocalRenderInformation}. Changes made to the original object 245 * instance (such as resetting attribute values) will <em>not affect the 246 * instance in the {@link LocalRenderInformation}</em>. In addition, the caller should make 247 * sure to free the original object if it is no longer being used, or 248 * else a memory leak will result. Please see {@link LocalRenderInformation#createStyle()} 249 * for a method that does not lead to these issues. 250 <p> 251 * @see #createStyle() 252 */ public 253 int addStyle(LocalStyle pStyle) { 254 return libsbmlJNI.LocalRenderInformation_addStyle(swigCPtr, this, LocalStyle.getCPtr(pStyle), pStyle); 255 } 256 257 258/** 259 * Creates an {@link XMLNode} object from this {@link LocalRenderInformation} object. 260 <p> 261 * @return the {@link XMLNode} with the XML representation for the 262 * {@link LocalRenderInformation} object. 263 */ public 264 XMLNode toXML() { 265 return new XMLNode(libsbmlJNI.LocalRenderInformation_toXML(swigCPtr, this), true); 266 } 267 268 269/** 270 * Returns the XML element name of this object, which for 271 * {@link LocalRenderInformation}, is always <code>'renderInformation'.</code> 272 <p> 273 * @return the name of this element, i.e., <code>'renderInformation'.</code> 274 */ public 275 String getElementName() { 276 return libsbmlJNI.LocalRenderInformation_getElementName(swigCPtr, this); 277 } 278 279 280/** 281 * Returns the libSBML type code for this SBML object. 282 <p> 283 * LibSBML attaches an 284 * identifying code to every kind of SBML object. These are known as 285 * <em>SBML type codes</em>. In other languages, the set of type codes 286 * is stored in an enumeration; in the Java language interface for 287 * libSBML, the type codes are defined as static integer constants in 288 * interface class {@link libsbmlConstants}. The names of the type codes 289 * all begin with the characters <code>SBML_.</code> 290 <p> 291 * @return the SBML type code for this object, or <code>SBML_UNKNOWN</code> (default). 292 <p> 293 * @see #getElementName() 294 */ public 295 int getTypeCode() { 296 return libsbmlJNI.LocalRenderInformation_getTypeCode(swigCPtr, this); 297 } 298 299 public void connectToChild() { 300 libsbmlJNI.LocalRenderInformation_connectToChild(swigCPtr, this); 301 } 302 303 304/** * @internal */ public 305 void enablePackageInternal(String pkgURI, String pkgPrefix, boolean flag) { 306 libsbmlJNI.LocalRenderInformation_enablePackageInternal(swigCPtr, this, pkgURI, pkgPrefix, flag); 307 } 308 309}