]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
OK now
authorDUC ANH HOANG <dh77501n@dsp1043837>
Tue, 18 Jun 2024 15:26:58 +0000 (17:26 +0200)
committerDUC ANH HOANG <dh77501n@dsp1043837>
Tue, 18 Jun 2024 15:26:58 +0000 (17:26 +0200)
src/SPV3D/SPV3D_CADSelection.cxx
src/SPV3D/SPV3D_Prs.cxx
src/SPV3D/SPV3D_Prs.h
src/SPV3D/SPV3D_ViewModel.cxx
src/SPV3D/SPV3D_ViewModel.h
src/SPV3D/SPV3D_ViewWindow.cxx
src/SPV3D/SPV3D_ViewWindow.h

index 3cf88341764c9fd97c2243aa79d6696d940c6b85..5849227de4239123c45cd72c56ce24fa23cf430f 100644 (file)
@@ -300,10 +300,10 @@ void SPV3D_CADSelection::onMouseMove()
   // Force to update the information property
   proxyRepresentation->UpdatePropertyInformation(selectedIDProperty);
 
-  vtkIdType PreSelectedID =
-    vtkSMPropertyHelper(proxyRepresentation,"PreSelectedID").GetAsInt(0);
+  //vtkIdType PreSelectedID =
+  //  vtkSMPropertyHelper(proxyRepresentation,"PreSelectedID").GetAsInt(0);
   
-  std::cout << "PreSelectedID: "<< PreSelectedID<< std::endl;
+  //std::cout << "PreSelectedID: "<< PreSelectedID<< std::endl;
   //
 }
 
index 90d8a1b2a3dc5bd44d0599152e59cfbcad3ded1c..d6fd8c6febbad8b8d1c4ac5fa991d4c14947b3c6 100644 (file)
 vtkIdType SPV3D_Prs::cellid = 0;
 vtkIdType SPV3D_Prs::nbsolid = 0;
 //std::map<vtkIdType, const char*> SPV3D_Prs::vtkIdToEntry;
-vtkSmartPointer<vtkMultiBlockDataSet> SPV3D_Prs::multiGEOMData = vtkSmartPointer<vtkMultiBlockDataSet>::New();
+//vtkSmartPointer<vtkMultiBlockDataSet> SPV3D_Prs::multiGEOMData = vtkSmartPointer<vtkMultiBlockDataSet>::New();
 
 SPV3D_EXPORTSPV3DData::SPV3D_EXPORTSPV3DData()
 {
   nbsolid = 0;
   _multiGEOMData = vtkSmartPointer<vtkMultiBlockDataSet>::New();
+  std::cout << "DDDDDDDDDDDDDDDDDDDDDD" << std::endl;
   pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
+  std::cout << "AAAAAAAAAAAAAAAAAAAAAa" << std::endl;
   pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+  std::cout << "BBBBBBBBBBBBBBBBBBBBBB" << std::endl;
   _sourceProducer = builder->createSource("sources","PVTrivialProducer",serv);
-  _repr = builder->createDataRepresentation(_sourceProducer->getOutputPort(0),getView(),"CADRepresentation");
-  vtkSMViewProxy::RepresentationVisibilityChanged(_repr->getViewProxy(), _repr->getProxy(), true);
+  std::cout << "CCCCCCCCCCCCCCCCCCCCC" << std::endl;
 }
 void SPV3D_EXPORTSPV3DData::SetPolyData(vtkPolyData* ds)
 {
@@ -59,7 +61,7 @@ void SPV3D_EXPORTSPV3DData::SetPolyData(vtkPolyData* ds)
   nbsolid++;
 }
 
