#include "VisuGUI_ClippingPlaneDlg.h"
#include "VisuGUI_ViewTools.h"
+#include <VISU_ColoredPrs3dCache_i.hh>
+
#include <LightApp_Application.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
return;
}
myPresentations = getPrsList(aStudy, aVisuSO);
+
+ //Process Cache system folder
+ _PTR(SObject) aSObjPtr = aStudy->FindObject(VISU::ColoredPrs3dCache_i::GetFolderName().c_str());
+ if (aSObjPtr) {
+ _PTR(ChildIterator) Iter = aStudy->NewChildIterator( aSObjPtr );
+ for ( ; Iter->More(); Iter->Next() ) {
+ _PTR(SObject) aChildObj = Iter->Value();
+ myPresentations.append(aChildObj->GetID().c_str());
+ }
+ }
+
QStringList aNames;
for (int i = 0; i < myPresentations.size(); i++) {
- aNames.append(getPrsName(myPresentations.at(i)));
+ aNames.append(getPrsName(getPrs(myPresentations.at(i))));
}
myPrsList->addItems(aNames);
}
}
//*************************************************************************
-QList<VISU::Prs3d_i*> VisuGUI_ClippingPanel::getPrsList(_PTR(Study) theStudy,
- _PTR(SObject) theObject)
+QStringList VisuGUI_ClippingPanel::getPrsList(_PTR(Study) theStudy,
+ _PTR(SObject) theObject)
{
- QList<VISU::Prs3d_i*> aList;
+ //QList<VISU::Prs3d_i*> aList;
+ QStringList aList;
_PTR(ChildIterator) aIter = theStudy->NewChildIterator(theObject);
for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
_PTR(SObject) aSObject = aIter->Value();
std::vector<VISU::Prs3d_i*> aSTLList = VISU::GetPrs3dList(myModule, aSObject);
for (int i = 0; i < aSTLList.size(); i++) {
VISU::Prs3d_i* aPrs = aSTLList[i];
- if (!aList.contains(aPrs))
- aList.append(aPrs);
+ if (!aList.contains(aPrs->GetEntry().c_str()))
+ aList.append(aPrs->GetEntry().c_str());
}
if (aList.size() == 0) {
- QList<VISU::Prs3d_i*> aSubList = getPrsList(theStudy, aSObject);
+ //QList<VISU::Prs3d_i*> aSubList = getPrsList(theStudy, aSObject);
+ QStringList aSubList = getPrsList(theStudy, aSObject);
for (int i = 0; i < aSubList.size(); i++) {
- VISU::Prs3d_i* aPrs = aSubList[i];
- if (!aList.contains(aPrs))
- aList.append(aSubList[i]);
+ //VISU::Prs3d_i* aPrs = aSubList[i];
+ QString aPrsEntry = aSubList[i];
+ if (!aList.contains(aPrsEntry))
+ aList.append(aPrsEntry);
}
}
}
aItem->setFlags(0);
// apply to all presentations
aItem->setCheckState(Qt::Checked);
- foreach(VISU::Prs3d_i* aPrs, myPresentations) {
- aPrs->AddClippingPlane(aNewPlane.plane);
+ foreach(QString aPrsEntry, myPresentations) {
+ getPrs(aPrsEntry)->AddClippingPlane(aNewPlane.plane);
}
} else { // if it is not auto
- foreach(VISU::Prs3d_i* aPrs, myPresentations) {
+ foreach(QString aPrsEntry, myPresentations) {
_PTR(ChildIterator) aRefIter = aStudy->NewChildIterator(aSObject);
for (; aRefIter->More(); aRefIter->Next()) {
_PTR(SObject) aObj = aRefIter->Value();
_PTR(SObject) aRefPrsObject;
if (aObj->ReferencedObject(aRefPrsObject)) { // If it is referenced on current plane
- if (QString(aRefPrsObject->GetID().c_str()) == QString(aPrs->GetEntry().c_str())) {
- aPrs->AddClippingPlane(aNewPlane.plane);
+ if (QString(aRefPrsObject->GetID().c_str()) == aPrsEntry) {
+ getPrs(aPrsEntry)->AddClippingPlane(aNewPlane.plane);
}
}
}
// Check current presentation
int aPrsNum = myPrsList->currentRow();
if (aPrsNum >= 0) {
- if (containsPlane(myPresentations.at(aPrsNum), aNewPlane))
+ if (containsPlane(getPrs(myPresentations.at(aPrsNum)), aNewPlane))
aItem->setCheckState(Qt::Checked);
}
}
//*************************************************************************
void VisuGUI_ClippingPanel::onPresentationCreate(VISU::Prs3d_i* thePrs)
{
+ printf("#### onPresentationCreate PrsNb = %i\n", myPresentations.size());
myPrsList->addItem(getPrsName(thePrs));
- myPresentations.append(thePrs);
+ myPresentations.append(thePrs->GetEntry().c_str());
for (int i = 0; i < myPlanes.size(); i++) {
const PlaneDef& aPlane = myPlanes.at(i);
if (aPlane.isAuto)
aItem->setFlags(0);
aItem->setCheckState(Qt::Checked);
for (int i = 0; i < myPresentations.size(); i++) {
- myPresentations.at(i)->AddClippingPlane(aNewPlane.plane);
+ getPrs(myPresentations.at(i))->AddClippingPlane(aNewPlane.plane);
}
} else {
aItem->setCheckState(Qt::Unchecked);
aItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
int aPrsNum = myPrsList->currentRow();
if (aPrsNum >= 0) {
- if (containsPlane(myPresentations.at(aPrsNum), aPlane))
+ if (containsPlane(getPrs(myPresentations.at(aPrsNum)), aPlane))
aItem->setCheckState(Qt::Checked);
}
}
if (aRes == QMessageBox::Yes) {
short aTag1 = aPlane.plane->getPlaneObject()->Tag();
for (int i = 0; i < myPresentations.size(); i++) {
- VISU::Prs3d_i* aPrs = myPresentations.at(i);
+ VISU::Prs3d_i* aPrs = getPrs(myPresentations.at(i));
for (int j = aPrs->GetNumberOfClippingPlanes()-1; j > -1; j--) {
CutPlaneFunction* aPln = dynamic_cast<CutPlaneFunction*>(aPrs->GetClippingPlane(j));
if (aPln) {
PlaneDef aPlane = myPlanes.at(thePlaneNum);
_PTR(Study) aStudy = VISU::GetCStudy( VISU::GetAppStudy( myModule ) );
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
- VISU::Prs3d_i* aPrs = myPresentations.at(thePrsNum);
+ VISU::Prs3d_i* aPrs = getPrs(myPresentations.at(thePrsNum));
_PTR(SObject) aSObject = aPlane.plane->getPlaneObject();
_PTR(SObject) aPrsSObj = aStudy->FindObjectID(aPrs->GetEntry());
if (isChecked) {
//*************************************************************************
bool VisuGUI_ClippingPanel::containsPlane(VISU::Prs3d_i* thePrs, const PlaneDef& thePlane)
{
- bool isContains = false;
+ //bool isContains = false;
for (int i = 0; i < thePrs->GetNumberOfClippingPlanes(); i++) {
if (thePrs->GetClippingPlane(i) == thePlane.plane.GetPointer()) {
return true;
//*************************************************************************
void VisuGUI_ClippingPanel::onObjectDelete(QString theEntry)
{
+ printf("#### onObjectDelete PrsSize = %i\n", myPresentations.size());
disconnect(myPrsList, SIGNAL(currentRowChanged(int)), this, SLOT(onPrsSelected(int)));
int i = 0;
- foreach (VISU::Prs3d_i* aPrs, myPresentations) {
- QString aID(aPrs->GetEntry().c_str());
- if (aID == theEntry) {
- myPresentations.removeAt(i);
- myPrsList->takeItem(i);
- break;
+ foreach (QString aPrsEntry, myPresentations) {
+ VISU::Prs3d_i* aPrs = getPrs(aPrsEntry);
+ if (aPrs) {
+ QString aID(aPrs->GetEntry().c_str());
+ if (aID == theEntry) {
+ myPresentations.removeAt(i);
+ myPrsList->takeItem(i);
+ break;
+ }
+ i++;
}
- i++;
}
connect(myPrsList, SIGNAL(currentRowChanged(int)), this, SLOT(onPrsSelected(int)));
onPrsSelected(myPrsList->currentRow());
{
if (thePrs < 0) return;
disconnect(myPlanesList, SIGNAL(cellChanged(int,int)), this, SLOT(onCellChanged(int,int)));
- VISU::Prs3d_i* aPrs = myPresentations.at(thePrs);
+ VISU::Prs3d_i* aPrs = getPrs(myPresentations.at(thePrs));
QListOfPlanes::const_iterator aIt;
int i = 0;
for (aIt = myPlanes.begin(), i = 0; aIt != myPlanes.end(); ++aIt, i++) {
}
+//*************************************************************************
+VISU::Prs3d_i* VisuGUI_ClippingPanel::getPrs(QString theEntry)
+{
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(VISU::GetAppStudy(myModule),
+ qPrintable(theEntry));
+ return VISU::GetPrs3dFromBase(anObjectInfo.myBase);
+}
+
+
//*************************************************************************
void VisuGUI_ClippingPanel::onHelp()
{