VISU_AppendPolyData.hxx \
VISU_AppendFilterUtilities.hxx \
VISU_ExtractUnstructuredGrid.hxx \
+ VISU_UsedPointsFilter.hxx \
VISU_CommonCellsFilter.hxx \
VISUConvertor.hxx
VISU_AppendFilterUtilities.cxx \
VISU_MergeFilter.cxx \
VISU_MergeFilterUtilities.cxx \
+ VISU_UsedPointsFilter.cxx \
VISU_CommonCellsFilter.cxx
libVisuConvertor_la_CPPFLAGS= \
#include "VISU_Convertor.hxx"
-#include <vtkDataSetAlgorithm.h>
+//#include <vtkDataSetAlgorithm.h>
+#include <vtkPointSetAlgorithm.h>
namespace VISU
{
//------------------------------------------------------------------------------
-class VISU_CONVERTOR_EXPORT VISU_MergeFilter : public vtkDataSetAlgorithm
+class VISU_CONVERTOR_EXPORT VISU_MergeFilter : public vtkPointSetAlgorithm
{
public:
static VISU_MergeFilter *New();
- vtkTypeMacro(VISU_MergeFilter, vtkDataSetAlgorithm);
+ vtkTypeMacro(VISU_MergeFilter, vtkPointSetAlgorithm);
// Description:
// Specify object from which to extract geometry information.
--- /dev/null
+// 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_UsedPointsFilter.cxx
+// Author :
+// Module : VISU
+
+
+#include "VISU_UsedPointsFilter.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkCell.h>
+#include <vtkIdList.h>
+
+#include <map>
+
+vtkStandardNewMacro(VISU_UsedPointsFilter);
+
+
+VISU_UsedPointsFilter::VISU_UsedPointsFilter()
+{
+}
+
+VISU_UsedPointsFilter::~VISU_UsedPointsFilter()
+{
+}
+
+void VISU_UsedPointsFilter::Execute(){
+ vtkDataSet *anInput = this->GetInput();
+ vtkUnstructuredGrid *anOutput = this->GetOutput();
+
+ typedef std::map<vtkIdType, vtkIdType> TId2IdMap;
+ TId2IdMap aId2IdMap;
+
+ vtkPointData *aPointData = anOutput->GetPointData();
+ aPointData->CopyAllocate(anInput->GetPointData());
+
+ vtkPoints* aUsedPoints = vtkPoints::New();
+ vtkIdList *anIdList = vtkIdList::New();
+ vtkIdType iEnd = anInput->GetNumberOfPoints();
+ for(vtkIdType aPointId = 0; aPointId < iEnd; aPointId++){
+ anInput->GetPointCells(aPointId,anIdList);
+ if(anIdList->GetNumberOfIds() > 0){
+ vtkIdType aNewPointId = aUsedPoints->InsertNextPoint(anInput->GetPoint(aPointId));
+ aPointData->CopyData(anInput->GetPointData(), aPointId, aNewPointId);
+ aId2IdMap[aPointId] = aNewPointId;
+ }
+ }
+ aPointData->Squeeze();
+ anOutput->SetPoints(aUsedPoints);
+ aUsedPoints->Delete();
+ anIdList->Delete();
+
+ vtkCellData *aCellData = anOutput->GetCellData();
+ aCellData->CopyAllocate(anInput->GetCellData());
+
+ anOutput->Allocate(anInput->GetNumberOfCells());
+ vtkIdList *anOldPointsIds = vtkIdList::New();
+ vtkIdList *aNewPointsIds = vtkIdList::New();
+ aNewPointsIds->Allocate(VTK_CELL_SIZE);
+ iEnd = anInput->GetNumberOfCells();
+ for(vtkIdType aCellId = 0; aCellId < iEnd; aCellId++){
+ anInput->GetCellPoints(aCellId, anOldPointsIds);
+ vtkIdType aNbPointsInCell = anOldPointsIds->GetNumberOfIds();
+ aNewPointsIds->Reset();
+ for(vtkIdType i = 0; i < aNbPointsInCell; i++){
+ vtkIdType anOldId = anOldPointsIds->GetId(i);
+ TId2IdMap::iterator anIter = aId2IdMap.find(anOldId);
+ if(anIter == aId2IdMap.end())
+ goto NEXT_CELL;
+ vtkIdType aNewId = anIter->second;
+ aNewPointsIds->InsertNextId(aNewId);
+ }
+ {
+ vtkIdType aNewCellId = anOutput->InsertNextCell(anInput->GetCellType(aCellId), aNewPointsIds);
+ aCellData->CopyData(anInput->GetCellData(), aCellId, aNewCellId);
+ }
+ NEXT_CELL:
+ continue;
+ }
+ aCellData->Squeeze();
+ anOldPointsIds->Delete();
+ aNewPointsIds->Delete();
+ anOutput->Squeeze();
+}
+
--- /dev/null
+// 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_UsedPointsFilter.hxx
+// Author :
+// Module : VISU
+
+#ifndef VISU_UsedPointsFilter_HeaderFile
+#define VISU_UsedPointsFilter_HeaderFile
+
+#include <vtkDataSetToUnstructuredGridFilter.h>
+
+class VISU_UsedPointsFilter : public vtkDataSetToUnstructuredGridFilter
+{
+public:
+ vtkTypeMacro(VISU_UsedPointsFilter,vtkDataSetToUnstructuredGridFilter);
+ static VISU_UsedPointsFilter *New();
+
+protected:
+ VISU_UsedPointsFilter();
+ ~VISU_UsedPointsFilter();
+
+ virtual void Execute();
+};
+
+#endif
+
VISU_ScalarBarActor.hxx \
VISU_Extractor.hxx \
VISU_FieldTransform.hxx \
- VISU_UsedPointsFilter.hxx \
+ VISU_MaskPointsFilter.hxx \
VISU_GaussPointsPL.hxx \
VISU_Plot3DPL.hxx \
VISU_OpenGLPointSpriteMapper.hxx \
VISU_ScalarBarActor.cxx \
VISU_Extractor.cxx \
VISU_FieldTransform.cxx \
- VISU_UsedPointsFilter.cxx \
+ VISU_MaskPointsFilter.cxx \
VISU_GaussPointsPL.cxx \
VISU_Plot3DPL.cxx \
SALOME_ExtractGeometry.cxx \
--- /dev/null
+// VISU OBJECT : 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: VISU_StreamLinesPL.cxx
+// Author: Alexey PETROV
+// Module : VISU
+
+
+#include "VISU_MaskPointsFilter.hxx"
+
+#include <vtkObjectFactory.h>
+#include <vtkPointSet.h>
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkPoints.h>
+#include <vtkIdList.h>
+
+vtkStandardNewMacro(VISU_MaskPointsFilter);
+
+VISU_MaskPointsFilter::VISU_MaskPointsFilter(){
+ PercentsOfUsedPoints = 1.0;
+}
+
+VISU_MaskPointsFilter::~VISU_MaskPointsFilter(){}
+
+void VISU_MaskPointsFilter::Execute(){
+ vtkPointSet *anInput = this->GetInput(), *anOutput = this->GetOutput();
+ anOutput->GetPointData()->CopyAllOff();
+ anOutput->GetCellData()->CopyAllOff();
+ anOutput->CopyStructure(anInput);
+
+ vtkPoints* aPoints = vtkPoints::New();
+ vtkIdList *anIdList = vtkIdList::New();
+ vtkIdType iEnd = anInput->GetNumberOfPoints();
+ for(vtkIdType i = 0; i < iEnd; i++){
+ anInput->GetPointCells(i,anIdList);
+ if(anIdList->GetNumberOfIds() > 0)
+ aPoints->InsertNextPoint(anInput->GetPoint(i));
+ }
+ vtkPoints* aNewPoints = vtkPoints::New();
+ iEnd = aPoints->GetNumberOfPoints();
+ if (PercentsOfUsedPoints > 0){
+ vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
+ if(anOffset < 1) anOffset = 1;
+ for(vtkIdType i = 0; i < iEnd; i += anOffset)
+ aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
+ }
+ anOutput->SetPoints(aNewPoints);
+ aNewPoints->Delete();
+ aPoints->Delete();
+}
--- /dev/null
+// VISU OBJECT : 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: VISU_MaskPointsFilter.hxx
+// Author: Alexey PETROV
+// Module : VISU
+
+#ifndef VISU_MaskPointsFilter_HeaderFile
+#define VISU_MaskPointsFilter_HeaderFile
+
+#include <vtkPointSetToPointSetFilter.h>
+
+class VISU_MaskPointsFilter : public vtkPointSetToPointSetFilter{
+protected:
+ VISU_MaskPointsFilter();
+ VISU_MaskPointsFilter(const VISU_MaskPointsFilter&);
+
+ virtual void Execute();
+ float PercentsOfUsedPoints;
+
+public:
+ vtkTypeMacro(VISU_MaskPointsFilter,vtkPointSetToPointSetFilter);
+ static VISU_MaskPointsFilter* New();
+ virtual ~VISU_MaskPointsFilter();
+
+ vtkSetMacro(PercentsOfUsedPoints,float);
+ vtkGetMacro(PercentsOfUsedPoints,float);
+};
+
+#endif
theOutputFilter->SetInput(theDataSet);
}
- //----------------------------------------------------------------------------
- template<class TOutputFilter>
- void
- ToCellCenters(TOutputFilter* theOutputFilter,
- vtkCellCenters *theCellCenters,
- vtkDataSet* theDataSet)
-
- {
- if(VISU::IsDataOnCells(theDataSet)){
- theCellCenters->SetInput(theDataSet);
- theCellCenters->VertexCellsOn();
- theOutputFilter->SetInput(theCellCenters->GetOutput());
- }else
- theOutputFilter->SetInput(theDataSet);
- }
-
//----------------------------------------------------------------------------
//! Checks whether the float values are the same or not
bool VISU_PIPELINE_EXPORT
//----------------------------------------------------------------------------
-vtkDataSet*
+vtkPointSet*
VISU_ScalarMapPL
::GetMergedInput()
{
//----------------------------------------------------------------------------
virtual
- vtkDataSet*
+ vtkPointSet*
GetMergedInput();
protected:
#include "VISU_StreamLinesPL.hxx"
-#include "VISU_Extractor.hxx"
-#include "VISU_FieldTransform.hxx"
-#include "VISU_UsedPointsFilter.hxx"
-#include "VTKViewer_GeometryFilter.h"
+#include "VISU_Extractor.hxx"
+//#include "VISU_FieldTransform.hxx"
+//#include "VISU_UsedPointsFilter.hxx"
+#include "VISU_MaskPointsFilter.hxx"
#include "VISU_PipeLineUtils.hxx"
+#include "VTKViewer_GeometryFilter.h"
+
#include <algorithm>
#include <vtkCell.h>
myStream = vtkStreamLine::New();
myCenters = vtkCellCenters::New();
myGeomFilter = VTKViewer_GeometryFilter::New();
- myPointsFilter = VISU_UsedPointsFilter::New();
+ myPointsFilter = VISU_MaskPointsFilter::New();
myPercents = 0.3;
mySource = NULL;
}
::SetParams(vtkFloatingPointType theIntStep,
vtkFloatingPointType thePropogationTime,
vtkFloatingPointType theStepLength,
- vtkDataSet* theSource,
+ vtkPointSet* theSource,
vtkFloatingPointType thePercents,
int theDirection)
{
- vtkDataSet* aDataSet = theSource? theSource: GetMergedInput();
+ vtkPointSet* aDataSet = theSource? theSource: GetMergedInput();
aDataSet->Update();
vtkIdType aNbOfPoints = aDataSet->GetNumberOfPoints();
//----------------------------------------------------------------------------
-vtkDataSet*
+vtkPointSet*
VISU_StreamLinesPL
::GetSource()
{
//----------------------------------------------------------------------------
size_t
VISU_StreamLinesPL
-::IsPossible(vtkDataSet* theDataSet,
+::IsPossible(vtkPointSet* theDataSet,
vtkFloatingPointType thePercents)
{
vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
- VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New();
+ VISU_MaskPointsFilter *aPointsFilter = VISU_MaskPointsFilter::New();
aPointsFilter->SetInput(theDataSet);
vtkDataSet* aDataSet = aPointsFilter->GetOutput();
aDataSet->Update();
#include <vtkStreamLine.h>
class vtkDataSet;
+class vtkPointSet;
class vtkCellCenters;
class VTKViewer_GeometryFilter;
-class VISU_UsedPointsFilter;
+class VISU_MaskPointsFilter;
//----------------------------------------------------------------------------
SetParams(vtkFloatingPointType theIntStep,
vtkFloatingPointType thePropogationTime,
vtkFloatingPointType theStepLength,
- vtkDataSet* theSource = NULL,
+ vtkPointSet* theSource = NULL,
vtkFloatingPointType thePercents = 0.3,
int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS);
virtual
- vtkDataSet*
+ vtkPointSet*
GetSource();
virtual
static
size_t
- IsPossible(vtkDataSet* theDataSet,
+ IsPossible(vtkPointSet* theDataSet,
vtkFloatingPointType thePercents = 0.3);
protected:
vtkDataSet* theDataSet);
vtkStreamLine* myStream;
- vtkDataSet* mySource;
+ vtkPointSet* mySource;
vtkCellCenters* myCenters;
VTKViewer_GeometryFilter *myGeomFilter;
- VISU_UsedPointsFilter *myPointsFilter;
+ VISU_MaskPointsFilter *myPointsFilter;
vtkFloatingPointType myPercents;
};
+++ /dev/null
-// VISU OBJECT : 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: VISU_StreamLinesPL.cxx
-// Author: Alexey PETROV
-// Module : VISU
-
-
-#include "VISU_UsedPointsFilter.hxx"
-
-#include "VISU_ConvertorUtils.hxx"
-
-#include <vtkObjectFactory.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkPoints.h>
-#include <vtkIdList.h>
-
-#include <vtkInformation.h>
-#include <vtkInformationVector.h>
-
-
-//----------------------------------------------------------------------------
-vtkStandardNewMacro(VISU_UsedPointsFilter);
-
-
-//----------------------------------------------------------------------------
-VISU_UsedPointsFilter::VISU_UsedPointsFilter()
-{
- PercentsOfUsedPoints = 1.0;
-}
-
-//----------------------------------------------------------------------------
-VISU_UsedPointsFilter::~VISU_UsedPointsFilter()
-{}
-
-
-//----------------------------------------------------------------------------
-int VISU_UsedPointsFilter::RequestData (vtkInformation *vtkNotUsed(request),
- vtkInformationVector **inputVector,
- vtkInformationVector *outputVector)
-{
- // get the info objects
- vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
- vtkInformation *outInfo = outputVector->GetInformationObject(0);
-
- // get the input and ouptut
- vtkDataSet *input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
- vtkPointSet *output = vtkPointSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
-
- //////////
- output->GetPointData()->CopyAllOff();
- output->GetCellData()->CopyAllOff();
- output->CopyStructure(input);
-
- vtkPoints* aPoints = vtkPoints::New();
- vtkIdList *anIdList = vtkIdList::New();
- vtkIdType iEnd = input->GetNumberOfPoints();
- for (vtkIdType i = 0; i < iEnd; i++) {
- input->GetPointCells(i, anIdList);
- if (anIdList->GetNumberOfIds() > 0)
- aPoints->InsertNextPoint(input->GetPoint(i));
- }
- vtkPoints* aNewPoints = vtkPoints::New();
- iEnd = aPoints->GetNumberOfPoints();
- if (PercentsOfUsedPoints > 0) {
- vtkIdType anOffset = vtkIdType(1.0/PercentsOfUsedPoints);
- if (anOffset < 1) anOffset = 1;
- for (vtkIdType i = 0; i < iEnd; i += anOffset)
- aNewPoints->InsertNextPoint(aPoints->GetPoint(i));
- }
- output->SetPoints(aNewPoints);
- aNewPoints->Delete();
- aPoints->Delete();
-
- return 1;
-}
+++ /dev/null
-// VISU OBJECT : 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: VISU_UsedPointsFilter.hxx
-// Author: Alexey PETROV
-// Module : VISU
-
-#ifndef VISU_UsedPointsFilter_HeaderFile
-#define VISU_UsedPointsFilter_HeaderFile
-
-#include <vtkPointSetAlgorithm.h>
-
-
-//----------------------------------------------------------------------------
-class VISU_UsedPointsFilter : public vtkPointSetAlgorithm
-{
-public:
- vtkTypeMacro(VISU_UsedPointsFilter, vtkPointSetAlgorithm);
-
- static
- VISU_UsedPointsFilter*
- New();
-
- vtkSetMacro(PercentsOfUsedPoints,float);
- vtkGetMacro(PercentsOfUsedPoints,float);
-
-protected:
- VISU_UsedPointsFilter();
- VISU_UsedPointsFilter(const VISU_UsedPointsFilter&);
-
- virtual
- ~VISU_UsedPointsFilter();
-
- int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
-
- float PercentsOfUsedPoints;
-};
-
-#endif
#include "VISU_VectorsPL.hxx"
#include "VISU_FieldTransform.hxx"
#include "VISU_PipeLineUtils.hxx"
+#include "VISU_UsedPointsFilter.hxx"
#include "VTKViewer_TransformFilter.h"
#include "VTKViewer_Transform.h"
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_VectorsPL);
-
//----------------------------------------------------------------------------
+template<class TOutputFilter>
+void ToCellCenters(TOutputFilter *theOutputFilter,
+ vtkCellCenters *theCellCenters,
+ vtkDataSet* theDataSet,
+ VISU_UsedPointsFilter* theUsedPointsFilter)
+{
+ if(VISU::IsDataOnCells(theDataSet)){
+ theCellCenters->SetInput(theDataSet);
+ theCellCenters->VertexCellsOn();
+ theOutputFilter->SetInput(theCellCenters->GetOutput());
+ }else {
+ theUsedPointsFilter->SetInput(theDataSet);
+ theOutputFilter->SetInput(theUsedPointsFilter->GetOutput());
+ }
+}
+
+
VISU_VectorsPL
::VISU_VectorsPL()
{
myCenters = vtkCellCenters::New();
myTransformFilter = VTKViewer_TransformFilter::New();
+
+ myUsedPointsFilter = VISU_UsedPointsFilter::New();
}
myLineSource->Delete();
myTransformFilter->Delete();
+
+ myUsedPointsFilter->Delete();
}
::Build()
{
Superclass::Build();
-
- VISU::ToCellCenters(myBaseGlyph,
- myCenters,
- GetMergedInput());
+
+ ToCellCenters(myBaseGlyph,
+ myCenters,
+ GetMergedInput(),
+ myUsedPointsFilter);
myBaseGlyph->SetVectorModeToUseVector();
myBaseGlyph->SetScaleModeToScaleByVector();
myBaseGlyph->SetColorModeToColorByScalar();
- VISU::ToCellCenters(myTransformFilter,
- myCenters,
- GetMergedInput());
+ ToCellCenters(myTransformFilter,
+ myCenters,
+ GetMergedInput(),
+ myUsedPointsFilter);
myTransformedGlyph->SetInput(myTransformFilter->GetOutput());
myTransformedGlyph->SetVectorModeToUseVector();
myTransformedGlyph->SetScaleModeToScaleByVector();
class vtkGlyph3D;
+class VISU_UsedPointsFilter;
//----------------------------------------------------------------------------
class VISU_PIPELINE_EXPORT VISU_VectorsPL : public VISU_DeformedShapePL
vtkCellCenters* myCenters;
VTKViewer_TransformFilter *myTransformFilter;
+
+ VISU_UsedPointsFilter* myUsedPointsFilter;
};
msgid "INF_DONE"
msgstr " done"
+msgid "INF_FAILED"
+msgstr " failed!"
+
msgid "WRN_STUDY_LOCKED"
msgstr "Current Study is locked"
msgid "VisuGUI::MEN_IMPORT_MED_FIELD"
msgstr "Import Field"
+msgid "VisuGUI::MEN_LOAD_COMPONENT_DATA"
+msgstr "Load Component Data"
+
msgid "VisuGUI::MEN_DELETE_OBJS"
msgstr "Delete"
// The same in SUPERVISION: NPAL14522
{
SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
- //std::string aCompIOR;
CORBA::String_var aCompIOR;
if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
CORBA::String_var aCompDataType = aSComp->ComponentDataType();
- //std::string aCompDataType = aSComp->ComponentDataType();
// obtain a driver by a component data type
// like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
try {
CORBA::Object_var
- //anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType.c_str());
anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
if (CORBA::is_nil(anEngineObj))
- //anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType.c_str());
anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
if (!CORBA::is_nil(anEngineObj))
if (!CORBA::is_nil(anEngine)) {
// try to load
SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
- //aStudyBuilder->LoadWith(aSComp, aDriverIOR.in());
aStudyBuilder->LoadWith(aSComp, anEngine);
}
}
QApplication::restoreOverrideCursor();
}
+void VisuGUI::OnLoadComponentData()
+{
+ _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
+ if (CheckLock(aCStudy,GetDesktop(this)))
+ return;
+ SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
+
+ LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
+ SALOME_ListIO aListIO;
+ aSelectionMgr->selectedObjects(aListIO);
+
+ SALOME_ListIteratorOfListIO It (aListIO);
+ QApplication::setOverrideCursor(Qt::waitCursor);
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = It.Value();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (!aSObject->_is_nil()) {
+
+ // try to load a component data from an opened (presumably) study
+ // The same in SUPERVISION: NPAL14522
+ {
+ SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
+ CORBA::String_var aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ CORBA::String_var aCompDataType = aSComp->ComponentDataType();
+
+ QString anInfo ("Loading ");
+ anInfo = anInfo + aCompDataType.in() + " Component Data ...";
+ application()->putInfo( anInfo );
+
+ // obtain a driver by a component data type
+ // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
+ SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
+ SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
+ try {
+ CORBA::Object_var
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
+ if (CORBA::is_nil(anEngineObj))
+ anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
+
+ if (!CORBA::is_nil(anEngineObj))
+ anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
+
+ if (!CORBA::is_nil(anEngine)) {
+ // try to load
+ SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
+ aStudyBuilder->LoadWith(aSComp, anEngine);
+ }
+
+ application()->putInfo( anInfo + tr("INF_DONE"));
+ }
+ catch (...) {
+ application()->putInfo( anInfo + tr("INF_FAILED"));
+ }
+ }
+ }
+ }
+ }
+ QApplication::restoreOverrideCursor();
+}
+
void
CreateCurves( SalomeApp_Module* theModule,
VISU::CutLines_i* thePrs,
tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
this, SLOT(OnImportMedField()));
+ createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIconSet(),
+ tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
+ this, SLOT(OnLoadComponentData()));
+
createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIconSet(),
tr("MEN_CREATE_PRS"), "", 0, aParent, false,
this, SLOT(OnCreateMesh()));
if (aListIO.Extent() != 1)
return;
+ // Check if the object's data is loaded
+ _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
+ std::string aCompIOR;
+ if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
+ //std::string aCompDataType = aSComp->ComponentDataType();
+ action( VISU_LOAD_COMPONENT_DATA )->addTo(theMenu); // "Load Component Data"
+ }
+
VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
if (aType == VISU::TANIMATION) {
action( VISU_SHOW_ANIMATION )->addTo(theMenu);
if (!CORBA::is_nil(anObject)) {
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
if (!CORBA::is_nil(aMED.in())) {
- action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu);
+ action( VISU_IMPORT_MED_STRUCTURE )->addTo(theMenu); // "Import Structure"
}
- SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject); // "Import Structure"
+ SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
if (!CORBA::is_nil(aField)) {
action( VISU_IMPORT_MED_TIMESTAMP )->addTo(theMenu); // "Import TimeStamp"
}
} else {
- _PTR(SObject) aSFather = aSObject->GetFather();
- if (aSFather) {
- _PTR(GenericAttribute) anAttr;
- aSFather->FindAttribute(anAttr, "AttributeName");
- if (anAttr) {
- _PTR(AttributeName) aName (anAttr);
- std::string aValue = aName->Value();
- if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
- action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
- }
+ _PTR(SObject) aSFather1 = aSObject->GetFather();
+ if (aSFather1) {
+ std::string aValue = aSFather1->GetName();
+ if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
+ action( VISU_IMPORT_MED_FIELD )->addTo(theMenu); // "Import Field"
}
}
}
void OnExportTableToFile();
void OnImportMedField();
+ void OnLoadComponentData();
+
void OnCreateMesh();
void OnCreateScalarMap();
void OnCreateDeformedShape();
#define VISU_IMPORT_MED_STRUCTURE 4004
#define VISU_IMPORT_MED_TIMESTAMP 4005
#define VISU_IMPORT_MED_FIELD 4006
+#define VISU_LOAD_COMPONENT_DATA 4007
#define VISU_SCALAR_MAP 4011
#define VISU_DEFORMED_SHAPE 4012
Execute()
{
myPrs3dServant = NULL;
- vtkDataSet* aSource = NULL;
+ vtkPointSet* aSource = NULL;
if (!CORBA::is_nil(myPrs3d)){
myPrs3dServant = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(myPrs3d).in());
if(myPrs3dServant){