Commit 31e7d702 authored by Mark Hymers's avatar Mark Hymers

import 2.9.3 upstream source

parents
====================
All files except those mentioned in this file have their own copyright
notices.
All *.ui files, ifrit.rc file, images/ifrit.ico file, and images/*.png
files are under GNU General Public License appearing in the file
LICENSE.GPL included in the packaging of this software.
====================
This diff is collapsed.
THE Q PUBLIC LICENSE
version 1.0
Copyright (C) 1999-2000 Trolltech AS, Norway.
Everyone is permitted to copy and
distribute this license document.
The intent of this license is to establish freedom to share and change the
software regulated by this license under the open source model.
This license applies to any software containing a notice placed by the
copyright holder saying that it may be distributed under the terms of
the Q Public License version 1.0. Such software is herein referred to as
the Software. This license covers modification and distribution of the
Software, use of third-party application programs based on the Software,
and development of free software which uses the Software.
Granted Rights
1. You are granted the non-exclusive rights set forth in this license
provided you agree to and comply with any and all conditions in this
license. Whole or partial distribution of the Software, or software
items that link with the Software, in any form signifies acceptance of
this license.
2. You may copy and distribute the Software in unmodified form provided
that the entire package, including - but not restricted to - copyright,
trademark notices and disclaimers, as released by the initial developer
of the Software, is distributed.
3. You may make modifications to the Software and distribute your
modifications, in a form that is separate from the Software, such as
patches. The following restrictions apply to modifications:
a. Modifications must not alter or remove any copyright notices in
the Software.
b. When modifications to the Software are released under this
license, a non-exclusive royalty-free right is granted to the
initial developer of the Software to distribute your modification
in future versions of the Software provided such versions remain
available under these terms in addition to any other license(s) of
the initial developer.
4. You may distribute machine-executable forms of the Software or
machine-executable forms of modified versions of the Software, provided
that you meet these restrictions:
a. You must include this license document in the distribution.
b. You must ensure that all recipients of the machine-executable forms
are also able to receive the complete machine-readable source code
to the distributed Software, including all modifications, without
any charge beyond the costs of data transfer, and place prominent
notices in the distribution explaining this.
c. You must ensure that all modifications included in the
machine-executable forms are available under the terms of this
license.
5. You may use the original or modified versions of the Software to
compile, link and run application programs legally developed by you
or by others.
6. You may develop application programs, reusable components and other
software items that link with the original or modified versions of the
Software. These items, when distributed, are subject to the following
requirements:
a. You must ensure that all recipients of machine-executable forms of
these items are also able to receive and use the complete
machine-readable source code to the items without any charge
beyond the costs of data transfer.
b. You must explicitly license all recipients of your items to use
and re-distribute original and modified versions of the items in
both machine-executable and source code forms. The recipients must
be able to do so without any charges whatsoever, and they must be
able to re-distribute to anyone they choose.
c. If the items are not available to the general public, and the
initial developer of the Software requests a copy of the items,
then you must supply one.
Limitations of Liability
In no event shall the initial developers or copyright holders be liable
for any damages whatsoever, including - but not restricted to - lost
revenue or profits or other direct, indirect, special, incidental or
consequential damages, even if they have been advised of the possibility
of such damages, except to the extent invariable law, if any, provides
otherwise.
No Warranty
The Software and this license document are provided AS IS with NO WARRANTY
OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.
Choice of Law
This license is governed by the Laws of Norway. Disputes shall be settled
by Oslo City Court.
/*=========================================================================
Program: Ionization FRont Interactive Tool (IFRIT)
Language: C++
Copyright (c) 2002-2003 Nick Gnedin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither name of Nick Gnedin nor the names of any contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
* Modified source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include <qglobal.h>
#ifdef _WIN32
#include <vtkProp.h>
#include <vtkPropCollection.h>
#include <vtkViewport.h>
#include <vtkCubeAxesActor2D.h>
#include <vtkAbstractPropPicker.h>
void vtkViewport::RemovePropW(vtkProp *p)
{
if (p)
{
p->ReleaseGraphicsResources(this->VTKWindow);
this->Props->RemoveItem(p);
}
}
void vtkCubeAxesActor2D::SetPropW(vtkProp *p)
{
//vtkCxxSetObjectMacro(vtkCubeAxesActor2D,Prop, vtkProp);
vtkSetObjectBodyMacro(Prop,vtkProp,p);
}
vtkProp* vtkAbstractPropPicker::GetPropW()
{
return this->GetProp();
}
#else
#if defined(VTKDLL) && VTK_MAJOR_VERSION==4 && VTK_MINOR_VERSION==2 && VTK_BUILD_VERSION<4
#include <vtkVolumeMapper.h>
#include <vtkImageData.h>
void vtkVolumeMapper::SetInput( vtkImageData *input )
{
this->vtkProcessObject::SetNthInput(0, input );
}
#endif
#endif
#if (QT_VERSION == 0x030200)
#include <qspinbox.h>
#include <qapplication.h>
#include <qlineedit.h>
bool QSpinBox::eventFilter( QObject* o, QEvent* ev )
{
if (o != vi)
return QWidget::eventFilter(o,ev);
if ( ev->type() == QEvent::KeyPress ) {
QKeyEvent* k = (QKeyEvent*)ev;
bool retval = FALSE; // workaround for MSVC++ optimization bug
if( (k->key() == Key_Tab) || (k->key() == Key_BackTab) ){
if ( k->state() & Qt::ControlButton )
return FALSE;
if ( edited )
interpretText();
qApp->sendEvent( this, ev );
retval = TRUE;
} if ( k->key() == Key_Up ) {
stepUp();
retval = TRUE;
} else if ( k->key() == Key_Down ) {
stepDown();
retval = TRUE;
} else if ( k->key() == Key_Enter || k->key() == Key_Return ) {
interpretText();
return FALSE;
}
if ( retval )
return retval;
} else if ( ev->type() == QEvent::FocusOut || ev->type() == QEvent::Leave || ev->type() == QEvent::Hide ) {
if ( edited ) {
interpretText();
}
return FALSE;
}
return FALSE;
}
#endif
This diff is collapsed.
This diff is collapsed.
/*=========================================================================
Program: Ionization FRont Interactive Tool (IFRIT)
Language: C++
Copyright (c) 2002-2003 Nick Gnedin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither name of Nick Gnedin nor the names of any contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
* Modified source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
/*
Header file for classes that support GUI data structures. They are
created to minimize interaction berween GUI and VTK.
*/
#ifndef IANIMATOR_H
#define IANIMATOR_H
class iAnimatorScript;
class iAnimatorEventObserver;
#include "istring.h"
#include "ivtksource.h"
struct iAnimatorState
{
int mode;
int nframes;
int nBlendedFrames;
int nTransitionFrames;
float dphi;
float dtheta;
float dscale;
float droll;
double slideSpeed;
float flybySpeed;
float xsecPos;
bool ifBoundingBox;
bool ifColorBars;
bool ifTimeLabel;
int currec;
int cameraProjection;
double cameraPosition[3];
double cameraFocalPoint[3];
double cameraViewUp[3];
double cameraParallelScale;
double cameraClippingRange[2];
iString titlePageFile;
int titlePageNumBlendedFrames;
int titlePageNumFrames;
iString logoFile;
float logoOpacity;
int logoPosition;
};
class vtkPolyData;
class iCameraPath;
class vtkImageData;
#include "iobject.h"
class iAnimator : public iObject
{
public:
//virtual const char *GetClassName() {return "";}
//static int IsTypeOf(const char *type) { return 0; }
//virtual int IsA(const char *type) { return 0; }
static iAnimator *New(iVTK *m);
virtual ~iAnimator();
virtual int animate();
virtual int step(bool dumpImage = true);
virtual void reset();
virtual void resetCurrentFile();
virtual iAnimatorScript* getScript(){ return animatorScript; }
inline int getReturnCode(){ return returnCode; }
inline int getMode(){ return state.mode; }
inline int getNframes(){ return state.nframes; }
inline float getDPhi(){ return state.dphi; }
inline float getDTheta(){ return state.dtheta; }
inline float getDScale(){ return state.dscale; }
inline float getDRoll(){ return state.droll; }
inline double getSlideSpeed(){ return fabs(state.slideSpeed); }
inline float getFlybySpeed(){ return state.flybySpeed; }
inline int getNumBlendedFrames(){ return state.nBlendedFrames; }
inline int getNumTransitionFrames(){ return state.nTransitionFrames; }
inline vtkImageData *getTitlePageImage(){ return titlePageImage; }
inline iString getTitlePageFile(){ return state.titlePageFile; }
inline int getNumTitlePageFrames(){ return state.titlePageNumFrames; }
inline int getNumTitlePageBlendedFrames(){ return state.titlePageNumBlendedFrames; }
inline vtkImageData *getLogoImage(){ return logoImage; }
inline iString getLogoFile(){ return state.logoFile; }
inline int getLogoPosition(){ return state.logoPosition; }
inline float getLogoOpacity(){ return state.logoOpacity; }
virtual void getInfo(bool &nr, int &cr, int &cf){ nr = newrec; cr = currec; cf = curframe; }
void setMode(int ma);
inline void setNframes(int na){ state.nframes = na; }
inline void setDPhi(float va){ state.dphi = va; }
inline void setDTheta(float va){ state.dtheta = va; }
inline void setDScale(float va){ state.dscale = va; }
inline void setDRoll(float va){ state.droll = va; }
inline void setSlideSpeed(double va){ state.slideSpeed = va; }
inline void setFlybySpeed(float va){ state.flybySpeed = va; }
inline void setNumBlendedFrames(int na){ state.nBlendedFrames = na; }
inline void setNumTransitionFrames(int na){ state.nTransitionFrames = na; }
bool setTitlePageFile(iString s);
inline void setNumTitlePageFrames(int n){ state.titlePageNumFrames = n; }
inline void setNumTitlePageBlendedFrames(int n){ state.titlePageNumBlendedFrames = n; }
bool setLogoFile(iString s);
inline void setLogoPosition(int n){ state.logoPosition = n; }
inline void setLogoOpacity(float v){ state.logoOpacity = v; }
inline bool getUseScript(){ return useScript; }
virtual void setUseScript(bool s){ useScript = s; }
inline bool getRestoreCamera(){ return restoreCamera; }
virtual void setRestoreCamera(bool s){ restoreCamera = s; }
inline bool getInheritSettings(){ return inheritSettings; }
virtual void setInheritSettings(bool s){ inheritSettings = s; }
inline iString getScriptFileName(){ return scriptFileName; }
virtual void setScriptFileName(iString s){ scriptFileName = s; }
virtual void resetState();
virtual void saveState();
virtual void restoreState();
virtual void copyState(iAnimator *);
virtual void packState(iString &s);
virtual void unpackState(iString s);
virtual void setDebugMode(bool s);
//
// Camera path funstions
//
virtual int getNumberOfPathHandles();
virtual int getNumberOfPathSteps();
virtual bool isPathLoop();
virtual bool isFocalPointPathUsed();
virtual bool isFocalPointPathToPoint();
virtual void setNumberOfPathHandles(int n);
virtual void setNumberOfPathSteps(int n);
virtual void setPathLoop(bool s);
virtual void useFocalPointPath(bool s);
virtual void setFocalPointPathToPoint(bool s);
virtual void setCameraPathColor(float r, float g, float b);
virtual bool isCameraPathValid();
virtual void playCameraPathDemo();
protected:
iAnimator(iVTK *m);
virtual void positionCameraOnThePath(int step);
private:
bool started, debugMode, useScript, restoreCamera, inheritSettings;
unsigned int seed;
int returnCode;
iString scriptFileName;
iAnimatorState state;
iAnimatorState state2;
float randstep;
bool newrec;
int prevrec, currec, totframe;
int curframe;
//
// Internal variables
//
vtkFloat pos[3];
float r, dphl0, dthl0, ramp;
vtkFloat xc1[3], xc2[3], x[3];
float v[3], t, dt0, dt;
int pathStep;
bool useFocalPath;
vtkPolyData *pathData, *pathData2;
iCameraPath *cameraPath, *focalPath;
vtkImageData **blenderBase;
int numBlenderBase;
vtkImageData *titlePageImage, *logoImage;
bool doingTitlePage;
iAnimatorScript *animatorScript;
iAnimatorEventObserver *animatorEventObserver;
};
#endif // IANIMATOR_H
This diff is collapsed.
/*=========================================================================
Program: Ionization FRont Interactive Tool (IFRIT)
Language: C++
Copyright (c) 2002-2003 Nick Gnedin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither name of Nick Gnedin nor the names of any contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
* Modified source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
/**********************************************************************
*
* IFRIT animation script class - maps commands to function calls
*
***********************************************************************/
#ifndef IANIMATORSCRIPT_H
#define IANIMATORSCRIPT_H
#include "iscript.h"
class iAnimator;
class iAnimatorScript: public iScript
{
friend class iObjectFactory;
public:
static iAnimatorScript *New(iAnimator *);
virtual ~iAnimatorScript();
virtual void setDebugMode(bool s) { debugMode = s; }
inline bool getDebugMode(){ return debugMode; }
protected:
iAnimatorScript(iAnimator *m);
//
// Temporary iValues
//
static iValue *valIS, *valFS, *valFP, *valVA3;
static int counter;
//
// Statement functions
//
static bool myCheckAbort(int lineInScript, int entryPointInteration, int entryPointIterationCount, int userCode);
static void myShowLine(int lineInScript);
//
// Render functions
//
static void Render(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void RenderAll(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void MultiRender(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
//
// basic functions
//
static void Reset(iString *pErrorMessage);
static void Load(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void Style(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void FramesPerFile(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void NumBlendedFrames(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void NumTransitionFrames(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void FlybySpeed(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void RotationPhi(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void RotationTheta(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void RotationRoll(iValue* v1, iScriptType::Assignment rel, iString *pErrorMessage);
static void Scale(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void XsectionSpeed(iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);
static void VarLo(iValue* n, iValue* v, iScriptType::Assignment rel, iString *pErrorMessage);