-void SPV3D_EXPORTSPV3DData::SetPrs(vtkPolyData* ds; const char* entry)
+void SPV3D_EXPORTSPV3DData::SetPrs(vtkPolyData* ds, const char* entry)
 {
   unsigned int id;
   if (havePrs(entry, id))
@@ -78,7 +80,7 @@ void SPV3D_EXPORTSPV3DData::SetPrs(vtkPolyData* ds; const char* entry)
 //  cellIdArray->SetName("Edge id");
 
   vtkIdType *pt( solidIdArray->GetPointer(0) );
-  vtkIdType solidid = SPV3D_Prs::FromEntryToVtkId(GetEntry());
+  vtkIdType solidid = SPV3D_Prs::FromEntryToVtkId(entry);
   std::cout <<"Presolidid_from_src: " <<solidid << std::endl;
   std::for_each(pt,pt+nbCells,[solidid](vtkIdType& elt) { elt = solidid;});
 // pt = cellIdArray->GetPointer(0);
@@ -87,6 +89,7 @@ void SPV3D_EXPORTSPV3DData::SetPrs(vtkPolyData* ds; const char* entry)
   ds->GetCellData()->AddArray( solidIdArray );
 // ->GetCellData()->AddArray( cellIdArray );
   SetPolyData(ds);
+  updateSource_for_display();
 }
 
 void SPV3D_EXPORTSPV3DData::RemovePrs(const char* entry)
@@ -95,23 +98,25 @@ void SPV3D_EXPORTSPV3DData::RemovePrs(const char* entry)
   if (!havePrs(entry, id))
   {
     std::cout << "Can not find solid " << entry<< std::endl;
-  }
     return;
+  }
   _multiGEOMData->RemoveBlock(id);
-  Hide_list.erase(SPV3D_Prs::FromEntryToVtkId(entry));
+  updateSource_for_display();
+  //Hide_list.erase(SPV3D_Prs::FromEntryToVtkId(entry));
 }
 
-void SPV3D_EXPORTSPV3DData::updateSource_for_display() const
+void SPV3D_EXPORTSPV3DData::updateSource_for_display()
 {
   vtkNew<vtkAppendPolyData> appendFilter;
-  std::cout <<"number of block: " << _multiGEOMData->GetNumberOfBlocks()<<std::endl;
-  for (unsigned int i = 0; i < _multiGEOMData->GetNumberOfBlocks(); ++i)
+  nbsolid = _multiGEOMData->GetNumberOfBlocks();
+  std::cout <<"number of block: " << nbsolid<<std::endl;
+  for (unsigned int i = 0; i < nbsolid; ++i)
   {
       vtkPolyData* polyData = vtkPolyData::SafeDownCast(_multiGEOMData->GetBlock(i));
       if (polyData)
       {
         vtkIdTypeArray* retrievedArray = vtkIdTypeArray::SafeDownCast(polyData->GetCellData()->GetArray("Solid id"));
-        if (retrievedArray && !Hide_list.find(retrievedArray->GetValue(0)))
+        if (retrievedArray && Hide_list.find(retrievedArray->GetValue(0)) == Hide_list.end())
           appendFilter->AddInputData(polyData);
       }
   }
@@ -125,9 +130,11 @@ void SPV3D_EXPORTSPV3DData::updateSource_for_display() const
   vtkPVTrivialProducer *clientSideObjectCast = vtkPVTrivialProducer::SafeDownCast(clientSideObject);
   clientSideObjectCast->SetOutput(ds);
   _sourceProducer->updatePipeline();
-  pqProxy *producerBase2( getPQProxy(producerBase) );
-  if(producerBase2 && !_name.empty())
-    producerBase2->rename( _name.c_str() );
+
+  //pqServerManagerModel* smmodel = pqApplicationCore::instance()->getServerManagerModel();
+  //pqProxy *producerBase2( smmodel->findItem<pqProxy*>(producerBase) );
+  //if(producerBase2 && !_name.empty())
+  //  producerBase2->rename( _name.c_str() );
 }
 
 bool SPV3D_EXPORTSPV3DData::IsVisible() const
@@ -139,9 +146,9 @@ bool SPV3D_EXPORTSPV3DData::IsVisible() const
 
 bool SPV3D_EXPORTSPV3DData::SolidIsVisible(vtkIdType solid_id) const
 {
-  if( Hide_list.find(solid_id) )
+  if( Hide_list.find(solid_id) != Hide_list.end() )
     return false;
-  return true
+  return true;
 }
 
 bool SPV3D_EXPORTSPV3DData::havePrs(const char* entry, unsigned int & id)
