From: nds Date: Tue, 18 Sep 2007 07:45:30 +0000 (+0000) Subject: File from WPdev branch X-Git-Tag: TG_Saint_Valentine-Day~58 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=43c9a8ea8363d7c8d82dad5a0b7ba71a6f72818d;p=modules%2Fgui.git File from WPdev branch --- diff --git a/src/VTKViewer/VTKViewer.cxx b/src/VTKViewer/VTKViewer.cxx new file mode 100644 index 000000000..6a548f1df --- /dev/null +++ b/src/VTKViewer/VTKViewer.cxx @@ -0,0 +1,57 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : +// Author : +// Module : +// $Header$ + +#include "VTKViewer_Actor.h" +#include "VTKViewer_CellRectPicker.h" +#include "VTKViewer_ExtractUnstructuredGrid.h" +#include "VTKViewer_ConvexTool.h" +#include "VTKViewer_Filter.h" +#include "VTKViewer_GeometryFilter.h" +#include "VTKViewer_AppendFilter.h" +#include "VTKViewer_Algorithm.h" +#include "VTKViewer_InteractorStyle.h" +#include "VTKViewer_PassThroughFilter.h" +#include "VTKViewer_RectPicker.h" +#include "VTKViewer_RenderWindow.h" +#include "VTKViewer_RenderWindowInteractor.h" +#include "VTKViewer_ShrinkFilter.h" +#include "VTKViewer_TransformFilter.h" +#include "VTKViewer_Transform.h" +#include "VTKViewer_Trihedron.h" +#include "VTKViewer_Utilities.h" +#include "VTKViewer_VectorText.h" +#include "VTKViewer_ViewManager.h" +#include "VTKViewer_ViewModel.h" +#include "VTKViewer_ViewWindow.h" +#include "VTKViewer_Functor.h" + +int +main(int argc, char** argv) +{ + return 0; +} diff --git a/src/VTKViewer/VTKViewer.h b/src/VTKViewer/VTKViewer.h new file mode 100755 index 000000000..77de94830 --- /dev/null +++ b/src/VTKViewer/VTKViewer.h @@ -0,0 +1,40 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef VTKVIEWER_H +#define VTKVIEWER_H + +#ifdef WNT +# ifdef VTKVIEWER_EXPORTS +# define VTKVIEWER_EXPORT __declspec( dllexport ) +# else +# define VTKVIEWER_EXPORT __declspec( dllimport ) +# endif +#else +# define VTKVIEWER_EXPORT +#endif + +#include + +#if !defined(vtkFloatingPointType) +# define vtkFloatingPointType vtkFloatingPointType + typedef float vtkFloatingPointType; +#endif + +#endif diff --git a/src/VTKViewer/VTKViewer_Actor.cxx b/src/VTKViewer/VTKViewer_Actor.cxx new file mode 100755 index 000000000..5f0e621e7 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Actor.cxx @@ -0,0 +1,677 @@ +// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SALOME_Actor.cxx +// Author : Nicolas REJNERI +// Module : SALOME +// $Header$ + +/*! + \class SALOME_Actor SALOME_Actor.h + \brief Abstract class of SALOME Objects in VTK. +*/ + + +#include "VTKViewer_Actor.h" + +#include "VTKViewer_Transform.h" +#include "VTKViewer_TransformFilter.h" +#include "VTKViewer_PassThroughFilter.h" +#include "VTKViewer_GeometryFilter.h" + +// VTK Includes +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +#if defined __GNUC__ + #if __GNUC__ == 2 + #define __GNUC_2__ + #endif +#endif + +int VTKViewer_POINT_SIZE = 5; +int VTKViewer_LINE_WIDTH = 3; + + +vtkStandardNewMacro(VTKViewer_Actor); + +/*! + Constructor +*/ +VTKViewer_Actor +::VTKViewer_Actor(): + myIsHighlighted(false), + myIsPreselected(false), + myRepresentation(VTK_SURFACE), + myDisplayMode(1), + myProperty(vtkProperty::New()), + PreviewProperty(NULL), + myIsInfinite(false), + myIsResolveCoincidentTopology(true), + myStoreMapping(false), + myGeomFilter(VTKViewer_GeometryFilter::New()), + myTransformFilter(VTKViewer_TransformFilter::New()) +{ + vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor, + myPolygonOffsetUnits); + + for(int i = 0; i < 6; i++) + myPassFilter.push_back(VTKViewer_PassThroughFilter::New()); +} + +/*! + Destructor +*/ +VTKViewer_Actor +::~VTKViewer_Actor() +{ + SetPreviewProperty(NULL); + + myGeomFilter->Delete(); + + myTransformFilter->Delete(); + + for(int i = 0, iEnd = myPassFilter.size(); i < iEnd; i++) + if(myPassFilter[i]) + myPassFilter[i]->Delete(); + + myProperty->Delete(); +} + +/*! + \return name +*/ +const char* +VTKViewer_Actor +::getName() +{ + return myName.c_str(); +} + +/*! + Sets name + \param theName - new name +*/ +void +VTKViewer_Actor +::setName(const char* theName) +{ + myName = theName; +} + +/*! + To publish the actor an all its internal devices +*/ +void +VTKViewer_Actor +::AddToRender(vtkRenderer* theRenderer) +{ + theRenderer->AddActor(this); +} + +/*! + To remove the actor an all its internal devices +*/ +void +VTKViewer_Actor +::RemoveFromRender(vtkRenderer* theRenderer) +{ + theRenderer->RemoveActor(this); +} + +/*! + Used to obtain all dependent actors +*/ +void +VTKViewer_Actor +::GetChildActors(vtkActorCollection*) +{} + +/*! + Apply view transformation + \param theTransform - view transformation +*/ +void +VTKViewer_Actor +::SetTransform(VTKViewer_Transform* theTransform) +{ + myTransformFilter->SetTransform(theTransform); +} + + +/*! + To insert some additional filters and then sets the given #vtkMapper +*/ +void +VTKViewer_Actor +::SetMapper(vtkMapper* theMapper) +{ + InitPipeLine(theMapper); +} + +/*! + Initialization +*/ +void +VTKViewer_Actor +::InitPipeLine(vtkMapper* theMapper) +{ + if(theMapper){ + int anId = 0; + myPassFilter[ anId ]->SetInput( theMapper->GetInput() ); + myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() ); + + anId++; // 1 + myGeomFilter->SetStoreMapping( myStoreMapping ); + myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); + + anId++; // 2 + myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); + myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); + + anId++; // 3 + myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() ); + + anId++; // 4 + myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() ); + myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); + + anId++; // 5 + if(vtkDataSetMapper* aMapper = dynamic_cast(theMapper)){ + aMapper->SetInput(myPassFilter[anId]->GetOutput()); + }else if(vtkPolyDataMapper* aMapper = dynamic_cast(theMapper)){ + aMapper->SetInput(myPassFilter[anId]->GetPolyDataOutput()); + } + } + Superclass::SetMapper(theMapper); +} + +/*! + Renders actor +*/ +void +VTKViewer_Actor +::Render(vtkRenderer *ren, vtkMapper* m) +{ + if(vtkDataSet* aDataSet = GetInput()){ + static vtkFloatingPointType PERCENTS_OF_DETAILS = 0.50; + vtkIdType aNbOfPoints = vtkIdType(aDataSet->GetNumberOfPoints()*PERCENTS_OF_DETAILS); + if(aNbOfPoints > 0) + SetNumberOfCloudPoints(aNbOfPoints); + } + + if(myIsResolveCoincidentTopology){ + int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology(); + vtkFloatingPointType aFactor, aUnit; + vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit); + + vtkMapper::SetResolveCoincidentTopologyToPolygonOffset(); + vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor, + myPolygonOffsetUnits); + Superclass::Render(ren,m); + + vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit); + vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology); + }else{ + Superclass::Render(ren,m); + } +} + +/*! + Set ResolveCoincidentTopology flag + \param theIsResolve - new flag value +*/ +void +VTKViewer_Actor +::SetResolveCoincidentTopology(bool theIsResolve) +{ + myIsResolveCoincidentTopology = theIsResolve; +} + +/*! + Set polygon offset parameters + \param factor, units - Opengl polygon offset parameters +*/ +void +VTKViewer_Actor +::SetPolygonOffsetParameters(vtkFloatingPointType factor, + vtkFloatingPointType units) +{ + myPolygonOffsetFactor = factor; + myPolygonOffsetUnits = units; +} + +/*! + Get polygon offset parameters + \param factor, units - Opengl polygon offset parameters +*/ +void +VTKViewer_Actor +::GetPolygonOffsetParameters(vtkFloatingPointType& factor, + vtkFloatingPointType& units) +{ + factor = myPolygonOffsetFactor; + units = myPolygonOffsetUnits; +} + +/*! + \return shrink factor +*/ +vtkFloatingPointType +VTKViewer_Actor +::GetShrinkFactor() +{ + return 1.0; +} + +/*! + \return true if the actor is shrunkable +*/ +bool +VTKViewer_Actor +::IsShrunkable() +{ + return false; +} + +/*! + \return true if the actor is shrunk +*/ +bool +VTKViewer_Actor +::IsShrunk() +{ + return false; +} + +/*! + Insert shrink filter into pipeline +*/ +void +VTKViewer_Actor +::SetShrink() +{} + +/*! + Remove shrink filter from pipeline +*/ +void +VTKViewer_Actor +::UnShrink() +{} + +/*! + Allows to get initial #vtkDataSet +*/ +vtkDataSet* +VTKViewer_Actor +::GetInput() +{ + return myPassFilter.front()->GetOutput(); +} + +/*! + To calculatate last modified time +*/ +unsigned long int +VTKViewer_Actor +::GetMTime() +{ + unsigned long mTime = this->Superclass::GetMTime(); + unsigned long time = myTransformFilter->GetMTime(); + mTime = ( time > mTime ? time : mTime ); + if(vtkDataSet *aDataSet = myPassFilter[0]->GetInput()){ + time = aDataSet->GetMTime(); + mTime = ( time > mTime ? time : mTime ); + } + return mTime; +} + +/*! + Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on) + param theMode - new mode +*/ +void +VTKViewer_Actor +::SetRepresentation(int theMode) +{ + switch(myRepresentation){ + case VTK_POINTS : + case VTK_SURFACE : + myProperty->SetAmbient(GetProperty()->GetAmbient()); + myProperty->SetDiffuse(GetProperty()->GetDiffuse()); + myProperty->SetSpecular(GetProperty()->GetSpecular()); + break; + } + + switch(theMode){ + case VTK_POINTS : + case VTK_SURFACE : + GetProperty()->SetAmbient(myProperty->GetAmbient()); + GetProperty()->SetDiffuse(myProperty->GetDiffuse()); + GetProperty()->SetSpecular(myProperty->GetSpecular()); + break; + default: + GetProperty()->SetAmbient(1.0); + GetProperty()->SetDiffuse(0.0); + GetProperty()->SetSpecular(0.0); + } + + switch(theMode){ + case 3 : + myGeomFilter->SetInside(true); + myGeomFilter->SetWireframeMode(true); + GetProperty()->SetRepresentation(VTK_WIREFRAME); + break; + case VTK_POINTS : + GetProperty()->SetPointSize(VTKViewer_POINT_SIZE); + GetProperty()->SetRepresentation(theMode); + myGeomFilter->SetWireframeMode(false); + myGeomFilter->SetInside(false); + break; + case VTK_WIREFRAME : + GetProperty()->SetRepresentation(theMode); + myGeomFilter->SetWireframeMode(true); + myGeomFilter->SetInside(false); + break; + case VTK_SURFACE : + GetProperty()->SetRepresentation(theMode); + myGeomFilter->SetWireframeMode(false); + myGeomFilter->SetInside(false); + break; + } + + myRepresentation = theMode; +} + +/*! + \return current representation mode +*/ +int +VTKViewer_Actor +::GetRepresentation() +{ + return myRepresentation; +} + +/*! + Maps VTK index of a node to corresponding object index +*/ +int +VTKViewer_Actor +::GetNodeObjId(int theVtkID) +{ + return theVtkID; +} + +/*! + Get coordinates of a node for given object index +*/ +vtkFloatingPointType* +VTKViewer_Actor +::GetNodeCoord(int theObjID) +{ + return GetInput()->GetPoint(theObjID); +} + +/*! + Get corresponding #vtkCell for given object index +*/ +vtkCell* +VTKViewer_Actor +::GetElemCell(int theObjID) +{ + return GetInput()->GetCell(theObjID); +} + +/*! + Maps VTK index of a cell to corresponding object index +*/ +int +VTKViewer_Actor +::GetElemObjId(int theVtkID) +{ + return theVtkID; +} + + +/*! + \return object dimension. Virtual method should be redifined by derived classes +*/ +int +VTKViewer_Actor +::GetObjDimension( const int theObjId ) +{ + if ( vtkCell* aCell = GetElemCell(theObjId) ) + return aCell->GetCellDimension(); + return 0; +} + +/*! + Infinitive means actor without size (point for example), + which is not taken into account in calculation of boundaries of the scene +*/ +void +VTKViewer_Actor +::SetInfinitive(bool theIsInfinite) +{ + myIsInfinite = theIsInfinite; +} + +/*! + \return infinive flag +*/ +bool +VTKViewer_Actor +::IsInfinitive() +{ + if(myIsInfinite) + return true; + + static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT; + vtkFloatingPointType aBounds[6]; + GetBounds(aBounds); + for(int i = 0; i < 6; i++) + if(fabs(aBounds[i]) > MAX_DISTANCE) + return true; + + static vtkFloatingPointType MIN_DISTANCE = 1.0/VTK_LARGE_FLOAT; + if(GetLength() < MIN_DISTANCE) + return true; + + return false; +} + +/*! + \return current bounding box +*/ +vtkFloatingPointType* +VTKViewer_Actor +::GetBounds() +{ + return Superclass::GetBounds(); +} + + +/*! + \return current bounding box +*/ +void +VTKViewer_Actor +::GetBounds(vtkFloatingPointType theBounds[6]) +{ + Superclass::GetBounds(theBounds); +} + + +bool +VTKViewer_Actor +::IsSetCamera() const +{ + return false; +} + +bool +VTKViewer_Actor +::IsResizable() const +{ + return false; +} + +void +VTKViewer_Actor +::SetSize( const vtkFloatingPointType ) +{} + + +void +VTKViewer_Actor +::SetCamera( vtkCamera* ) +{} + + +void +VTKViewer_Actor +::SetOpacity(vtkFloatingPointType theOpacity) +{ + myOpacity = theOpacity; + GetProperty()->SetOpacity(theOpacity); +} + +vtkFloatingPointType +VTKViewer_Actor +::GetOpacity() +{ + return myOpacity; +} + + +/*! + Change color +*/ +void +VTKViewer_Actor +::SetColor(vtkFloatingPointType r, + vtkFloatingPointType g, + vtkFloatingPointType b) +{ + GetProperty()->SetColor(r,g,b); +} + +/*! + Change color +*/ +void +VTKViewer_Actor +::SetColor(const vtkFloatingPointType theRGB[3]) +{ + SetColor(theRGB[0],theRGB[1],theRGB[2]); +} + +/*! + Get color +*/ +void +VTKViewer_Actor +::GetColor(vtkFloatingPointType& r, + vtkFloatingPointType& g, + vtkFloatingPointType& b) +{ + vtkFloatingPointType aColor[3]; + GetProperty()->GetColor(aColor); + r = aColor[0]; + g = aColor[1]; + b = aColor[2]; +} + + +/*! + \return display mode +*/ +int +VTKViewer_Actor +::getDisplayMode() +{ + return myDisplayMode; +} + +/*! + Change display mode +*/ +void +VTKViewer_Actor +::setDisplayMode(int theMode) +{ + SetRepresentation(theMode + 1); + myDisplayMode = GetRepresentation() - 1; +} + + +/*! + \return true if the descendant of the VTKViewer_Actor will implement its own highlight or not +*/ +bool +VTKViewer_Actor +::hasHighlight() +{ + return false; +} + +/*! + \return true if the VTKViewer_Actor is already highlighted +*/ +bool +VTKViewer_Actor +::isHighlighted() +{ + return myIsHighlighted; +} + +/*! + Set preselection mode +*/ +void +VTKViewer_Actor +::SetPreSelected(bool thePreselect) +{ + myIsPreselected = thePreselect; +} + +/*! + Just to update visibility of the highlight devices +*/ +void +VTKViewer_Actor +::highlight(bool theIsHighlight) +{ + myIsHighlighted = theIsHighlight; +} + +vtkCxxSetObjectMacro(VTKViewer_Actor,PreviewProperty,vtkProperty); diff --git a/src/VTKViewer/VTKViewer_Actor.h b/src/VTKViewer/VTKViewer_Actor.h new file mode 100755 index 000000000..28d5af787 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Actor.h @@ -0,0 +1,341 @@ +// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SALOME_Actor.h +// Author : Nicolas REJNERI +// Module : SALOME +// $Header$ + +#ifndef VTKVIEVER_ACTOR_H +#define VTKVIEVER_ACTOR_H + +#include "VTKViewer.h" + +#include +#include + +#include + +class vtkCell; +class vtkPointPicker; +class vtkCellPicker; +class vtkDataSet; +class vtkCamera; +class vtkProperty; +class vtkRenderer; + +class VTKViewer_Transform; +class VTKViewer_GeometryFilter; +class VTKViewer_TransformFilter; +class VTKViewer_PassThroughFilter; + +extern int VTKViewer_POINT_SIZE; +extern int VTKViewer_LINE_WIDTH; + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*! \class vtkLODActor + * \brief For more information see VTK documentation + */ +class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor +{ + public: + static VTKViewer_Actor* New(); + + vtkTypeMacro(VTKViewer_Actor,vtkLODActor); + + //---------------------------------------------------------------------------- + //! Get its name + virtual + const char* + getName(); + + //! Name the #VTKViewer_Actor + virtual + void + setName(const char* theName); + + //---------------------------------------------------------------------------- + //! Change opacity + virtual + void + SetOpacity(vtkFloatingPointType theOpacity); + + //! Get current opacity + virtual + vtkFloatingPointType + GetOpacity(); + + //! Change color + virtual + void + SetColor(vtkFloatingPointType r, + vtkFloatingPointType g, + vtkFloatingPointType b); + + //! Get current color + virtual + void + GetColor(vtkFloatingPointType& r, + vtkFloatingPointType& g, + vtkFloatingPointType& b); + + //! Change color + virtual + void + SetColor(const vtkFloatingPointType theRGB[3]); + + //---------------------------------------------------------------------------- + // For selection mapping purpose + //! Maps VTK index of a node to corresponding object index + virtual + int + GetNodeObjId(int theVtkID); + + //! Get coordinates of a node for given object index + virtual + vtkFloatingPointType* + GetNodeCoord(int theObjID); + + //! Maps VTK index of a cell to corresponding object index + virtual + int + GetElemObjId(int theVtkID); + + //! Get corresponding #vtkCell for given object index + virtual + vtkCell* + GetElemCell(int theObjID); + + //---------------------------------------------------------------------------- + //! Get dimension of corresponding mesh element + virtual + int + GetObjDimension( const int theObjId ); + + //! To insert some additional filters and then sets the given #vtkMapper + virtual + void + SetMapper(vtkMapper* theMapper); + + //! Allows to get initial #vtkDataSet + virtual + vtkDataSet* + GetInput(); + + //! Apply view transformation + virtual + void + SetTransform(VTKViewer_Transform* theTransform); + + //! To calculatate last modified time + virtual + unsigned long int + GetMTime(); + + //---------------------------------------------------------------------------- + //! Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on) + virtual + void + SetRepresentation(int theMode); + + //! Get current representation mode + virtual + int + GetRepresentation(); + + //! Get current display mode (obsolete) + virtual + int + getDisplayMode(); + + //! Set display mode (obsolete) + virtual + void + setDisplayMode(int theMode); + + //---------------------------------------------------------------------------- + //! Set infinive flag + /*! + Infinitive means actor without size (point for example), + which is not taken into account in calculation of boundaries of the scene + */ + void + SetInfinitive(bool theIsInfinite); + + //! Get infinive flag + virtual + bool + IsInfinitive(); + + //! To calcualte current bounding box + virtual + vtkFloatingPointType* + GetBounds(); + + //! To calcualte current bounding box + void + GetBounds(vtkFloatingPointType bounds[6]); + + //---------------------------------------------------------------------------- + virtual + bool + IsSetCamera() const; + + virtual + bool + IsResizable() const; + + virtual + void + SetSize( const vtkFloatingPointType ); + + virtual + void + SetCamera( vtkCamera* ); + + //---------------------------------------------------------------------------- + //! Set ResolveCoincidentTopology flag + void + SetResolveCoincidentTopology(bool theIsResolve); + + //! Set ResolveCoincidentTopology parameters + void + SetPolygonOffsetParameters(vtkFloatingPointType factor, + vtkFloatingPointType units); + + //! Get current ResolveCoincidentTopology parameters + void + GetPolygonOffsetParameters(vtkFloatingPointType& factor, + vtkFloatingPointType& units); + + virtual + void + Render(vtkRenderer *, vtkMapper *); + + //---------------------------------------------------------------------------- + //! Get current shrink factor + virtual + vtkFloatingPointType + GetShrinkFactor(); + + //! Is the actor is shrunkable + virtual + bool + IsShrunkable(); + + //! Is the actor is shrunk + virtual + bool + IsShrunk(); + + //! Insert shrink filter into pipeline + virtual + void + SetShrink(); + + //! Remove shrink filter from pipeline + virtual + void + UnShrink(); + + //---------------------------------------------------------------------------- + //! To publish the actor an all its internal devices + virtual + void + AddToRender(vtkRenderer* theRendere); + + //! To remove the actor an all its internal devices + virtual + void + RemoveFromRender(vtkRenderer* theRendere); + + //! Used to obtain all dependent actors + virtual + void + GetChildActors(vtkActorCollection*); + + //---------------------------------------------------------------------------- + //! Ask, if the descendant of the VTKViewer_Actor will implement its own highlight or not + virtual + bool + hasHighlight(); + + //! Ask, if the VTKViewer_Actor is already highlighted + virtual + bool + isHighlighted(); + + //! Set preselection mode + virtual + void + SetPreSelected(bool thePreselect = false); + + //---------------------------------------------------------------------------- + //! Just to update visibility of the highlight devices + virtual + void + highlight(bool theHighlight); + + void + SetPreviewProperty(vtkProperty* theProperty); + + protected: + //---------------------------------------------------------------------------- + bool myIsResolveCoincidentTopology; + vtkFloatingPointType myPolygonOffsetFactor; + vtkFloatingPointType myPolygonOffsetUnits; + + std::string myName; + + vtkFloatingPointType myOpacity; + int myDisplayMode; + bool myIsInfinite; + + bool myStoreMapping; + VTKViewer_GeometryFilter *myGeomFilter; + VTKViewer_TransformFilter *myTransformFilter; + std::vector myPassFilter; + + int myRepresentation; + vtkProperty *myProperty; + + void + InitPipeLine(vtkMapper* theMapper); + + VTKViewer_Actor(); + ~VTKViewer_Actor(); + + protected: + vtkProperty *PreviewProperty; + bool myIsPreselected; + bool myIsHighlighted; +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif // VTKVIEVER_ACTOR_H diff --git a/src/VTKViewer/VTKViewer_Algorithm.h b/src/VTKViewer/VTKViewer_Algorithm.h new file mode 100644 index 000000000..b533f149b --- /dev/null +++ b/src/VTKViewer/VTKViewer_Algorithm.h @@ -0,0 +1,91 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_ViewFrame.h +// Author : Nicolas REJNERI +// Module : SALOME +// $Header$ + +#ifndef VTKViewer_Algorithm_H +#define VTKViewer_Algorithm_H + +#include + +class vtkActor; + +namespace VTK +{ + /*!For each actor(for ex: someActor) from \a theCollection(that can be dynamic cast to type TActor)\n + * Call method \a theFun(someActor) + */ + template + TFunction ForEach(vtkActorCollection *theCollection, TFunction theFun) + { + if(theCollection){ + theCollection->InitTraversal(); + while(vtkActor *anAct = theCollection->GetNextActor()) + if(TActor *anActor = dynamic_cast(anAct)) + theFun(anActor); + } + return theFun; + } + + /*!For each actor(for ex: someActor) from \a theCollection(that can be dynamic cast to type TActor and \n + * method \a thePredicate(someActor) return true) \n + * Call method \a theFun(someActor) + */ + template + TFunction ForEachIf(vtkActorCollection *theCollection, + TPredicate thePredicate, + TFunction theFun) + { + if(theCollection){ + theCollection->InitTraversal(); + while(vtkActor *anAct = theCollection->GetNextActor()) + if(TActor *anActor = dynamic_cast(anAct)) + if(thePredicate(anActor)) + theFun(anActor); + } + return theFun; + } + + /*!Find actor from collection, that can be dynamicaly cast to \a TActor, \n + *and method \a thePredicate(someActor) return true) \n + *\retval someActor + */ + template + TActor* Find(vtkActorCollection *theCollection, TPredicate thePredicate) + { + if(theCollection){ + theCollection->InitTraversal(); + while(vtkActor *anAct = theCollection->GetNextActor()) + if(TActor *anActor = dynamic_cast(anAct)) + if(thePredicate(anActor)) + return anActor; + } + return NULL; + } + +} + +#endif diff --git a/src/VTKViewer/VTKViewer_AppendFilter.cxx b/src/VTKViewer/VTKViewer_AppendFilter.cxx new file mode 100644 index 000000000..4218c4f20 --- /dev/null +++ b/src/VTKViewer/VTKViewer_AppendFilter.cxx @@ -0,0 +1,304 @@ +// SALOME OBJECT : kernel of SALOME component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_GeometryFilter.cxx +// Author : +// Module : SALOME +// $Header$ + +#include "VTKViewer_AppendFilter.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#if defined __GNUC__ + #if __GNUC__ == 2 + #define __GNUC_2__ + #endif +#endif + +vtkCxxRevisionMacro(VTKViewer_AppendFilter, "$Revision$"); +vtkStandardNewMacro(VTKViewer_AppendFilter); + +VTKViewer_AppendFilter +::VTKViewer_AppendFilter() +{ + myDoMappingFlag = false; +} + +VTKViewer_AppendFilter +::~VTKViewer_AppendFilter() +{} + +void +VTKViewer_AppendFilter +::SetDoMappingFlag(const bool theFlag) +{ + if(myDoMappingFlag == theFlag) + return; + + myDoMappingFlag = theFlag; + + this->Modified(); +} + +bool +VTKViewer_AppendFilter +::DoMappingFlag() const +{ + return myDoMappingFlag; +} + +void +VTKViewer_AppendFilter +::SetPoints(vtkPoints* thePoints) +{ + if(GetPoints() == thePoints) + return; + + myPoints = thePoints; + + this->Modified(); +} + +vtkPoints* +VTKViewer_AppendFilter +::GetPoints() +{ + return myPoints.GetPointer(); +} + +void +VTKViewer_AppendFilter +::Execute() +{ + if(myPoints.GetPointer()) + MakeOutput(); + else + Superclass::Execute(); + + if(myDoMappingFlag) + DoMapping(); +} + + +void +VTKViewer_AppendFilter +::DoMapping() +{ + myNodeRanges.clear(); + myCellRanges.clear(); + + vtkIdType aPntStartId = 0; + vtkIdType aCellStartId = 0; + + for(vtkIdType aDataSetId = 0; aDataSetId < this->NumberOfInputs; ++aDataSetId){ + vtkDataSet* aDataSet = (vtkDataSet *)(this->Inputs[aDataSetId]); + // Do mapping of the nodes + if(!myPoints.GetPointer()){ + vtkIdType aNbPnts = aDataSet->GetNumberOfPoints(); + myNodeRanges.push_back(aPntStartId + aNbPnts); + aPntStartId += aNbPnts; + } + // Do mapping of the cells + vtkIdType aNbCells = aDataSet->GetNumberOfCells(); + myCellRanges.push_back(aCellStartId + aNbCells); + aCellStartId += aNbCells; + } +} + +namespace +{ + inline + vtkIdType + GetOutputID(vtkIdType theInputID, + vtkIdType theInputDataSetID, + const VTKViewer_AppendFilter::TVectorIds& theRanges) + { + theInputID = theInputDataSetID = -1; + + vtkIdType aNbInputs = theRanges.size(); + if(theInputDataSetID < 0 || theInputDataSetID >= aNbInputs) + return -1; + + vtkIdType aStartId = theRanges[theInputDataSetID]; + return aStartId + theInputID; + } +} + +vtkIdType +VTKViewer_AppendFilter +::GetPointOutputID(vtkIdType theInputID, + vtkIdType theInputDataSetID) +{ + if(myPoints.GetPointer()) + return theInputID; + + return GetOutputID(theInputID,theInputDataSetID,myNodeRanges); +} + + +vtkIdType +VTKViewer_AppendFilter +::GetCellOutputID(vtkIdType theInputID, + vtkIdType theInputDataSetID) +{ + if(myPoints.GetPointer()) + return theInputID; + + return GetOutputID(theInputID,theInputDataSetID,myCellRanges); +} + + +namespace +{ + void + GetInputID(vtkIdType theOutputID, + vtkIdType& theInputID, + vtkIdType& theStartID, + vtkIdType& theInputDataSetID, + const VTKViewer_AppendFilter::TVectorIds& theRanges) + { + theInputID = theStartID = theInputDataSetID = -1; + + if(theRanges.empty()) + return; + + const vtkIdType& aRangeEnd = theRanges.back(); + if(theOutputID < 0 || theOutputID >= aRangeEnd) + return; + + vtkIdType aStartId = 0; + vtkIdType aNbInputs = theRanges.size(); + for(vtkIdType aDataSetId = 0; aDataSetId < aNbInputs; ++aDataSetId){ + vtkIdType aRange = theRanges[aDataSetId]; + if(aRange > theOutputID){ + theInputID = theOutputID - aStartId; + theInputDataSetID = aDataSetId; + theStartID = aStartId; + break; + } + aStartId = aRange; + } + } +} + +void +VTKViewer_AppendFilter +::GetPointInputID(vtkIdType theOutputID, + vtkIdType& theInputID, + vtkIdType& theStartID, + vtkIdType& theInputDataSetID) +{ + if(myPoints.GetPointer()) { + theStartID = theInputDataSetID = 0; + theInputID = theOutputID; + return; + } + + ::GetInputID(theOutputID, + theInputID, + theStartID, + theInputDataSetID, + myNodeRanges); +} + + +void +VTKViewer_AppendFilter +::GetCellInputID(vtkIdType theOutputID, + vtkIdType& theInputID, + vtkIdType& theStartID, + vtkIdType& theInputDataSetID) +{ + ::GetInputID(theOutputID, + theInputID, + theStartID, + theInputDataSetID, + myCellRanges); +} + + +void +VTKViewer_AppendFilter +::MakeOutput() +{ + int idx; + vtkIdType numPts, numCells, newCellId, cellId; + vtkCellData *cd; + vtkIdList *ptIds; + vtkDataSet *ds; + vtkUnstructuredGrid *output = this->GetOutput(); + // + numPts = myPoints->GetNumberOfPoints(); + if (numPts < 1) { + return; + } + // + numCells = 0; + for (idx = 0; idx < this->NumberOfInputs; ++idx) { + ds = (vtkDataSet *)(this->Inputs[idx]); + if (ds != NULL) { + if ( ds->GetNumberOfPoints() <= 0 && ds->GetNumberOfCells() <= 0 ) { + continue; //no input, just skip + } + numCells += ds->GetNumberOfCells(); + }//if non-empty dataset + }//for all inputs + if (numCells < 1) { + return; + } + // + // Now can allocate memory + output->Allocate(numCells); + ptIds = vtkIdList::New(); + ptIds->Allocate(VTK_CELL_SIZE); + // + // Append each input dataset together + // + // 1.points + output->SetPoints(myPoints.GetPointer()); + // 2.cells + for (idx = 0; idx < this->NumberOfInputs; ++idx) { + ds = (vtkDataSet *)(this->Inputs[idx]); + if (ds != NULL) { + numCells = ds->GetNumberOfCells(); + cd = ds->GetCellData(); + // copy cell and cell data + for (cellId=0; cellIdGetCellPoints(cellId, ptIds); + newCellId = output->InsertNextCell(ds->GetCellType(cellId), ptIds); + } + } + } + // + ptIds->Delete(); +} + diff --git a/src/VTKViewer/VTKViewer_AppendFilter.h b/src/VTKViewer/VTKViewer_AppendFilter.h new file mode 100644 index 000000000..f7b1a171d --- /dev/null +++ b/src/VTKViewer/VTKViewer_AppendFilter.h @@ -0,0 +1,112 @@ +// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_APPENDFILTER_H +#define VTKVIEWER_APPENDFILTER_H + +#include "VTKViewer.h" + +#include +#include + +#include +#include + +class vtkPoints; + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*! \brief This class used same as vtkAppendFilter. See documentation on VTK for more information. + */ +class VTKVIEWER_EXPORT VTKViewer_AppendFilter : public vtkAppendFilter +{ +public: + /*! \fn static VTKViewer_AppendFilter *New() + */ + static VTKViewer_AppendFilter *New(); + + /*! \fn vtkTypeRevisionMacro(VTKViewer_AppendFilter, vtkAppendFilter) + * \brief VTK type revision macros. + */ + vtkTypeRevisionMacro(VTKViewer_AppendFilter, vtkAppendFilter); + + void SetDoMappingFlag(const bool theFlag); + + bool DoMappingFlag() const; + + void + SetPoints(vtkPoints* thePoints); + + vtkPoints* + GetPoints(); + + vtkIdType + GetPointOutputID(vtkIdType theInputID, + vtkIdType theInputDataSetID); + + vtkIdType + GetCellOutputID(vtkIdType theInputID, + vtkIdType theInputDataSetID); + + void + GetPointInputID(vtkIdType theOutputID, + vtkIdType& theInputID, + vtkIdType& theStartID, + vtkIdType& theInputDataSetID); + + void + GetCellInputID(vtkIdType theOutputID, + vtkIdType& theInputID, + vtkIdType& theStartID, + vtkIdType& theInputDataSetID); + + typedef std::vector TVectorIds; + +protected: + /*! \fn VTKViewer_AppendFilter(); + * \brief Constructor + */ + VTKViewer_AppendFilter(); + /*! \fn ~VTKViewer_AppendFilter(); + * \brief Destructor. + */ + ~VTKViewer_AppendFilter(); + /*! \fn void Execute(); + * \brief Filter culculation method. + */ + virtual void Execute(); + // + void DoMapping(); + + void Reset(); + + void MakeOutput(); + + bool myDoMappingFlag; + TVectorIds myNodeRanges; + TVectorIds myCellRanges; + vtkSmartPointer myPoints; +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif diff --git a/src/VTKViewer/VTKViewer_CellLocationsArray.cxx b/src/VTKViewer/VTKViewer_CellLocationsArray.cxx new file mode 100644 index 000000000..995eedf49 --- /dev/null +++ b/src/VTKViewer/VTKViewer_CellLocationsArray.cxx @@ -0,0 +1,33 @@ +// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : +// Author : +// Module : +// $Header$ + +#include "VTKViewer_CellLocationsArray.h" + +#include + +vtkStandardNewMacro(VTKViewer_CellLocationsArray); diff --git a/src/VTKViewer/VTKViewer_CellLocationsArray.h b/src/VTKViewer/VTKViewer_CellLocationsArray.h new file mode 100644 index 000000000..8cbd4d89b --- /dev/null +++ b/src/VTKViewer/VTKViewer_CellLocationsArray.h @@ -0,0 +1,42 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef VTKVIEWER_CELLLOCATIONS_H +#define VTKVIEWER_CELLLOCATIONS_H + +#include "VTKViewer.h" + +#if (VTK_MAJOR_VERSION >= 4) && (VTK_MINOR_VERSION >= 4) +# include +# define TCellLocationsArray vtkIdTypeArray +#else +# include +# define TCellLocationsArray vtkIntArray +#endif + +struct VTKVIEWER_EXPORT VTKViewer_CellLocationsArray : TCellLocationsArray +{ + static VTKViewer_CellLocationsArray* New(); + + vtkTypeMacro(VTKViewer_CellLocationsArray,TCellLocationsArray); +}; + +#undef TCellLocationsArray + +#endif diff --git a/src/VTKViewer/VTKViewer_CellRectPicker.cxx b/src/VTKViewer/VTKViewer_CellRectPicker.cxx new file mode 100755 index 000000000..016da1f75 --- /dev/null +++ b/src/VTKViewer/VTKViewer_CellRectPicker.cxx @@ -0,0 +1,443 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include + +#include "vtkGenericCell.h" +#include "vtkAssemblyNode.h" +#include "vtkAssemblyPath.h" +#include "vtkObjectFactory.h" +#include "vtkImageData.h" +#include "vtkMapper.h" +#include "vtkVolumeMapper.h" +#include "vtkMath.h" +#include "vtkLine.h" +#include "vtkQuad.h" +#include "vtkPoints.h" +#include "vtkPlane.h" +#include "vtkActor.h" + +vtkStandardNewMacro(VTKViewer_CellRectPicker); + +/*!Constructor.\n + * \li create instance of generic cell + * \li create two instances of Quad. + */ +VTKViewer_CellRectPicker::VTKViewer_CellRectPicker() +{ + this->Cell = vtkGenericCell::New(); + this->Quad1 = vtkQuad::New(); + this->Quad2 = vtkQuad::New(); +} + +/*!Destructor. + * \li Delete generic cell + * \li Delete two quads. + */ +VTKViewer_CellRectPicker::~VTKViewer_CellRectPicker() +{ + this->Cell->Delete(); + this->Quad1->Delete(); + this->Quad2->Delete(); +} + +/*!Clear \a ActorData and call VTKViewer_RectPicker::Initialize() method*/ +void VTKViewer_CellRectPicker::Initialize() +{ + ActorData.clear(); + this->VTKViewer_RectPicker::Initialize(); +} + +/*!*/ +float VTKViewer_CellRectPicker::IntersectWithHex(float p1[4][4], float p2[4][4], float tol, + vtkAssemblyPath *path, vtkProp3D *prop3D, + vtkAbstractMapper3D *m) +{ + vtkDataSet *input; + vtkMapper *mapper; + vtkVolumeMapper *volumeMapper; + + // Get the underlying dataset + if ( (mapper=vtkMapper::SafeDownCast(m)) != NULL ) { + input = mapper->GetInput(); + } + else if ( (volumeMapper=vtkVolumeMapper::SafeDownCast(m)) != NULL ) { + input = volumeMapper->GetInput(); + } + else { + return VTK_LARGE_FLOAT; + } + + vtkIdType numCells; + if ( (numCells = input->GetNumberOfCells()) < 1 ) { + return 2.0; + } + + int i, k, subId; + float bounds[6], center[3], cp1[3], cp2[3]; + float pcoord[3], weight[4], dist; + float t1[2], t2[2], x[3], t; + + for (k = 0; k < 4; k++) { + this->Quad1->PointIds->SetId(k, k); + this->Quad1->Points->SetPoint(k, p1[k]); + this->Quad2->PointIds->SetId(k, k); + this->Quad2->Points->SetPoint(k, p2[k]); + } + + /* + cout << "---> Selection area:" << endl; + for (k = 0; k < 4; k++) + cout << "\t(" << p1[k][0] << ", " << p1[k][1] << ", " << p1[k][2] << ")"; + cout << endl; + for (k = 0; k < 4; k++) + cout << "\t(" << p2[k][0] << ", " << p2[k][1] << ", " << p2[k][2] << ")"; + cout << endl; + */ + + vtkIdType cellId; + VTKViewer_CellData cellData; + VTKViewer_CellDataSet dataList; + + char inside; int n; float *point; + float tMin = VTK_LARGE_FLOAT, xMin[3]; + for (cellId = 0; cellId < numCells; cellId++) { + input->GetCell(cellId, this->Cell); + + this->Cell->GetBounds(bounds); + for (i = 0; i < 3; i++) + center[i] = (bounds[2*i]+bounds[2*i+1])/2; + + /* + if (!VTKViewer_RectPicker::PointInside(center, p1, p2, 0.01)) + continue; + */ + + inside = 1; + n = this->Cell->Points->GetNumberOfPoints(); + //cout << "---> Info cell " << cellId << " (" << n << "): " << endl; + for (k = 0; k < n; k++) { + point = this->Cell->Points->GetPoint(k); + //cout << " P (" << point[0] << ", " << point[1] << ", " << point[2] << ")"; + if (!VTKViewer_RectPicker::PointInside(point, p1, p2)) { + inside = 0; break; + } + } + //cout << endl; + if (!inside) continue; + + //cout << "---> Inside cell " << cellId << endl; + + this->Quad1->EvaluatePosition(center, 0, subId, pcoord, dist, weight); + t1[0] = pcoord[0]; t1[1] = pcoord[1]; + this->Quad2->EvaluatePosition(center, 0, subId, pcoord, dist, weight); + t2[0] = pcoord[0]; t2[1] = pcoord[1]; + + pcoord[0] = (t1[0]+t2[0])/2; pcoord[1] = (t1[1]+t2[1])/2; pcoord[2] = 0; + + this->Quad1->EvaluateLocation(subId, pcoord, cp1, weight); + this->Quad2->EvaluateLocation(subId, pcoord, cp2, weight); + + if (this->Cell->IntersectWithLine(cp1, cp2, tol, t, x, pcoord, subId)) { + cellData.cellId = cellId; + cellData.subId = subId; + cellData.depth = t; + for (i = 0; i < 3; i++) { + cellData.p1[i] = cp1[i]; + cellData.p2[i] = cp2[i]; + } + /* + cout << "---> Include cell " << cellId << ", depth = " << t << endl; + cout << " P1 = (" << cp1[0] << ", " << cp1[1] << ", " << cp1[2] << ")" << endl; + cout << " P2 = (" << cp2[0] << ", " << cp2[1] << ", " << cp2[2] << ")" << endl; + */ + IncludeCell(input, cellData, dataList); + if (t < tMin) { + tMin = t; + for (i = 0; i < 3; i++) + xMin[i] = x[i]; + } + } + } + + if (!dataList.empty()) { + // compare against other actors + IncludeActor(prop3D, input, dataList); + if (tMin < this->GlobalTMin) { + this->MarkPicked(path, prop3D, m, tMin, xMin); + } + } + + return tMin; +} + +/*!*/ +void VTKViewer_CellRectPicker::IncludeCell(vtkDataSet* input, + VTKViewer_CellData cellData, + VTKViewer_CellDataSet& dataList) +{ + vtkGenericCell* cell1 = vtkGenericCell::New(); + vtkGenericCell* cell2 = vtkGenericCell::New(); + vtkCell* sub1 = 0; + vtkCell* sub2 = 0; + + input->GetCell(cellData.cellId, cell1); + if (cell1->GetNumberOfFaces() > 0) + sub1 = cell1->GetFace(cellData.subId); + + int i, result; + float p1[3], p2[3], dir[3]; + char add = 1; + + VTKViewer_CellData curData; + VTKViewer_CellDataSet::iterator it; + for (it = dataList.begin(); it != dataList.end();) { + curData = *it; + for (i = 0; i < 3; i++) { + p1[i] = (cellData.p1[i]+curData.p1[i])/2; + p2[i] = (cellData.p2[i]+curData.p2[i])/2; + dir[i] = p2[i] - p1[i]; + } + + input->GetCell(curData.cellId, cell2); + sub2 = 0; + if (cell2->GetNumberOfFaces() > 0) + sub2 = cell2->GetFace(curData.subId); + + if (sub1) { + if (sub2) + result = IntersectCells(sub1, cellData.depth, + sub2, curData.depth, dir); + else + result = IntersectCells(sub1, cellData.depth, + cell2, curData.depth, dir); + } + else { + if (sub2) + result = IntersectCells(cell1, cellData.depth, + sub2, curData.depth, dir); + else + result = IntersectCells(cell1, cellData.depth, + cell2, curData.depth, dir); + } + /* + cout << " Direction = (" << dir[0] << ", " << dir[1] << ", " << dir[2] << ")"; + cout << " depth = " << cellData.depth << ", " << curData.depth << ", " << result << endl; + */ + if (result > 0) { + if (result == 1) { + it = dataList.erase(it); + continue; + } + else { + add = 0; + break; + } + } + ++it; + } + if (add) { + //cout << " add " << endl; + dataList.push_back(cellData); + } + + cell1->Delete(); + cell2->Delete(); +} + +/*!*/ +void VTKViewer_CellRectPicker::IncludeActor(vtkProp3D* prop, + vtkDataSet* input, + VTKViewer_CellDataSet& dataList) +{ + vtkGenericCell* cell1 = vtkGenericCell::New(); + vtkGenericCell* cell2 = vtkGenericCell::New(); + + int i, result; + float p1[3], p2[3], dir[3]; + char removed; + + VTKViewer_CellDataSet actorData; + VTKViewer_CellData curData, cellData; + VTKViewer_CellDataSet::iterator it1, it2; + VTKViewer_ActorDataMap::iterator it; + + for (it1 = dataList.begin(); it1 != dataList.end();) { + cellData = *it1; + input->GetCell(cellData.cellId, cell1); + removed = 0; + + for (it = ActorData.begin(); it != ActorData.end(); ++it) { + //vtkActor* actor = (*it).first; + actorData = (*it).second; + + for (it2 = actorData.begin(); it2 != actorData.end();) { + curData = *it2; + for (i = 0; i < 3; i++) { + p1[i] = (cellData.p1[i]+curData.p1[i])/2; + p2[i] = (cellData.p2[i]+curData.p2[i])/2; + dir[i] = p2[i] - p1[i]; + } + + input->GetCell(curData.cellId, cell2); + result = IntersectCells(cell1, cellData.depth, + cell2, curData.depth, dir); + if (result > 0) { + if (result == 1) { + it2 = actorData.erase(it2); + continue; + } + else { + removed = 1; + it1 = dataList.erase(it1); + break; + } + break; + } + ++it2; + } + if (removed) break; + } // by actors + if (!removed) ++it1; + } + + if (!dataList.empty()) { + vtkActor* actor; + if ((actor = vtkActor::SafeDownCast(prop)) != NULL) + ActorData[actor] = dataList; + } + + cell1->Delete(); + cell2->Delete(); +} + +/*! The method returns a non-zero value, if the cells intersect each other + * in the direction dir[3]. + * \param c1 - first vtkCell pointer + * \param d1 - + * \param c2 - second vtkCell pointer + * \param d2 - + * \param dir[3] - direction + * \retval integer - Returned value is 1 if the first cell is top of + * the second one according to direction and 2 if the second cell is top. + */ +int VTKViewer_CellRectPicker::IntersectCells(vtkCell* c1, float d1, vtkCell* c2, float d2, float dir[3]) +{ + int i, k; + float *orig, cp[3], bounds[6]; + vtkCell* cell = 0; + vtkCell* tcell = 0; + + // define the central point and cell for projection + if (fabs(d1-d2) < 1.e-7) return 0; + + if (d1 < d2) { + orig = c1->Points->GetPoint(0); + cell = c1; + tcell = c2; + c2->GetBounds(bounds); + for (i = 0; i < 3; i++) + cp[i] = (bounds[2*i] + bounds[2*i+1])/2; + } + else if (d1 > d2) { + orig = c2->Points->GetPoint(0); + cell = c2; + tcell = c1; + c1->GetBounds(bounds); + for (i = 0; i < 3; i++) + cp[i] = (bounds[2*i] + bounds[2*i+1])/2; + } + + float proj[3]; + vtkPlane::GeneralizedProjectPoint(cp, orig, dir, proj); + + float *p, pp[3]; + vtkPoints* aPoints = vtkPoints::New(); + for (k = 0; k < cell->Points->GetNumberOfPoints(); k++) { + p = cell->Points->GetPoint(k); + vtkPlane::GeneralizedProjectPoint(p, orig, dir, pp); + aPoints->InsertNextPoint(pp[0], pp[1], pp[2]); + } + + int result = 0; + if (PointInside(proj, aPoints)) { + result = (d1Points->GetNumberOfPoints(); k++) { + p = tcell->Points->GetPoint(k); + vtkPlane::GeneralizedProjectPoint(p, orig, dir, pp); + if (PointInside(pp, aPoints)) { + result = 1; break; + } + } + if (result && d2Delete(); + return result; +} + +/*! Check point position. + * \param point[3] - point + * \param list - point data set + * \retval 0 or 1 - The method returns a non-zero value, if the point is inlide point data set + */ +char VTKViewer_CellRectPicker::PointInside(float point[3], vtkPoints* list) +{ + int i, k, l, n; + float x[3], *a1, *a2, v[3], p[3], q[3]; + + n = list->GetNumberOfPoints(); + if (n < 3) return 0; + + for (k = 0; k < n; k++) { + l = k+1; if (l == n) l = 0; + a1 = list->GetPoint(k); + a2 = list->GetPoint(l); + + // compute vectors + for (i = 0; i < 3; i++) { + x[i] = point[i] - a1[i]; + v[i] = a2[i]-a1[i]; + } + + // check if point coincides with vertex + if (x[0]*x[0] + x[1]*x[1] + x[2]*x[2] < 1.e-7) return 0; + + // compute normal + vtkMath::Cross(x, v, p); + + // check if point lays on edge + if (p[0]*p[0] + p[1]*p[1] + p[2]*p[2] < 1.e-7) return 0; + + // check if normals are in the same direction + if (k > 0) { + if (vtkMath::Dot(p, q) < 0.0) return 0; + } + + // remember normal direction + for (i = 0; i < 3; i++) { + q[i] = p[i]; + } + } + + return 1; +} diff --git a/src/VTKViewer/VTKViewer_CellRectPicker.h b/src/VTKViewer/VTKViewer_CellRectPicker.h new file mode 100755 index 000000000..fde6f4dd2 --- /dev/null +++ b/src/VTKViewer/VTKViewer_CellRectPicker.h @@ -0,0 +1,107 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : VTKViewer_CellRectPicker.h +// Author : Natalia KOPNOVA +// Module : SALOME + + +#ifndef __VTKViewer_CellRectPicker_h +#define __VTKViewer_CellRectPicker_h + +#include "VTKViewer_RectPicker.h" +#include +#include + +/*! \brief Cell data structure*/ +typedef struct { + vtkIdType cellId; + int subId; + float depth; + float p1[3]; + float p2[3]; +} VTKViewer_CellData; + +typedef std::vector VTKViewer_CellDataSet; +typedef std::map VTKViewer_ActorDataMap; + +class vtkCell; +class vtkGenericCell; +class vtkQuad; + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*!Rectangular cell picker class.*/ +class VTK_EXPORT VTKViewer_CellRectPicker : public VTKViewer_RectPicker +{ +public: + /*!Create new instance of CellRectPicker class.*/ + static VTKViewer_CellRectPicker *New(); + + /*! \fn vtkTypeMacro(VTKViewer_CellRectPicker,VTKViewer_RectPicker); + * \brief VTK type macros. + */ + vtkTypeMacro(VTKViewer_CellRectPicker,VTKViewer_RectPicker); + + /*! \fn VTKViewer_CellDataSet GetCellData(vtkActor* actor) + * \brief Get the id of the picked cells. + * \brief (Notes: use GetActors() to get picked actors list) + * \param actor - vtkActor pointer + */ + VTKViewer_CellDataSet GetCellData(vtkActor* actor) + { return this->ActorData[actor]; } + + static int IntersectCells(vtkCell* c1, float d1, vtkCell* c2, float d2, float dir[3]); + + static char PointInside(float point[3], vtkPoints* list); + +protected: + + VTKViewer_CellRectPicker(); + ~VTKViewer_CellRectPicker(); + + VTKViewer_ActorDataMap ActorData; + + virtual float IntersectWithHex(float p1[4][4], float p2[4][4], float tol, + vtkAssemblyPath *path, vtkProp3D *p, + vtkAbstractMapper3D *m); + + void Initialize(); + + + void IncludeCell(vtkDataSet* input, VTKViewer_CellData cellData, VTKViewer_CellDataSet& dalaList); + void IncludeActor(vtkProp3D* prop, vtkDataSet* input, VTKViewer_CellDataSet& dataList); + +private: + vtkGenericCell *Cell; + vtkQuad* Quad1; + vtkQuad* Quad2; +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif + + diff --git a/src/VTKViewer/VTKViewer_ConvexTool.cxx b/src/VTKViewer/VTKViewer_ConvexTool.cxx new file mode 100644 index 000000000..6ba9ee187 --- /dev/null +++ b/src/VTKViewer/VTKViewer_ConvexTool.cxx @@ -0,0 +1,601 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include "VTKViewer_ConvexTool.h" + +#include +#include + +#ifdef WNT +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ + typedef std::vector TConnectivities; + + struct TPolygon + { + TConnectivities myConnectivities; + vtkFloatingPointType myOrigin[3]; + vtkFloatingPointType myNormal[3]; + TPolygon(const TConnectivities& theConnectivities, + vtkFloatingPointType theOrigin[3], + vtkFloatingPointType theNormal[3]): + myConnectivities(theConnectivities) + { + myOrigin[0] = theOrigin[0]; + myOrigin[1] = theOrigin[1]; + myOrigin[2] = theOrigin[2]; + + myNormal[0] = theNormal[0]; + myNormal[1] = theNormal[1]; + myNormal[2] = theNormal[2]; + } + }; + + typedef std::vector TPolygons; +} + +/*! + Constructor +*/ +VTKViewer_Triangulator +::VTKViewer_Triangulator(): + myInput(NULL), + myCellId(-1), + myShowInside(-1), + myAllVisible(-1), + myCellsVisibility(NULL), + myCellIds(vtkIdList::New()) +{} + + +/*! + Destructor +*/ +VTKViewer_Triangulator +::~VTKViewer_Triangulator() +{ + myCellIds->Delete(); +} + + + +bool +VTKViewer_Triangulator +::Execute(vtkUnstructuredGrid *theInput, + vtkCellData* thInputCD, + vtkIdType theCellId, + int theShowInside, + int theAllVisible, + const char* theCellsVisibility, + vtkPolyData *theOutput, + vtkCellData* theOutputCD, + int theStoreMapping, + std::vector& theVTK2ObjIds, + bool theIsCheckConvex) +{ + myInput = theInput; + myCellId = theCellId; + myShowInside = theShowInside; + myAllVisible = theAllVisible; + myCellsVisibility = theCellsVisibility; + + vtkPoints *aPoints = InitPoints(); + vtkIdType aNumPts = GetNbOfPoints(); + //cout<<"Triangulator - aNumPts = "<GetPoint(GetPointId(aPntId),aPntCoord); + //cout<<"\taPntId = "< TPointIds; + TPointIds anInitialPointIds; + for(vtkIdType aPntId = 0; aPntId < aNumPts; aPntId++) + anInitialPointIds.insert(GetPointId(aPntId)); + + // To initialize set of points by face that belong to the cell and backward + typedef std::set TFace2Visibility; + TFace2Visibility aFace2Visibility; + + typedef std::set TFace2PointIds; + TFace2PointIds aFace2PointIds; + + for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) { + vtkCell* aFace = GetFace(aFaceId); + + GetCellNeighbors(theCellId, aFace, myCellIds); + if((!myAllVisible && !myCellsVisibility[myCellIds->GetId(0)]) || + myCellIds->GetNumberOfIds() <= 0 || myShowInside) + { + TPointIds aPointIds; + vtkIdList *anIdList = aFace->PointIds; + aPointIds.insert(anIdList->GetId(0)); + aPointIds.insert(anIdList->GetId(1)); + aPointIds.insert(anIdList->GetId(2)); + + aFace2PointIds.insert(aPointIds); + aFace2Visibility.insert(aFaceId); + } + } + + + ::TPolygons aPolygons; + + for (int aFaceId = 0; aFaceId < aNumFaces; aFaceId++) { + if(aFace2Visibility.find(aFaceId) == aFace2Visibility.end()) + continue; + + vtkCell* aFace = GetFace(aFaceId); + + vtkIdList *anIdList = aFace->PointIds; + vtkIdType aNewPts[3] = {anIdList->GetId(0), anIdList->GetId(1), anIdList->GetId(2)}; + + // To initialize set of points for the plane where the trinangle face belong to + TPointIds aPointIds; + aPointIds.insert(aNewPts[0]); + aPointIds.insert(aNewPts[1]); + aPointIds.insert(aNewPts[2]); + + // To get know, if the points of the trinagle were already observed + bool anIsObserved = aFace2PointIds.find(aPointIds) == aFace2PointIds.end(); + //cout<<"\taFaceId = "<GetPoint(aNewPts[0],aCoord[0]); + aPoints->GetPoint(aNewPts[1],aCoord[1]); + aPoints->GetPoint(aNewPts[2],aCoord[2]); + + // To calculate plane normal + vtkFloatingPointType aVector01[3] = { aCoord[1][0] - aCoord[0][0], + aCoord[1][1] - aCoord[0][1], + aCoord[1][2] - aCoord[0][2] }; + + vtkFloatingPointType aVector02[3] = { aCoord[2][0] - aCoord[0][0], + aCoord[2][1] - aCoord[0][1], + aCoord[2][2] - aCoord[0][2] }; + + // To calculate the normal for the triangle + vtkFloatingPointType aNormal[3]; + vtkMath::Cross(aVector02,aVector01,aNormal); + + vtkMath::Normalize(aNormal); + + // To calculate what points belong to the plane + // To calculate bounds of the point set + vtkFloatingPointType aCenter[3] = {0.0, 0.0, 0.0}; + { + TPointIds::const_iterator anIter = anInitialPointIds.begin(); + TPointIds::const_iterator anEndIter = anInitialPointIds.end(); + for(; anIter != anEndIter; anIter++){ + vtkFloatingPointType aPntCoord[3]; + vtkIdType aPntId = *anIter; + aPoints->GetPoint(aPntId,aPntCoord); + vtkFloatingPointType aDist = vtkPlane::DistanceToPlane(aPntCoord,aNormal,aCoord[0]); + //cout<<"\t\taPntId = "< 0){ + aNormal[0] = -aNormal[0]; + aNormal[1] = -aNormal[1]; + aNormal[2] = -aNormal[2]; + } + + // To calculate the primary direction for point set + vtkFloatingPointType aVector0[3] = { aCoord[0][0] - aCenter[0], + aCoord[0][1] - aCenter[1], + aCoord[0][2] - aCenter[2] }; + vtkMath::Normalize(aVector0); + + //cout<<"\t\taCenter = {"< TSortedPointIds; + TSortedPointIds aSortedPointIds; + + TPointIds::const_iterator anIter = aPointIds.begin(); + TPointIds::const_iterator anEndIter = aPointIds.end(); + for(; anIter != anEndIter; anIter++){ + vtkFloatingPointType aPntCoord[3]; + vtkIdType aPntId = *anIter; + aPoints->GetPoint(aPntId,aPntCoord); + vtkFloatingPointType aVector[3] = { aPntCoord[0] - aCenter[0], + aPntCoord[1] - aCenter[1], + aPntCoord[2] - aCenter[2] }; + vtkMath::Normalize(aVector); + + vtkFloatingPointType aCross[3]; + vtkMath::Cross(aVector,aVector0,aCross); + bool aGreaterThanPi = vtkMath::Dot(aCross,aNormal) < 0; + vtkFloatingPointType aCosinus = vtkMath::Dot(aVector,aVector0); + if(aCosinus > 1.0) + aCosinus = 1.0; + if(aCosinus < -1.0) + aCosinus = -1.0; + static vtkFloatingPointType a2Pi = 2.0 * vtkMath::Pi(); + vtkFloatingPointType anAngle = acos(aCosinus); + //cout<<"\t\t\taPntId = "<second; + aConnectivities[anId] = GetConnectivity(aPntId); + } + aPolygons.push_back(::TPolygon(aConnectivities,aCenter,aNormal)); + } + } + } + } + + if(aPolygons.empty()) + return true; + + // To check, whether the polygons give a convex polyhedron or not + if(theIsCheckConvex){ + int aNbPolygons = aPolygons.size(); + for (int aPolygonId = 0; aPolygonId < aNbPolygons; aPolygonId++) { + ::TPolygon& aPolygon = aPolygons[aPolygonId]; + vtkFloatingPointType* aNormal = aPolygon.myNormal; + vtkFloatingPointType* anOrigin = aPolygon.myOrigin; + //cout<<"\taPolygonId = "<GetPoint(anId,aPntCoord); + vtkFloatingPointType aDist = vtkPlane::Evaluate(aNormal,anOrigin,aPntCoord); + //cout<<"\t\taPntId = "<InsertNextCell(VTK_POLYGON,aNbPoints,&aConnectivities[0]); + if(theStoreMapping) + theVTK2ObjIds.push_back(theCellId); + theOutputCD->CopyData(thInputCD,theCellId,aNewCellId); + } + } + + //cout<<"\tTriangulator - Ok\n"; + return true; +} + +/*! + Constructor +*/ +VTKViewer_OrderedTriangulator +::VTKViewer_OrderedTriangulator(): + myCell(vtkGenericCell::New()) +{} + +/*! + Destructor +*/ +VTKViewer_OrderedTriangulator +::~VTKViewer_OrderedTriangulator() +{ + myCell->Delete(); +} + +vtkPoints* +VTKViewer_OrderedTriangulator +::InitPoints() +{ + myInput->GetCell(myCellId,myCell); + return myInput->GetPoints(); +} + +vtkIdType +VTKViewer_OrderedTriangulator +::GetNbOfPoints() +{ + return myCell->GetNumberOfPoints(); +} + +vtkIdType +VTKViewer_OrderedTriangulator +::GetPointId(vtkIdType thePointId) +{ + return myCell->GetPointId(thePointId); +} + +vtkFloatingPointType +VTKViewer_OrderedTriangulator +::GetCellLength() +{ + return sqrt(myCell->GetLength2()); +} + +vtkIdType +VTKViewer_OrderedTriangulator +::GetNumFaces() +{ + return myCell->GetNumberOfFaces(); +} + +vtkCell* +VTKViewer_OrderedTriangulator +::GetFace(vtkIdType theFaceId) +{ + return myCell->GetFace(theFaceId); +} + +void +VTKViewer_OrderedTriangulator +::GetCellNeighbors(vtkIdType theCellId, + vtkCell* theFace, + vtkIdList* theCellIds) +{ + vtkIdList *anIdList = theFace->PointIds; + myInput->GetCellNeighbors(theCellId, anIdList, theCellIds); +} + +vtkIdType +VTKViewer_OrderedTriangulator +::GetConnectivity(vtkIdType thePntId) +{ + return thePntId; +} + +/*! + Constructor +*/ +VTKViewer_DelaunayTriangulator +::VTKViewer_DelaunayTriangulator(): + myUnstructuredGrid(vtkUnstructuredGrid::New()), + myGeometryFilter(vtkGeometryFilter::New()), + myDelaunay3D(vtkDelaunay3D::New()), + myFaceIds(vtkIdList::New()), + myPoints(vtkPoints::New()), + myPolyData(NULL), + myPointIds(NULL) +{ + myDelaunay3D->SetInput(myUnstructuredGrid); + myGeometryFilter->SetInput(myDelaunay3D->GetOutput()); +} + + + +/*! + Destructor +*/ +VTKViewer_DelaunayTriangulator +::~VTKViewer_DelaunayTriangulator() +{ + myUnstructuredGrid->Delete(); + myGeometryFilter->Delete(); + myDelaunay3D->Delete(); + myFaceIds->Delete(); + myPoints->Delete(); +} + + +vtkPoints* +VTKViewer_DelaunayTriangulator +::InitPoints() +{ + myPoints->Reset(); + myUnstructuredGrid->Initialize(); + myUnstructuredGrid->Allocate(); + myUnstructuredGrid->SetPoints(myPoints); + + vtkIdType aNumPts; + myInput->GetCellPoints(myCellId,aNumPts,myPointIds); + + if ( aNumPts < myPoints->GetNumberOfPoints() ) + myPoints->Reset(); + + { + vtkFloatingPointType aPntCoord[3]; + myPoints->SetNumberOfPoints(aNumPts); + vtkPoints *anInputPoints = myInput->GetPoints(); + for (int aPntId = 0; aPntId < aNumPts; aPntId++) { + anInputPoints->GetPoint(myPointIds[aPntId],aPntCoord); + myPoints->SetPoint(aPntId,aPntCoord); + } + } + + myPoints->Modified(); + myUnstructuredGrid->Modified(); + + myGeometryFilter->Update(); + myPolyData = myGeometryFilter->GetOutput(); + + return myPoints; +} + +vtkIdType +VTKViewer_DelaunayTriangulator +::GetNbOfPoints() +{ + return myPoints->GetNumberOfPoints(); +} + +vtkIdType +VTKViewer_DelaunayTriangulator +::GetPointId(vtkIdType thePointId) +{ + return thePointId; +} + +vtkFloatingPointType +VTKViewer_DelaunayTriangulator +::GetCellLength() +{ + return myPolyData->GetLength(); +} + +vtkIdType +VTKViewer_DelaunayTriangulator +::GetNumFaces() +{ + return myPolyData->GetNumberOfCells(); +} + +vtkCell* +VTKViewer_DelaunayTriangulator +::GetFace(vtkIdType theFaceId) +{ + return myPolyData->GetCell(theFaceId); +} + +void +VTKViewer_DelaunayTriangulator +::GetCellNeighbors(vtkIdType theCellId, + vtkCell* theFace, + vtkIdList* theCellIds) +{ + myFaceIds->Reset(); + vtkIdList *anIdList = theFace->PointIds; + myFaceIds->InsertNextId(myPointIds[anIdList->GetId(0)]); + myFaceIds->InsertNextId(myPointIds[anIdList->GetId(1)]); + myFaceIds->InsertNextId(myPointIds[anIdList->GetId(2)]); + + myInput->GetCellNeighbors(theCellId, myFaceIds, theCellIds); +} + + +vtkIdType +VTKViewer_DelaunayTriangulator +::GetConnectivity(vtkIdType thePntId) +{ + return myPointIds[thePntId]; +} diff --git a/src/VTKViewer/VTKViewer_ConvexTool.h b/src/VTKViewer/VTKViewer_ConvexTool.h new file mode 100644 index 000000000..2bf024d5e --- /dev/null +++ b/src/VTKViewer/VTKViewer_ConvexTool.h @@ -0,0 +1,203 @@ +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _VTKViewer_ConvexTool_H +#define _VTKViewer_ConvexTool_H + +#include "VTKViewer.h" + +#include + +#include + +class vtkUnstructuredGrid; +class vtkGeometryFilter; +class vtkGenericCell; +class vtkDelaunay3D; +class vtkPolyData; +class vtkCellData; +class vtkPoints; +class vtkIdList; +class vtkCell; + +class VTKVIEWER_EXPORT VTKViewer_Triangulator +{ + public: + VTKViewer_Triangulator(); + + ~VTKViewer_Triangulator(); + + bool + Execute(vtkUnstructuredGrid *theInput, + vtkCellData* thInputCD, + vtkIdType theCellId, + int theShowInside, + int theAllVisible, + const char* theCellsVisibility, + vtkPolyData *theOutput, + vtkCellData* theOutputCD, + int theStoreMapping, + std::vector& theVTK2ObjIds, + bool theIsCheckConvex); + + protected: + vtkIdList* myCellIds; + + vtkUnstructuredGrid *myInput; + vtkIdType myCellId; + int myShowInside; + int myAllVisible; + const char* myCellsVisibility; + + virtual + vtkPoints* + InitPoints() = 0; + + virtual + vtkIdType + GetNbOfPoints() = 0; + + virtual + vtkIdType + GetPointId(vtkIdType thePointId) = 0; + + virtual + vtkFloatingPointType + GetCellLength() = 0; + + virtual + vtkIdType + GetNumFaces() = 0; + + virtual + vtkCell* + GetFace(vtkIdType theFaceId) = 0; + + virtual + void + GetCellNeighbors(vtkIdType theCellId, + vtkCell* theFace, + vtkIdList* theCellIds) = 0; + + virtual + vtkIdType + GetConnectivity(vtkIdType thePntId) = 0; +}; + + +class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator +{ + public: + + VTKViewer_OrderedTriangulator(); + + ~VTKViewer_OrderedTriangulator(); + + protected: + vtkGenericCell *myCell; + + virtual + vtkPoints* + InitPoints(); + + virtual + vtkIdType + GetNbOfPoints(); + + vtkIdType + GetPointId(vtkIdType thePointId); + + virtual + vtkFloatingPointType + GetCellLength(); + + virtual + vtkIdType + GetNumFaces(); + + virtual + vtkCell* + GetFace(vtkIdType theFaceId); + + virtual + void + GetCellNeighbors(vtkIdType theCellId, + vtkCell* theFace, + vtkIdList* theCellIds); + + virtual + vtkIdType + GetConnectivity(vtkIdType thePntId); +}; + + +class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator +{ + public: + + VTKViewer_DelaunayTriangulator(); + + ~VTKViewer_DelaunayTriangulator(); + + protected: + vtkUnstructuredGrid* myUnstructuredGrid; + vtkGeometryFilter* myGeometryFilter; + vtkDelaunay3D* myDelaunay3D; + vtkPolyData* myPolyData; + vtkIdType *myPointIds; + vtkIdList* myFaceIds; + vtkPoints* myPoints; + + virtual + vtkPoints* + InitPoints(); + + virtual + vtkIdType + GetNbOfPoints(); + + vtkIdType + GetPointId(vtkIdType thePointId); + + virtual + vtkFloatingPointType + GetCellLength(); + + virtual + vtkIdType + GetNumFaces(); + + virtual + vtkCell* + GetFace(vtkIdType theFaceId); + + virtual + void + GetCellNeighbors(vtkIdType theCellId, + vtkCell* theFace, + vtkIdList* theCellIds); + + virtual + vtkIdType + GetConnectivity(vtkIdType thePntId); +}; + + +#endif // _VTKViewer_ConvexTool_H diff --git a/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx new file mode 100755 index 000000000..5cb422e11 --- /dev/null +++ b/src/VTKViewer/VTKViewer_ExtractUnstructuredGrid.cxx @@ -0,0 +1,351 @@ +// VISU CONVERTOR : +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File: VISU_ExtractUnstructuredGrid.cxx +// Author: Alexey PETROV +// Module : VISU + + +#include "VTKViewer_ExtractUnstructuredGrid.h" +#include "VTKViewer_CellLocationsArray.h" + +#include +#include +#include +#include +#include +#include + +using namespace std; + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + +#if defined __GNUC__ + #if __GNUC__ == 2 + #define __GNUC_2__ + #endif +#endif + +vtkStandardNewMacro(VTKViewer_ExtractUnstructuredGrid); + + +VTKViewer_ExtractUnstructuredGrid::VTKViewer_ExtractUnstructuredGrid(): + myExtractionMode(eCells), myChangeMode(ePassAll) +{} + + +VTKViewer_ExtractUnstructuredGrid::~VTKViewer_ExtractUnstructuredGrid(){} + + +void VTKViewer_ExtractUnstructuredGrid::RegisterCell(vtkIdType theCellId){ +// if(0 && MYDEBUG) MESSAGE("RegisterCell - theCellId = "<GetNumberOfCells() = "<GetNumberOfCells()); + MESSAGE("Execute - myCellTypes.size() = "<GetNumberOfCells() = "<GetNumberOfCells()); + if(myStoreMapping){ + MESSAGE("Execute - myOut2InId.size() = "< + +#include +#include +#include + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*! \class vtkUnstructuredGridToUnstructuredGridFilter + * \brief For more information see VTK documentation + */ +/*! \class vtkUnstructuredGridToUnstructuredGridFilter + * \brief For more information see VTK documentation. + */ +class VTKVIEWER_EXPORT VTKViewer_ExtractUnstructuredGrid : public vtkUnstructuredGridToUnstructuredGridFilter +{ +public: + //! VTK type macros. + vtkTypeMacro( VTKViewer_ExtractUnstructuredGrid, vtkUnstructuredGridToUnstructuredGridFilter ); + + //! \brief Construct with all types of clipping turned off. + static VTKViewer_ExtractUnstructuredGrid *New(); + + enum EExtraction{ eCells, ePoints}; + //! Sets mode of extraction to \a theExtractionMode + void SetModeOfExtraction(EExtraction theExtractionMode){ + myExtractionMode = theExtractionMode; Modified(); + } + //! Get Extraction mode (Return: \a myExtractionMode field) + EExtraction GetModeOfExtraction(){ return myExtractionMode;} + + enum EChanging{ ePassAll, eAdding, eRemoving}; + //! Sets mode of changing to \a theChangeMode + void SetModeOfChanging(EChanging theChangeMode){ + myChangeMode = theChangeMode; + Modified(); + } + //! Return \a myChangeMode field + EChanging GetModeOfChanging(){ return myChangeMode;} + + //! Add cell id to \a myCellIds std::set + void RegisterCell(vtkIdType theCellId); + //! Check if myCellIds is empty. + int IsCellsRegistered() { return !myCellIds.empty();} + //! Remove the cell from the output + void ClearRegisteredCells() { + myCellIds.clear(); + Modified(); + } + + //! Add cell type to \a myCellTypes std::set + void RegisterCellsWithType(vtkIdType theCellType); + //! Check if myCellTypes is empty. + int IsCellsWithTypeRegistered() { return !myCellTypes.empty();} + //! Remove every cells with the type from the output + void ClearRegisteredCellsWithType() { + myCellTypes.clear(); + Modified(); + } + + //! \brief Do the filter do some real work + int IsChanging() { return IsCellsRegistered() || IsCellsWithTypeRegistered();} + + //! \brief Do it keep the mapping between input's and output's UnstructuredGrid + void SetStoreMapping(int theStoreMapping); + //! Get \a myStoreMapping + int GetStoreMapping(){ return myStoreMapping;} + + //! Gets the input id by output id. + vtkIdType GetInputId(int theOutId) const; + //! Gets the output id by input id. + vtkIdType GetOutputId(int theInId) const; + + typedef std::vector TVectorId; + typedef std::map TMapId; + +protected: + VTKViewer_ExtractUnstructuredGrid(); + ~VTKViewer_ExtractUnstructuredGrid(); + + //! Main method, which calculate output + void Execute(); + + EExtraction myExtractionMode; + + EChanging myChangeMode; + typedef std::set TSetId; + TSetId myCellIds; + TSetId myCellTypes; + + bool myStoreMapping; + TVectorId myOut2InId; + TMapId myIn2OutId; + +private: + //! Not implemented. + VTKViewer_ExtractUnstructuredGrid(const VTKViewer_ExtractUnstructuredGrid&); + //! Not implemented. + void operator=(const VTKViewer_ExtractUnstructuredGrid&); +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif diff --git a/src/VTKViewer/VTKViewer_Filter.cxx b/src/VTKViewer/VTKViewer_Filter.cxx new file mode 100755 index 000000000..f33ea7bae --- /dev/null +++ b/src/VTKViewer/VTKViewer_Filter.cxx @@ -0,0 +1,69 @@ +// VTKViewer_Filter : Filter for VTK viewer +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_Filter.cxx +// Author : Sergey LITONIN +// Module : SALOME + +#include "VTKViewer_Filter.h" +using namespace std; + +IMPLEMENT_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(VTKViewer_Filter, MMgt_TShared) + +/*! + * \class VTKViewer_Filter + * Description : Base class of filters of for VTK viewer. Method IsValid \n + * should be redefined in derived classes + */ + +/*!Constructor.*/ +VTKViewer_Filter::VTKViewer_Filter() +{ + myActor = 0; +} + +/*!Virtual Destructor.*/ +VTKViewer_Filter::~VTKViewer_Filter() +{ +} + +/*!Check correctness of \a theCellId for actor \a theActor by + * call virtual method IsValid( const int theId ). + * \param theActor - actor + * \param theCellId - cell id. + * \retval TRUE - if cell id is valid, else false. + */ +bool VTKViewer_Filter::IsValid( VTKViewer_Actor* theActor, const int theCellId ) +{ + SetActor( theActor ); + return IsValid( theCellId ); +} + +/*!Virtual method.Set actor to \a theActor. + * \param theActor - actor. + */ +void VTKViewer_Filter::SetActor( VTKViewer_Actor* theActor ) +{ + myActor = theActor; +} diff --git a/src/VTKViewer/VTKViewer_Filter.h b/src/VTKViewer/VTKViewer_Filter.h new file mode 100755 index 000000000..7e72b8df5 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Filter.h @@ -0,0 +1,67 @@ +// SMESHGUI_Filter : Filter for VTK viewer +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_Filter.h +// Author : Sergey LITONIN +// Module : SALOME + +#ifndef VTKViewer_Filter_HeaderFile +#define VTKViewer_Filter_HeaderFile + +#include "VTKViewer.h" + +#include +#include + +class VTKViewer_Actor; + +DEFINE_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared); + +/* + Class : VTKViewer_Filter + Description : Base class of filters of for VTK viewer. Method IsValid + should be redefined in derived classes +*/ + +class VTKViewer_Filter : public MMgt_TShared +{ + +public: + VTKVIEWER_EXPORT VTKViewer_Filter(); + VTKVIEWER_EXPORT virtual ~VTKViewer_Filter(); + + VTKVIEWER_EXPORT bool IsValid( VTKViewer_Actor*, const int theId ); + VTKVIEWER_EXPORT virtual bool IsValid( const int theId ) const = 0; + VTKVIEWER_EXPORT virtual int GetId() const = 0; + VTKVIEWER_EXPORT virtual bool IsNodeFilter() const = 0; + + VTKVIEWER_EXPORT virtual void SetActor( VTKViewer_Actor* ); + +protected: + VTKViewer_Actor* myActor; + +public: + DEFINE_STANDARD_RTTI(VTKViewer_Filter) +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_Functor.h b/src/VTKViewer/VTKViewer_Functor.h new file mode 100644 index 000000000..7aa5630be --- /dev/null +++ b/src/VTKViewer/VTKViewer_Functor.h @@ -0,0 +1,59 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_ViewFrame.h +// Author : Nicolas REJNERI +// Module : SALOME +// $Header$ + +#ifndef VTKViewer_Functor_H +#define VTKViewer_Functor_H + +#include + +#include + +namespace VTK +{ + template struct TSetFunction + { + typedef void (TActor::* TAction)(TArg); + TAction myAction; + TStoreArg myArg; + TSetFunction(TAction theAction, TArg theArg) : myAction(theAction), myArg(theArg) + {} + void operator()(TActor* theActor) + { + (theActor->*myAction)(myArg); + } + }; + + template struct TSetVisibility: TSetFunction + { + TSetVisibility(TArg theArg): + TSetFunction(&TActor::SetVisibility,theArg) + {} + }; +} + +#endif diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx new file mode 100755 index 000000000..420c1a1d3 --- /dev/null +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -0,0 +1,825 @@ +// SALOME OBJECT : kernel of SALOME component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_GeometryFilter.cxx +// Author : Michael ZORIN +// Module : SALOME +// $Header$ + +#include "VTKViewer_GeometryFilter.h" +#include "VTKViewer_ConvexTool.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if defined __GNUC__ + #if __GNUC__ == 2 + #define __GNUC_2__ + #endif +#endif + +//#define USE_ROBUST_TRIANGULATION + +vtkCxxRevisionMacro(VTKViewer_GeometryFilter, "$Revision$"); +vtkStandardNewMacro(VTKViewer_GeometryFilter); + +VTKViewer_GeometryFilter +::VTKViewer_GeometryFilter(): + myShowInside(0), + myStoreMapping(0), + myIsWireframeMode(0) +{} + + +VTKViewer_GeometryFilter +::~VTKViewer_GeometryFilter() +{} + + +void +VTKViewer_GeometryFilter +::Execute() +{ + vtkDataSet *input= this->GetInput(); + vtkIdType numCells=input->GetNumberOfCells(); + + if (numCells == 0) + { + return; + } + + if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){ + this->UnstructuredGridExecute(); + return; + }else + vtkGeometryFilter::Execute(); +} + + +void +VTKViewer_GeometryFilter +::UnstructuredGridExecute() +{ + vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)this->GetInput(); + vtkCellArray *Connectivity = input->GetCells(); + // Check input + if ( Connectivity == NULL ) + { + vtkDebugMacro(<<"Nothing to extract"); + return; + } + + vtkIdType cellId; + int i; + int allVisible; + vtkIdType npts = 0; + vtkIdType *pts = 0; + vtkPoints *p = input->GetPoints(); + vtkIdType numCells=input->GetNumberOfCells(); + vtkPointData *pd = input->GetPointData(); + vtkCellData *cd = input->GetCellData(); + vtkPolyData *output = this->GetOutput(); + vtkPointData *outputPD = output->GetPointData(); + + VTKViewer_OrderedTriangulator anOrderedTriangulator; + VTKViewer_DelaunayTriangulator aDelaunayTriangulator; + + vtkCellData *outputCD = output->GetCellData(); + vtkGenericCell *cell = vtkGenericCell::New(); + + vtkIdList *cellIds = vtkIdList::New(); + vtkIdList *faceIds = vtkIdList::New(); + + char *cellVis; + vtkIdType newCellId; + int faceId, *faceVerts, numFacePts; + vtkFloatingPointType *x; + int PixelConvert[4], aNewPts[VTK_CELL_SIZE]; + // ghost cell stuff + unsigned char updateLevel = (unsigned char)(output->GetUpdateGhostLevel()); + unsigned char *cellGhostLevels = 0; + + PixelConvert[0] = 0; + PixelConvert[1] = 1; + PixelConvert[2] = 3; + PixelConvert[3] = 2; + + vtkDebugMacro(<<"Executing geometry filter for unstructured grid input"); + + vtkDataArray* temp = 0; + if (cd) + { + temp = cd->GetArray("vtkGhostLevels"); + } + if ( (!temp) || (temp->GetDataType() != VTK_UNSIGNED_CHAR) + || (temp->GetNumberOfComponents() != 1)) + { + vtkDebugMacro("No appropriate ghost levels field available."); + } + else + { + cellGhostLevels = ((vtkUnsignedCharArray*)temp)->GetPointer(0); + } + + // Determine nature of what we have to do + if ( (!this->CellClipping) && (!this->PointClipping) && + (!this->ExtentClipping) ) + { + allVisible = 1; + cellVis = NULL; + } + else + { + allVisible = 0; + cellVis = new char[numCells]; + } + + // Just pass points through, never merge + output->SetPoints(input->GetPoints()); + outputPD->PassData(pd); + + outputCD->CopyAllocate(cd,numCells,numCells/2); + + output->Allocate(numCells/4+1,numCells); + + // Loop over the cells determining what's visible + if (!allVisible) + { + for (cellId=0, Connectivity->InitTraversal(); + Connectivity->GetNextCell(npts,pts); + cellId++) + { + cellVis[cellId] = 1; + if ( this->CellClipping && cellId < this->CellMinimum || + cellId > this->CellMaximum ) + { + cellVis[cellId] = 0; + } + else + { + for (i=0; i < npts; i++) + { + x = p->GetPoint(pts[i]); + if ( (this->PointClipping && (pts[i] < this->PointMinimum || + pts[i] > this->PointMaximum) ) || + (this->ExtentClipping && + (x[0] < this->Extent[0] || x[0] > this->Extent[1] || + x[1] < this->Extent[2] || x[1] > this->Extent[3] || + x[2] < this->Extent[4] || x[2] > this->Extent[5] )) ) + { + cellVis[cellId] = 0; + break; + }//point/extent clipping + }//for each point + }//if point clipping needs checking + }//for all cells + }//if not all visible + + // Loop over all cells now that visibility is known + // (Have to compute visibility first for 3D cell boundarys) + int progressInterval = numCells/20 + 1; + if(myStoreMapping){ + myVTK2ObjIds.clear(); + myVTK2ObjIds.reserve(numCells); + } + for (cellId=0, Connectivity->InitTraversal(); + Connectivity->GetNextCell(npts,pts); + cellId++) + { + //Progress and abort method support + if ( !(cellId % progressInterval) ) + { + vtkDebugMacro(<<"Process cell #" << cellId); + this->UpdateProgress ((float)cellId/numCells); + } + + // Handle ghost cells here. Another option was used cellVis array. + if (cellGhostLevels && cellGhostLevels[cellId] > updateLevel) + { // Do not create surfaces in outer ghost cells. + continue; + } + + if (allVisible || cellVis[cellId]) //now if visible extract geometry + { + //special code for nonlinear cells - rarely occurs, so right now it + //is slow. + vtkIdType aCellType = input->GetCellType(cellId); + switch (aCellType) + { + case VTK_EMPTY_CELL: + break; + + case VTK_VERTEX: + case VTK_POLY_VERTEX: + newCellId = output->InsertNextCell(aCellType,npts,pts); + if(myStoreMapping){ + myVTK2ObjIds.push_back(cellId); //apo + } + outputCD->CopyData(cd,cellId,newCellId); + break; + + case VTK_LINE: + case VTK_POLY_LINE: + newCellId = output->InsertNextCell(aCellType,npts,pts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + break; + + case VTK_TRIANGLE: + case VTK_QUAD: + case VTK_POLYGON: + newCellId = output->InsertNextCell(aCellType,npts,pts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + break; + + case VTK_TRIANGLE_STRIP: + newCellId = output->InsertNextCell(aCellType,npts,pts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + break; + + case VTK_PIXEL: + newCellId = output->InsertNextCell(aCellType,npts,pts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + break; + + case VTK_CONVEX_POINT_SET: { + bool anIsOk = anOrderedTriangulator.Execute(input, + cd, + cellId, + myShowInside, + allVisible, + cellVis, + output, + outputCD, + myStoreMapping, + myVTK2ObjIds, + true); + if(!anIsOk) + aDelaunayTriangulator.Execute(input, + cd, + cellId, + myShowInside, + allVisible, + cellVis, + output, + outputCD, + myStoreMapping, + myVTK2ObjIds, + false); + + break; + } + case VTK_TETRA: { + for (faceId = 0; faceId < 4; faceId++) + { + faceIds->Reset(); + faceVerts = vtkTetra::GetFaceArray(faceId); + faceIds->InsertNextId(pts[faceVerts[0]]); + faceIds->InsertNextId(pts[faceVerts[1]]); + faceIds->InsertNextId(pts[faceVerts[2]]); + aCellType = VTK_TRIANGLE; + numFacePts = 3; + input->GetCellNeighbors(cellId, faceIds, cellIds); + if ( cellIds->GetNumberOfIds() <= 0 || myShowInside || + (!allVisible && !cellVis[cellIds->GetId(0)]) ) + { + for ( i=0; i < numFacePts; i++) + aNewPts[i] = pts[faceVerts[i]]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + break; + } + case VTK_VOXEL: { + for (faceId = 0; faceId < 6; faceId++) + { + faceIds->Reset(); + faceVerts = vtkVoxel::GetFaceArray(faceId); + faceIds->InsertNextId(pts[faceVerts[0]]); + faceIds->InsertNextId(pts[faceVerts[1]]); + faceIds->InsertNextId(pts[faceVerts[2]]); + faceIds->InsertNextId(pts[faceVerts[3]]); + aCellType = VTK_QUAD; + numFacePts = 4; + input->GetCellNeighbors(cellId, faceIds, cellIds); + if ( cellIds->GetNumberOfIds() <= 0 || myShowInside || + (!allVisible && !cellVis[cellIds->GetId(0)]) ) + { + for ( i=0; i < numFacePts; i++) + aNewPts[i] = pts[faceVerts[PixelConvert[i]]]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + break; + } + case VTK_HEXAHEDRON: { + for (faceId = 0; faceId < 6; faceId++) + { + faceIds->Reset(); + faceVerts = vtkHexahedron::GetFaceArray(faceId); + faceIds->InsertNextId(pts[faceVerts[0]]); + faceIds->InsertNextId(pts[faceVerts[1]]); + faceIds->InsertNextId(pts[faceVerts[2]]); + faceIds->InsertNextId(pts[faceVerts[3]]); + aCellType = VTK_QUAD; + numFacePts = 4; + input->GetCellNeighbors(cellId, faceIds, cellIds); + if ( cellIds->GetNumberOfIds() <= 0 || myShowInside || + (!allVisible && !cellVis[cellIds->GetId(0)]) ) + { + for ( i=0; i < numFacePts; i++) + aNewPts[i] = pts[faceVerts[i]]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + break; + } + case VTK_WEDGE: { + for (faceId = 0; faceId < 5; faceId++) + { + faceIds->Reset(); + faceVerts = vtkWedge::GetFaceArray(faceId); + faceIds->InsertNextId(pts[faceVerts[0]]); + faceIds->InsertNextId(pts[faceVerts[1]]); + faceIds->InsertNextId(pts[faceVerts[2]]); + aCellType = VTK_TRIANGLE; + numFacePts = 3; + if (faceVerts[3] >= 0) + { + faceIds->InsertNextId(pts[faceVerts[3]]); + aCellType = VTK_QUAD; + numFacePts = 4; + } + input->GetCellNeighbors(cellId, faceIds, cellIds); + if ( cellIds->GetNumberOfIds() <= 0 || myShowInside || + (!allVisible && !cellVis[cellIds->GetId(0)]) ) + { + for ( i=0; i < numFacePts; i++) + aNewPts[i] = pts[faceVerts[i]]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + break; + } + case VTK_PYRAMID: { + for (faceId = 0; faceId < 5; faceId++) + { + faceIds->Reset(); + faceVerts = vtkPyramid::GetFaceArray(faceId); + faceIds->InsertNextId(pts[faceVerts[0]]); + faceIds->InsertNextId(pts[faceVerts[1]]); + faceIds->InsertNextId(pts[faceVerts[2]]); + aCellType = VTK_TRIANGLE; + numFacePts = 3; + if (faceVerts[3] >= 0) + { + faceIds->InsertNextId(pts[faceVerts[3]]); + aCellType = VTK_QUAD; + numFacePts = 4; + } + input->GetCellNeighbors(cellId, faceIds, cellIds); + if ( cellIds->GetNumberOfIds() <= 0 || myShowInside || + (!allVisible && !cellVis[cellIds->GetId(0)]) ) + { + for ( i=0; i < numFacePts; i++) + aNewPts[i] = pts[faceVerts[i]]; + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + break; + } + //Quadratic cells + case VTK_QUADRATIC_EDGE: + case VTK_QUADRATIC_TRIANGLE: + case VTK_QUADRATIC_QUAD: + case VTK_QUADRATIC_TETRA: + case VTK_QUADRATIC_HEXAHEDRON: + if(!myIsWireframeMode){ + input->GetCell(cellId,cell); + vtkIdList *pts = vtkIdList::New(); + vtkPoints *coords = vtkPoints::New(); + vtkIdList *cellIds = vtkIdList::New(); + vtkIdType newCellId; + + if ( cell->GetCellDimension() == 1 ) { + aCellType = VTK_LINE; + numFacePts = 2; + cell->Triangulate(0,pts,coords); + for (i=0; i < pts->GetNumberOfIds(); i+=2) { + aNewPts[0] = pts->GetId(i); + aNewPts[1] = pts->GetId(i+1); + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + else if ( cell->GetCellDimension() == 2 ) { + aCellType = VTK_TRIANGLE; + numFacePts = 3; + cell->Triangulate(0,pts,coords); + for (i=0; i < pts->GetNumberOfIds(); i+=3) { + aNewPts[0] = pts->GetId(i); + aNewPts[1] = pts->GetId(i+1); + aNewPts[2] = pts->GetId(i+2); + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + else //3D nonlinear cell + { + aCellType = VTK_TRIANGLE; + numFacePts = 3; + for (int j=0; j < cell->GetNumberOfFaces(); j++){ + vtkCell *face = cell->GetFace(j); + input->GetCellNeighbors(cellId, face->PointIds, cellIds); + if ( cellIds->GetNumberOfIds() <= 0 || myShowInside ) { + face->Triangulate(0,pts,coords); + for (i=0; i < pts->GetNumberOfIds(); i+=3) { + aNewPts[0] = pts->GetId(i); + aNewPts[1] = pts->GetId(i+1); + aNewPts[2] = pts->GetId(i+2); + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + outputCD->CopyData(cd,cellId,newCellId); + } + } + } + } //3d cell + cellIds->Delete(); + coords->Delete(); + pts->Delete(); + break; + }else{ + switch(aCellType){ + case VTK_QUADRATIC_EDGE: { + aCellType = VTK_POLY_LINE; + numFacePts = 3; + + aNewPts[0] = pts[0]; + aNewPts[2] = pts[1]; + aNewPts[1] = pts[2]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + break; + } + case VTK_QUADRATIC_TRIANGLE: { + aCellType = VTK_POLYGON; + numFacePts = 6; + + aNewPts[0] = pts[0]; + aNewPts[1] = pts[3]; + aNewPts[2] = pts[1]; + aNewPts[3] = pts[4]; + aNewPts[4] = pts[2]; + aNewPts[5] = pts[5]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + break; + } + case VTK_QUADRATIC_QUAD: { + aCellType = VTK_POLYGON; + numFacePts = 8; + + aNewPts[0] = pts[0]; + aNewPts[1] = pts[4]; + aNewPts[2] = pts[1]; + aNewPts[3] = pts[5]; + aNewPts[4] = pts[2]; + aNewPts[5] = pts[6]; + aNewPts[6] = pts[3]; + aNewPts[7] = pts[7]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + break; + } + case VTK_QUADRATIC_TETRA: { + aCellType = VTK_POLYGON; + numFacePts = 6; + + //--------------------------------------------------------------- + aNewPts[0] = pts[0]; + aNewPts[1] = pts[4]; + aNewPts[2] = pts[1]; + aNewPts[3] = pts[5]; + aNewPts[4] = pts[2]; + aNewPts[5] = pts[6]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[0]; + aNewPts[1] = pts[7]; + aNewPts[2] = pts[3]; + aNewPts[3] = pts[8]; + aNewPts[4] = pts[1]; + aNewPts[5] = pts[4]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[1]; + aNewPts[1] = pts[8]; + aNewPts[2] = pts[3]; + aNewPts[3] = pts[9]; + aNewPts[4] = pts[2]; + aNewPts[5] = pts[5]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[2]; + aNewPts[1] = pts[9]; + aNewPts[2] = pts[3]; + aNewPts[3] = pts[7]; + aNewPts[4] = pts[0]; + aNewPts[5] = pts[6]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + break; + } + case VTK_QUADRATIC_HEXAHEDRON: { + aCellType = VTK_POLYGON; + numFacePts = 8; + + //--------------------------------------------------------------- + aNewPts[0] = pts[0]; + aNewPts[1] = pts[8]; + aNewPts[2] = pts[1]; + aNewPts[3] = pts[17]; + aNewPts[4] = pts[5]; + aNewPts[5] = pts[12]; + aNewPts[6] = pts[4]; + aNewPts[7] = pts[16]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[1]; + aNewPts[1] = pts[9]; + aNewPts[2] = pts[2]; + aNewPts[3] = pts[18]; + aNewPts[4] = pts[6]; + aNewPts[5] = pts[13]; + aNewPts[6] = pts[5]; + aNewPts[7] = pts[17]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[2]; + aNewPts[1] = pts[10]; + aNewPts[2] = pts[3]; + aNewPts[3] = pts[19]; + aNewPts[4] = pts[7]; + aNewPts[5] = pts[14]; + aNewPts[6] = pts[6]; + aNewPts[7] = pts[18]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[3]; + aNewPts[1] = pts[11]; + aNewPts[2] = pts[0]; + aNewPts[3] = pts[16]; + aNewPts[4] = pts[4]; + aNewPts[5] = pts[15]; + aNewPts[6] = pts[7]; + aNewPts[7] = pts[19]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[0]; + aNewPts[1] = pts[8]; + aNewPts[2] = pts[1]; + aNewPts[3] = pts[9]; + aNewPts[4] = pts[2]; + aNewPts[5] = pts[10]; + aNewPts[6] = pts[3]; + aNewPts[7] = pts[11]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + //--------------------------------------------------------------- + aNewPts[0] = pts[4]; + aNewPts[1] = pts[12]; + aNewPts[2] = pts[5]; + aNewPts[3] = pts[13]; + aNewPts[4] = pts[6]; + aNewPts[5] = pts[14]; + aNewPts[6] = pts[7]; + aNewPts[7] = pts[15]; + + newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts); + if(myStoreMapping) + myVTK2ObjIds.push_back(cellId); + + outputCD->CopyData(cd,cellId,newCellId); + + break; + }} + } + } //switch + } //if visible + } //for all cells + + output->Squeeze(); + + vtkDebugMacro(<<"Extracted " << input->GetNumberOfPoints() << " points," + << output->GetNumberOfCells() << " cells."); + + cell->Delete(); + + cellIds->Delete(); + faceIds->Delete(); + + if ( cellVis ) + { + delete [] cellVis; + } +} + + +void +VTKViewer_GeometryFilter +::SetInside(int theShowInside) +{ + if(myShowInside == theShowInside) + return; + + myShowInside = theShowInside; + this->Modified(); +} + +int +VTKViewer_GeometryFilter +::GetInside() +{ + return myShowInside; +} + + +void +VTKViewer_GeometryFilter +::SetWireframeMode(int theIsWireframeMode) +{ + if(myIsWireframeMode == theIsWireframeMode) + return; + + myIsWireframeMode = theIsWireframeMode; + this->Modified(); +} + +int +VTKViewer_GeometryFilter +::GetWireframeMode() +{ + return myIsWireframeMode; +} + + +void +VTKViewer_GeometryFilter +::SetStoreMapping(int theStoreMapping) +{ + if(myStoreMapping == theStoreMapping) + return; + + myStoreMapping = theStoreMapping; + this->Modified(); +} + +int +VTKViewer_GeometryFilter +::GetStoreMapping() +{ + return myStoreMapping; +} + + +vtkIdType VTKViewer_GeometryFilter::GetElemObjId( int theVtkID ) +{ + if( myVTK2ObjIds.empty() || theVtkID > (int)myVTK2ObjIds.size() ) + return -1; +#if defined __GNUC_2__ + return myVTK2ObjIds[theVtkID]; +#else + return myVTK2ObjIds.at(theVtkID); +#endif +} diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.h b/src/VTKViewer/VTKViewer_GeometryFilter.h new file mode 100755 index 000000000..9c7425aa3 --- /dev/null +++ b/src/VTKViewer/VTKViewer_GeometryFilter.h @@ -0,0 +1,118 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_GEOMETRYFILTER_H +#define VTKVIEWER_GEOMETRYFILTER_H + +#include "VTKViewer.h" + +#include + +#include + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*! \brief This class used same as vtkGeometryFilter. See documentation on VTK for more information. + */ +class VTKVIEWER_EXPORT VTKViewer_GeometryFilter : public vtkGeometryFilter +{ +public: + /*! \fn static VTKViewer_GeometryFilter *New() + */ + static VTKViewer_GeometryFilter *New(); + + /*! \fn vtkTypeRevisionMacro(VTKViewer_GeometryFilter, vtkGeometryFilter) + * \brief VTK type revision macros. + */ + vtkTypeRevisionMacro(VTKViewer_GeometryFilter, vtkGeometryFilter); + /*! \fn void SetInside(int theShowInside) + * \brief Sets \a myShowInside flag. \a myShowInside is changed, call this->Modified(). + * \param theShowInside - used for changing value of \a myShowInside variable. + */ + void SetInside(int theShowInside); + /*! \fn int GetInside() + * \brief Return value of \a myShowInside + * \retval myShowInside + */ + int GetInside(); + /*! \fn void SetWireframeMode(int theIsWireframeMode) + * \brief Sets \a myIsWireframeMode flag. \a myIsWireframeMode is changed, call this->Modified(). + * \param theIsWireframeMode - used for changing value of \a myIsWireframeMode variable. + */ + void SetWireframeMode(int theIsWireframeMode); + /*! \fn int GetWireframeMode() + * \brief Return value of \a myIsWireframeMode + * \retval myIsWireframeMode + */ + int GetWireframeMode(); + /*! \fn void SetStoreMapping(int theStoreMapping); + * \brief Sets \a myStoreMapping flag and call this->Modified() + * \param theStoreMapping - used for changing value of \a myStoreMapping variable. + */ + void SetStoreMapping(int theStoreMapping); + /*! \fn int GetStoreMapping() + * \brief Return value of \a myStoreMapping + * \retval myStoreMapping + */ + int GetStoreMapping(); + /*! \fn virtual vtkIdType GetNodeObjId(int theVtkID) + * \brief Return input value theVtkID + * \retval theVtkID + */ + virtual vtkIdType GetNodeObjId(int theVtkID) { return theVtkID;} + /*! \fn virtual vtkIdType GetElemObjId(int theVtkID); + * \brief Return object ID by VTK ID cell + * \retval myVTK2ObjIds[theVtkID] + */ + virtual vtkIdType GetElemObjId(int theVtkID); + +protected: + /*! \fn VTKViewer_GeometryFilter(); + * \brief Constructor which sets \a myShowInside = 0 and \a myStoreMapping = 0 + */ + VTKViewer_GeometryFilter(); + /*! \fn ~VTKViewer_GeometryFilter(); + * \brief Destructor. + */ + ~VTKViewer_GeometryFilter(); + /*! \fn void Execute(); + * \brief Filter culculation method. + */ + void Execute(); + /*! \fn void UnstructuredGridExecute(); + * \brief Filter culculation method for data object type is VTK_UNSTRUCTURED_GRID. + */ + void UnstructuredGridExecute(); + +private: + typedef std::vector TVectorId; + +private: + TVectorId myVTK2ObjIds; + int myShowInside; + int myStoreMapping; + int myIsWireframeMode; +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif diff --git a/src/VTKViewer/VTKViewer_InteractorStyle.cxx b/src/VTKViewer/VTKViewer_InteractorStyle.cxx new file mode 100644 index 000000000..6bc13e78e --- /dev/null +++ b/src/VTKViewer/VTKViewer_InteractorStyle.cxx @@ -0,0 +1,1523 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_InteractorStyle.cxx +// Author : Christophe ATTANASIO +// Module : SALOME + +#include "VTKViewer_InteractorStyle.h" + +#include "VTKViewer_Actor.h" +#include "VTKViewer_Utilities.h" +#include "VTKViewer_Trihedron.h" +#include "VTKViewer_ViewWindow.h" +#include "VTKViewer_RenderWindow.h" +#include "VTKViewer_RenderWindowInteractor.h" + +//#include "SALOME_Actor.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +//VRV: porting on Qt 3.0.5 +#if QT_VERSION >= 0x030005 +#include +#endif +//VRV: porting on Qt 3.0.5 +#include + +//#include "utilities.h" + +using namespace std; + + +/* +static int GetEdgeId(vtkPicker *thePicker, SALOME_Actor *theActor, int theObjId){ + int anEdgeId = -1; + if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) { + float aPickPosition[3]; + thePicker->GetPickPosition(aPickPosition); + float aMinDist = 1000000.0, aDist = 0; + for (int i = 0, iEnd = aPickedCell->GetNumberOfEdges(); i < iEnd; i++){ + if(vtkLine* aLine = vtkLine::SafeDownCast(aPickedCell->GetEdge(i))){ + int subId; float pcoords[3], closestPoint[3], weights[3]; + aLine->EvaluatePosition(aPickPosition,closestPoint,subId,pcoords,aDist,weights); + if (aDist < aMinDist) { + aMinDist = aDist; + anEdgeId = i; + } + } + } + } + return anEdgeId; +} +*/ + +vtkStandardNewMacro(VTKViewer_InteractorStyle); + + +/*!Constructor.*/ +VTKViewer_InteractorStyle::VTKViewer_InteractorStyle() +{ + m_Trihedron = 0; + this->MotionFactor = 10.0; + this->State = VTK_INTERACTOR_STYLE_CAMERA_NONE; + this->RadianToDegree = 180.0 / vtkMath::Pi(); + this->ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE; + loadCursors(); + + myPreSelectionActor = VTKViewer_Actor::New(); + myPreSelectionActor->GetProperty()->SetColor(0,1,1); + myPreSelectionActor->GetProperty()->SetLineWidth(5); + myPreSelectionActor->GetProperty()->SetPointSize(5); + + OnSelectionModeChanged(); +} + + +/*!Destructor.*/ +VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle() +{ + m_ViewWnd->RemoveActor(myPreSelectionActor); +} + + +/*!Set preselection properties. + *\param theRed - red color. + *\param theGreen - green color. + *\param theBlue - blue color. + *\param theWidth - width.. + */ +void VTKViewer_InteractorStyle::setPreselectionProp(const double& theRed, const double& theGreen, + const double& theBlue, const int& theWidth) +{ + if ( myPreSelectionActor->GetProperty() == 0 ) + return; + myPreSelectionActor->GetProperty()->SetColor(theRed, theGreen, theBlue); + myPreSelectionActor->GetProperty()->SetLineWidth(theWidth); + myPreSelectionActor->GetProperty()->SetPointSize(theWidth); +} + + +/*!Set render window interactor + *\param theInteractor - interactor. + */ +void VTKViewer_InteractorStyle::SetInteractor(vtkRenderWindowInteractor *theInteractor){ + m_Interactor = dynamic_cast(theInteractor); + Superclass::SetInteractor(theInteractor); +} + + +/*!Set view window. + *\param theViewWnd - SALOME VTKViewer_ViewWindow + */ +void VTKViewer_InteractorStyle::setViewWnd(VTKViewer_ViewWindow* theViewWnd ){ + m_ViewWnd = theViewWnd; + m_ViewWnd->AddActor(myPreSelectionActor); + myPreSelectionActor->Delete(); +} + + +/*!Set GUI window. + *\param theWindow - QWidget window. + */ +void VTKViewer_InteractorStyle::setGUIWindow(QWidget* theWindow){ + myGUIWindow = theWindow; +} + + +/*!Set trihedron. + *\param theTrihedron - SALOME VTKViewer_Trihedron + */ +void VTKViewer_InteractorStyle::setTriedron(VTKViewer_Trihedron* theTrihedron){ + m_Trihedron = theTrihedron; +} + +/*!Rotate camera. + *\param dx - + *\param dy - + */ +void VTKViewer_InteractorStyle::RotateXY(int dx, int dy) +{ + double rxf; + double ryf; + vtkCamera *cam; + + if (this->CurrentRenderer == NULL) + { + return; + } + + int *size = this->CurrentRenderer->GetRenderWindow()->GetSize(); + this->DeltaElevation = -20.0 / size[1]; + this->DeltaAzimuth = -20.0 / size[0]; + + rxf = (double)dx * this->DeltaAzimuth * this->MotionFactor; + ryf = (double)dy * this->DeltaElevation * this->MotionFactor; + + cam = this->CurrentRenderer->GetActiveCamera(); + cam->Azimuth(rxf); + cam->Elevation(ryf); + cam->OrthogonalizeViewUp(); + ::ResetCameraClippingRange(this->CurrentRenderer); + //this->Interactor->Render(); + myGUIWindow->update(); +} + +void VTKViewer_InteractorStyle::PanXY(int x, int y, int oldX, int oldY) +{ + TranslateView(x, y, oldX, oldY); + //this->Interactor->Render(); + myGUIWindow->update(); +} + + +/*! Move the position of the camera along the direction of projection. (dx,dy)*/ +void VTKViewer_InteractorStyle::DollyXY(int dx, int dy) +{ + if (this->CurrentRenderer == NULL) return; + + double dxf = this->MotionFactor * (double)(dx) / (double)(this->CurrentRenderer->GetCenter()[1]); + double dyf = this->MotionFactor * (double)(dy) / (double)(this->CurrentRenderer->GetCenter()[1]); + + double zoomFactor = pow((double)1.1, dxf + dyf); + + vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera(); + if (aCam->GetParallelProjection()) + aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor); + else{ + aCam->Dolly(zoomFactor); + ::ResetCameraClippingRange(this->CurrentRenderer); + } + + //this->Interactor->Render(); + myGUIWindow->update(); +} + +void VTKViewer_InteractorStyle::SpinXY(int x, int y, int oldX, int oldY) +{ + vtkCamera *cam; + + if (this->CurrentRenderer == NULL) + { + return; + } + + double newAngle = atan2((double)(y - this->CurrentRenderer->GetCenter()[1]), + (double)(x - this->CurrentRenderer->GetCenter()[0])); + double oldAngle = atan2((double)(oldY -this->CurrentRenderer->GetCenter()[1]), + (double)(oldX - this->CurrentRenderer->GetCenter()[0])); + + newAngle *= this->RadianToDegree; + oldAngle *= this->RadianToDegree; + + cam = this->CurrentRenderer->GetActiveCamera(); + cam->Roll(newAngle - oldAngle); + cam->OrthogonalizeViewUp(); + + //this->Interactor->Render(); + myGUIWindow->update(); +} + + +/*!On mouse move event. + *\param ctrl - CTRL (not used) + *\param shift - SHIFT (on/off - integer 0/1) + *\param x - x coordinate + *\param y - y coordinate + */ +void VTKViewer_InteractorStyle::OnMouseMove(int vtkNotUsed(ctrl), + int shift, + int x, int y) +{ + myShiftState = shift; + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + onOperation(QPoint(x, y)); + else if (ForcedState == VTK_INTERACTOR_STYLE_CAMERA_NONE) + onCursorMove(QPoint(x, y)); +} + + +/*!On Left button down event. + *\param ctrl - CTRL (on/off - integer 0/1) + *\param shift - SHIFT (on/off - integer 0/1) + *\param x - x coordinate + *\param y - y coordinate + */ +void VTKViewer_InteractorStyle::OnLeftButtonDown(int ctrl, int shift, + int x, int y) +{ + if (this->HasObserver(vtkCommand::LeftButtonPressEvent)) { + this->InvokeEvent(vtkCommand::LeftButtonPressEvent,NULL); + return; + } + this->FindPokedRenderer(x, y); + if (this->CurrentRenderer == NULL) { + return; + } + myShiftState = shift; + // finishing current viewer operation + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + myOtherPoint = myPoint = QPoint(x, y); + if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + startOperation(ForcedState); + } else { + if (ctrl) + startOperation(VTK_INTERACTOR_STYLE_CAMERA_ZOOM); + else + startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT); + } + return; +} + + +/*!On left button up event. + *\param ctrl - CTRL (not used) + *\param shift - SHIFT (on/off - integer 0/1) + *\param x - x coordinate (not used) + *\param y - y coordinate (not used) + */ +void VTKViewer_InteractorStyle::OnLeftButtonUp(int vtkNotUsed(ctrl), + int shift, + int vtkNotUsed(x), + int vtkNotUsed(y)) +{ + myShiftState = shift; + // finishing current viewer operation + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } +} + + +/*!On left button up event. + *\param ctrl - CTRL (on/off - integer 0/1) + *\param shift - SHIFT (on/off - integer 0/1) + *\param x - x coordinate + *\param y - y coordinate + */ +void VTKViewer_InteractorStyle::OnMiddleButtonDown(int ctrl, + int shift, + int x, int y) +{ + if (this->HasObserver(vtkCommand::MiddleButtonPressEvent)) + { + this->InvokeEvent(vtkCommand::MiddleButtonPressEvent,NULL); + return; + } + this->FindPokedRenderer(x, y); + if (this->CurrentRenderer == NULL) + { + return; + } + myShiftState = shift; + // finishing current viewer operation + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + myOtherPoint = myPoint = QPoint(x, y); + if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + startOperation(ForcedState); + } + else { + if (ctrl) + startOperation(VTK_INTERACTOR_STYLE_CAMERA_PAN); + } +} + + +/*!On middle button up event. + *\param ctrl - CTRL (not used) + *\param shift - SHIFT (on/off - integer 0/1) + *\param x - x coordinate (not used) + *\param y - y coordinate (not used) + */ +void VTKViewer_InteractorStyle::OnMiddleButtonUp(int vtkNotUsed(ctrl), + int shift, + int vtkNotUsed(x), + int vtkNotUsed(y)) +{ + myShiftState = shift; + // finishing current viewer operation + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } +} + + +/*!On right button down event. + *\param ctrl - CTRL (on/off - integer 0/1) + *\param shift - SHIFT (on/off - integer 0/1) + *\param x - x coordinate + *\param y - y coordinate + */ +void VTKViewer_InteractorStyle::OnRightButtonDown(int ctrl, + int shift, + int x, int y) +{ + if (this->HasObserver(vtkCommand::RightButtonPressEvent)) + { + this->InvokeEvent(vtkCommand::RightButtonPressEvent,NULL); + return; + } + this->FindPokedRenderer(x, y); + if (this->CurrentRenderer == NULL) + { + return; + } + myShiftState = shift; + // finishing current viewer operation + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + myOtherPoint = myPoint = QPoint(x, y); + if (ForcedState != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + startOperation(ForcedState); + } + else { + if (ctrl) + startOperation(VTK_INTERACTOR_STYLE_CAMERA_ROTATE); + } +} + +/*!On right button up event. + *\param ctrl - CTRL (not used) + *\param shift - SHIFT (on/off - integer 0/1) + *\param x - x coordinate (not used) + *\param y - y coordinate (not used) + */ +void VTKViewer_InteractorStyle::OnRightButtonUp(int vtkNotUsed(ctrl), + int shift, + int vtkNotUsed(x), + int vtkNotUsed(y)) +{ + myShiftState = shift; + // finishing current viewer operation + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } +} + +/*! @name XPM - x pixmaps. */ +//@{ +/*!Image Zoom cursor*/ +const char* imageZoomCursor[] = { +"32 32 3 1", +". c None", +"a c #000000", +"# c #ffffff", +"................................", +"................................", +".#######........................", +"..aaaaaaa.......................", +"................................", +".............#####..............", +"...........##.aaaa##............", +"..........#.aa.....a#...........", +".........#.a.........#..........", +".........#a..........#a.........", +"........#.a...........#.........", +"........#a............#a........", +"........#a............#a........", +"........#a............#a........", +"........#a............#a........", +".........#...........#.a........", +".........#a..........#a.........", +".........##.........#.a.........", +"........#####.....##.a..........", +".......###aaa#####.aa...........", +"......###aa...aaaaa.......#.....", +".....###aa................#a....", +"....###aa.................#a....", +"...###aa...............#######..", +"....#aa.................aa#aaaa.", +".....a....................#a....", +"..........................#a....", +"...........................a....", +"................................", +"................................", +"................................", +"................................"}; + +/*!Image rotate cursor*/ +const char* imageRotateCursor[] = { +"32 32 3 1", +". c None", +"a c #000000", +"# c #ffffff", +"................................", +"................................", +"................................", +"................................", +"........#.......................", +".......#.a......................", +"......#######...................", +".......#aaaaa#####..............", +"........#..##.a#aa##........##..", +".........a#.aa..#..a#.....##.aa.", +".........#.a.....#...#..##.aa...", +".........#a.......#..###.aa.....", +"........#.a.......#a..#aa.......", +"........#a.........#..#a........", +"........#a.........#a.#a........", +"........#a.........#a.#a........", +"........#a.........#a.#a........", +".........#.........#a#.a........", +"........##a........#a#a.........", +"......##.a#.......#.#.a.........", +"....##.aa..##.....##.a..........", +"..##.aa.....a#####.aa...........", +"...aa.........aaa#a.............", +"................#.a.............", +"...............#.a..............", +"..............#.a...............", +"...............a................", +"................................", +"................................", +"................................", +"................................", +"................................"}; +//@} + +/*! Loads cursors for viewer operations - zoom, pan, etc...*/ +void VTKViewer_InteractorStyle::loadCursors() +{ + myDefCursor = QCursor(ArrowCursor); + myHandCursor = QCursor(PointingHandCursor); + myPanCursor = QCursor(SizeAllCursor); + myZoomCursor = QCursor(QPixmap(imageZoomCursor)); + myRotateCursor = QCursor(QPixmap(imageRotateCursor)); + mySpinCursor = QCursor(QPixmap(imageRotateCursor)); // temporarly !!!!!! + myGlobalPanCursor = QCursor(CrossCursor); + myCursorState = false; +} + + +/*! event filter - controls mouse and keyboard events during viewer operations*/ +bool VTKViewer_InteractorStyle::eventFilter(QObject* object, QEvent* event) +{ + if (!myGUIWindow) return false; + if ( (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::KeyPress) && object != myGUIWindow) + { + qApp->removeEventFilter(this); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + return QObject::eventFilter(object, event); +} + + +/*! starts Zoom operation (e.g. through menu command)*/ +void VTKViewer_InteractorStyle::startZoom() +{ + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + setCursor(VTK_INTERACTOR_STYLE_CAMERA_ZOOM); + ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ZOOM; + qApp->installEventFilter(this); +} + + +/*! starts Pan operation (e.g. through menu command)*/ +void VTKViewer_InteractorStyle::startPan() +{ + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + setCursor(VTK_INTERACTOR_STYLE_CAMERA_PAN); + ForcedState = VTK_INTERACTOR_STYLE_CAMERA_PAN; + qApp->installEventFilter(this); +} + +/*! starts Rotate operation (e.g. through menu command)*/ +void VTKViewer_InteractorStyle::startRotate() +{ + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + setCursor(VTK_INTERACTOR_STYLE_CAMERA_ROTATE); + ForcedState = VTK_INTERACTOR_STYLE_CAMERA_ROTATE; + qApp->installEventFilter(this); +} + + +/*! starts Spin operation (e.g. through menu command)*/ +void VTKViewer_InteractorStyle::startSpin() +{ + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + setCursor(VTK_INTERACTOR_STYLE_CAMERA_SPIN); + ForcedState = VTK_INTERACTOR_STYLE_CAMERA_SPIN; + qApp->installEventFilter(this); +} + + + +/*! starts Fit Area operation (e.g. through menu command)*/ +void VTKViewer_InteractorStyle::startFitArea() +{ + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + setCursor(VTK_INTERACTOR_STYLE_CAMERA_FIT); + ForcedState = VTK_INTERACTOR_STYLE_CAMERA_FIT; + qApp->installEventFilter(this); +} + + +/*!View fit all.*/ +void VTKViewer_InteractorStyle::ViewFitAll() { + int aTriedronWasVisible = false; + if(m_Trihedron){ + aTriedronWasVisible = m_Trihedron->GetVisibility() == VTKViewer_Trihedron::eOn; + if(aTriedronWasVisible) m_Trihedron->VisibilityOff(); + } + + if(m_Trihedron->GetVisibleActorCount(CurrentRenderer)){ + m_Trihedron->VisibilityOff(); + ::ResetCamera(CurrentRenderer); + }else{ + m_Trihedron->SetVisibility(VTKViewer_Trihedron::eOnlyLineOn); + ::ResetCamera(CurrentRenderer,true); + } + if(aTriedronWasVisible) m_Trihedron->VisibilityOn(); + else m_Trihedron->VisibilityOff(); + ::ResetCameraClippingRange(CurrentRenderer); +} + + +/*! starts Global Panning operation (e.g. through menu command)*/ +void VTKViewer_InteractorStyle::startGlobalPan() +{ + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + { + onFinishOperation(); + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + } + setCursor(VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN); + ForcedState = VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN; + + // store current zoom scale + vtkCamera *cam = this->CurrentRenderer->GetActiveCamera(); + myScale = cam->GetParallelScale(); + + ViewFitAll(); + + if (myGUIWindow) myGUIWindow->update(); + + qApp->installEventFilter(this); +} + + +/*!\retval TRUE if needs redrawing*/ +bool VTKViewer_InteractorStyle::needsRedrawing() +{ + return State == VTK_INTERACTOR_STYLE_CAMERA_ZOOM || + State == VTK_INTERACTOR_STYLE_CAMERA_PAN || + State == VTK_INTERACTOR_STYLE_CAMERA_ROTATE || + State == VTK_INTERACTOR_STYLE_CAMERA_SPIN || + State == VTK_INTERACTOR_STYLE_CAMERA_NONE; +} + + +/*! fits viewer contents to rectangle + *\param left - left side + *\param top - top side + *\param right - right side + *\param bottom - bottom side + */ +void VTKViewer_InteractorStyle::fitRect(const int left, + const int top, + const int right, + const int bottom) +{ + if (this->CurrentRenderer == NULL) return; + + // move camera + int x = (left + right)/2; + int y = (top + bottom)/2; + int *aSize = this->CurrentRenderer->GetRenderWindow()->GetSize(); + int oldX = aSize[0]/2; + int oldY = aSize[1]/2; + TranslateView(oldX, oldY, x, y); + + // zoom camera + double dxf = (double)(aSize[0]) / (double)(abs(right - left)); + double dyf = (double)(aSize[1]) / (double)(abs(bottom - top)); + double zoomFactor = (dxf + dyf)/2 ; + + vtkCamera *aCam = this->CurrentRenderer->GetActiveCamera(); + if(aCam->GetParallelProjection()) + aCam->SetParallelScale(aCam->GetParallelScale()/zoomFactor); + else{ + aCam->Dolly(zoomFactor); + ::ResetCameraClippingRange(this->CurrentRenderer); + } + + myGUIWindow->update(); +} + + +/*! starts viewer operation (!internal usage!)*/ +void VTKViewer_InteractorStyle::startOperation(int operation) +{ + switch(operation) + { + case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: + case VTK_INTERACTOR_STYLE_CAMERA_ZOOM: + case VTK_INTERACTOR_STYLE_CAMERA_PAN: + case VTK_INTERACTOR_STYLE_CAMERA_ROTATE: + case VTK_INTERACTOR_STYLE_CAMERA_SPIN: + case VTK_INTERACTOR_STYLE_CAMERA_FIT: + case VTK_INTERACTOR_STYLE_CAMERA_SELECT: + if (State != VTK_INTERACTOR_STYLE_CAMERA_NONE) + startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE); + State = operation; + if (State != VTK_INTERACTOR_STYLE_CAMERA_SELECT) + setCursor(operation); + onStartOperation(); + break; + case VTK_INTERACTOR_STYLE_CAMERA_NONE: + default: + setCursor(VTK_INTERACTOR_STYLE_CAMERA_NONE); + State = ForcedState = VTK_INTERACTOR_STYLE_CAMERA_NONE; + break; + } +} + + +/*! sets proper cursor for window when viewer operation is activated*/ +void VTKViewer_InteractorStyle::setCursor(const int operation) +{ + if (!myGUIWindow) return; + switch (operation) + { + case VTK_INTERACTOR_STYLE_CAMERA_ZOOM: + myGUIWindow->setCursor(myZoomCursor); + myCursorState = true; + break; + case VTK_INTERACTOR_STYLE_CAMERA_PAN: + myGUIWindow->setCursor(myPanCursor); + myCursorState = true; + break; + case VTK_INTERACTOR_STYLE_CAMERA_ROTATE: + myGUIWindow->setCursor(myRotateCursor); + myCursorState = true; + break; + case VTK_INTERACTOR_STYLE_CAMERA_SPIN: + myGUIWindow->setCursor(mySpinCursor); + myCursorState = true; + break; + case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: + myGUIWindow->setCursor(myGlobalPanCursor); + myCursorState = true; + break; + case VTK_INTERACTOR_STYLE_CAMERA_FIT: + case VTK_INTERACTOR_STYLE_CAMERA_SELECT: + myGUIWindow->setCursor(myHandCursor); + myCursorState = true; + break; + case VTK_INTERACTOR_STYLE_CAMERA_NONE: + default: + myGUIWindow->setCursor(myDefCursor); + myCursorState = false; + break; + } +} + + +/*! called when viewer operation started (!put necessary initialization here!)*/ +void VTKViewer_InteractorStyle::onStartOperation() +{ + if (!myGUIWindow) return; + // VSV: LOD actor activisation + // this->Interactor->GetRenderWindow()->SetDesiredUpdateRate(this->Interactor->GetDesiredUpdateRate()); + switch (State) { + case VTK_INTERACTOR_STYLE_CAMERA_SELECT: + case VTK_INTERACTOR_STYLE_CAMERA_FIT: + { + QPainter p(myGUIWindow); + p.setPen(Qt::lightGray); + p.setRasterOp(Qt::XorROP); + p.drawRect(QRect(myPoint, myOtherPoint)); + break; + } + case VTK_INTERACTOR_STYLE_CAMERA_ZOOM: + case VTK_INTERACTOR_STYLE_CAMERA_PAN: + case VTK_INTERACTOR_STYLE_CAMERA_ROTATE: + case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: + case VTK_INTERACTOR_STYLE_CAMERA_SPIN: + break; + } +} + + +/*! called when viewer operation finished (!put necessary post-processing here!)*/ +void VTKViewer_InteractorStyle::onFinishOperation() +{ + if (!myGUIWindow) return; + + +// SUIT_Study* aActiveStudy = SUIT_Application::getDesktop()->getActiveStudy(); +// SALOME_Selection* aSel = SALOME_Selection::Selection( aActiveStudy->getSelection() ); + + // VSV: LOD actor activisation + // rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate()); + +// Selection_Mode aSelectionMode = aSel->SelectionMode(); +// bool aSelActiveCompOnly = aSel->IsSelectActiveCompOnly(); + +/* switch (State) { + case VTK_INTERACTOR_STYLE_CAMERA_SELECT: + case VTK_INTERACTOR_STYLE_CAMERA_FIT: + { + QPainter p(myGUIWindow); + p.setPen(Qt::lightGray); + p.setRasterOp(Qt::XorROP); + QRect rect(myPoint, myOtherPoint); + p.drawRect(rect); + rect = rect.normalize(); + if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) { + // making fit rect opeation + int w, h; + m_Interactor->GetSize(w, h); + int x1, y1, x2, y2; + x1 = rect.left(); + y1 = h - rect.top() - 1; + x2 = rect.right(); + y2 = h - rect.bottom() - 1; + fitRect(x1, y1, x2, y2); + } + else { + if (myPoint == myOtherPoint) { + // process point selection + int w, h, x, y; + m_Interactor->GetSize(w, h); + x = myPoint.x(); + y = h - myPoint.y() - 1; + + this->FindPokedRenderer(x, y); + m_Interactor->StartPickCallback(); + + vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker()); + aPicker->Pick(x, y, 0.0, this->CurrentRenderer); + + SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor()); + + if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) { + int aVtkId = picker->GetCellId(); + if ( aVtkId >= 0 && SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) { + int anObjId = SActor->GetElemObjId(aVtkId); + if(anObjId >= 0){ + Handle(SALOME_InteractiveObject) IO = SActor->getIO(); + if(aSelectionMode != EdgeOfCellSelection) { + if(CheckDimensionId(aSelectionMode,SActor,anObjId)){ + if (IsSelected(IO,aSel)) { + // This IO is already in the selection + aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false ); + } else { + if (!myShiftState) { + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false ); + aSel->AddIObject( IO, false ); + } + } + }else{ + if (!myShiftState) { + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + int anEdgeId = GetEdgeId(picker,SActor,anObjId); + if (anEdgeId >= 0) { + aSel->AddOrRemoveIndex( IO, anObjId, true, false); + aSel->AddOrRemoveIndex( IO, -anEdgeId-1, true, true ); + aSel->AddIObject( IO, false ); + } + } + } + } else { + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + } else if ( vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker) ) { + int aVtkId = picker->GetPointId(); + if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) { + if ( SActor && SActor->hasIO() ) { + int anObjId = SActor->GetNodeObjId(aVtkId); + if(anObjId >= 0){ + Handle(SALOME_InteractiveObject) IO = SActor->getIO(); + if(IsSelected(IO,aSel)) { + // This IO is already in the selection + aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false ); + } else { + if(!myShiftState) { + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + aSel->AddOrRemoveIndex( IO, anObjId, myShiftState, false ); + aSel->AddIObject( IO, false ); + } + } + } + } else { + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + } else { + if ( SActor && SActor->hasIO() ) { + this->PropPicked++; + Handle(SALOME_InteractiveObject) IO = SActor->getIO(); + if(IsSelected(IO,aSel)) { + // This IO is already in the selection + if(myShiftState) { + aSel->RemoveIObject(IO); + } + } + else { + if(!myShiftState) { + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + aSel->AddIObject( IO, false ); + } + }else{ + // No selection clear all + this->PropPicked = 0; + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + } + m_Interactor->EndPickCallback(); + } else { + //processing rectangle selection + QString aComponentDataType = SUIT_Application::getDesktop()->getComponentDataType(); + if(aSelActiveCompOnly && aComponentDataType.isEmpty()) return; + m_Interactor->StartPickCallback(); + + if (!myShiftState) { + this->PropPicked = 0; + this->HighlightProp( NULL ); + aSel->ClearIObjects(); + } + + // Compute bounds + // vtkCamera *cam = this->CurrentRenderer->GetActiveCamera(); + QRect rect(myPoint, myOtherPoint); + rect = rect.normalize(); + int w, h; + m_Interactor->GetSize(w, h); + int x1, y1, x2, y2; + x1 = rect.left(); + y1 = h - rect.top() - 1; + x2 = rect.right(); + y2 = h - rect.bottom() - 1; + + switch (aSelectionMode) { + case NodeSelection: { + if ( vtkPointPicker* aPointPicker = vtkPointPicker::SafeDownCast(m_Interactor->GetPicker()) ) { + vtkActorCollection* aListActors = this->CurrentRenderer->GetActors(); + aListActors->InitTraversal(); + while (vtkActor* aActor = aListActors->GetNextActor()) { + if (!aActor->GetVisibility()) + continue; + if(SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aActor)) { + if (SActor->hasIO()) { + Handle(SALOME_InteractiveObject) IO = SActor->getIO(); + if (IO.IsNull()) + continue; + if (aSelActiveCompOnly && aComponentDataType != IO->getComponentDataType()) + continue; + if (vtkDataSet* aDataSet = SActor->GetInput()) { + SALOME_Selection::TContainerOfId anIndices; + for(int i = 0; i < aDataSet->GetNumberOfPoints(); i++) { + float aPoint[3]; + aDataSet->GetPoint(i,aPoint); + if (IsInRect(aPoint,x1,y1,x2,y2)){ + float aDisp[3]; + ComputeWorldToDisplay(aPoint[0],aPoint[1],aPoint[2],aDisp); + if(aPointPicker->Pick(aDisp[0],aDisp[1],0.0,CurrentRenderer)){ + if(vtkActorCollection *anActorCollection = aPointPicker->GetActors()){ + if(anActorCollection->IsItemPresent(SActor)){ + float aPickedPoint[3]; + aPointPicker->GetMapperPosition(aPickedPoint); + vtkIdType aVtkId = aDataSet->FindPoint(aPickedPoint); + if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ){ + int anObjId = SActor->GetNodeObjId(aVtkId); + anIndices.insert(anObjId); + } + } + } + } + } + } + if (!anIndices.empty()) { + aSel->AddOrRemoveIndex(IO, anIndices, true, false); + aSel->AddIObject(IO, false); + anIndices.clear(); + }else{ + aSel->RemoveIObject(IO, false); + } + } + } + } + } + } + break; + } + case CellSelection: + case EdgeOfCellSelection: + case EdgeSelection: + case FaceSelection: + case VolumeSelection: + { + vtkSmartPointer picker = VTKViewer_CellRectPicker::New(); + picker->SetTolerance(0.001); + picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer); + + vtkActorCollection* aListActors = picker->GetActors(); + aListActors->InitTraversal(); + while(vtkActor* aActor = aListActors->GetNextActor()) { + if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) { + if (aSActor->hasIO()) { + Handle(SALOME_InteractiveObject) aIO = aSActor->getIO(); + if (aSelActiveCompOnly && aComponentDataType != aIO->getComponentDataType()) + continue; + VTKViewer_CellDataSet cellList = picker->GetCellData(aActor); + if ( !cellList.empty() ) { + SALOME_Selection::TContainerOfId anIndexes; + VTKViewer_CellDataSet::iterator it; + for ( it = cellList.begin(); it != cellList.end(); ++it ) { + int aCellId = (*it).cellId; + + if ( !IsValid( aSActor, aCellId ) ) + continue; + + int anObjId = aSActor->GetElemObjId(aCellId); + if (anObjId != -1){ + if ( CheckDimensionId(aSelectionMode,aSActor,anObjId) ) { + anIndexes.insert(anObjId); + } + } + } + aSel->AddOrRemoveIndex(aIO, anIndexes, true, false); + aSel->AddIObject(aIO, false); + } + } + } + } + } + break; + case ActorSelection: // objects selection + { + vtkSmartPointer picker = VTKViewer_RectPicker::New(); + picker->SetTolerance(0.001); + picker->Pick(x1, y1, 0.0, x2, y2, 0.0, this->CurrentRenderer); + + vtkActorCollection* aListActors = picker->GetActors(); + SALOME_ListIO aListIO; + aListActors->InitTraversal(); + while(vtkActor* aActor = aListActors->GetNextActor()) { + if (SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)) { + if (aSActor->hasIO()) { + Handle(SALOME_InteractiveObject) aIO = aSActor->getIO(); + if (!IsStored(aIO,aListIO)) + aListIO.Append(aIO); + } + } + } + if (!aListIO.IsEmpty()) { + SALOME_ListIteratorOfListIO It(aListIO); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + this->PropPicked++; + aSel->AddIObject( IOS, false ); + } + } + } // end case 4 + } //end switch + m_Interactor->EndPickCallback(); + } + aActiveStudy->update3dViewers(); + } + } + break; + case VTK_INTERACTOR_STYLE_CAMERA_ZOOM: + case VTK_INTERACTOR_STYLE_CAMERA_PAN: + case VTK_INTERACTOR_STYLE_CAMERA_ROTATE: + case VTK_INTERACTOR_STYLE_CAMERA_SPIN: + break; + case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: + { + int w, h, x, y; + m_Interactor->GetSize(w, h); + x = myPoint.x(); + y = h - myPoint.y() - 1; + Place(x, y); + } + break; + } + if (myGUIWindow) myGUIWindow->update(); +*/ +} + +/*! called during viewer operation when user moves mouse (!put necessary processing here!)*/ +void VTKViewer_InteractorStyle::onOperation(QPoint mousePos) +{ + if (!myGUIWindow) return; + int w, h; + GetInteractor()->GetSize(w, h); + switch (State) { + case VTK_INTERACTOR_STYLE_CAMERA_PAN: + { + // processing panning + //this->FindPokedCamera(mousePos.x(), mousePos.y()); + this->PanXY(mousePos.x(), myPoint.y(), myPoint.x(), mousePos.y()); + myPoint = mousePos; + break; + } + case VTK_INTERACTOR_STYLE_CAMERA_ZOOM: + { + // processing zooming + //this->FindPokedCamera(mousePos.x(), mousePos.y()); + this->DollyXY(mousePos.x() - myPoint.x(), mousePos.y() - myPoint.y()); + myPoint = mousePos; + break; + } + case VTK_INTERACTOR_STYLE_CAMERA_ROTATE: + { + // processing rotation + //this->FindPokedCamera(mousePos.x(), mousePos.y()); + this->RotateXY(mousePos.x() - myPoint.x(), myPoint.y() - mousePos.y()); + myPoint = mousePos; + break; + } + case VTK_INTERACTOR_STYLE_CAMERA_SPIN: + { + // processing spinning + //this->FindPokedCamera(mousePos.x(), mousePos.y()); + this->SpinXY(mousePos.x(), mousePos.y(), myPoint.x(), myPoint.y()); + myPoint = mousePos; + break; + } + case VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN: + { + break; + } + case VTK_INTERACTOR_STYLE_CAMERA_SELECT: + { + if (!myCursorState) + setCursor(VTK_INTERACTOR_STYLE_CAMERA_SELECT); + } + case VTK_INTERACTOR_STYLE_CAMERA_FIT: + { + QPainter p(myGUIWindow); + p.setPen(Qt::lightGray); + p.setRasterOp(Qt::XorROP); + p.drawRect(QRect(myPoint, myOtherPoint)); + myOtherPoint = mousePos; + p.drawRect(QRect(myPoint, myOtherPoint)); + break; + } + } + this->LastPos[0] = mousePos.x(); + this->LastPos[1] = h - mousePos.y() - 1; +} + +/*! called when selection mode changed (!put necessary initialization here!)*/ +void VTKViewer_InteractorStyle::OnSelectionModeChanged() +{ + + myPreSelectionActor->SetVisibility(false); + myElemId = myEdgeId = myNodeId = -1; + mySelectedActor = NULL; +} + +/*! called when user moves mouse inside viewer window and there is no active viewer operation \n + * (!put necessary processing here!) + */ +void VTKViewer_InteractorStyle::onCursorMove(QPoint mousePos) { + // processing highlighting +// SUIT_Study* anActiveStudy = SUIT_Application::getDesktop()->getActiveStudy(); +// SALOME_Selection* Sel = SALOME_Selection::Selection( anActiveStudy->getSelection() ); +// Selection_Mode aSelectionMode = Sel->SelectionMode(); + +/* int w, h, x, y; + m_Interactor->GetSize(w, h); + x = mousePos.x(); y = h - mousePos.y() - 1; + + this->FindPokedRenderer(x,y); + m_Interactor->StartPickCallback(); + myPreSelectionActor->SetVisibility(false); + + vtkPicker* aPicker = vtkPicker::SafeDownCast(m_Interactor->GetPicker()); + aPicker->Pick(x, y, 0.0, this->CurrentRenderer); + + SALOME_Actor* SActor = SALOME_Actor::SafeDownCast(aPicker->GetActor()); + + if (vtkCellPicker* picker = vtkCellPicker::SafeDownCast(aPicker)) { + int aVtkId = picker->GetCellId(); + if ( aVtkId >= 0 ) { + int anObjId = SActor->GetElemObjId(aVtkId); + if ( SActor && SActor->hasIO() && IsValid( SActor, aVtkId ) ) { + bool anIsSameObjId = (mySelectedActor == SActor && myElemId == anObjId); + bool aResult = anIsSameObjId; + if(!anIsSameObjId) { + if(aSelectionMode != EdgeOfCellSelection) { + aResult = CheckDimensionId(aSelectionMode,SActor,anObjId); + if(aResult){ + mySelectedActor = SActor; + myElemId = anObjId; + m_Interactor->setCellData(anObjId,SActor,myPreSelectionActor); + } + } + } + if(aSelectionMode == EdgeOfCellSelection){ + int anEdgeId = GetEdgeId(picker,SActor,anObjId); + bool anIsSameEdgeId = (myEdgeId != anEdgeId) && anIsSameObjId; + aResult = anIsSameEdgeId; + if(!anIsSameEdgeId) { + aResult = (anEdgeId >= 0); + if (aResult) { + mySelectedActor = SActor; + myEdgeId = anEdgeId; + myElemId = anObjId; + m_Interactor->setEdgeData(anObjId,SActor,-anEdgeId-1,myPreSelectionActor); + } + } + } + if(aResult) { + myPreSelectionActor->GetProperty()->SetRepresentationToSurface(); + myPreSelectionActor->SetVisibility(true); + } + } + } + } + else if (vtkPointPicker* picker = vtkPointPicker::SafeDownCast(aPicker)) { + int aVtkId = picker->GetPointId(); + if ( aVtkId >= 0 && IsValid( SActor, aVtkId, true ) ) { + if ( SActor && SActor->hasIO() ) { + int anObjId = SActor->GetNodeObjId(aVtkId); + bool anIsSameObjId = (mySelectedActor == SActor && myNodeId == anObjId); + if(!anIsSameObjId) { + mySelectedActor = SActor; + myNodeId = anObjId; + m_Interactor->setPointData(anObjId,SActor,myPreSelectionActor); + } + myPreSelectionActor->GetProperty()->SetRepresentationToSurface(); + myPreSelectionActor->SetVisibility(true); + } + } + } + else if ( vtkPicker::SafeDownCast(aPicker) ) { + if ( SActor ) { + if ( myPreViewActor != SActor ) { + if ( myPreViewActor != NULL ) { + myPreViewActor->SetPreSelected( false ); + } + myPreViewActor = SActor; + + if ( SActor->hasIO() ) { + Handle( SALOME_InteractiveObject) IO = SActor->getIO(); + if ( !IsSelected(IO,Sel) ) { + // Find All actors with same IO + vtkActorCollection* theActors = this->CurrentRenderer->GetActors(); + theActors->InitTraversal(); + while( vtkActor *ac = theActors->GetNextActor() ) { + if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) { + if ( anActor->hasIO() ) { + Handle(SALOME_InteractiveObject) IOS = anActor->getIO(); + if(IO->isSame(IOS)) { + anActor->SetPreSelected( true ); + } + } + } + } + } + } + } + } else { + myPreViewActor = NULL; + vtkActorCollection* theActors = this->CurrentRenderer->GetActors(); + theActors->InitTraversal(); + while( vtkActor *ac = theActors->GetNextActor() ) { + if ( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) ) { + anActor->SetPreSelected( false ); + } + } + } + } + m_Interactor->EndPickCallback(); + //m_Interactor->Render(); + myGUIWindow->update(); + + this->LastPos[0] = x; + this->LastPos[1] = y;*/ +} + +/*! called on finsh GlobalPan operation */ +void VTKViewer_InteractorStyle::Place(const int theX, const int theY) +{ + if (this->CurrentRenderer == NULL) { + return; + } + + //translate view + int *aSize = this->CurrentRenderer->GetRenderWindow()->GetSize(); + int centerX = aSize[0]/2; + int centerY = aSize[1]/2; + + TranslateView(centerX, centerY, theX, theY); + + // restore zoom scale + vtkCamera *cam = this->CurrentRenderer->GetActiveCamera(); + cam->SetParallelScale(myScale); + ::ResetCameraClippingRange(this->CurrentRenderer); + + if (myGUIWindow) myGUIWindow->update(); + +} + + + +/*! Translates view from Point to Point*/ +void VTKViewer_InteractorStyle::TranslateView(int toX, int toY, int fromX, int fromY) +{ + vtkCamera *cam = this->CurrentRenderer->GetActiveCamera(); + vtkFloatingPointType viewFocus[4], focalDepth, viewPoint[3]; + vtkFloatingPointType newPickPoint[4], oldPickPoint[4], motionVector[3]; + cam->GetFocalPoint(viewFocus); + + this->ComputeWorldToDisplay(viewFocus[0], viewFocus[1], + viewFocus[2], viewFocus); + focalDepth = viewFocus[2]; + + this->ComputeDisplayToWorld(vtkFloatingPointType(toX), vtkFloatingPointType(toY), + focalDepth, newPickPoint); + this->ComputeDisplayToWorld(vtkFloatingPointType(fromX),vtkFloatingPointType(fromY), + focalDepth, oldPickPoint); + + // camera motion is reversed + motionVector[0] = oldPickPoint[0] - newPickPoint[0]; + motionVector[1] = oldPickPoint[1] - newPickPoint[1]; + motionVector[2] = oldPickPoint[2] - newPickPoint[2]; + + cam->GetFocalPoint(viewFocus); + cam->GetPosition(viewPoint); + cam->SetFocalPoint(motionVector[0] + viewFocus[0], + motionVector[1] + viewFocus[1], + motionVector[2] + viewFocus[2]); + cam->SetPosition(motionVector[0] + viewPoint[0], + motionVector[1] + viewPoint[1], + motionVector[2] + viewPoint[2]); +} + + +/*! Checks: is the given Actor within display coordinates?*/ +bool VTKViewer_InteractorStyle::IsInRect(vtkActor* theActor, + const int left, const int top, + const int right, const int bottom) +{ + vtkFloatingPointType* aBounds = theActor->GetBounds(); + vtkFloatingPointType aMin[3], aMax[3]; + ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin); + ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax); + if (aMin[0] > aMax[0]) { + vtkFloatingPointType aBuf = aMin[0]; + aMin[0] = aMax[0]; + aMax[0] = aBuf; + } + if (aMin[1] > aMax[1]) { + vtkFloatingPointType aBuf = aMin[1]; + aMin[1] = aMax[1]; + aMax[1] = aBuf; + } + + return ((aMin[0]>left) && (aMax[0]bottom) && (aMax[1]GetBounds(); + vtkFloatingPointType aMin[3], aMax[3]; + ComputeWorldToDisplay(aBounds[0], aBounds[2], aBounds[4], aMin); + ComputeWorldToDisplay(aBounds[1], aBounds[3], aBounds[5], aMax); + if (aMin[0] > aMax[0]) { + vtkFloatingPointType aBuf = aMin[0]; + aMin[0] = aMax[0]; + aMax[0] = aBuf; + } + if (aMin[1] > aMax[1]) { + vtkFloatingPointType aBuf = aMin[1]; + aMin[1] = aMax[1]; + aMax[1] = aBuf; + } + + return ((aMin[0]>left) && (aMax[0]bottom) && (aMax[1]left) && (aPnt[0]bottom) && (aPnt[1]GetId() ] = theFilter; +} + +/*!Checks: is filter present (with id \a theId) + *\param theId - filter id. + */ +bool VTKViewer_InteractorStyle::IsFilterPresent( const int theId ) +{ + return myFilters.find( theId ) != myFilters.end(); +} + +/*!Remove filter with id \a theId. + *\param theId - filter id. + */ +void VTKViewer_InteractorStyle::RemoveFilter( const int theId ) +{ + if ( IsFilterPresent( theId ) ) + myFilters.erase( theId ); +} + +/*!Checks: is valid cell(node) with id \a theId in actor \a theActor. + *\param theActor - VTKViewer_Actor pointer. + *\param theId - cell id. + *\param theIsNode - boolean flag, if true - node, else - cell. + */ +bool VTKViewer_InteractorStyle::IsValid( VTKViewer_Actor* theActor, + const int theId, + const bool theIsNode ) +{ + std::map::const_iterator anIter; + for ( anIter = myFilters.begin(); anIter != myFilters.end(); ++anIter ) + { + const Handle(VTKViewer_Filter)& aFilter = anIter->second; + if ( theIsNode == aFilter->IsNodeFilter() && + !aFilter->IsValid( theActor, theId ) ) + return false; + } + return true; +} + +/*!Gets filter handle by filter id \a theId.*/ +Handle(VTKViewer_Filter) VTKViewer_InteractorStyle::GetFilter( const int theId ) +{ + return IsFilterPresent( theId ) ? myFilters[ theId ] : Handle(VTKViewer_Filter)(); +} + +/*!Increment pan. + *\param incrX - X coordinate increment. + *\param incrY - Y coordinate increment. + */ +void VTKViewer_InteractorStyle::IncrementalPan( const int incrX, const int incrY ) +{ + this->PanXY( incrX, incrY, 0, 0 ); +} + +/*!Increment zoom. + *\param incr - zoom increment. + */ +void VTKViewer_InteractorStyle::IncrementalZoom( const int incr ) +{ + this->DollyXY( incr, incr ); +} + +/*!Increment rotate. + *\param incrX - X coordinate increment. + *\param incrY - Y coordinate increment. + */ +void VTKViewer_InteractorStyle::IncrementalRotate( const int incrX, const int incrY ) +{ + this->RotateXY( incrX, -incrY ); +} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/VTKViewer/VTKViewer_InteractorStyle.h b/src/VTKViewer/VTKViewer_InteractorStyle.h new file mode 100644 index 000000000..b867f64b3 --- /dev/null +++ b/src/VTKViewer/VTKViewer_InteractorStyle.h @@ -0,0 +1,196 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_InteractorStyle.h +// Author : Christophe ATTANASIO +// Module : SALOME + +#ifndef __VTKViewer_InteractorStyle_h +#define __VTKViewer_InteractorStyle_h + +#include + +class vtkCell; +class vtkRenderWindowInteractor; + +#include +#include + +#include + +#include "VTKViewer.h" + +#include "VTKViewer_Filter.h" + +class VTKViewer_Actor; +class VTKViewer_Trihedron; +class VTKViewer_ViewWindow; +class VTKViewer_RenderWindowInteractor; + +#define VTK_INTERACTOR_STYLE_CAMERA_NONE 0 +#define VTK_INTERACTOR_STYLE_CAMERA_ROTATE 1 +#define VTK_INTERACTOR_STYLE_CAMERA_PAN 2 +#define VTK_INTERACTOR_STYLE_CAMERA_ZOOM 3 +#define VTK_INTERACTOR_STYLE_CAMERA_SPIN 4 +#define VTK_INTERACTOR_STYLE_CAMERA_FIT 5 +#define VTK_INTERACTOR_STYLE_CAMERA_SELECT 6 +#define VTK_INTERACTOR_STYLE_CAMERA_GLOBAL_PAN 7 + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*! Description:\n + * This class must be supplied with a vtkRenderWindowInteractor wrapper or\n + * parent. This class should not normally be instantiated by application\n + * programmers. + */ +class VTKVIEWER_EXPORT VTKViewer_InteractorStyle : public QObject, public vtkInteractorStyle +{ + public: + static VTKViewer_InteractorStyle *New(); + vtkTypeMacro(VTKViewer_InteractorStyle, vtkInteractorStyle); + + virtual void SetInteractor(vtkRenderWindowInteractor *theInteractor); + void setViewWnd(VTKViewer_ViewWindow* theViewWnd); + void setGUIWindow(QWidget* theWindow); + + void setTriedron(VTKViewer_Trihedron* theTrihedron); + void setPreselectionProp(const double& theRed = 0, const double& theGreen = 1, + const double& theBlue = 1, const int& theWidth = 5); + + // Generic event bindings must be overridden in subclasses + void OnMouseMove (int ctrl, int shift, int x, int y); + void OnLeftButtonDown(int ctrl, int shift, int x, int y); + void OnLeftButtonUp (int ctrl, int shift, int x, int y); + void OnMiddleButtonDown(int ctrl, int shift, int x, int y); + void OnMiddleButtonUp (int ctrl, int shift, int x, int y); + void OnRightButtonDown(int ctrl, int shift, int x, int y); + void OnRightButtonUp (int ctrl, int shift, int x, int y); + + void OnSelectionModeChanged(); + + void ViewFitAll(); + + void SetFilter( const Handle( VTKViewer_Filter)& ); + Handle(VTKViewer_Filter) GetFilter( const int ); + bool IsFilterPresent( const int ); + void RemoveFilter( const int ); + bool IsValid( VTKViewer_Actor* theActor, + const int theId, + const bool theIsNode = false ); + + void IncrementalPan ( const int incrX, const int incrY ); + void IncrementalZoom ( const int incr ); + void IncrementalRotate( const int incrX, const int incrY ); + + int CurrentState() const { return State; } + + protected: + VTKViewer_InteractorStyle(); + ~VTKViewer_InteractorStyle(); + VTKViewer_InteractorStyle(const VTKViewer_InteractorStyle&) {}; + void operator=(const VTKViewer_InteractorStyle&) {}; + + void RotateXY(int dx, int dy); + void PanXY(int x, int y, int oldX, int oldY); + void DollyXY(int dx, int dy); + void SpinXY(int dx, int dy, int oldX, int oldY); + void fitRect(const int left, const int top, const int right, const int bottom); + void Place(const int theX, const int theY); + void TranslateView(int toX, int toY, int fromX, int fromY); + bool IsInRect(vtkActor* theActor, + const int left, const int top, + const int right, const int bottom); + bool IsInRect(vtkCell* theCell, + const int left, const int top, + const int right, const int bottom); + bool IsInRect(vtkFloatingPointType* thePoint, + const int left, const int top, + const int right, const int bottom); + + int State; + vtkFloatingPointType MotionFactor; + vtkFloatingPointType RadianToDegree; // constant: for conv from deg to rad + double myScale; + + VTKViewer_Actor *myPreViewActor, *myPreSelectionActor, *mySelectedActor; + + int myElemId; + int myEdgeId; + int myNodeId; + + public: + bool eventFilter(QObject* object, QEvent* event); + void startZoom(); + void startPan(); + void startGlobalPan(); + void startRotate(); + void startFitArea(); + void startSpin(); + bool needsRedrawing(); + + protected: + void loadCursors(); + void startOperation(int operation); + virtual void onStartOperation(); + virtual void onFinishOperation(); + virtual void onOperation(QPoint mousePos); + virtual void onCursorMove(QPoint mousePos); + virtual void setCursor(const int operation); + + + protected: + QCursor myDefCursor; + QCursor myPanCursor; + QCursor myZoomCursor; + QCursor myRotateCursor; + QCursor mySpinCursor; + QCursor myHandCursor; + QCursor myGlobalPanCursor; + QPoint myPoint; + QPoint myOtherPoint; + bool myCursorState; + bool myShiftState; + int ForcedState; + + VTKViewer_RenderWindowInteractor* m_Interactor; + VTKViewer_ViewWindow* m_ViewWnd; + VTKViewer_Trihedron* m_Trihedron; + QWidget* myGUIWindow; + + std::map myFilters; + + /** @name members from old version*/ + //@{ + double DeltaElevation; + double DeltaAzimuth; + int LastPos[2]; + //@} +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif diff --git a/src/VTKViewer/VTKViewer_PassThroughFilter.cxx b/src/VTKViewer/VTKViewer_PassThroughFilter.cxx new file mode 100755 index 000000000..172976d7e --- /dev/null +++ b/src/VTKViewer/VTKViewer_PassThroughFilter.cxx @@ -0,0 +1,69 @@ +// SALOME FILTER : interactive object for VISU entities implementation +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SALOME_PassThroughFilter.cxx +// Author : Laurent CORNABE with help of Nicolas REJNERI +// Module : SALOME + + +#include "VTKViewer_PassThroughFilter.h" + +#include +#include +#include +#include + +vtkCxxRevisionMacro(VTKViewer_PassThroughFilter, "$Revision$"); +vtkStandardNewMacro(VTKViewer_PassThroughFilter); + +/*! \class VTKViewer_PassThroughFilter + * Passive filter take a dataset as input and create a dataset as output.\n + * The form of the input geometry is not changed in these filters, \n + * only the point attributes (e.g. scalars, vectors, etc.). + */ + +/*!Execute method.Output calculation.*/ +void VTKViewer_PassThroughFilter::Execute() +{ + vtkDataSet *input = static_cast(this->GetInput()); + vtkDataSet *output = static_cast(this->GetOutput()); + + // This has to be here because it initialized all field datas. + output->CopyStructure( input ); + + //! Pass all. (data object's field data is passed by the + //! superclass after this method) + output->GetPointData()->PassData( input->GetPointData() ); + output->GetCellData()->PassData( input->GetCellData() ); + +} + +/*!Methods invoked by print to print information about the object including superclasses.\n + * Typically not called by the user (use Print() instead) but used in the hierarchical \n + * print process to combine the output of several classes. + *\param os - output stream. + */ +void VTKViewer_PassThroughFilter::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os,indent); +} diff --git a/src/VTKViewer/VTKViewer_PassThroughFilter.h b/src/VTKViewer/VTKViewer_PassThroughFilter.h new file mode 100755 index 000000000..3e683348f --- /dev/null +++ b/src/VTKViewer/VTKViewer_PassThroughFilter.h @@ -0,0 +1,46 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_PASSTHROUGHFILTER_H +#define VTKVIEWER_PASSTHROUGHFILTER_H + +#include "VTKViewer.h" + +#include + +class VTKVIEWER_EXPORT VTKViewer_PassThroughFilter : public vtkDataSetToDataSetFilter +{ +public: + vtkTypeRevisionMacro( VTKViewer_PassThroughFilter, vtkDataSetToDataSetFilter ); + void PrintSelf( ostream& os, vtkIndent indent ); + + /*!Create a new VTKViewer_PassThroughFilter.*/ + static VTKViewer_PassThroughFilter *New(); + +protected: + VTKViewer_PassThroughFilter() {};//!< Null body. + virtual ~VTKViewer_PassThroughFilter() {};//!< Null body. + + void Execute(); + +private: + VTKViewer_PassThroughFilter( const VTKViewer_PassThroughFilter& ); //!< Not implemented. + void operator=( const VTKViewer_PassThroughFilter& ); //!< Not implemented. +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_RectPicker.cxx b/src/VTKViewer/VTKViewer_RectPicker.cxx new file mode 100755 index 000000000..d8f883b7a --- /dev/null +++ b/src/VTKViewer/VTKViewer_RectPicker.cxx @@ -0,0 +1,893 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_RectPicker.cxx +// Author : Natalia KOPNOVA +// Module : SALOME + +#include + +#include "vtkActor.h" +#include "vtkAssemblyNode.h" +#include "vtkAssemblyPath.h" +#include "vtkCamera.h" +#include "vtkCommand.h" +#include "vtkImageData.h" +#include "vtkLODProp3D.h" +#include "vtkMapper.h" +#include "vtkMath.h" +#include "vtkObjectFactory.h" +#include "vtkPoints.h" +#include "vtkProp3DCollection.h" +#include "vtkProperty.h" +#include "vtkRenderWindow.h" +#include "vtkRenderer.h" +#include "vtkTransform.h" +#include "vtkVertex.h" +#include "vtkVolume.h" +#include "vtkVolumeMapper.h" + +using namespace std; + + +vtkStandardNewMacro(VTKViewer_RectPicker); + + +/*!Constructor. Do nothing*/ +VTKViewer_RectPicker::VTKViewer_RectPicker() +{ +} + + +/*!Perform pick operation with selection rectangle provided. Normally the + * first two values for the selection top-left and right-bottom points are + * x-y pixel coordinate, and the third value is =0. + * \retval Return non-zero if something was successfully picked. + */ +int VTKViewer_RectPicker::Pick(float selectionX1, float selectionY1, float selectionZ1, + float selectionX2, float selectionY2, float selectionZ2, + vtkRenderer *renderer) +{ + int k, i; + vtkProp *prop; + vtkCamera *camera; + vtkAbstractMapper3D *mapper = NULL; + float p1World[4][4], p2World[4][4], p1Mapper[4][4], p2Mapper[4][4]; + float c1[3], c2[3]; + int picked=0; + int *winSize; + float x, y, t; + float *viewport; + float cameraPos[4], cameraFP[4]; + float *displayCoords, *worldCoords; + float pickPosition[4][3]; + double *clipRange; + float ray[4][3], rayLength[4]; + int pickable; + int LODId; + float windowLowerLeft[4], windowUpperRight[4]; + float bounds[6], tol; + float tF, tB; + float cameraDOP[3]; + + // Initialize picking process + this->Initialize(); + this->Renderer = renderer; + + /* Selection point is not defined for the rectangle + this->SelectionPoint[0] = + this->SelectionPoint[1] = + this->SelectionPoint[2] = + */ + + // Invoke start pick method if defined + this->InvokeEvent(vtkCommand::StartPickEvent,NULL); + + if ( renderer == NULL ) + { + vtkErrorMacro(<<"Must specify renderer!"); + return 0; + } + + // Get camera focal point and position. Convert to display (screen) + // coordinates. We need a depth value for z-buffer. + // + camera = renderer->GetActiveCamera(); + camera->GetPosition((float *)cameraPos); cameraPos[3] = 1.0; + camera->GetFocalPoint((float *)cameraFP); cameraFP[3] = 1.0; + + renderer->SetWorldPoint(cameraFP); + renderer->WorldToDisplay(); + displayCoords = renderer->GetDisplayPoint(); + selectionZ1 = selectionZ2 = displayCoords[2]; + + // Convert the selection rectangle into world coordinates. + // + renderer->SetDisplayPoint(selectionX1, selectionY1, selectionZ1); + renderer->DisplayToWorld(); + worldCoords = renderer->GetWorldPoint(); + if ( worldCoords[3] == 0.0 ) + { + vtkErrorMacro(<<"Bad homogeneous coordinates"); + return 0; + } + for (i=0; i < 3; i++) + { + pickPosition[0][i] = worldCoords[i] / worldCoords[3]; + } + + renderer->SetDisplayPoint(selectionX1, selectionY2, (selectionZ1+selectionZ2)/2); + renderer->DisplayToWorld(); + worldCoords = renderer->GetWorldPoint(); + if ( worldCoords[3] == 0.0 ) + { + vtkErrorMacro(<<"Bad homogeneous coordinates"); + return 0; + } + for (i=0; i < 3; i++) + { + pickPosition[1][i] = worldCoords[i] / worldCoords[3]; + } + + renderer->SetDisplayPoint(selectionX2, selectionY2, selectionZ2); + renderer->DisplayToWorld(); + worldCoords = renderer->GetWorldPoint(); + if ( worldCoords[3] == 0.0 ) + { + vtkErrorMacro(<<"Bad homogeneous coordinates"); + return 0; + } + for (i=0; i < 3; i++) + { + pickPosition[2][i] = worldCoords[i] / worldCoords[3]; + } + + renderer->SetDisplayPoint(selectionX2, selectionY1, (selectionZ1+selectionZ2)/2); + renderer->DisplayToWorld(); + worldCoords = renderer->GetWorldPoint(); + if ( worldCoords[3] == 0.0 ) + { + vtkErrorMacro(<<"Bad homogeneous coordinates"); + return 0; + } + for (i=0; i < 3; i++) + { + pickPosition[3][i] = worldCoords[i] / worldCoords[3]; + } + + // Compute the ray endpoints. The ray is along the line running from + // the camera position to the selection point, starting where this line + // intersects the front clipping plane, and terminating where this + // line intersects the back clipping plane. + for (k=0; k < 4; k++) { + for (i=0; i<3; i++) + { + ray[k][i] = pickPosition[k][i] - cameraPos[i]; + } + } + for (i=0; i<3; i++) + { + cameraDOP[i] = cameraFP[i] - cameraPos[i]; + } + + vtkMath::Normalize(cameraDOP); + + for (k=0; k < 4; k++) { + if (( rayLength[k] = vtkMath::Dot(cameraDOP,ray[k])) == 0.0 ) + { + vtkWarningMacro("Cannot process points"); + return 0; + } + } + + clipRange = camera->GetClippingRange(); + + if ( camera->GetParallelProjection() ) + { + for (k=0; k < 4; k++) { + tF = clipRange[0] - rayLength[k]; + tB = clipRange[1] - rayLength[k]; + for (i=0; i<3; i++) + { + p1World[k][i] = pickPosition[k][i] + tF*cameraDOP[i]; + p2World[k][i] = pickPosition[k][i] + tB*cameraDOP[i]; + } + p1World[k][3] = p2World[k][3] = 1.0; + } + } + else + { + for (k=0; k < 4; k++) { + tF = clipRange[0] / rayLength[k]; + tB = clipRange[1] / rayLength[k]; + for (i=0; i<3; i++) + { + p1World[k][i] = cameraPos[i] + tF*ray[k][i]; + p2World[k][i] = cameraPos[i] + tB*ray[k][i]; + } + p1World[k][3] = p2World[k][3] = 1.0; + } + } + + // Compute the center points of ray rectangle + for (i=0; i<3; i++) { + c1[i] = c2[i] = 0; + for (k=0; k<4; k++) { + c1[i] += p1World[k][i]; + c2[i] += p2World[k][i]; + } + c1[i] = c1[i]/4; + c2[i] = c2[i]/4; + } + + // Compute the tolerance in world coordinates. Do this by + // determining the world coordinates of the diagonal points of the + // window, computing the width of the window in world coordinates, and + // multiplying by the tolerance. + // + viewport = renderer->GetViewport(); + winSize = renderer->GetRenderWindow()->GetSize(); + x = winSize[0] * viewport[0]; + y = winSize[1] * viewport[1]; + renderer->SetDisplayPoint(x, y, selectionZ1); + renderer->DisplayToWorld(); + renderer->GetWorldPoint(windowLowerLeft); + + x = winSize[0] * viewport[2]; + y = winSize[1] * viewport[3]; + renderer->SetDisplayPoint(x, y, selectionZ2); + renderer->DisplayToWorld(); + renderer->GetWorldPoint(windowUpperRight); + + for (tol=0.0,i=0; i<3; i++) + { + tol += (windowUpperRight[i] - windowLowerLeft[i]) * + (windowUpperRight[i] - windowLowerLeft[i]); + } + + tol = sqrt (tol) * this->Tolerance; + + // Loop over all props. Transform ray (defined from position of + // camera to selection point) into coordinates of mapper (not + // transformed to actors coordinates! Reduces overall computation!!!). + // Note that only vtkProp3D's can be picked by vtkPicker. + // + vtkPropCollection *props; + vtkProp *propCandidate; + if ( this->PickFromList ) + { + props = this->GetPickList(); + } + else + { + props = renderer->GetProps(); + } + + vtkActor *actor; + vtkLODProp3D *prop3D; + vtkVolume *volume; + vtkAssemblyPath *path; + vtkProperty *tempProperty; + this->Transform->PostMultiply(); + for ( props->InitTraversal(); (prop=props->GetNextProp()); ) + { + for ( prop->InitPathTraversal(); (path=prop->GetNextPath()); ) + { + pickable = 0; + actor = NULL; + propCandidate = path->GetLastNode()->GetProp(); + if ( propCandidate->GetPickable() && propCandidate->GetVisibility() ) + { + pickable = 1; + if ( (actor=vtkActor::SafeDownCast(propCandidate)) != NULL ) + { + mapper = actor->GetMapper(); + if ( actor->GetProperty()->GetOpacity() <= 0.0 ) + { + pickable = 0; + } + } + else if ( (prop3D=vtkLODProp3D::SafeDownCast(propCandidate)) != NULL ) + { + LODId = prop3D->GetPickLODID(); + mapper = prop3D->GetLODMapper(LODId); + + // if the mapper is a vtkMapper (as opposed to a vtkVolumeMapper), + // then check the transparency to see if the object is pickable + if ( vtkMapper::SafeDownCast(mapper) != NULL) + { + prop3D->GetLODProperty(LODId, &tempProperty); + if ( tempProperty->GetOpacity() <= 0.0 ) + { + pickable = 0; + } + } + } + else if ( (volume=vtkVolume::SafeDownCast(propCandidate)) != NULL ) + { + mapper = volume->GetMapper(); + } + else + { + pickable = 0; //only vtkProp3D's (actors and volumes) can be picked + } + } + // If actor can be picked, get its composite matrix, invert it, and + // use the inverted matrix to transform the ray points into mapper + // coordinates. + if ( pickable && mapper != NULL ) + { + vtkMatrix4x4 *LastMatrix = path->GetLastNode()->GetMatrix(); + if (LastMatrix == NULL) + { + vtkErrorMacro (<< "Pick: Null matrix."); + return 0; + } + this->Transform->SetMatrix(LastMatrix); + this->Transform->Push(); + this->Transform->Inverse(); + + for (k=0; k < 4; k++) { + this->Transform->TransformPoint(p1World[k],p1Mapper[k]); + this->Transform->TransformPoint(p2World[k],p2Mapper[k]); + + for (i=0; i<3; i++) + { + ray[k][i] = p2Mapper[k][i] - p1Mapper[k][i]; + } + } + + this->Transform->Pop(); + + // Have the ray endpoints in mapper space, now need to compare this + // with the mapper bounds to see whether intersection is possible. + // + // Get the bounding box of the modeller. Note that the tolerance is + // added to the bounding box to make sure things on the edge of the + // bounding box are picked correctly. + mapper->GetBounds(bounds); + bounds[0] -= tol; bounds[1] += tol; + bounds[2] -= tol; bounds[3] += tol; + bounds[4] -= tol; bounds[5] += tol; + if ( HitBBox(bounds, p1Mapper, ray) ) { + t = this->IntersectWithHex(p1Mapper, p2Mapper, tol, path, + (vtkProp3D *)propCandidate, mapper); + if ( t >= 0.0 && t <= 1.0 /*t < VTK_LARGE_FLOAT*/ ) { + picked = 1; + this->Prop3Ds->AddItem((vtkProp3D *)prop); + this->PickedPositions->InsertNextPoint + ((1.0 - t)*c1[0] + t*c2[0], + (1.0 - t)*c1[1] + t*c2[1], + (1.0 - t)*c1[2] + t*c2[2]); + + // backwards compatibility: also add to this->Actors + if (actor) { + this->Actors->AddItem(actor); + } + } + } + + }//if visible and pickable not transparent and has mapper + }//for all parts + }//for all actors + + // Invoke end pick method if defined + this->InvokeEvent(vtkCommand::EndPickEvent,NULL); + + return picked; +} + +#define SIDE_LEFT 0 +#define SIDE_RIGHT 1 +#define SIDE_MIDDLE 2 + +float GetParameterValue(float start, float end, float point) +{ + if (start == end) return -VTK_LARGE_FLOAT; + return (point-start)/(end-start); +} + +void GetPointCoord(const float start[3], const float end[3], float t, float point[3]) +{ + int i; + for (i = 0; i < 3; i++) { + point[i] = start[i] + t*(end[i]-start[i]); + } +} + +char GetIntersectionPoint(const float start[3], const float end[3], + const int& index, const float p, float point[3]) +{ + float t = GetParameterValue(start[index], end[index], p); + char result = 0; + if (t >= 0.0 && t <= 1.0) { + result = 1; + GetPointCoord(start, end, t, point); + } + return result; +} + + +/*! Bounding box intersection with hexahedron. Origin[4][4] starts the ray from corner points, + * dir[4][3] is the vector components of the ray in the x-y-z directions. + * (Notes: the intersection ray dir[4][3] is NOT normalized.) + * \retval The method returns a non-zero value, if the bounding box is hit. + */ +char VTKViewer_RectPicker::HitBBox (float bounds[6], float origin[4][4], float dir[4][3]) +{ + int i, j, k, n; + float endray[4][3]; + + for (k = 0; k < 4; k++) { + for (i = 0; i < 3; i++) { + endray[k][i] = origin[k][i] + dir[k][i]; + } + } + + // Compute hex bounding box, center point and center direction + float hbounds[6], center[3], ray[3]; + for (i = 0; i < 3; i++) { + hbounds[2*i] = hbounds[2*i+1] = origin[0][i]; + center[i] = ray[i] = 0; + for (k = 0; k < 4; k++) { + center[i] += origin[k][i]; + ray[i] += endray[k][i]; + if (origin[k][i] < hbounds[2*i]) { + hbounds[2*i] = origin[k][i]; + } + else if (origin[k][i] > hbounds[2*i+1]) + hbounds[2*i+1] = origin[k][i]; + if (endray[k][i] < hbounds[2*i]) + hbounds[2*i] = endray[k][i]; + else if (endray[k][i] > hbounds[2*i+1]) + hbounds[2*i+1] = endray[k][i]; + } + center[i] = center[i]/4; + ray[i] = ray[i]/4; + ray[i] = ray[i] - center[i]; + } + + // Check for intersection between bouning boxes + for (i = 0; i < 3; i++) { + if (bounds[2*i+1] < hbounds[2*i] || bounds[2*i] > hbounds[2*i+1]) + return 0; + } + + // Check if one of the origin point lays inside bbox + char inside; + for (k = 0; k < 4; k++) { + inside = 1; + for (i = 0; i < 3; i++) { + if (origin[k][i] < bounds[2*i] || origin[k][i] > bounds[2*i+1]) { + inside = 0; + break; + } + } + if (inside) return 1; + } + + // Find the closest coord plane for the center point + char side[3]; + float coordPlane[3]; + inside = 1; + for (i = 0; i < 3; i++) { + if (center[i] < bounds[2*i]) { + inside = 0; + coordPlane[i] = bounds[2*i]; + side[i] = SIDE_LEFT; + } + else if (center[i] > bounds[2*i+1]) { + inside = 0; + coordPlane[i] = bounds[2*i+1]; + side[i] = SIDE_RIGHT; + } + else { + coordPlane[i] = (ray[i]<0.0) ? bounds[2*i] : bounds[2*i+1]; + side[i] = SIDE_MIDDLE; + } + } + if (inside) return 1; + + // Calculate parametric distances to the planes and find the max + float maxT[3]; + int whichPlane = 0; + char defined = 0; + for (i = 0; i < 3; i++) { + if (side[i] != SIDE_MIDDLE && ray[i] != 0.0) { + maxT[i] = (coordPlane[i]-center[i])/ray[i]; + defined = 1; + } + else + maxT[i] = -1.0; + } + for (i = 0; i < 3; i++) { + if (maxT[whichPlane] < maxT[i]) + whichPlane = i; + } + + // Check for intersection along the center ray + float coord; + if (maxT[whichPlane] <= 1.0 && maxT[whichPlane] >= 0.0) { + inside = 1; + for (i = 0; i < 3; i++) { + if (i != whichPlane) { + coord = center[i] + maxT[whichPlane]*ray[i]; + if (coord < bounds[2*i] || coord > bounds[2*i+1]) + inside = 0; + } + } + if (inside) return 1; + } + + // Define the intersection plane + if (!defined) { + for (i = 0; i < 3; i++) { + if (ray[i] != 0.0) { + maxT[i] = (coordPlane[i]-center[i])/ray[i]; + } + else + maxT[i] = VTK_LARGE_FLOAT; + } + for (i = 0; i < 3; i++) { + if (maxT[whichPlane] > maxT[i]) + whichPlane = i; + } + } + + // Compute the intersection between hex and coord plane + float t[4]; + for (k = 0; k < 4; k++) { + if (dir[k][whichPlane] != 0.0) { + t[k] = (coordPlane[whichPlane]-origin[k][whichPlane])/dir[k][whichPlane]; + } + else { + t[k] = VTK_LARGE_FLOAT; + } + } + + vtkPoints* aPoints = vtkPoints::New(); + float p[3], q[3], t1; + for (k = 0; k < 4; k++) { + n = (k+1)%4; // next point + if (t[k] > 1.0) { + if (t[n] < 1.0) { + // find intersection point + t1 = GetParameterValue(endray[k][whichPlane], endray[n][whichPlane], coordPlane[whichPlane]); + if (t1 > 0.0 && t1 < 1.0) { + GetPointCoord(endray[k], endray[n], t1, p); + aPoints->InsertNextPoint(p[0], p[1], p[2]); + } + } + if (t[n] < 0.0) { + // find second intersection point + t1 = GetParameterValue(origin[k][whichPlane], origin[n][whichPlane], coordPlane[whichPlane]); + if (t1 > 0.0 && t1 < 1.0) { + GetPointCoord(origin[k], origin[n], t1, p); + aPoints->InsertNextPoint(p[0], p[1], p[2]); + } + } + } + else if (t[k] < 0.0) { + if (t[n] > 0.0) { + // find intersection point + t1 = GetParameterValue(origin[k][whichPlane], origin[n][whichPlane], coordPlane[whichPlane]); + if (t1 > 0.0 && t1 < 1.0) { + GetPointCoord(origin[k], origin[n], t1, p); + aPoints->InsertNextPoint(p[0], p[1], p[2]); + } + } + } + else { + // find intersection point + GetPointCoord(origin[k], endray[k], t[k], p); + aPoints->InsertNextPoint(p[0], p[1], p[2]); + + if (t[n] < 0.0) { + // find second intersection point + t1 = GetParameterValue(origin[k][whichPlane], origin[n][whichPlane], coordPlane[whichPlane]); + if (t1 > 0.0 && t1 < 1.0) { + GetPointCoord(origin[k], origin[n], t1, p); + aPoints->InsertNextPoint(p[0], p[1], p[2]); + } + } + else if (t[n] > 1.0) { + // find second intersection point + t1 = GetParameterValue(endray[k][whichPlane], endray[n][whichPlane], coordPlane[whichPlane]); + if (t1 > 0.0 && t1 < 1.0) { + GetPointCoord(endray[k], endray[n], t1, p); + aPoints->InsertNextPoint(p[0], p[1], p[2]); + } + } + } + } + n = aPoints->GetNumberOfPoints(); + if (n == 0) { + aPoints->Delete(); + return 0; + } + + if (n == 1) { + aPoints->GetPoint(0, p); + inside = 1; + for (i = 0; i < 3; i++) { + if (i != whichPlane) { + if (p[i] < bounds[2*i] || p[i] > bounds[2*i+1]) { + inside = 0; break; + } + } + } + aPoints->Delete(); + return inside; + } + + // Analize intersection + int nearPlane, boundPlane = -1; + float boundCoord, boundMin, boundMax; + char intersect = 0; + for (k = 0; k < n; k++) { + aPoints->GetPoint(k, p); + j = k+1; if (j == n) j = 0; + aPoints->GetPoint(j, q); + inside = 1; + nearPlane = 0; + // if the point is inside bbox + for (i = 0; i < 3; i++) { + if (i != whichPlane) { + if (p[i] < bounds[2*i]) { + side[i] = SIDE_LEFT; + maxT[i] = GetParameterValue(p[i], q[i], bounds[2*i]); + inside = 0; + } + else if (p[i] > bounds[2*i+1]) { + side[i] = SIDE_RIGHT; + maxT[i] = GetParameterValue(p[i], q[i], bounds[2*i+1]); + inside = 0; + } + else { + side[i] = SIDE_MIDDLE; + maxT[i] = -1.0; + } + } + else maxT[i] = -1.0; + if (maxT[i] > maxT[nearPlane]) nearPlane = i; + } + if (inside) break; + // if segment intersects bbox + if (maxT[nearPlane] >= 0.0 && maxT[nearPlane] <= 1.0) { + for (i = 0; i < 3; i++) { + if (i != whichPlane && i != nearPlane) { + coord = p[i] + maxT[nearPlane]*(q[i]-p[i]); + if (coord >= bounds[2*i] && coord <= bounds[2*i+1]) { + intersect = 1; break; + } + } + } + // intersect with boundPlane + if (boundPlane == -1) { + boundCoord = p[nearPlane] + maxT[nearPlane]*(q[nearPlane]-p[nearPlane]); + boundPlane = nearPlane; + for (i = 0; i < 3; i++) { + if (i != whichPlane && i != boundPlane) { + coord = p[i] + maxT[nearPlane]*(q[i]-p[i]); + boundMin = boundMax = coord; + } + } + } + else { + t1 = GetParameterValue(p[boundPlane], q[boundPlane], boundCoord); + if (t1 >= 0.0 && t1 <= 1.0) { + for (i = 0; i < 3; i++) { + if (i != whichPlane && i != boundPlane) { + coord = p[i] + t1*(q[i]-p[i]); + if (coord < boundMin) boundMin = coord; + if (coord > boundMax) boundMax = coord; + } + } + } + } + } + if (intersect) break; + } + aPoints->Delete(); + if (inside || intersect) { + return 1; + } + + inside = 1; + for (i = 0; i < 3; i++) { + if (i != whichPlane && i != boundPlane) { + if (boundMin > bounds[2*i+1] || boundMax < bounds[2*i]) + inside = 0; + } + } + + return inside; +} + +/*! Position of point relative to hexahedron. p1[4][4] is the corner points of top face, + * p2[4][4] is the corner points of bottom face. + * \retval The method returns a non-zero value, if the point is inside. + */ +char VTKViewer_RectPicker::PointInside(float p[3], float p1[4][4], float p2[4][4], float tol) +{ + int j, k; + float t, coord[3]; + + // Fix one coordinate (x, for example) and + // compute intersection with coordinate plane + vtkPoints* aPoints = vtkPoints::New(); + int mode = 0; + for (k = 0; k < 4; k++) { + j = k+1; if (j == 4) j = 0; + switch (mode) { + case 0: + if (GetIntersectionPoint(p1[k], p1[j], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 0; + } + if (GetIntersectionPoint(p1[k], p2[k], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 1; + } + if (GetIntersectionPoint(p2[k], p2[j], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 2; + } + /* + if ((p1[k][0]-p[0])*(p2[k][0]-p[0]) <= 0) { + t = GetParameterValue(p1[k][0], p2[k][0], p[0]); + if (t >= 0.0 && t <= 1.0) { + GetPointCoord(p1[k], p2[k], t, coord); + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + } + } + */ + break; + case 1: + if (GetIntersectionPoint(p1[k], p2[k], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 1; + } + if (GetIntersectionPoint(p2[k], p2[j], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 2; + } + if (GetIntersectionPoint(p1[k], p1[j], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 0; + } + /* + if ((p1[k][0]-p[0])*(p1[j][0]-p[0]) <= 0) { + t = GetParameterValue(p1[k][0], p1[j][0], p[0]); + if (t > 0.0 && t < 1.0) { + GetPointCoord(p1[k], p1[j], t, coord); + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + } + } + */ + break; + case 2: + if (GetIntersectionPoint(p2[k], p2[j], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 2; + } + if (GetIntersectionPoint(p1[k], p2[k], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 1; + } + if (GetIntersectionPoint(p1[k], p1[j], 0, p[0], coord)) { + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + mode = 0; + } + /* + if ((p2[k][0]-p[0])*(p2[j][0]-p[0]) <= 0) { + t = GetParameterValue(p2[k][0], p2[j][0], p[0]); + if (t > 0.0 && t < 1.0) { + GetPointCoord(p2[k], p2[j], t, coord); + aPoints->InsertNextPoint(coord[0], coord[1], coord[2]); + } + } + */ + break; + } + } + int n = aPoints->GetNumberOfPoints(); + //cout << "---> Points in X projection " << n << endl; + if (n == 0) { + aPoints->Delete(); + return 0; + } + + // Fix the second coord and define bounds + float zMin = VTK_LARGE_FLOAT, zMax = -VTK_LARGE_FLOAT, z, ncoord[3]; + char inside = 0; + for (k = 0; k < n; k++) { + aPoints->GetPoint(k, coord); + //cout << " P" << k << " (" << coord[0] << ", " << coord[1] << ", " << coord[2] << ")"; + j = k+1; if (j == n) j = 0; + if (j == k) { + if (p[1] == coord[1] && p[2] == coord[2]) { + inside = 1; + } + break; + } + aPoints->GetPoint(j, ncoord); + t = GetParameterValue(coord[1], ncoord[1], p[1]); + if (t >= 0.0 && t <= 1) { + z = coord[2] + t*(ncoord[2]-coord[2]); + if (z < zMin) zMin = z; + if (z > zMax) zMax = z; + } + } + //cout << endl << " Zmin = " << zMin << ", Zmax = " << zMax << endl; + if (!inside) { + if (p[2] <= (zMax+tol) && p[2] >= (zMin-tol)) + inside = 1; + } + + aPoints->Delete(); + return inside; +} + +float VTKViewer_RectPicker::IntersectWithHex(float p1[4][4], float p2[4][4], float tol, + vtkAssemblyPath *path, vtkProp3D *prop3D, + vtkAbstractMapper3D *mapper) +{ + int i, k; + float *center, p0[3], ray[3], rayFactor, t; + + // Get the data from the modeler + // + center = mapper->GetCenter(); + + if (!PointInside(center, p1, p2)) { + return 2.0; + } + + // Determine appropriate info + // + for (i = 0; i < 3; i++) { + p0[i] = ray[i] = 0; + for (k = 0; k < 4; k++) { + p0[i] += p1[k][i]; + ray[i] += p2[k][i]; + } + p0[i] = p0[i]/4; + ray[i] = ray[i]/4; + ray[i] = ray[i] - p0[i]; + } + if (( rayFactor = vtkMath::Dot(ray,ray)) == 0.0 ) { + vtkErrorMacro("Cannot process points"); + return 2.0; + } + + // Project the center point onto the ray and determine its parametric value + // + t = (ray[0]*(center[0]-p0[0]) + ray[1]*(center[1]-p0[1]) + + ray[2]*(center[2]-p0[2])) / rayFactor; + + if ( t >= 0.0 && t <= 1.0 && t < this->GlobalTMin ) { + this->MarkPicked(path, prop3D, mapper, t, center); + } + return t; +} diff --git a/src/VTKViewer/VTKViewer_RectPicker.h b/src/VTKViewer/VTKViewer_RectPicker.h new file mode 100755 index 000000000..e20201630 --- /dev/null +++ b/src/VTKViewer/VTKViewer_RectPicker.h @@ -0,0 +1,78 @@ +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : VTKViewer_RectPicker.h +// Author : Natalia KOPNOVA +// Module : SALOME + +#ifndef __VTKViewer_RectPicker_h +#define __VTKViewer_RectPicker_h + +#include + +/*! \class vtkPicker + * \brief For more information see VTK documentation + */ +/*! \class VTKViewer_RectPicker + * \brief Rectangular picker class. + */ +class VTK_EXPORT VTKViewer_RectPicker : public vtkPicker +{ +public: + /*!Create new instance of VTKViewer_RectPicker.*/ + static VTKViewer_RectPicker *New(); + vtkTypeMacro(VTKViewer_RectPicker,vtkPicker); + + virtual int Pick(float selectionX1, float selectionY1, float selectionZ1, + float selectionX2, float selectionY2, float selectionZ2, + vtkRenderer *renderer); + + /*! + * Perform pick operation with selection rectangle provided. Normally the first + * two values for the selection top-left and right-bottom points are x-y pixel + * coordinate, and the third value is =0. + * \retval Return non-zero if something was successfully picked. + */ + int Pick(float selectionPt1[3], float selectionPt2[3], vtkRenderer *ren) + {return this->Pick(selectionPt1[0], selectionPt1[1], selectionPt1[2], + selectionPt2[0], selectionPt2[1], selectionPt2[2], + ren);}; + + static char HitBBox(float bounds[6], float origin[4][4], float dir[4][3]); + + static char PointInside(float point[3], float p1[4][4], float p2[4][4], float tol=0); + +protected: + VTKViewer_RectPicker(); + ~VTKViewer_RectPicker() {}; + + virtual float IntersectWithHex(float p1[4][4], float p2[4][4], float tol, + vtkAssemblyPath *path, vtkProp3D *p, + vtkAbstractMapper3D *m); + +private: +}; + +#endif + + diff --git a/src/VTKViewer/VTKViewer_RenderWindow.cxx b/src/VTKViewer/VTKViewer_RenderWindow.cxx new file mode 100755 index 000000000..82bcf80ec --- /dev/null +++ b/src/VTKViewer/VTKViewer_RenderWindow.cxx @@ -0,0 +1,162 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "VTKViewer_RenderWindow.h" + +#include +#include + +#include +#include + +#include +#include +#include +#ifndef WNT +#include +//#include +//#include +//#include +#endif + +#if QT_VERSION > 300 +#include +#endif + +/*!Constructor. Create render window with parant \a parent and name \a name. + *\param parent - parent window + *\param name - render window name. + */ +VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget* parent, const char* name) : +QWidget(parent, name, + Qt::WStyle_NoBorder | Qt::WDestructiveClose | + Qt::WResizeNoErase | Qt::WRepaintNoErase) +{ + myRW = vtkRenderWindow::New(); +#ifndef WNT + myRW->SetDisplayId((void*)x11Display()); +#endif + myRW->SetWindowId((void*)winId()); + myRW->DoubleBufferOn(); + setMouseTracking(true); +} + +/*!Destructor.*/ +VTKViewer_RenderWindow::~VTKViewer_RenderWindow() +{ + myRW->Delete(); +} + +/*!Call Render method for render window field.*/ +void VTKViewer_RenderWindow::paintEvent(QPaintEvent* theEvent) +{ + myRW->Render(); +} + +/*!Resize render window.*/ +void VTKViewer_RenderWindow::resizeEvent(QResizeEvent* theEvent) +{ + int aWidth = myRW->GetSize()[0], aHeight = myRW->GetSize()[1]; + if(vtkRenderWindowInteractor* aRWI = myRW->GetInteractor()) + aRWI->UpdateSize(width(), height()); + if(aWidth != width() || aHeight != height()){ + vtkRendererCollection * aRenderers = myRW->GetRenderers(); + aRenderers->InitTraversal(); + double aCoeff = 1.0; + if(vtkRenderer *aRenderer = aRenderers->GetNextItem()){ + vtkCamera *aCamera = aRenderer->GetActiveCamera(); + double aScale = aCamera->GetParallelScale(); + if((aWidth - width())*(aHeight - height()) > 0) + aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight)); + else + aCoeff = double(aWidth)/double(width()); + aCamera->SetParallelScale(aScale*aCoeff); + } + } +} + +/*!Emit mouse move event.*/ +void VTKViewer_RenderWindow::mouseMoveEvent(QMouseEvent* event) +{ + emit MouseMove(event) ; +} + +/*!Emit mouse button press event.*/ +void VTKViewer_RenderWindow::mousePressEvent(QMouseEvent* event) +{ + emit MouseButtonPressed( event ); +} + +/*!Emit mouse button release event.*/ +void VTKViewer_RenderWindow::mouseReleaseEvent( QMouseEvent *event ) +{ + emit MouseButtonReleased( event ); +} + +/*!Emit mouse button double click event.*/ +void VTKViewer_RenderWindow::mouseDoubleClickEvent( QMouseEvent* event ) +{ + emit MouseDoubleClicked( event ); +} + +/*!Emit key pressed event.*/ +void VTKViewer_RenderWindow::keyPressEvent (QKeyEvent* event) +{ + emit KeyPressed(event) ; +} + +/*!Emit key release event.*/ +void VTKViewer_RenderWindow::keyReleaseEvent (QKeyEvent * event) +{ + emit KeyReleased(event) ; +} + +/*!Emit wheel move event.*/ +void VTKViewer_RenderWindow::wheelEvent(QWheelEvent* event) +{ + emit WheelMoved(event) ; +} + +/*!Reaction on change background color.*/ +void VTKViewer_RenderWindow::onChangeBackgroundColor() +{ + //float red, green, blue; + vtkFloatingPointType backint[3]; + + vtkRendererCollection * theRenderers = myRW->GetRenderers(); + theRenderers->InitTraversal(); + vtkRenderer * theRenderer = theRenderers->GetNextItem(); + theRenderer->GetBackground(backint); + + QColor selColor = QColorDialog::getColor ( QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)), NULL ); + if ( selColor.isValid() ) { + theRenderer->SetBackground( selColor.red()/255., selColor.green()/255., selColor.blue()/255. ); + /* VSR : PAL5420 --------------------------------------------------- + SUIT_CONFIG->addSetting( "VTKViewer:BackgroundColorRed", selColor.red() ); + SUIT_CONFIG->addSetting( "VTKViewer:BackgroundColorGreen", selColor.green() ); + SUIT_CONFIG->addSetting( "VTKViewer:BackgroundColorBlue", selColor.blue() ); + VSR : PAL5420 --------------------------------------------------- */ + } +} + +/*!Emit content menu requested.*/ +void VTKViewer_RenderWindow::contextMenuEvent ( QContextMenuEvent * e ) +{ + if ( e->reason() != QContextMenuEvent::Mouse ) + emit contextMenuRequested( e ); +} diff --git a/src/VTKViewer/VTKViewer_RenderWindow.h b/src/VTKViewer/VTKViewer_RenderWindow.h new file mode 100755 index 000000000..e85b1c549 --- /dev/null +++ b/src/VTKViewer/VTKViewer_RenderWindow.h @@ -0,0 +1,97 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_RENDERWINDOW_H +#define VTKVIEWER_RENDERWINDOW_H + +#include "VTKViewer.h" + +#include + +#include + +class VTKVIEWER_EXPORT VTKViewer_RenderWindow : public QWidget +{ + Q_OBJECT + +public: + /* popup management */ + //void onCreatePopup(); + +// const char *GetClassName() {return "VTKViewer_RenderWindow";}; + +public: + VTKViewer_RenderWindow(QWidget *parent, const char *name); + virtual ~VTKViewer_RenderWindow() ; + + /*!Get render window pointer.*/ + vtkRenderWindow* getRenderWindow() { return myRW; } + + protected: + virtual void mouseMoveEvent( QMouseEvent* ); + virtual void mousePressEvent( QMouseEvent* ); + virtual void mouseReleaseEvent( QMouseEvent* ); + virtual void mouseDoubleClickEvent( QMouseEvent* ); + virtual void wheelEvent( QWheelEvent* ); + virtual void keyPressEvent( QKeyEvent* ); + virtual void keyReleaseEvent( QKeyEvent* ); + virtual void paintEvent( QPaintEvent* ); + virtual void resizeEvent( QResizeEvent* ); + virtual void onChangeBackgroundColor(); + virtual void contextMenuEvent( QContextMenuEvent * e ); + + signals: + /*!On mouse move signal.*/ + void MouseMove( QMouseEvent* ); + /*!On mouse button pressed signal.*/ + void MouseButtonPressed( QMouseEvent* ); + /*!On mouse button released signal.*/ + void MouseButtonReleased( QMouseEvent* ); + /*!On mouse double click signal.*/ + void MouseDoubleClicked( QMouseEvent* ); + /*!On wheel moved signal.*/ + void WheelMoved( QWheelEvent* ); + /*!On left button pressed signal.*/ + void LeftButtonPressed(const QMouseEvent *event) ; + /*!On left button released signal.*/ + void LeftButtonReleased(const QMouseEvent *event) ; + /*!On middle button pressed signal.*/ + void MiddleButtonPressed(const QMouseEvent *event) ; + /*!On middle button released signal.*/ + void MiddleButtonReleased(const QMouseEvent *event) ; + /*!On right button pressed signal.*/ + void RightButtonPressed(const QMouseEvent *event) ; + /*!On right button released signal.*/ + void RightButtonReleased(const QMouseEvent *event) ; + + /*!On button pressed signal.*/ + void ButtonPressed(const QMouseEvent *event); + /*!On button released signal.*/ + void ButtonReleased(const QMouseEvent *event); + /*!On key pressed signal.*/ + void KeyPressed( QKeyEvent* ); + /*!On key released signal.*/ + void KeyReleased( QKeyEvent* ); + /*!On content menu requested signal.*/ + void contextMenuRequested( QContextMenuEvent *e ); + + protected: + vtkRenderWindow* myRW; +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx new file mode 100755 index 000000000..9445c5b15 --- /dev/null +++ b/src/VTKViewer/VTKViewer_RenderWindowInteractor.cxx @@ -0,0 +1,685 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "VTKViewer_RenderWindowInteractor.h" +#include "VTKViewer_RenderWindow.h" +#include "VTKViewer_InteractorStyle.h" +#include "SUIT_ViewModel.h" +#include "VTKViewer_ViewWindow.h" + +//#include "SUIT_Application.h" +//#include "SUIT_Desktop.h" + +//#include "SALOME_Selection.h" +#include "VTKViewer_Actor.h" +#include "VTKViewer_Algorithm.h" +#include "VTKViewer_Functor.h" + +//#include +//#include +//#include +//#include + +// VTK Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// QT Includes +#include + +/*! Create new instance of VTKViewer_RenderWindowInteractor*/ +VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New() +{ + vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ; + if( ret ) { + return dynamic_cast(ret) ; + } + return new VTKViewer_RenderWindowInteractor; +} + +/*!Constructor.*/ +VTKViewer_RenderWindowInteractor::VTKViewer_RenderWindowInteractor() +{ + this->Enabled = 0 ; + this->mTimer = new QTimer( this ) ; + myDisplayMode = 0; + + myBasicPicker = vtkPicker::New(); + myCellPicker = vtkCellPicker::New(); + myPointPicker = vtkPointPicker::New(); + + myCellActor = VTKViewer_Actor::New(); + myCellActor->PickableOff(); + myCellActor->GetProperty()->SetColor(1,1,0); + myCellActor->GetProperty()->SetLineWidth(5); + myCellActor->GetProperty()->SetRepresentationToSurface(); + + myEdgeActor = VTKViewer_Actor::New(); + myEdgeActor->PickableOff(); + myEdgeActor->GetProperty()->SetColor(1,0,0); + myEdgeActor->GetProperty()->SetLineWidth(5); + myEdgeActor->GetProperty()->SetRepresentationToWireframe(); + + myPointActor = VTKViewer_Actor::New(); + myPointActor->PickableOff(); + myPointActor->GetProperty()->SetColor(1,1,0); + myPointActor->GetProperty()->SetPointSize(5); + myPointActor->GetProperty()->SetRepresentationToPoints(); + + connect(mTimer, SIGNAL(timeout()), this, SLOT(TimerFunc())) ; +} + +/*!Destructor.*/ +VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor() +{ + delete mTimer ; + + if ( GetRenderWindow() ) { + myViewWnd->RemoveActor(myCellActor); + myViewWnd->RemoveActor(myEdgeActor); + myViewWnd->RemoveActor(myPointActor); + } + + myCellActor->Delete(); + myEdgeActor->Delete(); + myPointActor->Delete(); + + myBasicPicker->Delete(); + myCellPicker->Delete(); + myPointPicker->Delete(); +} + +/*! + Print interactor to stream + \param os - stream + \param indent +*/ +void VTKViewer_RenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent) +{ + vtkRenderWindowInteractor::PrintSelf(os, indent) ; + // + // :NOTE: Fri Apr 21 21:51:05 2000 Pagey + // QGL specific stuff goes here. One should add output + // lines here if any protected members are added to + // the class. + // +} + +/*!Description:\n + * Initializes the event handlers without an XtAppContext. This is \n + * good for when you don`t have a user interface, but you still \n + * want to have mouse interaction.\n + * We never allow the VTKViewer_RenderWindowInteractor to control \n + * the event loop. The application always has the control. + */ +void VTKViewer_RenderWindowInteractor::Initialize() +{ + // + // We cannot do much unless there is a render window + // associated with this interactor. + // + if( ! RenderWindow ) { + vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize(): No render window attached!") ; + return ; + } + + // + // We cannot hand a render window which is not a VTKViewer_RenderWindow. + // One way to force this is to use dynamic_cast and hope that + // it works. If the dynamic_cast does not work, we flag an error + // and get the hell out. + // + vtkRenderWindow *my_render_win = dynamic_cast(RenderWindow) ; + if( !my_render_win ) { + vtkErrorMacro(<< "VTKViewer_RenderWindowInteractor::Initialize() can only handle VTKViewer_RenderWindow.") ; + return ; + } + + // + // If the render window has zero size, then set it to a default + // value of 300x300. + // + int* aSize = my_render_win->GetSize(); + this->Size[0] = ((aSize[0] > 0) ? aSize[0] : 300); + this->Size[1] = ((aSize[1] > 0) ? aSize[1] : 300); + + this->SetPicker(myBasicPicker); + + SetSelectionTolerance(); + + // + // Enable the interactor. + // + this->Enable() ; + + // + // Start the rendering of the window. + // + my_render_win->Start() ; + + // + // The interactor has been initialized. + // + this->Initialized = 1 ; + + return ; +} + +/*!Sets view window and add to it selection actors.*/ +void VTKViewer_RenderWindowInteractor::setViewWindow(VTKViewer_ViewWindow* theViewWnd){ + myViewWnd = theViewWnd; + + if ( myViewWnd ) { + myViewWnd->InsertActor(myCellActor); + myViewWnd->InsertActor(myEdgeActor); + myViewWnd->InsertActor(myPointActor); + } +} + +/*!Move selection actors to view window.*/ +void VTKViewer_RenderWindowInteractor::MoveInternalActors() +{ + myViewWnd->MoveActor(myCellActor); + myViewWnd->MoveActor(myEdgeActor); + myViewWnd->MoveActor(myPointActor); +} + +/*!Sets interactor style.*/ +void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *theInteractor){ + myInteractorStyle = dynamic_cast(theInteractor); + vtkRenderWindowInteractor::SetInteractorStyle(theInteractor); +} + +/*!Sets selection properties. + *\param theRed - red component of color + *\param theGreen - green component of color + *\param theBlue - blue component of color + *\param theWidth - point size and line width + */ +void VTKViewer_RenderWindowInteractor::SetSelectionProp(const double& theRed, const double& theGreen, + const double& theBlue, const int& theWidth) +{ + myCellActor->GetProperty()->SetColor(theRed, theGreen, theBlue); + myCellActor->GetProperty()->SetLineWidth(theWidth); + + myPointActor->GetProperty()->SetColor(theRed, theGreen, theBlue); + myPointActor->GetProperty()->SetPointSize(theWidth); +} + +/*!Sets selection tolerance + *\param theTolNodes - nodes selection tolerance + *\param theTolItems - selection tolerance for basic and cell pickers. + */ +void VTKViewer_RenderWindowInteractor::SetSelectionTolerance(const double& theTolNodes, const double& theTolItems) +{ + myTolNodes = theTolNodes; + myTolItems = theTolItems; + + myBasicPicker->SetTolerance(myTolItems); + myCellPicker->SetTolerance(myTolItems); + myPointPicker->SetTolerance(myTolNodes); + +} + +/*! Description:\n + * Enable/Disable interactions. By default interactors are enabled when \n + * initialized. Initialize() must be called prior to enabling/disabling \n + * interaction. These methods are used when a window/widget is being \n + * shared by multiple renderers and interactors. This allows a "modal" \n + * display where one interactor is active when its data is to be displayed \n + * and all other interactors associated with the widget are disabled \n + * when their data is not displayed. + */ +void VTKViewer_RenderWindowInteractor::Enable() +{ + // + // Do not need to do anything if already enabled. + // + if( this->Enabled ) { + return ; + } + + this->Enabled = 1 ; + this->Modified() ; +} + +/*!See Enable().*/ +void VTKViewer_RenderWindowInteractor::Disable() +{ + if( ! this->Enabled ) { + return ; + } + + this->Enabled = 0 ; + this->Modified() ; +} + +/*!Description:\n + * This will start up the X event loop and never return. If you \n + * call this method it will loop processing X events until the \n + * application is exited. + */ +void VTKViewer_RenderWindowInteractor::Start() +{ + // + // We do not allow this interactor to control the + // event loop. Only the QtApplication objects are + // allowed to do that. + // + vtkErrorMacro(<<"VTKViewer_RenderWindowInteractor::Start() not allowed to start event loop.") ; +} + +/*! Description:\n + * Event loop notification member for Window size change + */ +void VTKViewer_RenderWindowInteractor::UpdateSize(int w, int h) +{ + // if the size changed send this on to the RenderWindow + if ((w != this->Size[0])||(h != this->Size[1])) { + this->Size[0] = w; + this->Size[1] = h; + this->RenderWindow->SetSize(w,h); + } +} + +/*! Description: + * Timer methods must be overridden by platform dependent subclasses. + * flag is passed to indicate if this is first timer set or an update + * as Win32 uses repeating timers, whereas X uses One shot more timer + * if flag == VTKXI_TIMER_FIRST Win32 and X should createtimer + * otherwise Win32 should exit and X should perform AddTimeOut + * \retval 1 + */ +int VTKViewer_RenderWindowInteractor::CreateTimer(int vtkNotUsed(timertype)) +{ + /// + /// Start a one-shot timer for 10ms. + /// + mTimer->start(10, TRUE) ; + return 1 ; +} + +/*! + \sa CreateTimer(int ) + \retval 1 + */ +int VTKViewer_RenderWindowInteractor::DestroyTimer(void) +{ + // + // :TRICKY: Tue May 2 00:17:32 2000 Pagey + // + /*! QTimer will automatically expire after 10ms. So + * we do not need to do anything here. In fact, we + * should not even Stop() the QTimer here because doing + * this will skip some of the processing that the TimerFunc() + * does and will result in undesirable effects. For + * example, this will result in vtkLODActor to leave + * the models in low-res mode after the mouse stops + * moving. + */ + return 1 ; +} + +/*! Not all of these slots are needed in VTK_MAJOR_VERSION=3,\n + * but moc does not understand "#if VTK_MAJOR_VERSION". Hence, \n + * we have to include all of these for the time being. Once,\n + * this bug in MOC is fixed, we can separate these. + */ +void VTKViewer_RenderWindowInteractor::TimerFunc() +{ + if( ! this->Enabled ) { + return ; + } + + ((vtkInteractorStyle*)this->InteractorStyle)->OnTimer() ; + emit RenderWindowModified() ; +} + +/*!Emit render window modified on mouse move,\n + *if interactor style needs redrawing and render window enabled.*/ +void VTKViewer_RenderWindowInteractor::MouseMove(QMouseEvent *event) { + if( ! this->Enabled ) { + return ; + } + myInteractorStyle->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ; + if (myInteractorStyle->needsRedrawing() ) + emit RenderWindowModified() ; +} + +/*!Reaction on left button pressed.\n + *Same as left button down for interactor style.\n + *If render window enabled. + */ +void VTKViewer_RenderWindowInteractor::LeftButtonPressed(const QMouseEvent *event) { + if( ! this->Enabled ) { + return ; + } + myInteractorStyle->OnLeftButtonDown((event->state() & ControlButton), + (event->state() & ShiftButton), + event->x(), event->y()); +} + +/*!Reaction on left button releases.\n + *Same as left button up for interactor style.\n + *If render window enabled. + */ +void VTKViewer_RenderWindowInteractor::LeftButtonReleased(const QMouseEvent *event) { + if( ! this->Enabled ) { + return ; + } + myInteractorStyle->OnLeftButtonUp( (event->state() & ControlButton), + (event->state() & ShiftButton), + event->x(), event->y() ) ; +} + +/*!Reaction on middle button pressed.\n + *Same as middle button down for interactor style.\n + *If render window enabled. + */ +void VTKViewer_RenderWindowInteractor::MiddleButtonPressed(const QMouseEvent *event) { + if( ! this->Enabled ) { + return ; + } + myInteractorStyle->OnMiddleButtonDown((event->state() & ControlButton), + (event->state() & ShiftButton), + event->x(), event->y() ) ; +} + +/*!Reaction on middle button released.\n + *Same as middle button up for interactor style.\n + *If render window enabled. + */ +void VTKViewer_RenderWindowInteractor::MiddleButtonReleased(const QMouseEvent *event) { + if( ! this->Enabled ) { + return ; + } + myInteractorStyle->OnMiddleButtonUp( (event->state() & ControlButton), + (event->state() & ShiftButton), + event->x(), event->y() ) ; +} + +/*!Reaction on right button pressed.\n + *Same as right button down for interactor style.\n + *If render window enabled. + */ +void VTKViewer_RenderWindowInteractor::RightButtonPressed(const QMouseEvent *event) { + if( ! this->Enabled ) { + return ; + } + myInteractorStyle->OnRightButtonDown( (event->state() & ControlButton), + (event->state() & ShiftButton), + event->x(), event->y() ) ; +} + +/*!Reaction on right button released.\n + *Same as right button up for interactor style.If render window enabled.\n + *Emit context menu requested, if interactor style state equal VTK_INTERACTOR_STYLE_CAMERA_NONE. + */ +void VTKViewer_RenderWindowInteractor::RightButtonReleased(const QMouseEvent *event) { + if( ! this->Enabled ) { + return ; + } + bool isOperation = myInteractorStyle->CurrentState() != VTK_INTERACTOR_STYLE_CAMERA_NONE; + myInteractorStyle->OnRightButtonUp( (event->state() & ControlButton), + (event->state() & ShiftButton), + event->x(), event->y() ); + if ( !isOperation ) + { + QContextMenuEvent aEvent( QContextMenuEvent::Mouse, + event->pos(), event->globalPos(), + event->state() ); + emit contextMenuRequested( &aEvent ); + } +} + +/*!Reaction on button pressed. + *\warning Do nothing. + */ +void VTKViewer_RenderWindowInteractor::ButtonPressed(const QMouseEvent *event) { + return ; +} + +/*!Reaction on button released.. + *\warning Do nothing. + */ +void VTKViewer_RenderWindowInteractor::ButtonReleased(const QMouseEvent *event) { + return ; +} + +/*!Gets display mode.*/ +int VTKViewer_RenderWindowInteractor::GetDisplayMode() { + return myDisplayMode; +} + +/*!Sets display mode.*/ +void VTKViewer_RenderWindowInteractor::SetDisplayMode(int theMode) { + if(theMode == 0) + ChangeRepresentationToWireframe(); + else + ChangeRepresentationToSurface(); + myDisplayMode = theMode; +} + +/*!Change all actors to wireframe*/ +void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe() +{ + ChangeRepresentationToWireframe(GetRenderer()->GetActors()); +} + +/*!Change all actors to surface*/ +void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface() +{ + ChangeRepresentationToSurface(GetRenderer()->GetActors()); +} + +/*!Change all actors from \a theCollection to wireframe and + * emit render window modified. + */ +void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* theCollection) +{ + using namespace VTK; + ForEach(theCollection, + TSetFunction + (&VTKViewer_Actor::setDisplayMode,0)); + emit RenderWindowModified(); +} + +/*!Change all actors from \a theCollection to surface and + * emit render window modified. + */ +void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* theCollection) +{ + using namespace VTK; + ForEach(theCollection, + TSetFunction + (&VTKViewer_Actor::setDisplayMode,1)); + emit RenderWindowModified(); +} + +/*!Gets renderer.*/ +vtkRenderer* VTKViewer_RenderWindowInteractor::GetRenderer() +{ + vtkRendererCollection * theRenderers = this->RenderWindow->GetRenderers(); + theRenderers->InitTraversal(); + return theRenderers->GetNextItem(); +} + +/*!Do nothing*/ +void VTKViewer_RenderWindowInteractor::EraseAll() +{ +} + +/*!Display all actors. + *Sets visible for all actors from renderer collection and emit render window modified. + */ +void VTKViewer_RenderWindowInteractor::DisplayAll() +{ + using namespace VTK; + vtkActorCollection* aCollection = GetRenderer()->GetActors(); + ForEach(aCollection,TSetVisibility(true)); + + emit RenderWindowModified() ; +} + +/*!Do nothing*/ +void VTKViewer_RenderWindowInteractor::Erase( VTKViewer_Actor* SActor, bool update) +{ +} + +/*!Remove \a SActor from renderer and emit update window, if \a updateViewer - true*/ +void VTKViewer_RenderWindowInteractor::Remove( VTKViewer_Actor* SActor, bool updateViewer ) +{ + if ( SActor != 0 ) + { + GetRenderer()->RemoveProp( SActor ); + if ( updateViewer ) + emit RenderWindowModified(); + } +} + +/*!Remove actors from render window collection(not implemented). + *Emit render window modified, if \a updateViewer - true. + */ +void VTKViewer_RenderWindowInteractor::RemoveAll( const bool updateViewer ) +{ + vtkRenderer* aRenderer = GetRenderer(); + vtkActorCollection* anActors = aRenderer->GetActors(); + if ( anActors ) + { + anActors->InitTraversal(); + while ( vtkActor *anAct = anActors->GetNextActor() ) + { + if ( anAct->IsA( "VTKViewer_Actor" ) ) + { + } + } + + if ( updateViewer ) + emit RenderWindowModified(); + } +} + +/*!\brief Display the \a theActor.*/ +/*! Add actor to renderer and set visibility to true. + * Emit render window modified, if \a update - true. + */ +void VTKViewer_RenderWindowInteractor::Display( VTKViewer_Actor* theActor, bool update) +{ + GetRenderer()->AddActor(theActor); + theActor->SetVisibility(true); + + if(update) + emit RenderWindowModified(); +} + +/*! + default key press event (empty implementation) +*/ +void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event) +{ + /// NOT_IMPLEMENTED +} + +/*!Structure with one function "operator()", which call apply properties for actor.*/ +struct TUpdateAction{ + /*!Apply properties for \a theActor.*/ + void operator()(vtkActor* theActor){ + theActor->ApplyProperties(); + } +}; + +/*!Update all actors from renderer and emit render window modified.*/ +void VTKViewer_RenderWindowInteractor::Update() { + using namespace VTK; + vtkRenderer* aRen = GetRenderer(); + ForEach(aRen->GetActors(),TUpdateAction()); + + aRen->ResetCamera(); + + emit RenderWindowModified(); +} + +/*!Unhighlight all selection actors.*/ +void VTKViewer_RenderWindowInteractor::unHighlightSubSelection(){ + myPointActor->SetVisibility(false); + myEdgeActor->SetVisibility(false); + myCellActor->SetVisibility(false); +} + +/*!@see unHighlightSubSelection() + * Also emit render window modified. + */ +bool VTKViewer_RenderWindowInteractor::unHighlightAll(){ + unHighlightSubSelection(); + + emit RenderWindowModified() ; + return false; +} + + +/*! \li Sets actors data and sets visibility to true, if flag \a hilight - true, + * else sets visibility to false. + * \li Emit render window modified, if flag \a update - true. + */ +bool VTKViewer_RenderWindowInteractor::highlight(const TColStd_IndexedMapOfInteger& theMapIndex, + VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor, + TUpdateActor theFun, bool hilight, bool update) +{ + if(theMapIndex.Extent() == 0) return false; + + if (hilight) { + setActorData(theMapIndex,theMapActor,theActor,theFun); + theActor->SetVisibility(true); + } + else { + theActor->SetVisibility(false); + } + + if(update){ + this->RenderWindow->Render(); + emit RenderWindowModified() ; + } + + return false; +} + +/*!Sets actors data.*/ +void VTKViewer_RenderWindowInteractor::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex, + VTKViewer_Actor * theMapActor, + VTKViewer_Actor * theActor, + TUpdateActor theFun) +{ + (*theFun)(theMapIndex,theMapActor,theActor); + vtkFloatingPointType aPos[3]; + theMapActor->GetPosition(aPos); + theActor->SetPosition(aPos); +} diff --git a/src/VTKViewer/VTKViewer_RenderWindowInteractor.h b/src/VTKViewer/VTKViewer_RenderWindowInteractor.h new file mode 100755 index 000000000..435e5b4b8 --- /dev/null +++ b/src/VTKViewer/VTKViewer_RenderWindowInteractor.h @@ -0,0 +1,234 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_RENDERWINDOWINTERACTOR_H +#define VTKVIEWER_RENDERWINDOWINTERACTOR_H + +#include "VTKViewer.h" +#include "VTKViewer_Actor.h" + +#include +#include + +// Open CASCADE Includes +#include +#include +#include + +class vtkPicker; +class vtkCellPicker; +class vtkPointPicker; +class vtkActorCollection; + +class VTKViewer_Actor; +class VTKViewer_ViewWindow; +class VTKViewer_RenderWindow; +class VTKViewer_InteractorStyle; + +#include "VTKViewer_Algorithm.h" + +#include +#include +#include + +class VTKVIEWER_EXPORT VTKViewer_RenderWindowInteractor : public QObject, public vtkRenderWindowInteractor +{ + Q_OBJECT + +public: + static VTKViewer_RenderWindowInteractor *New(); + + vtkTypeMacro(VTKViewer_RenderWindowInteractor,vtkRenderWindowInteractor); + + void PrintSelf(ostream& os, vtkIndent indent); + + virtual void Initialize(); + + virtual void SetInteractorStyle(vtkInteractorObserver *); + /*!Return interactor style pointer.*/ + VTKViewer_InteractorStyle* GetInteractorStyle() const + { + return myInteractorStyle; + } + + virtual void Start(); + + virtual void Enable(); + virtual void Disable(); + + virtual void UpdateSize(int x,int y); + + /** @name Timer options*/ + //@{ + virtual int CreateTimer(int ) ; + virtual int DestroyTimer() ; + //@} + + /*! Description:\n + * This function is called on 'q','e' keypress if exitmethod is not\n + * specified and should be overidden by platform dependent subclasses\n + * to provide a termination procedure if one is required. + */ + virtual void TerminateApp(void) { /* empty */ } + + // Description: + // These methods correspond to the the Exit, User and Pick + // callbacks. They allow for the Style to invoke them. + //virtual void ExitCallback(); + //virtual void UserCallback(); + //virtual void StartPickCallback(); + //virtual void EndPickCallback(); + + /** @name Selection Management */ + //@{ + bool highlightCell(const TColStd_IndexedMapOfInteger& MapIndex, + VTKViewer_Actor* theMapActor, + bool hilight, + bool update = true ); + bool highlightEdge(const TColStd_IndexedMapOfInteger& MapIndex, + VTKViewer_Actor* theMapActor, + bool hilight, + bool update = true ); + bool highlightPoint(const TColStd_IndexedMapOfInteger& MapIndex, + VTKViewer_Actor* theMapActor, + bool hilight, + bool update = true ); + + void unHighlightSubSelection(); + bool unHighlightAll(); + + //void SetSelectionMode(Selection_Mode mode); + void SetSelectionProp(const double& theRed = 1, const double& theGreen = 1, + const double& theBlue = 0, const int& theWidth = 5); + void SetSelectionTolerance(const double& theTolNodes = 0.025, const double& theTolCell = 0.001); + //@} + + /** @name Displaymode management*/ + //@{ + int GetDisplayMode(); + void SetDisplayMode(int); + //@} + + /** @name Change all actors to wireframe or surface*/ + //@{ + void ChangeRepresentationToWireframe(); + void ChangeRepresentationToSurface(); + //@} + + /** @name Change to wireframe or surface a list of vtkactor*/ + //@{ + void ChangeRepresentationToWireframe(vtkActorCollection* ListofActors); + void ChangeRepresentationToSurface(vtkActorCollection* ListofActors); + //@} + + /** @name Erase Display functions*/ + //@{ + void EraseAll(); + void DisplayAll(); + void RemoveAll( const bool immediatly ); + + void Display( VTKViewer_Actor* SActor, bool immediatly = true ); + void Erase( VTKViewer_Actor* SActor, bool immediatly = true ); + void Remove( VTKViewer_Actor* SActor, bool updateViewer = true ); + //@} + + void Update(); + + vtkRenderer* GetRenderer(); + + void setViewWindow( VTKViewer_ViewWindow* theViewWnd ); + + void setCellData(const int& theIndex, + VTKViewer_Actor* theMapActor, + VTKViewer_Actor* theActor) {} + void setEdgeData(const int& theCellIndex, + VTKViewer_Actor* theMapActor, + const int& theEdgeIndex, + VTKViewer_Actor* theActor ) {} //NB + void setPointData(const int& theIndex, + VTKViewer_Actor* theMapActor, + VTKViewer_Actor* theActor) {} + + typedef void (*TUpdateActor)(const TColStd_IndexedMapOfInteger& theMapIndex, + VTKViewer_Actor* theMapActor, + VTKViewer_Actor* theActor); + protected: + + VTKViewer_RenderWindowInteractor(); + ~VTKViewer_RenderWindowInteractor(); + + VTKViewer_InteractorStyle* myInteractorStyle; + + bool highlight(const TColStd_IndexedMapOfInteger& theMapIndex, + VTKViewer_Actor* theMapActor, VTKViewer_Actor* theActor, + TUpdateActor theFun, bool hilight, bool update); + void setActorData(const TColStd_IndexedMapOfInteger& theMapIndex, + VTKViewer_Actor* theMapActor, + VTKViewer_Actor *theActor, + TUpdateActor theFun); + + /*! Timer used during various mouse events to figure + * out mouse movements. + */ + QTimer *mTimer ; + + int myDisplayMode; + + //NRI: Selection mode + VTKViewer_Actor* myPointActor; + VTKViewer_Actor* myEdgeActor; + VTKViewer_Actor* myCellActor; + void MoveInternalActors(); + + vtkPicker* myBasicPicker; + vtkCellPicker* myCellPicker; + vtkPointPicker* myPointPicker; + + /*! User for switching to stereo mode.*/ + int PositionBeforeStereo[2]; + + public slots: + void MouseMove(QMouseEvent *event) ; + void LeftButtonPressed(const QMouseEvent *event) ; + void LeftButtonReleased(const QMouseEvent *event) ; + void MiddleButtonPressed(const QMouseEvent *event) ; + void MiddleButtonReleased(const QMouseEvent *event) ; + void RightButtonPressed(const QMouseEvent *event) ; + void RightButtonReleased(const QMouseEvent *event) ; + void ButtonPressed(const QMouseEvent *event) ; + void ButtonReleased(const QMouseEvent *event) ; + void KeyPressed(QKeyEvent *event) ; + + private slots: + void TimerFunc() ; + +signals: + void RenderWindowModified() ; + void contextMenuRequested( QContextMenuEvent *e ); + +private: + friend class VTKViewer_ViewWindow; + + VTKViewer_ViewWindow* myViewWnd; + /** Selection node tolerance.*/ + double myTolNodes; + /** Selection cell tolerance.*/ + double myTolItems; +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_ShrinkFilter.cxx b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx new file mode 100755 index 000000000..b4a7fb6a2 --- /dev/null +++ b/src/VTKViewer/VTKViewer_ShrinkFilter.cxx @@ -0,0 +1,174 @@ +// SALOME OBJECT : kernel of SALOME component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SALOME_GeometryFilter.cxx +// Author : Michael ZORIN +// Module : SALOME +// $Header$ + +#include "VTKViewer_ShrinkFilter.h" + +#include +#include +#include +#include +#include +#include + +vtkCxxRevisionMacro(VTKViewer_ShrinkFilter, "$Revision$"); +vtkStandardNewMacro(VTKViewer_ShrinkFilter); + +/*!Constructor. Sets store mapping to zero.*/ +VTKViewer_ShrinkFilter::VTKViewer_ShrinkFilter(): + myStoreMapping(0) +{} + +/*!Destructor.*/ +VTKViewer_ShrinkFilter::~VTKViewer_ShrinkFilter() +{} + + +/*!Execute method. Calculate output.*/ +void VTKViewer_ShrinkFilter::Execute() +{ + vtkPoints *newPts; + int i, j, numIds, abort=0; + vtkIdType cellId, numCells, numPts; + vtkIdType oldId, newId; + vtkFloatingPointType center[3], *p, pt[3]; + vtkPointData *pd, *outPD;; + vtkIdList *ptIds, *newPtIds; + vtkDataSet *input= this->GetInput(); + vtkUnstructuredGrid *output = this->GetOutput(); + vtkIdType tenth; + vtkFloatingPointType decimal; + + vtkDebugMacro(<<"Shrinking cells"); + + numCells=input->GetNumberOfCells(); + numPts = input->GetNumberOfPoints(); + if (numCells < 1 || numPts < 1) + { + vtkErrorMacro(<<"No data to shrink!"); + return; + } + + ptIds = vtkIdList::New(); + ptIds->Allocate(VTK_CELL_SIZE); + newPtIds = vtkIdList::New(); + newPtIds->Allocate(VTK_CELL_SIZE); + + output->Allocate(numCells); + newPts = vtkPoints::New(); + newPts->Allocate(numPts*8,numPts); + pd = input->GetPointData(); + outPD = output->GetPointData(); + outPD->CopyAllocate(pd,numPts*8,numPts); + + // Traverse all cells, obtaining node coordinates. Compute "center" of cell, + // then create new vertices shrunk towards center. + // + tenth = numCells/10 + 1; + decimal = 0.0; + if(myStoreMapping){ + myVTK2ObjIds.clear(); + myVTK2ObjIds.reserve(numCells); + } + + for (cellId=0; cellId < numCells && !abort; cellId++) + { + input->GetCellPoints(cellId, ptIds); + numIds = ptIds->GetNumberOfIds(); + + //abort/progress methods + if (cellId % tenth == 0) + { + decimal += 0.1; + this->UpdateProgress (decimal); + abort = this->GetAbortExecute(); + } + + // get the center of the cell + center[0] = center[1] = center[2] = 0.0; + for (i=0; i < numIds; i++) + { + p = input->GetPoint(ptIds->GetId(i)); + for (j=0; j < 3; j++) + { + center[j] += p[j]; + } + } + for (j=0; j<3; j++) + { + center[j] /= numIds; + } + + // Create new points and cells + newPtIds->Reset(); + for (i=0; i < numIds; i++) + { + p = input->GetPoint(ptIds->GetId(i)); + for (j=0; j < 3; j++) + { + pt[j] = center[j] + this->ShrinkFactor*(p[j] - center[j]); + } + + oldId = ptIds->GetId(i); + newId = newPts->InsertNextPoint(pt); + if(myStoreMapping) + myVTK2ObjIds.push_back(oldId); + newPtIds->InsertId(i,newId); + + outPD->CopyData(pd, oldId, newId); + } + output->InsertNextCell(input->GetCellType(cellId), newPtIds); + }//for all cells + + // Update ourselves and release memory + // + output->GetCellData()->PassData(input->GetCellData()); + + output->SetPoints(newPts); + output->Squeeze(); + + ptIds->Delete(); + newPtIds->Delete(); + newPts->Delete(); +} + +/*!Sets store mapping.*/ +void VTKViewer_ShrinkFilter::SetStoreMapping(int theStoreMapping){ + myStoreMapping = theStoreMapping; + this->Modified(); +} + + +/*!Return node object id by vtk node id. + *\retval -1 - if no object, else return id. + */ +vtkIdType VTKViewer_ShrinkFilter::GetNodeObjId(int theVtkID) +{ + if ( myVTK2ObjIds.empty() || theVtkID > (int)myVTK2ObjIds.size() ) + return -1; + return myVTK2ObjIds.at(theVtkID); +} diff --git a/src/VTKViewer/VTKViewer_ShrinkFilter.h b/src/VTKViewer/VTKViewer_ShrinkFilter.h new file mode 100755 index 000000000..336d30636 --- /dev/null +++ b/src/VTKViewer/VTKViewer_ShrinkFilter.h @@ -0,0 +1,68 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_SHRINKFILTER_H +#define VTKVIEWER_SHRINKFILTER_H + +#include "VTKViewer.h" + +#include + +#include + +#ifdef WIN32 +#pragma warning ( disable:4251 ) +#endif + +/*!Shrink cells composing an arbitrary data set. + *\warning It is possible to turn cells inside out or cause self intersection in special cases. + */ +class VTKVIEWER_EXPORT VTKViewer_ShrinkFilter : public vtkShrinkFilter +{ +public: + /*!Create new instance of VTKViewer_ShrinkFilter.*/ + static VTKViewer_ShrinkFilter *New(); + vtkTypeRevisionMacro(VTKViewer_ShrinkFilter, vtkShrinkFilter); + + void SetStoreMapping(int theStoreMapping); + /*!Gets store mapping flag.*/ + int GetStoreMapping(){ return myStoreMapping;} + + virtual vtkIdType GetNodeObjId(int theVtkID); + /*!Return element id by vtk id.*/ + virtual vtkIdType GetElemObjId(int theVtkID) { return theVtkID;} + +protected: + VTKViewer_ShrinkFilter(); + ~VTKViewer_ShrinkFilter(); + + void Execute(); + /*!Not implemented.*/ + void UnstructuredGridExecute(); + +private: + int myStoreMapping; + typedef std::vector TVectorId; + TVectorId myVTK2ObjIds; +}; + +#ifdef WIN32 +#pragma warning ( default:4251 ) +#endif + +#endif diff --git a/src/VTKViewer/VTKViewer_Transform.cxx b/src/VTKViewer/VTKViewer_Transform.cxx new file mode 100755 index 000000000..4526d4555 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Transform.cxx @@ -0,0 +1,68 @@ +// SALOME FILTER : interactive object for VISU entities implementation +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SALOME_Transform.cxx +// Author : Laurent CORNABE with help of Nicolas REJNERI +// Module : SALOME + + +#include "VTKViewer_Transform.h" + +#include +#include + +static double EPS = 10e-4; + + +vtkStandardNewMacro(VTKViewer_Transform); + +/*!Sets matrix scale.*/ +void VTKViewer_Transform::SetMatrixScale(double theScaleX, double theScaleY, double theScaleZ){ + double aMatrix[16] = {theScaleX,0,0,0, + 0,theScaleY,0,0, + 0,0,theScaleZ,0, + 0,0,0,1.0000000}; + this->SetMatrix(aMatrix); +} + +/*!Gets matrix scale.*/ +void VTKViewer_Transform::GetMatrixScale(double theScale[3]){ + vtkMatrix4x4 *aTMatrix=this->GetMatrix(); + const double aScaleX = aTMatrix->GetElement(0,0); + const double aScaleY = aTMatrix->GetElement(1,1); + const double aScaleZ = aTMatrix->GetElement(2,2); + theScale[0] = aScaleX; + theScale[1] = aScaleY; + theScale[2] = aScaleZ; +} + +/*!Checks: Is matrix identity, where used EPS value. + *If |aScaleX-1|GetMatrixScale(aScale); + return (fabs(aScale[0] - 1.0) < EPS && + fabs(aScale[1] - 1.0) < EPS && + fabs(aScale[2] - 1.0) < EPS); +} diff --git a/src/VTKViewer/VTKViewer_Transform.h b/src/VTKViewer/VTKViewer_Transform.h new file mode 100755 index 000000000..9ef364577 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Transform.h @@ -0,0 +1,53 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_TRANSFORM_H +#define VTKVIEWER_TRANSFORM_H + +#include "VTKViewer.h" + +#include + +/*!\brief Describes linear transformations via a 4x4 matrix. + *@see vtkTransform class + */ +class VTKVIEWER_EXPORT VTKViewer_Transform : public vtkTransform +{ +public: + /*!Create new instance of VTKViewer_Transform.*/ + static VTKViewer_Transform *New(); + vtkTypeMacro( VTKViewer_Transform, vtkTransform ); + + int IsIdentity(); + //merge with V2_2_0_VISU_improvements:void SetScale( float theScaleX, float theScaleY, float theScaleZ ); + void SetMatrixScale(double theScaleX, double theScaleY, double theScaleZ); + void GetMatrixScale(double theScale[3]); + +protected: + /*!Constructor.*/ + VTKViewer_Transform() {/*!Do nothing*/} + /*!Copy contructor.*/ + VTKViewer_Transform(const VTKViewer_Transform&) {/*!Do nothing*/} + /*!Destructor.*/ + ~VTKViewer_Transform() {/*!Do nothing*/} + + /*!Operator = */ + void operator=( const VTKViewer_Transform& ) {/*!Do nothing*/} +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_TransformFilter.cxx b/src/VTKViewer/VTKViewer_TransformFilter.cxx new file mode 100755 index 000000000..cdfc14a1f --- /dev/null +++ b/src/VTKViewer/VTKViewer_TransformFilter.cxx @@ -0,0 +1,70 @@ +// SALOME FILTER : interactive object for VISU entities implementation +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// +// File : SALOME_TransformFilter.h +// Author : Laurent CORNABE with help of Nicolas REJNERI +// Module : SALOME + + +#include "VTKViewer_TransformFilter.h" +#include "VTKViewer_Transform.h" + +#include +#include +#include +#include +#include + + +vtkStandardNewMacro(VTKViewer_TransformFilter); + +/*!Execution method. Calculate output.*/ +void VTKViewer_TransformFilter::Execute(){ + vtkPoints *inPts; + vtkPoints *newPts; + int numPts, numCells; + vtkPointSet *input = this->GetInput(); + vtkPointSet *output = this->GetOutput(); + vtkPointData *pd=input->GetPointData(), *outPD=output->GetPointData(); + vtkCellData *cd=input->GetCellData(), *outCD=output->GetCellData(); + output->CopyStructure( input ); + if(Transform){ + bool anIsIdentity = true; + if(VTKViewer_Transform* aTransform = dynamic_cast(Transform)) + anIsIdentity = aTransform->IsIdentity() != 0; + inPts = input->GetPoints(); + if(!anIsIdentity && inPts){ + numPts = inPts->GetNumberOfPoints(); + numCells = input->GetNumberOfCells(); + newPts = vtkPoints::New(); + newPts->Allocate(numPts); + this->UpdateProgress(.2); + this->Transform->TransformPoints(inPts,newPts); + this->UpdateProgress(.8); + output->SetPoints(newPts); + newPts->Delete(); + } + } + outPD->PassData(pd); + outCD->PassData(cd); +} diff --git a/src/VTKViewer/VTKViewer_TransformFilter.h b/src/VTKViewer/VTKViewer_TransformFilter.h new file mode 100755 index 000000000..3087a03e9 --- /dev/null +++ b/src/VTKViewer/VTKViewer_TransformFilter.h @@ -0,0 +1,48 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_TRANSFORMFILTER_H +#define VTKVIEWER_TRANSFORMFILTER_H + +#include "VTKViewer.h" + +#include + +/*!Transform points and associated normals and vectors + *@see vtkTransformFilter + */ +class VTKVIEWER_EXPORT VTKViewer_TransformFilter : public vtkTransformFilter +{ +public: + /*!Create new instance of VTKViewer_TransformFilter.*/ + static VTKViewer_TransformFilter *New(); + vtkTypeMacro(VTKViewer_TransformFilter,vtkTransformFilter); + +protected: + /*!Constructor.*/ + VTKViewer_TransformFilter() {/*!Do nothing*/} + /*!Destructor.*/ + ~VTKViewer_TransformFilter() {/*!Do nothing*/} + /*!Copy constructor.*/ + VTKViewer_TransformFilter(const VTKViewer_TransformFilter&) {/*!Do nothing*/} + /*!Operator = */ + void operator=(const VTKViewer_TransformFilter&) {/*!Do nothing*/} + void Execute(); +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_Trihedron.cxx b/src/VTKViewer/VTKViewer_Trihedron.cxx new file mode 100755 index 000000000..c426e0280 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Trihedron.cxx @@ -0,0 +1,435 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "VTKViewer_Trihedron.h" +#include "VTKViewer_Actor.h" + +// VTK Includes +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "VTKViewer_VectorText.h" + +vtkStandardNewMacro(VTKViewer_UnScaledActor); + +/*!Constructor*/ +VTKViewer_UnScaledActor::VTKViewer_UnScaledActor() +{ + Bounds[0] = Bounds[2] = Bounds[4] = VTK_LARGE_FLOAT; + Bounds[1] = Bounds[3] = Bounds[5] = -VTK_LARGE_FLOAT; +} + +/*! + \return bounding box +*/ +vtkFloatingPointType* +VTKViewer_UnScaledActor +::GetBounds() +{ + return Bounds; +} + +/*! Sets \a mySize= \a theSize variable. + * \param theSize - integer size + */ +void VTKViewer_UnScaledActor::SetSize(int theSize) +{ + mySize = theSize; +} + +/*!This causes the actor to be rendered. + * Set new scale for actor. + */ +void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer) +{ + if(theRenderer){ + vtkFloatingPointType P[2][3] = {{-1.0, -1.0, 0.0},{+1.0, +1.0, 0.0}}; + theRenderer->ViewToWorld(P[0][0],P[0][1],P[0][2]); + theRenderer->ViewToWorld(P[1][0],P[1][1],P[1][2]); + vtkFloatingPointType aWorldDiag = sqrt((P[1][0]-P[0][0])*(P[1][0]-P[0][0])+ + (P[1][1]-P[0][1])*(P[1][1]-P[0][1])+ + (P[1][2]-P[0][2])*(P[1][2]-P[0][2])); + int* aSize = theRenderer->GetRenderWindow()->GetSize(); + vtkFloatingPointType aWinDiag = sqrt(vtkFloatingPointType(aSize[0]*aSize[0]+aSize[1]*aSize[1])); + vtkDataSet* aDataSet = GetMapper()->GetInput(); + aDataSet->Update(); + vtkFloatingPointType aLength = aDataSet->GetLength(); + vtkFloatingPointType aPrecision = 1.0E-3; + vtkFloatingPointType anOldScale = GetScale()[0]; + vtkFloatingPointType aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1])); + if(fabs(aScale - anOldScale)/aScale > aPrecision){ + SetScale(aScale); + } + } + vtkFollower::Render(theRenderer); +} + +vtkStandardNewMacro(VTKViewer_LineActor); + +vtkCxxSetObjectMacro(VTKViewer_LineActor,LabelActor,VTKViewer_UnScaledActor); +vtkCxxSetObjectMacro(VTKViewer_LineActor,ArrowActor,VTKViewer_UnScaledActor); + +/*!Adds Label and Arrow actors to \a theRenderer.*/ +void VTKViewer_LineActor::Render(vtkRenderer *theRenderer) +{ + if(LabelActor && LabelActor->GetVisibility()){ + LabelActor->Modified(); + LabelActor->Render(theRenderer); + } + if(ArrowActor && ArrowActor->GetVisibility()){ + ArrowActor->Modified(); + ArrowActor->Render(theRenderer); + } + vtkFollower::Render(theRenderer); +} + +/*! + Constructor +*/ +VTKViewer_Axis::VTKViewer_Axis() +{ + /*! \li Initialize the Line pipe-line representation*/ + myLineSource = vtkLineSource::New(); + myLineSource->SetPoint1(0.0,0.0,0.0); + + myMapper[0] = vtkPolyDataMapper::New(); + myMapper[0]->SetInput(myLineSource->GetOutput()); + + myLineActor = VTKViewer_LineActor::New(); + myLineActor->SetMapper(myMapper[0]); + myLineActor->PickableOff(); + + /*! \li Initialize the Arrow pipe-line representation*/ + myConeSource = vtkConeSource::New(); + myConeSource->SetResolution(2); + myConeSource->SetAngle(10); + + myMapper[1] = vtkPolyDataMapper::New(); + myMapper[1]->SetInput(myConeSource->GetOutput()); + + myArrowActor = VTKViewer_UnScaledActor::New(); + myArrowActor->SetMapper(myMapper[1]); + static int aArrowActorSize = 24; + myArrowActor->SetSize(aArrowActorSize); + myArrowActor->PickableOff(); + + myLineActor->SetArrowActor(myArrowActor); + + /*! \li Initialize the Label pipe-line representation */ + myVectorText = VTKViewer_VectorText::New(); + + myMapper[2] = vtkPolyDataMapper::New(); + myMapper[2]->SetInput(myVectorText->GetOutput()); + + myLabelActor = VTKViewer_UnScaledActor::New(); + myLabelActor->SetMapper(myMapper[2]); + static int aLabelActorSize = 12; + myLabelActor->SetSize(aLabelActorSize); + myLabelActor->PickableOff(); + //myLabelActor->DebugOn(); + + myLineActor->SetLabelActor(myLabelActor); + + /*! \li Initialise visibility param.*/ + myVisibility = VTKViewer_Trihedron::eOn; +} + +/*! + Destructor +*/ +VTKViewer_Axis::~VTKViewer_Axis() +{ + /*! \li Destroy of the Label pipe-line representation */ + myLabelActor->Delete(); + + myMapper[0]->RemoveAllInputs(); + myMapper[0]->Delete(); + + myVectorText->Delete(); + + /*! \li Destroy of the Arrow pipe-line representation */ + myArrowActor->Delete(); + + myMapper[1]->RemoveAllInputs(); + myMapper[1]->Delete(); + + myConeSource->Delete(); + + /*! \li Destroy of the Line pipe-line representation */ + myLineActor->Delete(); + + myMapper[2]->RemoveAllInputs(); + myMapper[2]->Delete(); + + myLineSource->Delete(); +} + +/*! Add to renderer + * \param theRenderer - vtkRenderer pointer + */ +void VTKViewer_Axis::AddToRender(vtkRenderer* theRenderer){ + /*! \li Order of the calls are important*/ + theRenderer->AddActor(myLineActor); + theRenderer->AddActor(myLabelActor); + theRenderer->AddActor(myArrowActor); +} + +/*! Remove actor of acis from \a theRenderer which are in myPresent. + * \param theRenderer - vtkRenderer pointer + */ +void VTKViewer_Axis::RemoveFromRender(vtkRenderer* theRenderer){ + /*! \li Order of the calls are important*/ + theRenderer->RemoveActor(myLineActor); + theRenderer->RemoveActor(myLabelActor); + theRenderer->RemoveActor(myArrowActor); +} + +/*! Sets visibility for all Axis to \a theVis*/ +void VTKViewer_Axis::SetVisibility(VTKViewer_Trihedron::TVisibility theVis) +{ + switch(theVis){ + case VTKViewer_Trihedron::eOff: + case VTKViewer_Trihedron::eOn: + myLabelActor->SetVisibility(theVis); + myArrowActor->SetVisibility(theVis); + myLineActor->SetVisibility(theVis); + break; + case VTKViewer_Trihedron::eOnlyLineOn: + myLabelActor->VisibilityOff(); + myArrowActor->VisibilityOff(); + myLineActor->VisibilityOn(); + break; + default: + return; + } + myVisibility = theVis; +} + +/*! Set camera for myLabelActor + */ +void VTKViewer_Axis::SetCamera(vtkCamera* theCamera){ + myLabelActor->SetCamera(theCamera); +} + +/*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor + */ +void VTKViewer_Axis::SetProperty(vtkProperty* theProperty){ + myLabelActor->SetProperty(theProperty); + myArrowActor->SetProperty(theProperty); + myLineActor->SetProperty(theProperty); +} + +/*! Set size of VTKViewer_Axis + */ +void VTKViewer_Axis::SetSize(vtkFloatingPointType theSize) +{ + vtkFloatingPointType aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize}; + myLineSource->SetPoint2(aPosition); + + myArrowActor->SetPosition(0.0,0.0,0.0); + myArrowActor->AddPosition(aPosition); + myArrowActor->SetOrientation(myRot); + + myLabelActor->SetPosition(0.0,0.0,0.0); + myLabelActor->AddPosition(aPosition); +} + +/*! \class VTKViewer_XAxis + * \brief X Axis actor + */ +class VTKViewer_XAxis : public VTKViewer_Axis +{ +protected: + VTKViewer_XAxis(); + VTKViewer_XAxis(const VTKViewer_XAxis&); +public: + vtkTypeMacro(VTKViewer_XAxis,VTKViewer_Axis); + static VTKViewer_XAxis *New(); +}; + +vtkStandardNewMacro(VTKViewer_XAxis); + +/*!Initialize X Axis*/ +VTKViewer_XAxis::VTKViewer_XAxis(){ + myDir[0] = 1.0; myDir[1] = 0.0; myDir[2] = 0.0; + myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 0.0; + myVectorText->SetText("X"); + vtkProperty* aProperty = vtkProperty::New(); + aProperty->SetColor(1.0,0.0,0.0); + SetProperty(aProperty); + aProperty->Delete(); +} + +/*! \class VTKViewer_YAxis + * \brief Y Axis actor + */ +class VTKViewer_YAxis : public VTKViewer_Axis{ +protected: + VTKViewer_YAxis(); + VTKViewer_YAxis(const VTKViewer_YAxis&); +public: + vtkTypeMacro(VTKViewer_YAxis,VTKViewer_Axis); + static VTKViewer_YAxis *New(); +}; + +vtkStandardNewMacro(VTKViewer_YAxis); + +/*!Initialize Y Axis*/ +VTKViewer_YAxis::VTKViewer_YAxis() +{ + myDir[0] = 0.0; myDir[1] = 1.0; myDir[2] = 0.0; + myRot[0] = 0.0; myRot[1] = 0.0; myRot[2] = 90.; + myVectorText->SetText("Y"); + vtkProperty* aProperty = vtkProperty::New(); + aProperty->SetColor(0.0,1.0,0.0); + SetProperty(aProperty); + aProperty->Delete(); +} + +/*! \class VTKViewer_ZAxis + * \brief Z Axis actor + */ +class VTKViewer_ZAxis : public VTKViewer_Axis +{ +protected: + VTKViewer_ZAxis(); + VTKViewer_ZAxis(const VTKViewer_ZAxis&); +public: + vtkTypeMacro(VTKViewer_ZAxis,VTKViewer_Axis); + static VTKViewer_ZAxis *New(); +}; + +vtkStandardNewMacro(VTKViewer_ZAxis); + +/*!Initialize Z Axis*/ +VTKViewer_ZAxis::VTKViewer_ZAxis() +{ + myDir[0] = 0.0; myDir[1] = 0.0; myDir[2] = 1.0; + myRot[0] = 0.0; myRot[1] = -90; myRot[2] = 0.0; + myVectorText->SetText("Z"); + vtkProperty* aProperty = vtkProperty::New(); + aProperty->SetColor(0.0,0.0,1.0); + SetProperty(aProperty); + aProperty->Delete(); +} + +vtkStandardNewMacro(VTKViewer_Trihedron); + +/*! + Constructor +*/ +VTKViewer_Trihedron::VTKViewer_Trihedron() +{ + myPresent = vtkActorCollection::New(); + myAxis[0] = VTKViewer_XAxis::New(); + myAxis[1] = VTKViewer_YAxis::New(); + myAxis[2] = VTKViewer_ZAxis::New(); + static vtkFloatingPointType aSize = 100; + SetSize(aSize); +} + +/*! + Destructor +*/ +VTKViewer_Trihedron::~VTKViewer_Trihedron() +{ + myPresent->RemoveAllItems(); + myPresent->Delete(); + for(int i = 0; i < 3; i++) + myAxis[i]->Delete(); +} + +/*! Set size of axes + */ +void VTKViewer_Trihedron::SetSize(vtkFloatingPointType theSize) +{ + mySize = theSize; + for(int i = 0; i < 3; i++) + myAxis[i]->SetSize(theSize); +} + +/*! Set visibility of axes + */ +void VTKViewer_Trihedron::SetVisibility(TVisibility theVis) +{ + for(int i = 0; i < 3; i++) + myAxis[i]->SetVisibility(theVis); +} + +/*! + \return visibility of first axis +*/ +VTKViewer_Trihedron::TVisibility VTKViewer_Trihedron::GetVisibility() +{ + return myAxis[0]->GetVisibility(); +} + +/*! Add to render all Axis + * \param theRenderer - vtkRenderer pointer + */ +void VTKViewer_Trihedron::AddToRender(vtkRenderer* theRenderer) +{ + vtkCamera* aCamera = theRenderer->GetActiveCamera(); + for(int i = 0; i < 3; i++){ + myAxis[i]->AddToRender(theRenderer); + myAxis[i]->SetCamera(aCamera); + } +} + +/*! Remove all actors from \a theRenderer which are in myPresent. + * \param theRenderer - vtkRenderer pointer + */ +void VTKViewer_Trihedron::RemoveFromRender(vtkRenderer* theRenderer) +{ + myPresent->InitTraversal(); + while(vtkActor* anActor = myPresent->GetNextActor()) + theRenderer->RemoveActor(anActor); + for(int i = 0; i < 3; i++) + myAxis[i]->RemoveFromRender(theRenderer); +} + +/*! Return count of visible actors. + * \param theRenderer - vtkRenderer pointer + */ +int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer) +{ + //TVisibility aVis = GetVisibility(); + //SetVisibility(eOff); + vtkActorCollection* aCollection = theRenderer->GetActors(); + aCollection->InitTraversal(); + int aCount = 0; + while(vtkActor* prop = aCollection->GetNextActor()) { + if( prop->GetVisibility()) + if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(prop)) + if(!anActor->IsInfinitive()) + aCount++; + //int aCount = theRenderer->VisibleActorCount(); + //SetVisibility(aVis); + } + return aCount; +} diff --git a/src/VTKViewer/VTKViewer_Trihedron.h b/src/VTKViewer/VTKViewer_Trihedron.h new file mode 100755 index 000000000..0d29f11d8 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Trihedron.h @@ -0,0 +1,282 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_TRIHEDRON_H +#define VTKVIEWER_TRIHEDRON_H + +#include "VTKViewer.h" + +#include +#include + +class vtkRenderer; +class vtkActorCollection; +class vtkCamera; +class vtkProperty; +class vtkPolyDataMapper; +class vtkLineSource; +class vtkConeSource; + +class VTKViewer_Axis; +class VTKViewer_VectorText; + +/*! \class vtkFollower + * See vtk documentation + */ +/*!a subclass of actor that always faces the camera + *@see vtkFollower + */ +class VTKVIEWER_EXPORT VTKViewer_UnScaledActor: public vtkFollower +{ + VTKViewer_UnScaledActor(const VTKViewer_UnScaledActor&); + +public: + + vtkTypeMacro(VTKViewer_UnScaledActor,vtkFollower); + + /*!Create new instance of VTKViewer_UnScaledActor.*/ + static VTKViewer_UnScaledActor *New(); + + virtual vtkFloatingPointType* GetBounds(); + virtual void SetSize(int theSize); + virtual void Render(vtkRenderer *theRenderer); + +protected: + VTKViewer_UnScaledActor(); + /*!Destructor. Do nothing.*/ + ~VTKViewer_UnScaledActor(){} + + int mySize; +}; + +/*!a subclass of actor that always faces the camera + *@see vtkFollower + */ +class VTKVIEWER_EXPORT VTKViewer_LineActor: public vtkFollower +{ + VTKViewer_LineActor(const VTKViewer_LineActor&); + +public: + /*!vtk type macros.*/ + vtkTypeMacro(VTKViewer_LineActor,vtkFollower); + + /*!Create new instance of VTKViewer_LineActor.*/ + static VTKViewer_LineActor *New(); + + /*! Sets Lable actor. + * \param theLabelActor - VTKViewer_UnScaledActor + */ + void SetLabelActor(VTKViewer_UnScaledActor* theLabelActor); + + /*! Sets Arrow actor. + * \param theLabelActor - VTKViewer_UnScaledActor + */ + void SetArrowActor(VTKViewer_UnScaledActor* theLabelActor); + + virtual void Render(vtkRenderer *theRenderer); + +protected: + + /*! Constructor which sets \a LabelActor and \a ArrowActor to NULL*/ + VTKViewer_LineActor(){ + LabelActor = NULL; + ArrowActor = NULL; + } + + /*!Destructor which call SetLabelActor(NULL) and SetArrowActor(NULL)*/ + ~VTKViewer_LineActor(){ + SetLabelActor(NULL); + SetArrowActor(NULL); + } + + /*!Label actor pointer*/ + VTKViewer_UnScaledActor* LabelActor; + + /*!Arrow actor pointer*/ + VTKViewer_UnScaledActor* ArrowActor; +}; + +/*!This class provide support trihedron object in vtk viewer.*/ +class VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject +{ +protected: + /*!Initialize fields by default values.*/ + VTKViewer_Trihedron(); + + /*!Const copy constructor.*/ + VTKViewer_Trihedron(const VTKViewer_Trihedron&); + + /*!Destructor. Remove all fileds.*/ + virtual ~VTKViewer_Trihedron(); + +public: + /*!vtk type macros.*/ + vtkTypeMacro(VTKViewer_Trihedron,vtkObject); + + /*!Create new instance of VTKViewer_Trihedron.*/ + static VTKViewer_Trihedron *New(); + + /*!Sets size of trihedron. + * \param theSize - vtkFloatingPointType value + */ + virtual void SetSize(vtkFloatingPointType theSize); + + /*! Get size of trihedron. + * \retval mySize - vtkFloatingPointType value + */ + virtual vtkFloatingPointType GetSize() { return mySize;} + + enum TVisibility{eOff, eOn, eOnlyLineOn}; + + /*! Sets visibility for all Axis to \a theVis*/ + virtual void SetVisibility(TVisibility theVis); + + /*! OFF visibility for all Axis.*/ + virtual void VisibilityOff() { SetVisibility(eOff);} + + /*! ON visibility for all Axis.*/ + virtual void VisibilityOn() { SetVisibility(eOn);} + + /*! Gets visibility of myAxis[0] actor.*/ + virtual TVisibility GetVisibility(); + + /*! Add to render all Axis + * \param theRenderer - vtkRenderer pointer + */ + virtual void AddToRender(vtkRenderer* theRenderer); + + /*! Remove all actors from \a theRenderer which are in myPresent. + * \param theRenderer - vtkRenderer pointer + */ + virtual void RemoveFromRender(vtkRenderer* theRenderer); + + /*! Return count of visible actors. + * \param theRenderer - vtkRenderer pointer + */ + virtual int GetVisibleActorCount(vtkRenderer* theRenderer); + +protected: + /*! Actor collection*/ + vtkActorCollection* myPresent; + + /*! \li myAxis[0] - X Axis actor + * \li myAxis[1] - Y Axis actor + * \li myAxis[2] - Z Axis actor + */ + VTKViewer_Axis* myAxis[3]; + + /*! Common size for trihedron, for each axis.*/ + vtkFloatingPointType mySize; +}; + +/*!The base class for concreate Axis. + * Its only duty is to give correct initialization and destruction + * of its pipe-lines + */ +class VTKVIEWER_EXPORT VTKViewer_Axis : public vtkObject +{ +protected: + VTKViewer_Axis(); + VTKViewer_Axis(const VTKViewer_Axis&); + virtual ~VTKViewer_Axis(); + +public: + /*!vtk type macros.*/ + vtkTypeMacro(VTKViewer_Axis,vtkObject); + + /*! Add to \a theRenderer actors: myLineActor,myLabelActor,myArrowActor + */ + virtual void AddToRender(vtkRenderer* theRenderer); + virtual void RemoveFromRender(vtkRenderer* theRenderer); + + /*! Sets visibility for actors: myLineActor,myLabelActor,myArrowActor + */ + virtual void SetVisibility(VTKViewer_Trihedron::TVisibility theVis); + + /*! Return visibility of VTKViewer_Axis + * \retval myVisibility + */ + virtual VTKViewer_Trihedron::TVisibility GetVisibility() { return myVisibility; } + + /*! Set camera for myLabelActor + */ + virtual void SetCamera(vtkCamera* theCamera); + + /*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor + */ + virtual void SetProperty(vtkProperty* theProperty); + + /*! Set size of VTKViewer_Axis + */ + virtual void SetSize(vtkFloatingPointType theSize); + + /*! Get label actor. + * \retval Return myLabelActor. + */ + virtual VTKViewer_UnScaledActor* GetLabel() { return myLabelActor; } + + /*! Get arrow actor. + * \retval Return myArrowActor + */ + virtual VTKViewer_UnScaledActor* GetArrow() { return myArrowActor; } + +protected: + /*! Visibility flag. + */ + VTKViewer_Trihedron::TVisibility myVisibility; + + /*! \var myDir[3] + * Direction vector + */ + /*! \var myRot[3] + * Orientation vector + */ + vtkFloatingPointType myDir[3], myRot[3]; + + /*! VTKViewer_LineActor actor pointer + */ + VTKViewer_LineActor *myLineActor; + + /*! VTKViewer_UnScaledActor actor pointer + */ + VTKViewer_UnScaledActor *myArrowActor; + + /*! VTKViewer_UnScaledActor actor pointer + */ + VTKViewer_UnScaledActor *myLabelActor; + + /*! \li myMapper[0] - for the Line pipe-line representation + * \li myMapper[1] - for the Arrow pipe-line representation + * \li myMapper[2] - for the Label pipe-line representation + */ + vtkPolyDataMapper *myMapper[3]; + + /*! vtkLineSource pointer (Line) + */ + vtkLineSource *myLineSource; + + /*! vtkConeSource pointer (Arrow) + */ + vtkConeSource *myConeSource; + + /*! VTKViewer_VectorText pointer (Label) + */ + VTKViewer_VectorText* myVectorText; +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_Utilities.cxx b/src/VTKViewer/VTKViewer_Utilities.cxx new file mode 100755 index 000000000..5f061a64b --- /dev/null +++ b/src/VTKViewer/VTKViewer_Utilities.cxx @@ -0,0 +1,216 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "VTKViewer_Utilities.h" +#include "VTKViewer_Actor.h" + +#include + +// VTK Includes +#include +#include +#include +#include + +using namespace std; + +/*!@see vtkRenderer::ResetCamera(vtkFloatingPointType bounds[6]) method*/ +void +ResetCamera(vtkRenderer* theRenderer, + int theUsingZeroFocalPoint) +{ + if(!theRenderer) + return; + + vtkCamera* aCamera = theRenderer->GetActiveCamera(); + if(!aCamera) + return; + + vtkFloatingPointType aBounds[6]; + int aCount = ComputeVisiblePropBounds(theRenderer,aBounds); + + if(theUsingZeroFocalPoint || aCount){ + static vtkFloatingPointType MIN_DISTANCE = 1.0 / VTK_LARGE_FLOAT; + + vtkFloatingPointType aLength = aBounds[1]-aBounds[0]; + aLength = max((aBounds[3]-aBounds[2]),aLength); + aLength = max((aBounds[5]-aBounds[4]),aLength); + + if(aLength < MIN_DISTANCE) + return; + + vtkFloatingPointType aWidth = + sqrt((aBounds[1]-aBounds[0])*(aBounds[1]-aBounds[0]) + + (aBounds[3]-aBounds[2])*(aBounds[3]-aBounds[2]) + + (aBounds[5]-aBounds[4])*(aBounds[5]-aBounds[4])); + + if(aWidth < MIN_DISTANCE) + return; + + vtkFloatingPointType aViewPlaneNormal[3]; + aCamera->GetViewPlaneNormal(aViewPlaneNormal); + + vtkFloatingPointType aCenter[3] = {0.0, 0.0, 0.0}; + if(!theUsingZeroFocalPoint){ + aCenter[0] = (aBounds[0] + aBounds[1])/2.0; + aCenter[1] = (aBounds[2] + aBounds[3])/2.0; + aCenter[2] = (aBounds[4] + aBounds[5])/2.0; + } + aCamera->SetFocalPoint(aCenter[0],aCenter[1],aCenter[2]); + + vtkFloatingPointType aViewAngle = aCamera->GetViewAngle(); + vtkFloatingPointType aDistance = 2.0*aWidth/tan(aViewAngle*vtkMath::Pi()/360.0); + + // check view-up vector against view plane normal + vtkFloatingPointType aViewUp[3]; + aCamera->GetViewUp(aViewUp); + if(fabs(vtkMath::Dot(aViewUp,aViewPlaneNormal)) > 0.999) + aCamera->SetViewUp(-aViewUp[2], aViewUp[0], aViewUp[1]); + + // update the camera + aCamera->SetPosition(aCenter[0]+aDistance*aViewPlaneNormal[0], + aCenter[1]+aDistance*aViewPlaneNormal[1], + aCenter[2]+aDistance*aViewPlaneNormal[2]); + + // find size of the window + int* aWinSize = theRenderer->GetSize(); + if(aWinSize[0] < aWinSize[1]) + aWidth *= vtkFloatingPointType(aWinSize[1])/vtkFloatingPointType(aWinSize[0]); + + if(theUsingZeroFocalPoint) + aWidth *= sqrt(2.0); + + aCamera->SetParallelScale(aWidth/2.0); + } + + ResetCameraClippingRange(theRenderer); +} + +/*! Compute the bounds of the visible props*/ +int +ComputeVisiblePropBounds(vtkRenderer* theRenderer, + vtkFloatingPointType theBounds[6]) +{ + int aCount = 0; + + theBounds[0] = theBounds[2] = theBounds[4] = VTK_LARGE_FLOAT; + theBounds[1] = theBounds[3] = theBounds[5] = -VTK_LARGE_FLOAT; + + // loop through all props + vtkActorCollection* aCollection = theRenderer->GetActors(); + aCollection->InitTraversal(); + while (vtkActor* aProp = aCollection->GetNextActor()) { + // if it's invisible, or has no geometry, we can skip the rest + if(aProp->GetVisibility() && aProp->GetMapper()){ + if(VTKViewer_Actor* anActor = VTKViewer_Actor::SafeDownCast(aProp)) + if(anActor->IsInfinitive()) + continue; + + vtkFloatingPointType *aBounds = aProp->GetBounds(); + static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT; + // make sure we haven't got bogus bounds + if ( aBounds != NULL && + aBounds[0] > -MAX_DISTANCE && aBounds[1] < MAX_DISTANCE && + aBounds[2] > -MAX_DISTANCE && aBounds[3] < MAX_DISTANCE && + aBounds[4] > -MAX_DISTANCE && aBounds[5] < MAX_DISTANCE ) + { + aCount++; + + theBounds[0] = min(aBounds[0],theBounds[0]); + theBounds[2] = min(aBounds[2],theBounds[2]); + theBounds[4] = min(aBounds[4],theBounds[4]); + + theBounds[1] = max(aBounds[1],theBounds[1]); + theBounds[3] = max(aBounds[3],theBounds[3]); + theBounds[5] = max(aBounds[5],theBounds[5]); + + }//not bogus + } + } + return aCount; +} + +/*!@see vtkRenderer::ResetCameraClippingRange(vtkFloatingPointType bounds[6]) method*/ +void +ResetCameraClippingRange(vtkRenderer* theRenderer) +{ + if(!theRenderer || !theRenderer->VisibleActorCount()) return; + + vtkCamera* anActiveCamera = theRenderer->GetActiveCamera(); + if( anActiveCamera == NULL ){ + return; + } + + // Find the plane equation for the camera view plane + vtkFloatingPointType vn[3]; + anActiveCamera->GetViewPlaneNormal(vn); + vtkFloatingPointType position[3]; + anActiveCamera->GetPosition(position); + + vtkFloatingPointType bounds[6]; + theRenderer->ComputeVisiblePropBounds(bounds); + + vtkFloatingPointType center[3]; + center[0] = (bounds[0] + bounds[1])/2.0; + center[1] = (bounds[2] + bounds[3])/2.0; + center[2] = (bounds[4] + bounds[5])/2.0; + + vtkFloatingPointType width = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); + + vtkFloatingPointType distance = sqrt((position[0]-center[0])*(position[0]-center[0]) + + (position[1]-center[1])*(position[1]-center[1]) + + (position[2]-center[2])*(position[2]-center[2])); + + vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0}; + + // Do not let the range behind the camera throw off the calculation. + if (range[0] < 0.0) range[0] = 0.0; + + anActiveCamera->SetClippingRange( range ); +} + +/*!Compute trihedron size.*/ +bool +ComputeTrihedronSize( vtkRenderer* theRenderer, + vtkFloatingPointType& theNewSize, + const vtkFloatingPointType theSize, + const vtkFloatingPointType theSizeInPercents ) +{ + // calculating diagonal of visible props of the renderer + vtkFloatingPointType bnd[ 6 ]; + if ( ComputeVisiblePropBounds( theRenderer, bnd ) == 0 ) + { + bnd[ 1 ] = bnd[ 3 ] = bnd[ 5 ] = 100; + bnd[ 0 ] = bnd[ 2 ] = bnd[ 4 ] = 0; + } + vtkFloatingPointType aLength = 0; + + aLength = bnd[ 1 ]-bnd[ 0 ]; + aLength = max( ( bnd[ 3 ] - bnd[ 2 ] ),aLength ); + aLength = max( ( bnd[ 5 ] - bnd[ 4 ] ),aLength ); + + static vtkFloatingPointType EPS_SIZE = 5.0E-3; + theNewSize = aLength * theSizeInPercents / 100.0; + + // if the new trihedron size have sufficient difference, then apply the value + return fabs( theNewSize - theSize) > theSize * EPS_SIZE || + fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE; +} diff --git a/src/VTKViewer/VTKViewer_Utilities.h b/src/VTKViewer/VTKViewer_Utilities.h new file mode 100755 index 000000000..7ef9cc550 --- /dev/null +++ b/src/VTKViewer/VTKViewer_Utilities.h @@ -0,0 +1,50 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_UTILITIES_H +#define VTKVIEWER_UTILITIES_H + +#include "VTKViewer.h" + +class vtkRenderer; + +VTKVIEWER_EXPORT +extern +void +ResetCamera(vtkRenderer* theRenderer, + int theUsingZeroFocalPoint = false); + +VTKVIEWER_EXPORT +extern +int +ComputeVisiblePropBounds(vtkRenderer* theRenderer, + vtkFloatingPointType theBounds[6]); + +VTKVIEWER_EXPORT +extern +void +ResetCameraClippingRange(vtkRenderer* theRenderer); +VTKVIEWER_EXPORT +extern +bool +ComputeTrihedronSize(vtkRenderer* theRenderer, + vtkFloatingPointType& theNewSize, + const vtkFloatingPointType theSize, + const vtkFloatingPointType theSizeInPercents); + +#endif diff --git a/src/VTKViewer/VTKViewer_VectorText.cxx b/src/VTKViewer/VTKViewer_VectorText.cxx new file mode 100755 index 000000000..e701a1f07 --- /dev/null +++ b/src/VTKViewer/VTKViewer_VectorText.cxx @@ -0,0 +1,1754 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information.*/ + +// VTKViewer_VectorText.cxx is a copy of vtkVectorText.cxx file. +// Purpose of copying: to remove linking to libHybrid.so VTK library + +#include "VTKViewer_VectorText.h" + +#include "vtkCellArray.h" +#include "vtkObjectFactory.h" +#include "vtkPoints.h" +#include "vtkPolyData.h" +using namespace std; + +vtkCxxRevisionMacro(VTKViewer_VectorText, "$Revision$"); +vtkStandardNewMacro(VTKViewer_VectorText); + +char *VTK_VECTOR_TEXT_33 = (char *) "11 0.438482 " +"0.28000 -0.07186 0.43164 -0.07143 0.27689 0.07714 0.43472 0.07714 0.32000 0.20134 " +"0.40000 0.20243 0.31429 0.20550 0.27277 0.76857 0.43848 0.76857 0.27693 1.02571 " +"0.43429 1.02615 7 2 1 3 2 0 1 7 6 5 6 4 5 8 " +"7 5 7 8 9 10 9 8 " +; + +char *VTK_VECTOR_TEXT_34 = (char *) "21 0.615625 " +"0.25714 0.63563 0.32571 0.63563 0.50286 0.63642 0.25143 0.63946 0.33143 0.63840 " +"0.33462 0.64286 0.49673 0.64286 0.57714 0.63757 0.58093 0.64286 0.21335 0.84286 " +"0.36680 0.84286 0.46177 0.84286 0.61522 0.84286 0.21295 1.02000 0.46134 1.02000 " +"0.61563 1.02000 0.36571 1.02307 0.46550 1.02571 0.21714 1.02615 0.36000 1.02723 " +"0.61143 1.02615 17 3 5 9 7 6 2 4 5 1 6 8 12 0 1 5 6 " +"12 11 3 0 5 7 8 6 11 12 14 13 9 10 10 9 5 15 14 12 19 " +"18 10 18 13 10 17 14 20 14 15 20 16 19 10 " +; + +char *VTK_VECTOR_TEXT_35 = (char *) "43 0.974539 " +"0.22286 -0.09100 0.32571 -0.09236 0.56832 -0.08857 0.67429 -0.09201 0.28193 0.22000 " +"0.39470 0.22000 0.63009 0.22000 0.15385 0.23143 0.27429 0.22723 0.40571 0.22723 " +"0.62286 0.22723 0.74857 0.22680 0.97454 0.23143 0.15385 0.33429 0.97454 0.33429 " +"0.30344 0.34000 0.65201 0.34000 0.77084 0.34000 0.42286 0.34010 0.42034 0.34571 " +"0.36041 0.60286 0.70748 0.60286 0.82034 0.60286 0.47429 0.60626 0.15385 0.61429 " +"0.35429 0.61009 0.70286 0.60951 0.82857 0.61009 0.97454 0.61429 0.15385 0.71714 " +"0.37714 0.72134 0.50286 0.72191 0.72571 0.72134 0.85143 0.72156 0.97143 0.72025 " +"0.38605 0.72857 0.49823 0.72857 0.73335 0.72857 0.84613 0.72857 0.45143 1.04160 " +"0.55735 1.04286 0.80000 1.04243 0.90521 1.04286 43 6 2 3 5 0 1 0 5 4 18 " +"9 10 11 6 3 4 9 8 13 8 15 17 6 11 9 4 5 13 7 8 17 " +"12 14 8 9 15 15 19 20 16 6 17 12 17 11 18 10 16 10 6 16 21 " +"16 17 18 19 9 15 9 19 20 30 25 23 20 19 34 33 28 29 24 25 29 " +"25 30 27 21 22 33 21 27 20 23 30 22 21 17 33 27 28 31 26 32 35 " +"30 23 32 38 37 31 35 23 21 32 26 26 31 23 32 21 38 41 37 38 36 " +"35 31 38 21 33 40 39 36 42 41 38 39 35 36 " +; + +char *VTK_VECTOR_TEXT_36 = (char *) "73 0.921518 " +"0.52571 -0.22882 0.59429 -0.22991 0.52000 -0.09942 0.60571 -0.09385 0.40571 -0.07057 " +"0.72730 -0.06571 0.33143 -0.03465 0.80571 -0.01813 0.51429 0.01891 0.52152 0.02571 " +"0.60571 0.02014 0.84571 0.02168 0.25669 0.04286 0.66857 0.03800 0.44571 0.04535 " +"0.70984 0.06571 0.74535 0.10571 0.74857 0.11079 0.74902 0.11143 0.37057 0.12857 " +"0.90538 0.12857 0.20823 0.15143 0.35748 0.16286 0.77395 0.16857 0.35429 0.17310 " +"0.35177 0.18000 0.78134 0.21429 0.92152 0.21429 0.19580 0.22571 0.33480 0.25429 " +"0.77395 0.29429 0.91177 0.32286 0.76000 0.32921 0.72571 0.36972 0.89355 0.37429 " +"0.64690 0.40857 0.65143 0.40706 0.64000 0.41109 0.60571 0.41986 0.52109 0.43714 " +"0.85714 0.43270 0.38857 0.49216 0.79429 0.48902 0.72571 0.52437 0.30454 0.54571 " +"0.60260 0.56286 0.52043 0.58571 0.26286 0.59570 0.46857 0.59800 0.39429 0.65095 " +"0.22857 0.67295 0.36823 0.70000 0.75429 0.77624 0.21907 0.78571 0.35891 0.78571 " +"0.89184 0.79714 0.37714 0.85001 0.72571 0.86144 0.87470 0.86571 0.24571 0.89016 " +"0.68571 0.90956 0.44000 0.92036 0.60571 0.94469 0.83179 0.94571 0.28000 0.94629 " +"0.51429 0.94891 0.34286 1.00607 0.75429 1.01579 0.38286 1.02784 0.52043 1.06571 " +"0.60260 1.06571 0.52260 1.12286 0.60043 1.12286 75 3 8 2 2 8 4 19 12 6 13 11 15 9 8 10 3 2 1 8 " +"3 10 5 13 10 15 11 16 7 13 5 4 14 6 2 0 1 5 10 3 12 " +"22 21 14 4 8 13 7 11 11 18 16 20 23 18 18 17 16 20 18 11 19 " +"6 14 28 21 29 26 23 20 12 19 22 25 22 24 21 22 25 21 25 29 26 " +"27 30 27 26 20 31 32 30 31 30 27 40 33 32 37 43 38 34 32 31 38 " +"39 9 40 32 34 38 9 10 43 33 42 37 36 43 39 38 43 42 33 40 35 " +"36 37 33 43 36 39 45 46 48 41 39 45 39 43 41 48 44 47 51 50 46 " +"62 65 48 39 46 44 49 47 49 44 48 54 53 50 51 47 49 53 56 59 53 " +"54 56 66 64 56 55 58 52 58 57 52 54 50 51 59 56 64 67 60 63 60 " +"57 63 66 61 68 61 66 56 68 65 69 65 62 69 62 46 45 63 57 58 62 " +"60 67 68 61 65 71 70 72 70 62 67 62 70 69 71 69 70 " +; + +char *VTK_VECTOR_TEXT_37 = (char *) "81 1.409911 " +"0.46713 -0.11143 0.57143 -0.11215 1.19429 -0.11252 1.10286 -0.10252 1.26444 -0.09429 " +"1.05143 -0.07759 1.31429 -0.06384 1.14857 -0.01538 1.18857 -0.01807 0.98857 -0.01364 " +"1.22286 -0.00771 1.36784 -0.00286 1.11302 0.00286 1.26436 0.03143 1.07787 0.04857 " +"0.95748 0.05429 1.39681 0.06571 1.28680 0.09429 1.05866 0.14000 1.40991 0.14571 " +"0.94134 0.15143 0.94134 0.21429 1.29295 0.21429 1.06134 0.23714 1.40723 0.23714 " +"0.95748 0.30000 1.39387 0.30000 1.07787 0.30571 1.27429 0.30371 1.09561 0.33429 " +"1.23429 0.35465 1.36616 0.36286 1.13143 0.36327 1.16571 0.37277 1.20571 0.36899 " +"1.00045 0.38571 1.32000 0.41543 1.06857 0.44498 1.24571 0.45681 0.48000 0.46420 " +"1.15429 0.46723 0.38857 0.47462 0.55016 0.48286 0.60000 0.51330 0.30286 0.52704 " +"0.43429 0.56177 0.47429 0.55907 0.26857 0.57284 0.50857 0.56943 0.65355 0.57429 " +"0.39873 0.58000 0.55007 0.60857 0.24530 0.62571 0.36359 0.62571 0.68252 0.64286 " +"0.56680 0.64857 0.23050 0.69429 0.34437 0.71714 0.57866 0.72286 0.69563 0.72286 " +"0.22705 0.79143 0.34705 0.81429 0.69295 0.81429 0.56891 0.85429 0.67959 0.87714 " +"0.24530 0.88286 0.36359 0.88286 0.38132 0.91143 0.54286 0.90975 0.52000 0.93179 " +"0.65465 0.93429 0.41714 0.94041 0.47429 0.94950 0.29143 0.96914 0.60571 0.99258 " +"0.32000 0.99868 0.38286 1.03395 0.53714 1.03184 1.06857 1.04249 1.17287 1.04286 " +"0.48000 1.04395 79 0 1 78 10 4 6 2 8 3 9 14 15 4 " +"10 8 3 7 5 7 3 8 10 6 13 12 5 7 5 12 9 4 8 2 13 " +"16 17 17 19 22 14 9 12 15 18 20 11 13 6 13 11 16 17 16 19 18 " +"15 14 21 20 18 21 23 25 22 26 28 23 21 18 24 22 19 25 27 35 35 " +"29 37 22 24 26 28 31 30 27 25 23 31 28 26 27 29 35 36 30 31 38 " +"34 30 38 33 34 37 32 40 32 33 40 38 30 36 32 37 29 40 33 38 42 " +"46 39 47 53 52 48 43 51 39 46 41 41 50 44 56 57 60 45 41 46 42 " +"48 46 48 42 43 50 41 45 53 47 44 51 49 55 54 55 49 53 44 50 49 " +"51 43 55 54 58 59 58 54 57 56 52 57 52 53 60 61 65 58 62 63 57 " +"61 60 62 64 63 65 66 73 66 65 61 73 66 75 58 59 62 63 64 68 70 " +"69 68 67 75 66 70 68 64 76 71 72 75 67 76 74 69 70 71 76 67 69 " +"77 72 72 77 80 77 69 74 76 72 80 79 78 1 " +; + +char *VTK_VECTOR_TEXT_38 = (char *) "76 1.126291 " +"0.58857 -0.08966 1.03429 -0.09235 0.48000 -0.08395 0.66286 -0.07673 0.40000 -0.05914 " +"0.72000 -0.05641 0.98286 -0.05473 0.35429 -0.03393 0.78857 -0.01678 1.12629 0.00857 " +"0.29143 0.02168 0.52571 0.02991 0.57714 0.02764 0.62286 0.03756 0.46857 0.04645 " +"0.87429 0.05495 0.69714 0.07393 0.42132 0.08286 1.04571 0.07868 0.24486 0.08857 " +"0.75011 0.11714 0.22327 0.14000 0.37927 0.14571 0.78349 0.16286 0.96893 0.16286 " +"0.96571 0.16717 0.96457 0.16857 0.95937 0.18000 0.35580 0.22571 0.20991 0.25429 " +"0.36319 0.28857 0.86286 0.29600 1.02437 0.31143 0.22645 0.32857 0.40418 0.36286 " +"0.40571 0.36454 0.41330 0.37429 1.05421 0.40857 0.28418 0.42571 0.92000 0.44119 " +"0.53714 0.46770 0.37143 0.50250 0.66758 0.54000 0.46406 0.55714 0.78704 0.62571 " +"0.59429 0.63146 0.37714 0.68444 0.69296 0.70000 0.85355 0.71714 0.35681 0.73429 " +"0.50200 0.75143 0.49756 0.76286 0.49502 0.76857 0.72891 0.76857 0.86966 0.76857 " +"0.34748 0.82000 0.73295 0.82000 0.48764 0.82571 0.87236 0.83143 0.49714 0.86089 " +"0.35849 0.87143 0.71429 0.87650 0.52000 0.89555 0.69714 0.89846 0.37964 0.91714 " +"0.84657 0.91714 0.55429 0.92073 0.65714 0.92498 0.60000 0.93277 0.81868 0.95714 " +"0.42857 0.97582 0.76571 1.00436 0.51429 1.02723 0.72000 1.02723 0.59429 1.04437 " +"0.64571 1.04395 78 7 17 10 3 13 0 " +"2 14 4 6 18 15 17 7 4 9 18 " +"6 9 6 1 8 16 5 0 12 2 " +"17 4 14 2 11 14 12 0 13 13 5 " +"16 15 24 20 16 8 20 13 3 5 " +"2 12 11 10 17 19 21 28 29 15 20 " +"8 20 24 23 40 23 31 24 25 26 " +"19 22 21 31 23 27 22 19 17 18 24 " +"15 28 21 22 29 30 33 31 32 39 " +"23 24 26 30 29 28 23 26 27 33 30 " +"38 32 31 27 38 36 41 38 34 36 " +"34 38 30 36 34 35 39 32 37 42 40 " +"31 40 41 36 42 44 47 45 43 40 " +"40 43 41 50 46 43 50 49 46 45 40 " +"42 48 53 47 45 42 47 49 52 55 " +"53 48 56 50 43 45 57 60 55 52 50 " +"51 49 50 52 48 47 44 54 56 48 " +"56 65 61 60 59 64 59 60 57 65 56 " +"58 52 57 55 64 59 70 58 56 54 " +"59 62 70 68 74 72 65 69 61 70 66 " +"72 63 71 67 63 61 69 70 62 66 " +"67 73 68 71 63 69 73 67 71 68 72 " +"66 74 68 75 75 68 73 " +; + +char *VTK_VECTOR_TEXT_39 = (char *) "10 0.364197 " +"0.25143 0.63563 0.24571 0.63946 0.32571 0.63757 0.32950 0.64286 0.21034 0.83714 " +"0.36379 0.83714 0.20991 1.02000 0.36420 1.02000 0.21408 1.02571 0.36000 1.02615 8 1 0 3 " +"2 3 0 1 3 4 7 6 4 5 4 " +"3 7 4 5 8 6 9 6 7 9 " +; + +char *VTK_VECTOR_TEXT_40 = (char *) "19 0.595731 " +"0.50857 -0.39522 0.59429 -0.39447 0.44000 -0.30784 0.51787 -0.24857 0.32530 -0.09429 " +"0.43748 -0.05429 0.26899 0.06571 0.38134 0.20286 0.23580 0.27714 0.37605 0.38000 " +"0.23848 0.41429 0.39320 0.53429 0.27177 0.59714 0.43748 0.71143 0.47216 0.80286 " +"0.36086 0.82000 0.45714 0.97936 0.59573 1.04286 0.50857 1.04395 17 2 3 4 0 3 2 3 " +"0 1 6 4 5 3 5 4 6 7 8 7 6 5 9 10 8 9 8 7 10 " +"11 12 10 9 11 12 13 15 12 11 13 14 15 13 16 15 14 17 18 16 17 " +"16 14 " +; + +char *VTK_VECTOR_TEXT_41 = (char *) "19 0.598482 " +"0.24000 -0.39447 0.33143 -0.39258 0.40616 -0.28857 0.31641 -0.24857 0.48784 -0.14000 " +"0.39681 -0.05429 0.55538 0.03143 0.45295 0.20286 0.59580 0.23714 0.59848 0.37429 " +"0.45823 0.38000 0.44723 0.49429 0.56252 0.59714 0.41714 0.64134 0.47343 0.82000 " +"0.34857 0.83301 0.37714 0.97936 0.23855 1.04286 0.32571 1.04395 17 0 1 3 2 3 1 3 " +"4 5 3 2 4 5 6 7 6 5 4 7 8 10 8 9 10 11 10 9 8 " +"7 6 11 12 13 13 14 15 12 11 9 14 13 12 15 16 17 16 15 14 16 " +"18 17 " +; + +char *VTK_VECTOR_TEXT_42 = (char *) "34 0.685300 " +"0.33143 0.58250 0.33714 0.58223 0.53714 0.58250 0.54286 0.58194 0.36213 0.61429 " +"0.25587 0.63714 0.25266 0.64286 0.62655 0.64286 0.25393 0.64857 0.43429 0.73293 " +"0.44000 0.73049 0.36715 0.78000 0.50714 0.78000 0.35429 0.78613 0.63429 0.80816 " +"0.19309 0.82571 0.68389 0.82571 0.19177 0.83143 0.68530 0.83143 0.38857 0.86213 " +"0.39523 0.86571 0.48000 0.86242 0.47660 0.86571 0.34657 0.88286 0.58857 0.90823 " +"0.22286 0.92522 0.22857 0.92848 0.64571 0.92816 0.65143 0.92675 0.49295 1.02000 " +"0.38134 1.03714 0.38550 1.04286 0.49143 1.04021 0.48571 1.04437 32 2 12 10 8 4 11 " +"8 5 4 8 6 5 4 0 1 2 3 " +"12 0 4 5 12 9 10 9 11 4 " +"19 11 21 14 24 12 26 25 17 16 18 " +"14 13 23 15 19 21 20 11 19 13 " +"33 31 30 24 21 12 12 21 9 21 11 " +"9 26 17 23 12 3 7 27 24 18 " +"13 19 23 23 17 15 20 21 22 18 24 " +"14 28 27 18 33 30 20 29 20 22 " +"29 33 20 32 33 29 " +; + +char *VTK_VECTOR_TEXT_43 = (char *) "20 0.952768 " +"0.52836 0.10571 0.64878 0.10571 0.52420 0.11143 0.65295 0.11143 0.52420 0.39714 " +"0.65295 0.39714 0.22857 0.40546 0.52000 0.40329 0.66286 0.40437 0.95168 0.40857 " +"0.22437 0.52286 0.95277 0.52286 0.22857 0.52900 0.52311 0.53429 0.65403 0.53429 " +"0.94857 0.52900 0.52528 0.82571 0.65186 0.82571 0.53143 0.82991 0.64571 0.82991 18 1 2 0 1 3 2 " +"4 2 3 5 4 3 12 6 7 14 4 " +"8 9 15 8 8 4 5 9 11 15 " +"12 7 13 6 12 10 7 4 13 14 8 " +"15 17 19 18 14 13 4 17 18 16 " +"17 16 13 17 13 14 " +; + +char *VTK_VECTOR_TEXT_44 = (char *) "23 0.432768 " +"0.30286 -0.28607 0.30857 -0.28726 0.33714 -0.27355 0.36571 -0.25275 0.27329 -0.23714 " +"0.38670 -0.23143 0.30286 -0.21582 0.39914 -0.21429 0.32115 -0.19714 0.41355 -0.18571 " +"0.33800 -0.16857 0.42327 -0.15714 0.34605 -0.14571 0.43277 -0.10000 0.35580 -0.08286 " +"0.35472 -0.07714 0.28571 -0.07295 0.34857 -0.07295 0.28000 -0.06878 0.27957 0.07714 " +"0.43168 0.07714 0.28571 0.08134 0.42857 0.08025 21 0 6 4 0 " +"1 2 0 2 6 3 6 2 8 5 10 5 7 10 6 5 8 5 6 3 10 " +"7 12 9 12 7 12 13 14 11 12 9 12 11 13 18 17 19 17 21 19 15 " +"14 13 15 13 17 21 17 22 17 20 22 18 16 17 20 17 13 " +; + +char *VTK_VECTOR_TEXT_45 = (char *) "8 0.606146 " +"0.19118 0.26000 0.19429 0.25689 0.60000 0.25580 0.60615 0.26000 0.19118 0.38571 " +"0.60615 0.38571 0.19429 0.38882 0.60000 0.38991 6 6 1 2 6 0 " +"1 6 2 7 6 4 0 7 2 3 " +"5 7 3 " +; + +char *VTK_VECTOR_TEXT_46 = (char *) "13 0.432768 " +"0.28571 -0.07295 0.42286 -0.07295 0.42857 -0.07186 0.27848 -0.06571 0.28000 -0.06878 " +"0.43277 -0.06571 0.27848 0.07143 0.43277 0.07143 0.27957 0.07714 0.43168 0.07714 " +"0.28571 0.08134 0.42286 0.08134 0.42857 0.08025 11 0 " +"3 4 3 0 1 8 6 10 5 1 2 3 1 5 6 3 5 6 7 11 6 " +"5 7 10 6 11 9 12 11 9 11 7 " +; + +char *VTK_VECTOR_TEXT_47 = (char *) "5 0.562348 " +"0.14389 -0.08857 0.14857 -0.09256 0.25004 -0.08857 0.56235 1.04286 0.46286 1.04358 3 2 0 1 4 0 2 3 " +"4 2 " +; + +char *VTK_VECTOR_TEXT_48 = (char *) "53 0.926804 " +"0.53714 -0.09009 0.59429 -0.09009 0.66857 -0.07673 0.43429 -0.06723 0.73143 -0.05070 " +"0.34286 -0.00972 0.80571 0.01025 0.54857 0.02152 0.61714 0.02891 0.30241 0.03714 " +"0.65714 0.04645 0.46857 0.05007 0.42473 0.08857 0.70286 0.08454 0.26645 0.10000 " +"0.86943 0.11143 0.39955 0.12286 0.73800 0.13429 0.23748 0.18000 0.37034 0.19714 " +"0.76252 0.20286 0.91236 0.26000 0.21866 0.26571 0.35621 0.26571 0.77823 0.28857 " +"0.34437 0.40286 0.92680 0.40286 0.20420 0.40857 0.78705 0.54000 0.20723 0.58000 " +"0.92420 0.58571 0.35277 0.64286 0.22177 0.69429 0.76571 0.72437 0.89966 0.74000 " +"0.37756 0.76286 0.74498 0.79143 0.26073 0.82571 0.85927 0.84857 0.42473 0.85429 " +"0.70439 0.85429 0.46286 0.88902 0.66286 0.89007 0.30241 0.90000 0.51009 0.91143 " +"0.58286 0.91823 0.80725 0.92857 0.77714 0.95829 0.38350 0.98000 0.71429 0.99927 " +"0.46286 1.01681 0.65714 1.01959 0.53714 1.02991 53 2 8 1 0 7 3 5 16 9 2 10 8 0 " +"1 8 7 0 8 12 16 5 11 3 7 3 12 5 15 20 17 11 12 3 13 " +"6 17 6 13 4 9 16 14 10 4 13 14 19 18 4 10 2 15 17 6 19 " +"14 16 21 24 20 23 18 19 22 25 27 24 26 28 23 22 18 21 20 15 26 " +"24 21 22 23 25 29 27 25 29 31 32 28 30 33 31 29 25 30 28 26 32 " +"35 37 46 40 36 30 34 33 32 31 35 43 39 48 43 37 35 38 36 33 38 " +"33 34 42 40 49 48 41 50 39 43 35 47 40 46 46 36 38 41 44 50 45 " +"52 44 42 51 45 41 48 39 49 40 47 50 44 52 52 45 51 42 49 51 " +; + +char *VTK_VECTOR_TEXT_49 = (char *) "11 0.708571 " +"0.58286 -0.07186 0.70857 -0.07186 0.30857 0.62908 0.31429 0.62657 0.38286 0.65641 " +"0.30785 0.75143 0.57714 0.77731 0.47429 0.85616 0.56384 0.94000 0.62857 1.02915 " +"0.70857 1.02882 9 6 0 1 2 4 5 7 5 4 2 3 4 6 " +"8 7 6 7 4 10 8 6 10 6 1 10 9 8 " +; + +char *VTK_VECTOR_TEXT_50 = (char *) "43 0.914286 " +"0.18857 -0.06878 0.91429 -0.06878 0.18748 -0.04286 0.19849 0.00857 0.91429 0.05164 " +"0.38142 0.06000 0.22943 0.07714 0.46286 0.15868 0.30286 0.17832 0.38286 0.25813 " +"0.58413 0.43143 0.78286 0.44454 0.67543 0.52286 0.85355 0.53429 0.72045 0.58000 " +"0.89756 0.62571 0.75470 0.64286 0.35168 0.70000 0.91236 0.70000 0.77295 0.71143 " +"0.21403 0.71714 0.77295 0.74571 0.22605 0.79143 0.37143 0.79804 0.90244 0.80857 " +"0.75429 0.81228 0.38902 0.83143 0.24359 0.84286 0.73143 0.84689 0.42454 0.87143 " +"0.86607 0.88857 0.68000 0.89070 0.28000 0.90629 0.49143 0.90823 0.58857 0.91866 " +"0.82857 0.93555 0.31597 0.94571 0.37714 0.98784 0.76000 0.98657 0.44571 1.01470 " +"0.69143 1.01470 0.53714 1.02991 0.62857 1.02723 41 3 2 0 3 5 6 1 5 0 5 " +"3 0 1 4 5 6 5 8 7 8 5 9 8 7 9 7 10 11 10 7 10 " +"11 12 12 11 14 16 15 18 16 18 19 13 14 11 14 13 16 21 24 25 15 " +"16 13 21 19 18 23 27 22 17 23 22 24 21 18 27 23 32 17 22 20 31 " +"42 34 30 28 25 26 32 23 40 31 38 35 28 30 36 32 26 29 36 26 34 " +"41 33 33 37 29 36 29 37 33 39 37 30 25 24 28 38 31 38 28 35 39 " +"33 41 31 40 42 41 34 42 " +; + +char *VTK_VECTOR_TEXT_51 = (char *) "68 0.927232 " +"0.52571 -0.09009 0.63429 -0.08395 0.45143 -0.07756 0.37143 -0.04498 0.74286 -0.04771 " +"0.30857 0.00132 0.81714 0.00439 0.54286 0.02152 0.60000 0.02420 0.64661 0.03714 " +"0.27429 0.03952 0.46857 0.04073 0.42857 0.06759 0.70857 0.07561 0.88213 0.08286 " +"0.23429 0.10772 0.38812 0.11714 0.74535 0.11714 0.91109 0.14571 0.77823 0.19143 " +"0.20764 0.20857 0.92723 0.22571 0.34286 0.23215 0.78437 0.27143 0.92723 0.27714 " +"0.75429 0.36430 0.89927 0.38571 0.72571 0.40132 0.86857 0.43270 0.67429 0.43927 " +"0.48000 0.45284 0.48571 0.44966 0.54857 0.46152 0.60000 0.46109 0.83429 0.46686 " +"0.72693 0.52286 0.49034 0.55714 0.49714 0.56395 0.78857 0.56473 0.58286 0.57109 " +"0.82857 0.60921 0.67429 0.61616 0.70400 0.64857 0.85294 0.65429 0.72680 0.70571 " +"0.87009 0.72286 0.35429 0.72298 0.22175 0.74571 0.72991 0.76286 0.72151 0.80286 " +"0.86244 0.80857 0.38857 0.82064 0.69143 0.85832 0.84571 0.85587 0.26241 0.87143 " +"0.43429 0.87829 0.64571 0.89641 0.48571 0.90723 0.29330 0.91714 0.60571 0.91252 " +"0.53143 0.91823 0.80384 0.92286 0.36000 0.97750 0.73143 0.98213 0.44571 1.01681 " +"0.65714 1.01470 0.52000 1.02991 0.60000 1.02723 66 3 11 " +"5 9 8 1 1 8 0 4 9 1 " +"9 4 13 7 0 8 6 13 4 17 13 " +"6 2 11 3 2 0 7 5 16 10 " +"12 5 11 10 16 15 11 2 7 16 5 " +"12 17 14 19 14 17 6 20 15 22 " +"19 18 23 22 15 16 14 18 19 21 23 " +"18 23 26 25 23 21 24 26 28 25 " +"30 32 36 25 34 27 35 32 33 35 29 " +"27 25 28 34 29 35 33 26 23 24 " +"37 36 32 39 32 35 35 27 34 37 32 " +"39 30 31 32 39 35 41 38 41 35 " +"38 42 41 40 42 38 42 40 44 40 43 " +"44 44 43 48 45 48 43 47 46 54 " +"49 48 50 50 48 45 49 53 52 63 52 " +"61 53 49 50 46 51 54 58 54 51 " +"58 55 62 62 55 64 66 57 60 61 52 " +"53 55 58 51 59 67 60 52 63 56 " +"56 65 59 55 57 64 64 57 66 65 56 " +"63 67 66 60 67 59 65 " +; + +char *VTK_VECTOR_TEXT_52 = (char *) "18 0.920000 " +"0.64571 -0.07295 0.64000 -0.06878 0.77143 -0.06878 0.77403 0.18571 0.16265 0.19143 " +"0.63429 0.18882 0.92000 0.19408 0.15891 0.31143 0.91735 0.31143 0.29653 0.31714 " +"0.63740 0.31714 0.77714 0.31403 0.16571 0.32228 0.16616 0.32286 0.63429 0.79380 " +"0.77186 1.02000 0.66857 1.02282 0.76571 1.02420 18 2 1 0 1 3 5 1 2 " +"3 3 10 5 9 4 5 4 9 7 " +"6 11 3 8 11 6 7 9 13 15 16 " +"14 9 5 10 7 13 12 13 14 16 " +"11 10 3 14 13 9 14 10 11 15 17 " +"16 15 14 11 " +; + +char *VTK_VECTOR_TEXT_53 = (char *) "54 0.932946 " +"0.52571 -0.09009 0.61714 -0.08665 0.44571 -0.07673 0.73143 -0.05179 0.35429 -0.03759 " +"0.78914 -0.01429 0.30286 0.00241 0.53714 0.02152 0.62857 0.03184 0.84115 0.03714 " +"0.46857 0.03927 0.66286 0.04645 0.26286 0.04921 0.42286 0.06759 0.71429 0.08439 " +"0.88045 0.09429 0.23343 0.10000 0.38812 0.10571 0.74535 0.12286 0.35748 0.16857 " +"0.77294 0.18000 0.91681 0.18000 0.20420 0.20857 0.34286 0.22376 0.78705 0.23714 " +"0.93295 0.27143 0.79009 0.31714 0.93252 0.33429 0.77714 0.38420 0.91681 0.42000 " +"0.34857 0.43034 0.75641 0.43143 0.23088 0.44857 0.72000 0.47868 0.40000 0.48400 " +"0.68000 0.50784 0.86902 0.51714 0.46857 0.52437 0.53143 0.53848 0.57714 0.53848 " +"0.58857 0.53621 0.60000 0.53580 0.82286 0.56972 0.38494 0.59714 0.77714 0.60535 " +"0.48571 0.64244 0.69714 0.64327 0.56571 0.65848 0.61714 0.65848 0.43891 0.87714 " +"0.44571 0.88395 0.88043 0.88857 0.88043 1.00857 0.33714 1.01182 52 7 1 " +"8 7 0 1 7 2 0 2 10 4 " +"6 13 12 3 8 1 3 11 8 10 2 " +"7 4 13 6 11 3 14 19 16 12 " +"3 5 14 9 14 5 10 13 4 22 19 " +"23 18 15 20 17 12 13 15 14 9 " +"14 15 18 19 12 17 25 26 24 20 21 " +"24 21 20 15 22 16 19 25 24 21 " +"26 25 27 29 28 26 29 26 27 43 37 " +"45 36 31 29 34 32 30 31 36 33 " +"31 28 29 32 34 43 48 47 41 45 38 " +"47 42 33 36 41 39 40 38 39 47 " +"37 38 45 47 39 41 44 33 42 43 34 " +"37 46 33 44 35 46 41 33 46 35 " +"46 48 41 32 43 53 43 49 53 49 50 " +"53 53 50 52 50 51 52 " +; + +char *VTK_VECTOR_TEXT_54 = (char *) "70 0.927232 " +"0.55429 -0.09009 0.66857 -0.08034 0.43429 -0.06213 0.75429 -0.04607 0.34857 -0.00972 " +"0.81143 -0.00439 0.59429 0.02152 0.51339 0.03143 0.85188 0.04286 0.67429 0.04645 " +"0.46286 0.05579 0.27384 0.07714 0.41714 0.09597 0.73143 0.09597 0.89355 0.11714 " +"0.38771 0.14000 0.91177 0.16857 0.77294 0.17429 0.22816 0.18571 0.36530 0.19714 " +"0.78705 0.24857 0.92680 0.25429 0.35320 0.26000 0.78665 0.30571 0.20420 0.31143 " +"0.35320 0.31143 0.92723 0.31714 0.36657 0.37429 0.77395 0.37429 0.75429 0.41841 " +"0.39179 0.42571 0.89756 0.44286 0.72000 0.46418 0.43429 0.47258 0.19891 0.50571 " +"0.33714 0.50495 0.48000 0.50213 0.66857 0.50086 0.86241 0.50571 0.55429 0.52134 " +"0.61143 0.51866 0.80403 0.56857 0.42286 0.58821 0.74286 0.60943 0.34134 0.63143 " +"0.50857 0.62823 0.68000 0.63252 0.57714 0.64134 0.21563 0.66000 0.77714 0.74697 " +"0.37502 0.75714 0.90966 0.76286 0.25673 0.80286 0.41901 0.83143 0.73143 0.85191 " +"0.45143 0.86686 0.87343 0.87714 0.30036 0.88286 0.68000 0.89514 0.50286 0.90086 " +"0.51429 0.90530 0.52000 0.90784 0.60571 0.91866 0.83846 0.92857 0.35429 0.94384 " +"0.40571 0.98150 0.76000 0.99229 0.49143 1.01748 0.68571 1.02041 0.56571 1.02991 70 " +"2 10 4 6 1 9 3 5 13 0 7 " +"2 3 9 1 1 6 0 9 3 13 " +"7 0 6 10 2 7 20 26 23 4 12 " +"11 13 8 17 4 10 12 11 19 18 " +"17 21 20 15 11 12 11 15 19 16 17 " +"14 18 22 24 8 14 17 8 13 5 " +"24 35 34 22 18 19 20 21 26 28 23 " +"26 21 17 16 24 27 35 24 22 25 " +"28 31 29 31 28 26 24 25 27 32 41 " +"37 30 35 27 34 44 48 35 33 42 " +"43 37 41 46 39 40 32 29 38 38 29 " +"31 33 35 30 33 36 42 42 36 45 " +"45 39 47 36 39 45 37 46 40 41 32 " +"38 46 37 43 47 39 46 44 34 35 " +"48 50 52 48 44 50 49 56 54 57 53 " +"64 57 52 50 54 66 58 51 56 49 " +"62 69 61 53 57 50 61 59 60 59 65 " +"55 65 64 55 58 68 62 55 64 53 " +"66 54 63 63 54 56 65 59 67 69 62 " +"68 67 59 61 69 67 61 68 58 66 " +; + +char *VTK_VECTOR_TEXT_55 = (char *) "17 0.923788 " +"0.37143 -0.07186 0.50286 -0.07186 0.36723 -0.06571 0.37335 0.02000 0.52991 0.11143 " +"0.40379 0.18571 0.59787 0.35143 0.47387 0.41429 0.66857 0.51873 0.53355 0.55143 " +"0.63384 0.72857 0.80893 0.76286 0.74359 0.88286 0.21714 0.88546 0.92379 0.91143 " +"0.21403 1.00857 0.92311 1.00857 15 3 0 1 2 0 3 3 4 5 4 3 1 6 7 5 6 5 4 9 " +"7 6 10 9 8 8 9 6 10 11 12 11 10 8 15 13 12 12 14 16 15 " +"12 16 11 14 12 " +; + +char *VTK_VECTOR_TEXT_56 = (char *) "83 0.926804 " +"0.53143 -0.08966 0.62857 -0.08665 0.45143 -0.07605 0.73714 -0.05641 0.38857 -0.05343 " +"0.34286 -0.02616 0.79429 -0.02250 0.28571 0.02445 0.58857 0.02152 0.50857 0.02823 " +"0.85258 0.03143 0.66937 0.04286 0.45143 0.05070 0.71429 0.07296 0.41143 0.07868 " +"0.24000 0.09016 0.89927 0.10571 0.37669 0.12286 0.76613 0.14000 0.21462 0.15714 " +"0.35849 0.16286 0.92109 0.17429 0.78705 0.22000 0.34437 0.22571 0.20420 0.27143 " +"0.92680 0.27143 0.78437 0.28286 0.34748 0.28857 0.77143 0.32947 0.91470 0.33429 " +"0.21714 0.34118 0.37502 0.36286 0.73296 0.39143 0.89057 0.39143 0.24359 0.40286 " +"0.41883 0.41429 0.69143 0.42722 0.27275 0.44286 0.85714 0.43841 0.46286 0.44371 " +"0.50286 0.45748 0.63429 0.45470 0.58286 0.46420 0.80507 0.48286 0.33143 0.49007 " +"0.40456 0.52286 0.72693 0.52286 0.32000 0.57616 0.54857 0.57580 0.62286 0.58319 " +"0.82082 0.58571 0.49714 0.58657 0.66286 0.60073 0.28527 0.61429 0.44571 0.61582 " +"0.70439 0.63714 0.85759 0.63714 0.25756 0.67143 0.72657 0.67143 0.39849 0.68286 " +"0.87470 0.68286 0.74134 0.72857 0.38705 0.73429 0.88109 0.76857 0.24764 0.77429 " +"0.73395 0.79714 0.39470 0.80286 0.87177 0.82000 0.71641 0.83714 0.27216 0.86571 " +"0.44000 0.87296 0.84486 0.88286 0.66286 0.89179 0.48000 0.90086 0.61714 0.91184 " +"0.54286 0.91823 0.31846 0.93429 0.80571 0.93555 0.38286 0.98616 0.72000 0.99800 " +"0.43429 1.01008 0.53143 1.02991 0.61714 1.02723 85 0 " +"9 2 12 4 2 1 8 0 6 11 3 5 14 7 9 0 8 8 1 11 4 " +"12 5 13 11 6 1 3 11 12 2 9 5 12 14 13 10 18 7 17 15 10 " +"13 6 15 20 19 7 14 17 18 16 22 16 18 10 20 15 17 19 23 24 16 " +"21 22 22 25 26 23 19 20 24 27 30 25 22 21 27 24 23 31 34 30 31 " +"37 34 29 28 26 31 30 27 29 26 25 33 28 29 28 33 32 36 32 43 37 " +"31 44 40 45 39 44 39 45 43 32 38 35 44 31 42 48 40 44 35 39 41 " +"46 42 36 46 41 32 33 38 48 42 49 46 36 43 48 45 40 42 46 49 51 " +"45 48 49 46 52 47 54 53 52 46 55 53 59 57 45 54 47 45 51 54 50 " +"55 46 59 53 54 50 58 55 58 50 61 57 62 64 61 63 65 56 61 50 57 " +"59 62 60 61 56 64 66 69 63 67 65 64 62 66 63 61 60 71 68 65 76 " +"69 66 72 68 77 71 65 67 76 70 78 70 76 66 74 82 75 80 78 70 79 " +"72 77 74 72 79 80 73 75 80 75 81 68 71 77 73 80 70 82 81 75 82 " +"74 79 " +; + +char *VTK_VECTOR_TEXT_57 = (char *) "72 0.927232 " +"0.50286 -0.09009 0.56000 -0.09009 0.42857 -0.07673 0.64571 -0.07395 0.36000 -0.04771 " +"0.74286 -0.02616 0.28759 0.01429 0.51429 0.02152 0.57143 0.02420 0.80115 0.02571 " +"0.47429 0.02891 0.42857 0.05007 0.64000 0.04943 0.24930 0.07714 0.39314 0.08286 " +"0.85229 0.10000 0.70902 0.11143 0.37057 0.12286 0.22177 0.17429 0.34857 0.18947 " +"0.75109 0.19714 0.89395 0.20286 0.75429 0.20739 0.75681 0.21429 0.90966 0.27143 " +"0.50286 0.30152 0.42857 0.31605 0.61714 0.31462 0.37714 0.33787 0.70286 0.35759 " +"0.78705 0.37429 0.32000 0.37846 0.58286 0.42152 0.50286 0.42891 0.63429 0.43184 " +"0.78286 0.43630 0.92723 0.43714 0.26286 0.44350 0.45143 0.45107 0.68571 0.45750 " +"0.41587 0.47714 0.23787 0.48857 0.74498 0.52286 0.36359 0.55143 0.21522 0.55714 " +"0.92680 0.56286 0.76571 0.57009 0.34437 0.63143 0.77823 0.63714 0.20462 0.69429 " +"0.77866 0.69429 0.91236 0.70000 0.35429 0.74118 0.76571 0.76404 0.21756 0.77429 " +"0.38286 0.80921 0.87343 0.82571 0.40759 0.84286 0.72571 0.84118 0.24527 0.84857 " +"0.69143 0.87527 0.84000 0.88221 0.47429 0.89641 0.28571 0.90975 0.63429 0.90784 " +"0.54857 0.91866 0.33143 0.95527 0.76000 0.96331 0.39629 0.99714 0.68571 1.00437 " +"0.49714 1.02723 0.57714 1.02991 72 3 8 1 2 11 4 0 7 2 " +"8 3 12 4 14 6 0 1 8 6 17 " +"13 10 2 7 7 0 8 5 12 3 " +"12 5 16 2 10 11 4 11 14 5 9 " +"16 18 13 19 16 15 20 15 23 20 " +"6 14 17 13 17 19 21 23 15 22 20 " +"23 23 24 30 16 9 15 23 21 24 " +"25 32 26 27 32 25 38 28 26 43 41 " +"37 34 29 39 33 26 32 29 34 27 " +"30 36 35 34 32 27 36 30 24 28 38 " +"31 31 38 37 35 39 29 38 26 33 " +"39 35 42 42 35 36 40 37 38 44 41 " +"43 42 36 46 44 47 49 43 37 40 " +"48 46 45 36 45 46 51 50 48 52 54 " +"49 47 44 43 50 51 53 51 48 45 " +"59 54 52 59 55 63 52 49 47 53 61 " +"58 56 53 51 55 59 52 53 56 61 " +"66 63 57 55 57 63 62 68 57 58 67 " +"60 67 58 61 68 66 57 60 69 64 " +"68 62 70 60 67 69 64 71 65 65 70 " +"62 70 65 71 64 69 71 " +; + +char *VTK_VECTOR_TEXT_58 = (char *) "14 0.432768 " +"0.28571 -0.07295 0.42857 -0.07186 0.28000 -0.06878 0.43277 -0.06571 0.27957 0.07714 " +"0.28571 0.08134 0.42857 0.08025 0.27957 0.57429 0.28571 0.57009 0.43168 0.57429 " +"0.27848 0.71714 0.43277 0.71714 0.28265 0.72286 0.42857 0.72329 10 " +"2 5 4 2 0 5 0 3 5 6 5 " +"3 0 1 3 7 8 10 10 11 13 " +"9 10 8 12 10 13 11 10 9 " +; + +char *VTK_VECTOR_TEXT_59 = (char *) "18 0.432768 " +"0.30857 -0.28726 0.36571 -0.25275 0.27323 -0.23714 0.39543 -0.22000 0.32384 -0.19143 " +"0.33756 -0.16857 0.42327 -0.15714 0.43277 -0.10000 0.35472 -0.07714 0.28571 -0.07295 " +"0.34857 -0.07295 0.28000 -0.06878 0.27957 0.07714 0.43168 0.07714 0.27957 0.57429 " +"0.43168 0.57429 0.28265 0.72286 0.42857 0.72329 14 2 1 4 5 4 3 0 1 " +"2 5 6 8 3 4 1 6 5 3 " +"6 7 8 11 10 12 12 10 13 8 7 " +"10 11 9 10 13 10 7 17 16 15 " +"15 16 14 " +; + +char *VTK_VECTOR_TEXT_60 = (char *) "11 0.952690 " +"0.94857 0.09939 0.95269 0.10571 0.95236 0.22571 0.22894 0.40857 0.38919 0.46571 " +"0.38919 0.47143 0.22748 0.52857 0.23192 0.53429 0.95098 0.70571 0.95216 0.83143 " +"0.94857 0.83523 9 4 0 2 5 7 6 4 3 0 0 1 2 7 " +"8 10 4 5 3 5 6 3 8 9 10 7 5 8 " +; + +char *VTK_VECTOR_TEXT_61 = (char *) "12 0.952768 " +"0.22857 0.23975 0.94857 0.23975 0.22437 0.35714 0.95277 0.35714 0.22857 0.36329 " +"0.94857 0.36329 0.22857 0.57385 0.94857 0.57385 0.22437 0.58000 0.95277 0.58000 " +"0.22857 0.69740 0.94857 0.69740 8 0 4 " +"2 0 1 5 4 0 5 3 5 1 " +"11 7 9 10 6 7 10 7 11 8 6 " +"10 " +; + +char *VTK_VECTOR_TEXT_62 = (char *) "11 0.952360 " +"0.23429 0.09914 0.22857 0.10169 0.22748 0.22571 0.23192 0.23143 0.95116 0.40857 " +"0.79073 0.46571 0.79073 0.47143 0.95236 0.52857 0.22897 0.70571 0.22857 0.83287 " +"0.23429 0.83563 9 1 0 2 3 2 0 3 0 5 4 7 5 4 " +"5 0 6 5 7 6 10 8 8 10 9 10 6 7 " +; + +char *VTK_VECTOR_TEXT_63 = (char *) "45 0.918074 " +"0.47429 -0.07186 0.62021 -0.07143 0.47118 0.07714 0.62329 0.07714 0.49979 0.19714 " +"0.62021 0.19714 0.49563 0.20286 0.49563 0.27714 0.63681 0.31714 0.50816 0.34571 " +"0.65714 0.36350 0.53669 0.41429 0.70857 0.42384 0.57868 0.47143 0.82857 0.53597 " +"0.86902 0.58571 0.73258 0.62000 0.90437 0.65429 0.76086 0.66000 0.77522 0.70000 " +"0.91580 0.70000 0.34857 0.71338 0.21034 0.73429 0.77866 0.75143 0.91807 0.76857 " +"0.22605 0.80857 0.76571 0.80375 0.38286 0.82144 0.73714 0.85191 0.25098 0.87143 " +"0.89143 0.86730 0.43597 0.88857 0.86812 0.90571 0.67429 0.90616 0.48571 0.91800 " +"0.62857 0.92538 0.29296 0.93429 0.54857 0.93277 0.81143 0.96670 0.35429 0.98821 " +"0.76571 0.99800 0.44571 1.02891 0.69714 1.02680 0.53143 1.04395 0.60000 1.04437 41 2 1 3 2 0 1 7 6 4 7 4 5 8 9 7 11 10 13 8 " +"7 5 8 10 11 9 8 11 13 12 16 12 13 10 14 16 12 14 15 16 16 " +"15 18 17 18 15 17 23 19 17 19 18 20 23 17 29 27 36 26 32 28 21 " +"25 22 26 23 24 27 29 25 24 23 20 36 31 39 28 40 33 30 26 24 35 " +"44 37 31 36 27 27 25 21 31 34 41 42 33 40 28 38 40 39 31 41 38 " +"28 32 26 30 32 42 35 33 41 34 43 43 37 44 34 37 43 44 35 42 " +; + +char *VTK_VECTOR_TEXT_64 = (char *) "114 1.632597 " +"0.92571 -0.39563 1.16571 -0.38109 0.74857 -0.37236 0.65143 -0.34613 1.33143 -0.33070 " +"0.54286 -0.29914 0.86286 -0.27866 1.06286 -0.28134 1.45650 -0.26000 0.73714 -0.25387 " +"1.21143 -0.25387 0.43429 -0.22384 0.62286 -0.21216 1.32144 -0.20857 1.55582 -0.17429 " +"0.53714 -0.16099 0.52571 -0.15258 0.53143 -0.15669 0.33714 -0.11650 1.45143 -0.11561 " +"0.46286 -0.09260 0.80000 -0.07295 1.20571 -0.07252 1.09714 -0.06891 0.71429 -0.06252 " +"1.49714 -0.06187 1.63260 -0.06000 0.29629 -0.04857 1.29714 -0.04498 0.90857 -0.03629 " +"1.03384 -0.02571 0.62857 -0.01582 0.40486 -0.00857 0.59429 0.01873 1.41143 0.03296 " +"0.82857 0.03907 0.77714 0.04327 1.01143 0.04414 1.20000 0.05050 1.16989 0.06571 " +"1.25143 0.06086 0.90857 0.06821 0.72000 0.07561 0.54771 0.09429 1.15580 0.09429 " +"0.24420 0.10000 0.35748 0.11143 0.96000 0.10725 0.68527 0.11714 1.33841 0.11714 " +"1.51579 0.15714 0.66177 0.17429 1.41355 0.20286 1.03514 0.20857 0.65295 0.23143 " +"0.22437 0.23714 0.51277 0.23714 0.33563 0.24857 1.45355 0.27714 1.07177 0.31143 " +"1.58478 0.31143 0.65966 0.32857 1.48319 0.36857 0.53184 0.39714 0.23277 0.40286 " +"0.34478 0.40857 1.60420 0.42571 1.08420 0.44286 0.71514 0.48857 0.25184 0.49429 " +"1.49295 0.49429 0.57229 0.50000 1.60109 0.52857 1.05714 0.54144 0.75846 0.55143 " +"0.38645 0.55714 1.47681 0.58571 1.01143 0.59527 0.81714 0.60331 1.58605 0.60857 " +"1.12878 0.61429 0.65714 0.62418 0.86286 0.62319 0.96571 0.62151 0.92571 0.62991 " +"0.42857 0.64350 1.44571 0.66730 0.32359 0.67714 1.06048 0.68286 0.74857 0.69641 " +"1.15429 0.71588 1.28235 0.71714 1.00571 0.71800 0.82857 0.73109 0.92000 0.74152 " +"1.52657 0.75143 0.51275 0.75714 0.37669 0.76286 1.38286 0.76132 0.59493 0.82571 " +"1.30857 0.82821 1.45561 0.84857 0.47429 0.87296 0.73143 0.89681 1.18286 0.89580 " +"1.08571 0.92395 1.37143 0.92400 0.92000 0.93580 0.58286 0.95188 1.30857 0.96371 " +"0.71429 1.00899 1.18286 1.01470 0.92000 1.04437 1.01143 1.04395 114 0 6 2 1 7 0 6 0 7 " +"7 1 10 2 9 3 3 12 5 9 2 " +"6 10 4 13 4 10 1 15 5 12 " +"5 15 11 13 8 19 12 3 9 8 13 " +"4 11 20 18 11 15 16 17 16 15 " +"14 19 8 26 25 14 20 11 16 22 38 " +"23 25 19 14 23 39 30 30 39 37 " +"27 46 45 18 32 27 32 18 20 21 36 " +"24 35 29 41 24 42 31 29 35 21 " +"22 28 40 38 22 40 34 49 40 33 31 " +"48 36 21 35 37 47 41 33 48 43 " +"43 51 56 44 37 39 34 40 28 47 37 " +"53 50 52 34 38 39 23 52 49 34 " +"37 44 53 27 32 46 42 24 36 48 31 " +"42 37 41 29 45 57 55 53 44 59 " +"51 54 56 52 50 58 58 60 62 43 48 " +"51 45 46 57 56 61 63 64 55 57 " +"91 80 44 60 58 50 62 66 70 56 54 " +"61 44 80 67 59 44 67 71 63 61 " +"64 65 69 67 80 73 65 64 57 66 62 " +"60 68 71 61 71 68 81 69 75 87 " +"72 70 66 74 81 68 77 73 80 70 79 " +"76 75 69 65 83 77 88 87 85 97 " +"81 74 89 89 78 93 86 76 79 70 72 " +"79 74 78 89 88 77 80 75 85 87 " +"82 84 94 91 90 80 86 95 98 78 82 " +"93 92 83 88 93 82 94 84 83 92 " +"94 84 92 97 96 102 95 86 79 102 99 " +"108 95 101 98 96 97 85 96 99 102 " +"98 101 100 103 108 99 100 109 104 106 100 " +"101 108 103 110 105 113 107 100 106 109 " +"104 111 105 107 112 110 111 104 109 113 105 " +"111 112 107 113 107 110 103 " +; + +char *VTK_VECTOR_TEXT_65 = (char *) "13 1.155731 " +"0.14455 -0.07143 1.00000 -0.07252 1.15573 -0.07143 0.29143 -0.07103 0.40981 0.25429 " +"0.86857 0.25754 0.45714 0.37713 0.82478 0.38000 0.45462 0.38571 0.58538 0.73429 " +"0.63429 0.90068 0.56000 1.02454 0.71429 1.02644 13 5 " +"1 2 0 8 11 6 4 5 12 10 7 0 3 4 0 4 8 6 5 7 6 " +"8 4 7 5 2 8 9 11 9 10 11 12 7 2 11 10 12 " +; + +char *VTK_VECTOR_TEXT_66 = (char *) "48 1.081090 " +"0.25714 -0.07186 0.78286 -0.06723 0.86857 -0.04899 0.93714 -0.02045 1.00725 0.03714 " +"0.39957 0.06000 0.73143 0.05621 0.80571 0.06891 1.04213 0.08857 0.87555 0.10571 " +"1.06437 0.14000 0.91070 0.15143 1.08109 0.22000 0.93295 0.22571 0.93252 0.26571 " +"1.07177 0.32286 0.90857 0.34064 1.04616 0.38571 0.86857 0.38686 0.79429 0.42252 " +"0.39957 0.43143 1.01296 0.43143 0.69714 0.43563 0.97143 0.46686 0.88197 0.51143 " +"0.40571 0.56437 0.72000 0.56705 0.39848 0.57429 0.96956 0.58571 0.80571 0.58930 " +"0.84686 0.62000 0.99641 0.62571 0.86943 0.65429 1.02437 0.70571 0.88420 0.71143 " +"1.02665 0.76857 0.87429 0.79232 1.01673 0.82000 0.84000 0.84984 0.77714 0.88538 " +"0.98607 0.88857 0.39957 0.89429 0.71429 0.89580 0.93143 0.95296 0.85714 0.99756 " +"0.80000 1.01470 0.25714 1.02615 0.70857 1.02680 50 1 6 0 2 7 1 " +"0 20 46 7 2 9 1 7 6 20 27 " +"46 9 4 11 4 9 3 2 3 9 " +"11 10 13 8 11 4 10 11 8 12 13 " +"10 14 17 16 14 15 17 16 21 18 " +"14 13 12 15 14 12 23 18 21 5 0 " +"6 19 26 22 18 24 19 16 17 21 " +"24 18 23 26 19 29 19 24 29 25 22 " +"26 22 25 20 30 29 24 32 28 31 " +"28 32 30 32 31 34 0 5 20 34 35 " +"36 33 34 31 28 30 24 36 40 38 " +"38 44 39 35 37 36 34 33 35 25 27 " +"20 27 41 46 40 36 37 43 38 40 " +"39 45 42 42 47 41 38 43 44 45 39 " +"44 47 46 41 47 42 45 " +; + +char *VTK_VECTOR_TEXT_67 = (char *) "56 1.186046 " +"0.69143 -0.08966 0.80000 -0.08705 0.60000 -0.07823 0.50857 -0.05070 0.93143 -0.05216 " +"0.45714 -0.02486 1.00000 -0.01473 0.39597 0.02000 0.69714 0.03563 0.74857 0.03563 " +"0.62286 0.04899 0.82286 0.04899 1.08000 0.05597 0.57143 0.06784 0.88000 0.07229 " +"0.32571 0.10064 0.93143 0.10759 0.49143 0.11901 1.13800 0.14000 0.45600 0.15714 " +"0.28930 0.16286 0.99641 0.18571 0.41502 0.22571 1.18605 0.27714 0.24319 0.28857 " +"1.04571 0.31105 0.38244 0.32857 0.22748 0.36286 0.36723 0.44286 0.21866 0.52857 " +"0.36991 0.55714 0.22705 0.60857 1.02857 0.69469 0.40657 0.71143 1.16694 0.72857 " +"0.26286 0.74089 0.44187 0.78000 1.13927 0.80857 0.97143 0.80914 0.48000 0.82725 " +"0.31750 0.84286 0.93714 0.85011 0.53143 0.86784 0.89143 0.88331 1.07582 0.90571 " +"0.64000 0.91252 0.64571 0.91335 0.65714 0.91563 0.38286 0.91868 0.78857 0.91823 " +"1.00571 0.96902 0.50286 0.99756 0.93143 1.01070 0.58286 1.02680 0.70286 1.04705 " +"0.80000 1.04437 54 " +"1 9 0 0 8 2 14 6 16 4 14 " +"11 24 20 22 7 17 15 2 10 3 " +"8 10 2 9 1 11 0 9 8 4 11 " +"1 3 13 5 12 16 6 10 13 3 " +"5 13 7 7 13 17 22 20 15 16 12 " +"21 14 4 6 19 15 17 23 25 18 " +"22 15 19 25 21 18 18 21 12 27 28 " +"29 27 24 26 26 24 22 28 27 26 " +"29 30 31 30 29 28 33 35 31 35 33 " +"40 33 31 30 34 37 32 48 42 51 " +"36 40 33 40 36 48 38 44 41 44 38 " +"37 32 37 38 48 39 42 36 39 48 " +"54 53 47 45 51 42 49 43 52 50 41 " +"44 47 45 46 41 50 43 45 53 51 " +"49 54 47 53 45 47 49 55 54 55 49 " +"52 52 43 50 " +; + +char *VTK_VECTOR_TEXT_68 = (char *) "34 1.167232 " +"0.26286 -0.07186 0.70286 -0.07252 0.80000 -0.06109 0.89714 -0.03355 0.99555 0.02571 " +"0.40528 0.06000 0.72571 0.05891 1.03582 0.06571 0.79547 0.07143 0.88000 0.10893 " +"1.08150 0.12857 0.92115 0.14571 0.96657 0.21429 1.13966 0.26571 0.99470 0.28857 " +"1.16420 0.39714 1.01823 0.43714 1.16723 0.52857 1.01823 0.53429 1.15277 0.64286 " +"1.00000 0.65848 0.97714 0.72375 1.11216 0.77429 0.94286 0.78057 0.87429 0.84902 " +"1.06607 0.85429 0.81714 0.87865 0.40528 0.89429 0.69143 0.89807 0.97714 0.94616 " +"0.90857 0.98657 0.81143 1.01580 0.26286 1.02615 0.70286 1.02680 34 2 6 1 5 0 1 " +"8 3 9 3 8 2 0 27 32 6 2 " +"8 5 1 6 4 7 11 4 9 3 " +"9 4 11 11 10 12 11 7 10 13 14 " +"12 14 15 16 13 12 10 16 17 18 " +"14 13 15 18 19 20 17 16 15 18 17 " +"19 22 21 20 21 22 23 29 24 23 " +"22 20 19 26 24 30 0 5 27 25 23 " +"22 29 23 25 30 24 29 26 31 28 " +"31 26 30 33 32 27 28 33 27 33 28 " +"31 " +; + +char *VTK_VECTOR_TEXT_69 = (char *) "15 1.080000 " +"0.26857 -0.07186 1.08000 -0.06878 1.08000 0.05164 0.41100 0.06000 0.41100 0.42571 " +"1.01143 0.43100 1.01563 0.55143 0.41714 0.55866 1.01143 0.55757 0.40991 0.56857 " +"0.41100 0.89429 1.05143 0.89957 1.05563 1.02000 0.26857 1.02615 1.05143 1.02615 13 0 4 13 1 3 0 1 2 3 0 " +"3 4 7 5 8 5 7 4 6 8 5 4 9 13 7 9 4 9 10 13 11 " +"14 10 14 13 10 12 14 11 " +; + +char *VTK_VECTOR_TEXT_70 = (char *) "12 1.005714 " +"0.26857 -0.07186 0.40571 -0.07186 0.40991 0.42000 0.41714 0.42723 0.92615 0.43143 " +"0.92615 0.55143 0.41714 0.55563 0.40991 0.56286 0.41100 0.89429 1.00571 0.90265 " +"1.00571 1.02307 0.26857 1.02615 10 0 2 " +"11 2 7 11 2 0 1 6 4 5 " +"4 6 3 3 6 2 7 2 6 7 8 " +"11 11 8 10 8 9 10 " +; + +char *VTK_VECTOR_TEXT_71 = (char *) "60 1.234286 " +"0.82286 -0.08966 0.65714 -0.07866 0.93143 -0.07335 0.56571 -0.05387 1.05143 -0.03355 " +"0.48000 -0.01514 1.12000 0.00073 0.74286 0.03866 0.83429 0.04177 0.38857 0.05044 " +"0.65143 0.05470 0.92571 0.06319 1.23260 0.07714 0.34857 0.09302 0.54286 0.10150 " +"1.03429 0.11229 0.50286 0.13044 1.09252 0.15714 0.44421 0.19714 0.27429 0.21629 " +"0.24252 0.31143 0.39320 0.31143 0.77714 0.36243 1.09143 0.35773 0.22748 0.39714 " +"0.37605 0.40286 0.77295 0.48286 0.77714 0.48900 1.23429 0.48900 0.22437 0.51143 " +"0.37295 0.51714 0.23320 0.59143 0.39748 0.65429 1.09143 0.68617 1.08571 0.69099 " +"0.42073 0.71714 1.21977 0.72286 0.27387 0.73429 1.06286 0.75301 0.30645 0.80286 " +"0.47616 0.80286 1.02286 0.82127 1.18498 0.82571 0.54286 0.86150 0.34857 0.86629 " +"0.94286 0.88371 1.14857 0.88793 0.61143 0.89580 0.86286 0.91184 0.40168 0.92286 " +"0.70857 0.91866 0.80000 0.92134 1.09714 0.94384 0.45714 0.96436 0.53714 1.00498 " +"1.00000 1.00371 0.93714 1.02613 0.62857 1.03252 0.73714 1.04705 0.84571 1.04395 58 0 7 1 14 5 3 5 14 " +"9 2 8 0 1 10 3 0 8 7 " +"8 2 11 18 13 9 17 6 12 10 1 " +"7 4 11 2 13 18 19 23 17 12 " +"15 6 17 4 6 15 16 9 14 11 4 " +"15 14 3 10 19 21 20 18 9 16 " +"30 31 29 23 27 22 25 24 20 22 27 " +"26 21 19 18 25 20 21 23 28 27 " +"28 23 12 29 24 25 30 29 25 31 32 " +"37 38 33 36 37 32 39 32 31 30 " +"35 39 32 34 33 38 39 40 44 38 46 " +"41 38 42 46 40 39 35 44 40 49 " +"53 43 54 43 49 40 42 38 36 43 47 " +"54 52 41 46 41 52 45 43 53 49 " +"54 47 57 50 57 47 45 56 48 55 45 " +"52 48 59 51 57 50 58 50 51 58 " +"56 45 55 58 51 59 59 48 56 " +; + +char *VTK_VECTOR_TEXT_72 = (char *) "16 1.125714 " +"0.26857 -0.07186 0.40571 -0.07186 0.98857 -0.07295 0.98286 -0.06878 1.12571 -0.06878 " +"0.40991 0.43714 0.41714 0.44437 0.97714 0.44329 0.41714 0.57277 0.97714 0.57385 " +"0.40991 0.58000 0.98550 1.02571 1.12571 1.02307 0.26857 1.02615 0.40571 1.02615 " +"1.12000 1.02723 14 4 9 7 0 5 13 5 10 13 " +"5 0 1 8 7 9 9 4 11 10 5 " +"8 6 8 5 4 3 2 7 8 6 " +"14 13 10 12 15 11 3 4 7 4 12 " +"11 " +; + +char *VTK_VECTOR_TEXT_73 = (char *) "4 0.428571 " +"0.42592 -0.07143 0.28571 -0.06878 0.28836 1.02571 0.42857 1.02307 2 1 3 2 3 1 0 " +; + +char *VTK_VECTOR_TEXT_74 = (char *) "27 0.790089 " +"0.45143 -0.09009 0.50857 -0.09009 0.37714 -0.07756 0.58404 -0.07714 0.33143 -0.06086 " +"0.64000 -0.05641 0.26489 -0.01429 0.71429 -0.00117 0.46286 0.03866 0.53714 0.04706 " +"0.74902 0.04857 0.41714 0.04899 0.57772 0.06571 0.21143 0.06772 0.37016 0.07714 " +"0.34498 0.11143 0.77252 0.11143 0.62371 0.11714 0.18705 0.16286 0.32462 0.17429 " +"0.64420 0.22571 0.79009 0.23143 0.18546 0.23714 0.31472 0.25429 0.64836 1.02571 " +"0.78857 1.02307 0.78286 1.02723 25 10 " +"12 7 4 2 11 0 1 8 3 8 1 11 2 8 0 8 2 8 3 9 9 " +"3 12 4 14 6 7 12 5 3 5 12 6 15 13 12 10 17 14 4 11 13 " +"19 18 6 14 15 22 19 23 17 16 20 13 15 19 16 17 10 22 18 19 21 " +"20 16 20 21 24 25 26 24 21 25 24 " +; + +char *VTK_VECTOR_TEXT_75 = (char *) "17 1.155019 " +"0.25714 -0.07186 0.39429 -0.07186 1.15502 -0.07143 0.97143 -0.07140 0.89527 0.28857 " +"0.89143 0.29371 0.89098 0.29429 0.39848 0.30000 0.57714 0.47913 0.40000 0.49126 " +"0.68956 0.56857 0.68571 0.57371 0.68527 0.57429 1.13216 1.02571 0.25714 1.02615 " +"0.39429 1.02615 0.94857 1.02680 15 0 9 14 0 7 9 3 10 8 3 6 10 9 8 16 4 5 6 7 " +"0 1 3 4 6 16 8 12 10 11 12 4 3 2 8 10 12 9 7 8 13 " +"16 12 15 14 9 " +; + +char *VTK_VECTOR_TEXT_76 = (char *) "7 0.941339 " +"0.25714 -0.07186 0.93714 -0.07186 0.94134 0.04857 0.39957 0.06000 0.93714 0.05472 " +"0.25714 1.02615 0.39429 1.02615 5 3 0 1 0 3 5 2 4 1 3 1 4 6 5 3 " +; + +char *VTK_VECTOR_TEXT_77 = (char *) "19 1.302857 " +"0.39164 -0.07143 0.71429 -0.07186 1.17143 -0.07295 0.25714 -0.06878 0.84000 -0.06947 " +"1.16571 -0.06878 1.30286 -0.06878 0.78286 0.09751 0.78857 0.09751 1.16000 0.83018 " +"0.40000 0.84467 0.52151 0.88286 0.52000 0.88739 0.51748 0.89429 0.47580 1.02000 " +"0.25979 1.02571 1.11429 1.02285 1.30286 1.02307 0.46857 1.02680 17 3 10 15 5 6 9 6 " +"5 2 1 11 10 4 8 1 1 7 11 9 16 8 1 8 7 9 8 4 10 " +"18 15 13 11 12 10 3 0 10 13 18 16 9 17 10 11 13 13 14 18 6 " +"17 9 " +; + +char *VTK_VECTOR_TEXT_78 = (char *) "14 1.125714 " +"0.26286 -0.07186 0.39429 -0.07186 0.98286 -0.07295 1.12571 -0.06878 0.98286 0.17231 " +"0.72045 0.31143 0.71678 0.31714 0.72000 0.31207 0.40000 0.78092 0.99122 1.02571 " +"1.12571 1.02307 0.26286 1.02615 0.40571 1.02644 1.12000 1.02723 12 " +"0 8 11 8 0 1 4 3 9 3 4 " +"2 4 5 2 6 7 5 12 6 4 " +"4 6 5 6 12 8 10 13 9 8 12 " +"11 3 10 9 " +; + +char *VTK_VECTOR_TEXT_79 = (char *) "63 1.267054 " +"0.70286 -0.08966 0.77714 -0.08966 0.61143 -0.07605 0.89714 -0.06823 0.97143 -0.04073 " +"0.49143 -0.03229 1.05650 0.00857 0.42286 0.01107 0.70857 0.03605 0.77143 0.03605 " +"0.63429 0.04899 0.84571 0.04899 1.12725 0.07143 0.35044 0.07714 0.92716 0.08286 " +"0.54857 0.08535 0.49143 0.12704 1.17465 0.13429 1.01296 0.15143 0.28571 0.17016 " +"0.43955 0.18571 1.21184 0.20286 0.40784 0.23714 1.08086 0.26000 1.24613 0.30000 " +"0.23109 0.31143 1.10665 0.34571 0.36764 0.36857 0.21295 0.43143 1.11848 0.43714 " +"1.26705 0.43714 0.36193 0.51143 1.11848 0.51714 0.21563 0.54571 0.36991 0.59143 " +"1.25522 0.61429 1.09966 0.63714 0.23236 0.64857 1.23681 0.68857 1.07070 0.71714 " +"0.41143 0.73016 0.26645 0.75143 1.20486 0.76857 0.45561 0.79714 1.02286 0.79270 " +"0.98857 0.82956 0.31429 0.83650 1.16045 0.84286 0.53143 0.86150 0.92000 0.87800 " +"0.35582 0.88857 0.63429 0.90764 0.85143 0.90613 1.10286 0.90956 0.71429 0.92134 " +"0.79429 0.91866 0.43493 0.95714 1.04000 0.95964 0.52000 1.00498 0.96000 1.00327 " +"0.89714 1.02613 0.63429 1.03866 0.77714 1.04705 63 0 8 2 1 9 0 8 10 2 2 10 5 9 1 11 5 " +"16 7 11 3 14 3 11 1 3 4 14 6 14 4 7 16 13 10 15 5 0 " +"9 8 16 5 15 14 6 18 13 20 19 12 18 6 18 17 23 17 21 23 20 " +"22 19 18 12 17 23 21 26 25 19 22 13 16 20 25 27 28 27 25 22 21 " +"24 26 30 29 26 32 35 36 30 26 24 33 34 37 32 29 30 28 31 33 31 " +"28 27 34 33 31 36 38 39 35 32 30 41 37 34 38 42 39 41 40 46 35 " +"38 36 39 47 44 40 43 46 53 45 44 46 43 50 45 57 49 40 41 34 56 " +"50 43 49 59 52 48 56 43 57 45 53 53 44 47 56 48 58 39 42 47 58 " +"51 61 59 49 57 51 58 48 55 52 60 62 54 55 59 60 52 61 54 62 54 " +"61 51 62 55 60 " +; + +char *VTK_VECTOR_TEXT_80 = (char *) "31 1.098661 " +"0.26286 -0.07186 0.40000 -0.07186 0.40420 0.36857 0.41143 0.37580 0.73714 0.37621 " +"0.88571 0.40034 0.98343 0.44857 0.41143 0.50420 0.72571 0.50420 0.40420 0.51143 " +"1.04045 0.51143 0.82947 0.52286 0.88571 0.55296 0.91678 0.58571 1.08252 0.59714 " +"0.93966 0.63143 1.09866 0.68286 0.94966 0.72857 0.93355 0.79143 1.08530 0.80857 " +"0.90857 0.83270 0.86857 0.86893 1.05927 0.87143 0.40528 0.89429 0.82286 0.88899 " +"0.74857 0.89807 1.02439 0.92286 0.96000 0.97641 0.89143 1.00538 0.26286 1.02615 " +"0.74286 1.02680 31 0 9 29 0 2 9 2 7 9 7 3 8 12 11 5 5 11 4 4 " +"8 3 3 7 2 2 0 1 11 8 4 13 12 6 10 13 6 6 12 5 14 " +"15 10 15 14 17 13 10 15 16 17 14 17 19 18 19 17 16 18 19 20 20 " +"27 21 22 20 19 9 23 29 30 25 24 25 30 23 27 20 26 20 22 26 28 " +"24 21 28 21 27 30 29 23 30 24 28 " +; + +char *VTK_VECTOR_TEXT_81 = (char *) "66 1.276398 " +"1.23429 -0.15444 1.13714 -0.11188 0.76571 -0.09009 0.64571 -0.08437 0.84000 -0.08034 " +"0.58286 -0.07034 1.27640 -0.06000 0.93143 -0.05470 0.46857 -0.02322 1.00000 -0.02293 " +"0.38857 0.03330 0.76000 0.03563 0.68000 0.03866 0.83547 0.04857 1.09814 0.04857 " +"0.61714 0.05177 0.87591 0.06571 0.55429 0.07800 0.80000 0.10784 0.49143 0.12132 " +"0.30857 0.12350 0.74115 0.12857 0.98286 0.13189 1.17355 0.14571 0.42857 0.19207 " +"0.86857 0.19927 0.26286 0.20486 1.05355 0.22000 0.77714 0.23134 0.39277 0.26000 " +"1.23177 0.27714 0.23387 0.28286 1.08823 0.30571 0.36420 0.36286 0.20991 0.40286 " +"0.35580 0.43714 1.25866 0.43714 1.11009 0.44286 0.20723 0.51714 1.25252 0.58000 " +"0.36420 0.59714 1.09823 0.60857 0.23470 0.67714 0.38857 0.68947 1.21184 0.73429 " +"1.05143 0.73841 0.42902 0.76857 0.28821 0.80286 1.00571 0.80413 1.17188 0.81429 " +"0.96000 0.84670 0.51429 0.85473 0.34473 0.88286 1.12000 0.88413 0.57714 0.89070 " +"0.88571 0.89070 0.64571 0.91252 0.76571 0.92093 0.42857 0.95759 1.03429 0.95864 " +"0.50286 0.99927 0.96571 0.99800 0.60000 1.03252 0.86857 1.03184 0.69714 1.04705 " +"0.77143 1.04665 66 0 6 1 " +"13 7 16 14 9 1 9 16 7 3 15 " +"5 16 9 14 11 4 13 11 2 4 " +"7 13 4 12 3 11 2 11 3 15 3 " +"12 5 17 8 8 19 10 10 19 20 " +"14 1 6 5 15 17 20 29 26 19 8 " +"17 21 18 28 22 16 14 16 25 18 " +"22 14 27 24 20 19 16 22 25 26 29 " +"31 18 25 28 14 23 27 27 30 32 " +"30 27 23 31 33 34 20 24 29 37 32 " +"30 33 31 29 34 33 38 36 37 30 " +"35 38 33 37 39 41 38 40 42 37 36 " +"39 41 44 45 40 38 35 42 43 47 " +"44 41 39 46 47 43 43 42 40 47 46 " +"52 45 49 48 59 50 48 52 51 58 " +"53 48 49 61 50 59 50 61 55 58 51 " +"60 51 52 46 49 45 44 59 48 53 " +"57 64 56 60 54 62 55 63 57 51 54 " +"60 54 56 62 62 56 64 63 55 61 " +"63 65 57 57 65 64 " +; + +char *VTK_VECTOR_TEXT_82 = (char *) "46 1.225355 " +"0.26857 -0.07186 0.40571 -0.07186 1.05143 -0.07215 1.22359 -0.07143 1.22535 -0.06571 " +"1.17465 0.01429 1.17143 0.01936 1.17098 0.02000 0.84571 0.24343 1.00571 0.27650 " +"0.76571 0.34698 0.91832 0.37429 0.73143 0.37678 0.40991 0.40857 0.68000 0.40437 " +"0.41714 0.41580 0.62286 0.41538 0.84226 0.42571 0.92571 0.44706 0.99429 0.47502 " +"1.07582 0.54000 0.41714 0.54420 0.40991 0.55143 0.80000 0.54764 0.88000 0.56538 " +"1.11641 0.60286 0.94286 0.60439 0.96784 0.63714 1.13823 0.67714 0.98966 0.69429 " +"0.99277 0.74571 1.14134 0.75143 0.97143 0.81493 1.12823 0.82000 0.93143 0.86115 " +"1.10498 0.87714 0.89143 0.88498 0.40991 0.90000 0.41714 0.90723 0.78857 0.90723 " +"1.07011 0.92857 1.01714 0.97579 0.97143 0.99865 0.87429 1.02109 0.26857 1.02615 " +"0.80571 1.02723 46 2 9 8 3 5 2 0 37 " +"44 5 7 2 5 6 7 3 4 5 " +"2 7 9 18 23 17 11 8 9 8 11 " +"10 0 22 37 11 17 10 21 16 23 " +"21 15 16 23 10 17 19 24 18 23 18 " +"24 23 12 10 15 21 13 0 21 22 " +"16 14 23 23 14 12 20 26 19 26 20 " +"27 24 19 26 27 25 29 28 30 29 " +"31 30 28 25 27 20 30 33 32 28 29 " +"25 33 30 31 32 40 34 35 32 33 " +"0 1 13 0 13 21 41 34 40 43 36 " +"42 38 39 45 32 35 40 42 34 41 " +"34 42 36 36 43 39 44 38 45 43 45 " +"39 37 38 44 " +; + +char *VTK_VECTOR_TEXT_83 = (char *) "69 1.081090 " +"0.71429 -0.08966 0.53714 -0.07866 0.82286 -0.07101 0.46286 -0.05959 0.38857 -0.02616 " +"0.94286 -0.01678 0.33714 0.01044 0.64000 0.03866 0.73143 0.04177 1.00571 0.03883 " +"0.56000 0.05177 0.28527 0.06571 0.50857 0.06930 0.83587 0.07143 1.04086 0.08857 " +"0.88127 0.10000 0.43429 0.11330 0.24486 0.13429 0.92613 0.15714 1.07177 0.16286 " +"0.38771 0.16857 0.94134 0.21429 0.36319 0.22571 0.21563 0.23714 1.08109 0.26571 " +"0.21403 0.27714 0.93294 0.27714 0.34857 0.28916 0.91011 0.31714 1.06816 0.32857 " +"0.84000 0.36943 1.04486 0.38000 0.76571 0.39673 0.98286 0.45241 0.53143 0.45748 " +"0.42857 0.49343 0.92571 0.49070 0.37143 0.52535 0.82857 0.53109 0.31044 0.58000 " +"0.53143 0.60899 0.43429 0.65616 0.26244 0.67143 0.39891 0.71143 0.90857 0.71084 " +"0.25295 0.72286 1.04615 0.72286 0.39320 0.76857 0.40359 0.80857 1.03109 0.81429 " +"0.26327 0.82000 0.87429 0.81493 0.45143 0.86956 0.82286 0.87258 0.28930 0.88286 " +"0.98812 0.90000 0.50857 0.90041 0.76571 0.90151 0.57714 0.91563 0.67429 0.91866 " +"0.95443 0.94000 0.35429 0.96099 0.89143 0.98784 0.40000 0.99188 0.83429 1.01470 " +"0.50286 1.03184 0.74857 1.03823 0.57143 1.04437 0.67429 1.04705 67 2 " +"8 0 0 7 1 6 4 16 6 16 11 0 8 7 7 10 1 8 2 13 5 " +"15 13 1 10 3 10 12 3 9 15 5 4 3 12 15 14 18 5 13 2 14 " +"15 9 16 4 12 21 24 26 18 19 21 11 20 17 20 11 16 17 22 23 19 " +"18 14 22 17 20 25 23 27 23 22 27 24 21 19 26 31 28 28 33 30 24 " +"29 26 30 38 32 26 29 31 34 32 38 33 28 31 34 40 35 33 36 30 39 " +"43 42 38 30 36 41 37 35 40 34 38 37 41 39 41 35 40 50 48 54 39 " +"41 43 44 46 49 45 42 43 45 47 50 48 50 47 60 51 55 47 45 43 51 " +"60 53 54 48 61 44 49 51 55 51 49 48 52 61 56 63 52 57 66 59 61 " +"52 63 63 56 65 62 53 60 53 64 57 53 62 64 59 66 58 65 58 67 58 " +"65 56 66 57 64 67 58 68 68 58 66 " +; + +char *VTK_VECTOR_TEXT_84 = (char *) "8 1.045714 " +"0.54286 -0.07186 0.68000 -0.07186 0.53757 0.89429 0.68528 0.89429 0.17714 0.90265 " +"1.04571 0.90265 0.17979 1.02571 1.04571 1.02307 6 0 3 2 3 0 " +"1 6 4 2 6 3 7 6 2 3 " +"3 5 7 " +; + +char *VTK_VECTOR_TEXT_85 = (char *) "32 1.126804 " +"0.65714 -0.09009 0.77143 -0.08705 0.53143 -0.07034 0.85714 -0.07101 0.47429 -0.05070 " +"0.94286 -0.03629 0.38286 0.00704 1.02286 0.02445 0.65714 0.04437 0.78857 0.05320 " +"0.33669 0.06000 0.58286 0.05748 0.84000 0.06823 0.52000 0.08535 1.07070 0.08857 " +"0.89714 0.10154 0.46857 0.13025 1.09966 0.15714 0.29143 0.15866 0.94899 0.17429 " +"0.43177 0.19714 0.27320 0.24286 0.97252 0.26000 1.12680 0.33429 0.26437 0.34000 " +"0.40991 0.34000 0.98134 0.34571 0.98550 1.02571 1.12571 1.02307 0.26857 1.02615 " +"0.40571 1.02615 1.12000 1.02723 30 3 9 1 10 20 18 8 0 " +"1 0 11 2 7 15 5 0 8 11 " +"8 1 9 9 3 12 13 4 2 5 12 " +"3 15 7 19 16 10 6 12 5 15 " +"4 13 6 13 2 11 21 18 20 13 16 " +"6 19 17 22 17 19 14 7 14 19 " +"10 16 20 25 24 21 23 26 22 23 22 " +"17 25 21 20 24 25 29 30 29 25 " +"28 31 27 26 23 27 23 28 27 " +; + +char *VTK_VECTOR_TEXT_86 = (char *) "8 1.148571 " +"0.57714 -0.07025 0.72571 -0.06947 0.64571 0.06079 0.65143 0.06062 0.15429 1.02560 " +"0.30286 1.02531 1.00571 1.02531 1.14857 1.02560 6 0 2 4 3 2 " +"0 3 7 6 1 3 0 3 1 7 " +"2 5 4 " +; + +char *VTK_VECTOR_TEXT_87 = (char *) "14 1.568063 " +"0.45143 -0.07186 0.60000 -0.07017 1.13143 -0.06912 1.27429 -0.06912 0.52571 0.09707 " +"1.20000 0.09787 1.13673 0.38000 0.86857 0.88103 0.16571 1.02562 0.78286 1.02446 " +"1.42857 1.02446 1.56806 1.02571 0.30857 1.02615 0.95429 1.02615 12 " +"2 6 7 6 2 5 1 4 0 7 9 " +"4 11 10 5 3 5 2 8 0 4 " +"13 7 6 9 7 13 7 4 1 11 5 " +"3 12 8 4 " +; + +char *VTK_VECTOR_TEXT_88 = (char *) "14 1.141168 " +"0.15194 -0.07143 1.14117 -0.07143 0.32000 -0.07106 0.97143 -0.07140 0.65143 0.37795 " +"0.74607 0.49429 0.56517 0.50000 0.74286 0.49909 0.74219 0.50000 0.65714 0.61727 " +"0.20016 1.02571 0.96000 1.02568 1.11260 1.02571 0.36571 1.02644 12 " +"0 2 6 3 5 4 5 6 4 5 8 " +"6 5 3 1 5 7 8 4 6 2 " +"9 6 8 12 11 8 6 13 10 13 6 " +"9 11 9 8 " +; + +char *VTK_VECTOR_TEXT_89 = (char *) "12 1.145205 " +"0.71164 -0.07143 0.57143 -0.06878 0.56891 0.39143 0.71787 0.39714 0.65143 0.51441 " +"0.43179 0.85429 0.42857 0.85936 0.42812 0.86000 0.15284 1.02571 0.32000 1.02535 " +"0.98286 1.02464 1.14521 1.02571 10 3 2 " +"1 3 1 0 4 2 3 2 9 8 " +"11 10 4 5 2 4 5 6 7 2 7 " +"9 2 5 7 11 4 3 " +; + +char *VTK_VECTOR_TEXT_90 = (char *) "11 1.040000 " +"0.17714 -0.07186 1.04000 -0.06878 1.04000 0.05164 0.17395 0.06000 0.34602 0.06000 " +"0.84777 0.89429 0.24000 0.89957 1.02395 0.90000 0.23580 1.02000 1.02286 1.02307 " +"0.24000 1.02615 9 0 4 3 1 4 0 1 2 4 3 4 5 5 " +"7 9 4 7 5 5 10 6 10 5 9 6 10 8 " +; + +char *VTK_VECTOR_TEXT_91 = (char *) "8 0.541339 " +"0.24528 -0.37429 0.54025 -0.37429 0.54025 -0.27143 0.38227 -0.26571 0.38286 0.91454 " +"0.54134 0.92286 0.24836 1.02571 0.53714 1.02615 6 0 4 6 3 1 " +"2 1 3 0 0 3 4 5 7 4 " +"6 4 7 " +; + +char *VTK_VECTOR_TEXT_92 = (char *) "5 0.564685 " +"0.46286 -0.09182 0.56000 -0.09256 0.56469 -0.08857 0.14713 1.04286 0.24571 1.04358 3 0 4 3 0 2 4 0 " +"1 2 " +; + +char *VTK_VECTOR_TEXT_93 = (char *) "9 0.465968 " +"0.17100 -0.37429 0.46597 -0.37429 0.17100 -0.27143 0.32571 -0.26723 0.33295 -0.26000 " +"0.33143 0.91201 0.17143 0.91979 0.16991 1.02000 0.46286 1.02615 7 2 0 3 1 " +"3 0 1 4 3 5 4 1 7 6 8 5 8 6 8 5 1 " +; + +char *VTK_VECTOR_TEXT_94 = (char *) "11 0.817005 " +"0.18389 0.44857 0.18857 0.44458 0.32000 0.44686 0.68571 0.44746 0.81143 0.44445 " +"0.81700 0.44857 0.49714 0.88224 0.50286 0.88224 0.44571 1.04090 0.55429 1.04168 " +"0.45143 1.04437 9 0 2 6 0 6 8 7 3 5 4 5 3 2 " +"0 1 10 7 9 10 8 6 10 6 7 9 7 5 " +; + +char *VTK_VECTOR_TEXT_95 = (char *) "4 1.011860 " +"0.11957 -0.37429 1.01186 -0.37429 0.11957 -0.28857 1.01186 -0.28857 2 2 1 3 2 0 1 " +; + +char *VTK_VECTOR_TEXT_96 = (char *) "11 0.486571 " +"0.38857 0.82420 0.48000 0.82420 0.48403 0.82571 0.37714 0.82989 0.38286 0.82575 " +"0.48657 0.83143 0.21296 1.02571 0.38771 1.02571 0.21412 1.03143 0.38286 1.03106 " +"0.37714 1.03295 9 5 1 2 0 3 4 3 10 6 0 1 5 7 " +"3 0 8 6 10 7 0 5 3 7 10 10 7 9 " +; + +char *VTK_VECTOR_TEXT_97 = (char *) "70 0.929303 " +"0.44000 -0.09009 0.50286 -0.08966 0.36571 -0.07756 0.57143 -0.07907 0.92716 -0.07143 " +"0.79429 -0.07106 0.92930 -0.06571 0.62857 -0.06151 0.30857 -0.05514 0.27429 -0.03258 " +"0.68000 -0.03629 0.90748 -0.00857 0.48000 0.01580 0.53143 0.01621 0.42768 0.02571 " +"0.76571 0.02129 0.22073 0.03143 0.61804 0.03714 0.89866 0.03714 0.37130 0.06000 " +"0.20613 0.06571 0.68000 0.07330 0.34538 0.10000 0.71429 0.10809 0.19580 0.11714 " +"0.89295 0.13429 0.33907 0.15714 0.74538 0.16857 0.20319 0.19714 0.36000 0.20914 " +"0.75580 0.22000 0.40000 0.24371 0.22812 0.25429 0.44571 0.26041 0.66286 0.29891 " +"0.28000 0.31258 0.75848 0.31714 0.75429 0.32399 0.33714 0.34657 0.38857 0.36538 " +"0.68571 0.41320 0.75772 0.43714 0.35289 0.48286 0.22093 0.50000 0.22857 0.49470 " +"0.89252 0.50571 0.75580 0.51143 0.22857 0.53547 0.37800 0.54571 0.74286 0.55301 " +"0.88680 0.56286 0.71429 0.58893 0.41714 0.59330 0.42228 0.59714 0.25800 0.60286 " +"0.42286 0.59759 0.65143 0.61959 0.48000 0.62193 0.86498 0.62571 0.53143 0.62950 " +"0.59429 0.62950 0.28187 0.63714 0.84571 0.65486 0.33714 0.68436 0.80571 0.69007 " +"0.37915 0.70571 0.72571 0.72538 0.45714 0.72966 0.54286 0.74152 0.62286 0.74152 70 " +"3 13 1 5 4 15 4 11 15 19 8 " +"2 13 3 7 13 0 1 14 0 12 " +"20 22 24 0 14 2 12 0 13 13 7 " +"17 11 4 6 19 2 14 17 10 21 " +"7 10 17 11 18 15 16 22 20 8 19 " +"9 15 23 21 15 21 10 23 25 27 " +"9 19 16 19 22 16 23 15 25 24 26 " +"28 27 25 30 25 15 18 30 25 36 " +"32 28 26 26 24 22 29 32 26 39 38 " +"31 38 35 29 32 29 35 31 38 29 " +"39 34 40 33 39 31 39 33 34 36 41 " +"37 40 37 41 37 40 34 41 36 25 " +"41 45 46 43 44 47 47 48 54 48 47 " +"44 50 49 46 41 25 45 50 46 45 " +"42 48 44 49 64 51 52 53 55 52 65 " +"63 65 52 55 52 61 48 52 63 61 " +"58 49 50 49 58 62 69 60 56 49 62 " +"64 54 48 61 57 67 65 57 65 55 " +"51 66 56 69 59 60 66 51 64 68 67 " +"57 59 69 57 69 68 57 69 56 66 " +; + +char *VTK_VECTOR_TEXT_98 = (char *) "49 0.932518 " +"0.61143 -0.09009 0.50286 -0.07823 0.36000 -0.07186 0.24000 -0.06878 0.72000 -0.06213 " +"0.45714 -0.05914 0.77143 -0.03188 0.36571 0.01806 0.59429 0.02193 0.83543 0.02571 " +"0.52000 0.02823 0.66857 0.04645 0.46857 0.05179 0.42704 0.08857 0.72956 0.10000 " +"0.88784 0.10571 0.39216 0.14000 0.75641 0.14000 0.91470 0.18000 0.37462 0.19143 " +"0.78665 0.23714 0.36152 0.28857 0.93252 0.29429 0.79236 0.36857 0.93252 0.37429 " +"0.36420 0.38000 0.77294 0.47714 0.39216 0.50000 0.90899 0.50000 0.42473 0.55143 " +"0.73143 0.55546 0.88657 0.55714 0.45883 0.58571 0.67429 0.60498 0.50857 0.61641 " +"0.63429 0.62252 0.56571 0.62991 0.37714 0.64118 0.83429 0.63841 0.37315 0.64857 " +"0.80571 0.66686 0.74286 0.70784 0.46857 0.71355 0.68571 0.72899 0.56571 0.74109 " +"0.61714 0.74152 0.24265 1.02571 0.37143 1.02307 0.36571 1.02723 49 3 25 46 5 1 10 5 12 7 8 0 4 11 6 14 11 " +"4 6 0 8 1 2 7 3 8 4 11 10 1 8 21 3 19 12 13 7 12 " +"5 10 14 9 17 9 14 6 17 15 20 16 7 13 15 18 20 15 17 9 3 " +"7 19 22 20 18 20 22 23 28 26 23 22 24 23 25 3 21 30 43 33 39 " +"46 25 28 23 24 27 39 25 26 31 30 7 16 19 31 26 28 37 32 42 39 " +"27 37 40 30 38 29 37 27 38 30 31 35 33 43 32 34 42 35 45 36 37 " +"29 32 42 34 36 45 35 43 43 30 41 41 30 40 36 45 44 42 36 44 47 " +"48 46 39 47 46 " +; + +char *VTK_VECTOR_TEXT_99 = (char *) "58 0.894057 " +"0.53143 -0.08966 0.59429 -0.08966 0.45714 -0.07673 0.68000 -0.07294 0.72571 -0.05343 " +"0.37714 -0.04331 0.33714 -0.01543 0.78857 -0.01011 0.58286 0.02152 0.29143 0.03016 " +"0.49625 0.03143 0.62857 0.03034 0.83107 0.03714 0.45714 0.04943 0.69270 0.06571 " +"0.26241 0.07143 0.85714 0.07873 0.40457 0.09429 0.72722 0.10571 0.37629 0.14000 " +"0.74437 0.14000 0.22899 0.14571 0.37184 0.15143 0.36930 0.15714 0.88571 0.15295 " +"0.89406 0.19714 0.76571 0.21540 0.21034 0.22571 0.34705 0.25429 0.20420 0.36286 " +"0.34478 0.36857 0.21673 0.45429 0.36252 0.47143 0.75429 0.47269 0.88058 0.48857 " +"0.88319 0.49429 0.38371 0.52286 0.23849 0.52857 0.72000 0.55200 0.86437 0.55714 " +"0.43025 0.58000 0.69714 0.58127 0.28527 0.61429 0.47429 0.60943 0.48571 0.61387 " +"0.83473 0.61429 0.49143 0.61641 0.63429 0.62041 0.54857 0.62950 0.58857 0.62991 " +"0.81296 0.64286 0.32168 0.65429 0.35429 0.67964 0.76571 0.68535 0.44571 0.72327 " +"0.67429 0.72816 0.53714 0.74109 0.60000 0.74109 56 2 13 5 0 8 2 11 4 14 " +"1 8 0 3 11 1 15 23 21 2 10 " +"13 11 8 1 11 3 4 7 14 4 " +"10 2 8 14 7 18 17 6 13 6 5 " +"13 17 15 9 18 12 20 7 12 18 " +"17 9 6 16 20 12 24 20 16 19 15 " +"17 15 19 23 23 19 22 27 28 29 " +"26 20 24 26 24 25 21 28 27 28 21 " +"23 29 30 31 28 30 29 31 32 37 " +"39 38 33 34 39 33 32 31 30 37 32 " +"36 55 49 47 37 36 42 51 42 36 " +"34 35 39 45 41 38 52 40 43 46 43 " +"44 50 41 45 56 49 57 40 51 36 " +"51 40 52 45 38 39 52 43 54 47 41 " +"53 54 46 48 56 48 49 53 41 50 " +"54 48 56 54 43 46 57 49 55 55 47 " +"53 " +; + +char *VTK_VECTOR_TEXT_100 = (char *) "48 0.885714 " +"0.51429 -0.09009 0.56571 -0.08966 0.62857 -0.07673 0.76571 -0.07186 0.88571 -0.06878 " +"0.41143 -0.06486 0.67429 -0.05641 0.36000 -0.03669 0.30286 0.01025 0.76000 0.01806 " +"0.53714 0.02152 0.49714 0.02891 0.60571 0.02891 0.68127 0.07143 0.41714 0.07561 " +"0.23787 0.10571 0.71579 0.11143 0.38241 0.11714 0.74135 0.16286 0.21395 0.16857 " +"0.74286 0.16739 0.74538 0.17429 0.34605 0.20286 0.76420 0.27714 0.19277 0.28857 " +"0.33295 0.28857 0.19277 0.36286 0.76152 0.38571 0.33563 0.39714 0.73355 0.50000 " +"0.22135 0.51143 0.36784 0.51714 0.69714 0.55841 0.42286 0.58686 0.26857 0.60793 " +"0.63429 0.60943 0.48571 0.62151 0.56571 0.62950 0.74857 0.64048 0.75269 0.64857 " +"0.30857 0.65582 0.65714 0.71355 0.40571 0.71756 0.50286 0.74109 0.55429 0.74152 " +"0.75693 1.02571 0.88571 1.02307 0.88000 1.02723 48 0 11 5 12 6 13 " +"1 2 12 7 14 8 10 0 1 14 7 " +"5 10 1 12 6 12 2 0 10 11 " +"8 17 15 9 16 13 14 5 11 4 9 " +"3 6 9 13 9 4 18 16 9 18 " +"15 22 19 17 8 14 22 15 17 20 18 " +"21 21 18 4 19 25 24 21 4 23 " +"25 19 22 26 24 25 26 28 30 39 27 " +"4 26 25 28 39 38 29 29 38 32 " +"27 39 29 30 31 34 32 38 35 31 30 " +"28 40 34 31 36 42 33 23 4 27 " +"35 41 37 33 40 31 40 33 42 41 35 " +"38 42 36 43 37 43 36 44 37 41 " +"37 44 43 46 47 45 39 4 45 4 46 " +"45 " +; + +char *VTK_VECTOR_TEXT_101 = (char *) "65 0.934539 " +"0.54857 -0.09009 0.61143 -0.09009 0.45714 -0.07462 0.71429 -0.07101 0.40571 -0.05641 " +"0.77714 -0.04331 0.33714 -0.01543 0.82857 -0.00670 0.29714 0.02154 0.56000 0.02152 " +"0.60571 0.02193 0.49714 0.03563 0.68159 0.04286 0.88150 0.05429 0.45714 0.05514 " +"0.26286 0.06636 0.72000 0.06759 0.40457 0.10000 0.91216 0.11143 0.77229 0.13429 " +"0.37057 0.15143 0.22034 0.15714 0.36613 0.16286 0.92834 0.16286 0.36359 0.16857 " +"0.91429 0.16966 0.79429 0.18111 0.35177 0.20286 0.20462 0.22571 0.33866 0.28286 " +"0.34286 0.28900 0.93454 0.29429 0.19848 0.35714 0.93295 0.39714 0.34857 0.40134 " +"0.78857 0.40134 0.34134 0.40857 0.79580 0.40857 0.20462 0.41429 0.35429 0.47261 " +"0.22327 0.49429 0.91429 0.48975 0.77143 0.50661 0.38857 0.54057 0.74857 0.54629 " +"0.40725 0.56286 0.25714 0.57001 0.71429 0.58154 0.87070 0.58571 0.45143 0.59759 " +"0.68000 0.60498 0.29296 0.62000 0.49143 0.61681 0.63429 0.62252 0.54857 0.62950 " +"0.59429 0.62991 0.33311 0.66000 0.81143 0.65543 0.77143 0.68607 0.41143 0.70930 " +"0.72000 0.71355 0.45714 0.72605 0.66857 0.73050 0.54286 0.74152 0.60000 0.74152 65 0 9 11 10 " +"1 3 10 3 12 5 12 3 17 8 6 10 0 1 0 11 2 4 14 6 0 " +"10 9 7 16 5 5 16 12 14 2 11 16 7 19 14 4 2 15 8 17 26 " +"18 25 17 6 14 15 27 21 7 13 19 23 25 18 20 15 17 26 19 18 18 " +"19 13 24 20 22 15 20 24 15 24 27 21 27 28 28 29 32 33 37 35 29 " +"28 27 32 29 38 35 34 30 40 39 46 33 35 30 31 33 30 36 38 29 36 " +"29 34 37 41 42 40 38 36 30 34 29 39 40 36 41 37 33 46 43 51 51 " +"49 56 42 48 44 48 42 41 44 48 47 49 51 45 43 46 39 56 49 59 50 " +"62 53 57 47 48 64 55 53 45 51 43 55 63 54 58 47 57 62 50 60 59 " +"52 61 59 49 52 47 60 50 61 54 63 60 47 58 61 52 54 64 53 62 55 " +"64 63 " +; + +char *VTK_VECTOR_TEXT_102 = (char *) "24 0.617143 " +"0.28000 -0.07186 0.40571 -0.07186 0.27472 0.61429 0.41100 0.61429 0.16571 0.61957 " +"0.56000 0.61957 0.56420 0.71714 0.16571 0.72329 0.27472 0.72857 0.41100 0.72857 " +"0.56000 0.72329 0.41034 0.83143 0.27580 0.86000 0.43429 0.89555 0.28613 0.91714 " +"0.46286 0.91294 0.50286 0.92134 0.60000 0.91830 0.31107 0.96857 0.34286 1.00099 " +"0.38857 1.02784 0.61714 1.03086 0.46286 1.04395 0.52571 1.04437 22 0 3 2 " +"3 0 1 4 8 7 9 3 5 2 3 " +"8 5 6 10 4 2 8 9 8 3 " +"8 11 12 11 8 9 12 11 14 9 5 " +"10 13 19 18 13 18 14 13 14 11 " +"23 15 16 15 23 22 21 23 17 15 20 " +"13 19 13 20 20 15 22 23 16 17 " +; + +char *VTK_VECTOR_TEXT_103 = (char *) "71 0.892518 " +"0.46857 -0.39295 0.56571 -0.39563 0.66286 -0.37959 0.35429 -0.36200 0.74286 -0.34616 " +"0.28571 -0.31868 0.80368 -0.30000 0.50857 -0.28437 0.62286 -0.27395 0.44571 -0.27101 " +"0.23387 -0.24286 0.84657 -0.24286 0.69200 -0.23714 0.38171 -0.23143 0.72150 -0.20286 " +"0.87177 -0.18000 0.34916 -0.15714 0.74899 -0.14000 0.22286 -0.13957 0.50857 -0.07295 " +"0.56000 -0.07295 0.43429 -0.05959 0.65143 -0.05070 0.37143 -0.03355 0.69714 -0.02527 " +"0.89252 -0.00857 0.74857 0.01873 0.75042 0.02000 0.75756 0.02000 0.75429 0.02333 " +"0.29143 0.03381 0.53143 0.03866 0.57143 0.03907 0.47429 0.05216 0.64000 0.05787 " +"0.41714 0.08704 0.68000 0.08439 0.23216 0.12857 0.38036 0.12857 0.72784 0.14000 " +"0.35277 0.18571 0.20530 0.20857 0.75538 0.20857 0.19320 0.28286 0.33295 0.29429 " +"0.76991 0.35714 0.19277 0.37429 0.33563 0.40857 0.75109 0.47143 0.35109 0.47714 " +"0.21143 0.47832 0.72784 0.52286 0.23787 0.55143 0.39044 0.55143 0.69868 0.56286 " +"0.66286 0.59393 0.27107 0.60857 0.45143 0.60498 0.48571 0.62041 0.56571 0.62991 " +"0.57714 0.62764 0.58286 0.62723 0.76571 0.63477 0.32000 0.66384 0.68571 0.70213 " +"0.39429 0.71229 0.77408 0.72286 0.88878 0.72286 0.62857 0.72816 0.46857 0.73580 " +"0.56000 0.74152 71 1 7 0 8 4 12 2 8 1 0 " +"9 3 7 1 8 5 13 10 9 0 7 13 5 3 8 2 4 6 14 12 6 " +"12 4 11 15 17 11 14 6 13 3 9 14 11 17 10 16 18 16 10 13 17 " +"25 28 23 21 33 22 32 20 32 19 20 35 23 33 19 31 21 23 35 30 31 " +"19 32 32 22 34 26 29 36 17 15 25 33 21 31 26 36 24 24 34 22 26 " +"27 29 36 34 24 36 29 39 30 38 37 39 28 25 39 29 28 37 40 41 38 " +"40 37 30 35 38 39 25 42 44 46 43 44 43 41 44 41 40 42 25 45 67 " +"51 48 46 47 50 67 48 45 47 46 44 50 49 52 49 50 47 67 62 51 62 " +"54 51 56 52 49 54 62 55 55 64 61 60 61 59 53 56 49 56 53 63 63 " +"57 65 65 58 69 65 57 58 70 59 61 59 69 58 64 55 62 67 45 25 67 " +"66 62 63 53 57 68 70 61 59 70 69 64 68 61 " +; + +char *VTK_VECTOR_TEXT_104 = (char *) "27 0.889502 " +"0.24571 -0.07186 0.37143 -0.07186 0.76000 -0.07186 0.88571 -0.07186 0.37605 0.40286 " +"0.37756 0.40857 0.75538 0.46000 0.88950 0.47714 0.38899 0.48286 0.74538 0.51714 " +"0.88152 0.54571 0.42439 0.55143 0.72000 0.56914 0.47429 0.59355 0.68000 0.60331 " +"0.85996 0.61429 0.53143 0.61748 0.61143 0.62379 0.37714 0.63983 0.81714 0.67296 " +"0.45714 0.70045 0.77714 0.70213 0.50857 0.72437 0.68571 0.73538 0.58857 0.74152 " +"0.24571 1.02615 0.37143 1.02615 25 0 " +"4 25 4 18 25 6 2 3 9 6 7 7 6 3 18 8 11 18 11 13 9 " +"15 12 12 19 14 10 9 7 18 13 20 8 4 5 15 9 10 4 0 1 18 " +"4 8 17 24 16 19 21 14 14 23 17 20 16 22 16 20 13 19 12 15 17 " +"23 24 23 14 21 24 22 16 18 26 25 " +; + +char *VTK_VECTOR_TEXT_105 = (char *) "8 0.377143 " +"0.25143 -0.07186 0.37714 -0.07186 0.25143 0.72329 0.37714 0.72329 0.25143 0.87403 " +"0.37714 0.87403 0.25143 1.02615 0.37714 1.02615 4 3 2 0 3 0 " +"1 4 5 6 7 6 5 " +; + +char *VTK_VECTOR_TEXT_106 = (char *) "18 0.375625 " +"0.14857 -0.39563 0.22286 -0.39252 0.07383 -0.38000 0.26857 -0.37914 0.31429 -0.34989 " +"0.34036 -0.31714 0.18857 -0.27462 0.10286 -0.26950 0.36109 -0.26571 0.22331 -0.24857 " +"0.37563 -0.16857 0.24152 -0.16286 0.24571 0.72329 0.37143 0.72329 0.24571 0.87403 " +"0.37143 0.87403 0.24571 1.02615 0.37143 1.02615 14 1 6 0 3 6 1 4 6 " +"3 9 10 11 7 0 6 7 2 0 " +"9 5 8 5 9 4 6 4 9 9 8 " +"10 11 10 12 13 12 10 14 15 16 " +"17 16 15 " +; + +char *VTK_VECTOR_TEXT_107 = (char *) "15 0.897876 " +"0.37450 -0.07143 0.89788 -0.07143 0.24571 -0.06878 0.73714 -0.07035 0.38004 0.24286 " +"0.68421 0.25429 0.68045 0.26000 0.68000 0.26064 0.46857 0.32924 0.38286 0.40888 " +"0.57152 0.42571 0.69714 0.72283 0.86359 0.72286 0.24836 1.02571 0.37714 1.02307 13 2 9 13 4 2 0 5 8 3 5 " +"3 1 5 6 7 9 14 13 11 9 10 5 7 8 7 10 8 8 9 4 12 " +"11 10 9 8 10 2 4 9 " +; + +char *VTK_VECTOR_TEXT_108 = (char *) "4 0.371429 " +"0.36878 -0.07143 0.24000 -0.06878 0.24265 1.02571 0.37143 1.02307 2 1 3 2 3 1 0 " +; + +char *VTK_VECTOR_TEXT_109 = (char *) "45 1.318074 " +"0.24571 -0.07186 0.37143 -0.07186 0.72000 -0.07295 1.18857 -0.07186 1.31429 -0.07186 " +"0.71429 -0.06878 0.84571 -0.06878 0.37866 0.37429 0.84723 0.40286 0.85335 0.46000 " +"0.39109 0.48286 0.71277 0.48286 1.18437 0.48286 1.31807 0.52286 0.87787 0.53429 " +"0.41143 0.53493 1.17395 0.54000 0.43582 0.56857 0.68784 0.56857 1.14857 0.58403 " +"0.93143 0.59188 0.66286 0.59829 0.82857 0.60801 0.51009 0.61429 0.36571 0.61924 " +"0.63429 0.61470 1.09714 0.61580 1.29355 0.62000 0.56000 0.62420 1.00571 0.62152 " +"1.06286 0.62379 0.41311 0.67143 0.78857 0.66975 1.25561 0.67714 0.90857 0.68902 " +"0.74286 0.70784 1.20571 0.71355 0.35735 0.72286 0.24571 0.72329 0.50286 0.72498 " +"0.99429 0.73109 1.16000 0.73109 0.67429 0.73470 0.57714 0.74109 1.05143 0.74152 43 6 5 2 0 7 38 8 11 5 7 0 1 8 5 6 12 3 4 12 " +"13 16 9 11 8 15 17 24 11 22 18 22 20 34 11 9 22 14 22 9 13 " +"12 4 24 17 31 7 10 38 10 15 24 16 27 19 32 21 18 24 37 38 20 " +"22 14 10 24 38 27 16 13 31 23 39 26 41 30 30 40 29 32 18 22 41 " +"19 36 34 29 40 19 41 26 36 19 33 23 31 17 35 21 32 29 34 20 39 " +"28 43 33 19 27 43 28 42 25 42 28 28 39 23 42 25 21 42 21 35 44 " +"30 41 30 44 40 " +; + +char *VTK_VECTOR_TEXT_110 = (char *) "38 0.889911 " +"0.24571 -0.07186 0.37143 -0.07186 0.75429 -0.07186 0.88571 -0.07186 0.24152 -0.06571 " +"0.37563 -0.06571 0.75009 -0.06571 0.88991 -0.06571 0.37605 0.40286 0.37866 0.41429 " +"0.38134 0.44857 0.74665 0.48286 0.88950 0.48286 0.39849 0.51143 0.73229 0.54000 " +"0.88420 0.54000 0.43011 0.56286 0.46286 0.58893 0.69714 0.58725 0.87008 0.59143 " +"0.51580 0.61429 0.65143 0.61343 0.36571 0.62031 0.56571 0.62420 0.60571 0.62379 " +"0.61714 0.62152 0.62286 0.62109 0.83955 0.64857 0.40725 0.66571 0.79429 0.69179 " +"0.45714 0.70213 0.24152 0.71714 0.75429 0.71355 0.35735 0.72286 0.24571 0.72329 " +"0.52571 0.73050 0.68571 0.73538 0.58857 0.74152 36 1 4 0 " +"3 6 2 1 5 4 3 7 6 6 12 " +"11 11 15 14 6 7 12 22 16 28 " +"10 8 9 13 22 10 10 22 8 8 4 " +"5 15 11 12 8 22 4 14 15 19 " +"14 19 18 25 26 24 16 22 13 16 17 " +"28 30 28 17 27 18 19 32 23 24 " +"29 18 27 30 20 35 18 32 21 31 4 " +"22 20 30 17 32 26 21 32 24 26 " +"32 18 29 34 31 33 33 31 22 35 23 " +"37 23 35 20 36 23 32 37 23 36 " +; + +char *VTK_VECTOR_TEXT_111 = (char *) "65 0.938661 " +"0.53143 -0.08966 0.59429 -0.09009 0.69143 -0.07101 0.41143 -0.06213 0.76571 -0.03759 " +"0.34857 -0.02821 0.81714 -0.00099 0.29143 0.02154 0.54286 0.02193 0.60571 0.02420 " +"0.50857 0.02823 0.64571 0.03563 0.86331 0.04857 0.45143 0.05216 0.25714 0.06636 " +"0.70857 0.07330 0.89229 0.09429 0.40000 0.09597 0.22771 0.12286 0.38036 0.12286 " +"0.37714 0.12793 0.37669 0.12857 0.75473 0.12857 0.76657 0.15143 0.77101 0.16286 " +"0.77355 0.16857 0.92319 0.18000 0.20764 0.18571 0.34816 0.19714 0.78605 0.20857 " +"0.33563 0.26000 0.19320 0.28286 0.93823 0.28857 0.79848 0.29429 0.33295 0.36286 " +"0.93866 0.37429 0.19580 0.39714 0.79538 0.39714 0.35277 0.47143 0.92319 0.47143 " +"0.21184 0.48286 0.77143 0.48947 0.23216 0.54000 0.38742 0.54000 0.89927 0.54000 " +"0.74286 0.54057 0.71429 0.57275 0.42286 0.57813 0.87678 0.58000 0.27429 0.60984 " +"0.48571 0.61580 0.64571 0.61580 0.54286 0.62950 0.58857 0.62950 0.60000 0.62723 " +"0.60571 0.62680 0.83225 0.63714 0.31025 0.64857 0.34857 0.67864 0.75429 0.69641 " +"0.40000 0.70784 0.45143 0.72605 0.68571 0.72538 0.53714 0.74152 0.60000 0.74109 65 11 4 15 8 " +"0 1 17 7 5 11 2 4 2 9 1 8 1 9 0 8 10 0 10 3 2 " +"11 9 3 13 5 10 13 3 6 12 22 6 15 4 15 6 22 18 28 27 17 " +"5 13 14 19 18 16 23 22 19 7 17 7 19 14 18 19 21 24 23 25 25 " +"23 16 19 20 21 16 22 12 26 29 25 27 30 31 26 25 16 28 18 21 29 " +"26 33 30 27 28 31 34 36 33 32 35 26 32 33 34 31 30 33 35 37 40 " +"36 34 37 39 41 40 38 42 39 37 35 47 57 43 38 40 34 43 49 42 46 " +"45 56 39 44 41 41 48 45 43 57 49 41 44 48 43 42 38 57 47 58 54 " +"55 53 56 45 48 50 60 47 64 63 53 64 55 62 53 63 52 59 62 51 61 " +"60 50 64 53 55 51 62 55 52 61 50 59 46 56 61 52 63 46 59 51 58 " +"47 60 " +; + +char *VTK_VECTOR_TEXT_112 = (char *) "49 0.935625 " +"0.24571 -0.37740 0.37454 -0.37429 0.56000 -0.08966 0.66857 -0.07966 0.47429 -0.06657 " +"0.75429 -0.04331 0.37584 -0.00286 0.80571 -0.00704 0.38286 0.00159 0.59429 0.02152 " +"0.52000 0.02891 0.63429 0.02992 0.85964 0.05429 0.45143 0.06725 0.70857 0.07330 " +"0.39787 0.13429 0.39514 0.14000 0.39216 0.14571 0.76213 0.14571 0.90538 0.14571 " +"0.37462 0.19714 0.78327 0.20857 0.92680 0.22571 0.36379 0.27143 0.36152 0.28286 " +"0.79580 0.29429 0.93563 0.30000 0.36379 0.36857 0.79580 0.36857 0.92680 0.43714 " +"0.78286 0.45547 0.38286 0.47232 0.75429 0.52921 0.41714 0.54057 0.88571 0.56444 " +"0.44571 0.57582 0.69143 0.59964 0.51429 0.62213 0.65143 0.62213 0.36571 0.63051 " +"0.56571 0.63563 0.82704 0.64857 0.45714 0.70784 0.74857 0.70657 0.24571 0.72329 " +"0.36000 0.72329 0.51429 0.73177 0.69143 0.72899 0.62286 0.74152 49 0 1 6 0 24 44 3 9 2 2 10 4 3 11 9 4 " +"13 8 10 2 9 11 5 14 11 3 5 7 14 5 4 10 13 14 12 18 14 " +"7 12 0 20 24 15 8 13 8 15 6 19 18 12 18 19 21 21 22 25 24 " +"27 44 17 15 16 22 21 19 28 25 26 22 26 25 6 15 17 29 30 28 23 " +"24 20 20 6 17 29 28 26 30 34 32 27 31 44 0 6 20 31 39 44 32 " +"41 36 41 32 34 31 33 39 42 37 46 39 35 42 34 30 29 39 33 35 38 " +"47 40 35 37 42 47 38 43 40 46 37 43 36 41 39 45 44 46 40 48 48 " +"40 47 38 36 43 " +; + +char *VTK_VECTOR_TEXT_113 = (char *) "52 0.885714 " +"0.76000 -0.37740 0.88571 -0.37740 0.56571 -0.09009 0.45143 -0.07673 0.65143 -0.06784 " +"0.36000 -0.03188 0.70857 -0.03465 0.75580 -0.00286 0.74857 0.00454 0.29714 0.02418 " +"0.54286 0.02152 0.57714 0.02193 0.58857 0.02420 0.59429 0.02462 0.47429 0.03927 " +"0.64571 0.04371 0.43302 0.06571 0.70670 0.09429 0.23914 0.11143 0.38607 0.11714 " +"0.38286 0.12221 0.38241 0.12286 0.75008 0.17429 0.21101 0.19143 0.34748 0.20857 " +"0.76723 0.25429 0.19848 0.26000 0.76723 0.27143 0.33605 0.28286 0.76991 0.28857 " +"0.19580 0.37429 0.33866 0.40286 0.75429 0.45277 0.21101 0.47143 0.35429 0.47832 " +"0.73143 0.51301 0.39846 0.56286 0.69296 0.56857 0.25669 0.58571 0.45143 0.60902 " +"0.61714 0.62213 0.49143 0.62723 0.76571 0.62602 0.29330 0.63714 0.56571 0.63522 " +"0.72403 0.67143 0.36571 0.69641 0.66286 0.71355 0.77408 0.72286 0.88571 0.72329 " +"0.44571 0.72966 0.56000 0.74152 52 29 27 25 " +"49 42 32 22 7 25 3 13 11 2 13 " +"3 4 13 2 6 15 4 11 13 12 " +"3 14 5 13 4 15 10 3 11 15 6 " +"8 14 3 10 15 8 17 24 23 18 " +"5 16 9 17 8 22 14 16 5 9 19 " +"18 19 20 21 18 19 21 42 35 32 " +"7 22 8 16 19 9 49 48 42 7 0 " +"1 24 18 21 23 24 26 26 28 30 " +"28 26 24 30 31 33 34 33 31 31 30 " +"28 33 34 38 49 29 25 36 43 38 " +"49 25 7 35 42 37 37 45 40 45 37 " +"42 29 49 32 45 47 40 39 43 36 " +"46 39 50 40 47 44 43 39 46 36 38 " +"34 41 44 51 41 50 39 49 7 1 " +"50 41 51 51 44 47 " +; + +char *VTK_VECTOR_TEXT_114 = (char *) "24 0.667686 " +"0.24571 -0.07186 0.37143 -0.07186 0.24152 -0.06571 0.37563 -0.06571 0.37563 0.38000 " +"0.39748 0.50000 0.41964 0.54571 0.44740 0.57429 0.61714 0.57787 0.62286 0.57880 " +"0.48000 0.59294 0.57714 0.59395 0.51429 0.60134 0.36571 0.61385 0.41868 0.68857 " +"0.66769 0.69429 0.66542 0.70000 0.24152 0.71714 0.35735 0.72286 0.24571 0.72329 " +"0.46286 0.72436 0.60000 0.73109 0.51429 0.74109 0.55429 0.74109 22 1 2 0 " +"1 3 2 4 2 3 5 6 13 5 13 " +"17 21 11 15 2 4 17 4 5 17 " +"6 7 13 18 17 13 7 10 14 13 7 " +"14 14 12 20 11 21 12 9 15 11 " +"12 14 10 19 17 18 20 12 22 8 9 " +"11 21 15 16 22 12 23 23 12 21 " +; + +char *VTK_VECTOR_TEXT_115 = (char *) "63 0.849502 " +"0.56000 -0.09009 0.46286 -0.08705 0.65143 -0.07395 0.37143 -0.06723 0.70444 -0.05429 " +"0.33143 -0.04943 0.76057 -0.02000 0.28571 -0.01813 0.79582 0.01429 0.50286 0.02152 " +"0.55429 0.02152 0.56571 0.02379 0.57714 0.02420 0.24571 0.02636 0.64000 0.04200 " +"0.41714 0.04371 0.22200 0.06571 0.38286 0.06725 0.68384 0.07714 0.83580 0.08286 " +"0.69927 0.10000 0.34200 0.12286 0.84950 0.14000 0.71009 0.15714 0.19109 0.16286 " +"0.19370 0.16857 0.32000 0.18615 0.69864 0.19143 0.84723 0.20286 0.65714 0.22784 " +"0.83641 0.24286 0.80956 0.28857 0.34286 0.32371 0.75429 0.33641 0.30286 0.34421 " +"0.69143 0.36327 0.25714 0.38445 0.22645 0.43714 0.41143 0.44538 0.37587 0.46571 " +"0.35885 0.48286 0.21295 0.49429 0.69143 0.50460 0.34478 0.51714 0.81977 0.52286 " +"0.67514 0.55143 0.35216 0.56286 0.22034 0.56857 0.64000 0.59465 0.38286 0.59829 " +"0.79429 0.61016 0.24000 0.61573 0.42857 0.62041 0.58286 0.62252 0.48571 0.62991 " +"0.74689 0.67143 0.28571 0.67258 0.70286 0.70045 0.33714 0.70613 0.38857 0.72538 " +"0.61714 0.73050 0.47429 0.74109 0.54286 0.74109 61 2 12 0 10 1 12 12 2 14 14 4 6 7 17 13 0 " +"12 1 4 14 2 11 10 12 15 3 1 3 15 5 9 1 10 14 6 18 15 " +"1 9 17 5 15 6 8 18 5 17 7 21 16 13 16 21 24 18 8 20 23 " +"28 27 21 13 17 19 22 23 26 25 21 21 25 24 20 19 23 19 20 8 28 " +"23 22 27 33 29 28 30 27 31 27 30 27 31 33 29 38 32 35 29 33 29 " +"35 38 34 38 36 32 38 34 36 40 37 39 36 38 41 43 47 43 41 37 36 " +"39 40 50 45 42 43 37 40 47 46 51 46 47 43 53 60 54 45 57 48 52 " +"58 49 45 55 57 51 49 56 49 51 46 50 42 44 48 57 53 56 49 58 55 " +"45 50 52 59 58 59 52 61 52 54 61 60 53 57 61 54 62 62 54 60 " +; + +char *VTK_VECTOR_TEXT_116 = (char *) "24 0.551972 " +"0.42286 -0.08395 0.48000 -0.08437 0.55197 -0.07143 0.33714 -0.05914 0.29901 -0.02571 " +"0.28041 0.00857 0.44571 0.04816 0.44453 0.04857 0.53714 0.04344 0.44000 0.05008 " +"0.41057 0.07714 0.26748 0.10000 0.40152 0.11714 0.26597 0.61429 0.40260 0.61429 " +"0.17143 0.61957 0.53450 0.62000 0.53866 0.71714 0.53450 0.72286 0.17143 0.72329 " +"0.26597 0.72857 0.40260 0.72857 0.26748 0.91714 0.40000 0.99545 22 10 5 4 " +"6 7 9 10 4 3 10 3 9 8 6 " +"1 6 9 1 5 10 11 8 1 2 " +"0 9 3 11 12 13 0 1 9 10 12 " +"11 17 18 16 14 13 12 21 14 16 " +"18 21 16 22 20 23 20 13 14 15 20 " +"19 15 13 20 20 14 21 23 20 21 " +; + +char *VTK_VECTOR_TEXT_117 = (char *) "38 0.884197 " +"0.48571 -0.09009 0.53714 -0.09009 0.41714 -0.07673 0.77143 -0.07295 0.88000 -0.07186 " +"0.63518 -0.06571 0.76571 -0.06878 0.88420 -0.06571 0.34857 -0.04771 0.70857 -0.01846 " +"0.29901 -0.00857 0.27429 0.02730 0.52000 0.02723 0.56000 0.02764 0.47339 0.03714 " +"0.76000 0.03684 0.61714 0.04135 0.43943 0.05429 0.65143 0.05787 0.41330 0.07714 " +"0.25143 0.08437 0.69143 0.08704 0.39343 0.10571 0.38899 0.11714 0.71473 0.11714 " +"0.38645 0.12286 0.73294 0.15714 0.23848 0.17429 0.37563 0.17429 0.75009 0.26000 " +"0.23848 0.71714 0.37295 0.71714 0.75009 0.71714 0.88420 0.71714 0.24265 0.72286 " +"0.36878 0.72286 0.75429 0.72329 0.88000 0.72329 36 6 3 15 " +"3 7 15 3 4 7 8 17 10 2 14 " +"17 2 17 8 5 13 1 19 11 10 " +"9 16 5 12 1 13 0 12 2 12 0 " +"1 9 18 16 13 5 16 14 2 12 " +"11 22 20 21 18 9 15 21 9 21 15 " +"24 20 28 27 11 19 22 24 7 26 " +"19 10 17 24 15 7 25 22 23 20 22 " +"25 20 25 28 26 7 29 31 30 27 " +"33 29 7 34 31 35 34 30 31 31 27 " +"28 36 33 37 32 29 33 36 32 33 " +; + +char *VTK_VECTOR_TEXT_118 = (char *) "12 0.884203 " +"0.45714 -0.06947 0.58857 -0.07103 0.52000 0.09808 0.52571 0.09808 0.47580 0.23714 " +"0.16151 0.71714 0.88420 0.71714 0.16427 0.72286 0.30286 0.71951 0.74857 0.72090 " +"0.88145 0.72286 0.29714 0.72395 10 4 0 " +"2 0 4 5 3 2 0 1 3 0 " +"3 6 9 8 11 5 9 6 10 7 5 " +"11 8 5 4 3 1 6 " +; + +char *VTK_VECTOR_TEXT_119 = (char *) "14 1.231638 " +"0.39429 -0.07215 0.52571 -0.07215 0.97714 -0.07252 0.84571 -0.06947 0.45714 0.10650 " +"0.46286 0.10650 0.92000 0.12073 0.69143 0.52785 0.15122 0.72286 0.28571 0.72090 " +"0.62857 0.72243 0.76193 0.72286 1.23164 0.72286 1.10857 0.72329 12 " +"2 6 3 0 4 8 3 6 7 5 0 " +"1 12 13 6 5 4 0 7 10 5 " +"11 10 7 7 5 1 11 7 6 4 9 " +"8 12 6 2 " +; + +char *VTK_VECTOR_TEXT_120 = (char *) "17 0.882498 " +"0.15697 -0.07143 0.88073 -0.07143 0.15473 -0.06571 0.31429 -0.07035 0.72571 -0.07140 " +"0.88250 -0.06571 0.52000 0.22529 0.52571 0.22529 0.60332 0.33429 0.43534 0.34000 " +"0.51429 0.45005 0.17188 0.71714 0.86812 0.71714 0.17412 0.72286 0.86588 0.72286 " +"0.32571 0.72395 0.71429 0.72395 15 1 5 4 2 6 9 8 6 7 3 2 0 4 8 7 6 2 3 4 " +"5 8 8 10 6 10 9 6 15 11 9 16 10 8 15 9 10 12 16 8 13 " +"11 15 16 12 14 " +; + +char *VTK_VECTOR_TEXT_121 = (char *) "16 0.888063 " +"0.34286 -0.39563 0.24000 -0.38043 0.41714 -0.37641 0.45714 -0.34956 0.50436 -0.29429 " +"0.32000 -0.26680 0.22286 -0.25766 0.36652 -0.25429 0.54371 -0.22000 0.41293 -0.21429 " +"0.46848 -0.07714 0.53714 0.09292 0.16998 0.72286 0.30857 0.71999 0.76000 0.72246 " +"0.88806 0.72286 14 2 7 0 0 5 1 5 0 7 " +"6 1 5 3 7 2 7 3 9 3 4 " +"9 9 8 10 9 4 8 10 11 12 " +"11 15 14 11 8 15 11 10 8 11 13 " +"12 " +; + +char *VTK_VECTOR_TEXT_122 = (char *) "17 0.872768 " +"0.17714 -0.07295 0.86857 -0.07186 0.17143 -0.06878 0.87277 -0.06571 0.17146 0.03714 " +"0.34212 0.03714 0.87277 0.03714 0.34132 0.04286 0.44000 0.04327 0.86857 0.04329 " +"0.20571 0.61689 0.67062 0.62000 0.84991 0.64286 0.20152 0.71714 0.84991 0.71714 " +"0.20571 0.72329 0.84571 0.72329 15 2 0 4 0 1 9 0 5 4 1 3 9 5 0 8 5 7 4 0 " +"9 8 3 6 9 12 14 11 11 14 16 11 16 10 12 11 7 11 4 7 10 " +"15 13 15 10 16 " +; + +char *VTK_VECTOR_TEXT_123 = (char *) "39 0.611429 " +"0.61143 -0.39454 0.46857 -0.38420 0.40000 -0.34154 0.61143 -0.27975 0.35748 -0.27143 " +"0.52000 -0.26992 0.47787 -0.23143 0.46748 -0.19143 0.34134 -0.18000 0.46395 0.04286 " +"0.33563 0.05429 0.45184 0.14571 0.32109 0.16286 0.29143 0.21832 0.42286 0.22716 " +"0.25143 0.24943 0.18857 0.26528 0.39429 0.26698 0.31413 0.32286 0.18857 0.38615 " +"0.25143 0.40073 0.41188 0.40286 0.29143 0.42775 0.43514 0.44286 0.32823 0.49429 " +"0.45866 0.52286 0.34134 0.60286 0.46705 0.80857 0.34478 0.84857 0.47748 0.87143 " +"0.35748 0.91143 0.50286 0.90821 0.50793 0.91143 0.50857 0.91188 0.61143 0.92814 " +"0.40571 0.99511 0.46857 1.03294 0.53143 1.04437 0.61143 1.04329 37 0 3 5 6 2 5 2 6 4 0 5 1 2 " +"1 5 4 7 8 7 4 6 8 9 10 10 11 12 9 8 7 11 10 9 12 " +"17 13 12 14 17 14 12 11 18 15 13 16 15 20 18 13 17 16 20 19 15 " +"18 20 21 22 18 22 21 24 22 20 18 24 25 26 23 24 21 25 24 23 26 " +"27 28 27 26 25 28 29 30 29 28 27 30 29 35 31 32 33 36 31 33 31 " +"36 29 36 33 37 34 38 37 35 29 36 34 37 33 " +; + +char *VTK_VECTOR_TEXT_124 = (char *) "4 0.388571 " +"0.28571 -0.39454 0.38857 -0.39563 0.28571 1.04329 0.38857 1.04437 2 3 2 0 3 0 1 " +; + +char *VTK_VECTOR_TEXT_125 = (char *) "35 0.606299 " +"0.17714 -0.39454 0.31429 -0.38613 0.39429 -0.33832 0.17714 -0.27975 0.27429 -0.26784 " +"0.43681 -0.26000 0.31070 -0.23714 0.44950 -0.19714 0.32723 -0.15714 0.45295 0.04857 " +"0.33295 0.11714 0.46857 0.16404 0.35387 0.19714 0.51429 0.23258 0.56000 0.25681 " +"0.39429 0.26403 0.60630 0.26571 0.47702 0.32857 0.41714 0.36742 0.60571 0.38615 " +"0.54857 0.39927 0.50171 0.43143 0.36086 0.43714 0.46748 0.50000 0.32991 0.56857 " +"0.45252 0.78571 0.32723 0.80286 0.31748 0.87143 0.29143 0.90893 0.43470 0.91714 " +"0.17714 0.92814 0.41629 0.95714 0.36571 1.01107 0.32000 1.03294 0.17714 1.04329 33 4 3 0 2 4 1 6 7 8 1 4 0 2 6 4 5 " +"6 2 6 5 7 8 9 10 9 8 7 10 11 12 15 13 17 11 10 9 12 " +"11 15 13 14 17 13 15 11 20 17 14 20 14 16 19 20 16 21 17 20 17 " +"21 18 22 23 24 22 18 21 23 22 21 25 26 24 25 24 23 29 27 26 29 " +"26 25 27 31 28 31 27 29 32 28 31 28 33 30 33 34 30 33 28 32 " +; + +char *VTK_VECTOR_TEXT_126 = (char *) "25 0.971429 " +"0.73714 0.34462 0.20759 0.35143 0.21143 0.34662 0.81143 0.34723 0.66857 0.35756 " +"0.86857 0.36135 0.25143 0.38115 0.90857 0.38086 0.52000 0.41580 0.32571 0.42723 " +"0.97140 0.43143 0.37143 0.43866 0.42286 0.44093 0.79429 0.49009 0.21028 0.50000 " +"0.72571 0.49681 0.86286 0.50930 0.25714 0.54115 0.92571 0.54759 0.32571 0.57470 " +"0.50286 0.57621 0.96571 0.58154 0.97143 0.58073 0.38857 0.58680 0.44000 0.58723 23 1 17 14 8 4 15 13 5 7 6 1 2 5 " +"13 3 1 6 17 3 13 0 16 10 18 15 4 0 13 7 16 15 0 13 8 " +"20 12 12 20 11 9 17 6 10 16 7 17 9 19 22 21 18 11 20 24 11 " +"19 9 20 8 15 11 24 23 22 18 10 11 23 19 " +; + + +/*! Construct object with no string set and backing enabled.*/ +VTKViewer_VectorText::VTKViewer_VectorText() +{ + this->Text = NULL; + + this->Letters[33] = VTK_VECTOR_TEXT_33; + this->Letters[34] = VTK_VECTOR_TEXT_34; + this->Letters[35] = VTK_VECTOR_TEXT_35; + this->Letters[36] = VTK_VECTOR_TEXT_36; + this->Letters[37] = VTK_VECTOR_TEXT_37; + this->Letters[38] = VTK_VECTOR_TEXT_38; + this->Letters[39] = VTK_VECTOR_TEXT_39; + this->Letters[40] = VTK_VECTOR_TEXT_40; + this->Letters[41] = VTK_VECTOR_TEXT_41; + this->Letters[42] = VTK_VECTOR_TEXT_42; + this->Letters[43] = VTK_VECTOR_TEXT_43; + this->Letters[44] = VTK_VECTOR_TEXT_44; + this->Letters[45] = VTK_VECTOR_TEXT_45; + this->Letters[46] = VTK_VECTOR_TEXT_46; + this->Letters[47] = VTK_VECTOR_TEXT_47; + this->Letters[48] = VTK_VECTOR_TEXT_48; + this->Letters[49] = VTK_VECTOR_TEXT_49; + this->Letters[50] = VTK_VECTOR_TEXT_50; + this->Letters[51] = VTK_VECTOR_TEXT_51; + this->Letters[52] = VTK_VECTOR_TEXT_52; + this->Letters[53] = VTK_VECTOR_TEXT_53; + this->Letters[54] = VTK_VECTOR_TEXT_54; + this->Letters[55] = VTK_VECTOR_TEXT_55; + this->Letters[56] = VTK_VECTOR_TEXT_56; + this->Letters[57] = VTK_VECTOR_TEXT_57; + this->Letters[58] = VTK_VECTOR_TEXT_58; + this->Letters[59] = VTK_VECTOR_TEXT_59; + this->Letters[60] = VTK_VECTOR_TEXT_60; + this->Letters[61] = VTK_VECTOR_TEXT_61; + this->Letters[62] = VTK_VECTOR_TEXT_62; + this->Letters[63] = VTK_VECTOR_TEXT_63; + this->Letters[64] = VTK_VECTOR_TEXT_64; + this->Letters[65] = VTK_VECTOR_TEXT_65; + this->Letters[66] = VTK_VECTOR_TEXT_66; + this->Letters[67] = VTK_VECTOR_TEXT_67; + this->Letters[68] = VTK_VECTOR_TEXT_68; + this->Letters[69] = VTK_VECTOR_TEXT_69; + this->Letters[70] = VTK_VECTOR_TEXT_70; + this->Letters[71] = VTK_VECTOR_TEXT_71; + this->Letters[72] = VTK_VECTOR_TEXT_72; + this->Letters[73] = VTK_VECTOR_TEXT_73; + this->Letters[74] = VTK_VECTOR_TEXT_74; + this->Letters[75] = VTK_VECTOR_TEXT_75; + this->Letters[76] = VTK_VECTOR_TEXT_76; + this->Letters[77] = VTK_VECTOR_TEXT_77; + this->Letters[78] = VTK_VECTOR_TEXT_78; + this->Letters[79] = VTK_VECTOR_TEXT_79; + this->Letters[80] = VTK_VECTOR_TEXT_80; + this->Letters[81] = VTK_VECTOR_TEXT_81; + this->Letters[82] = VTK_VECTOR_TEXT_82; + this->Letters[83] = VTK_VECTOR_TEXT_83; + this->Letters[84] = VTK_VECTOR_TEXT_84; + this->Letters[85] = VTK_VECTOR_TEXT_85; + this->Letters[86] = VTK_VECTOR_TEXT_86; + this->Letters[87] = VTK_VECTOR_TEXT_87; + this->Letters[88] = VTK_VECTOR_TEXT_88; + this->Letters[89] = VTK_VECTOR_TEXT_89; + this->Letters[90] = VTK_VECTOR_TEXT_90; + this->Letters[91] = VTK_VECTOR_TEXT_91; + this->Letters[92] = VTK_VECTOR_TEXT_92; + this->Letters[93] = VTK_VECTOR_TEXT_93; + this->Letters[94] = VTK_VECTOR_TEXT_94; + this->Letters[95] = VTK_VECTOR_TEXT_95; + this->Letters[96] = VTK_VECTOR_TEXT_96; + this->Letters[97] = VTK_VECTOR_TEXT_97; + this->Letters[98] = VTK_VECTOR_TEXT_98; + this->Letters[99] = VTK_VECTOR_TEXT_99; + this->Letters[100] = VTK_VECTOR_TEXT_100; + this->Letters[101] = VTK_VECTOR_TEXT_101; + this->Letters[102] = VTK_VECTOR_TEXT_102; + this->Letters[103] = VTK_VECTOR_TEXT_103; + this->Letters[104] = VTK_VECTOR_TEXT_104; + this->Letters[105] = VTK_VECTOR_TEXT_105; + this->Letters[106] = VTK_VECTOR_TEXT_106; + this->Letters[107] = VTK_VECTOR_TEXT_107; + this->Letters[108] = VTK_VECTOR_TEXT_108; + this->Letters[109] = VTK_VECTOR_TEXT_109; + this->Letters[110] = VTK_VECTOR_TEXT_110; + this->Letters[111] = VTK_VECTOR_TEXT_111; + this->Letters[112] = VTK_VECTOR_TEXT_112; + this->Letters[113] = VTK_VECTOR_TEXT_113; + this->Letters[114] = VTK_VECTOR_TEXT_114; + this->Letters[115] = VTK_VECTOR_TEXT_115; + this->Letters[116] = VTK_VECTOR_TEXT_116; + this->Letters[117] = VTK_VECTOR_TEXT_117; + this->Letters[118] = VTK_VECTOR_TEXT_118; + this->Letters[119] = VTK_VECTOR_TEXT_119; + this->Letters[120] = VTK_VECTOR_TEXT_120; + this->Letters[121] = VTK_VECTOR_TEXT_121; + this->Letters[122] = VTK_VECTOR_TEXT_122; + this->Letters[123] = VTK_VECTOR_TEXT_123; + this->Letters[124] = VTK_VECTOR_TEXT_124; + this->Letters[125] = VTK_VECTOR_TEXT_125; + this->Letters[126] = VTK_VECTOR_TEXT_126; + +} + +/*!Calculate output.*/ +void VTKViewer_VectorText::Execute() +{ + vtkPolyData *output = this->GetOutput(); + vtkPoints *newPoints; + vtkCellArray *newPolys; + int ptOffset = 0; + int aPoint, i; + int pos = 0; + float xpos = 0; + float ypos = 0; + int ptCount, triCount; + char *aLetter; + float width; + float ftmp[3]; + + if (this->Text == NULL) + { + vtkErrorMacro (<< "Text is not set!"); + return; + } + + // Set things up; allocate memory + newPoints = vtkPoints::New(); + newPolys = vtkCellArray::New(); + ftmp[2] = 0.0; + + // Create Text + while (this->Text[pos]) + { + switch (this->Text[pos]) + { + case 32: + xpos += 0.4; + break; + + case 10: + ypos -= 1.4; + xpos = 0; + break; + + default: + // if we have a valid character + if ((this->Text[pos] > 32)&&(this->Text[pos] < 127)) + { + // add the result to our output + aLetter = this->Letters[this->Text[pos]]; + ptCount = strtol(aLetter,&aLetter,10); + width = strtod(aLetter,&aLetter); + for (i = 0; i < ptCount; i++) + { + ftmp[0] = strtod(aLetter,&aLetter); + ftmp[1] = strtod(aLetter,&aLetter); + ftmp[0] += xpos; + ftmp[1] += ypos; + newPoints->InsertNextPoint(ftmp); + } + triCount = strtol(aLetter,&aLetter,10); + for (i = 0; i < triCount; i++) + { + newPolys->InsertNextCell(3); + aPoint = strtol(aLetter,&aLetter,10); + newPolys->InsertCellPoint(aPoint + ptOffset); + aPoint = strtol(aLetter,&aLetter,10); + newPolys->InsertCellPoint(aPoint + ptOffset); + aPoint = strtol(aLetter,&aLetter,10); + newPolys->InsertCellPoint(aPoint + ptOffset); + } + ptOffset += ptCount; + xpos += width; + } + break; + } + pos++; + } + + // + // Update ourselves and release memory + // + output->SetPoints(newPoints); + newPoints->Delete(); + + output->SetPolys(newPolys); + newPolys->Delete(); +} + +/*! + Print text to stream + \param os - stream + \param indent +*/ +void VTKViewer_VectorText::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os,indent); + + os << indent << "Text: " << (this->Text ? this->Text : "(none)") << "\n"; +} + +/*!Destructor.*/ +VTKViewer_VectorText::~VTKViewer_VectorText() +{ + if (this->Text) + { + delete [] this->Text; + } +} diff --git a/src/VTKViewer/VTKViewer_VectorText.h b/src/VTKViewer/VTKViewer_VectorText.h new file mode 100755 index 000000000..3bc1afd33 --- /dev/null +++ b/src/VTKViewer/VTKViewer_VectorText.h @@ -0,0 +1,68 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information.*/ + +// .NAME vtkVectorText - create polygonal text +// .SECTION Description + +// vtkVectorText generates vtkPolyData from an input text string. Besides the +// ASCII alphanumeric characters a-z, A-Z, 0-9, vtkVectorText also supports +// ASCII punctuation marks. (The supported ASCII character set are the codes +// (33-126) inclusive.) The only control character supported is the line feed +// character "\n", which advances to a new line. +// +// To use thie class, you normally couple it with a vtkPolyDataMapper and a +// vtkActor. In this case you would use the vtkActor's transformation methods +// to position, orient, and scale the text. You may also wish to use a +// vtkFollower to orient the text so that it always faces the camera. + +// .SECTION See Also +// vtkTextMapper vtkCaptionActor2D + +// VTKViewer_VectorText.h is a copy of vtkVectorText.h file. +// Purpose of copying: to remove linking to libHybrid.so VTK library + +#ifndef __VTKViewer_VectorText_h +#define __VTKViewer_VectorText_h + +#include "vtkPolyDataSource.h" +/*!Generates vtkPolyData from an input text string. + *@see vtkVectorText + */ +class VTKViewer_VectorText : public vtkPolyDataSource +{ +public: + static VTKViewer_VectorText *New(); + vtkTypeRevisionMacro(VTKViewer_VectorText,vtkPolyDataSource); + void PrintSelf(ostream& os, vtkIndent indent); + + // Description: + // Set/Get the text to be drawn. + vtkSetStringMacro(Text); + vtkGetStringMacro(Text); + +protected: + VTKViewer_VectorText(); + ~VTKViewer_VectorText(); + + void Execute(); + char *Text; + char *Letters[127]; + +}; + +#endif + + diff --git a/src/VTKViewer/VTKViewer_ViewManager.cxx b/src/VTKViewer/VTKViewer_ViewManager.cxx new file mode 100755 index 000000000..a206be6ee --- /dev/null +++ b/src/VTKViewer/VTKViewer_ViewManager.cxx @@ -0,0 +1,35 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "VTKViewer_ViewManager.h" +#include "VTKViewer_ViewModel.h" + +/*!Constructor.Initialize SIUT_ViewManager by \a study and \a theDesktop. + * Create new instance of VTKViewer_Viewer and set view model by it. + */ +VTKViewer_ViewManager::VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop ) +: SUIT_ViewManager( study, theDesktop, new VTKViewer_Viewer() ) +{ + setTitle( tr( "VTK_VIEW_TITLE" ) ); +} + +/*!Destructor.*/ +VTKViewer_ViewManager::~VTKViewer_ViewManager() +{ + /*!Do nothing.*/ +} diff --git a/src/VTKViewer/VTKViewer_ViewManager.h b/src/VTKViewer/VTKViewer_ViewManager.h new file mode 100755 index 000000000..38518fe06 --- /dev/null +++ b/src/VTKViewer/VTKViewer_ViewManager.h @@ -0,0 +1,38 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_VIEWMANAGER_H +#define VTKVIEWER_VIEWMANAGER_H + +#include "VTKViewer.h" + +#include + +class SUIT_Desktop; + +/*!View manager.*/ +class VTKVIEWER_EXPORT VTKViewer_ViewManager : public SUIT_ViewManager +{ + Q_OBJECT + +public: + VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* ); + virtual ~VTKViewer_ViewManager(); +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_ViewModel.cxx b/src/VTKViewer/VTKViewer_ViewModel.cxx new file mode 100755 index 000000000..f611972ae --- /dev/null +++ b/src/VTKViewer/VTKViewer_ViewModel.cxx @@ -0,0 +1,202 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "VTKViewer_ViewModel.h" +#include "VTKViewer_ViewWindow.h" +#include "VTKViewer_ViewManager.h" +#include "VTKViewer_RenderWindowInteractor.h" + +#include "SUIT_ViewWindow.h" +#include "SUIT_Desktop.h" +#include "SUIT_Session.h" + +#include +#include +#include +#include +#include + +bool _InitializeVtkWarningsCall() +{ + char* isOn = getenv( "VTK_WARNINGS_IS_ON" ); + if ( !isOn || strcmp( isOn, "1" ) ) + vtkObject::GlobalWarningDisplayOff(); + + delete isOn; + return vtkObject::GetGlobalWarningDisplay(); +} +static bool _InitializeVtkWarnings = _InitializeVtkWarningsCall(); + +/*!Constructor.Sets background color to black.*/ +VTKViewer_Viewer::VTKViewer_Viewer() +: SUIT_ViewModel(), +myBgColor( Qt::black ) +{ +} + +/*!Destructor.*/ +VTKViewer_Viewer::~VTKViewer_Viewer() +{ +} + +/*!Gets background color.*/ +QColor VTKViewer_Viewer::backgroundColor() const +{ + return myBgColor; +} + +/*!Sets background color.*/ +void VTKViewer_Viewer::setBackgroundColor( const QColor& c ) +{ + if ( c.isValid() ) + myBgColor = c; +} + +/*!Create new instance of VTKViewer_ViewWindow, sets background color and return pointer to it.*/ +SUIT_ViewWindow* VTKViewer_Viewer::createView( SUIT_Desktop* theDesktop ) +{ + VTKViewer_ViewWindow* vw = new VTKViewer_ViewWindow( theDesktop, this ); + vw->setBackgroundColor( myBgColor ); + return vw; +} + +/*!Sets view manager and connect slots.*/ +void VTKViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager) +{ + SUIT_ViewModel::setViewManager(theViewManager); + connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), + this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); + + connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), + this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*))); + + connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), + this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*))); +} + +/*!Insert context into popup menu.*/ +void VTKViewer_Viewer::contextMenuPopup(QPopupMenu* thePopup) +{ + thePopup->insertItem( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); + thePopup->insertItem( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); + + thePopup->insertSeparator(); + + VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView()); + if ( aView && !aView->getToolBar()->isVisible() ) + thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); +} + +/*!On mouse press event.*/ +void VTKViewer_Viewer::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event) +{ + VTKViewer_RenderWindowInteractor* rwi = 0; + if ( vw && vw->inherits( "VTKViewer_ViewWindow" ) ) + rwi = ((VTKViewer_ViewWindow*)vw)->getRWInteractor(); + if ( !rwi ) + return; + + switch(event->button()) { + case LeftButton: + rwi->LeftButtonPressed(event) ; + break ; + case MidButton: + rwi->MiddleButtonPressed(event) ; + break ; + case RightButton: + rwi->RightButtonPressed(event) ; + break; + default: + break ; + } +} + +/*!On mouse move event.*/ +void VTKViewer_Viewer::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event) +{ + VTKViewer_RenderWindowInteractor* rwi = 0; + if ( vw && vw->inherits( "VTKViewer_ViewWindow" ) ) + rwi = ((VTKViewer_ViewWindow*)vw)->getRWInteractor(); + if ( rwi ) + rwi->MouseMove( event ); +} + +/*!On mouse release event.*/ +void VTKViewer_Viewer::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event) +{ + VTKViewer_RenderWindowInteractor* rwi = 0; + if ( vw && vw->inherits( "VTKViewer_ViewWindow" ) ) + rwi = ((VTKViewer_ViewWindow*)vw)->getRWInteractor(); + if ( !rwi ) + return; + + switch(event->button()) { + case LeftButton: + rwi->LeftButtonReleased(event) ; + break ; + case MidButton: + rwi->MiddleButtonReleased(event) ; + break ; + case RightButton: + rwi->RightButtonReleased(event) ; + break; + default: + break ; + } +} + +/*!Sets flag to enable selection \a isEnable.*/ +void VTKViewer_Viewer::enableSelection(bool isEnabled) +{ + mySelectionEnabled = isEnabled; + //!! To be done for view windows +} + +/*!Sets flag to multi selection enable \a isEnable.*/ +void VTKViewer_Viewer::enableMultiselection(bool isEnable) +{ + myMultiSelectionEnabled = isEnable; + //!! To be done for view windows +} + +/*!On dump view event.*/ +void VTKViewer_Viewer::onDumpView() +{ + VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView()); + if ( aView ) + aView->onDumpView(); +} + +/*!On change back ground color event.*/ +void VTKViewer_Viewer::onChangeBgColor() +{ + VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView()); + if ( !aView ) + return; + + QColor aColor = QColorDialog::getColor( aView->backgroundColor(), aView); + if ( aColor.isValid() ) + aView->setBackgroundColor(aColor); +} + +/*!On show tool bar event.*/ +void VTKViewer_Viewer::onShowToolbar() { + VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView()); + if ( aView ) + aView->getToolBar()->show(); +} diff --git a/src/VTKViewer/VTKViewer_ViewModel.h b/src/VTKViewer/VTKViewer_ViewModel.h new file mode 100755 index 000000000..06cab857f --- /dev/null +++ b/src/VTKViewer/VTKViewer_ViewModel.h @@ -0,0 +1,80 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_VIEWMODEL_H +#define VTKVIEWER_VIEWMODEL_H + +#include "VTKViewer.h" +#include "SUIT_ViewModel.h" + +#include + +class SUIT_ViewWindow; +class SUIT_Desktop; + +class VTKVIEWER_EXPORT VTKViewer_Viewer: public SUIT_ViewModel +{ + Q_OBJECT + +public: + /*!Initialize type of viewer.*/ + static QString Type() { return "VTKViewer"; } + + VTKViewer_Viewer(); + virtual ~VTKViewer_Viewer(); + + virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); + + virtual void setViewManager(SUIT_ViewManager* theViewManager); + virtual void contextMenuPopup( QPopupMenu* ); + /*!Gets type of viewer.*/ + virtual QString getType() const { return Type(); } + +public: + void enableSelection(bool isEnabled); + /*!Checks: is selection enabled*/ + bool isSelectionEnabled() const { return mySelectionEnabled; } + + void enableMultiselection(bool isEnable); + /*!Checks: is multi selection enabled*/ + bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; } + + int getSelectionCount() const; + + QColor backgroundColor() const; + void setBackgroundColor( const QColor& ); + +signals: + void selectionChanged(); + +protected slots: + void onMousePress(SUIT_ViewWindow*, QMouseEvent*); + void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); + void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); + + void onDumpView(); + void onShowToolbar(); + void onChangeBgColor(); + +private: + QColor myBgColor; + bool mySelectionEnabled; + bool myMultiSelectionEnabled; +}; + +#endif diff --git a/src/VTKViewer/VTKViewer_ViewWindow.cxx b/src/VTKViewer/VTKViewer_ViewWindow.cxx new file mode 100755 index 000000000..aba392028 --- /dev/null +++ b/src/VTKViewer/VTKViewer_ViewWindow.cxx @@ -0,0 +1,612 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "VTKViewer_ViewWindow.h" +#include "VTKViewer_ViewModel.h" +#include "VTKViewer_RenderWindow.h" +#include "VTKViewer_RenderWindowInteractor.h" +#include "VTKViewer_InteractorStyle.h" +#include "VTKViewer_Trihedron.h" +#include "VTKViewer_Transform.h" +#include "VTKViewer_Utilities.h" + +#include "SUIT_Session.h" +#include "SUIT_ToolButton.h" +#include "SUIT_MessageBox.h" + +#include "SUIT_Tools.h" +#include "SUIT_ResourceMgr.h" + +#include +#include + +#include +#include + +/*! Construction*/ +VTKViewer_ViewWindow::VTKViewer_ViewWindow( SUIT_Desktop* theDesktop, + VTKViewer_Viewer* theModel, + VTKViewer_InteractorStyle* iStyle, + VTKViewer_RenderWindowInteractor* rw ) +: SUIT_ViewWindow( theDesktop ) +{ + myModel = theModel; + + myTrihedron = VTKViewer_Trihedron::New(); + myTransform = VTKViewer_Transform::New(); + myRenderer = vtkRenderer::New() ; + + myTrihedron->AddToRender( myRenderer ); + + myRenderWindow = new VTKViewer_RenderWindow( this, "RenderWindow" ); + setCentralWidget(myRenderWindow); + myRenderWindow->setFocusPolicy( StrongFocus ); + myRenderWindow->setFocus(); + + myRenderWindow->getRenderWindow()->AddRenderer( myRenderer ); + + myRenderer->GetActiveCamera()->ParallelProjectionOn(); + myRenderer->LightFollowCameraOn(); + myRenderer->TwoSidedLightingOn(); + + // Set BackgroundColor + QString BgrColorRed = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorRed"); + QString BgrColorGreen = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorGreen"); + QString BgrColorBlue = "0";//SUIT_CONFIG->getSetting("VTKViewer:BackgroundColorBlue"); + + if( !BgrColorRed.isEmpty() && !BgrColorGreen.isEmpty() && !BgrColorBlue.isEmpty() ) + myRenderer->SetBackground( BgrColorRed.toInt()/255., BgrColorGreen.toInt()/255., BgrColorBlue.toInt()/255. ); + else + myRenderer->SetBackground( 0, 0, 0 ); + + // Create an interactor. + myRWInteractor = rw ? rw : VTKViewer_RenderWindowInteractor::New(); + myRWInteractor->SetRenderWindow( myRenderWindow->getRenderWindow() ); + + VTKViewer_InteractorStyle* RWS = iStyle ? iStyle : VTKViewer_InteractorStyle::New(); + RWS->setGUIWindow( myRenderWindow ); + myRWInteractor->SetInteractorStyle( RWS ); + + myRWInteractor->Initialize(); + RWS->setTriedron( myTrihedron ); + RWS->FindPokedRenderer( 0, 0 ); + + setCentralWidget( myRenderWindow ); + + myToolBar = new QToolBar(this); + myToolBar->setCloseMode(QDockWindow::Undocked); + myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); + + createActions(); + createToolBar(); + + connect( myRenderWindow, SIGNAL(KeyPressed( QKeyEvent* )), + this, SLOT(onKeyPressed( QKeyEvent* )) ); + connect( myRenderWindow, SIGNAL(KeyReleased( QKeyEvent* )), + this, SLOT(onKeyReleased( QKeyEvent* )) ); + connect( myRenderWindow, SIGNAL(MouseButtonPressed( QMouseEvent* )), + this, SLOT(onMousePressed( QMouseEvent* )) ); + connect( myRenderWindow, SIGNAL(MouseButtonReleased( QMouseEvent* )), + this, SLOT(onMouseReleased( QMouseEvent* )) ); + connect( myRenderWindow, SIGNAL(MouseDoubleClicked( QMouseEvent* )), + this, SLOT(onMouseDoubleClicked( QMouseEvent* )) ); + connect( myRenderWindow, SIGNAL(MouseMove( QMouseEvent* )), + this, SLOT(onMouseMoving( QMouseEvent* )) ); + connect( myRWInteractor, SIGNAL(RenderWindowModified()), + myRenderWindow, SLOT(update()) ); + + connect( myRenderWindow, SIGNAL(contextMenuRequested( QContextMenuEvent * )), + this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) ); + + connect( myRWInteractor, SIGNAL(contextMenuRequested( QContextMenuEvent * )), + this, SIGNAL(contextMenuRequested( QContextMenuEvent * )) ); + + + onResetView(); +} + +/*!Destructor.*/ +VTKViewer_ViewWindow::~VTKViewer_ViewWindow() +{ + myTransform->Delete(); + // In order to ensure that the interactor unregisters + // this RenderWindow, we assign a NULL RenderWindow to + // it before deleting it. + myRWInteractor->SetRenderWindow( NULL ); + myRWInteractor->Delete(); + + //m_RW->Delete() ; + myRenderer->RemoveAllProps(); + //m_Renderer->Delete() ; + myTrihedron->Delete(); +} + +/*!Checks: is trihedron displayed.*/ +bool VTKViewer_ViewWindow::isTrihedronDisplayed(){ + return myTrihedron->GetVisibility() == VTKViewer_Trihedron::eOn; +} + +/*!Activates 'zooming' transformation*/ +void VTKViewer_ViewWindow::activateZoom() +{ + myRWInteractor->GetInteractorStyle()->startZoom(); +} + +/*!Activates 'panning' transformation*/ +void VTKViewer_ViewWindow::activatePanning() +{ + myRWInteractor->GetInteractorStyle()->startPan(); +} + +/*!Activates 'rotation' transformation*/ +void VTKViewer_ViewWindow::activateRotation() +{ + myRWInteractor->GetInteractorStyle()->startRotate(); +} + +/*!Activate global panning.*/ +void VTKViewer_ViewWindow::activateGlobalPanning() +{ + //if(myTrihedron->GetVisibleActorCount(myRenderer)) + myRWInteractor->GetInteractorStyle()->startGlobalPan(); +} + +/*!Activates 'fit area' transformation*/ +void VTKViewer_ViewWindow::activateWindowFit() +{ + myRWInteractor->GetInteractorStyle()->startFitArea(); +} + +/*!Create actions:*/ +void VTKViewer_ViewWindow::createActions() +{ + if (!myActionsMap.isEmpty()) return; + + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + + QtxAction* aAction; + + //! \li Dump view + aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_DUMP" ) ), + tr( "MNU_DUMP_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_DUMP_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView())); + myActionsMap[ DumpId ] = aAction; + + //! \li FitAll + aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITALL" ) ), + tr( "MNU_FITALL" ), 0, this); + aAction->setStatusTip(tr("DSC_FITALL")); + connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll())); + myActionsMap[ FitAllId ] = aAction; + + //! \li FitRect + aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FITAREA" ) ), + tr( "MNU_FITRECT" ), 0, this); + aAction->setStatusTip(tr("DSC_FITRECT")); + connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit())); + myActionsMap[ FitRectId ] = aAction; + + //! \li Zoom + aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ZOOM" ) ), + tr( "MNU_ZOOM_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_ZOOM_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom())); + myActionsMap[ ZoomId ] = aAction; + + //! \li Panning + aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_PAN" ) ), + tr( "MNU_PAN_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_PAN_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning())); + myActionsMap[ PanId ] = aAction; + + //! \li Global Panning + aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_GLOBALPAN" ) ), + tr( "MNU_GLOBALPAN_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning())); + myActionsMap[ GlobalPanId ] = aAction; + + //! \li Rotation + aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATE" ) ), + tr( "MNU_ROTATE_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_ROTATE_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation())); + myActionsMap[ RotationId ] = aAction; + + //! \li Projections + aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_FRONT" ) ), + tr( "MNU_FRONT_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_FRONT_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView())); + myActionsMap[ FrontId ] = aAction; + + //! \li Back view + aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BACK" ) ), + tr( "MNU_BACK_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_BACK_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onBackView())); + myActionsMap[ BackId ] = aAction; + + //! \li Top view + aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TOP" ) ), + tr( "MNU_TOP_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_TOP_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onTopView())); + myActionsMap[ TopId ] = aAction; + + //! \li Bottom view + aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_BOTTOM" ) ), + tr( "MNU_BOTTOM_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_BOTTOM_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView())); + myActionsMap[ BottomId ] = aAction; + + //! \li Left view + aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_LEFT" ) ), + tr( "MNU_LEFT_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_LEFT_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView())); + myActionsMap[ LeftId ] = aAction; + + //! \li Right view + aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RIGHT" ) ), + tr( "MNU_RIGHT_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_RIGHT_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onRightView())); + myActionsMap[ RightId ] = aAction; + + //! \li Reset + aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_RESET" ) ), + tr( "MNU_RESET_VIEW" ), 0, this); + aAction->setStatusTip(tr("DSC_RESET_VIEW")); + connect(aAction, SIGNAL(activated()), this, SLOT(onResetView())); + myActionsMap[ ResetId ] = aAction; + + //! \li Trihedron shown + aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRON"), aResMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_TRIHEDRON" ) ), + tr( "MNU_SHOW_TRIHEDRON" ), 0, this); + aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRON")); + connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow())); + myActionsMap[ TrihedronShowId ] = aAction; +} + +/*!Create tool bar.*/ +void VTKViewer_ViewWindow::createToolBar() +{ + myActionsMap[DumpId]->addTo(myToolBar); + myActionsMap[TrihedronShowId]->addTo(myToolBar); + + SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar); + aScaleBtn->AddAction(myActionsMap[FitAllId]); + aScaleBtn->AddAction(myActionsMap[FitRectId]); + aScaleBtn->AddAction(myActionsMap[ZoomId]); + + SUIT_ToolButton* aPanningBtn = new SUIT_ToolButton(myToolBar); + aPanningBtn->AddAction(myActionsMap[PanId]); + aPanningBtn->AddAction(myActionsMap[GlobalPanId]); + + myActionsMap[RotationId]->addTo(myToolBar); + + SUIT_ToolButton* aViewsBtn = new SUIT_ToolButton(myToolBar); + aViewsBtn->AddAction(myActionsMap[FrontId]); + aViewsBtn->AddAction(myActionsMap[BackId]); + aViewsBtn->AddAction(myActionsMap[TopId]); + aViewsBtn->AddAction(myActionsMap[BottomId]); + aViewsBtn->AddAction(myActionsMap[LeftId]); + aViewsBtn->AddAction(myActionsMap[RightId]); + + myActionsMap[ResetId]->addTo(myToolBar); +} + +/*!On front view event.*/ +void VTKViewer_ViewWindow::onFrontView() +{ + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->SetPosition(1,0,0); + camera->SetViewUp(0,0,1); + camera->SetFocalPoint(0,0,0); + onFitAll(); +} + +/*!On back view slot.*/ +void VTKViewer_ViewWindow::onBackView() +{ + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->SetPosition(-1,0,0); + camera->SetViewUp(0,0,1); + camera->SetFocalPoint(0,0,0); + onFitAll(); +} + +/*!On back view slot.*/ +void VTKViewer_ViewWindow::onTopView() +{ + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->SetPosition(0,0,1); + camera->SetViewUp(0,1,0); + camera->SetFocalPoint(0,0,0); + onFitAll(); +} + +/*!On bottom view slot.*/ +void VTKViewer_ViewWindow::onBottomView() +{ + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->SetPosition(0,0,-1); + camera->SetViewUp(0,1,0); + camera->SetFocalPoint(0,0,0); + onFitAll(); +} + +/*!On left view slot.*/ +void VTKViewer_ViewWindow::onLeftView() +{ + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->SetPosition(0,-1,0); + camera->SetViewUp(0,0,1); + camera->SetFocalPoint(0,0,0); + onFitAll(); +} + +/*!On right view slot.*/ +void VTKViewer_ViewWindow::onRightView() +{ + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->SetPosition(0,1,0); + camera->SetViewUp(0,0,1); + camera->SetFocalPoint(0,0,0); + onFitAll(); +} + +/*!On reset view slot.*/ +void VTKViewer_ViewWindow::onResetView() +{ + int aTriedronIsVisible = isTrihedronDisplayed(); + myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn ); + ::ResetCamera(myRenderer,true); + vtkCamera* aCamera = myRenderer->GetActiveCamera(); + aCamera->SetPosition(1,-1,1); + aCamera->SetViewUp(0,0,1); + ::ResetCamera(myRenderer,true); + if(aTriedronIsVisible) myTrihedron->VisibilityOn(); + else myTrihedron->VisibilityOff(); + static vtkFloatingPointType aCoeff = 3.0; + aCamera->SetParallelScale(aCoeff*aCamera->GetParallelScale()); + Repaint(); +} + +/*!On fit all slot.*/ +void VTKViewer_ViewWindow::onFitAll() +{ + myRWInteractor->GetInteractorStyle()->ViewFitAll(); + Repaint(); +} + +/*!Set background of the viewport*/ +void VTKViewer_ViewWindow::setBackgroundColor( const QColor& color ) +{ + if ( myRenderer ) + myRenderer->SetBackground( color.red()/255., color.green()/255., color.blue()/255. ); +} + +/*!Returns background of the viewport*/ +QColor VTKViewer_ViewWindow::backgroundColor() const +{ + vtkFloatingPointType backint[3]; + if ( myRenderer ) { + myRenderer->GetBackground( backint ); + return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255)); + } + return SUIT_ViewWindow::backgroundColor(); +} + +/*!Repaint window. If \a theUpdateTrihedron is true - recalculate trihedron.*/ +void VTKViewer_ViewWindow::Repaint(bool theUpdateTrihedron) +{ + if (theUpdateTrihedron) onAdjustTrihedron(); + myRenderWindow->update(); +} + +/*!Get scale of transformation filter.*/ +void VTKViewer_ViewWindow::GetScale( double theScale[3] ) { + myTransform->GetScale( theScale ); +} + +/*!Set scale of transformation filter and repaint window.*/ +void VTKViewer_ViewWindow::SetScale( double theScale[3] ) { + myTransform->SetMatrixScale( theScale[0], theScale[1], theScale[2] ); + myRWInteractor->Render(); + Repaint(); +} + +/*!Calculation trihedron size.*/ +void VTKViewer_ViewWindow::onAdjustTrihedron(){ + if( !isTrihedronDisplayed() ) + return; + int aVisibleNum = myTrihedron->GetVisibleActorCount(myRenderer); + if(aVisibleNum){ + // calculating diagonal of visible props of the renderer + vtkFloatingPointType bnd[6]; + myTrihedron->VisibilityOff(); + ::ComputeVisiblePropBounds(myRenderer,bnd); + myTrihedron->VisibilityOn(); + vtkFloatingPointType aLength = 0; + static bool CalcByDiag = false; + if(CalcByDiag){ + aLength = sqrt((bnd[1]-bnd[0])*(bnd[1]-bnd[0])+ + (bnd[3]-bnd[2])*(bnd[3]-bnd[2])+ + (bnd[5]-bnd[4])*(bnd[5]-bnd[4])); + }else{ + aLength = bnd[1]-bnd[0]; + aLength = max((bnd[3]-bnd[2]),aLength); + aLength = max((bnd[5]-bnd[4]),aLength); + } + + static vtkFloatingPointType aSizeInPercents = 105; + QString aSetting;// = SUIT_CONFIG->getSetting("Viewer:TrihedronSize"); + if(!aSetting.isEmpty()) aSizeInPercents = aSetting.toFloat(); + + static vtkFloatingPointType EPS_SIZE = 5.0E-3; + vtkFloatingPointType aSize = myTrihedron->GetSize(); + vtkFloatingPointType aNewSize = aLength*aSizeInPercents/100.0; + // if the new trihedron size have sufficient difference, then apply the value + if(fabs(aNewSize-aSize) > aSize*EPS_SIZE || fabs(aNewSize-aSize) > aNewSize*EPS_SIZE){ + myTrihedron->SetSize(aNewSize); + } + } + ::ResetCameraClippingRange(myRenderer); +} + +/*!Emit key pressed.*/ +void VTKViewer_ViewWindow::onKeyPressed(QKeyEvent* event) +{ + emit keyPressed( this, event ); +} + +/*!Emit key released.*/ +void VTKViewer_ViewWindow::onKeyReleased(QKeyEvent* event) +{ + emit keyReleased( this, event ); +} + +/*!Emit key pressed.*/ +void VTKViewer_ViewWindow::onMousePressed(QMouseEvent* event) +{ + emit mousePressed(this, event); +} + +/*!Emit mouse released.*/ +void VTKViewer_ViewWindow::onMouseReleased(QMouseEvent* event) +{ + emit mouseReleased( this, event ); +} + +/*!Emit mouse moving.*/ +void VTKViewer_ViewWindow::onMouseMoving(QMouseEvent* event) +{ + emit mouseMoving( this, event ); +} + +/*!Emit mouse double clicked.*/ +void VTKViewer_ViewWindow::onMouseDoubleClicked( QMouseEvent* event ) +{ + emit mouseDoubleClicked( this, event ); +} + +/*!Insert actor to renderer and transformation filter. + *Move Internal actors, if \a theMoveInternalActors is true. + */ +void VTKViewer_ViewWindow::InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors ){ + theActor->AddToRender(myRenderer); + theActor->SetTransform(myTransform); + if(theMoveInternalActors) + myRWInteractor->MoveInternalActors(); +} + +/*!Add actor.Repaint window if \a theUpdate is true. + *@see InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors ) + */ +void VTKViewer_ViewWindow::AddActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){ + InsertActor(theActor); + if(theUpdate) + Repaint(); +} + +/*!Remove \a theActor from renderer and pepaint, if \a theUpdate is true.*/ +void VTKViewer_ViewWindow::RemoveActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){ + theActor->RemoveFromRender(myRenderer); + if(theUpdate) + Repaint(); +} + +/*!@see RemoveActor() and InsertActor().*/ +void VTKViewer_ViewWindow::MoveActor( VTKViewer_Actor* theActor) +{ + RemoveActor(theActor); + InsertActor(theActor,true); +} + +/*!On trihedron show slot.*/ +void VTKViewer_ViewWindow::onTrihedronShow() +{ + if (isTrihedronDisplayed()) + myTrihedron->VisibilityOff(); + else + myTrihedron->VisibilityOn(); + myRenderWindow->update(); +} + +/*!Dump view.*/ +QImage VTKViewer_ViewWindow::dumpView() +{ + QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() ); + return px.convertToImage(); +} + +/*! The method returns the visual parameters of this view as a formated string + */ +QString VTKViewer_ViewWindow::getVisualParameters() +{ + double pos[3], focalPnt[3], viewUp[3], parScale, scale[3]; + + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->GetPosition( pos ); + camera->GetFocalPoint( focalPnt ); + camera->GetViewUp( viewUp ); + parScale = camera->GetParallelScale(); + GetScale( scale ); + + QString retStr; + retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", + pos[0], pos[1], pos[2], focalPnt[0], focalPnt[1], focalPnt[2], viewUp[0], viewUp[1], + viewUp[2], parScale, scale[0], scale[1], scale[2] ); + return retStr; +} + +/*! The method restors visual parameters of this view from a formated string + */ +void VTKViewer_ViewWindow::setVisualParameters( const QString& parameters ) +{ + QStringList paramsLst = QStringList::split( '*', parameters, true ); + if ( paramsLst.size() == 13 ) { + double pos[3], focalPnt[3], viewUp[3], parScale, scale[3]; + pos[0] = paramsLst[0].toDouble(); + pos[1] = paramsLst[1].toDouble(); + pos[2] = paramsLst[2].toDouble(); + focalPnt[0] = paramsLst[3].toDouble(); + focalPnt[1] = paramsLst[4].toDouble(); + focalPnt[2] = paramsLst[5].toDouble(); + viewUp[0] = paramsLst[6].toDouble(); + viewUp[1] = paramsLst[7].toDouble(); + viewUp[2] = paramsLst[8].toDouble(); + parScale = paramsLst[9].toDouble(); + scale[0] = paramsLst[10].toDouble(); + scale[1] = paramsLst[11].toDouble(); + scale[2] = paramsLst[12].toDouble(); + + vtkCamera* camera = myRenderer->GetActiveCamera(); + camera->SetPosition( pos ); + camera->SetFocalPoint( focalPnt ); + camera->SetViewUp( viewUp ); + camera->SetParallelScale( parScale ); + myTransform->SetMatrixScale( scale[0], scale[1], scale[2] ); + myRWInteractor->Render(); + } +} diff --git a/src/VTKViewer/VTKViewer_ViewWindow.h b/src/VTKViewer/VTKViewer_ViewWindow.h new file mode 100755 index 000000000..05c9ee9a8 --- /dev/null +++ b/src/VTKViewer/VTKViewer_ViewWindow.h @@ -0,0 +1,137 @@ +// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef VTKVIEWER_VIEWWINDOW_H +#define VTKVIEWER_VIEWWINDOW_H + +#include "VTKViewer.h" + +#include "SUIT_ViewWindow.h" + +#include "QtxAction.h" + +class vtkRenderer; +class SUIT_Desktop; +class VTKViewer_Viewer; +class VTKViewer_Trihedron; +class VTKViewer_Transform; +class VTKViewer_RenderWindow; +class VTKViewer_InteractorStyle; +class VTKViewer_RenderWindowInteractor; +class VTKViewer_Actor; + +#ifdef WIN32 +#pragma warning( disable:4251 ) +#endif + +class VTKVIEWER_EXPORT VTKViewer_ViewWindow : public SUIT_ViewWindow +{ + Q_OBJECT + +public: + VTKViewer_ViewWindow( SUIT_Desktop*, VTKViewer_Viewer*, + VTKViewer_InteractorStyle* = 0, + VTKViewer_RenderWindowInteractor* = 0 ); + virtual ~VTKViewer_ViewWindow(); + + /*!Gets tool bar.*/ + QToolBar* getToolBar() { return myToolBar; } + + void setBackgroundColor( const QColor& ); + QColor backgroundColor() const; + + /*!Gets renderer.*/ + vtkRenderer* getRenderer() { return myRenderer; } + /*!Gets render window.*/ + VTKViewer_RenderWindow* getRenderWindow() { return myRenderWindow; } + /*!Gets render window interactor.*/ + VTKViewer_RenderWindowInteractor* getRWInteractor() { return myRWInteractor; } + bool isTrihedronDisplayed(); + + void Repaint( bool theUpdateTrihedron = true ); + void onAdjustTrihedron(); + void GetScale( double theScale[3] ); + void SetScale( double theScale[3] ); + void AddActor( VTKViewer_Actor*, bool update = false ); + void RemoveActor( VTKViewer_Actor*, bool update = false); + + virtual QString getVisualParameters(); + virtual void setVisualParameters( const QString& parameters ); + +public slots: + void onFrontView(); + void onBackView(); + void onTopView(); + void onBottomView(); + void onLeftView(); + void onRightView(); + void onResetView(); + void onFitAll(); + void activateZoom(); + void activateWindowFit(); + void activateRotation(); + void activatePanning(); + void activateGlobalPanning(); + void onTrihedronShow(); + +protected: + QImage dumpView(); + +protected slots: + void onKeyPressed(QKeyEvent* event); + void onKeyReleased(QKeyEvent* event); + void onMousePressed(QMouseEvent* event); + void onMouseDoubleClicked(QMouseEvent* event); + void onMouseReleased(QMouseEvent* event); + void onMouseMoving(QMouseEvent* event); + +private: + void InsertActor( VTKViewer_Actor* theActor, + bool theMoveInternalActors = false ); + void MoveActor( VTKViewer_Actor* theActor ); + +private: + enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId, + FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, TrihedronShowId }; + typedef QMap ActionsMap; + + void createActions(); + void createToolBar(); + + VTKViewer_Viewer* myModel; + + vtkRenderer* myRenderer; + VTKViewer_RenderWindow* myRenderWindow; + VTKViewer_RenderWindowInteractor* myRWInteractor; + + VTKViewer_Trihedron* myTrihedron; + VTKViewer_Transform* myTransform; + + QToolBar* myToolBar; + ActionsMap myActionsMap; + + double myCurScale; + + friend class VTKViewer_RenderWindowInteractor; +}; + +#ifdef WIN32 +#pragma warning( default:4251 ) +#endif + +#endif diff --git a/src/VTKViewer/resources/VTKViewer_images.po b/src/VTKViewer/resources/VTKViewer_images.po new file mode 100755 index 000000000..0f618ddc5 --- /dev/null +++ b/src/VTKViewer/resources/VTKViewer_images.po @@ -0,0 +1,79 @@ +# SALOME SALOMEGUI : implementation of desktop and GUI kernel +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# +# +# File : SALOMEGUI_icons.po +# Module : SALOME + +msgid "" +msgstr "" +"Project-Id-Version: example-Qt-message-extraction\n" +"POT-Creation-Date: 1999-02-23 15:38+0200\n" +"PO-Revision-Date: 1999-02-23 15:38+0200\n" +"Last-Translator: \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +msgid "ICON_VTKVIEWER_VIEW_BACK" +msgstr "view_back.png" + +msgid "ICON_VTKVIEWER_VIEW_BOTTOM" +msgstr "view_bottom.png" + +msgid "ICON_VTKVIEWER_VIEW_FITALL" +msgstr "view_fitall.png" + +msgid "ICON_VTKVIEWER_VIEW_FITAREA" +msgstr "view_fitarea.png" + +msgid "ICON_VTKVIEWER_VIEW_FRONT" +msgstr "view_front.png" + +msgid "ICON_VTKVIEWER_VIEW_GLOBALPAN" +msgstr "view_glpan.png" + +msgid "ICON_VTKVIEWER_VIEW_LEFT" +msgstr "view_left.png" + +msgid "ICON_VTKVIEWER_VIEW_PAN" +msgstr "view_pan.png" + +msgid "ICON_VTKVIEWER_VIEW_RESET" +msgstr "view_reset.png" + +msgid "ICON_VTKVIEWER_VIEW_RIGHT" +msgstr "view_right.png" + +msgid "ICON_VTKVIEWER_VIEW_ROTATE" +msgstr "view_rotate.png" + +msgid "ICON_VTKVIEWER_VIEW_TOP" +msgstr "view_top.png" + +msgid "ICON_VTKVIEWER_VIEW_ZOOM" +msgstr "view_zoom.png" + +msgid "ICON_VTKVIEWER_VIEW_TRIHEDRON" +msgstr "view_triedre.png" + +msgid "ICON_VTKVIEWER_VIEW_DUMP" +msgstr "view_camera_dump.png" + diff --git a/src/VTKViewer/resources/VTKViewer_msg_en.po b/src/VTKViewer/resources/VTKViewer_msg_en.po new file mode 100755 index 000000000..ea26f2678 --- /dev/null +++ b/src/VTKViewer/resources/VTKViewer_msg_en.po @@ -0,0 +1,150 @@ +# SALOME SALOMEGUI : implementation of desktop and GUI kernel +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# +# +# File : SALOMEGUI_msg_en.po +# Module : SALOME + +msgid "" +msgstr "" +"Project-Id-Version: example-Qt-message-extraction\n" +"POT-Creation-Date: 1999-02-23 15:38+0200\n" +"PO-Revision-Date: 2005-05-31 13:25+0400\n" +"Last-Translator: \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +msgid "LBL_TOOLBAR_LABEL" +msgstr "View Operations" + +msgid "DSC_FRONT_VIEW" +msgstr "Front View" + +msgid "MNU_FRONT_VIEW" +msgstr "Front" + +msgid "DSC_BACK_VIEW" +msgstr "Back View" + +msgid "MNU_BACK_VIEW" +msgstr "Back" + +msgid "DSC_TOP_VIEW" +msgstr "Top View" + +msgid "MNU_TOP_VIEW" +msgstr "Top" + +msgid "DSC_BOTTOM_VIEW" +msgstr "Bottom View" + +msgid "MNU_BOTTOM_VIEW" +msgstr "Bottom" + +msgid "DSC_LEFT_VIEW" +msgstr "Left View" + +msgid "MNU_LEFT_VIEW" +msgstr "Left" + +msgid "DSC_RIGHT_VIEW" +msgstr "Right View" + +msgid "MNU_RIGHT_VIEW" +msgstr "Right" + +msgid "DSC_RESET_VIEW" +msgstr "Reset View Point" + +msgid "MNU_RESET_VIEW" +msgstr "Reset" + +msgid "DSC_FITALL" +msgstr "Fit all objects inside the view frame" + +msgid "MNU_FITALL" +msgstr "Fit All" + +msgid "DSC_FITRECT" +msgstr "Fit area within the view frame" + +msgid "MNU_FITRECT" +msgstr "Fit Area" + +msgid "DSC_ZOOM_VIEW" +msgstr "Zoom the view" + +msgid "MNU_ZOOM_VIEW" +msgstr "Zoom" + +msgid "DSC_PAN_VIEW" +msgstr "Panning the view" + +msgid "MNU_PAN_VIEW" +msgstr "Panning" + +msgid "DSC_GLOBALPAN_VIEW" +msgstr "Selection of a new center of the view" + +msgid "MNU_GLOBALPAN_VIEW" +msgstr "Global Panning" + +msgid "DSC_ROTATE_VIEW" +msgstr "Rotation of the point of view around the scene center" + +msgid "MNU_ROTATE_VIEW" +msgstr "Rotation" + +msgid "DSC_DUMP_VIEW" +msgstr "Saves the active view in the image file" + +msgid "MNU_DUMP_VIEW" +msgstr "Dump view..." + +msgid "VTK_IMAGE_FILES" +msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)" + +msgid "INF_APP_DUMP_VIEW" +msgstr "Dump view" + +msgid "ERR_DOC_CANT_SAVE_FILE" +msgstr "Cannot save file" + +msgid "ERROR" +msgstr "Error" + +msgid "VTKViewer_Viewer::MEN_DUMP_VIEW" +msgstr "Dump view..." + +msgid "VTKViewer_Viewer::MEN_SHOW_TOOLBAR" +msgstr "Show toolbar" + +msgid "VTKViewer_Viewer::MEN_CHANGE_BACKGROUD" +msgstr "Change background..." + +msgid "VTKViewer_ViewManager::VTK_VIEW_TITLE" +msgstr "VTK scene:%M - viewer:%V" + +msgid "MNU_SHOW_TRIHEDRON" +msgstr "Show/Hide trihedron" + +msgid "DSC_SHOW_TRIHEDRON" +msgstr "Show/Hide trihedron in the current view" diff --git a/src/VTKViewer/resources/view_back.png b/src/VTKViewer/resources/view_back.png new file mode 100755 index 000000000..436f2da15 Binary files /dev/null and b/src/VTKViewer/resources/view_back.png differ diff --git a/src/VTKViewer/resources/view_bottom.png b/src/VTKViewer/resources/view_bottom.png new file mode 100755 index 000000000..a18011c47 Binary files /dev/null and b/src/VTKViewer/resources/view_bottom.png differ diff --git a/src/VTKViewer/resources/view_camera_dump.png b/src/VTKViewer/resources/view_camera_dump.png new file mode 100755 index 000000000..8eb63e09b Binary files /dev/null and b/src/VTKViewer/resources/view_camera_dump.png differ diff --git a/src/VTKViewer/resources/view_fitall.png b/src/VTKViewer/resources/view_fitall.png new file mode 100755 index 000000000..c09ff94ad Binary files /dev/null and b/src/VTKViewer/resources/view_fitall.png differ diff --git a/src/VTKViewer/resources/view_fitarea.png b/src/VTKViewer/resources/view_fitarea.png new file mode 100755 index 000000000..5b79594e7 Binary files /dev/null and b/src/VTKViewer/resources/view_fitarea.png differ diff --git a/src/VTKViewer/resources/view_front.png b/src/VTKViewer/resources/view_front.png new file mode 100755 index 000000000..c5dfc00d5 Binary files /dev/null and b/src/VTKViewer/resources/view_front.png differ diff --git a/src/VTKViewer/resources/view_glpan.png b/src/VTKViewer/resources/view_glpan.png new file mode 100755 index 000000000..c23322a4a Binary files /dev/null and b/src/VTKViewer/resources/view_glpan.png differ diff --git a/src/VTKViewer/resources/view_graduated_axes.png b/src/VTKViewer/resources/view_graduated_axes.png new file mode 100755 index 000000000..f1ad7558e --- /dev/null +++ b/src/VTKViewer/resources/view_graduated_axes.png @@ -0,0 +1 @@ +‰PNG diff --git a/src/VTKViewer/resources/view_left.png b/src/VTKViewer/resources/view_left.png new file mode 100755 index 000000000..dbc06cc6e Binary files /dev/null and b/src/VTKViewer/resources/view_left.png differ diff --git a/src/VTKViewer/resources/view_pan.png b/src/VTKViewer/resources/view_pan.png new file mode 100755 index 000000000..038fba118 Binary files /dev/null and b/src/VTKViewer/resources/view_pan.png differ diff --git a/src/VTKViewer/resources/view_reset.png b/src/VTKViewer/resources/view_reset.png new file mode 100755 index 000000000..12850643e Binary files /dev/null and b/src/VTKViewer/resources/view_reset.png differ diff --git a/src/VTKViewer/resources/view_right.png b/src/VTKViewer/resources/view_right.png new file mode 100755 index 000000000..598def41d Binary files /dev/null and b/src/VTKViewer/resources/view_right.png differ diff --git a/src/VTKViewer/resources/view_rotate.png b/src/VTKViewer/resources/view_rotate.png new file mode 100755 index 000000000..80926c545 Binary files /dev/null and b/src/VTKViewer/resources/view_rotate.png differ diff --git a/src/VTKViewer/resources/view_scaling.png b/src/VTKViewer/resources/view_scaling.png new file mode 100644 index 000000000..5d3443634 Binary files /dev/null and b/src/VTKViewer/resources/view_scaling.png differ diff --git a/src/VTKViewer/resources/view_top.png b/src/VTKViewer/resources/view_top.png new file mode 100755 index 000000000..ebbf34da5 Binary files /dev/null and b/src/VTKViewer/resources/view_top.png differ diff --git a/src/VTKViewer/resources/view_triedre.png b/src/VTKViewer/resources/view_triedre.png new file mode 100755 index 000000000..3eed48db8 Binary files /dev/null and b/src/VTKViewer/resources/view_triedre.png differ diff --git a/src/VTKViewer/resources/view_update_rate.png b/src/VTKViewer/resources/view_update_rate.png new file mode 100755 index 000000000..9065e6b45 Binary files /dev/null and b/src/VTKViewer/resources/view_update_rate.png differ diff --git a/src/VTKViewer/resources/view_zoom.png b/src/VTKViewer/resources/view_zoom.png new file mode 100755 index 000000000..b46573914 Binary files /dev/null and b/src/VTKViewer/resources/view_zoom.png differ