X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVTKViewer%2FVTKViewer_Actor.cxx;h=76f5d153bde1b9a64534a216f774c4ab2b6b0c82;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=624ed1deb6c8b95429868396a59d6dfd0d76059d;hpb=e07448c48ea5b2127e34fc7b8c3427d01c7ce17b;p=modules%2Fgui.git diff --git a/src/VTKViewer/VTKViewer_Actor.cxx b/src/VTKViewer/VTKViewer_Actor.cxx index 624ed1deb..76f5d153b 100755 --- a/src/VTKViewer/VTKViewer_Actor.cxx +++ b/src/VTKViewer/VTKViewer_Actor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -61,18 +61,18 @@ vtkStandardNewMacro(VTKViewer_Actor); */ VTKViewer_Actor ::VTKViewer_Actor(): + myIsResolveCoincidentTopology(true), myOpacity(1.0), - myIsHighlighted(false), - myIsPreselected(false), - myRepresentation(VTKViewer::Representation::Surface), myDisplayMode(1), - myProperty(vtkProperty::New()), - PreviewProperty(NULL), myIsInfinite(false), - myIsResolveCoincidentTopology(true), myStoreMapping(false), myGeomFilter(VTKViewer_GeometryFilter::New()), - myTransformFilter(VTKViewer_TransformFilter::New()) + myTransformFilter(VTKViewer_TransformFilter::New()), + myRepresentation(VTKViewer::Representation::Surface), + myProperty(vtkProperty::New()), + PreviewProperty(NULL), + myIsPreselected(false), + myIsHighlighted(false) { vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(myPolygonOffsetFactor, myPolygonOffsetUnits); @@ -180,30 +180,26 @@ VTKViewer_Actor { if(theMapper){ int anId = 0; - myPassFilter[ anId ]->SetInput( theMapper->GetInput() ); - myPassFilter[ anId + 1]->SetInput( myPassFilter[ anId ]->GetOutput() ); + myPassFilter[ anId ]->SetInputData( theMapper->GetInput() ); + myPassFilter[ anId + 1]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() ); anId++; // 1 myGeomFilter->SetStoreMapping( myStoreMapping ); - myGeomFilter->SetInput( myPassFilter[ anId ]->GetOutput() ); + myGeomFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() ); anId++; // 2 - myPassFilter[ anId ]->SetInput( myGeomFilter->GetOutput() ); - myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); + myPassFilter[ anId ]->SetInputConnection( myGeomFilter->GetOutputPort() ); + myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() ); anId++; // 3 - myTransformFilter->SetInput( myPassFilter[ anId ]->GetPolyDataOutput() ); + myTransformFilter->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() ); anId++; // 4 - myPassFilter[ anId ]->SetInput( myTransformFilter->GetOutput() ); - myPassFilter[ anId + 1 ]->SetInput( myPassFilter[ anId ]->GetOutput() ); + myPassFilter[ anId ]->SetInputConnection( myTransformFilter->GetOutputPort() ); + myPassFilter[ anId + 1 ]->SetInputConnection( myPassFilter[ anId ]->GetOutputPort() ); 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()); - } + theMapper->SetInputConnection(myPassFilter[anId]->GetOutputPort()); } Superclass::SetMapper(theMapper); } @@ -216,15 +212,15 @@ VTKViewer_Actor ::Render(vtkRenderer *ren, vtkMapper* m) { if(vtkDataSet* aDataSet = GetInput()){ - static vtkFloatingPointType PERCENTS_OF_DETAILS = 0.50; + static double PERCENTS_OF_DETAILS = 0.50; vtkIdType aNbOfPoints = vtkIdType(aDataSet->GetNumberOfPoints()*PERCENTS_OF_DETAILS); if(aNbOfPoints > 0) SetNumberOfCloudPoints(aNbOfPoints); } + int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology(); if(myIsResolveCoincidentTopology){ - int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology(); - vtkFloatingPointType aFactor, aUnit; + double aFactor, aUnit; vtkMapper::GetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit); vtkMapper::SetResolveCoincidentTopologyToPolygonOffset(); @@ -233,10 +229,11 @@ VTKViewer_Actor Superclass::Render(ren,m); vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(aFactor,aUnit); - vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology); }else{ + vtkMapper::SetResolveCoincidentTopologyToOff(); Superclass::Render(ren,m); } + vtkMapper::SetResolveCoincidentTopology(aResolveCoincidentTopology); } /*! @@ -256,8 +253,8 @@ VTKViewer_Actor */ void VTKViewer_Actor -::SetPolygonOffsetParameters(vtkFloatingPointType factor, - vtkFloatingPointType units) +::SetPolygonOffsetParameters(double factor, + double units) { myPolygonOffsetFactor = factor; myPolygonOffsetUnits = units; @@ -269,8 +266,8 @@ VTKViewer_Actor */ void VTKViewer_Actor -::GetPolygonOffsetParameters(vtkFloatingPointType& factor, - vtkFloatingPointType& units) +::GetPolygonOffsetParameters(double& factor, + double& units) { factor = myPolygonOffsetFactor; units = myPolygonOffsetUnits; @@ -279,7 +276,7 @@ VTKViewer_Actor /*! \return shrink factor */ -vtkFloatingPointType +double VTKViewer_Actor ::GetShrinkFactor() { @@ -335,12 +332,12 @@ VTKViewer_Actor /*! To calculatate last modified time */ -unsigned long int +vtkMTimeType VTKViewer_Actor ::GetMTime() { - unsigned long mTime = this->Superclass::GetMTime(); - unsigned long time = myTransformFilter->GetMTime(); + vtkMTimeType mTime = this->Superclass::GetMTime(); + vtkMTimeType time = myTransformFilter->GetMTime(); mTime = ( time > mTime ? time : mTime ); if(vtkDataSet *aDataSet = dynamic_cast(myPassFilter[0]->GetInput())){ // bad usage of GetInput time = aDataSet->GetMTime(); @@ -433,7 +430,7 @@ VTKViewer_Actor /*! Get coordinates of a node for given object index */ -vtkFloatingPointType* +double* VTKViewer_Actor ::GetNodeCoord(int theObjID) { @@ -494,14 +491,14 @@ VTKViewer_Actor if(myIsInfinite) return true; - static vtkFloatingPointType MAX_DISTANCE = 0.9*VTK_LARGE_FLOAT; - vtkFloatingPointType aBounds[6]; + static double MAX_DISTANCE = 0.9*VTK_FLOAT_MAX; + double 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; + static double MIN_DISTANCE = 1.0/VTK_FLOAT_MAX; if(GetLength() < MIN_DISTANCE) return true; @@ -511,7 +508,7 @@ VTKViewer_Actor /*! \return current bounding box */ -vtkFloatingPointType* +double* VTKViewer_Actor ::GetBounds() { @@ -524,7 +521,7 @@ VTKViewer_Actor */ void VTKViewer_Actor -::GetBounds(vtkFloatingPointType theBounds[6]) +::GetBounds(double theBounds[6]) { Superclass::GetBounds(theBounds); } @@ -546,7 +543,7 @@ VTKViewer_Actor void VTKViewer_Actor -::SetSize( const vtkFloatingPointType ) +::SetSize( const double ) {} @@ -558,13 +555,13 @@ VTKViewer_Actor void VTKViewer_Actor -::SetOpacity(vtkFloatingPointType theOpacity) +::SetOpacity(double theOpacity) { myOpacity = theOpacity; GetProperty()->SetOpacity(theOpacity); } -vtkFloatingPointType +double VTKViewer_Actor ::GetOpacity() { @@ -577,9 +574,9 @@ VTKViewer_Actor */ void VTKViewer_Actor -::SetColor(vtkFloatingPointType r, - vtkFloatingPointType g, - vtkFloatingPointType b) +::SetColor(double r, + double g, + double b) { GetProperty()->SetColor(r,g,b); } @@ -589,7 +586,7 @@ VTKViewer_Actor */ void VTKViewer_Actor -::SetColor(const vtkFloatingPointType theRGB[3]) +::SetColor(const double theRGB[3]) { SetColor(theRGB[0],theRGB[1],theRGB[2]); } @@ -599,11 +596,11 @@ VTKViewer_Actor */ void VTKViewer_Actor -::GetColor(vtkFloatingPointType& r, - vtkFloatingPointType& g, - vtkFloatingPointType& b) +::GetColor(double& r, + double& g, + double& b) { - vtkFloatingPointType aColor[3]; + double aColor[3]; GetProperty()->GetColor(aColor); r = aColor[0]; g = aColor[1]; @@ -621,13 +618,23 @@ VTKViewer_Actor } /*! - Get current material -*/ -vtkProperty* -VTKViewer_Actor -::GetMaterial() -{ - return NULL; + Get current front material +*/ +vtkProperty* +VTKViewer_Actor +::GetFrontMaterial() +{ + return NULL; +} + +/*! + Get current back material +*/ +vtkProperty* +VTKViewer_Actor +::GetBackMaterial() +{ + return NULL; } /*! @@ -718,14 +725,14 @@ bool VTKViewer_Actor::GetQuadraticArcMode() const{ /*! * Set Max angle for representation 2D quadratic element as arked polygon */ -void VTKViewer_Actor::SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle){ +void VTKViewer_Actor::SetQuadraticArcAngle(double theMaxAngle){ myGeomFilter->SetQuadraticArcAngle(theMaxAngle); } /*! * Return Max angle of the representation 2D quadratic element as arked polygon */ -vtkFloatingPointType VTKViewer_Actor::GetQuadraticArcAngle() const{ +double VTKViewer_Actor::GetQuadraticArcAngle() const{ return myGeomFilter->GetQuadraticArcAngle(); }