@@ -168,9 +175,13 @@ bool SPV3D_EXPORTSPV3DData::havePrs(const char* entry, unsigned int & id)
 
 void SPV3D_EXPORTSPV3DData::HideSolid(vtkIdType solid_id)
 {
-  auto ret = Hide_list.emplace(solid_id);
-  if (!ret.second)
-    std::cout << SPV3D_Prs::FromVtkIdToEntry(solid_id) << " already exists in Hide_list\n" << std::endl;
+  //auto ret = Hide_list.emplace(solid_id);
+  //if (!ret.second)
+  //  std::cout << SPV3D_Prs::FromVtkIdToEntry(solid_id) << " already exists in Hide_list\n" << std::endl;
+  const char* entry = SPV3D_Prs::FromVtkIdToEntry(solid_id);
+  std::cout << "entry from vtkidtoentry: "<< entry << std::endl;
+  RemovePrs(entry);
+  updateSource_for_display();
 }
 
 void SPV3D_EXPORTSPV3DData::DisplaySolid(vtkIdType solid_id)
@@ -183,6 +194,7 @@ void SPV3D_EXPORTSPV3DData::DisplaySolid(vtkIdType solid_id)
   {
     std::cout << SPV3D_Prs::FromVtkIdToEntry(solid_id) << " is not in Hide_list\n" << std::endl;
   }
+  updateSource_for_display();
 }
 
 void SPV3D_EXPORTSPV3DData::Hide() const
@@ -220,9 +232,9 @@ vtkIdType SPV3D_Prs::FromEntryToVtkId (const char* entry)
 const char* SPV3D_Prs::FromVtkIdToEntry(vtkIdType id)
 {
   int d = id & 0xFF;
-  std::uint32_t c_work = ( val & 0xFF00 ); int c = c_work >> 8;
-  std::uint32_t b_work = ( val & 0xFF0000 ); int b = b_work >> 16;
-  std::uint32_t a_work = ( val & 0xFF000000 ); int a = a_work >> 24;
+  std::uint32_t c_work = ( id & 0xFF00 ); int c = c_work >> 8;
+  std::uint32_t b_work = ( id & 0xFF0000 ); int b = b_work >> 16;
+  std::uint32_t a_work = ( id & 0xFF000000 ); int a = a_work >> 24;
   std::string ret = std::to_string(a) + ":" + std::to_string(b) + ":" + std::to_string(c)+ ":" + std::to_string(d);
   return ret.c_str();
 }
@@ -239,85 +251,6 @@ pqProxy *getPQProxy(vtkSMProxy *proxy)
   return smmodel->findItem<pqProxy*>(proxy);
 }
 
