Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGFileGrabForeground.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 //---------------------------------------------------------------------------
00040 //  Includes
00041 //---------------------------------------------------------------------------
00042 
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 
00046 #include <OSGConfig.h>
00047 #include <OSGImage.h>
00048 
00049 #include "OSGFileGrabForeground.h"
00050 
00051 OSG_USING_NAMESPACE
00052 
00067 /*----------------------- constructors & destructors ----------------------*/
00068 
00069 FileGrabForeground::FileGrabForeground(void) :
00070     Inherited()
00071 {
00072 }
00073 
00074 FileGrabForeground::FileGrabForeground(const FileGrabForeground &source) :
00075     Inherited(source)
00076 {
00077 }
00078 
00079 FileGrabForeground::~FileGrabForeground(void)
00080 {
00081 }
00082 
00083 /*----------------------------- class specific ----------------------------*/
00084 
00085 void FileGrabForeground::initMethod (void)
00086 {
00087 }
00088 
00089 void FileGrabForeground::changed(BitVector whichField, UInt32 origin)
00090 {
00091     Inherited::changed(whichField, origin);
00092 }
00093 
00094 void FileGrabForeground::dump(      UInt32    , 
00095                          const BitVector ) const
00096 {
00097     SLOG << "Dump FileGrabForeground NI" << std::endl;
00098 }
00099 
00100 
00104 void FileGrabForeground::draw(DrawActionBase *action, Viewport *port)
00105 {
00106     if(getActive() == false)
00107         return;
00108     
00109     if(getName().empty())
00110     {
00111         FWARNING(("FileGrabForeground::draw: no name ?!?\n"));
00112         return;
00113     }
00114     
00115     // do we have an image yet? If not, create one.
00116     if(getImage() == NullFC)
00117     {
00118         beginEditCP(this->getPtr(), FileGrabForeground::ImageFieldMask);
00119         {
00120             ImagePtr iPtr=Image::create();
00121             iPtr->set(Image::OSG_RGB_PF, 1);
00122             setImage(iPtr);
00123         }
00124         endEditCP  (this->getPtr(), FileGrabForeground::ImageFieldMask);
00125     }
00126     
00127     Inherited::draw(action,port);
00128     
00129     Char8 *name = new Char8 [ getName().size() + 32 ]; // this is really 
00130                                                        // arbitrary... :(
00131 
00132     sprintf(name, getName().c_str(), getFrame());
00133         
00134     ImagePtr i = getImage();
00135 
00136     i->write(name);
00137     
00138     delete [] name;
00139     
00140     if(getIncrement() != false)
00141     {
00142         beginEditCP(this->getPtr(), FileGrabForeground::FrameFieldMask);
00143         {
00144             setFrame(getFrame() + 1);
00145         }
00146         endEditCP  (this->getPtr(), FileGrabForeground::FrameFieldMask);
00147     }   
00148 }
00149 
00150 
00151 /*-------------------------------------------------------------------------*/
00152 /*                              cvs id's                                   */
00153 
00154 #ifdef __sgi
00155 #pragma set woff 1174
00156 #endif
00157 
00158 #ifdef OSG_LINUX_ICC
00159 #pragma warning( disable : 177 )
00160 #endif
00161 
00162 namespace
00163 {
00164     static char cvsid_cpp[] = "@(#)$Id: $";
00165     static char cvsid_hpp[] = OSGFILEGRABFOREGROUND_HEADER_CVSID;
00166     static char cvsid_inl[] = OSGFILEGRABFOREGROUND_INLINE_CVSID;
00167 }

Generated on Thu Aug 25 04:04:49 2005 for OpenSG by  doxygen 1.4.3