Commit fb1d2ef0 authored by Adam Borowski's avatar Adam Borowski

Import upstream 4.1.2

parent 1adea549
......@@ -25,6 +25,7 @@ SET(Option:StereoSupport 1 CACHE BOOL "Enable OpenGL support for displaying ster
SET(Port:SearchOGL 0 CACHE BOOL "Search for OpenGL (normally should be found automatically)")
SET(Port:SearchX11 0 CACHE BOOL "Search for X11 (normally should be found automatically)")
SET(Port:NoLongLong 0 CACHE BOOL "Do not use long long type")
SET(Port:Debian 0 CACHE BOOL "Do not use long long type")
MARK_AS_ADVANCED(Port:SearchOGL Port:SearchX11 Port:NoLongLong)
IF(NOT CMAKE_BUILD_TYPE)
......@@ -321,6 +322,9 @@ ENDIF(NOT Option:StereoSupport)
IF(Port:NoLongLong)
ADD_DEFINITIONS(-DI_NO_LONG_LONG)
ENDIF(Port:NoLongLong)
IF(Port:Debian)
ADD_DEFINITIONS(-DI_PORT_DEBIAN)
ENDIF(Port:Debian)
#
# Add libraries
......@@ -328,13 +332,13 @@ ENDIF(Port:NoLongLong)
FUNCTION(link target)
TARGET_LINK_LIBRARIES(${target} ${VTK_LIBRARIES})
IF(AddOGL)
IF(Port:SearchOGL)
TARGET_LINK_LIBRARIES(${target} ${OPENGL_LIBRARIES})
ENDIF(AddOGL)
ENDIF(Port:SearchOGL)
IF(UNIX AND AddX11)
IF(UNIX AND Port:SearchX11)
TARGET_LINK_LIBRARIES(${target} ${X11_LIBRARIES})
ENDIF(UNIX AND AddX11)
ENDIF(UNIX AND Port:SearchX11)
IF(Shell:QT)
IF(QT_LIBRARIES)
......
/*=========================================================================
Program: Ionization FRont Interactive Tool (IFRIT)
Language: C++
Copyright (c) 2002-2012 Nick Gnedin
All rights reserved.
This file may be distributed and/or modified under the terms of the
GNU General Public License version 2 as published by the Free Software
Foundation and appearing in the file LICENSE.GPL included in the
packaging of this file.
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.
=========================================================================*/
//
// Specify defines that control which OpenGL libraries we use
//
#ifndef IOPENGL_H
#define IOPENGL_H
#include <vtkToolkits.h>
// Apple OSX stuff
#if defined(VTK_USE_CARBON) || defined(VTK_USE_COCOA) || defined(VTK_USE_OGLR)
#define IOPENGL_X11
#else
#define IOPENGL_WIN
#endif
#ifndef IVTK_H
#include "ivtk.h"
#endif
#ifndef VTK_IMPLEMENT_MESA_CXX
# include "vtkOpenGL.h"
#endif
#endif // IOPENGL_H
File mode changed from 100755 to 100644
......@@ -33,8 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// IFrIT version
//
#define IVERSION "4.1.1"
#define IREVISION "576"
#define IVERSION "4.1.2"
#define IREVISION "581"
//
// History
......@@ -164,7 +164,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// 130710 Base-3.4.2 ART-2.4.1 MV-1.2.1 VTK-1.1.0 GADGET-1.1.0
// some bug fixes
//
// 576***********************************************************************
// 581***********************************************************************
// Drop sub-versioning for extensions
//
// 140309 4.0.0B1
......@@ -188,6 +188,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// 150301 4.1.1
// Off-screen shell
//
// 15.... 4.1.2
// Bug fixes, Debian portability switch, fixed the bug with render observer not displaying, new ART mode
//
//
// ToDo (major additions)
......
......@@ -85,7 +85,7 @@ iActorViewInstance::iActorViewInstance(iActorViewSubject *owner, int num_actors,
a->GetProperty()->SetOpacity(mOpacity);
a->GetProperty()->SetInterpolationToGouraud();
a->GetProperty()->SetColor(owner->GetDefaultColor().ToVTK());
a->AddMapperObserver(vtkCommand::ProgressEvent,this->GetViewModule()->GetAbortRenderEventObserver());
a->AddMapperObserver(vtkCommand::ProgressEvent,this->GetViewModule()->GetRenderEventObserver());
this->GetViewModule()->AddObject(a);
this->Owner()->GetMaterial()->AddProperty(a->GetProperty());
mActors.Add(a);
......
......@@ -228,7 +228,7 @@ void iAnimator::Start()
//
// Disactivate Progress Dialog
//
iAbortRenderEventObserver::BlockAbortRenderEventObservers(true);
iRenderEventObserver::BlockRenderEventObservers(true);
this->GetViewModule()->StartAnimation();
mStarted = true;
......@@ -259,7 +259,7 @@ void iAnimator::Stop()
//
// Activate Progress Dialog
//
iAbortRenderEventObserver::BlockAbortRenderEventObservers(false);
iRenderEventObserver::BlockRenderEventObservers(false);
//
// Reset to initial state
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -56,14 +56,14 @@ iContourFilter::iContourFilter(iDataConsumer *consumer) : iGenericFilter<vtkData
w0->ComputeNormalsOn();
w0->ComputeScalarsOff();
w0->ComputeGradientsOff();
w0->AddObserver(vtkCommand::ProgressEvent,consumer->GetViewModule()->GetAbortExecuteEventObserver());
w0->AddObserver(vtkCommand::ProgressEvent,consumer->GetViewModule()->GetRenderEventObserver());
vtkMarchingContourFilter *w1 = vtkMarchingContourFilter::New(); IERROR_CHECK_MEMORY(w1);
w1->UseScalarTreeOn();
w1->ComputeNormalsOn();
w1->ComputeScalarsOff();
w1->ComputeGradientsOff();
w1->AddObserver(vtkCommand::ProgressEvent,consumer->GetViewModule()->GetAbortExecuteEventObserver());
w1->AddObserver(vtkCommand::ProgressEvent,consumer->GetViewModule()->GetRenderEventObserver());
mWorkers[0] = w0;
mWorkers[1] = w1;
......
......@@ -49,7 +49,11 @@ iDataHandler::iDataHandler(iDataConsumer *consumer) : iViewModuleComponent((cons
iDataHandler::~iDataHandler()
{
mConsumer->UnRegisterDataHandler(this);
//
// On exit, garbare collector may delete consumer first;
// then mConsumer would set to 0 by iDataConsumer destructor.
//
if(mConsumer != 0) mConsumer->UnRegisterDataHandler(this);
}
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -89,6 +89,7 @@ protected:
//
vtkDataObject* GetFilterOutputIfPresent(vtkAlgorithm *alg, int port);
void Reset();
void ExecuteParent();
virtual void ProvideInfo(); // called by RequestInformation
......
......@@ -73,7 +73,7 @@ iGenericFilter<Filter,InputType,OutputType>::iGenericFilter(iDataConsumer *consu
IBUG_FATAL("Incorrectly configured iGenericFilter<>");
}
this->AddObserver(vtkCommand::ProgressEvent,this->GetViewModule()->GetAbortExecuteEventObserver());
this->AddObserver(vtkCommand::ProgressEvent,this->GetViewModule()->GetRenderEventObserver());
this->SetNumberOfInputPorts(numInputs);
this->wCache.Reset();
......@@ -91,41 +91,41 @@ iGenericFilter<Filter,InputType,OutputType>::~iGenericFilter()
template<class Filter, class InputType, class OutputType>
int iGenericFilter<Filter,InputType,OutputType>::FillInputPortInformation(int port, vtkInformation* info)
{
if(port == 0)
{
int iGenericFilter<Filter,InputType,OutputType>::FillInputPortInformation(int port, vtkInformation* info)
{
if(port == 0)
{
#ifndef I_NO_CHECK
if(this->Filter::FillInputPortInformation(port,info) != 0)
{
if(InputType::IsTypeOf(info->Get(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE())) == 0)
{
IBUG_FATAL(iString("Invalid input type: ") + info->Get(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE()));
}
}
#endif
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),ivtkType::Name<InputType>());
return 1;
}
else return this->Filter::FillInputPortInformation(port,info);
}
if(this->Filter::FillInputPortInformation(port,info) != 0)
{
if(InputType::IsTypeOf(info->Get(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE())) == 0)
{
IBUG_FATAL(iString("Invalid input type: ") + info->Get(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE()));
}
}
#endif
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),ivtkType::Name<InputType>());
return 1;
}
else return this->Filter::FillInputPortInformation(port,info);
}
template<class Filter,class InputType,class OutputType>
int iGenericFilter<Filter,InputType,OutputType>::FillOutputPortInformation(int port,vtkInformation* info)
{
int iGenericFilter<Filter,InputType,OutputType>::FillOutputPortInformation(int port,vtkInformation* info)
{
#ifndef I_NO_CHECK
if(this->Filter::FillOutputPortInformation(port,info) != 0)
{
if(OutputType::IsTypeOf(info->Get(vtkDataObject::DATA_TYPE_NAME())) == 0)
{
IBUG_FATAL(iString("Invalid output type: ") + info->Get(vtkDataObject::DATA_TYPE_NAME()));
}
}
#endif
info->Set(vtkDataObject::DATA_TYPE_NAME(),ivtkType::Name<OutputType>());
return 1;
}
if(this->Filter::FillOutputPortInformation(port,info) != 0)
{
if(OutputType::IsTypeOf(info->Get(vtkDataObject::DATA_TYPE_NAME())) == 0)
{
IBUG_FATAL(iString("Invalid output type: ") + info->Get(vtkDataObject::DATA_TYPE_NAME()));
}
}
#endif
info->Set(vtkDataObject::DATA_TYPE_NAME(),ivtkType::Name<OutputType>());
return 1;
}
template<class Filter, class InputType, class OutputType>
......@@ -150,6 +150,17 @@ OutputType* iGenericFilter<Filter,InputType,OutputType>::OutputData(int n)
}
template<class Filter, class InputType, class OutputType>
void iGenericFilter<Filter,InputType,OutputType>::Reset()
{
int i;
for(i=0; i<this->GetNumberOfOutputPorts(); i++)
{
this->OutputData(i)->Initialize();
}
}
template<class Filter, class InputType, class OutputType>
int iGenericFilter<Filter,InputType,OutputType>::RequestInformation(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
{
......@@ -184,15 +195,13 @@ int iGenericFilter<Filter,InputType,OutputType>::RequestInformation(vtkInformati
this->ProvideInfo();
if(this->GetAbortExecute() == 0)
{
return 1;
}
else
if(this->GetAbortExecute() != 0)
{
this->wCache.Reset();
return 0;
this->Reset();
}
return 1;
}
......@@ -239,15 +248,13 @@ int iGenericFilter<Filter,InputType,OutputType>::RequestUpdateExtent(vtkInformat
this->ProvideExtent();
if(this->GetAbortExecute() == 0)
{
return 1;
}
else
if(this->GetAbortExecute() != 0)
{
this->wCache.Reset();
return 0;
this->Reset();
}
return 1;
}
......@@ -272,11 +279,10 @@ int iGenericFilter<Filter,InputType,OutputType>::RequestData(vtkInformation* req
this->wCache.LastRequest = request;
int i;
if(this->GetNumberOfInputPorts()>0 && this->InputData()==0)
{
for(i=0; i<this->GetNumberOfOutputPorts(); i++) this->OutputData(i)->Initialize();
this->wCache.Reset();
this->Reset();
return 1;
}
......@@ -291,10 +297,16 @@ int iGenericFilter<Filter,InputType,OutputType>::RequestData(vtkInformation* req
this->wCache.Reset();
if(this->GetAbortExecute() == 0)
if(this->GetAbortExecute() != 0)
{
this->wCache.Reset();
this->Reset();
}
else
{
if(this->IsOptimizedForMemory())
{
int i;
vtkDataSet *ds;
for(i = 0; i < this->GetNumberOfOutputPorts(); i++)
{
......@@ -303,9 +315,9 @@ int iGenericFilter<Filter,InputType,OutputType>::RequestData(vtkInformation* req
}
}
this->VerifyOutput();
return 1;
}
else return 0;
return 1;
}
......@@ -360,7 +372,7 @@ vtkDataObject* iGenericFilter<Filter,InputType,OutputType>::GetFilterOutputIfPre
//
// It is important to check that the output data actually exists
//
vtkInformation* info = alg->GetExecutive()->GetOutputInformation(port);
vtkInformation* info = alg->GetExecutive()->GetOutputInformation(port);
if(info!=0 && info->Has(vtkDataObject::DATA_OBJECT()))
{
return alg->GetOutputDataObject(port);
......@@ -511,8 +523,8 @@ void iGenericImageDataFilter<Filter>::ProvideInfo()
if(input != 0)
{
vtkInformation* outInfo = this->wCache.OutputVector->GetInformationObject(0);
outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),input->GetExtent(),6);
}
vtkInformation* outInfo = this->wCache.OutputVector->GetInformationObject(0);
outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),input->GetExtent(),6);
}
}
File mode changed from 100755 to 100644
File mode changed from 100644 to 100755
File mode changed from 100755 to 100644
......@@ -348,6 +348,20 @@ void iPaletteCollection::CreateDefaultPalettes()
tmp->Update();
}
if(this->CreateMember())
{
tmp = this->GetPalette(mChildren.MaxIndex());
tmp->SetName("2 color");
r = tmp->mRed;
g = tmp->mGreen;
b = tmp->mBlue;
r->MovePoint(0,0.0,1.0); g->MovePoint(0,0.0,0.0); b->MovePoint(0,0.0,0.0);
r->MovePoint(1,1.0,0.0); g->MovePoint(1,1.0,0.0); b->MovePoint(1,1.0,1.0);
r->AddPoint(0.4999,1.0); g->AddPoint(0.4999,0.0); b->AddPoint(0.4999,0.0);
r->AddPoint(0.5001,0.0); g->AddPoint(0.5001,0.0); b->AddPoint(0.5001,1.0);
tmp->Update();
}
if(this->CreateMember())
{
tmp = this->GetPalette(mChildren.MaxIndex());
......@@ -357,9 +371,9 @@ void iPaletteCollection::CreateDefaultPalettes()
b = tmp->mBlue;
r->MovePoint(0,0.0,1.0); g->MovePoint(0,0.0,0.0); b->MovePoint(0,0.0,0.0);
r->MovePoint(1,1.0,0.0); g->MovePoint(1,1.0,0.0); b->MovePoint(1,1.0,1.0);
r->AddPoint(0.3333,1.0); g->AddPoint(0.3333,0.0); b->AddPoint(0.3333,0.0);
r->AddPoint(0.3332,1.0); g->AddPoint(0.3332,0.0); b->AddPoint(0.3332,0.0);
r->AddPoint(0.3334,0.0); g->AddPoint(0.3334,1.0); b->AddPoint(0.3334,0.0);
r->AddPoint(0.6666,0.0); g->AddPoint(0.6666,1.0); b->AddPoint(0.6666,0.0);
r->AddPoint(0.6665,0.0); g->AddPoint(0.6665,1.0); b->AddPoint(0.6665,0.0);
r->AddPoint(0.6667,0.0); g->AddPoint(0.6667,0.0); b->AddPoint(0.6667,1.0);
tmp->Update();
}
......@@ -373,12 +387,38 @@ void iPaletteCollection::CreateDefaultPalettes()
b = tmp->mBlue;
r->MovePoint(0,0.0,1.0); g->MovePoint(0,0.0,0.0); b->MovePoint(0,0.0,0.0);
r->MovePoint(1,1.0,0.0); g->MovePoint(1,1.0,0.0); b->MovePoint(1,1.0,1.0);
r->AddPoint(0.249,1.0); g->AddPoint(0.249,0.0); b->AddPoint(0.249,0.0);
r->AddPoint(0.250,1.0); g->AddPoint(0.250,1.0); b->AddPoint(0.250,0.0);
r->AddPoint(0.499,1.0); g->AddPoint(0.499,1.0); b->AddPoint(0.499,0.0);
r->AddPoint(0.500,0.0); g->AddPoint(0.500,1.0); b->AddPoint(0.500,0.0);
r->AddPoint(0.749,0.0); g->AddPoint(0.749,1.0); b->AddPoint(0.749,0.0);
r->AddPoint(0.750,0.0); g->AddPoint(0.750,0.0); b->AddPoint(0.750,1.0);
r->AddPoint(0.2499,1.0); g->AddPoint(0.2499,0.0); b->AddPoint(0.2499,0.0);
r->AddPoint(0.2501,1.0); g->AddPoint(0.2501,1.0); b->AddPoint(0.2501,0.0);
r->AddPoint(0.4999,1.0); g->AddPoint(0.4999,1.0); b->AddPoint(0.4999,0.0);
r->AddPoint(0.5001,0.0); g->AddPoint(0.5001,1.0); b->AddPoint(0.5001,0.0);
r->AddPoint(0.7499,0.0); g->AddPoint(0.7499,1.0); b->AddPoint(0.7499,0.0);
r->AddPoint(0.7501,0.0); g->AddPoint(0.7501,0.0); b->AddPoint(0.7501,1.0);
tmp->Update();
}
if(this->CreateMember())
{
tmp = this->GetPalette(mChildren.MaxIndex());
tmp->SetName("8 color");
r = tmp->mRed;
g = tmp->mGreen;
b = tmp->mBlue;
r->MovePoint(0,0.0,1.0); g->MovePoint(0,0.0,0.0); b->MovePoint(0,0.0,0.0);
r->MovePoint(1,1.0,1.0); g->MovePoint(1,1.0,0.0); b->MovePoint(1,1.0,1.0);
r->AddPoint(0.1249,1.0); g->AddPoint(0.1249,0.0); b->AddPoint(0.1249,0.0);
r->AddPoint(0.1251,1.0); g->AddPoint(0.1251,0.5); b->AddPoint(0.1251,0.0);
r->AddPoint(0.2499,1.0); g->AddPoint(0.2499,0.5); b->AddPoint(0.2499,0.0);
r->AddPoint(0.2501,1.0); g->AddPoint(0.2501,1.0); b->AddPoint(0.2501,0.0);
r->AddPoint(0.3749,1.0); g->AddPoint(0.3749,1.0); b->AddPoint(0.3749,0.0);
r->AddPoint(0.3751,0.0); g->AddPoint(0.3751,1.0); b->AddPoint(0.3751,0.0);
r->AddPoint(0.4999,0.0); g->AddPoint(0.4999,1.0); b->AddPoint(0.4999,0.0);
r->AddPoint(0.5001,0.0); g->AddPoint(0.5001,1.0); b->AddPoint(0.5001,1.0);
r->AddPoint(0.6249,0.0); g->AddPoint(0.6249,1.0); b->AddPoint(0.6249,1.0);
r->AddPoint(0.6251,0.0); g->AddPoint(0.6251,0.5); b->AddPoint(0.6251,1.0);
r->AddPoint(0.7499,0.0); g->AddPoint(0.7499,0.5); b->AddPoint(0.7499,1.0);
r->AddPoint(0.7501,0.0); g->AddPoint(0.7501,0.0); b->AddPoint(0.7501,1.0);
r->AddPoint(0.8749,0.0); g->AddPoint(0.8749,0.0); b->AddPoint(0.8749,1.0);
r->AddPoint(0.8751,1.0); g->AddPoint(0.8751,0.0); b->AddPoint(0.8751,1.0);
tmp->Update();
}
}
......@@ -165,8 +165,7 @@ iParticleViewInstance::iParticleViewInstance(iParticleViewSubject *owner) : iPai
mConnector = iParticleConnector::New(this); IERROR_CHECK_MEMORY(mConnector);
mCameraEventObserver = CameraEventObserver::New(this); IERROR_CHECK_MEMORY(mCameraEventObserver);
iAbortRenderEventObserver *obsAbortRender = this->GetViewModule()->GetAbortRenderEventObserver();
mConnector->AddObserver(vtkCommand::ProgressEvent,obsAbortRender);
mConnector->AddObserver(vtkCommand::ProgressEvent,this->GetViewModule()->GetRenderEventObserver());
mActors[0]->GetProperty()->SetPointSize(mFixedSize);
mActors[0]->GetProperty()->SetLineWidth(mLineWidth);
......
......@@ -194,7 +194,7 @@ namespace iPicker_Private
int i;
for(i=0; i<NumPickMethods; i++)
{
mDevices[i]->AddObserver(vtkCommand::AbortCheckEvent,mParent->GetViewModule()->GetAbortRenderEventObserver());
mDevices[i]->AddObserver(vtkCommand::AbortCheckEvent,mParent->GetViewModule()->GetRenderEventObserver());
}
}
......@@ -238,7 +238,7 @@ iPicker::iPicker(iViewModule *vm, const iString &fname, const iString &sname) :
mSubjectName = "";
mDataTypePointer = 0;
mPickMethod = PickMethod::Object;
mPickMethod = PickMethod::Point;
//
// Handler
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -94,7 +94,7 @@ namespace iParameter
{
enum Type
{
AbortRender,
Render,
Pick
};
};
......
......@@ -160,11 +160,7 @@ void iExecutionEventObserver::Finish()
if(mInError) // error flag could have been cleared, in which case we ignore all error messages
{
int i, n = last.ErrorMessages.Contains("\n");
for(i=0; i<n; i++)
{
this->OutputText(MessageType::Error,last.ErrorMessages.Section("\n",i,i));
}
this->OutputText(MessageType::Error,last.ErrorMessages);
mInError = false;
}
}
......
......@@ -1054,3 +1054,17 @@ void iString::ReformatHTMLToText(int length)
}
}
iString iString::Whitespace(int len)
{
int i;
iString str;
char *ptr = str.GetWritePointer((len>0)?len:1);
for(i=0; i<len; i++)
{
ptr[i] = ' ';
}
return str;
}
......@@ -143,6 +143,11 @@ public:
void ReformatHTMLToText(int length = 0);
void FindTokenMatch(const iString &tokBeg, int &indBeg, const iString &tokEnd, int &indEnd, int index = 0, bool multiLevel = false) const;
//
// Misc functions
//
static iString Whitespace(int len);
private:
#ifdef I_DEBUG
......
......@@ -230,12 +230,10 @@ iViewModule::iViewModule(iViewModuleCollection *parent, const iString &fname, co
//
// Other observers
//
mObsAbortRender = iAbortRenderEventObserver::New(this); IERROR_CHECK_MEMORY(mObsAbortRender);
mRenderTool->AddObserver(vtkCommand::AbortCheckEvent,mObsAbortRender);
mRenderTool->AddObserver(vtkCommand::StartEvent,mObsAbortRender);
mRenderTool->AddObserver(vtkCommand::EndEvent,mObsAbortRender);
mObsAbortExecute = iAbortExecuteEventObserver::New(mObsAbortRender); IERROR_CHECK_MEMORY(mObsAbortExecute);
mRenderObserver = iRenderEventObserver::New(this); IERROR_CHECK_MEMORY(mRenderObserver);
mRenderTool->AddObserver(vtkCommand::AbortCheckEvent,mRenderObserver);
mRenderTool->AddObserver(vtkCommand::StartEvent,mRenderObserver);
mRenderTool->AddObserver(vtkCommand::EndEvent,mRenderObserver);
//
// Interactor styles
......@@ -424,8 +422,7 @@ iViewModule::~iViewModule()
}
mWriter->Delete();
mObsAbortExecute->Delete();
mObsAbortRender->Delete();
mRenderObserver->Delete();
//
// Extensions may use RenderTool, so we need to delete them before we delete mRenderTool
......@@ -656,9 +653,9 @@ void iViewModule::ActualRender()
mRenderTool->SetDepthPeelingStyle(0);
}
mObsAbortRender->SetInteractive(false);
mRenderObserver->SetInteractive(false);
mRenderTool->Render();
mObsAbortRender->SetInteractive(true);
mRenderObserver->SetInteractive(true);
if(mOldParentIndex!=this->ParentIndex() || mOldNumWindows!=this->GetShell()->GetNumberOfViewModules())
{
......@@ -676,7 +673,7 @@ void iViewModule::ActualRender()
void iViewModule::UpdatePerformance()
{
mObsAbortRender->PostFinished(); // manually driven
mRenderObserver->PostFinished(); // manually driven
}
......
......@@ -38,8 +38,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "istereoimagearray.h"
class iAbortExecuteEventObserver;
class iAbortRenderEventObserver;
class iActorCollection;
class iAnimator;
class iBoundingBox;
......@@ -59,6 +57,7 @@ class iMeasuringBox;
class iParallelManager;
class iParticleViewSubject;
class iPicker;
class iRenderEventObserver;
class iRenderTool;
class iRuler;
class iSurfaceViewSubject;
......@@ -168,8 +167,7 @@ public:
inline iBoundingBox* GetBoundingBox() const { return mBoundingBox; }
inline iMeasuringBox* GetMeasuringBox() const { return mMeasuringBox; }
inline iAbortRenderEventObserver* GetAbortRenderEventObserver() const { return mObsAbortRender; }
inline iAbortExecuteEventObserver* GetAbortExecuteEventObserver() const { return mObsAbortExecute; }
inline iRenderEventObserver* GetRenderEventObserver() const { return mRenderObserver; }
inline iPicker* GetPicker() const { return mPicker; }
void AddObject(vtkProp* p);
......@@ -298,10 +296,9 @@ private:
iCaptionInteractorStyle *mInteractorStyleCaption;
//
// Event observers
// Event observer
//
iAbortRenderEventObserver *mObsAbortRender;
iAbortExecuteEventObserver *mObsAbortExecute;
iRenderEventObserver *mRenderObserver;
//
// iViewSubject-related members
......
......@@ -35,39 +35,45 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "iviewmodule.h"
#include <vtkAlgorithm.h>
#include <vtkMultiThreader.h>
#include <vtkRenderWindow.h>
#include <vtkTimerLog.h>
bool iAbortRenderEventObserver::mTheseAreBlocked = false;
bool iRenderEventObserver::mTheseAreBlocked = false;
using namespace iParameter;
//
// iAbortRenderEventObserver class
// iRenderEventObserver class
//
iAbortRenderEventObserver* iAbortRenderEventObserver::New(iViewModule *vm)
iRenderEventObserver* iRenderEventObserver::New(iViewModule *vm)
{
IASSERT(vm);
return iRequiredCast<iAbortRenderEventObserver>(INFO,vm->GetShell()->CreateViewModuleEventObserver(iParameter::ViewModuleObserver::AbortRender,vm));
return iRequiredCast<iRenderEventObserver>(INFO,vm->GetShell()->CreateViewModuleEventObserver(iParameter::ViewModuleObserver::Render,vm));
}
iAbortRenderEventObserver::iAbortRenderEventObserver(iViewModule *vm) : iEventObserver(), iViewModuleComponent(vm)
iRenderEventObserver::iRenderEventObserver(iViewModule *vm) : iEventObserver(), iViewModuleComponent(vm)
{
mCancelled = mInProgress = false;
mRenderTimer = vtkTimerLog::New(); IERROR_CHECK_MEMORY(mRenderTimer);
mRenderTime = 0.0f;
mInteractive = true;
mMasterThreadId = vtkMultiThreader::GetCurrentThreadID();
}
iAbortRenderEventObserver::~iAbortRenderEventObserver()
iRenderEventObserver::~iRenderEventObserver()
{
mRenderTimer->Delete();
}
void iAbortRenderEventObserver::ExecuteBody(vtkObject *caller, unsigned long event, void *)
void iRenderEventObserver::ExecuteBody(vtkObject *caller, unsigned long event, void *)
{
if(mTheseAreBlocked) return;
......@@ -89,11 +95,30 @@ void iAbortRenderEventObserver::ExecuteBody(vtkObject *caller, unsigned long eve
{
if(mInProgress)
{
mCancelled = this->CheckAbort();
if(mMasterThreadId == vtkMultiThreader::GetCurrentThreadID())
{
//
// I am the master
//
mCancelled = this->CheckAbort();
if(mCancelled)
{
vtkRenderWindow *rw = vtkRenderWindow::SafeDownCast(caller);
if(rw !=