-void SPV3D_Prs::FillUsingActor_init(vtkActor *actor) const
-{
-  std::cout << "Hello FillUsingActor"<<std::endl;
-
-  SPV3D_EXPORTSPV3DData *alreadyExistingSrc = nullptr;
-  alreadyExistingSrc = _view->isEntryAlreadyExist( GetEntry() );
-
-  if(alreadyExistingSrc && !alreadyExistingSrc->GetSourceProducer())
-  {
-    actor->GetMapper()->Update();
-    vtkDataObject *ds = actor->GetMapper()->GetInput();
-    vtkPolyData *ds3 = vtkPolyData::SafeDownCast(ds);
-    vtkNew<vtkPolyData> ds4;
-    if(ds3)
-    {
-      ds4->ShallowCopy( ds3 );
-      auto nbCells( ds4->GetNumberOfCells() );
-
-      vtkNew<vtkIdTypeArray> solidIdArray;
-      std::cout << "nb of cells: " <<nbCells <<std::endl;
-      solidIdArray->SetNumberOfComponents(1);
-      solidIdArray->SetNumberOfTuples( nbCells );
-      solidIdArray->SetName("Solid id");
-
-    //  vtkNew<vtkIdTypeArray> cellIdArray;
-    //  cellIdArray->SetNumberOfComponents(1);
-    //  cellIdArray->SetNumberOfTuples( nbCells );
-    //  cellIdArray->SetName("Edge id");
-
-      vtkIdType *pt( solidIdArray->GetPointer(0) );
-      vtkIdType solidid = SPV3D_Prs::FromEntryToVtkId(GetEntry());
-      SPV3D_Prs::vtkIdToEntry[solidid] = GetEntry();
-      std::cout <<"Presolidid_from_src: " <<solidid << std::endl;
-      std::for_each(pt,pt+nbCells,[solidid](vtkIdType& elt) { elt = solidid;});
-     // pt = cellIdArray->GetPointer(0);
-     // std::for_each(pt,pt+nbCells,[](vtkIdType& elt) { elt = SPV3D_Prs::cellid;SPV3D_Prs::cellid++; });
-
-      ds4->GetCellData()->AddArray( solidIdArray );
-     // ds4->GetCellData()->AddArray( cellIdArray );
-      ////Add dataset to multiblock
-//
-      SPV3D_Prs::multiGEOMData->SetBlock(SPV3D_Prs::nbsolid , ds4);
-      SPV3D_Prs::nbsolid ++;
-//
-    }
-    vtkNew<vtkAppendPolyData> appendFilter;
-    std::cout <<"number of block: " << SPV3D_Prs::multiGEOMData->GetNumberOfBlocks()<<std::endl;
-    for (unsigned int i = 0; i < SPV3D_Prs::multiGEOMData->GetNumberOfBlocks(); ++i)
-    {
-        vtkPolyData* polyData = vtkPolyData::SafeDownCast(SPV3D_Prs::multiGEOMData->GetBlock(i));
-        if (polyData)
-        {
-          appendFilter->AddInputData(polyData);
-        }
-    }
-    appendFilter->Update();
-    vtkNew<vtkPolyData> ds5;
-    ds5->ShallowCopy(appendFilter->GetOutput());
-
-    pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
-    pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
-    pqPipelineSource *mySourceProducer(builder->createSource("sources","PVTrivialProducer",serv));
-    vtkSMProxy* producerBase = mySourceProducer->getProxy();
-    vtkSMSourceProxy *producer(vtkSMSourceProxy::SafeDownCast(producerBase));
-    vtkObjectBase *clientSideObject(producer->GetClientSideObject());
-    vtkPVTrivialProducer *clientSideObjectCast = vtkPVTrivialProducer::SafeDownCast(clientSideObject);
-    clientSideObjectCast->SetOutput(ds5);
-    mySourceProducer->updatePipeline();
-    pqProxy *producerBase2( getPQProxy(producerBase) );
-    if(producerBase2 && !_name.empty())
-      producerBase2->rename( _name.c_str() );
-    this->SetSourceProducer( mySourceProducer );
-  }
-  else
-  {
-    this->CopyInfo( alreadyExistingSrc );
-  }
-}
-
 SPV3D_Prs:: ~SPV3D_Prs() 
 {
 }
@@ -350,16 +283,25 @@ bool SPV3D_Prs::IsNull() const
 void SPV3D_Prs::FillUsingActor(vtkActor *actor) const
 {
   std::cout << "Hello FillUsingActor"<<std::endl;
-
+  std::cout << "entry: " <<GetEntry()<< std::endl;
   //SPV3D_EXPORTSPV3DData *alreadyExistingSrc = nullptr;
-  alreadyExisting = _view->isEntryAlreadyExist( GetEntry() );
+  int id = _view->isEntryAlreadyExist( GetEntry() );
 
-  if(alreadyExisting) // hide but it exist in SPV3D_EXPORTSPV3DData
+  if(id == -1) // not exist
   {
-
+    std::cout << "FillUsingActor111111111111111"<<std::endl;
+    actor->GetMapper()->Update();
+    vtkDataObject *ds = actor->GetMapper()->GetInput();
+    vtkPolyData *ds2 = vtkPolyData::SafeDownCast(ds);
+    if(ds2)
+    {
+      std::cout << "FillUsingActor2222222222222222éé"<<std::endl;
+      _view->ExportToSPV3D(ds2, GetEntry());
+    }
   }
-  else
+  else //exist but hide
   {
-    this->CopyInfo( alreadyExistingSrc );
+    std::cout << "FillUsingActor33333333333333é"<<std::endl;
+    _view->DisplayObj_withEntry( GetEntry() );
   }
 }
