SALOMEDS::AttributeIOR_var anIOR;
switch (theCommandID){
- /* ======================================================================================== */
- /* Import Table from file */
- /* ======================================================================================== */
+ /* ========================================================================== */
+ /* Import Table from file */
+ /* ========================================================================== */
case 199:
{
if(checkLock(aStudy)) break;
break;
}
- /* ======================================================================================== */
- /* Import Mesh from MED, DAT file */
- /* ======================================================================================== */
+ /* ========================================================================== */
+ /* Import Mesh from MED, DAT file */
+ /* ========================================================================== */
// case 111:
// {
break;
}
- /* ======================================================================================== */
- /* Export results and mesh into a file format */
- /* ======================================================================================== */
+ /* ========================================================================== */
+ /* Export results and mesh into a file format */
+ /* ========================================================================== */
case 122:
{
break;
}
- /* ========================================================================== */
- /* Visualization of Results : */
- /* 4011 : Scalar Map */
- /* 4012 : Deformed Shape */
- /* 4013 : Vectors */
- /* 4014 : Iso-Surfaces */
- /* 4015 : Cut Planes */
- /* 4016 : Stream Lines */
- /* ========================================================================== */
+ /* ========================================================================== */
+ /* Visualization of Results : */
+ /* 4011 : Scalar Map */
+ /* 4012 : Deformed Shape */
+ /* 4013 : Vectors */
+ /* 4014 : Iso-Surfaces */
+ /* 4015 : Cut Planes */
+ /* 4016 : Stream Lines */
+ /* ========================================================================== */
case 4011 :
visuGUI->CreateScalarMap();
visuGUI->SelectionInfo();
break;
- /* ========================================================================================================================= */
- /* Visualization - Wireframe */
- /* ========================================================================================================================= */
+ /* ========================================================================== */
+ /* Visualization - Wireframe */
+ /* ========================================================================== */
case 4211 :
ChangeViewer(1);
break;
- /* ========================================================================================================================= */
- /* Visualization - Surface */
- /* ========================================================================================================================= */
+ /* ========================================================================== */
+ /* Visualization - Surface */
+ /* ========================================================================== */
case 4212 :
ChangeViewer(2);
break;
- /* ========================================================================================================================= */
- /* Visualization - Points */
- /* ========================================================================================================================= */
+ /* ========================================================================== */
+ /* Visualization - Points */
+ /* ========================================================================== */
case 4213 :
ChangeViewer(0);
break;
- /* ========================================================================================================================= */
- /* Visualization - Erase */
- /* ========================================================================================================================= */
+ /* ========================================================================== */
+ /* Visualization - Erase */
+ /* ========================================================================== */
case 422 :
ChangeViewer(-1);
break;
- /* ========================================================================================================================= */
- /* Visualization - Global */
- /* ========================================================================================================================= */
+ /* ========================================================================== */
+ /* Visualization - Global */
+ /* ========================================================================== */
//case 423 :
- /* ========================================================================================================================= */
- /* Visualization - Partial */
- /* ========================================================================================================================= */
+ /* ========================================================================== */
+ /* Visualization - Partial */
+ /* ========================================================================== */
//case 424 :
}
/* ======================================================================================== */
-/* Preferences for Sweeping */
+/* Preferences for Sweeping */
/* ======================================================================================== */
case 52:
{
tr("VISU_BUT_OK") );
return false;
}
- catch (std::exception& e){
+ catch (std::exception& e) {
INFOS(e.what());
QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr(e.what()),
}
/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
+ * Slot : opens Table view : for Table object or SObject with table attribute selected
+ */
void VisuGUI::ShowTable() {
SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
if( Sel->IObjectCount() !=1 )
/*!
- Slot : opens Table view : for Table object or SObject with table attribute selected
-*/
-void VisuGUI::CreateTable() {
+ * Slot : opens Table view : for Table object or SObject with table attribute selected
+ */
+void VisuGUI::CreateTable()
+{
SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
if( aSel->IObjectCount() !=1 )
return;
/*!
- Slot : deletes SObject with all subobjects
-*/
+ * Slot : deletes SObject with all subobjects
+ */
void VisuGUI::DeleteObject() {
+ MESSAGE("VisuGUI::DeleteObject()");
+
SALOMEDS::Study_var aStudy = GetStudyDocument();
if (checkLock(aStudy)) return;
SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
- if( aSel->IObjectCount() !=1 )
- return;
+ if (aSel->IObjectCount() != 1) return;
+
Handle(SALOME_InteractiveObject) anIO = aSel->firstIObject();
- if (anIO->hasEntry()){
- SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
- if(!aSObject->_is_nil()){
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- ::ErasePrs(aChildObj);
- }
- SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
- // There is a transaction
- aStudyBuilder->NewCommand();
- CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
- if(!CORBA::is_nil(anObj)){
- VISU::Base_var aBase = VISU::Base::_narrow(anObj);
- if(!CORBA::is_nil(aBase)){
- VISU::VISUType aType = aBase->GetType();
- switch (aType){
- case VISU::TRESULT:
- {
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
- if(CORBA::is_nil(aPrs3d)) continue;
- VISU::Prs3d_i* pPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aPrs3d).in());
- DeletePresentation(pPrs3d);
- }
- break;
- }
- case VISU::TTABLE:
- {
- SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- CORBA::Object_ptr aCurve = VISU::Curve::_narrow( aChildObj );
- if(CORBA::is_nil(aCurve)) continue;
- VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
- DeletePresentation(pCurve);
- }
- break;
- }
- }
- }
+ if (!anIO->hasEntry()) return;
+
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ if (aSObject->_is_nil()) return;
+
+ SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
+ for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+ SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+ CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+ ::ErasePrs(aChildObj);
+ }
+
+ CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
+
+ // There is a transaction
+ SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
+ aStudyBuilder->NewCommand();
+
+ if (!CORBA::is_nil(anObj)) {
+ MESSAGE("VisuGUI::DeleteObject() : !CORBA::is_nil(anObj)");
+
+ VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
+ if (!CORBA::is_nil(aRemovableObject)) {
+ MESSAGE("VisuGUI::DeleteObject() : !CORBA::is_nil(aRemovableObject)");
+ aRemovableObject->RemoveFromStudy();
+ }
+ } else {
+ aStudyBuilder->RemoveObjectWithChildren(aSObject);
+ }
+
+ aStudyBuilder->CommitCommand();
+
+ GetActiveStudy()->unHighlightAll();
+ GetActiveStudy()->updateObjBrowser(true);
+}
+
+/*!
+ * Slot : deletes all selected SObjects with all subobjects
+ */
+void VisuGUI::DeleteManyObjects() {
+ MESSAGE("VisuGUI::DeleteManyObjects()");
+
+ SALOMEDS::Study_var aStudy = GetStudyDocument();
+ if (checkLock(aStudy)) return;
+
+ SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
+ int i, nbSelected = aSel->IObjectCount();
+ if (nbSelected < 1) return;
+
+ const char* entries [nbSelected];
+ SALOME_ListIteratorOfListIO It (aSel->StoredIObjects());
+ for (i = 0; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ if (anIO->hasEntry())
+ entries[i++] = anIO->getEntry();
+ }
+ nbSelected = i;
+
+ // There is a transaction
+ SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
+ aStudyBuilder->NewCommand();
+
+ for (i = 0; i < nbSelected; i++) {
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(entries[i]);
+ if (aSObject->_is_nil()) continue;
+
+ SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(aSObject);
+ for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) {
+ SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
+ CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
+ ::ErasePrs(aChildObj);
+ }
+
+ CORBA::Object_var anObj = VISU::SObjectToObject(aSObject);
+ if (!CORBA::is_nil(anObj)) {
+ MESSAGE("VisuGUI::DeleteManyObjects() : !CORBA::is_nil(anObj)");
+
+ VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj);
+ if (!CORBA::is_nil(aRemovableObject)) {
+ MESSAGE("VisuGUI::DeleteManyObjects() : !CORBA::is_nil(aRemovableObject)");
+ aRemovableObject->RemoveFromStudy();
}
+ } else {
aStudyBuilder->RemoveObjectWithChildren(aSObject);
- aStudyBuilder->CommitCommand();
- GetActiveStudy()->unHighlightAll();
- GetActiveStudy()->updateObjBrowser(true);
}
}
-}
+ // Finish transaction
+ aStudyBuilder->CommitCommand();
+
+ GetActiveStudy()->unHighlightAll();
+ GetActiveStudy()->updateObjBrowser(true);
+}
/*!
- Slot : deletes empty container
-*/
+ * Slot : creates empty container
+ */
void VisuGUI::CreatePlot2dView() {
if (checkLock(GetStudyDocument())) return;
GetVisuGen()->CreateContainer();
GetActiveStudy()->updateObjBrowser( true );
}
-
-
/*!
- Opens dialog box for curves creation. Acts only for selected SObject with table attribute.
-*/
+ * Opens dialog box for curves creation. Acts only for selected SObject with table attribute.
+ */
void VisuGUI::PlotData() {
SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
if( Sel->IObjectCount() !=1 )
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
QString SOName;
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
+ SALOMEDS::SObject_var SO =
+ GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
if ( IsSObjectTable(SO) ) {
// get name of SObject
if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
aName = SALOMEDS::AttributeName::_narrow( anAttr );
SOName = aName->Value();
}
- Plot2d_SetupPlot2dDlg* dlg = new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
+ Plot2d_SetupPlot2dDlg* dlg =
+ new Plot2d_SetupPlot2dDlg( SO, QAD_Application::getDesktop() );
if ( dlg->exec() == QDialog::Accepted ) {
if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- // if study is not locked - create new container, create curves
- // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
+ // if study is not locked - create new container, create curves and insert them
+ // into container, then plot container if current viewer is of VIEW_PLOT2D type
int horIndex;
QValueList<int> verIndices;
dlg->getCurvesSource( horIndex, verIndices );
if ( horIndex >= 0 && verIndices.count() > 0 ) {
CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
if( !CORBA::is_nil( aContainer ) ) {
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
+ VISU::Container_i* pContainer =
+ dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
if ( pContainer ) {
for ( int i = 0; i < verIndices.count(); i++ ) {
- CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
+ CORBA::Object_var aNewCurve =
+ GetVisuGen()->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
+ VISU::Curve_i* pCrv =
+ dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
if ( pCrv ) {
bool isAuto;
int marker, line, lineWidth;
QColor color;
- if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker, line, lineWidth, color ) && !isAuto ) {
- SALOMEDS::Color c; c.R = color.red()/255.; c.G = color.green()/255.; c.B = color.blue()/255.;
+ if ( dlg->getCurveAttributes( verIndices[i], isAuto, marker,
+ line, lineWidth, color ) && !isAuto ) {
+ SALOMEDS::Color c;
+ c.R = color.red()/255.;
+ c.G = color.green()/255.;
+ c.B = color.blue()/255.;
+
pCrv->SetColor( c );
pCrv->SetMarker( ( VISU::Curve::MarkerType )marker );
pCrv->SetLine( ( VISU::Curve::LineType )line, lineWidth );
}
}
else {
- // if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
+ // if study is locked just get curves info and plot
+ // them if current viewer is of VIEW_PLOT2D type
Plot2d_CurveContainer container;
dlg->getCurves( container );
if ( !container.isEmpty() ) {
QString SOName;
// check if Table SObject is selected
- SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
+ SALOMEDS::SObject_var SO =
+ GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
if ( IsSObjectTable(SO) ) {
// get name of SObject
if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
/*!
- Slot : Opens "Setup curve" dialog to set curve properties : for Curve object selected
-*/
+ * Slot : Opens "Setup curve" dialog to set curve properties : for Curve object selected
+ */
void VisuGUI::CurveProperties() {
SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
if( Sel->IObjectCount() !=1 )
/*!
- Slot : Clears container contents : for Container object selected
-*/
+ * Slot : Clears container contents : for Container object selected
+ */
void VisuGUI::ClearContainer() {
SALOME_Selection* Sel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
if( Sel->IObjectCount() !=1 )
}
/*!
- Slot : Edit container contents : for Container object selected
-*/
+ * Slot : Edit container contents : for Container object selected
+ */
void VisuGUI::EditContainer() {
CORBA::Object_var anObject = GetSelectedObj();
if(CORBA::is_nil(anObject)) return;
}
-void VisuGUI::DeletePrs() {
- SALOMEDS::Study_var aStudy = GetStudyDocument();
- if (checkLock(aStudy)) return;
-
- // There is a transaction
- SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
- aStudyBuilder->NewCommand();
-
- CORBA::Object_var anObject = GetSelectedObj();
- if ( !CORBA::is_nil( anObject ) ) {
- // is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
- if(aPrsObject)
- DeletePresentation(aPrsObject);
- // is it Curve object ?
- VISU::Curve_i* aCurveObject = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
- if(aCurveObject)
- DeletePresentation(aCurveObject);
- }
- aStudyBuilder->CommitCommand();
-}
-
-
void VisuGUI::SaveViewParams()
{
if (checkLock(GetStudyDocument())) return;
// purpose :
//=====================================================================================
void VisuGUI::ClippingPlanes() {
- //SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
new VisuGUI_ClippingDlg (QAD_Application::getDesktop(),"",false);
}
{
int selMode = homoNone;
SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
- for ( ; It.More(); It.Next() ) {
+ SALOME_ListIteratorOfListIO It (Sel->StoredIObjects());
+ for (; It.More(); It.Next()) {
int selNext = homoOther;
Handle(SALOME_InteractiveObject)& anIO = It.Value();
if ( anIO->hasEntry() ) {
return selMode;
}
+//=====================================================================================
+// function : isRemovable()
+// purpose :
+//=====================================================================================
+bool VisuGUI::isRemovable()
+{
+ SALOME_Selection* Sel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
+ SALOME_ListIteratorOfListIO It (Sel->StoredIObjects());
+ for (; It.More(); It.Next()) {
+ Handle(SALOME_InteractiveObject)& anIO = It.Value();
+ if (anIO->hasEntry()) {
+ SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
+ VISU::Storable::TRestoringMap pMap;
+ if (!aSObject->_is_nil()) {
+ CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ VISU::RemovableObject_var aRemovableObj = VISU::RemovableObject::_narrow(aCORBAObject);
+ if (CORBA::is_nil(aRemovableObj)) {
+ // Not removable CORBA object
+ return false;
+ }
+ } else {
+ // Can be removed, if lays directly under VISU
+ // (first sub-level) or is a child of such an object
+ string aNAME, aVisuNAME = GetVisuGen()->ComponentDataType();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeComment_var aComment;
+
+ bool isUnderVISU = false;
+ SALOMEDS::SObject_var aFatherSObject = aSObject->GetFather();
+ if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) {
+ aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ aNAME = aComment->Value();
+ if (aNAME == aVisuNAME) {
+ isUnderVISU = true;
+ }
+ }
+ if (!isUnderVISU) {
+ // Not directly under VISU component, check father
+ aCORBAObject = VISU::SObjectToObject(aFatherSObject);
+ if (!CORBA::is_nil(aCORBAObject)) {
+ // Father has IOR
+ return false;
+ }
+
+ isUnderVISU = false;
+ aFatherSObject = aFatherSObject->GetFather();
+ if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) {
+ aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ aNAME = aComment->Value();
+ if (aNAME == aVisuNAME) {
+ isUnderVISU = true;
+ }
+ }
+ if (!isUnderVISU) {
+ // Father is not directly under VISU component
+ return false;
+ }
+ }
+ //if (!IsSObjectTable(aSObject)) {
+ // CORBA::Long aTag = 1;
+ // SALOMEDS::SObject_var aSubObject;
+ // if (!aSObject->FindSubObject(aTag, aSubObject) ||
+ // !IsSObjectTable(aSubObject)) {
+ // // Neither table, nor a set of tables
+ // return false;
+ // }
+ //}
+ }
+ }
+ }
+ }
+ return true;
+}
+
//=====================================================================================
// function : GetNbChildren() [ static ]
// purpose : get number of children
// function : CustomPopup()
// purpose :
//=====================================================================================
-bool VisuGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* thePopup, const QString & theContext,
- const QString & theParent, const QString & theObject)
+bool VisuGUI::CustomPopup (QAD_Desktop* parent, QPopupMenu* thePopup, const QString & theContext,
+ const QString & theParent, const QString & theObject)
{
QAD_ResourceMgr* rmgr = parent->createResourceManager();
thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
return false;
}
- if( nbSel > 1 ) {
+ if ( nbSel > 1 ) {
int selMode = checkHomoSelection();
if(MYDEBUG) MESSAGE("VisuGUI::CustomPopup: multiple selection : selMode = "<<selMode );
if ( selMode == homoCurves ) {
thePopup->insertItem( "Merge Scalar Range", visuGUI, SLOT( MergeScalarBars() ) );
thePopup->insertItem( "Use Field Range", visuGUI, SLOT( FreeScalarBars() ) );
}
+ } else {
+ }
+
+ if (isRemovable()) {
+ thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteManyObjects() ) );
}
return true;
}
thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
}
- if ( !aIsLocked ) thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+ //if ( !aIsLocked ) thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+ if ( !aIsLocked ) thePopup->insertItem("Delete", visuGUI, SLOT(DeleteObject()));
break;
case VISU::TCONTAINER:
thePopup->insertItem("Display Only", visuGUI, SLOT(DisplayOnlyPrs()));
}
- thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+ //thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+ thePopup->insertItem("Delete", visuGUI, SLOT(DeleteObject()));
if ((aType != VISU::TMESH) && (!aIsLocked)) {
thePopup->insertSeparator();
thePopup->insertItem("Same As", visuGUI, SLOT(CopyPresentation()));
if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) { \
delete aDlg; \
} else { \
- DeletePresentation(pPresent); \
+ pPresent->RemoveFromStudy(); \
+ GetActiveStudy()->updateObjBrowser(); \
delete aDlg; \
return false; \
} \
}
}
-/**
- * Deletes given presentation from Data structure
- */
-void VisuGUI::DeletePresentation(VISU::Prs3d_i* thePrs) {
- if(checkLock(GetStudyDocument()) || !thePrs) return;
- GetActiveStudy()->unHighlightAll();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)){
- if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)){
- aViewFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- aViewFrame->unHighlightAll();
- }
- }
- thePrs->RemoveFromStudy();
- GetActiveStudy()->updateObjBrowser(); //update Object browser
-}
-
-/**
- * Deletes given curve presentation from Data structure
- */
-void VisuGUI::DeletePresentation(VISU::Curve_i* theCurve) {
- if(checkLock(GetStudyDocument()) || !theCurve) return;
- GetActiveStudy()->unHighlightAll();
- for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
- if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
- QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
- if(Plot2d_ViewFrame* aViewFrame = dynamic_cast<Plot2d_ViewFrame*>(aVFrame)){
- QList<Plot2d_Curve> clist;
- aViewFrame->getCurves( clist );
- for ( int i = 0; i < clist.count(); i++ ) {
- if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) )
- aViewFrame->eraseCurve( clist.at( i ) );
- }
- aViewFrame->Repaint();
- aViewFrame->unHighlightAll();
- }
- }
- theCurve->RemoveFromStudy();
- GetActiveStudy()->updateObjBrowser(); //update Object browser
-}
-
/**
* Creates new actor of presentation
*/
#include "VISU_CutLines_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_Table_i.hh"
#include "VISU_Table_i.hh"
#include "VISU_ScalarBarActor.hxx"
}
};
- class TSetViewRepresentation: public SALOME_Event{
- VISU::View::ViewRepresentation myViewRepr;
+ class TSetViewRepresentation: public SALOME_Event {
View_i* myView;
+ VISU::View::ViewRepresentation myViewRepr;
CORBA::Boolean myState;
- public:
- TSetViewRepresentation( View_i* aView,
+ public:
+ TSetViewRepresentation (View_i* aView,
VISU::View::ViewRepresentation ViewRepr,
- CORBA::Boolean State ):
+ CORBA::Boolean State):
SALOME_Event(), myViewRepr( ViewRepr ), myView( aView ), myState( State )
- {}
- virtual void Execute(){
+ {}
- bool old = myView->IsPartShown( myViewRepr );
+ virtual void Execute() {
+ bool old = myView->IsPartShown( myViewRepr );
- QAD_RightFrame* fr = myView->myStudyFrame->getRightFrame();
+ QAD_RightFrame* fr = myView->myStudyFrame->getRightFrame();
- if( myView->myStudyFrame != NULL ){
- switch( myViewRepr )
- {
- case VISU::View::OBJECTBROWSER:
- if( myState!=old )
- if( myState )
- myView->myStudyFrame->unCompressLeft();
- else
- myView->myStudyFrame->compressLeft();
- break;
- case VISU::View::VIEWER:
- if( myState!=old )
- if( myState )
- fr->unCompressUp();
- else
- fr->compressUp();
- break;
- case VISU::View::PYTHON:
- if( myState!=old )
- if( myState )
- fr->unCompressLeft();
- else
- fr->compressLeft();
- break;
- case VISU::View::MESSAGES:
- if( myState!=old )
- if( myState )
- fr->unCompressRight();
- else
- fr->compressRight();
- break;
- };
+ if( myView->myStudyFrame != NULL ){
+ switch( myViewRepr )
+ {
+ case VISU::View::OBJECTBROWSER:
+ if( myState!=old )
+ if( myState )
+ myView->myStudyFrame->unCompressLeft();
+ else
+ myView->myStudyFrame->compressLeft();
+ break;
+ case VISU::View::VIEWER:
+ if( myState!=old )
+ if( myState )
+ fr->unCompressUp();
+ else
+ fr->compressUp();
+ break;
+ case VISU::View::PYTHON:
+ if( myState!=old )
+ if( myState )
+ fr->unCompressLeft();
+ else
+ fr->compressLeft();
+ break;
+ case VISU::View::MESSAGES:
+ if( myState!=old )
+ if( myState )
+ fr->unCompressRight();
+ else
+ fr->compressRight();
+ break;
+ };
+ }
}
- }
-};
+ };
class TGetViewRepresentation: public SALOME_Event
{
}
};
- class TSetViewWidthHeight: public SALOME_Event{
+ class TSetViewWidthHeight: public SALOME_Event {
CORBA::Long mySize;
bool myIsWidth;
View_i* myView;
}
};
- class TGetViewWidthHeight: public SALOME_Event{
+ class TGetViewWidthHeight: public SALOME_Event {
public:
typedef CORBA::Long TResult;
TResult myResult;
}
};
- class TSetViewPositionHorizontal: public SALOME_Event{
+ class TSetViewPositionHorizontal: public SALOME_Event {
VISU::View::ViewPosition myViewPos;
View_i* myView;
public:
}
};
- class TSetViewPositionVertical: public SALOME_Event{
+ class TSetViewPositionVertical: public SALOME_Event {
VISU::View::ViewPosition myViewPos;
View_i* myView;
public:
- class TSavePictureEvent: public SALOME_Event{
+ class TSavePictureEvent: public SALOME_Event {
QWidget* myWidget;
const char* myFileName;
public:
void RepaintView(QAD_StudyFrame* theStudyFrame);
- class TRepaintViewEvent: public SALOME_Event{
+
+ class TRepaintViewEvent: public SALOME_Event {
QAD_StudyFrame* myStudyFrame;
public:
TRepaintViewEvent(QAD_StudyFrame* theStudyFrame):
}
- VISU_Actor* UpdateViewer(QAD_StudyFrame* theStudyFrame, int theDisplaing, Prs3d_i* thePrs){
+ VISU_Actor* UpdateViewer (QAD_StudyFrame* theStudyFrame, int theDisplaing, Prs3d_i* thePrs)
+ {
VTKViewer_ViewFrame* vf = GetViewFrame(theStudyFrame);
if (!vf) return NULL;
if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<<theDisplaing<<"; thePrs = "<<thePrs);
RepaintView(theStudyFrame);
return anVISUActor;
}
- void UpdatePlot2d(Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve) {
+
+ void UpdatePlot2d (Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve) {
if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = "<<theDisplaying);
if ( !theView )
return;
}
}
- QAD_Study* CheckStudy( SALOMEDS::Study_ptr theStudy ) {
+ QAD_Study* CheckStudy ( SALOMEDS::Study_ptr theStudy ) {
QAD_Desktop* aDesktop = QAD_Application::getDesktop();
QAD_Study* aStudy = aDesktop->findStudy(theStudy);
if(!aStudy){
}
return aStudy;
}
+
//===========================================================================
ViewManager_i::ViewManager_i(SALOMEDS::Study_ptr theStudy) {
if(MYDEBUG) MESSAGE("ViewManager_i::ViewManager_i");
}
- class TGetCurrentViewEvent: public SALOME_Event{
+ class TGetCurrentViewEvent: public SALOME_Event {
SALOMEDS::Study_ptr myStudyDocument;
public:
TGetCurrentViewEvent( SALOMEDS::Study_ptr theStudy):
template<class TViewFrame>
- class TCreateViewFrameEvent: public TCreateViewEvent{
+ class TCreateViewFrameEvent: public TCreateViewEvent {
public:
typedef typename TViewFrame::TInterface TInterface;
typedef typename TInterface::_ptr_type TResult;
}
- class TCreateTableViewEvent: public TCreateViewEvent{
+ class TCreateTableViewEvent: public TCreateViewEvent {
Table_ptr myTable;
public:
TCreateTableViewEvent(SALOMEDS::Study_ptr theStudy,
}
- class TEnbleGridEvent: public SALOME_Event{
+ class TEnbleGridEvent: public SALOME_Event {
public:
typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool = true);
TEnbleGridEvent(Plot2d_ViewFrame* theView, TFun theFun,
}
- class TSetTitleEvent: public SALOME_Event{
+ class TSetTitleEvent: public SALOME_Event {
public:
typedef void (Plot2d_ViewFrame::* TFun)(bool, const QString&, bool = true);
TSetTitleEvent(Plot2d_ViewFrame* theView, TFun theFun, const char* theTitle):
//===========================================================================
- VISU_Actor* GetActor(VISU::Prs3d_i* thePrs3d, VTKViewer_ViewFrame* theVTKFrame){
+ VISU_Actor* GetActor (VISU::Prs3d_i* thePrs3d, VTKViewer_ViewFrame* theVTKFrame)
+ {
vtkActorCollection *anActColl = theVTKFrame->getRenderer()->GetActors();
anActColl->InitTraversal();
- while(vtkActor *anActor = anActColl->GetNextActor())
- if(VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
- if(thePrs3d == anVISUActor->GetPrs3d())
+ while (vtkActor *anActor = anActColl->GetNextActor())
+ if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(anActor))
+ if (thePrs3d == anVISUActor->GetPrs3d())
return anVISUActor->GetParent();
return NULL;
}
+ void DeleteActors (VISU::Curve_i* thePrs)
+ {
+ if (!thePrs) return;
- void DeletePrs3d(Prs3d_ptr thePrs3d){
- if(Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(thePrs3d).in())){
- SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
- SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- if(QAD_Desktop* aDesktop = QAD_Application::getDesktop()){
- if(QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument)){
- aStudy->unHighlightAll();
- int aNbStudyFrames = aStudy->getStudyFramesCount();
- for(int aFrameId = 0; aFrameId < aNbStudyFrames; aFrameId++){
- if(QAD_StudyFrame* aFrame = aStudy->getStudyFrame(aFrameId)){
- QAD_ViewFrame* aViewFrame = aFrame->getRightFrame()->getViewFrame();
- if(VTKViewer_ViewFrame* aVTKFrame = dynamic_cast<VTKViewer_ViewFrame*>(aViewFrame)){
- if(VISU_Actor* anActor = VISU::GetActor(aPrs3d,aVTKFrame)){
- aVTKFrame->RemoveActor(anActor);
- anActor->Delete();
- }
- aVTKFrame->unHighlightAll();
- }
+ SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+ SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
+
+ QAD_Desktop* aDesktop = QAD_Application::getDesktop();
+ if (!aDesktop) return;
+
+ QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument);
+ if (!aStudy) return;
+
+ aStudy->unHighlightAll();
+ for (int i = 0, nbFrames = aStudy->getStudyFramesCount(); i < nbFrames; i++) {
+ if (QAD_StudyFrame* aFrame = aStudy->getStudyFrame(i)) {
+ QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
+ Plot2d_ViewFrame* aViewFrame = dynamic_cast<Plot2d_ViewFrame*>(aVFrame);
+ if (aViewFrame) {
+ QList<Plot2d_Curve> clist;
+ aViewFrame->getCurves(clist);
+ for (int i = 0; i < clist.count(); i++) {
+ if (clist.at(i)->hasIO() &&
+ strcmp(clist.at(i)->getIO()->getEntry(), thePrs->GetEntry()) == 0) {
+ aViewFrame->eraseCurve(clist.at(i));
}
}
+ aViewFrame->Repaint();
+ aViewFrame->unHighlightAll();
+ }
+ }
+ }
+ }
+
+ void DeleteActors (VISU::Prs3d_i* thePrs)
+ {
+ if (!thePrs) return;
- aPrs3d->RemoveFromStudy();
- aPrs3d->Destroy();
+ SALOMEDS::SObject_var aSObject = thePrs->GetSObject();
+ SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- aStudy->updateObjBrowser(); //update Object browser
+ QAD_Desktop* aDesktop = QAD_Application::getDesktop();
+ if (!aDesktop) return;
+
+ QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument);
+ if (!aStudy) return;
+
+ aStudy->unHighlightAll();
+ for (int i = 0, nbFrames = aStudy->getStudyFramesCount(); i < nbFrames; i++) {
+ if (QAD_StudyFrame* aFrame = aStudy->getStudyFrame(i)) {
+ QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
+ VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame);
+ if (aViewFrame) {
+ if (VISU_Actor* anActor = GetActor(thePrs,aViewFrame)) {
+ aViewFrame->RemoveActor(anActor);
+ anActor->Delete();
+ }
+ aViewFrame->unHighlightAll();
}
}
}
}
-
- void VISU_Gen_i::DeleteResult(Result_ptr theResult)
+ void VISU_Gen_i::DeleteResult (Result_ptr theResult)
{
- class TEvent: public SALOME_Event{
+ class TEvent: public SALOME_Event {
Result_ptr myResult;
public:
TEvent(Result_ptr theResult): myResult(theResult) {}
- virtual void Execute(){
- if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(myResult).in())){
- SALOMEDS::SObject_var aSObject = aResult->GetSObject();
- SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
- if(CORBA::is_nil(aPrs3d)) continue;
- VISU::DeletePrs3d(aPrs3d);
+ virtual void Execute()
+ {
+ myResult->RemoveFromStudy();
+
+ //update Object browser
+ if (QAD_Desktop* aDesktop = QAD_Application::getDesktop()) {
+ if (Result_i* aResult = dynamic_cast<Result_i*>(GetServant(myResult).in())) {
+ SALOMEDS::SObject_var aSObject = aResult->GetSObject();
+ SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
+ if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
+ aStudy->updateObjBrowser();
}
-
- aResult->RemoveFromStudy();
- aResult->Destroy();
-
- if(QAD_Desktop* aDesktop = QAD_Application::getDesktop())
- if(QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
- aStudy->updateObjBrowser(); //update Object browser
}
+
+ myResult->Destroy();
}
};
ProcessVoidEvent(new TEvent(theResult));
}
-
void VISU_Gen_i::DeletePrs3d(Prs3d_ptr thePrs3d)
{
- class TEvent: public SALOME_Event{
+ class TEvent: public SALOME_Event {
Prs3d_ptr myPrs3d;
public:
TEvent(Prs3d_ptr thePrs3d): myPrs3d(thePrs3d) {}
- virtual void Execute(){
- VISU::DeletePrs3d(myPrs3d);
+ virtual void Execute() {
+ myPrs3d->RemoveFromStudy();
+
+ //update Object browser
+ if (QAD_Desktop* aDesktop = QAD_Application::getDesktop()) {
+ if (Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(myPrs3d).in())) {
+ SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
+ SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
+ if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
+ aStudy->updateObjBrowser();
+ }
+ }
+
+ myPrs3d->Destroy();
}
};
ProcessVoidEvent(new TEvent(thePrs3d));
}
-
}