vtkIdType SPV3D_Prs::cellid = 0;
vtkIdType SPV3D_Prs::nbsolid = 0;
-std::map<vtkIdType, const char*> SPV3D_Prs::vtkIdToEntry;
+//std::map<vtkIdType, const char*> SPV3D_Prs::vtkIdToEntry;
vtkSmartPointer<vtkMultiBlockDataSet> SPV3D_Prs::multiGEOMData = vtkSmartPointer<vtkMultiBlockDataSet>::New();
SPV3D_EXPORTSPV3DData::SPV3D_EXPORTSPV3DData()
pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
_sourceProducer = builder->createSource("sources","PVTrivialProducer",serv);
+ _repr = builder->createDataRepresentation(_sourceProducer->getOutputPort(0),getView(),"CADRepresentation");
+ vtkSMViewProxy::RepresentationVisibilityChanged(_repr->getViewProxy(), _repr->getProxy(), true);
}
void SPV3D_EXPORTSPV3DData::SetPolyData(vtkPolyData* ds)
{
}
return;
_multiGEOMData->RemoveBlock(id);
+ Hide_list.erase(SPV3D_Prs::FromEntryToVtkId(entry));
}
-void SPV3D_EXPORTSPV3DData::updateSource() const
+void SPV3D_EXPORTSPV3DData::updateSource_for_display() const
{
vtkNew<vtkAppendPolyData> appendFilter;
std::cout <<"number of block: " << _multiGEOMData->GetNumberOfBlocks()<<std::endl;
vtkPolyData* polyData = vtkPolyData::SafeDownCast(_multiGEOMData->GetBlock(i));
if (polyData)
{
- appendFilter->AddInputData(polyData);
+ vtkIdTypeArray* retrievedArray = vtkIdTypeArray::SafeDownCast(polyData->GetCellData()->GetArray("Solid id"));
+ if (retrievedArray && !Hide_list.find(retrievedArray->GetValue(0)))
+ appendFilter->AddInputData(polyData);
}
}
appendFilter->Update();
return GetRepresentation()->isVisible();
}
-bool SPV3D_EXPORTSPV3DData::SolidIsVisible(vtkidtype solid_id) const
+bool SPV3D_EXPORTSPV3DData::SolidIsVisible(vtkIdType solid_id) const
{
- if( std::find(Hide_list.begin(), Hide_list.end(), solid_id) )
+ if( Hide_list.find(solid_id) )
return false;
return true
}
vtkPolyData* polyData = vtkPolyData::SafeDownCast(_multiGEOMData->GetBlock(id));
if (polyData)
{
- vtkIdTypeArray* retrievedArray = vtkIdTypeArray::SafeDownCast(toto->GetCellData()->GetArray("Solid id"));
+ vtkIdTypeArray* retrievedArray = vtkIdTypeArray::SafeDownCast(polyData->GetCellData()->GetArray("Solid id"));
if (retrievedArray && retrievedArray->GetValue(0) == solid_id)
break;
}
return false;
}
-void SPV3D_EXPORTSPV3DData::Hide(vtkditype solid_id)
+void SPV3D_EXPORTSPV3DData::HideSolid(vtkIdType solid_id)
{
- Hide_list.push_back(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;
+}
+
+void SPV3D_EXPORTSPV3DData::DisplaySolid(vtkIdType solid_id)
+{
+ if (SolidIsVisible(solid_id))
+ {
+ Hide_list.erase(solid_id);
+ }
+ else
+ {
+ std::cout << SPV3D_Prs::FromVtkIdToEntry(solid_id) << " is not in Hide_list\n" << std::endl;
+ }
}
void SPV3D_EXPORTSPV3DData::Hide() const
return smmodel->findItem<pqProxy*>(proxy);
}
-void SPV3D_Prs::FillUsingActor(vtkActor *actor) const
+void SPV3D_Prs::FillUsingActor_init(vtkActor *actor) const
{
std::cout << "Hello FillUsingActor"<<std::endl;
}
+
+
+
+void SPV3D_Prs::FillUsingActor(vtkActor *actor) const
+{
+ std::cout << "Hello FillUsingActor"<<std::endl;
+
+ //SPV3D_EXPORTSPV3DData *alreadyExistingSrc = nullptr;
+ alreadyExisting = _view->isEntryAlreadyExist( GetEntry() );
+
+ if(alreadyExisting) // hide but it exist in SPV3D_EXPORTSPV3DData
+ {
+
+ }
+ else
+ {
+ this->CopyInfo( alreadyExistingSrc );
+ }
+}
\ No newline at end of file
class SPV3D_EXPORTSPV3DData
{
public:
- SPV3D_EXPORTSPV3DData():nbsolid(0),_multiGEOMData( vtkSmartPointer<vtkMultiBlockDataSet>::New()){};
+ SPV3D_EXPORTSPV3DData();
SPV3D_EXPORTSPV3DData *deepCopy() { return new SPV3D_EXPORTSPV3DData(*this); }
void SetPrs(vtkPolyData* ds, const char* entry);
void SetPolyData(vtkPolyData* ds);
void SetRepresentation(pqDataRepresentation *repr) const { _repr = repr; }
pqDataRepresentation *GetRepresentation() const { return _repr; }
- void updateSource();
+ void updateSource_for_display();
bool IsNull() const { return !_sourceProducer && !_repr; }
bool IsVisible() const;
bool havePrs(const char* entry, unsigned int & id);
void Hide() const;
- void Hide(vtkIdType solid_id);
+ void HideSolid(vtkIdType solid_id);
+ void DisplaySolid(vtkIdType solid_id);
bool SolidIsVisible(vtkIdType solid_id) const;
private:
private:
vtkSmartPointer<vtkMultiBlockDataSet> _multiGEOMData;
vtkIdType nbsolid;
- std::list<vtkIdType> Hide_list;
+ std::set<vtkIdType> Hide_list;
mutable pqPipelineSource *_sourceProducer = nullptr;
mutable pqDataRepresentation *_repr = nullptr;
};
std::string _name;
static vtkIdType cellid;
static vtkIdType nbsolid;
- static std::map<vtkIdType,const char*> vtkIdToEntry;
+ //static std::map<vtkIdType,const char*> vtkIdToEntry;
static vtkSmartPointer<vtkMultiBlockDataSet> multiGEOMData;
};