\ No newline at end of file
index 8c5cecd288bc951b5b98280ac25cbdacb8a3e6d3..a320387d84c3eb3a62385c915f83ec7f8da4e6ee 100644 (file)
@@ -26,6 +26,8 @@
 #include "vtkCellData.h"
 #include <vtkMultiBlockDataSet.h>
 #include <vtkSmartPointer.h>
+
+#include <set>
 class vtkActor;
 class pqPipelineSource;
 class pqDataRepresentation;
@@ -99,7 +101,7 @@ private:
   SPV3D_Prs(const SPV3D_Prs& other) = default;
 
 public:
-  void hide() const { if(_pvRendInfo) return _pvRendInfo->Hide(); }
+  void hide() const { if(_pvRendInfo) return _pvRendInfo->RemovePrs(GetEntry()); }
   bool isVisible() const { if(_pvRendInfo) return _pvRendInfo->IsVisible(); return false; }
 
 private:
@@ -111,6 +113,6 @@ private:
   static vtkIdType cellid;
   static vtkIdType nbsolid;
   //static std::map<vtkIdType,const char*> vtkIdToEntry;
-  static vtkSmartPointer<vtkMultiBlockDataSet> multiGEOMData;
+  //static vtkSmartPointer<vtkMultiBlockDataSet> multiGEOMData;
 
 };
index cace97b7aa56fa5dfab1e7a4deb544bf82573272..d00ea859a05a051aacf89ca55095905c247661e0 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "SPV3D_ViewModel.h"
 #include "SPV3D_ViewWindow.h"
-#include "SPV3D_Prs.h"
 #include "PVViewer_Core.h"
 
 #include <pqActiveObjects.h>
@@ -196,12 +195,48 @@ pqView *SPV3D_ViewModel::getView() const
   return _view;
 }
 
