001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.7 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 * implementation of a 2D transformation matrix. 013 <p> 014 * The {@link Transformation2D} class represents a 2D transformation. it is derived from {@link Transformation} 015 * and inherits all the attributes of a 3D transformation. In addition is provides new methods to 016 * explicitly get and set 2D transformation properties. 017 * A 2D transformation normally consists of a 3x3 matrix, but since the last row is always 0 0 1, 018 * this is reduced to a 6 value array. 019 <p> 020 * Using one of the new 2D specific functions to set the matrix always updates the 3D matrix 021 * automatically and vice versa, so the 2D data and the 3D data inherited from {@link Transformation} should 022 * always be consistent. 023 */ 024 025public class Transformation2D extends Transformation { 026 private long swigCPtr; 027 028 protected Transformation2D(long cPtr, boolean cMemoryOwn) 029 { 030 super(libsbmlJNI.Transformation2D_SWIGUpcast(cPtr), cMemoryOwn); 031 swigCPtr = cPtr; 032 } 033 034 protected static long getCPtr(Transformation2D obj) 035 { 036 return (obj == null) ? 0 : obj.swigCPtr; 037 } 038 039 protected static long getCPtrAndDisown (Transformation2D 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_Transformation2D(swigCPtr); 061 } 062 swigCPtr = 0; 063 } 064 super.delete(); 065 } 066 067 068/** 069 * Returns a 2D identity matrix. 070 * The matrix contains 6 double values. 071 */ public 072 static SWIGTYPE_p_double getIdentityMatrix2D() { 073 long cPtr = libsbmlJNI.Transformation2D_getIdentityMatrix2D(); 074 return (cPtr == 0) ? null : new SWIGTYPE_p_double(cPtr, false); 075 } 076 077 078/** 079 * Sets the 2D matrix to the values given in the array. 080 * The 3D matrix is updated accordingly. 081 <p> 082 * @param m array with new values to be set for this {@link Transformation} object. 083 */ public 084 void setMatrix2D(SWIGTYPE_p_double m) { 085 libsbmlJNI.Transformation2D_setMatrix2D(swigCPtr, this, SWIGTYPE_p_double.getCPtr(m)); 086 } 087 088 089/** 090 * Sets the 2D matrix to the values given in the array. 091 * The 2D matrix is updated accordingly. 092 <p> 093 * @param m array with new values to be set for this {@link Transformation} object. 094 */ public 095 void setMatrix(SWIGTYPE_p_double m) { 096 libsbmlJNI.Transformation2D_setMatrix(swigCPtr, this, SWIGTYPE_p_double.getCPtr(m)); 097 } 098 099 100/** 101 * Returns the 2D matrix which is an array of double values of length 6. 102 <p> 103 * @return a pointer to the array of numbers for the 2D transformation. 104 */ public 105 SWIGTYPE_p_double getMatrix2D() { 106 long cPtr = libsbmlJNI.Transformation2D_getMatrix2D(swigCPtr, this); 107 return (cPtr == 0) ? null : new SWIGTYPE_p_double(cPtr, false); 108 } 109 110 111/** 112 * Creates an {@link XMLNode} object from this {@link Transformation2D} object. 113 <p> 114 * @return the {@link XMLNode} with the XML representation for the 115 * {@link Transformation2D} object. 116 <p> 117 * This method is purely virtual and has to be overwritten by derived classes. 118 */ public 119 XMLNode toXML() { 120 return new XMLNode(libsbmlJNI.Transformation2D_toXML(swigCPtr, this), true); 121 } 122 123}