+void SPV3D_ViewModel::updatePVPrsPipeline(const SPV3D_Prs* aPrs)
+{
+  if (aPrs->GetRepresentation())
+  {
+    aPrs->GetRepresentation()->setVisible(0);
+    delete(aPrs->GetRepresentation());
+  }
+  pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+  pqActiveObjects::instance().setActiveView(getView());
+  pqPipelineSource *mySourceProducer = aPrs->GetSourceProducer();
+  aPrs->SetSourceProducer( mySourceProducer );
+  pqDataRepresentation* myRepr(builder->createDataRepresentation(mySourceProducer->getOutputPort(0),getView(),"CADRepresentation"));//"GeometryRepresentation"
+  vtkSMViewProxy::RepresentationVisibilityChanged(myRepr->getViewProxy(), myRepr->getProxy(), true);
+  aPrs->SetRepresentation(myRepr);
+  myRepr->setVisible(1);
+  vtkSMPVRepresentationProxy* proxy(dynamic_cast<vtkSMPVRepresentationProxy*>(myRepr->getProxy()));
+  if(proxy)
+  {
+    vtkSMPropertyHelper inputHelper(proxy, "Input");
+    vtkSMSourceProxy* input = vtkSMSourceProxy::SafeDownCast(inputHelper.GetAsProxy());
+    input->UpdatePipeline();
+  }
+}
 /*!
   Display presentation
   \param prs - presentation
 */
 void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs )
 {
+  std::cout << "SPV3D_ViewModel::Display" << std::endl;
+  if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs ))
+  {
+    updatePVPrsPipeline(aPrs);
+    getView()->resetDisplay();
+    getView()->render();
+  }
+  else
+  {
+    std::cout<< "Can't update PV presentation pipeline"<< std::endl;
+  }
+  /*
+  
   if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs ))
   {
     if( !aPrs->GetRepresentation() )
@@ -212,9 +247,11 @@ void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs )
       aPrs->SetSourceProducer( mySourceProducer );
       pqDataRepresentation* myRepr(builder->createDataRepresentation(mySourceProducer->getOutputPort(0),getView(),"CADRepresentation"));//"GeometryRepresentation"
       vtkSMViewProxy::RepresentationVisibilityChanged(myRepr->getViewProxy(), myRepr->getProxy(), true);
+
       aPrs->SetRepresentation(myRepr);
     }
     pqDataRepresentation* myRepr = aPrs->GetRepresentation();
+
     myRepr->setVisible(1);
     vtkSMPVRepresentationProxy* proxy(dynamic_cast<vtkSMPVRepresentationProxy*>(myRepr->getProxy()));
     if(proxy)
@@ -226,6 +263,7 @@ void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs )
     getView()->resetDisplay();
     getView()->render();
   }
+  */
 }
 
 /*!
@@ -236,11 +274,15 @@ void SPV3D_ViewModel::Display( const SALOME_PV3DPrs* prs )
 void SPV3D_ViewModel::Erase( const SALOME_PV3DPrs* prs, const bool /*forced*/ )
 {
   // NYI - hide a source
-  std::cout << "SPV3D_ViewModel::Erase"<< std::endl;
   if(const SPV3D_Prs* aPrs = dynamic_cast<const SPV3D_Prs*>( prs )){
     if(aPrs->IsNull())
       return;
-    aPrs->GetRepresentation()->setVisible(0);
+    aPrs->hide();
+    updatePVPrsPipeline(aPrs);
+    ////aPrs->GetRepresentation()->setVisible(0);
+    ////aPrs->GetRepresentation()->setVisible(1);
+    ////
+    getView()->resetDisplay();
     getView()->render();
     //pqObjectBuilder* builder = pqApplicationCore::instance()->getObjectBuilder();
     //pqServer* activeServer = pqActiveObjects::instance().activeServer();
index dc982345e58fa6c12c6b44ab6b2cb534b645f5d8..3daf72d7ee320a4ee23b66f2a8e53ceccdb69ce4 100644 (file)
@@ -26,6 +26,9 @@
 #include <SALOME_InteractiveObject.hxx>
 #include <SALOME_ListIO.hxx>
 
+#include "SPV3D_Prs.h"
+
+
 class QMouseEvent;
 class pqPipelineSource;
 class pqView;
@@ -62,7 +65,7 @@ public:
 public:
   void enableSelection(bool isEnabled);
   bool isSelectionEnabled() const { return mySelectionEnabled; }
-
+  void updatePVPrsPipeline( const SPV3D_Prs* aPrs);
   /* Reimplemented from SALOME_View */
 
   //! See #SALOME_View::Display( const SALOME_Prs* )
index 191044a43eac4d025302ad37cbf118fc790e8f55..7f4f302439d95ddd6c7c27d63689293086f39420 100644 (file)
@@ -64,8 +64,7 @@
 */
 SPV3D_ViewWindow::SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* theModel):
   PV3DViewer_ViewWindow(theDesktop, theModel),
-  myModel(theModel),
-  myPrs( new SPV3D_EXPORTSPV3DData())
+  myModel(theModel)
 {
 }
 
@@ -115,6 +114,9 @@ void SPV3D_ViewWindow::init()
   QAction *selectionAction =  toolMgr()->toolBar(myToolBar)->addAction(SUIT_Session::session()->resourceMgr()->loadPixmap( "VTKViewer", tr( "ICON_SVTK_PRESELECTION_STANDARD" ) ), tr( "MNU_SVTK_PRESELECTION_STANDARD" ) );
   selectionAction->setCheckable(true);
   QObject::connect(selectionAction, &QAction::toggled, this, &SPV3D_ViewWindow::goSelect);
+  
+  SPV3D_EXPORTSPV3DData* rawPtr = new SPV3D_EXPORTSPV3DData();
+  myPrs.reset(rawPtr);
 }
 
 void SPV3D_ViewWindow::goSelect(bool val)
@@ -232,26 +234,15 @@ void SPV3D_ViewWindow::showCenterAxes(bool show_axes)
   renderView->render();
 }
 
+
 SPV3D_Prs *SPV3D_ViewWindow::findOrCreatePrs( const char* entry )
 {//en cours
-  std::string entryCpp( entry );
   SPV3D_Prs *prsOut( new SPV3D_Prs( entry, this ) );
-  for(auto& prs : myPrs)
-  {
-    if(entryCpp == prs.first)
-    {
-      prsOut->SetPVRenderInfo( prs.second.get() );
-      return prsOut;
-    }
-  }
-  std::unique_ptr<SPV3D_EXPORTSPV3DData> data(new SPV3D_EXPORTSPV3DData);
-  prsOut->SetPVRenderInfo( data.get() );
-  std::pair<std::string, std::unique_ptr<SPV3D_EXPORTSPV3DData> > p(entryCpp,std::move(data));
-  myPrs.emplace_back( std::move(p) );
+  prsOut->SetPVRenderInfo( myPrs.get() );
   return prsOut;
 }
 
-SPV3D_EXPORTSPV3DData *SPV3D_ViewWindow::isEntryAlreadyExist( const char* entry ) const
+unsigned int SPV3D_ViewWindow::isEntryAlreadyExist( const char* entry ) const
 {
   //std::string entryCpp( entry );
   //for(const auto& prs : myPrs)
@@ -262,13 +253,14 @@ SPV3D_EXPORTSPV3DData *SPV3D_ViewWindow::isEntryAlreadyExist( const char* entry
   //return nullptr;
   unsigned int id;
   if(myPrs->havePrs(entry, id))
-  {
-
-  }
+    return id;
   else
-  {
-    return nullptr;
-  }
+    return -1;
+}
+
+void SPV3D_ViewWindow::ExportToSPV3D(vtkPolyData* ds, const char* entry)
+{
+  myPrs->SetPrs(ds, entry);
 }
 
 /*!
@@ -280,11 +272,16 @@ SPV3D_ViewWindow::~SPV3D_ViewWindow()
 
 bool SPV3D_ViewWindow::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
 {
-  std::string entryCpp( theIObject->getEntry() );
-  for(auto& prs : myPrs)
+  auto entry =  theIObject->getEntry();
+  //for(auto& prs : myPrs)
+  //{
+  //  if(entryCpp == prs.first )
+  //    return prs.second->IsVisible();
+  //}
+  unsigned int id;
+  if (myPrs->havePrs(entry, id))
   {
-    if(entryCpp == prs.first )
-      return prs.second->IsVisible();
+    return myPrs->SolidIsVisible(SPV3D_Prs::FromEntryToVtkId(entry));
   }
   return false;
 }
@@ -334,7 +331,7 @@ void SPV3D_ViewWindow::EraseAll()
   //{
   //  prs.second->Hide();
   //}
-  myPrs->Hide()
+  myPrs->Hide();
   if(myModel)
     myModel->render();
 }
@@ -419,3 +416,13 @@ void SPV3D_ViewWindow::hideEvent( QHideEvent * theEvent )
 {
   emit Hide( theEvent );
 }
+
+void SPV3D_ViewWindow::DisplayObj_withEntry(const char* entry)
+{
+  myPrs->DisplaySolid(SPV3D_Prs::FromEntryToVtkId(entry));
+}
+
+void SPV3D_ViewWindow::HideObj_withEntry(const char* entry)
+{
+  myPrs->HideSolid(SPV3D_Prs::FromEntryToVtkId(entry));
+}
\ No newline at end of file
index 13434b9c88bfce004c613eb18ee4568b93ba571e..a0d20b514e6dc39d263a68f95da8290aeccad7b9 100644 (file)
@@ -48,7 +48,9 @@ class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow
 
   SPV3D_Prs *findOrCreatePrs( const char* entry );
 
-  SPV3D_EXPORTSPV3DData *isEntryAlreadyExist( const char* entry ) const;
+  unsigned int isEntryAlreadyExist( const char* entry ) const;
+
+  void ExportToSPV3D(vtkPolyData* ds, const char*);
 
   void init();
 
@@ -58,6 +60,8 @@ class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow
 
   /* display */         
   //----------------------------------------------------------------------------
+  void DisplayObj_withEntry(const char* entry);
+  void HideObj_withEntry(const char* entry);
   //! Redirect the request to #SPV3D_View::Display (to support old code)
   virtual void Display(const Handle(SALOME_InteractiveObject)& theIObject,
                        bool theImmediatly = true);
@@ -105,6 +109,7 @@ protected:
   int myToolBar = -1;
   SPV3D_ViewModel* myModel;
   //std::list< std::pair<std::string, std::unique_ptr<SPV3D_EXPORTSPV3DData> > > myPrs;
+  std::list< std::pair<std::string, SPV3D_Prs* > > Prs;
   std::unique_ptr<SPV3D_EXPORTSPV3DData> myPrs;
 };