@COMMENCE@
-EXPORT_PYSCRIPTS = \
- VisuGUI.py
-
# header files
EXPORT_HEADERS= \
VisuGUI_NonIsometricDlg.h
# Libraries targets
LIB = libVISUGUI.la
LIB_SRC = VisuGUI.cxx \
- VisuGUI_CellsResultsDlg.cxx \
- VisuGUI_PointsResultsDlg.cxx \
VisuGUI_Selection.cxx \
- VisuGUI_PhaseDlg.cxx \
- VisuGUI_PhaseMagnitudeDlg.cxx \
VisuGUI_MagnitudeDlg.cxx \
- VisuGUI_PartialScaDlg.cxx \
VisuGUI_IsoSurfacesDlg.cxx \
VisuGUI_CursorDlg.cxx \
VisuGUI_VectorsDlg.cxx \
VisuGUI_CutPlanesDlg.cxx \
- VisuGUI_SelVectCompDlg.cxx \
VisuGUI_ScalarBarDlg.cxx \
VisuGUI_SweepPrefDlg.cxx \
- VisuGUI_VisuAsDlg.cxx \
VisuGUI_NonIsometricDlg.cxx \
VisuGUI_StreamLinesDlg.cxx \
VisuGUI_TimeAnimation.cxx \
VisuGUI_CutLinesDlg.cxx \
- VisuGUI_FileDlg.cxx
+ VisuGUI_FileDlg.cxx \
+ VisuGUI_EditContainerDlg.cxx
LIB_MOC = \
VisuGUI.h \
- VisuGUI_CellsResultsDlg.h \
- VisuGUI_PointsResultsDlg.h \
- VisuGUI_PhaseDlg.h \
- VisuGUI_PhaseMagnitudeDlg.h \
VisuGUI_MagnitudeDlg.h \
- VisuGUI_PartialScaDlg.h \
VisuGUI_IsoSurfacesDlg.h \
VisuGUI_CursorDlg.h \
VisuGUI_VectorsDlg.h \
VisuGUI_CutPlanesDlg.h \
- VisuGUI_SelVectCompDlg.h \
VisuGUI_ScalarBarDlg.h \
VisuGUI_SweepPrefDlg.h \
- VisuGUI_VisuAsDlg.h \
VisuGUI_NonIsometricDlg.h \
VisuGUI_StreamLinesDlg.h \
VisuGUI_TimeAnimation.h \
VisuGUI_CutLinesDlg.h \
- VisuGUI_FileDlg.h
+ VisuGUI_FileDlg.h \
+ VisuGUI_EditContainerDlg.h \
+ VisuGUI_Selection.h
LIB_CLIENT_IDL = SALOME_Exception.idl \
VISU_Gen.idl \
CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) \
$(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
-I${KERNEL_ROOT_DIR}/include/salome
-
CXXFLAGS += -ftemplate-depth-32 $(OCC_CXXFLAGS) \
-I${KERNEL_ROOT_DIR}/include/salome
-
LDFLAGS += $(MED2_LIBS) $(HDF5_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeGUI -lSalomeNS \
- -lVisuObject -lVISUEngine -lmed -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome -L${KERNEL_ROOT_DIR}/lib/salome
+ -lVisuObject -lVISUEngine -lmed -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome
@CONCLUDE@
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2002-02-22 16:56:46 CET\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
+"PO-Revision-Date: 2003-10-07 11:25+0400\n"
"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
"Content-Type: text/plain; charset=iso-8859-1\n"
msgid "VisuGUI_MagnitudeDlg::VISU_MEN_PHASE"
msgstr "Magnitude"
-#: VisuGUI_PartialScaDlg.cxx:43
-msgid "VisuGUI_PartialScaDlg::&Cancel"
-msgstr "Cancel"
-
-#: VisuGUI_PartialScaDlg.cxx:30
-msgid "VisuGUI_PartialScaDlg::&Help"
-msgstr "Help"
-
-#: VisuGUI_PartialScaDlg.cxx:37
-msgid "VisuGUI_PartialScaDlg::&OK"
-msgstr "OK"
-
-#: VisuGUI_PartialScaDlg.cxx:76
-msgid "VisuGUI_PartialScaDlg::Max :"
-msgstr ""
-
-#: VisuGUI_PartialScaDlg.cxx:81
-msgid "VisuGUI_PartialScaDlg::Min :"
-msgstr ""
-
-#: VisuGUI_PartialScaDlg.cxx:49
-msgid "VisuGUI_PartialScaDlg::Min an Max limits of scalar Display"
-msgstr ""
-
-#: VisuGUI_PartialScaDlg.cxx:20
-msgid "VisuGUI_PartialScaDlg::MyDialog"
-msgstr "Partial Scalar"
-
-#: VisuGUI_PhaseDlg.cxx:43
-msgid "VisuGUI_PhaseDlg::VISU_BUT_CANCEL"
-msgstr "Cancel"
-
-#: VisuGUI_PhaseDlg.cxx:30
-msgid "VisuGUI_PhaseDlg::VISU_BUT_HELP"
-msgstr "Help"
-
-#: VisuGUI_PhaseDlg.cxx:37
-msgid "VisuGUI_PhaseDlg::VISU_BUT_OK"
-msgstr "OK"
-
-#: VisuGUI_PhaseDlg.cxx:54
-msgid "VisuGUI_PhaseDlg::VISU_MEN_PHASE"
-msgstr "Phase"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:83
-msgid "VisuGUI_PhaseMagnitudeDlg::&Cancel"
-msgstr "Cancel"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:70
-msgid "VisuGUI_PhaseMagnitudeDlg::&Help"
-msgstr "Help"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:77
-msgid "VisuGUI_PhaseMagnitudeDlg::&OK"
-msgstr "OK"
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:57
-msgid "VisuGUI_PhaseMagnitudeDlg::Magnitude :"
-msgstr ""
-
-#: VisuGUI_PhaseMagnitudeDlg.cxx:52
-msgid "VisuGUI_PhaseMagnitudeDlg::Phase :"
-msgstr ""
-
#: VisuGUI_VectorsDlg.cxx:47
msgid "VisuGUI_VectorsDlg::&Cancel"
msgstr "Cancel"
msgid "BUT_CLOSE"
msgstr "Close"
-msgid "VisuGUI_ScalarBarDlg::WRN_LOGARITHMIC_RANGE"
+msgid "BUT_CANCEL"
+msgstr "&Cancel"
+
+msgid "WRN_LOGARITHMIC_RANGE"
msgstr "Logarithmic scaling: use imposed range values > 0"
-msgid "VisuGUI_ScalarBarDlg::WRN_LOGARITHMIC_FIELD_RANGE"
+msgid "WRN_LOGARITHMIC_FIELD_RANGE"
msgstr "Logarithmic scaling: field range contains negative values, use imposed range instead"=======
msgid "TXT_ORIENTATION"
msgstr "Orientation"
msgstr "No Available data in selection"
msgid "ERR_CANT_BUILD_PRESENTATION"
-msgstr "The presentation can't be built"
+msgstr "The object can't be built"
msgid "ERR_CANT_CREATE_ACTOR"
msgstr "Can't create actor for this presentation"
msgid "MSG_NO_ANIMATIONDATA"
msgstr "There is no data for animation"
+
+msgid "LBL_SHOW_PREVIEW"
+msgstr "Show preview"
+
+msgid "LBL_GENERATE_TABLE"
+msgstr "Generate Data Table"
+
+msgid "LBL_GENERATE_CURVES"
+msgstr "Generate Curves"
+
+msgid "TIT_TEXT_PREF"
+msgstr "Text property"
+
+msgid "LBL_BOLD"
+msgstr "Bold"
+
+msgid "LBL_ITALIC"
+msgstr "Italic"
+
+msgid "LBL_SHADOW"
+msgstr "Shadow"
+
+msgid "LBL_TITLE"
+msgstr "Title"
+
+msgid "LBL_LABELS"
+msgstr "Labels"
+
#include "VISU_Actor.h"
#include "VISU_MeshAct.h"
-#include "VisuGUI_PhaseDlg.h"
#include "VisuGUI_MagnitudeDlg.h"
-#include "VisuGUI_PhaseMagnitudeDlg.h"
-#include "VisuGUI_PartialScaDlg.h"
#include "VisuGUI_CursorDlg.h"
#include "VisuGUI_ScalarBarDlg.h"
#include "VisuGUI_SweepPrefDlg.h"
#include "VisuGUI_VectorsDlg.h"
#include "VisuGUI_IsoSurfacesDlg.h"
#include "VisuGUI_StreamLinesDlg.h"
+#include "VisuGUI_EditContainerDlg.h"
#include "VisuGUI_TimeAnimation.h"
#include "VisuGUI_Selection.h"
-#include "VisuGUI_VisuAsDlg.h"
-#include "VisuGUI_SelVectCompDlg.h"
#include "VisuGUI_NonIsometricDlg.h"
#include "SALOMEGUI_ImportOperation.h"
#include <qthread.h>
#include <qlistbox.h>
#include <qcombobox.h>
+#include <qregexp.h>
//VRV: porting on Qt 3.0.5
#if QT_VERSION >= 0x030005
};
static VisuGUI MYVISUGUI;
-static VisuGUI *visuGUI = &MYVISUGUI;
+VisuGUI *visuGUI = &MYVISUGUI;
VISU::VISU_Gen_i* VisuGUI::GetVisuGen(){
VISU::VISU_Gen_i::GetVisuGenImpl()->SetCurrentStudy(GetStudyDocument());
if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()) vf->Repaint();
}
-/**
- * Returns selected sclalar mode or -1 if it was cancelled
- */
-int GetScalarMode(VISU::Result_i* theResult, const char* theFieldName){
- int aScalarMode = 0;
-// const VISU::TField* aField = theResult->GetInput()->GetField(theFieldName);
-// if(aField->myNbComp > 1){
-// VisuGUI_SelVectCompDlg* SelCompDlg = new VisuGUI_SelVectCompDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
-// if(SelCompDlg->exec()){
-// aScalarMode = SelCompDlg->whatIsChecked();
-// } else {
-// aScalarMode = -1;
-// }
-// delete SelCompDlg;
-// }
- return aScalarMode;
-}
-
-
-VisuGUI::VisuGUI(){}
+
+VisuGUI::VisuGUI(){
+ mySelectionDlg = 0;
+}
/* ==================================================================================== */
/* ==================================================================================== */
SALOMEDS::AttributeIOR_var anIOR;
switch (theCommandID){
- /* ======================================================================================== */
- /* Define Selection Mode */
- /* ======================================================================================== */
- case 101:
- case 102:
- case 103:
- case 104:
- {
- QApplication::setOverrideCursor( Qt::waitCursor );
- int mode = theCommandID - 100; // Point, Edge, Cell, Actor
- parent->SetSelectionMode( mode );
- QApplication::restoreOverrideCursor();
- }
- break;
-
/* ======================================================================================== */
/* Import Table from file */
/* ======================================================================================== */
/* Import Mesh from MED, DAT file */
/* ======================================================================================== */
+ case 111:
+ {
+ visuGUI->CopyAndImportFile();
+ break;
+ }
case 112:
{
- visuGUI->ImportFromFile();
+ visuGUI->ImportFile();
break;
}
visuGUI->CreateStreamLines();
break;
- /* ======================================================================================================================= */
- /* View Scalar Animation (Animation/scalar) */
- /* With Phase */
- /* ======================================================================================================================= */
-
- //case 4021 :
- //case 4022 :
- //case 4023 :
-
- /* ========================================================================================================================= */
- /* Selection - Cell by number */
- /* ========================================================================================================================= */
-
case 4111 :
- visuGUI->SelectCell();
- break;
-
- /* ========================================================================================================================= */
- /* Selection - Cell - information attribute */
- /* ========================================================================================================================= */
-
- case 4112 :
- visuGUI->InfoOnCell();
- break;
-
- /* ========================================================================================================================= */
- /* Selection - Point - information number */
- /* ========================================================================================================================= */
-
- case 4121 :
- visuGUI->SelectPoint();
- break;
-
- /* ========================================================================================================================= */
- /* Selection - Point - information attribute */
- /* ========================================================================================================================= */
-
- case 4122 :
- visuGUI->InfoOnPoint();
+ visuGUI->SelectionInfo();
break;
/* ========================================================================================================================= */
}
+void VisuGUI::SelectionInfo() {
+ if (mySelectionDlg) {
+ mySelectionDlg->close(true);
+ mySelectionDlg = 0;
+ }
+ mySelectionDlg = new VisuGUI_SelectionDlg();
+ mySelectionDlg->show();
+}
+
+
+
+
/* ********************************************************************************** */
/* Function ShowTrihedron */
/* ********************************************************************************** */
/* ********************************************************************************** */
void VisuGUI::ChangeViewer(int theType){
+ if(theType < 0 )
+ GetActiveStudy()->unHighlightAll();
if(vtkRenderer *aRen = GetRenderer()){
vtkActor *anActor;
vtkActorCollection *anActColl = aRen->GetActors();
CORBA::Object_var anObject = GetSelectedObj(&anIO);
if ( !CORBA::is_nil( anObject ) ) {
// is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if(aPrsObject){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Prs3d object");
UpdateViewer(aPrsObject);
return;
}
// is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject));
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
if(aCurve){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Curve object");
PlotCurve(aCurve, VISU::eDisplay );
return;
}
// is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject));
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
if(aContainer){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object");
PlotContainer(aContainer, VISU::eDisplay );
return;
}
// is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject));
+ VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
if(aTable){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object");
PlotTable(aTable, VISU::eDisplay );
CORBA::Object_var anObject = GetSelectedObj();
if ( !CORBA::is_nil( anObject ) ) {
// is it Prs3d object ?
- PortableServer::Servant aServant = VISU::GetServant(anObject);
- if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant)){
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if(VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Prs3d object");
UpdateViewer(aPrsObject, true);
VTKViewer_ViewFrame* vf = GetVtkViewFrame();
vf->getRenderer()->ResetCameraClippingRange();
vf->Repaint();
}
- }else if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant)){
+ }else if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Curve object");
PlotCurve(aCurve, VISU::eDisplayOnly );
- }else if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant)){
+ }else if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in())){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Container object");
PlotContainer(aContainer, VISU::eDisplayOnly );
- }else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aServant)){
+ }else if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aServant.in())){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyPrs : Table object");
PlotTable(aTable, VISU::eDisplayOnly );
}
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));
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if(aPrsObject){
if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Prs3d object");
ErasePrs(aPrsObject);
}
}
// is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject));
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in());
if(aCurve){
if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Curve object");
PlotCurve(aCurve, VISU::eErase );
}
// is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject));
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in());
if(aContainer){
if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Container object");
PlotContainer(aContainer, VISU::eErase );
}
// is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject));
+ VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in());
if(aTable){
if(MYDEBUG) MESSAGE("VisuGUI::ErasePrs : Table object");
PlotTable(aTable, VISU::eErase );
CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
if ( !CORBA::is_nil( aCORBAObject ) ) {
// is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
if(aPrsObject){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Prs3d object");
UpdateViewer(aPrsObject);
continue;
}
// is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
if(aCurve){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs: Curve object");
PlotCurve(aCurve, VISU::eDisplay );
continue;
}
// is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
if(aContainer){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Container object");
PlotContainer(aContainer, VISU::eDisplay );
continue;
}
// is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
if(aTable){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayManyPrs : Table object");
PlotTable(aTable, VISU::eDisplay );
CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
if ( !CORBA::is_nil( aCORBAObject ) ) {
// is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
if(aPrsObject){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Prs3d object");
UpdateViewer(aPrsObject, aFirstElem);
continue;
}
// is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
if(aCurve){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs: Curve object");
if (aFirstElem) {
continue;
}
// is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
if(aContainer){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Container object");
if (aFirstElem) {
continue;
}
// is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
if(aTable){
if(MYDEBUG) MESSAGE("VisuGUI::DisplayOnlyManyPrs : Table object");
if (aFirstElem) {
CORBA::Object_var aCORBAObject = VISU::SObjectToObject(aSObject);
if ( !CORBA::is_nil( aCORBAObject ) ) {
// is it Prs3d object ?
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(aCORBAObject).in());
if(aPrsObject){
if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Prs3d object");
ErasePrs(aPrsObject);
continue;
}
// is it Curve ?
- VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCORBAObject).in());
if(aCurve){
if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Curve object");
PlotCurve(aCurve, VISU::eErase );
continue;
}
// is it Container ?
- VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCORBAObject).in());
if(aContainer){
if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Container object");
PlotContainer(aContainer, VISU::eErase );
continue;
}
// is it Table ?
- VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject));
+ VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aCORBAObject).in());
if(aTable){
if(MYDEBUG) MESSAGE("VisuGUI::EraseManyPrs : Table object");
PlotTable(aTable, VISU::eErase );
QApplication::setOverrideCursor(Qt::waitCursor);
try{
thePrs->Update();
+ //UpdateViewer(thePrs); Avoid unnessary settings of visibility on for thePrs
for(int i = 0, nbFrames = GetActiveStudy()->getStudyFramesCount(); i < nbFrames; i++)
if(QAD_StudyFrame* aFrame = GetActiveStudy()->getStudyFrame(i)){
QAD_ViewFrame* aVFrame = aFrame->getRightFrame()->getViewFrame();
thePrs->UpdateActor(anActor);
}
}catch(std::runtime_error& ex){
+ QApplication::restoreOverrideCursor();
+ INFOS(ex.what());
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
+ tr ("VISU_BUT_OK") );
+ 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();
+ }
+ }
+ }
+ return;
}
QApplication::restoreOverrideCursor();
}
DlgName* aDlg = new DlgName(); \
aDlg->initFromPrsObject(aPrsObject); \
if ( aDlg->exec() ) { \
- aDlg->storeToPrsObject(aPrsObject); \
+ if(!(aDlg->storeToPrsObject(aPrsObject))){ \
+ delete aDlg; \
+ return; \
+ } \
RecreateActor(aPrsObject); \
- /*RepaintCurrentView();*/ \
if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) { \
if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) { \
vf->getRenderer()->ResetCameraClippingRange(); \
- vf->onViewFitAll(); \
vf->Repaint(); \
}\
} \
case VISU::TSCALARMAP: // ScalarMap 18
EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
break;
-
+
case VISU::TDEFORMEDSHAPE: // Deformed Shape 28
EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
break;
-
+
case VISU::TCUTPLANES: // Cut planes 42
- EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
+ //EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
+ {
+ VISU::CutPlanes_i* aPrsObject = dynamic_cast<VISU::CutPlanes_i*>(aPrs3d);
+ if (aPrsObject) {
+ VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, false);
+ aDlg->initFromPrsObject(aPrsObject);
+ aDlg->show();
+ myActiveDialogBox = aDlg;
+// if ( aDlg->exec() ) {
+// if(!(aDlg->storeToPrsObject(aPrsObject))){
+// delete aDlg;
+// return;
+// }
+// RecreateActor(aPrsObject);
+// if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
+// if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+// vf->getRenderer()->ResetCameraClippingRange();
+// vf->Repaint();
+// }
+// }
+// }
+// delete aDlg;
+ }
+ }
break;
case VISU::TCUTLINES: // Cut planes 42
- EDITPRS(VISU::CutLines_i, VisuGUI_CutLinesDlg);
+ //EDITPRS(VISU::CutLines_i, VisuGUI_CutLinesDlg);
+ {
+ VISU::CutLines_i* aPrsObject = dynamic_cast<VISU::CutLines_i*>(aPrs3d);
+ if (aPrsObject) {
+ VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(false);
+ aDlg->initFromPrsObject(aPrsObject);
+ aDlg->show();
+ myActiveDialogBox = aDlg;
+// if ( aDlg->exec() ) {
+// aDlg->storeToPrsObject(aPrsObject);
+// RecreateActor(aPrsObject);
+// if (VTKViewer_ViewFrame* vf = GetVtkViewFrame()) {
+// if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+// vf->getRenderer()->ResetCameraClippingRange();
+// vf->Repaint();
+// }
+// }
+// // Remove old Table
+// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
+// SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(aPrsObject->GetEntry());
+// if(!aSObject->_is_nil()) {
+// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+// for ( ;aIter->More(); aIter->Next()) {
+// SALOMEDS::SObject_var aTblObj = aIter->Value();
+// if (!aTblObj->_is_nil()) {
+// SALOMEDS::GenericAttribute_var anAttr;
+// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+// aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
+// break;
+// }
+// }
+// }
+// if (aDlg->isGenerateTable()) {
+// GetVisuGen()->CreateTable(aSObject->GetID());
+// if (aDlg->isGenerateCurves()) {
+// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
+// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+// for ( ;aIter->More(); aIter->Next()) {
+// SALOMEDS::SObject_var aTblObj = aIter->Value();
+// if (!aTblObj->_is_nil()) {
+// SALOMEDS::GenericAttribute_var anAttr;
+// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+// CreatePlot(aTblObj);
+// }
+// }
+
+// }
+// }
+// }
+// GetActiveStudy()->updateObjBrowser();
+// }
+// }
+// delete aDlg;
+ }
+ }
break;
case VISU::TISOSURFACE: // Iso surfaces
case VISU::TSTREAMLINES:
EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
+ break;
default:
return;
}
}
-//=====================================================================================
-// function : EditScalarBar()
-// purpose :
-//=====================================================================================
-void VisuGUI::EditScalarBar() {
- VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d();
- VISU::ScalarMap_i* aPrsObject = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
- if (aPrsObject) {
- VisuGUI_ScalarBarDlg* aDlg = new VisuGUI_ScalarBarDlg(false);
- aDlg->initFromPrsObject(aPrsObject);
- if ( aDlg->exec() ) {
- aDlg->storeToPrsObject(aPrsObject);
- RecreateActor(aPrsObject);
-
- VTKViewer_ViewFrame* vf = GetVtkViewFrame();
- if (vf)
- {
- vf->Repaint();
-
- Handle(SALOME_InteractiveObject) anIO;
- CORBA::Object_var anObject = GetSelectedObj(&anIO);
- if ( !CORBA::is_nil( anObject ) )
- vf->highlight(anIO, 1);
- }
-
- if (aDlg->isToSave())
- aDlg->storeToResources();
- }
- delete aDlg;
- }
-
-}
-
-
//=====================================================================================
// function : CreateMesh()
// purpose :
Utils_Timer timer;
timer.Start();
#endif
- VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()));
+ VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
if(aComment == "ENTITY"){
VISU::Entity anEntity = (VISU::Entity)VISU::Storable::FindValue(aMap,"myId").toInt();
if(VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity))
QApplication::restoreOverrideCursor();
VISU::Mesh_i* pPresent = NULL;
if(!CORBA::is_nil(aMesh))
- pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
+ pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
if (pPresent == NULL) {
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr ("ERR_CANT_BUILD_PRESENTATION"),
//GetActiveStudy()->updateObjBrowser(); //not necessary
GetDesktop()->putInfo("Ready");
}catch(std::runtime_error& exc){
+ INFOS(exc.what());
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr ("ERR_CANT_CREATE_ACTOR"),
tr ("VISU_BUT_OK") );
QApplication::restoreOverrideCursor();
if(CORBA::is_nil(aMesh)) return;
- VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
+ VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
try{
VISU_Actor *anActor = pPresent->CreateActor();
if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
}
GetDesktop()->putInfo("Ready");
}catch(std::runtime_error& exc){
+ INFOS(exc.what());
}
}
}
VISU::Prs3d_i* VisuGUI::GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO) {
CORBA::Object_var anObject = GetSelectedObj(theIO);
if(CORBA::is_nil(anObject)) return NULL;
- PortableServer::Servant aServant = VISU::GetServant(anObject);
- if(!aServant) return NULL;
- return dynamic_cast<VISU::Prs3d_i*>(aServant);
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if(!aServant.in()) return NULL;
+ return dynamic_cast<VISU::Prs3d_i*>(aServant.in());
}
void VisuGUI::ChageColor() {
if( !CORBA::is_nil( childObject ) ) {
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
+ VISU::Curve_i* theCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
Plot2d_Curve* plotCurve = 0;
for ( int i = 0; i < clist.count(); i++ ) {
if ( clist.at( i )->hasIO() && !strcmp( clist.at( i )->getIO()->getEntry(), theCurve->GetEntry() ) ) {
if ( !CORBA::is_nil( aVisuObj ) && aVisuObj->GetType() == VISU::TTABLE ) {
CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
if( !CORBA::is_nil( aTable ) ) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
+ VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
if ( table ) {
SO = GetActiveStudy()->getStudyDocument()->FindObjectID( table->GetObjectEntry() );
}
dlg->show();
}
+
/*!
Slot : opens Table view : for Table object or SObject with table attribute selected
*/
SALOMEDS::GenericAttribute_var anAttr;
if(!aCutLines->_is_nil() ||
aSObject->FindAttribute( anAttr, "AttributeTableOfInteger") ||
- aSObject->FindAttribute( anAttr, "AttributeTableOfReal" ) ){
+ aSObject->FindAttribute( anAttr, "AttributeTableOfReal" )) {
GetVisuGen()->CreateTable(aSObject->GetID());
GetActiveStudy()->updateObjBrowser();
}
}
}
+
+/*!
+ Slot : deletes SObject with all subobjects
+*/
+void VisuGUI::DeleteObject() {
+ SALOMEDS::Study_var aStudy = GetStudyDocument();
+ if (checkLock(aStudy)) return;
+
+ SALOME_Selection* aSel = SALOME_Selection::Selection( GetActiveStudy()->getSelection() );
+ 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::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;
+ }}
+ }
+ }
+ aStudyBuilder->RemoveObjectWithChildren(aSObject);
+ aStudyBuilder->CommitCommand();
+ GetActiveStudy()->unHighlightAll();
+ GetActiveStudy()->updateObjBrowser(true);
+ }
+ }
+}
+
+
+/*!
+ Slot : deletes 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.
*/
// Table (VISU object) is selected
CORBA::Object_ptr aTbl = VISU::Table::_narrow( anObject );
if( !CORBA::is_nil( aTbl ) ) {
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTbl ) );
+ VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTbl).in());
if ( table ) {
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeName_var aName;
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 ) );
+ 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 );
if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aNewCurve ) );
+ VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
if ( pCrv ) {
bool isAuto;
int marker, line, lineWidth;
// check if Table SObject is selected
SALOMEDS::SObject_var SO = GetActiveStudy()->getStudyDocument()->FindObjectID( Sel->firstIObject()->getEntry() );
- if ( !SO->_is_nil() && ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
- SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
+ if ( !SO->_is_nil() &&
+ ( SO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
+ SO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
// get name of SObject
if ( SO->FindAttribute( anAttr, "AttributeName" ) ) {
aName = SALOMEDS::AttributeName::_narrow( anAttr );
CORBA::Object_var aTable = GetVisuGen()->CreateTable( SO->GetID() );
CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
- VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
- VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ) );
+ VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
+ VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
if ( pContainer && pTable ) {
for ( int i = 0; i < verIndices.count(); i++ ) {
CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( pTable->_this(), horIndex+1, verIndices[i]+1 );
if( !CORBA::is_nil( aNewCurve ) ) {
- VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aNewCurve ) );
+ VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
if ( pCrv ) {
bool isAuto;
int marker, line, lineWidth;
}
}
}
- }
- else {
+ } else {
// if study is locked just get curves info and plot them if current viewer is of VIEW_PLOT2D type
if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
Plot2d_CurveContainer container;
}
}
delete dlg;
+ }
+ }
+}
+
+
+void VisuGUI::CreatePlot(SALOMEDS::SObject_var theTableSO) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+
+ if ( !theTableSO->_is_nil() &&
+ ( theTableSO->FindAttribute( anAttr, "AttributeTableOfInteger" ) ||
+ theTableSO->FindAttribute( anAttr, "AttributeTableOfReal" ) ) ) {
+ CORBA::Object_var aTable = VISU::SObjectToObject(theTableSO);
+ CORBA::Object_var aContainer = GetVisuGen()->CreateContainer();
+ if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) {
+ VISU::Table_i* pTable = dynamic_cast<VISU::Table_i*>( VISU::GetServant(aTable).in() );
+ VISU::Container_i* pContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant(aContainer).in() );
+
+ if ( pContainer && pTable ) {
+ for ( int i = 2; i <= pTable->GetNbRows(); i++ ) {
+ CORBA::Object_var aNewCurve = GetVisuGen()->CreateCurve( pTable->_this(), 1, i );
+ if( !CORBA::is_nil( aNewCurve ) ) {
+ VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aNewCurve).in() );
+ if ( pCrv ) {
+ pContainer->AddCurve( pCrv->_this() );
+ }
+ }
+ }
+ GetActiveStudy()->updateObjBrowser( true );
+ PlotContainer( pContainer, VISU::eDisplay );
+ }
}
}
}
+
+
/*!
Slot : Opens "Setup curve" dialog to set curve properties : for Curve object selected
*/
// Curve object
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
if( !CORBA::is_nil( aCurve ) ) {
- VISU::Curve_i* curve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
+ VISU::Curve_i* curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
if ( curve && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
SALOMEGUI_SetupCurveDlg* dlg = new SALOMEGUI_SetupCurveDlg( QAD_Application::getDesktop() );
dlg->setLine( (int)curve->GetLine(), curve->GetLineWidth() );
// Container object
CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
if( !CORBA::is_nil( aCnt ) ) {
- VISU::Container_i* container = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aCnt ) );
+ VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
if ( container && container->GetNbCurves() > 0 && !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
container->Clear();
GetActiveStudy()->updateObjBrowser();
}
}
+/*!
+ Slot : Edit container contents : for Container object selected
+*/
+void VisuGUI::EditContainer() {
+ CORBA::Object_var anObject = GetSelectedObj();
+ if(CORBA::is_nil(anObject)) return;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
+ if(!aServant.in()) return;
+ VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aServant.in());
+ if(!aContainer) return;
+
+ VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg();
+ aDlg->initFromPrsObject(aContainer);
+ if (aDlg->exec()) {
+ aDlg->storeToPrsObject(aContainer);
+ GetActiveStudy()->updateObjBrowser( true );
+ }
+ delete aDlg;
+}
+
void VisuGUI::DeletePrs() {
+ SALOMEDS::Study_var aStudy = GetStudyDocument();
+ if (checkLock(aStudy)) return;
+
+ // There is a transaction
+ SALOMEDS::StudyBuilder_var aStudyBuilder = VisuGUI::NewBuilder();
+ aStudyBuilder->NewCommand();
+
DeletePresentation(GetSelectedPrs3d());
+
+ aStudyBuilder->CommitCommand();
}
// Curve object
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
if( !CORBA::is_nil( aCurve ) ) {
- curve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) );
+ curve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
}
}
}
// Table object
CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
if( !CORBA::is_nil( aTable ) ) {
- table = dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
+ table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
}
}
}
// Curve object
CORBA::Object_ptr aContainer = VISU::Container::_narrow( anObject );
if( !CORBA::is_nil( aContainer ) ) {
- container = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ) );
+ container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainer).in());
}
}
}
GetActiveStudy()->updateObjBrowser();
}
-//=====================================================================================
-// function : InfoOnPoint() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::InfoOnPoint(){
- GetInfo(SelectionPoint,&(VisuGUI_Selection::PickingPoint));
-}
-
-//=====================================================================================
-// function : InfoOnCell() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::InfoOnCell(){
- GetInfo(SelectionCell,&(VisuGUI_Selection::PickingCell));
-}
-
-void VisuGUI::GetInfo(int theSelectionMode, TGetInfoFun theGetInfoFun){
- SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- if ( aSel->SelectionMode() == theSelectionMode ){
- Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d(&anIO)){
- TColStd_MapOfInteger aMapIndex;
- aSel->GetIndex(anIO,aMapIndex);
- TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex);
- if(anIter.More()){
- vtkDataSet* aDataSet = aPrs3d->GetPipeLine()->GetMapper()->GetInput();
- (*theGetInfoFun)(GetActiveStudy(), aDataSet, anIter.Key());
- return;
- }
- }
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- }else
- QAD_MessageBox::warn1( GetDesktop(),
- tr ("WARNING"),
- tr ("ERR_WRONG_SELECTION_MODE"),
- tr ("VISU_BUT_OK") );
-}
-
-//=====================================================================================
-// function : SelectPoint() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::SelectPoint(){
- Select(SelectionPoint,&vtkDataSet::GetNumberOfPoints,"Point selection","Point number:");
-}
-
-//=====================================================================================
-// function : SelectCell() [ slot ]
-// purpose :
-//=====================================================================================
-void VisuGUI::SelectCell(){
- Select(SelectionCell,&vtkDataSet::GetNumberOfCells,"Cell selection","Cell number:");
-}
-void VisuGUI::Select(int theSelectionMode, TSelectFun theSelectFun,
- const char* theTitle, const char* theRequest)
-{
- SALOME_Selection *aSel = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
- if(aSel->SelectionMode() == theSelectionMode){
- Handle(SALOME_InteractiveObject) anIO;
- if(VISU::Prs3d_i* aPrs3d = GetSelectedPrs3d(&anIO)){
- bool ok = FALSE;
- int anIndex = 0;
- TColStd_MapOfInteger aMapIndex;
- aSel->GetIndex(anIO,aMapIndex);
- TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex);
- if(anIter.More()) anIndex = anIter.Key();
- int anId = SALOMEGUI_SetValueDlg::getInteger( tr(theTitle),
- tr(theRequest),
- anIndex,
- &ok,
- GetDesktop());
- if(!ok) return;
- vtkDataSet* aDataSet = aPrs3d->GetPipeLine()->GetMapper()->GetInput();
- int aMaxId = (aDataSet->*theSelectFun)();
- if(0 <= anId && anId < aMaxId){
- VisuGUI_Selection::Highlight( GetActiveStudy(), anIO, anId );
- return;
- }
- }
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- tr ("VISU_WARNING"),
- tr ("WRN_NO_AVAILABLE_DATA"),
- tr ("VISU_BUT_OK"));
- }else
- QAD_MessageBox::warn1( GetDesktop(),
- tr ("WARNING"),
- tr ("ERR_WRONG_SELECTION_MODE"),
- tr ("VISU_BUT_OK") );
-}
//=====================================================================================
// function : DefinePopup()
int isViewer = (theParent.compare("ObjectBrowser") != 0), initId = isViewer? 800: 900;
QAD_ResourceMgr* rmgr = parent->createResourceManager();
+ bool aIsLocked = isStudyLocked( GetActiveStudy()->getStudyDocument() );
+
bool isVTKViewer = (GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK);
thePopup->clear();
SALOME_Selection* aSelection = SALOME_Selection::Selection(GetActiveStudy()->getSelection());
}
}
else if ( selMode == homoPresentable ) {
- thePopup->insertItem("Create Presentations", visuGUI, SLOT(CreateManyMesh()));
+ if (!aIsLocked) thePopup->insertItem("Create Presentations", visuGUI, SLOT(CreateManyMesh()));
}
else if ( selMode == homoAnimatable ) {
thePopup->insertItem( "Animation...", visuGUI, SLOT( TimeAnimation() ) );
if(MYDEBUG) MESSAGE("VisuGUI::CustomPopup - VISU object :: "<<aType);
switch (aType) {
case VISU::TVISUGEN:
- thePopup->insertItem("Import From File", visuGUI, SLOT(ImportFromFile()));
+ thePopup->insertItem("Import MED", visuGUI, SLOT(ImportFile()));
+ thePopup->insertItem("Import TABLE", visuGUI, SLOT(ImportTablesFromFile()));
+ thePopup->insertItem("Create Plot2d View", visuGUI, SLOT(CreatePlot2dView()));
break;
case VISU::TRESULT:
- //thePopup->insertItem("Create Mesh", visuGUI, SLOT(CreateMesh()));
- //thePopup->insertItem("Export To File", visuGUI, SLOT(ExportToFile()));
- //thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+ if (!aIsLocked) thePopup->insertItem("Delete", visuGUI, SLOT(DeleteObject()));
break;
case VISU::TTABLE:
- thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameTable() ) );
+ if (!aIsLocked) thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameTable() ) );
thePopup->insertItem( "Show Table", visuGUI, SLOT( ShowTable() ) );
- thePopup->insertItem( "Create Curves", visuGUI, SLOT( PlotData() ) );
+ if (!aIsLocked) thePopup->insertItem( "Create Curves", visuGUI, SLOT( PlotData() ) );
+ thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
+ thePopup->insertSeparator();
if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
if ( GetNbChildren( aSObject, false ) > 0 ) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
+ thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
}
}
+ thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
break;
case VISU::TCURVE:
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
+ if ( !aIsLocked ) {
thePopup->insertItem( "Properties", visuGUI, SLOT( CurveProperties() ) );
thePopup->insertItem( "Rename...", visuGUI, SLOT(Rename()));
}
break;
case VISU::TCONTAINER:
- if( !CORBA::is_nil( anObject ) ) {
- CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
- if( !CORBA::is_nil( aCnt ) ) {
- VISU::Container_i* container = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aCnt ) );
- if ( container && container->GetNbCurves() > 0 ) {
- if ( !isStudyLocked( GetActiveStudy()->getStudyDocument() ) ) {
- thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
- thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
- }
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
- thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
- thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
- thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
- }
- }
- }
+// if( !CORBA::is_nil( anObject ) ) {
+// CORBA::Object_ptr aCnt = VISU::Container::_narrow( anObject );
+// if( !CORBA::is_nil( aCnt ) ) {
+// VISU::Container_i* container = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aCnt).in());
+// if ( container ) {
+// if ( !aIsLocked ) {
+// thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
+// thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
+// if (container->GetNbCurves() > 0)
+// thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
+// }
+// if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
+// thePopup->insertSeparator();
+// thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
+// thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
+// thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
+// }
+// }
+// }
+// }
+ if ( !aIsLocked ) {
+ thePopup->insertItem( "Edit...", visuGUI, SLOT( EditContainer() ) );
+ thePopup->insertItem( "Rename...", visuGUI, SLOT( RenameContainer() ) );
+ thePopup->insertItem( "Clear", visuGUI, SLOT( ClearContainer() ) );
}
+ if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_PLOT2D ) {
+ thePopup->insertSeparator();
+ thePopup->insertItem( "Display", visuGUI, SLOT( DisplayPrs() ) );
+ thePopup->insertItem( "Erase", visuGUI, SLOT( ErasePrs () ) );
+ thePopup->insertItem( "Display Only", visuGUI, SLOT( DisplayOnlyPrs() ) );
+ }
+ if ( !aIsLocked ) thePopup->insertItem( "Delete", visuGUI, SLOT( DeleteObject() ) );
break;
default: // Presentation
{
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if (aPrsObject) {
if (isVTKViewer) {
// Add Presentation menu
thePopup->insertSeparator();
}
}
- thePopup->insertItem("Rename...", visuGUI, SLOT(Rename()));
+ if ( !aIsLocked ) thePopup->insertItem("Rename...", visuGUI, SLOT(Rename()));
if (aType != VISU::TMESH) {
- if (aType != VISU::TSCALARMAP)
- thePopup->insertItem("Edit...", visuGUI, SLOT(EditPrs()));
- thePopup->insertItem("Edit Scalar Bar...", visuGUI, SLOT(EditScalarBar()));
+ //if (aType != VISU::TSCALARMAP)
+ if ( !aIsLocked ) thePopup->insertItem("Edit...", visuGUI, SLOT(EditPrs()));
- if (aType == VISU::TCUTLINES)
- thePopup->insertItem( "Create Table", visuGUI, SLOT( CreateTable() ) );
-
+ if (aType == VISU::TCUTLINES) {
+ // Check: Does it has living children (tables)
+ SALOMEDS::ChildIterator_var aIter =
+ GetActiveStudy()->getStudyDocument()->NewChildIterator( aSObject );
+ bool isPresent = false;
+ for ( ;aIter->More(); aIter->Next()) {
+ SALOMEDS::SObject_var aTblObj = aIter->Value();
+ isPresent = !aTblObj->_is_nil();
+ if (isPresent) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ isPresent = aTblObj->FindAttribute(anAttr, "AttributeName");
+ if (isPresent) break; // We have at least a one child
+ }
+ }
+ if ((!isPresent) && (!aIsLocked) )
+ thePopup->insertItem( "Create Table", visuGUI, SLOT( CreateTable() ) );
+ }
thePopup->insertItem("Sweep", visuGUI, SLOT(Sweep()));
}
( aType == VISU::TMESH ||
aType == VISU::TSCALARMAP ||
aType == VISU::TDEFORMEDSHAPE ) ) {
- thePopup->insertSeparator();
- TColStd_MapOfInteger aMapIndex;
- aSelection->GetIndex(anIO,aMapIndex);
- if ( aSelection->SelectionMode() == SelectionPoint ) {
- if(aMapIndex.Extent() == 1)
- thePopup->insertItem("Results at Point", visuGUI, SLOT(InfoOnPoint()));
- thePopup->insertItem("Select a Point", visuGUI, SLOT(SelectPoint()));
- }
- else if ( aSelection->SelectionMode() == SelectionCell) {
- if(aMapIndex.Extent() == 1)
- thePopup->insertItem("Results on Cell", visuGUI, SLOT(InfoOnCell()));
- thePopup->insertItem("Select a Cell", visuGUI, SLOT(SelectCell()));
- }
+ thePopup->insertSeparator();
+ thePopup->insertItem("Selection info...", visuGUI, SLOT(SelectionInfo()));
}
thePopup->insertSeparator();
thePopup->insertItem("Display Only", visuGUI, SLOT(DisplayOnlyPrs()));
}
- if (aType != VISU::TMESH) {
- thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+ thePopup->insertItem("Delete", visuGUI, SLOT(DeletePrs()));
+ if ((aType != VISU::TMESH) && (!aIsLocked)) {
thePopup->insertSeparator();
thePopup->insertItem("Same As", visuGUI, SLOT(CopyPresentation()));
}
case VISU::TENTITY:
case VISU::TFAMILY:
case VISU::TGROUP:
- thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));
+ if ( !aIsLocked )thePopup->insertItem("Create Presentation", visuGUI, SLOT(CreateMesh()));
break;
case VISU::TVIEW3D:
- if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
- // Available only for VTK viewer
- thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
- thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
+ if ( !aIsLocked ) {
+ if ( GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
+ // Available only for VTK viewer
+ thePopup->insertItem( "Save view parameters", visuGUI, SLOT( SaveViewParams() ) );
+ thePopup->insertItem( "Restore view parameters", visuGUI, SLOT( RestoreViewParams() ) );
+ }
+ thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
+ thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
}
- thePopup->insertItem( "Rename...", visuGUI, SLOT( Rename() ) );
- thePopup->insertItem("Delete", visuGUI, SLOT(DeleteViewParams()));
break;
case VISU::TFIELD:
if ((getValue(aSObject, "myNbTimeStamps").toLong() > 1) && isVTKViewer)
aSObject->FindAttribute( anAttr, "AttributeTableOfReal" )){
thePopup->insertItem( "Show Table", visuGUI, SLOT(ShowTable()));
thePopup->insertItem( "Create Curves", visuGUI, SLOT(PlotData()));
+ thePopup->insertItem( "Export Table", visuGUI, SLOT( ExportTableToFile() ) );
return false;
}
aSObject = aSObject->GetFather();
+ if(aSObject->_is_nil()) return false;
aSObject->FindAttribute(anAttr, "AttributeName");
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ if(aName->_is_nil()) return false;
CORBA::String_var aValue = aName->Value();
//if(strcmp(aValue.in(),"MEDMESH") == 0)
// thePopup->insertItem( "Import MED", visuGUI, SLOT( ImportMedField() ) );
CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
if(!CORBA::is_nil(anObject)) {
- VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject));
+ VISU::Prs3d_i* aPrsObject = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in());
if ( !aPrsObject ) {
if(MYDEBUG) MESSAGE("The object is not VISU::Prs3d_i");
return;
if(VTKViewer_ViewFrame* vf = GetVtkViewFrame())
vf->AddActor(SelectedActor);
}catch(std::runtime_error& exc){
+ INFOS(exc.what());
}
}else
if(MYDEBUG) MESSAGE("CORBA::is_nil(anObject) = true");
CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
if(CORBA::is_nil(anObject)) return NULL;
theResult = VISU::Result::_narrow(anObject);
- VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject));
+ VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
if(pResult == NULL)
QAD_MessageBox::warn1(QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr ("WRN_NO_AVAILABLE_DATA"),
VISU::Result_var aResult; \
VISU::Result_i* pResult = CreatePresent(theField,aResult); \
if(pResult != NULL){ \
- if(PRSTYPE::IsPossible(pResult,theMeshName,(VISU::Entity)theEntity,theFieldName,theTimeId)){ \
- QApplication::setOverrideCursor( Qt::waitCursor ); \
- CORBA::Object_var anObject = \
- GetVisuGen()->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
- QApplication::restoreOverrideCursor(); \
- if(!CORBA::is_nil(anObject)) \
- return dynamic_cast<PRSTYPE*>(VISU::GetServant(anObject)); \
- } \
+ QApplication::setOverrideCursor( Qt::waitCursor ); \
+ CORBA::Object_var anObject = \
+ GetVisuGen()->FCREATE(aResult,theMeshName,theEntity,theFieldName,theTimeId); \
+ QApplication::restoreOverrideCursor(); \
+ if(!CORBA::is_nil(anObject)) \
+ return dynamic_cast<PRSTYPE*>(VISU::GetServant(anObject).in()); \
} \
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"), \
tr ("ERR_CANT_BUILD_PRESENTATION"), \
if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){ \
DLGNAME* aDlg = new DLGNAME(); \
aDlg->initFromPrsObject(pPresent); \
- if (aDlg->exec()) { \
- aDlg->storeToPrsObject(pPresent); \
+ if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) { \
+ delete aDlg; \
} else { \
DeletePresentation(pPresent); \
delete aDlg; \
return false; \
} \
- delete aDlg; \
} \
CreateActor(pPresent); \
return true; \
BUILDPRS(VISU::DeformedShape_i, CreateDeformedShapePrs, VisuGUI::CreateDeformedShape, VisuGUI_MagnitudeDlg);
BUILDPRS(VISU::Vectors_i, CreateVectorsPrs, VisuGUI::CreateVectors, VisuGUI_VectorsDlg);
BUILDPRS(VISU::IsoSurfaces_i, CreateIsoSurfacesPrs, VisuGUI::CreateIsoSurfaces, VisuGUI_IsoSurfacesDlg);
-BUILDPRS(VISU::CutPlanes_i, CreateCutPlanesPrs, VisuGUI::CreateCutPlanes, VisuGUI_CutPlanesDlg);
-BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg);
+//BUILDPRS(VISU::CutPlanes_i, CreateCutPlanesPrs, VisuGUI::CreateCutPlanes, VisuGUI_CutPlanesDlg);
+//BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg);
BUILDPRS(VISU::StreamLines_i, CreateStreamLinesPrs, VisuGUI::CreateStreamLines, VisuGUI_StreamLinesDlg);
+bool VisuGUI::CreateCutPlanes(SALOMEDS::SObject_var theField) {
+ VISU::Storable::TRestoringMap aMap = getMapOfValue(theField);
+ bool isExist;
+ QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist);
+ if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false;
+ QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
+ QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
+ QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
+ QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+ Utils_Timer timer;
+ if(MYCHECKTIME) timer.Start();
+ VISU::CutPlanes_i* pPresent =
+ CreateCutPlanesPrs(theField,aMeshName,(VISU::Entity)anEntity.toInt(),aFieldName,aTimeStampId.toInt());
+ if(MYCHECKTIME) {
+ timer.Stop();
+ cout<<"BUILDPRS(TYPE, FCREATE, FNAME, DLGNAME) - CREATE PRSOBJECT\n";
+ timer.Show();
+ }
+ if (pPresent) {
+ QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
+ if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){
+ VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(true, false);
+ aDlg->initFromPrsObject(pPresent);
+ aDlg->show();
+ myActiveDialogBox = aDlg;
+// if (aDlg->exec() && (aDlg->storeToPrsObject(pPresent))) {
+// delete aDlg;
+// } else {
+// DeletePresentation(pPresent);
+// delete aDlg;
+// return false;
+// }
+// }
+// CreateActor(pPresent);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool VisuGUI::CreateCutLines(SALOMEDS::SObject_var theField) {
+ VISU::Storable::TRestoringMap aMap = getMapOfValue(theField);
+ bool isExist;
+ QString aType = VISU::Storable::FindValue(aMap,"myType",&isExist);
+ if(!isExist || aType.toInt() != VISU::TTIMESTAMP ) return false;
+ QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName",&isExist).latin1();
+ QString anEntity = VISU::Storable::FindValue(aMap,"myEntityId",&isExist).latin1();
+ QString aFieldName = VISU::Storable::FindValue(aMap,"myFieldName",&isExist).latin1();
+ QString aTimeStampId = VISU::Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1();
+ Utils_Timer timer;
+ if(MYCHECKTIME) timer.Start();
+ VISU::CutLines_i* pPresent = CreateCutLinesPrs(theField,aMeshName,
+ (VISU::Entity)anEntity.toInt(),
+ aFieldName,aTimeStampId.toInt());
+ if(MYCHECKTIME) {
+ timer.Stop();
+ cout<<"BUILDPRS(VISU::CutLines_i, CreateCutLinesPrs, VisuGUI::CreateCutLines, VisuGUI_CutLinesDlg) - CREATE PRSOBJECT\n";
+ timer.Show();
+ }
+ if (pPresent) {
+ QString aValue = QAD_CONFIG->getSetting("Visu:BuildDefaultPrs3d");
+ if(aValue.isEmpty() || (!aValue.isEmpty() && !aValue.toInt())){
+ VisuGUI_CutLinesDlg* aDlg = new VisuGUI_CutLinesDlg(true);
+ aDlg->initFromPrsObject(pPresent);
+ aDlg->show();
+ myActiveDialogBox = aDlg;
+ return true;
+// if (aDlg->exec()) {
+// aDlg->storeToPrsObject(pPresent);
+// if (aDlg->isGenerateTable()) {
+// GetVisuGen()->CreateTable(pPresent->GetEntry());
+// if (aDlg->isGenerateCurves()) {
+// SALOMEDS::Study_var aStudy = GetActiveStudy()->getStudyDocument();
+// SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(pPresent->GetEntry());
+// if(!aSObject->_is_nil()) {
+// SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+// SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+// for ( ;aIter->More(); aIter->Next()) {
+// SALOMEDS::SObject_var aTblObj = aIter->Value();
+// if (!aTblObj->_is_nil()) {
+// SALOMEDS::GenericAttribute_var anAttr;
+// if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+// CreatePlot(aTblObj);
+// }
+// }
+// }
+// }
+// }
+// GetActiveStudy()->updateObjBrowser();
+// }
+// } else {
+// DeletePresentation(pPresent);
+// delete aDlg;
+// return false;
+// }
+// delete aDlg;
+// }
+// CreateActor(pPresent);
+// return true;
+ }
+ }
+ return false;
+}
+
+
/* ======================================================================================== */
/* Global Method to import tables from file */
/* ======================================================================================== */
void VisuGUI::ImportTablesFromFile(){
+ if (checkLock(GetActiveStudy()->getStudyDocument())) return;
QStringList flt;
flt.append( "Files (*.xls *.txt *.tab)" );
flt.append( "All Files (*.*)" );
}
GetActiveStudy()->updateObjBrowser(); //update Object browser
}
-}
+}
+
+void VisuGUI::ExportTableToFile()
+{
+ QAD_Study *aQADStudy = VisuGUI::GetActiveStudy();
+ SALOME_Selection* aSel = SALOME_Selection::Selection ( aQADStudy -> getSelection() );
+
+ if( aSel->IObjectCount() > 0 ) {
+ const Handle(SALOME_InteractiveObject)& anIO = aSel->firstIObject();
+ if(anIO->hasEntry()){
+ SALOMEDS::Study_var aStudy = aQADStudy->getStudyDocument();
+ SALOMEDS::SObject_var aSObj = aStudy -> FindObjectID(anIO->getEntry());
+ if(CORBA::is_nil(aSObj)) return;
+
+ QString aTitle;
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") &&
+ !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+ aSObj = aSObj->GetFather(); //if the current SObject is a table title
+ // we take a father contaning the table
+ if (!CORBA::is_nil(aSObj)) {
+ if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal") &&
+ !aSObj->FindAttribute(anAttr, "AttributeTableOfInteger"))
+ return;
+ }
+ else return;
+ }
+ if (CORBA::is_nil(anAttr)) return;
+
+ SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+ if (!CORBA::is_nil(aTabAttr))
+ aTitle = aTabAttr->GetTitle(); //get table title in order to have default name of the file
+ else {
+ SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger::_narrow(anAttr);
+ if (!CORBA::is_nil(aTabAttr))
+ aTitle = aTabAttr->GetTitle(); //get table title in order to have default name of the file
+ else return;
+ }
+ aTitle.simplifyWhiteSpace();
+ QStringList flt;
+ flt.append("Table Files (*.xls)");
+
+ QAD_FileDlg *aDlg = new QAD_FileDlg(QAD_Application::getDesktop(), false, true, true);
+ aDlg -> setCaption("Export Table To File");
+ aDlg -> setDir( getVisuOutputDir() );
+ aDlg -> setFilters(flt);
+ aDlg -> setSelection(aTitle.replace(QRegExp(" "), "_"));
+ aDlg -> exec();
+ QString aFile = aDlg -> selectedFile();
+ delete aDlg;
+
+ if(!aFile.isEmpty()){
+ QAD_Application::getDesktop()->putInfo( "Exporting To File " + aFile + "..." );
+ QString aDir = QAD_Tools::getDirFromPath(aFile);
+ QAD_CONFIG->addSetting("Visu:OutputDir",aDir);
+
+ try {
+ GetVisuGen() -> ExportTableToFile(aSObj, aFile.latin1());
+ QAD_Application::getDesktop()->putInfo(aFile+" exported.");
+ } catch(...) {
+ QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+ tr ("ERR_ERROR_DURING_EXPORT"),
+ tr ("VISU_BUT_OK") );
+ }
+ }
+ }
+ }
+}
/* ======================================================================================== */
/* Global Method to import mesh results in MED and DAT format */
/* ======================================================================================== */
-void VisuGUI::ImportFromFile(){
+void VisuGUI::ImportFile(){
+ VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::ImportFile);
+}
+void VisuGUI::CopyAndImportFile(){
+ VisuGUI::ImportFromFile(&VISU::VISU_Gen_i::CopyAndImportFile);
+}
+void VisuGUI::ImportFromFile(TImportFun theImportFun){
if (checkLock(GetActiveStudy()->getStudyDocument())) return;
QStringList flt;
//flt.append( "Exportable Files (*.med *.dat)" );
if(aFileInfo.extension(false) == "med"){
QString IsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
bool isBuild = (IsBuild.isEmpty()? 0 : IsBuild.toInt());
-
- if (VisuGUI_FileDlg::IsBuild)
- {
- aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
- if(!CORBA::is_nil(aResult.in())) aResult->BuildAll();
- }
- else
- {
- QAD_CONFIG->addSetting( "Visu:BuildResult", false );
- aResult=GetVisuGen()->ImportFile( aFileInfo.filePath() );
- QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
- }
+ if (VisuGUI_FileDlg::IsBuild){
+ aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
+ if(!CORBA::is_nil(aResult.in()))
+ if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(GetServant(aResult).in())){
+ if(!pResult->IsPossible())
+ QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+ tr ("ERR_CANT_BUILD_PRESENTATION"),
+ tr ("VISU_BUT_OK") );
+ else
+ aResult->BuildAll();
+ }
+ }else{
+ QAD_CONFIG->addSetting( "Visu:BuildResult", false );
+ //aResult=(GetVisuGen()->*theImportFun)(aFileInfo.filePath()); APO: 18/12/03 - fix crash on Linux RedHat 7.1
+ aResult=GetVisuGen()->ImportFile(aFileInfo.filePath()); // APO: 18/12/03 - fix crash on Linux RedHat 7.1
+ QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
+ }
}
-
#ifdef CHECKTIME
timer.Stop();
cout<<"VisuGUI::ImportFromFile() - IMPORT FILE\n";
void VisuGUI::ExportToFile(){
CORBA::Object_var anObject = GetSelectedObj();
if(CORBA::is_nil(anObject)) return;
- VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject));
+ VISU::Base_i* aBase = dynamic_cast<VISU::Base_i*>(VISU::GetServant(anObject).in());
if(aBase != NULL && aBase->GetType() == VISU::TRESULT){
QStringList flt;
flt.append( "Dat Files (*.dat)" );
anVISUActor = thePrs->CreateActor();
vf->AddActor(anVISUActor);
}catch(std::runtime_error& exc){
+ INFOS(exc.what());
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr ("ERR_CANT_VISUALIZE_OBJECT"),
tr ("VISU_BUT_OK") );
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(VTKViewer_ViewFrame* aViewFrame = dynamic_cast<VTKViewer_ViewFrame*>(aVFrame)){
if(VISU_Actor* anActor = GetActor(thePrs,aViewFrame)){
aViewFrame->RemoveActor(anActor);
anActor->Delete();
}
+ aViewFrame->unHighlightAll();
+ }
}
- thePrs->Destroy();
+ thePrs->RemoveFromStudy();
GetActiveStudy()->updateObjBrowser(); //update Object browser
}
* Creates new actor of presentation
*/
void VisuGUI::CreateActor(VISU::Prs3d_i* thePrs) {
+ if (GetActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
if (!thePrs) return;
QApplication::setOverrideCursor( Qt::waitCursor );
if(VTKViewer_ViewFrame* vf = GetVtkViewFrame()){
VISU_Actor* aActor = thePrs->CreateActor();
vf->AddActor(aActor);
}catch(std::runtime_error& exc){
+ INFOS(exc.what());
QApplication::restoreOverrideCursor();
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr ("WRN_CANT_VISUALIZE_PRS"),
class VISU_Actor;
class VISU_MeshAct;
class VISU_ScalarMapAct;
+class VisuGUI_SelectionDlg;
#include <vtkDataSet.h>
class vtkRenderer;
enum CameraOrient {e3D, eFront, eLeft, eTop};
static CameraOrient SetFitAll( VTKViewer_ViewFrame* vf);
+ typedef VISU::Result_ptr (VISU::VISU_Gen_i::* TImportFun)(const char*);
+ void ImportFromFile(TImportFun theImportFun);
+
bool CreateScalarMap(SALOMEDS::SObject_var theField);
static VISU::ScalarMap_i* CreateScalarMapPrs(SALOMEDS::SObject_var theField,
const char* theMeshName, VISU::Entity theEntity,
const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theTimeId);
bool TestObjectBrowser(SALOMEDS::SObject_var& objVisu);
-
- typedef void (*TGetInfoFun)(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId);
- void GetInfo(int theSelectionMode, TGetInfoFun theGetInfoFun);
-
- typedef int (vtkDataSet::* TSelectFun)();
- void Select(int theSelectionMode, TSelectFun theSelectFun,
- const char* theTitle, const char* theRequest);
-
+
static void ShowTrihedron(bool Show);
static void ChangeViewer(int theType);
static QString getValue(SALOMEDS::SObject_var theSObject, QString theKey);
static int checkHomoSelection();
- VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
- bool IsDisplayed(VISU::Prs3d_i* thePrs);
- void ErasePrs(VISU::Prs3d_i* thePrs);
+ static VISU_Actor* UpdateViewer(VISU::Prs3d_i* thePrs, bool theDispOnly=false);
+ static bool IsDisplayed(VISU::Prs3d_i* thePrs);
+ static void ErasePrs(VISU::Prs3d_i* thePrs);
static VISU::Prs3d_i* GetSelectedPrs3d(Handle(SALOME_InteractiveObject)* theIO = NULL);
static void RecreateActor(VISU::Prs3d_i* thePrs);
void EmitSignalCloseAllDialogs();
QDialog* GetActiveDialogBox();
void SetActiveDialogBox(QDialog* aDlg);
-
+
+ void CreatePlot(SALOMEDS::SObject_var theTableSO);
+
// ----------------------------------------
// All method of standard EXPORT
// ----------------------------------------
QAD_StudyFrame* studyFrame);
public slots:
void ImportTablesFromFile();
- void ImportFromFile();
+ void ExportTableToFile();
+
+ void ImportFile();
+ void CopyAndImportFile();
+
void ExportToFile();
+
void CreateMesh();
void CreateScalarMap();
void CreateDeformedShape();
void CreateCutLines();
void CreateStreamLines();
void CreateManyMesh();
+ void CreatePlot2dView();
void DisplayPrs();
void DisplayOnlyPrs();
void ErasePrs();
void EditPrs();
- void EditScalarBar();
void DisplayManyPrs();
void DisplayOnlyManyPrs();
void EraseManyPrs();
+ void EditContainer();
void MakeSurfaceframe();
void MakeInsideframe();
void ShowTable();
void CreateTable();
+ void DeleteObject();
void PlotData();
void CurveProperties();
void ClearContainer();
void DeleteViewParams();
void CopyPresentation();
- void InfoOnPoint();
- void InfoOnCell();
+ void SelectionInfo();
- void SelectPoint();
- void SelectCell();
-
private :
QDialog* myActiveDialogBox;
int myState ;
+ VisuGUI_SelectionDlg* mySelectionDlg;
signals:
void SignalDeactivateActiveDialog();
+++ /dev/null
-# VISU VISUGUI : GUI of VISU component
-#
-# Copyright (C) 2003 CEA/DEN, EDF R&D
-#
-#
-#
-# File : VisuGUI.py
-# Module : VISU
-
-class Row:
- def __init__(self):
- self.title = ""
- self.unit = ""
- self.values = []
- return
- pass
-
-class Table2D:
- def __init__(self):
- self.title = ""
- self.columnTitles = []
- self.columnUnits = []
- self.rows = []
- return
- def getColumns(self):
- nb = len(self.rows[0].values)
- cols = []
- for i in range(nb):
- col = Row()
- for r in self.rows:
- col.values.append(r.values[i])
- pass
- print self.columnTitles
- if len(self.columnTitles)>i:
- col.title = self.columnTitles[i]
- print col.title
- pass
- if len(self.columnUnits)>i:
- col.unit = self.columnUnits[i]
- pass
- cols.append(col)
- pass
- return cols
- pass
-
-def AddTablesInStudyFromFile(ffile):
- from exceptions import IOError
- try:
- file = open(ffile, 'r')
- except :
- msg="can't open file <%s>...\n"%ffile
- raise IOError(msg)
- # --
- is_table_first_line = 1
- tables = []
- # --
- num = 0
- for line in file.readlines():
- num += 1
- line = line.strip()
- if len(line)==0:
- is_table_first_line = 1
- continue
- if is_table_first_line:
- is_table_first_line = 0
- t = Table2D()
- tables.append(t)
- pass
- if line.find('#TITLE:')==0:
- t.title = line.split('#TITLE:')[1].strip()
- continue
- if line.find('#COLUMN_TITLES:')==0:
- titles = line.split('#COLUMN_TITLES:')[1].split("|")
- t.columnTitles = [ title.strip() for title in titles ]
- continue
- if line.find('#COLUMN_UNITS:')==0:
- units = line.split('#COLUMN_UNITS:')[1].split()
- t.columnUnits = [ unit.strip() for unit in units ]
- continue
- if line[0]== '#':
- continue
- row = Row()
- if line.find('#TITLE:')>0:
- row.title = line.split('#TITLE:')[1].strip()
- line = line.split('#TITLE:')[0]
- pass
- values = line.split()
- floatingValues = []
- for val in values :
- try:
- val = float(val)
- except ValueError:
- message = "Syntax error at line " + str(num) + " ... \n"
- message += "Found field : " + str(val) + '\n'
- message += "instead of a floating point number"
- import qt
- qt.QMessageBox.warning(None,"Error",message)
- return
- floatingValues.append(val)
- pass
-
- if len(t.rows)>0:
- if len(t.rows[0].values) != len(floatingValues):
- message = "Syntax error at line " + str(num) + " ... \n"
- message += "All rows must have the same number of fields"
- import qt
- qt.QMessageBox.warning(None,"Error",message)
- return
- pass
-
- row.values = floatingValues
- t.rows.append(row)
- pass
-
- import salome
- myStudy = salome.myStudy
- myBuilder = myStudy.NewBuilder()
-
- # >>> Getting (loading) VISU component =======================================
- myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
- myComponent = myStudy.FindComponent("VISU")
- if not myComponent:
- myComponent = myBuilder.NewComponent("VISU")
- aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
- #aName.SetValue("Visu")
- aName.SetValue( salome.sg.getComponentUserName("VISU") )
- myBuilder.DefineComponentInstance(myComponent,myVisu)
- pass
-
- # >>> Creating object with file name =====================================
- myFileObject = myBuilder.NewObject(myComponent)
- AName = myBuilder.FindOrCreateAttribute(myFileObject, "AttributeName")
- import os.path
- AName.SetValue(os.path.basename(ffile))
-
- num = 1
- for t in tables:
- # >>> Creating object with Table of real =====================================
- myTRealObject = myBuilder.NewObject(myFileObject)
- AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName")
- if t.title:
- AName.SetValue(t.title)
- else:
- AName.SetValue("Table "+str(num))
- pass
- num = num+1
- ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal")
- if t.title:
- ARealTable.SetTitle(t.title)
- pass
- cols = t.getColumns()
- for col in cols:
- ARealTable.AddRow(col.values)
- ARealTable.SetRowTitle(cols.index(col)+1, col.title)
- ARealTable.SetRowUnit(cols.index(col)+1, col.unit)
- # ARealTable.SetColumnTitles(l.values())
- pass
- pass
-
-
-
- # >>> Updating Object Browser ================================================
- salome.sg.updateObjBrowser(1)
-
-
- return
-
#include "VisuGUI_CutLinesDlg.h"
#include "VISU_CutLines_i.hh"
+#include "VisuGUI.h"
+#include "VISU_PipeLine.hxx"
+#include "VTKViewer_ViewFrame.h"
+#include "VISU_CutLinesPL.hxx"
+#include "VISU_Gen_i.hh"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
#include <qtabwidget.h>
#include <qhgroupbox.h>
+#include <vtkRenderer.h>
+#include <vtkAppendPolyData.h>
+#include <vtkDataSetMapper.h>
+
using namespace std;
-VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+extern VisuGUI *visuGUI;
+
+#include "QAD_RightFrame.h"
+#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
+
+bool VisuGUI_CutLinesDlg::MYGenerateTable = true;
+bool VisuGUI_CutLinesDlg::MYGenerateCurve = true;
+
+VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg(bool theIsCreation)
+ : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+ myPreviewActor(0),
+ myStudy(QAD_Application::getDesktop()->getActiveStudy())
{
+ myStudyFrame = myStudy -> getActiveStudyFrame();
setCaption( "Cut Lines Definition" );
setSizeGripEnabled( true );
+ myIsCreation = theIsCreation;
QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6);
aMainLayout->setSpacing(5);
myPosSpn = new QAD_SpinBoxDbl( aPosBox, 0, 1, 0.1 );
myPosSpn->setValue( 0.5 );
aPlaneLayout->addWidget( aPosBox );
+
+ myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), aPlanePane);
+ myPreviewCheck->setChecked(false);
+ aPlaneLayout->addWidget( myPreviewCheck );
+
+ myCreateTable = new QCheckBox(tr("LBL_GENERATE_TABLE"), aPlanePane);
+ myCreateTable->setChecked(MYGenerateTable);
+ aPlaneLayout->addWidget( myCreateTable );
+
+ QHBox* aCheckPane = new QHBox(aPlanePane);
+ QLabel* aLbl = new QLabel(" ", aCheckPane);
+ aCheckPane->setStretchFactor(aLbl, 0);
+ myCurvesCheck = new QCheckBox(tr("LBL_GENERATE_CURVES"), aCheckPane);
+ aCheckPane->setStretchFactor(aCheckPane, 0);
+ myCurvesCheck->setChecked(MYGenerateCurve);
+ myCurvesCheck->setEnabled(MYGenerateTable);
+ QLabel* aLbl2 = new QLabel(" ", aCheckPane);
+ aCheckPane->setStretchFactor(aLbl2, 1);
+ aPlaneLayout->addWidget( aCheckPane );
+
aPlaneLayout->addStretch();
+
aTabPane->addTab( aPlanePane, tr("LBL_LINES_PLANE") );
// Number of lines
aTabPane->addTab( aLinesPane, tr("LBL_LINES_CUT") );
+ myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+ myScalarPane->setMargin( 5 );
+ aTabPane->addTab(myScalarPane, "Scalar Bar");
+
aMainLayout->addWidget(aTabPane);
// Dialog buttons
QHBox* aBtnBox = new QHBox(this);
+ aBtnBox->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ aBtnBox->setLineWidth( 1 );
QHBoxLayout* aBtnLayout = (QHBoxLayout*) aBtnBox->layout();
aBtnLayout->setAutoAdd( false );
aBtnLayout->setSpacing( 5 );
+ aBtnLayout->setMargin( 11 );
QPushButton* aOkBtn = new QPushButton(tr( "VISU_BUT_OK" ), aBtnBox);
aOkBtn->setAutoDefault( TRUE );
aBtnLayout->addStretch();
- QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
+ QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox);
aBtnLayout->addWidget(aCloseBtn);
aMainLayout->addWidget(aBtnBox);
connect( myNbSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
connect( myPosSpn2, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
+ connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
+ connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
+ connect( myRotXSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+ connect( myRotYSpn, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+ connect( myRotXSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+ connect( myRotYSpn2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
+ connect( myBasePlanePos, SIGNAL( textChanged(const QString& )), this, SLOT( onPlanePos(const QString& ) ) );
+ connect( myCreateTable, SIGNAL( toggled(bool)), myCurvesCheck, SLOT( setEnabled(bool) ));
connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject()));
-
+ connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
+ connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
}
/*!
*/
VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg()
{
+ deletePlanes();
if(myCutLines) delete myCutLines;
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+ vf->Repaint();
}
//------------------------------------------------------------------------------
void VisuGUI_CutLinesDlg::initFromPrsObject(VISU::CutLines_i* thePrs) {
+ myPrs = thePrs;
+ myScalarPane->initFromPrsObject(thePrs);
myRotXSpn->setValue(thePrs->GetRotateX()*180./PI);
myRotYSpn->setValue(thePrs->GetRotateY()*180./PI);
myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
myCBSetDef->setChecked(thePrs->IsDefault());
DrawTable();
+
+ // Draw Preview
+ if (myPreviewCheck->isChecked()) {
+ createPlanes();
+ }
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
-
- thePrs->SetOrientationType(getOrientaion());
- thePrs->SetRotateX(myRotXSpn->value()*PI/180.);
- thePrs->SetRotateY(myRotYSpn->value()*PI/180.);
+int VisuGUI_CutLinesDlg::storeToPrsObject(VISU::CutLines_i* thePrs) {
+
+ myScalarPane->storeToPrsObject(thePrs);
+
+ thePrs->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
thePrs->SetDisplacement(myPosSpn->value());
thePrs->SetNbLines((int)myNbSpn->value());
- thePrs->SetOrientationType2(getOrientaion(false));
- thePrs->SetRotateX2(myRotXSpn2->value()*PI/180.);
- thePrs->SetRotateY2(myRotYSpn2->value()*PI/180.);
+ thePrs->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
thePrs->SetDisplacement2(myPosSpn2->value());
if (!myCBSetDef->isChecked())
for (int i = 0; i < (int)myNbSpn->value(); ++i)
{
- if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
- thePrs->SetLinePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
+ if (!((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked())
+ thePrs->SetLinePosition( i, myPosTable->text( i, 0 ).toDouble() );
else thePrs->SetDefaultPosition(i);
}
+ return 1;
+}
+
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutLinesDlg::createPlanes() {
+ if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+ if (myCutLines == NULL) return;
+ if (myPreviewActor != 0) return;
+
+ vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData();
+ vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+ aPlaneMapper->SetInput(aPolyData->GetOutput());
+ aPlaneMapper->ScalarVisibilityOff();
+
+ myPreviewActor = SALOME_Actor::New();
+ myPreviewActor->PickableOff();
+ myPreviewActor->SetMapper(aPlaneMapper);
+ aPlaneMapper->Delete();
+ GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+}
+
+//------------------------------------------------------------------------------
+void VisuGUI_CutLinesDlg::deletePlanes() {
+ if (myPreviewActor == 0) return;
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+ vf->RemoveActor(myPreviewActor);
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
}
+
//------------------------------------------------------------------------------
void VisuGUI_CutLinesDlg::onPlaneSelect(int theId) {
for (int i = 0; i < mySelPlane2->count(); i++)
myRotXLbl->setText( tr("LBL_ROT_X"));
myRotYLbl->setText( tr("LBL_ROT_Y"));
((QRadioButton*)mySelPlane2->find(1))->setChecked(true);
- onCutSelect(1);
+ onCutSelect(1, false);
break;
case 1:
myRotXLbl->setText( tr("LBL_ROT_Y"));
myRotYLbl->setText( tr("LBL_ROT_Z"));
((QRadioButton*)mySelPlane2->find(2))->setChecked(true);
- onCutSelect(2);
+ onCutSelect(2, false);
break;
case 2:
myRotXLbl->setText( tr("LBL_ROT_Z"));
myRotYLbl->setText( tr("LBL_ROT_X"));
((QRadioButton*)mySelPlane2->find(0))->setChecked(true);
- onCutSelect(0);
+ onCutSelect(0, false);
}
- setBaseDefault();
+ setBaseDefault(false);
+ DrawTable();
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::onCutSelect(int theId) {
+void VisuGUI_CutLinesDlg::onCutSelect(int theId, bool theUpdate) {
switch (theId) {
case 0:
myRotXLbl2->setText( tr("LBL_ROT_X"));
myRotXLbl2->setText( tr("LBL_ROT_Z"));
myRotYLbl2->setText( tr("LBL_ROT_X"));
}
- DrawTable();
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
+ myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+ myCutLines->SetDisplacement2(myPosSpn2->value());
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
}
//------------------------------------------------------------------------------
-void VisuGUI_CutLinesDlg::setBaseDefault() {
-
+void VisuGUI_CutLinesDlg::setBaseDefault(bool theUpdate) {
if (!hasInit) return;
if ( myCBSetDef->isChecked() )
{
if (!myCutLines->IsDefault()) myCutLines->SetDefault();
- myCutLines->SetOrientationType(getOrientaion());
+ myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
myCutLines->SetDisplacement(myPosSpn->value());
- myBasePlanePos->setText( QString::number(myCutLines->GetBasePlanePosition()) );
+ float aPos = myCutLines->GetBasePlanePosition();
+ myBasePlanePos->setText( QString::number(aPos) );
myBasePlanePos->setEnabled(false);
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) {
+ myCutLines->SetBasePlanePosition(aPos);
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
}
else myBasePlanePos->setEnabled(true);
-
}
//------------------------------------------------------------------------------
int aNbRows = myPosTable->numRows();
int aNbPlanes = (int)myNbSpn->value();
-
- if (aNbRows>0)
- for (int i = 0; i < aNbRows; ++i)
- {
- if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
- myCutLines->SetLinePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
- }
-
+
+ myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+
myCutLines->SetNbLines(aNbPlanes);
myCutLines->SetDisplacement2(myPosSpn2->value());
- myCutLines->SetOrientationType2(getOrientaion(false));
+ myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
- if (aNbRows < aNbPlanes)
- {
- if (aNbRows == 0) myPosTable->setNumRows(aNbPlanes);
- else myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
-
- QHeader *vh = myPosTable->verticalHeader();
- QString str;
-
- for (int i = aNbRows; i < myPosTable->numRows(); ++i)
- {
- QLineEdit *editline = new QLineEdit( myPosTable );
- editline->setValidator(mydvalidator);
- myPosTable->setCellWidget( i, 0, editline );
-
- QCheckBox *checkbox = new QCheckBox( myPosTable );
- myPosTable->setCellWidget(i, 1, checkbox );
- connect(checkbox , SIGNAL( clicked() ), this , SLOT( setDefault() ) );
-
- str = str.setNum(i+1);
- str.prepend ("Plane# ");
- vh->setLabel( i, str );
- }
+ if (aNbRows>0)
+ for (int i = 0; i < aNbRows; ++i) {
+ QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
+ if (aItem == 0) break;
+ if (!aItem->isChecked())
+ myCutLines->SetLinePosition(i, myPosTable->text(i, 0).toDouble());
}
- else if (aNbRows > aNbPlanes)
- for (int i = aNbRows-1; myPosTable->numRows() != aNbPlanes; --i )
- myPosTable->removeRow(i);
- for (int i = 0; i < myPosTable->numRows(); ++i)
- {
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutLines->GetLinePosition(i)) );
-
- if (myCutLines->IsDefaultPosition(i))
- {
- ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
- }
+ if (aNbPlanes > aNbRows)
+ myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
+ else if (aNbPlanes < aNbRows)
+ myPosTable->setNumRows(aNbPlanes);
+
+ int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
+ for (int i = 0; i<aMin; i++) {
+ myPosTable->setText(i, 0, QString::number(myCutLines->GetLinePosition(i)));
+ ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutLines->IsDefaultPosition(i));
+ }
+
+ QHeader *vh = myPosTable->verticalHeader();
+ QString str("Plane# %1");
+ for (int i=aMin; i<aNbPlanes; i++) {
+ VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
+ QTableItem::OnTyping,
+ QString::number(myCutLines->GetLinePosition(i)));
+ aEditItem->setReplaceable(false);
+ aEditItem->setEnabled(!myCutLines->IsDefaultPosition(i));
+ myPosTable->setItem(i, 0, aEditItem);
+
+ QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
+ aCheck->setChecked(myCutLines->IsDefaultPosition(i));
+ aCheck->setReplaceable(false);
+ myPosTable->setItem(i, 1, aCheck);
+
+ vh->setLabel( i, str.arg(i+1) );
+ }
+ // Update preview
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (myPreviewCheck->isChecked()) {
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
}
+ }
}
//------------------------------------------------------------------------------
void VisuGUI_CutLinesDlg::setDefault(int all)
{
+ myPosTable->setCurrentCell(-1, 1);
+ myPosTable->clearSelection();
if (all == 0) return;
-
if (all == 1)
for (int i = 0; i < (int)myNbSpn->value(); ++i)
- ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
-
- for (int i = 0; i < (int)myNbSpn->value(); ++i)
- {
- if ( ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked() )
- {
- myCutLines->SetDefaultPosition(i);
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutLines->GetLinePosition(i)) );
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
- }
- else ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(true);
- }
+ ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
+
+ for (int i = 0; i < (int)myNbSpn->value(); ++i) {
+ if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
+ myCutLines->SetDefaultPosition(i);
+ myPosTable->setText( i, 0, QString::number(myCutLines->GetLinePosition(i)));
+ myPosTable->item( i, 0 )->setEnabled(false);
+ } else
+ myPosTable->item( i, 0 )->setEnabled(true);
+ }
}
//------------------------------------------------------------------------------
onCutSelect(2);
}
}
+
+
+void VisuGUI_CutLinesDlg::onValueChanged(int theRow, int theCol) {
+ if (theCol == 0) {
+ QString aTxt = myPosTable->text(theRow, 0);
+ bool isChanged = !aTxt.isEmpty();
+ ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
+
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (myPreviewCheck->isChecked()) {
+ //Update Preview
+ myCutLines->SetLinePosition( theRow, aTxt.toDouble());
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+ } else {
+ bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
+ if (isDefault) {
+ myCutLines->SetDefaultPosition(theRow);
+ myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow)));
+
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (myPreviewCheck->isChecked()) {
+ //Update Preview
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+ }
+ myPosTable->item(theRow, 0)->setEnabled(!isDefault);
+ }
+}
+
+
+void VisuGUI_CutLinesDlg::accept() {
+ MYGenerateTable = myCreateTable->isChecked();
+ MYGenerateCurve = myCurvesCheck->isChecked();
+ if (myScalarPane->check()) {
+ storeToPrsObject(myPrs);
+ if (myIsCreation) {
+ if (isGenerateTable()) {
+ visuGUI->GetVisuGen()->CreateTable(myPrs->GetEntry());
+ if (isGenerateCurves()) {
+ SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+ if(!aSObject->_is_nil()) {
+ SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+ SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ for ( ;aIter->More(); aIter->Next()) {
+ SALOMEDS::SObject_var aTblObj = aIter->Value();
+ if (!aTblObj->_is_nil()) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+ visuGUI->CreatePlot(aTblObj);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ visuGUI->CreateActor(myPrs);
+ GET_VTK_VIEWFRAME(myStudy)->onViewFitAll();
+ }
+ } else {
+ visuGUI->RecreateActor(myPrs);
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+ vf->getRenderer()->ResetCameraClippingRange();
+ vf->Repaint();
+ }
+ }
+ // Remove old Table
+ SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
+ SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(myPrs->GetEntry());
+ if(!aSObject->_is_nil()) {
+ SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+ SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ for ( ;aIter->More(); aIter->Next()) {
+ SALOMEDS::SObject_var aTblObj = aIter->Value();
+ if (!aTblObj->_is_nil()) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+ aBuilder->RemoveObjectWithChildren(aIter->Value()); // We should have only one child
+ break;
+ }
+ }
+ }
+ if (isGenerateTable()) {
+ visuGUI->GetVisuGen()->CreateTable(aSObject->GetID());
+ if (isGenerateCurves()) {
+ SALOMEDS::Study_var aStudy = myStudy->getStudyDocument();
+ SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aSObject );
+ SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+ for ( ;aIter->More(); aIter->Next()) {
+ SALOMEDS::SObject_var aTblObj = aIter->Value();
+ if (!aTblObj->_is_nil()) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aTblObj->FindAttribute(anAttr, "AttributeName")) {
+ visuGUI->CreatePlot(aTblObj);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ myStudy->updateObjBrowser();
+ QDialog::accept();
+ }
+}
+
+void VisuGUI_CutLinesDlg::reject() {
+ if (myIsCreation) {
+ visuGUI->DeletePresentation(myPrs);
+ myStudy->updateObjBrowser();
+ }
+ QDialog::reject();
+}
+
+void VisuGUI_CutLinesDlg::onPreviewCheck(bool thePreview) {
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (thePreview) {
+ storeToPrsObject(myCutLines);
+ myCutLines->GetPL()->Update();
+ createPlanes();
+ vf->onViewFitAll();
+ } else {
+ deletePlanes();
+ vf->Repaint();
+ }
+ }
+}
+
+void VisuGUI_CutLinesDlg::onRotation(double theValue) {
+ if (myCutLines == NULL) return;
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (myPreviewCheck->isChecked()) {
+ myCutLines->SetOrientation(getOrientaion(),myRotXSpn->value()*PI/180.,myRotYSpn->value()*PI/180.);
+ myCutLines->SetOrientation2(getOrientaion(false),myRotXSpn2->value()*PI/180.,myRotYSpn2->value()*PI/180.);
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+}
+
+void VisuGUI_CutLinesDlg::onPlanePos(const QString& theValue) {
+ if (myCutLines == NULL) return;
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (myPreviewCheck->isChecked()) {
+ myCutLines->SetBasePlanePosition(theValue.toDouble());
+ myCutLines->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+}
+
+void VisuGUI_CutLinesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
+ if (theFrame != myStudyFrame)
+ reject();
+}
+
+
+
#ifndef VISUGUI_CUTLINESDLG_H
#define VISUGUI_CUTLINESDLG_H
-#include "VisuGUI_ScalarBarDlg.h"
+#include "VisuGUI_CutPlanesDlg.h"
-#include <qdialog.h>
#include <qhbuttongroup.h>
-#include <qlineedit.h>
-#include <qcheckbox.h>
#include <qvalidator.h>
-#include <qtable.h>
-
-#include "SALOMEconfig.h"
-#include CORBA_CLIENT_HEADER(VISU_Gen)
namespace VISU{
class CutLines_i;
Q_OBJECT
public:
- VisuGUI_CutLinesDlg();
+ VisuGUI_CutLinesDlg(bool theIsCreation);
~VisuGUI_CutLinesDlg();
void initFromPrsObject(VISU::CutLines_i* thePrs);
- void storeToPrsObject(VISU::CutLines_i* thePrs);
+ int storeToPrsObject(VISU::CutLines_i* thePrs);
+
+ bool isGenerateTable() { return myCreateTable->isChecked(); }
+ bool isGenerateCurves() { return myCreateTable->isChecked() && myCurvesCheck->isChecked(); }
+
+protected slots:
+ void accept();
+ void reject();
private slots:
void onPlaneSelect(int theId);
- void onCutSelect(int theId);
- void setBaseDefault();
+ void onCutSelect(int theId, bool theUpdate = true);
+ void setBaseDefault(bool theUpdate = true);
void setDefault( int all = -1);
void DrawTable();
-
+ void onValueChanged(int theRow, int theCol);
+ void onPreviewCheck(bool thePreview);
+ void onRotation(double theValue);
+ void onPlanePos(const QString& theValue);
+ void onFrameActivated(QAD_StudyFrame* );
+
private:
+ void createPlanes();
+ void deletePlanes();
+
+
QHButtonGroup* mySelPlane;
QAD_SpinBoxDbl* myRotXSpn;
QAD_SpinBoxDbl* myRotYSpn;
QAD_SpinBoxDbl* myPosSpn;
QLineEdit* myBasePlanePos;
QCheckBox* myCBSetDef;
+ QCheckBox* myCreateTable;
+ QCheckBox* myCurvesCheck;
QHButtonGroup* mySelPlane2;
QAD_SpinBoxDbl* myNbSpn;
QDoubleValidator *mydvalidator;
VISU::CutLines_i* myCutLines;
+ VisuGUI_ScalarBarPane* myScalarPane;
+
VISU::CutPlanes::Orientation getOrientaion(bool IsBasePlane = true);
void setOrientation( const VISU::CutPlanes::Orientation orient);
void setOrientation2( const VISU::CutPlanes::Orientation orient);
+
+ SALOME_Actor* myPreviewActor;
+ QCheckBox* myPreviewCheck;
+ VISU::CutLines_i* myPrs;
+
+ QAD_Study *myStudy;
+ QAD_StudyFrame *myStudyFrame;
+
+ bool myIsCreation;
+
+ static bool MYGenerateTable;
+ static bool MYGenerateCurve;
};
#endif // VISUGUI_CUTLINESDLG_H
#include "VisuGUI_CutPlanesDlg.h"
#include "VISU_CutPlanes_i.hh"
+#include "VISU_CutPlanesPL.hxx"
+
+#include "VisuGUI.h"
+#include "VTKViewer_ViewFrame.h"
#include "QAD_Application.h"
#include "QAD_Desktop.h"
+#include "QAD_RightFrame.h"
#include <qlayout.h>
#include <qcheckbox.h>
#include <qstring.h>
#include <qvalidator.h>
#include <qlineedit.h>
+#include <qtabwidget.h>
+
+#include <vtkRenderer.h>
+#include <vtkAppendPolyData.h>
+#include <vtkDataSetMapper.h>
+
+
+#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
using namespace std;
-/*!
- Constructor
-*/
-VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr( "Cut Planes Definition" ) );
- setSizeGripEnabled( TRUE );
+extern VisuGUI *visuGUI;
+VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theStudy)
+ :QFrame(theParent), myPreviewActor(0),myStudy(theStudy)
+{
QGridLayout* TopLayout = new QGridLayout( this );
TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
+ TopLayout->setMargin( 10 );
+
QButtonGroup* SelPlane = new QButtonGroup( tr( "Orientation" ), this, "SelPlane" );
SelPlane->setTitle( tr( "Orientation" ) );
SelPlane->setColumnLayout(0, Qt::Vertical );
SelPlaneLayout->setSpacing( 6 );
SelPlaneLayout->setMargin( 11 );
- RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
- RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
RBxy = new QRadioButton( tr( "// X-Y" ), SelPlane, "RBxy" );
+ RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
+ RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
SelPlaneLayout->addWidget( RBxy, 0, 0 );
SelPlaneLayout->addWidget( RByz, 0, 1 );
SelPlaneLayout->addWidget( RBzx, 0, 2 );
myPosTable = new QTable(this, "Positions of planes" );
myPosTable->setMaximumHeight( 227 );
myPosTable->setMinimumWidth( 294 );
- //myPosTable->setGeometry( QRect( 11, 98, 289, 325 ) );
myPosTable->setNumCols(2);
myPosTable->setNumRows(0);
+ connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
QHeader *th = myPosTable->horizontalHeader();
th->setLabel( 0, "Position" );
th->setLabel( 1, "Set default" );
+ th->setStyle("QStyle::CE_PushButton");
QGroupBox* GBrot = new QGroupBox( tr( "Rotations" ), this, "GBrot" );
GBrot->setColumnLayout(0, Qt::Vertical );
Rot1 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
Rot1->setValue( 0 );
Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
GBrotLayout->addWidget( Rot1, 0, 1 );
LabelRot2 = new QLabel( tr( "Rotation around Y (Z to X):" ), GBrot, "LabelRot2" );
Rot2 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
Rot2->setValue( 0 );
Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
GBrotLayout->addWidget( Rot2, 1, 1 );
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
-
- QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
myPosSpn = new QAD_SpinBoxDbl( this, 0, 1, 0.1 );
- th->setStyle("QStyle::CE_PushButton");
+ myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
+ myPreviewCheck->setChecked(false);
+ connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
- // layouting
TopLayout->addMultiCellWidget( SelPlane, 0, 0, 0, 1 );
TopLayout->addMultiCellWidget( GBrot, 1, 1, 0, 1 );
TopLayout->addWidget( LabelPosi_3, 2, 0 );
TopLayout->setRowStretch ( 3, 3 );
TopLayout->addWidget(aPosLbl, 4, 0 );
TopLayout->addWidget(myPosSpn, 4, 1 );
- TopLayout->addMultiCellWidget( GroupButtons, 5, 5, 0, 1 );
+ TopLayout->addMultiCellWidget( myPreviewCheck, 5, 5, 0, 1 );
// signals and slots connections
connect( SelPlane, SIGNAL( clicked( int )), this, SLOT( orientationChanged( int ) ) );
connect( nbPlan, SIGNAL( valueChanged( int )), this, SLOT( DrawTable( ) ) );
connect( myPosSpn, SIGNAL( valueChanged( double )), this, SLOT( DrawTable( ) ) );
- connect( RBzx, SIGNAL( toggled(bool)), this, SLOT( DrawTable( ) ) );
- connect( RByz, SIGNAL( toggled(bool)), this, SLOT( DrawTable( ) ) );
- connect( RBxy, SIGNAL( toggled(bool)), this, SLOT( DrawTable( ) ) );
connect( th, SIGNAL( clicked(int)), this, SLOT( setDefault(int) ) );
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
- myCutPlanes = NULL;
-
// default values
+ myCutPlanes = NULL;
hasInit = false;
X1 = 0; X2 = 0;
Y1 = 0; Y2 = 0;
Z1 = 0; Z2 = 0;
RByz->setChecked( true );
- orientationChanged( 0 );
-}
+
+} // End of Constructor
-/*!
- Destructor
-*/
-VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg()
+
+VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
{
- if(myCutPlanes) delete myCutPlanes;
+ deletePlanes();
+ if(myCutPlanes) myCutPlanes->Destroy();
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+ vf->Repaint();
}
-void VisuGUI_CutPlanesDlg::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
+void VisuGUI_CutPlanesPane::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
setNbPlanes(thePrs->GetNbPlanes());
setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
setPlanePos(thePrs->GetOrientationType());
myCutPlanes = new VISU::CutPlanes_i(thePrs->GetResult(),false);
myCutPlanes->SameAs(thePrs);
DrawTable();
+
+ // Draw Preview
+ if (myPreviewCheck->isChecked()) {
+ createPlanes();
+ }
}
-void VisuGUI_CutPlanesDlg::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
+
+void VisuGUI_CutPlanesPane::createPlanes() {
+ if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+ if (myCutPlanes == NULL) return;
+ if (myPreviewActor != 0) return;
+
+ vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
+ vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
+ aPlaneMapper->SetInput(aPolyData->GetOutput());
+ aPlaneMapper->ScalarVisibilityOff();
+
+ myPreviewActor = SALOME_Actor::New();
+ myPreviewActor->PickableOff();
+ myPreviewActor->SetMapper(aPlaneMapper);
+ aPlaneMapper->Delete();
+ GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+}
+
+
+
+int VisuGUI_CutPlanesPane::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
+ thePrs->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
thePrs->SetNbPlanes(getNbPlanes());
- thePrs->SetRotateX(getRotation1()*PI/180.);
- thePrs->SetRotateY(getRotation2()*PI/180.);
- thePrs->SetOrientationType(getOrientaion());
thePrs->SetDisplacement(myPosSpn->value());
for (int i = 0; i < getNbPlanes(); ++i)
{
- if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
- thePrs->SetPlanePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
+ if (!((QCheckTableItem*)myPosTable->item(i, 1))->isChecked())
+ thePrs->SetPlanePosition( i, myPosTable->text(i, 0).toDouble());
else thePrs->SetDefault(i);
}
+ return 1;
}
+
/*!
Called when orientation is changed
*/
-void VisuGUI_CutPlanesDlg::orientationChanged( int )
+void VisuGUI_CutPlanesPane::orientationChanged( int Id )
{
- if ( RBxy->isChecked() ) {
+ if ( Id == 0 ) { // RBxy->isChecked()
LabelRot1->setText( tr( "Rotation around X (Y to Z):" ) );
LabelRot2->setText( tr( "Rotation around Y (Z to X):" ) );
- } else if ( RByz->isChecked() ) {
+ } else if ( Id == 1 ) { // RByz->isChecked()
LabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
LabelRot2->setText( tr( "Rotation around Z (X to Y):" ) );
} else {
LabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
LabelRot2->setText( tr( "Rotation around X (Y to Z):" ) );
}
+ DrawTable();
}
-/*!
- Sets bounds ( must be called first )
-*/
-void VisuGUI_CutPlanesDlg::setBounds( const double x1, const double x2,
- const double y1, const double y2,
- const double z1, const double z2 )
-{
- X1 = min( x1, x2 ); X2 = max( x1, x2 );
- Y1 = min( y1, y2 ); Y2 = max( y1, y2 );
- Z1 = min( z1, z2 ); Z2 = max( z1, z2 );
- orientationChanged( 0 );
-}
-
-/*!
- Sets nb of planes
-*/
-void VisuGUI_CutPlanesDlg::setNbPlanes( const int nbp )
-{
- nbPlan->setValue( nbp );
-}
-
-/*!
- Gets nb of planes
-*/
-int VisuGUI_CutPlanesDlg::getNbPlanes()
-{
- return nbPlan->value();
-}
/*!
Sets planes orientation and position
*/
-void VisuGUI_CutPlanesDlg::setPlanePos( const VISU::CutPlanes::Orientation orient/*, const double pos1, const double pos2 */)
+void VisuGUI_CutPlanesPane::setPlanePos( const VISU::CutPlanes::Orientation orient)
{
if ( orient == VISU::CutPlanes::XY ) // xy
- RBxy->setChecked( true );
+ {
+ RBxy->setChecked( true );
+ orientationChanged( 0 );
+ }
else if ( orient == VISU::CutPlanes::YZ ) // yz
- RByz->setChecked( true );
+ {
+ RByz->setChecked( true );
+ orientationChanged( 1 );
+ }
else // zx
- RBzx->setChecked( true );
- orientationChanged( 0 );
+ {
+ RBzx->setChecked( true );
+ orientationChanged( 2 );
+ }
+
}
-
/*!
Gets planes orientation
*/
-VISU::CutPlanes::Orientation VisuGUI_CutPlanesDlg::getOrientaion()
+VISU::CutPlanes::Orientation VisuGUI_CutPlanesPane::getOrientaion()
{
VISU::CutPlanes::Orientation orient;
if ( RBxy->isChecked() ) // xy
orient = VISU::CutPlanes::XY;
- if ( RByz->isChecked() ) // yz
+ else if ( RByz->isChecked() ) // yz
orient = VISU::CutPlanes::YZ;
- if ( RBzx->isChecked() ) // zx
+ else if ( RBzx->isChecked() ) // zx
orient = VISU::CutPlanes::ZX;
return orient;
}
-
/*!
Sets planes rotation
*/
-void VisuGUI_CutPlanesDlg::setRotation( const double r1, const double r2 )
+void VisuGUI_CutPlanesPane::setRotation( const double r1, const double r2 )
{
Rot1->setValue( r1 );
Rot2->setValue( r2 );
}
-/*!
- Gets plane rotation 1
-*/
-double VisuGUI_CutPlanesDlg::getRotation1()
-{
- return Rot1->value();
-}
-
-/*!
- Gets plane rotation 2
-*/
-double VisuGUI_CutPlanesDlg::getRotation2()
-{
- return Rot2->value();
-}
-
/*!
Draw the table of planes positions
*/
-void VisuGUI_CutPlanesDlg::DrawTable()
+void VisuGUI_CutPlanesPane::DrawTable()
{
+ if (myCutPlanes == NULL) return;
if (!hasInit) return;
int aNbRows = myPosTable->numRows();
int aNbPlanes = getNbPlanes();
-
- if (aNbRows>0)
- for (int i = 0; i < aNbRows; ++i)
- {
- if (!((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked())
- myCutPlanes->SetPlanePosition( i, ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->text().toDouble() );
- }
-
+
+ myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
myCutPlanes->SetNbPlanes(aNbPlanes);
myCutPlanes->SetDisplacement(myPosSpn->value());
- myCutPlanes->SetOrientationType(getOrientaion());
-
- if (aNbRows < aNbPlanes)
- {
- if (aNbRows == 0) myPosTable->setNumRows(aNbPlanes);
- else myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
-
- QHeader *vh = myPosTable->verticalHeader();
- QString str;
-
- QDoubleValidator *dvalidator = new QDoubleValidator(myPosTable);
- dvalidator->setDecimals(32);
-
- for (int i = aNbRows; i < myPosTable->numRows(); ++i)
- {
- QLineEdit *editline = new QLineEdit( myPosTable );
- editline->setValidator(dvalidator);
- myPosTable->setCellWidget( i, 0, editline );
-
- QCheckBox *checkbox = new QCheckBox( myPosTable );
- myPosTable->setCellWidget(i, 1, checkbox );
- connect(checkbox , SIGNAL( clicked() ), this , SLOT( setDefault() ) );
-
- str = str.setNum(i+1);
- str.prepend ("Plane# ");
- vh->setLabel( i, str );
- }
+ if (aNbRows>0)
+ for (int i = 0; i < aNbRows; ++i) {
+ QCheckTableItem* aItem = (QCheckTableItem*)myPosTable->item( i, 1 );
+ if (aItem == 0) break;
+ if (!aItem->isChecked())
+ myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
}
- else if (aNbRows > aNbPlanes)
- for (int i = aNbRows-1; myPosTable->numRows() != aNbPlanes; --i )
- myPosTable->removeRow(i);
- for (int i = 0; i < myPosTable->numRows(); ++i)
- {
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutPlanes->GetPlanePosition(i)) );
-
- if (myCutPlanes->IsDefault(i))
- {
- ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
- }
+ if (aNbPlanes > aNbRows)
+ myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
+ else if (aNbPlanes < aNbRows)
+ myPosTable->setNumRows(aNbPlanes);
+
+ int aMin = (aNbRows < aNbPlanes)? aNbRows : aNbPlanes;
+ for (int i = 0; i<aMin; i++) {
+ myPosTable->setText(i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+ ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(myCutPlanes->IsDefault(i));
+ }
+
+ QHeader *vh = myPosTable->verticalHeader();
+ QString str("Plane# %1");
+ for (int i=aMin; i<aNbPlanes; i++) {
+ VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
+ QTableItem::OnTyping,
+ QString::number(myCutPlanes->GetPlanePosition(i)));
+ aEditItem->setReplaceable(false);
+ aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
+ myPosTable->setItem(i, 0, aEditItem);
+
+ QCheckTableItem* aCheck = new QCheckTableItem(myPosTable, 0);
+ aCheck->setChecked(myCutPlanes->IsDefault(i));
+ aCheck->setReplaceable(false);
+ myPosTable->setItem(i, 1, aCheck);
+
+ vh->setLabel( i, str.arg(i+1) );
+ }
+
+ // Update preview
+ if (myPreviewCheck->isChecked()) {
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ myCutPlanes->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
}
+ }
}
-void VisuGUI_CutPlanesDlg::setDefault(int all)
+void VisuGUI_CutPlanesPane::setDefault(int all)
{
+ myPosTable->setCurrentCell(-1, 1);
+ myPosTable->clearSelection();
if (all == 0) return;
-
if (all == 1)
for (int i = 0; i < getNbPlanes(); ++i)
- ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->setChecked(true);
+ ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
- for (int i = 0; i < getNbPlanes(); ++i)
- {
- if ( ((QCheckBox*)myPosTable->cellWidget( i, 1 ))->isChecked() )
- {
- myCutPlanes->SetDefault(i);
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setText( QString::number(myCutPlanes->GetPlanePosition(i)) );
- ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(false);
+ for (int i = 0; i < getNbPlanes(); ++i) {
+ if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
+ myCutPlanes->SetDefault(i);
+ myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
+ myPosTable->item( i, 0 )->setEnabled(false);
+ } else
+ myPosTable->item( i, 0 )->setEnabled(true);
+ }
+}
+
+void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
+ if (theCol == 0) {
+ QString aTxt = myPosTable->text(theRow, 0);
+ bool isChanged = !aTxt.isEmpty();
+ ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged);
+
+ if (myPreviewCheck->isChecked()) {
+ //Update Preview
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
+ myCutPlanes->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
+ }
+ }
+ } else {
+ bool isDefault = ((QCheckTableItem*)myPosTable->item(theRow, theCol))->isChecked();
+ if (isDefault) {
+ myCutPlanes->SetDefault(theRow);
+ myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
+
+ if (myPreviewCheck->isChecked()) {
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ //Update Preview
+ myCutPlanes->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
}
- else ((QLineEdit*)myPosTable->cellWidget( i, 0 ))->setEnabled(true);
+ }
+ }
+ myPosTable->item(theRow, 0)->setEnabled(!isDefault);
+ }
+}
+
+
+void VisuGUI_CutPlanesPane::deletePlanes() {
+ if (myPreviewActor == 0) return;
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+ vf->RemoveActor(myPreviewActor);
+ myPreviewActor->Delete();
+ myPreviewActor = 0;
+}
+
+void VisuGUI_CutPlanesPane::onRotation(double theValue) {
+ if (myCutPlanes == NULL) return;
+ if (myPreviewCheck->isChecked()) {
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
+ myCutPlanes->GetPL()->Update();
+ deletePlanes();
+ createPlanes();
+ vf->Repaint();
}
+ }
+}
+
+
+void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if (thePreview) {
+ storeToPrsObject(myCutPlanes);
+ myCutPlanes->GetPL()->Update();
+ createPlanes();
+ vf->onViewFitAll();
+ } else {
+ deletePlanes();
+ vf->Repaint();
+ }
+ }
+}
+
+
+
+
+//###################################################################
+
+
+
+/*!
+ Constructor
+*/
+VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal)
+ : QDialog( QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu/* | WDestructiveClose */),
+ myStudy(QAD_Application::getDesktop()->getActiveStudy())
+{
+ myStudyFrame = myStudy -> getActiveStudyFrame();
+ if (!theIsModal) {
+ setWFlags(getWFlags() | WDestructiveClose);
+ }
+ setCaption( tr( "Cut Planes Definition" ) );
+ setSizeGripEnabled( TRUE );
+ myIsCreation = theIsCreation;
+
+ QVBoxLayout* TopLayout = new QVBoxLayout( this );
+ TopLayout->setSpacing( 6 );
+ TopLayout->setMargin( 11 );
+
+ QTabWidget* aTabBox = new QTabWidget(this);
+ myCutPane = new VisuGUI_CutPlanesPane(this, myStudy);
+ aTabBox->addTab(myCutPane, "Cut Planes");
+ myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+ myScalarPane->setMargin( 5 );
+ aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+ TopLayout->addWidget(aTabBox);
+
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setTitle( tr( "" ) );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ TopLayout->addWidget(GroupButtons);
+
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
+ connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
+}
+
+
+void VisuGUI_CutPlanesDlg::accept() {
+ if (myScalarPane->check()) {
+ if (!isModal()) {
+ if (storeToPrsObject(myPrs)) {
+ if (myIsCreation) {
+ if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+ visuGUI->CreateActor(myPrs);
+ GET_VTK_VIEWFRAME(myStudy)->onViewFitAll();
+ }
+ } else {
+ visuGUI->RecreateActor(myPrs);
+ if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+ if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+ vf->getRenderer()->ResetCameraClippingRange();
+ vf->Repaint();
+ }
+ }
+ }
+ } else {
+ if (myIsCreation) {
+ visuGUI->DeletePresentation(myPrs);
+ }
+ }
+ }
+ QDialog::accept();
+ }
+}
+
+void VisuGUI_CutPlanesDlg::reject() {
+ if (myIsCreation && (!isModal())) {
+ visuGUI->DeletePresentation(myPrs);
+ myStudy -> updateObjBrowser();
+ }
+ QDialog::reject();
+}
+
+void VisuGUI_CutPlanesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
+ if (theFrame != myStudyFrame)
+ reject();
+}
+
+VisuGUI_CutPlanesDlg::~VisuGUI_CutPlanesDlg () {
+ reject();
+}
+
+
+//###################################################################
+
+
+
+QWidget* VisuGUI_NumEditItem::createEditor() const
+{
+ QLineEdit *editline = new QLineEdit(text(), table()->viewport());
+ QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport());
+ dvalidator->setDecimals(32);
+ editline->setValidator(dvalidator);
+ return editline;
}
#define VISUGUI_CUTPLANESDLG_H
#include "QAD_SpinBoxDbl.h"
+#include "QAD_StudyFrame.h"
+
#include "VisuGUI_ScalarBarDlg.h"
+#include "VISU_CutPlanes_i.hh"
+#include <SALOME_Actor.h>
-#include <qdialog.h>
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
#include <qradiobutton.h>
-#include <qspinbox.h>
#include <qtable.h>
#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(VISU_Gen)
-namespace VISU{
- class CutPlanes_i;
-}
-class VisuGUI_CutPlanesDlg : public QDialog
-{
+
+class VisuGUI_CutPlanesPane : public QFrame
+{
Q_OBJECT
public:
- VisuGUI_CutPlanesDlg();
- ~VisuGUI_CutPlanesDlg();
+ VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study * theStudy);
+ ~VisuGUI_CutPlanesPane();
- void setBounds( const double x1, const double x2,
- const double y1, const double y2,
- const double z1, const double z2 );
- void setNbPlanes( const int nbp );
- int getNbPlanes();
+ void setNbPlanes( const int nbp ) {nbPlan->setValue( nbp );}
+ int getNbPlanes() {return nbPlan->value();}
void setPlanePos( const VISU::CutPlanes::Orientation orient/*, const double pos1, const double pos2 */);
VISU::CutPlanes::Orientation getOrientaion();
void setRotation( const double r1, const double r2 );
- double getRotation1();
- double getRotation2();
+ double getRotation1() {return Rot1->value();}
+ double getRotation2() {return Rot2->value();}
void initFromPrsObject(VISU::CutPlanes_i* thePrs);
- void storeToPrsObject(VISU::CutPlanes_i* thePrs);
-
+ int storeToPrsObject(VISU::CutPlanes_i* thePrs);
+
private:
+ void createPlanes();
+ void deletePlanes();
+
+
QLabel* LabelRot1;
QLabel* LabelRot2;
QSpinBox* nbPlan;
QAD_SpinBoxDbl* myPosSpn;
QTable* myPosTable;
VISU::CutPlanes_i* myCutPlanes;
+ QCheckBox* myPreviewCheck;
double X1, X2;
double Y1, Y2;
double Z1, Z2;
bool hasInit;
+ QAD_Study* myStudy;
+
+ //vector<SALOME_Actor*> myPreviewActors;
+ SALOME_Actor* myPreviewActor;
private slots:
void editScalarBar();
void orientationChanged( int );
void DrawTable();
void setDefault( int all = -1);
+ void onValueChanged(int theRow, int theCol);
+ void onRotation(double theValue);
+ void onPreviewCheck(bool thePreview);
};
+
+
+class VisuGUI_CutPlanesDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal);
+ ~VisuGUI_CutPlanesDlg();
+
+ void initFromPrsObject(VISU::CutPlanes_i* thePrs)
+ {myPrs=thePrs; myScalarPane->initFromPrsObject(thePrs); myCutPane->initFromPrsObject(thePrs);}
+
+ int storeToPrsObject(VISU::CutPlanes_i* thePrs)
+ {return myScalarPane->storeToPrsObject(thePrs) && myCutPane->storeToPrsObject(thePrs);}
+
+protected slots:
+ void accept();
+ void reject();
+ void onFrameActivated( QAD_StudyFrame* theFrame);
+
+private:
+ VisuGUI_CutPlanesPane* myCutPane;
+ VisuGUI_ScalarBarPane* myScalarPane;
+ VISU::CutPlanes_i* myPrs;
+
+ bool myIsCreation;
+
+ QAD_Study *myStudy;
+ QAD_StudyFrame *myStudyFrame;
+};
+
+
+class VisuGUI_NumEditItem: public QTableItem
+{
+ // Q_OBJECT
+
+public:
+ VisuGUI_NumEditItem(QTable* table, EditType et, const QString& text ):
+ QTableItem(table, et, text) {};
+ ~VisuGUI_NumEditItem() {};
+
+ QWidget* createEditor() const;
+};
+
+
#endif // VISUGUI_CUTPLANESDLG_H
--- /dev/null
+using namespace std;
+
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : VisuGUI_EditContainerDlg.cxx
+// Author : VSV
+// Module : VISU
+
+
+#include "VisuGUI_EditContainerDlg.h"
+#include "VisuGUI.h"
+#include "VISU_Table_i.hh"
+
+#include "QAD_Application.h"
+#include "QAD_Desktop.h"
+
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+
+
+#include CORBA_SERVER_HEADER(VISU_Gen)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+extern VisuGUI *visuGUI;
+
+
+
+/* XPM */
+static const char * left_xpm[] = {
+"24 24 61 1",
+" c None",
+". c #323232",
+"+ c #010101",
+"@ c #4A4A4A",
+"# c #040404",
+"$ c #979797",
+"% c #7B7B7B",
+"& c #939393",
+"* c #EEEEEE",
+"= c #686868",
+"- c #030303",
+"; c #9C9C9C",
+"> c #FFFFFF",
+", c #B1B1B1",
+"' c #5E5E5E",
+") c #060606",
+"! c #C1C1C1",
+"~ c #626262",
+"{ c #000000",
+"] c #989898",
+"^ c #A1A1A1",
+"/ c #A5A5A5",
+"( c #909090",
+"_ c #868686",
+": c #616161",
+"< c #959595",
+"[ c #919191",
+"} c #848484",
+"| c #606060",
+"1 c #0B0B0B",
+"2 c #545454",
+"3 c #727272",
+"4 c #A2A2A2",
+"5 c #969696",
+"6 c #838383",
+"7 c #5F5F5F",
+"8 c #101010",
+"9 c #434343",
+"0 c #6B6B6B",
+"a c #858585",
+"b c #8E8E8E",
+"c c #373737",
+"d c #696969",
+"e c #8D8D8D",
+"f c #B5B5B5",
+"g c #111111",
+"h c #393939",
+"i c #898989",
+"j c #B0B0B0",
+"k c #191919",
+"l c #3A3A3A",
+"m c #646464",
+"n c #535353",
+"o c #050505",
+"p c #353535",
+"q c #585858",
+"r c #4C4C4C",
+"s c #0D0D0D",
+"t c #3E3E3E",
+"u c #020202",
+"v c #0A0A0A",
+" ",
+" ",
+" .+ .+ ",
+" .@# .@# ",
+" .$%# .$%# ",
+" .&*=- .&*=- ",
+" .;>,') .;>,') ",
+" .;>!;~{ .;>!;~{ ",
+" .]>!^&~{ .]>!^&~{ ",
+" ./>!/(_:{ ./>!/(_:{ ",
+" .<*!^[}}|{.<*!^[}}|{ ",
+" 123}45667{123}45667{ ",
+" 890a45b7{ 890a45b7{ ",
+" 8cdef5'{ 8cdef5'{ ",
+" gh0ij7k gh0ij7k ",
+" 8lm0no 8lm0no ",
+" 8pqr- 8pqr- ",
+" sht- sht- ",
+" 1.u 1.u ",
+" v{ v{ ",
+" ",
+" ",
+" ",
+" "};
+
+static QPixmap MYLeftPix(left_xpm);
+
+
+static const char * right_xpm[] = {
+"24 24 43 1",
+" g None",
+". g #323232",
+"+ g #5D5D5D",
+"@ g #000000",
+"# g #C4C4C4",
+"$ g #313131",
+"% g #C5C5C5",
+"& g #E4E4E4",
+"* g #2D2D2D",
+"= g #B7B7B7",
+"- g #EFEFEF",
+"; g #DCDCDC",
+"> g #282828",
+", g #AFAFAF",
+"' g #E0E0E0",
+") g #242424",
+"! g #C7C7C7",
+"~ g #9A9A9A",
+"{ g #8E8E8E",
+"] g #1F1F1F",
+"^ g #A5A5A5",
+"/ g #989898",
+"( g #888888",
+"_ g #1B1B1B",
+": g #ADADAD",
+"< g #858585",
+"[ g #838383",
+"} g #868686",
+"| g #929292",
+"1 g #C1C1C1",
+"2 g #161616",
+"3 g #909090",
+"4 g #747474",
+"5 g #3A3A3A",
+"6 g #121212",
+"7 g #0D0D0D",
+"8 g #7A7A7A",
+"9 g #8A8A8A",
+"0 g #090909",
+"a g #040404",
+"b g #707070",
+"c g #6E6E6E",
+"d g #3F3F3F",
+" ",
+" ",
+" .. .. ",
+" .+@ .+@ ",
+" .#+@ .#+@ ",
+" $%&+@ $%&+@ ",
+" *=-;+@ *=-;+@ ",
+" >,'=;+@ >,'=;+@ ",
+" ),!~{;+@ ),!~{;+@ ",
+" ]^!/({;+@ ]^!/({;+@ ",
+" _~:<[}|1+@_~:<[}|1+@ ",
+" 23~[[{:45@23~[[{:45@ ",
+" 6</[{:45@ 6</[{:45@ ",
+" 789{:45@ 789{:45@ ",
+" 08~:45@ 08~:45@ ",
+" a4~45@ a4~45@ ",
+" @b45@ @b45@ ",
+" @c5@ @c5@ ",
+" @d@ @d@ ",
+" @@ @@ ",
+" ",
+" ",
+" ",
+" "};
+
+static QPixmap MYRightPix(right_xpm);
+
+
+VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg()
+ : QDialog( QAD_Application::getDesktop(), "VisuGUI_EditContainerDlg", true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( "Edit Plot 2D Presentation" );
+ setSizeGripEnabled( true );
+ QVBoxLayout* TopLayout = new QVBoxLayout(this, 6, 11);
+
+ /***************************************************************/
+ QFrame* aControlFrame = new QFrame(this);
+ aControlFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
+
+ QGridLayout* aControlLay = new QGridLayout(aControlFrame);
+ aControlLay->setSpacing( 6 );
+ aControlLay->setMargin( 11 );
+ aControlLay->addRowSpacing( 1, 30 );
+ aControlLay->addRowSpacing( 4, 30 );
+ aControlLay->setRowStretch( 1, 1 );
+ aControlLay->setRowStretch( 4, 1 );
+ aControlLay->addColSpacing( 0, 180 );
+ aControlLay->addColSpacing( 2, 180 );
+
+ QLabel* aSelectLbl = new QLabel(tr("Study"), aControlFrame);
+ aControlLay->addWidget(aSelectLbl, 0, 0);
+
+ myStudyLst = new QListView(aControlFrame);
+ myStudyLst->setSelectionMode(QListView::Extended);
+ myStudyLst->addColumn(tr("Table"), 80);
+ myStudyLst->addColumn(tr("Curve"), 50);
+ myStudyLst->addColumn(tr(""), 0);
+ myStudyLst->setAllColumnsShowFocus(true);
+ myStudyLst->setMinimumHeight(130);
+ connect(myStudyLst, SIGNAL( selectionChanged()), this, SLOT( onLeftSelected() ));
+ aControlLay->addMultiCellWidget(myStudyLst, 1, 4, 0, 0);
+
+ myRightBtn = new QToolButton(aControlFrame);
+ myRightBtn->setIconSet(MYRightPix);
+ myRightBtn->setEnabled(false);
+ connect(myRightBtn, SIGNAL( clicked()), this, SLOT( onRightClicked() ));
+ aControlLay->addWidget(myRightBtn, 2, 1);
+
+ myLeftBtn = new QToolButton(aControlFrame);
+ myLeftBtn->setIconSet(MYLeftPix);
+ myLeftBtn->setEnabled(false);
+ connect(myLeftBtn, SIGNAL( clicked()), this, SLOT( onLeftClicked() ));
+ aControlLay->addWidget(myLeftBtn, 3, 1);
+
+ QLabel* aForceLbl = new QLabel(tr("Container"), aControlFrame);
+ aControlLay->addWidget(aForceLbl, 0, 2);
+
+ myContainerLst = new QListView(aControlFrame);
+ myContainerLst->setSelectionMode(QListView::Extended);
+ myContainerLst->addColumn(tr("Table"), 80);
+ myContainerLst->addColumn(tr("Curve"), 50);
+ myContainerLst->addColumn(tr(""), 0);
+ myContainerLst->setMinimumWidth(130);
+ connect(myContainerLst, SIGNAL( selectionChanged()), this, SLOT( onRightSelected() ));
+ aControlLay->addMultiCellWidget(myContainerLst, 1, 4, 2, 2);
+
+ TopLayout->addWidget( aControlFrame );
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+
+void VisuGUI_EditContainerDlg::initFromPrsObject(VISU::Container_i* theContainer) {
+ SALOMEDS::Study_var aStudy = visuGUI->GetStudyDocument();
+ SALOMEDS::SComponent_var aVisuSO = aStudy->FindComponent("VISU");
+ if (aVisuSO->_is_nil()) {
+ return;
+ }
+ QValueList<CurveStruct> aStudyCurves;
+ QValueList<CurveStruct> aContainerCurves;
+ // Find curves in container
+ for (int i = 1; i <= theContainer->GetNbCurves(); i++) {
+ VISU::Curve_i* aCurve = theContainer->GetCurve(i);
+ if (aCurve == NULL) continue;
+ CurveStruct aEntry;
+ aEntry.CurveName = aCurve->GetTitle();
+ aEntry.CurveEntry = aCurve->GetEntry();
+ SALOMEDS::SObject_var aTableSO = aStudy->FindObjectID(aCurve->GetTableID());
+ if (CORBA::is_nil(aTableSO)) continue;
+ aEntry.TableName = getSObjectName(aTableSO);
+ aContainerCurves.append(aEntry);
+ new QListViewItem(myContainerLst, aEntry.TableName, aEntry.CurveName, aEntry.CurveEntry);
+ }
+ // Find curves in study
+ SALOMEDS::ChildIterator_var aIter = aStudy->NewChildIterator( aVisuSO );
+ for (aIter->InitEx(true); aIter->More(); aIter->Next()) {
+ SALOMEDS::SObject_var aSObject = aIter->Value();
+ CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
+ VISU::Base_var aVisuObj = VISU::Base::_narrow(anObject);
+ if (!CORBA::is_nil(aVisuObj)) {
+ if (aVisuObj->GetType() == VISU::TCURVE) {
+ SALOMEDS::SObject_var aTableSO = aSObject->GetFather();
+ CurveStruct aEntry;
+ aEntry.TableName = getSObjectName(aTableSO);
+ aEntry.CurveName = getSObjectName(aSObject);
+ aEntry.CurveEntry = aSObject->GetID();
+ aStudyCurves.append(aEntry);
+ }
+ }
+ }
+ //Show Curves which are not in Curve
+ QValueList<CurveStruct>::iterator it;
+ QValueList<CurveStruct>::iterator it2;
+ bool isExist = false;
+ for (it = aStudyCurves.begin(); it != aStudyCurves.end(); ++it ) {
+ for (it2 = aContainerCurves.begin(); it2 != aContainerCurves.end(); ++it2 ) {
+ if (isExist = ((*it).CurveEntry == (*it2).CurveEntry))
+ break;
+ }
+ if (!isExist)
+ new QListViewItem(myStudyLst, (*it).TableName, (*it).CurveName, (*it).CurveEntry);
+ }
+}
+
+
+void VisuGUI_EditContainerDlg::storeToPrsObject(VISU::Container_i* theContainer) {
+ theContainer->Clear();
+
+ SALOMEDS::Study_var aStudy = visuGUI->GetStudyDocument();
+ QListViewItem* anItem = myContainerLst->firstChild();
+ while (anItem) {
+ SALOMEDS::SObject_var aCurveSO = aStudy->FindObjectID(anItem->text(2));
+ if (!aCurveSO->_is_nil()) {
+ CORBA::Object_var aObject = VISU::SObjectToObject(aCurveSO);
+ if (!CORBA::is_nil(aObject)) {
+ VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aObject).in() );
+ if (aCurve) theContainer->AddCurve(aCurve->_this());
+ }
+ }
+ anItem = anItem->nextSibling();
+ }
+}
+
+
+QString VisuGUI_EditContainerDlg::getSObjectName(SALOMEDS::SObject_var theSObject) {
+ if (theSObject->_is_nil()) return QString("");
+
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ if ( theSObject->FindAttribute(anAttr, "AttributeName") ) {
+ aName = SALOMEDS::AttributeName::_narrow( anAttr );
+ return QString(strdup( aName->Value() ));
+ }
+ return QString("");
+}
+
+
+void VisuGUI_EditContainerDlg::onLeftClicked() {
+ QListViewItem* anItem = myContainerLst->firstChild();
+ while (anItem) {
+ if (anItem->isSelected()) {
+ QListViewItem* anTmpItem = anItem;
+ anItem = anTmpItem->nextSibling();
+ myContainerLst->takeItem(anTmpItem);
+ myStudyLst->insertItem(anTmpItem);
+ } else {
+ anItem = anItem->nextSibling();
+ }
+ }
+}
+
+
+void VisuGUI_EditContainerDlg::onRightClicked() {
+ QListViewItem* anItem = myStudyLst->firstChild();
+ while (anItem) {
+ if (anItem->isSelected()) {
+ QListViewItem* anTmpItem = anItem;
+ anItem = anTmpItem->nextSibling();
+ myStudyLst->takeItem(anTmpItem);
+ myContainerLst->insertItem(anTmpItem);
+ } else {
+ anItem = anItem->nextSibling();
+ }
+ }
+}
+
+
+void VisuGUI_EditContainerDlg::onLeftSelected() {
+ QListViewItem* anItem = myStudyLst->firstChild();
+ bool isSelected = false;
+ while (anItem) {
+ if (anItem->isSelected()) {
+ isSelected = true;
+ break;
+ }
+ anItem = anItem->nextSibling();
+ }
+ myRightBtn->setEnabled(isSelected);
+}
+
+
+void VisuGUI_EditContainerDlg::onRightSelected() {
+ QListViewItem* anItem = myContainerLst->firstChild();
+ bool isSelected = false;
+ while (anItem) {
+ if (anItem->isSelected()) {
+ isSelected = true;
+ break;
+ }
+ anItem = anItem->nextSibling();
+ }
+ myLeftBtn->setEnabled(isSelected);
+}
--- /dev/null
+// VISU VISUGUI : GUI of VISU component
+//
+// Copyright (C) 2003 CEA/DEN, EDF R&D
+//
+//
+//
+// File : VisuGUI_EditContainerDlg.h
+// Author : VSV
+// Module : VISU
+
+#ifndef VISUGUI_EDITCONTAINER_H
+#define VISUGUI_EDITCONTAINER_H
+
+#include <qdialog.h>
+#include <qlistview.h>
+#include <qvaluevector.h>
+#include <qtoolbutton.h>
+
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
+
+namespace VISU{
+ class Container_i;
+}
+
+
+struct CurveStruct {
+ QString TableName;
+ QString CurveName;
+ QString CurveEntry;
+};
+
+
+class VisuGUI_EditContainerDlg: public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_EditContainerDlg();
+ ~VisuGUI_EditContainerDlg() {};
+
+ void initFromPrsObject(VISU::Container_i* theContainer);
+ void storeToPrsObject(VISU::Container_i* theContainer);
+
+private slots:
+ void onLeftClicked();
+ void onRightClicked();
+ void onLeftSelected();
+ void onRightSelected();
+
+private:
+ QString getSObjectName(SALOMEDS::SObject_var theSObject);
+
+ QListView* myStudyLst;
+ QListView* myContainerLst;
+ QToolButton* myLeftBtn;
+ QToolButton* myRightBtn;
+};
+
+
+#endif // VISUGUI_EDITCONTAINER_H
+
-// VISU VISUGUI : GUI of VISU component
+z// VISU VISUGUI : GUI of VISU component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <qlayout.h>
#include <qvalidator.h>
+#include <qtabwidget.h>
+
using namespace std;
-/*!
- Constructor
-*/
-VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_IsoSurfacesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+
+VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane(QWidget* parent)
+ : QVBox(parent)
{
- setCaption( tr( "Iso Surfaces Definition" ) );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* TopLayout = new QGridLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
+ QFrame* TopGroup = new QFrame( this, "TopGroup" );
+ TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ TopGroup->setLineWidth(1);
+
+ QGridLayout* TopGroupLayout = new QGridLayout(TopGroup);
TopGroupLayout->setAlignment( Qt::AlignTop );
TopGroupLayout->setSpacing( 6 );
TopGroupLayout->setMargin( 11 );
+ QLabel* LabelNbr = new QLabel( tr( "Number of surfaces:" ), TopGroup, "LabelNbr" );
+ TopGroupLayout->addWidget( LabelNbr, 0, 0 );
+ NbrIso = new QSpinBox( 1, 100, 1, TopGroup, "NbrIso" );
+ NbrIso->setValue( 1 );
+ TopGroupLayout->addWidget( NbrIso, 0, 1 );
+
QLabel* LabelMin = new QLabel( tr( "Minimum value:" ), TopGroup, "LabelMin" );
- TopGroupLayout->addWidget( LabelMin, 0, 0 );
+ TopGroupLayout->addWidget( LabelMin, 1, 0 );
//MinIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1 );
MinIso = new QLineEdit( TopGroup );
- MinIso->setValidator( new QDoubleValidator(this) );
+ MinIso->setValidator( new QDoubleValidator(TopGroup) );
MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MinIso->setMinimumSize( 70, 0 );
LabelMin->setBuddy(MinIso);
- TopGroupLayout->addWidget( MinIso, 0, 1 );
+ TopGroupLayout->addWidget( MinIso, 1, 1 );
QLabel* LabelMax = new QLabel( tr( "Maximum value:" ), TopGroup, "LabelMax" );
- TopGroupLayout->addWidget( LabelMax, 1, 0 );
+ TopGroupLayout->addWidget( LabelMax, 2, 0 );
//MaxIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1);
MaxIso = new QLineEdit( TopGroup );
- MaxIso->setValidator( new QDoubleValidator(this) );
+ MaxIso->setValidator( new QDoubleValidator(TopGroup) );
MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MaxIso->setMinimumSize( 70, 0 );
LabelMax->setBuddy(MaxIso);
- TopGroupLayout->addWidget( MaxIso, 1, 1 );
+ TopGroupLayout->addWidget( MaxIso, 2, 1 );
- CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
- CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
- TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
- CBUpdate->setChecked(true);
- CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
- CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
- TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
+// CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
+// CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
+// TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
+// CBUpdate->setChecked(false);
+ QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
+ TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1);
+ connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
- QLabel* LabelNbr = new QLabel( tr( "Number of surfaces:" ), TopGroup, "LabelNbr" );
- TopGroupLayout->addWidget( LabelNbr, 2, 0 );
- NbrIso = new QSpinBox( 1, 100, 1, TopGroup, "NbrIso" );
- NbrIso->setValue( 1 );
- TopGroupLayout->addWidget( NbrIso, 2, 1 );
+// CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
+// CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
+// TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
+
+}
+
+
+
+void VisuGUI_IsoSurfPane::initFromPrsObject(VISU::IsoSurfaces_i* thePrs) {
+ NbrIso->setValue(thePrs->GetNbSurfaces());
+ MinIso->setText(QString::number(thePrs->GetSubMin()));
+ MaxIso->setText(QString::number(thePrs->GetSubMax()));
+// switch(thePrs->GetScaling()){
+// case VISU::LOGARITHMIC :
+// CBLog->setChecked(true);
+// break;
+// default:
+// CBLog->setChecked(false);
+// }
+}
+
+int VisuGUI_IsoSurfPane::storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {
+ thePrs->SetNbSurfaces(NbrIso->value());
+ thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
+ return 1;
+// if (CBUpdate->isChecked())
+// {
+// thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
+// if (CBLog->isChecked())
+// thePrs->SetScaling(VISU::LOGARITHMIC);
+// else
+// thePrs->SetScaling(VISU::LINEAR);
+// }
+}
+
+void VisuGUI_IsoSurfPane::onCBUpdate()
+{
+ // if (CBUpdate->isChecked()) {
+ myScalarPane->setRange(MinIso->text().toDouble(), MaxIso->text().toDouble(), true);
+ // }
+// CBLog->setDisabled(false);
+// else CBLog->setDisabled(true);
+}
+
+
+bool VisuGUI_IsoSurfPane::check() {
+ if (MinIso->text().toDouble() >= MaxIso->text().toDouble()) {
+ QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
+ tr("MSG_MINMAX_VALUES"),
+ tr("VISU_BUT_OK"));
+ return false;
+ } // else if (/* CBUpdate->isChecked() && CBLog->isChecked() && */
+// (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) ) {
+// QAD_MessageBox::warn1( this,
+// tr("VISU_WARNING"),
+// tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
+// tr("VISU_BUT_OK"));
+// return false;
+// }
+ return true;
+}
+
+
+
+
+
+/*!
+ Constructor
+*/
+VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
+ : QDialog( QAD_Application::getDesktop(), "VisuGUI_IsoSurfacesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( tr( "Iso Surfaces Definition" ) );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing( 6 );
+ TopLayout->setMargin(11);
+
+ QTabWidget* aTabBox = new QTabWidget(this);
+ myIsoPane = new VisuGUI_IsoSurfPane(this);
+ myIsoPane->setMargin( 5 );
+ aTabBox->addTab(myIsoPane, "Iso Surface");
+ myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+ myIsoPane->setScalarBarPane(myScalarPane);
+ myScalarPane->setMargin( 5 );
+ aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+ TopLayout->addWidget(aTabBox);
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
- TopLayout->addWidget( TopGroup, 0, 0 );
- TopLayout->addWidget( GroupButtons, 1, 0 );
+ TopLayout->addWidget(GroupButtons);
// signals and slots connections
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( CBUpdate, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
-}
-
-/*!
- Destructor
-*/
-VisuGUI_IsoSurfacesDlg::~VisuGUI_IsoSurfacesDlg()
-{
-}
-
-void VisuGUI_IsoSurfacesDlg::initFromPrsObject(VISU::IsoSurfaces_i* thePrs) {
- NbrIso->setValue(thePrs->GetNbSurfaces());
- MinIso->setText(QString::number(thePrs->GetSubMin()));
- MaxIso->setText(QString::number(thePrs->GetSubMax()));
- switch(thePrs->GetScaling()){
- case VISU::LOGARITHMIC :
- CBLog->setChecked(true);
- break;
- default:
- CBLog->setChecked(false);
- }
-}
-
-void VisuGUI_IsoSurfacesDlg::storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {
- thePrs->SetNbSurfaces(NbrIso->value());
- thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
- if (CBUpdate->isChecked())
- {
- thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
- if (CBLog->isChecked())
- thePrs->SetScaling(VISU::LOGARITHMIC);
- else
- thePrs->SetScaling(VISU::LINEAR);
- }
}
void VisuGUI_IsoSurfacesDlg::accept() {
-
- if (MinIso->text().toDouble() >= MaxIso->text().toDouble())
- QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
- tr("MSG_MINMAX_VALUES"),
- tr("VISU_BUT_OK"));
- else if ( CBUpdate->isChecked() && CBLog->isChecked() && (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) )
- {
-
- QAD_MessageBox::warn1( this,
- tr("VISU_WARNING"),
- tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
- tr("VISU_BUT_OK"));
- }
- else QDialog::accept();
+ if (myIsoPane->check() && myScalarPane->check()) QDialog::accept();
}
-void VisuGUI_IsoSurfacesDlg::onCBUpdate()
-{
- if (CBUpdate->isChecked())
- CBLog->setDisabled(false);
- else CBLog->setDisabled(true);
-}
#ifndef VISUGUI_ISOSURFACESDLG_H
#define VISUGUI_ISOSURFACESDLG_H
+#include "VisuGUI_ScalarBarDlg.h"
+#include "VISU_IsoSurfaces_i.hh"
+
#include <qdialog.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
#include <qlineedit.h>
-namespace VISU{
- class IsoSurfaces_i;
-}
+
+
+class VisuGUI_IsoSurfPane : public QVBox
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_IsoSurfPane(QWidget* parent);
+ ~VisuGUI_IsoSurfPane() {};
+
+ void initFromPrsObject(VISU::IsoSurfaces_i* thePrs);
+ int storeToPrsObject(VISU::IsoSurfaces_i* thePrs);
+
+ void setScalarBarPane(VisuGUI_ScalarBarPane* theScalarPane) {myScalarPane = theScalarPane;}
+ VisuGUI_ScalarBarPane* getScalarBarPane() {return myScalarPane;}
+
+ bool check();
+
+protected slots:
+ void onCBUpdate();
+
+private:
+ QLineEdit* MinIso;
+ QLineEdit* MaxIso;
+ QSpinBox* NbrIso;
+ //QCheckBox* CBUpdate;
+ VisuGUI_ScalarBarPane* myScalarPane;
+ // QCheckBox* CBLog;
+};
+
+
+
class VisuGUI_IsoSurfacesDlg : public QDialog
{
public:
VisuGUI_IsoSurfacesDlg();
- ~VisuGUI_IsoSurfacesDlg();
+ ~VisuGUI_IsoSurfacesDlg() {};
- void initFromPrsObject(VISU::IsoSurfaces_i* thePrs);
- void storeToPrsObject(VISU::IsoSurfaces_i* thePrs);
+ void initFromPrsObject(VISU::IsoSurfaces_i* thePrs)
+ {myScalarPane->initFromPrsObject(thePrs); myIsoPane->initFromPrsObject(thePrs);}
+
+ int storeToPrsObject(VISU::IsoSurfaces_i* thePrs)
+ {return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs);}
protected slots:
void accept();
- void onCBUpdate();
private:
- QLineEdit* MinIso;
- QLineEdit* MaxIso;
- QSpinBox* NbrIso;
- QCheckBox* CBUpdate;
- QCheckBox* CBLog;
+ VisuGUI_IsoSurfPane* myIsoPane;
+ VisuGUI_ScalarBarPane* myScalarPane;
};
#endif // VISUGUI_ISOSURFACESDLG_H
#include "QAD_Desktop.h"
#include <qlayout.h>
+#include <qtabwidget.h>
using namespace std;
setCaption( tr( "Deformed Shape" ) );
setSizeGripEnabled( TRUE );
- QGridLayout* TopLayout = new QGridLayout( this );
+ QVBoxLayout* TopLayout = new QVBoxLayout( this );
TopLayout->setSpacing( 6 );
TopLayout->setMargin( 11 );
- QGroupBox* TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
+ QTabWidget* aTabBox = new QTabWidget(this);
+
+ QVBox* aBox = new QVBox(this);
+ aBox->setMargin( 11 );
+ QFrame* TopGroup = new QFrame( aBox, "TopGroup" );
+ TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
+ TopGroup->setLineWidth(1);
+ QGridLayout* TopGroupLayout = new QGridLayout( TopGroup );
+ TopGroupLayout->setAlignment( Qt::AlignTop | Qt::AlignCenter );
TopGroupLayout->setSpacing( 6 );
TopGroupLayout->setMargin( 11 );
TopGroupLayout->addMultiCellWidget( UseMagn, 1, 1, 0, 1 );
//if (!enableUM)
// UseMagn->hide();
+ aTabBox->addTab(aBox, "Deformed Shape");
+
+ myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+ myScalarPane->setMargin( 5 );
+ aTabBox->addTab(myScalarPane, "Scalar Bar");
+
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
- TopLayout->addWidget( TopGroup, 0, 0 );
- TopLayout->addWidget( GroupButtons, 1, 0 );
+ TopLayout->addWidget( aTabBox );
+ TopLayout->addWidget( GroupButtons );
// signals and slots connections
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
}
-/*!
- Destructor
-*/
-VisuGUI_MagnitudeDlg::~VisuGUI_MagnitudeDlg()
-{
-}
-
void VisuGUI_MagnitudeDlg::initFromPrsObject(VISU::DeformedShape_i* thePrs) {
+ myScalarPane->initFromPrsObject(thePrs);
setFactor(thePrs->GetScale());
UseMagn->setChecked(thePrs->IsColored());
}
-void VisuGUI_MagnitudeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
+int VisuGUI_MagnitudeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
+ myScalarPane->storeToPrsObject(thePrs);
thePrs->SetScale(getFactor());
thePrs->ShowColored(isColored());
+ return 1;
+}
+
+
+void VisuGUI_MagnitudeDlg::accept() {
+ if (myScalarPane->check()) QDialog::accept();
}
#ifndef VISUGUI_MAGNITUDEDLG_H
#define VISUGUI_MAGNITUDEDLG_H
+#include "VisuGUI_ScalarBarDlg.h"
+
#include <qdialog.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
public:
VisuGUI_MagnitudeDlg();
- ~VisuGUI_MagnitudeDlg();
+ ~VisuGUI_MagnitudeDlg() {};
double getFactor()
{ return ScalFact->value(); }
{ return UseMagn->isChecked(); }
void initFromPrsObject(VISU::DeformedShape_i* thePrs);
- void storeToPrsObject(VISU::DeformedShape_i* thePrs);
+ int storeToPrsObject(VISU::DeformedShape_i* thePrs);
+protected slots:
+ void accept();
+
private:
QAD_SpinBoxDbl* ScalFact;
QCheckBox* UseMagn;
+ VisuGUI_ScalarBarPane* myScalarPane;
};
#endif // VISUGUI_MAGNITUDEDLG_H
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_PartialScaDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-using namespace std;
-#include "VisuGUI_PartialScaDlg.h"
-
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-
-/*!
- Constructor
-*/
-VisuGUI_PartialScaDlg::VisuGUI_PartialScaDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "VisuGUI_PartialScaDlg" );
- setCaption( tr( "Partial Scale" ) );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* TopLayout = new QGridLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setSpacing( 6 );
- TopGroupLayout->setMargin( 11 );
-
- MinLabel = new QLabel( tr( "Min:" ), TopGroup, "MinLabel" );
- MinSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
- MinSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- MinSpin->setMinimumSize( 70, 0 );
- MinSpin->setValue( 0.0 );
-
- MaxLabel = new QLabel( tr( "Max:" ), TopGroup, "MaxLabel" );
- MaxSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
- MaxSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- MaxSpin->setMinimumSize( 70, 0 );
- MaxSpin->setValue( 0.0 );
-
- TopGroupLayout->addWidget( MinLabel, 0, 0 );
- TopGroupLayout->addWidget( MinSpin, 0, 1 );
- TopGroupLayout->addWidget( MaxLabel, 1, 0 );
- TopGroupLayout->addWidget( MaxSpin, 1, 1 );
-
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
- buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( TopGroup, 0, 0 );
- TopLayout->addWidget( GroupButtons, 1, 0 );
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-/*!
- Destructor
-*/
-VisuGUI_PartialScaDlg::~VisuGUI_PartialScaDlg()
-{
-}
-
-/*!
- Sets min, max values
-*/
-void VisuGUI_PartialScaDlg::setMinMax( const double min, const double max )
-{
- MinSpin->setValue( min );
- MaxSpin->setValue( max );
-}
-
-/*!
- Gets min value
-*/
-double VisuGUI_PartialScaDlg::getMin()
-{
- return MinSpin->value();
-}
-
-/*!
- Gets max value
-*/
-double VisuGUI_PartialScaDlg::getMax()
-{
- return MaxSpin->value();
-}
-
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_PartialScaDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-#ifndef VISUGUI_PARTIALSCADLG_H
-#define VISUGUI_PARTIALSCADLG_H
-
-#include <qdialog.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include "QAD_SpinBoxDbl.h"
-
-class VisuGUI_PartialScaDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- VisuGUI_PartialScaDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~VisuGUI_PartialScaDlg();
-
- void setMinMax( const double min, const double max );
- double getMin();
- double getMax();
-
-private:
- QGroupBox* TopGroup;
- QLabel* MinLabel;
- QAD_SpinBoxDbl* MinSpin;
- QLabel* MaxLabel;
- QAD_SpinBoxDbl* MaxSpin;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-};
-
-#endif // VISUGUI_PARTIALSCADLG_H
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_PhaseDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-using namespace std;
-#include "VisuGUI_PhaseDlg.h"
-#include <qlayout.h>
-
-/*!
- Constructor
-*/
-VisuGUI_PhaseDlg::VisuGUI_PhaseDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "VisuGUI_PhaseDlg" );
- setCaption( tr( "Set Phase" ) );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* TopLayout = new QGridLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setSpacing( 6 );
- TopGroupLayout->setMargin( 11 );
-
- PhaseLabel = new QLabel( tr( "VISU_MEN_PHASE" ), TopGroup, "PhaseLabel" );
- PhaseSpin = new QAD_SpinBoxDbl( TopGroup, -360.00, 360.00, 1.0 );
- PhaseSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- PhaseSpin->setMinimumSize( 70, 0 );
- PhaseSpin->setValue( 0.0 );
-
- TopGroupLayout->addWidget( PhaseLabel, 0, 0 );
- TopGroupLayout->addWidget( PhaseSpin, 0, 1 );
-
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
- buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( TopGroup, 0, 0 );
- TopLayout->addWidget( GroupButtons, 1, 0 );
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-/*!
- Destructor
-*/
-VisuGUI_PhaseDlg::~VisuGUI_PhaseDlg()
-{
-}
-
-/*!
- Sets phase value
-*/
-void VisuGUI_PhaseDlg::setPhase( const double ph )
-{
- PhaseSpin->setValue( ph );
-}
-
-/*!
- Gets phase value
-*/
-double VisuGUI_PhaseDlg::getPhase()
-{
- return PhaseSpin->value();
-}
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_PhaseDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-#ifndef VISUGUI_PHASEDLG_H
-#define VISUGUI_PHASEDLG_H
-
-#include <qdialog.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include "QAD_SpinBoxDbl.h"
-
-class VisuGUI_PhaseDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- VisuGUI_PhaseDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~VisuGUI_PhaseDlg();
-
- void setPhase( const double ph );
- double getPhase();
-
-private:
- QGroupBox* TopGroup;
- QLabel* PhaseLabel;
- QAD_SpinBoxDbl* PhaseSpin;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-};
-
-#endif // VISUGUI_PHASEDLG_H
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_PhaseMagnitudeDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-using namespace std;
-#include "VisuGUI_PhaseMagnitudeDlg.h"
-
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-
-/*!
- Constructor
-*/
-VisuGUI_PhaseMagnitudeDlg::VisuGUI_PhaseMagnitudeDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "VisuGUI_PhaseMagnitudeDlg" );
- setCaption( tr( "Phase Magnitude" ) );
- setSizeGripEnabled( TRUE );
-
- QGridLayout* TopLayout = new QGridLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setSpacing( 6 );
- TopGroupLayout->setMargin( 11 );
-
- PhaseLabel = new QLabel( tr( "Phase:" ), TopGroup, "PhaseLabel" );
- PhaseSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
- PhaseSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- PhaseSpin->setMinimumSize( 70, 0 );
- PhaseSpin->setValue( 0.0 );
-
- MagnLabel = new QLabel( tr( "Magnitude:" ), TopGroup, "MagnLabel" );
- MagnSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
- MagnSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- MagnSpin->setMinimumSize( 70, 0 );
- MagnSpin->setValue( 0.0 );
-
- TopGroupLayout->addWidget( PhaseLabel, 0, 0 );
- TopGroupLayout->addWidget( PhaseSpin, 0, 1 );
- TopGroupLayout->addWidget( MagnLabel, 1, 0 );
- TopGroupLayout->addWidget( MagnSpin, 1, 1 );
-
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
- buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( TopGroup, 0, 0 );
- TopLayout->addWidget( GroupButtons, 1, 0 );
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-/*!
- Destructor
-*/
-VisuGUI_PhaseMagnitudeDlg::~VisuGUI_PhaseMagnitudeDlg()
-{
-}
-
-/*!
- Sets phase value
-*/
-void VisuGUI_PhaseMagnitudeDlg::setPhase( const double ph )
-{
- PhaseSpin->setValue( ph );
-}
-
-/*!
- Gets phase value
-*/
-double VisuGUI_PhaseMagnitudeDlg::getPhase()
-{
- return PhaseSpin->value();
-}
-
-/*!
- Sets magnitude value
-*/
-void VisuGUI_PhaseMagnitudeDlg::setMagnitude( const double magn )
-{
- MagnSpin->setValue( magn );
-}
-
-/*!
- Gets magnitude value
-*/
-double VisuGUI_PhaseMagnitudeDlg::getMagnitude()
-{
- return MagnSpin->value();
-}
-
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_PhaseMagnitudeDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-#ifndef VISUGUI_PHASEMAGNITUDEDLG_H
-#define VISUGUI_PHASEMAGNITUDEDLG_H
-
-#include <qdialog.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include "QAD_SpinBoxDbl.h"
-
-class VisuGUI_PhaseMagnitudeDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- VisuGUI_PhaseMagnitudeDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~VisuGUI_PhaseMagnitudeDlg();
-
- void setPhase( const double ph );
- double getPhase();
- void setMagnitude( const double magn );
- double getMagnitude();
-
-private:
- QGroupBox* TopGroup;
- QLabel* PhaseLabel;
- QAD_SpinBoxDbl* PhaseSpin;
- QLabel* MagnLabel;
- QAD_SpinBoxDbl* MagnSpin;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-};
-
-#endif // VISUGUI_PHASEMAGNITUDEDLG_H
#include <limits.h>
#include <qlayout.h>
#include <qvalidator.h>
+#include <qcolordialog.h>
using namespace std;
-/*!
- Constructor
-*/
-VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
- : QDialog( QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+
+
+VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane(QWidget * parent, bool SetPref):
+ QVBox(parent)
{
- setName( "VisuGUI_ScalarBarDlg" );
- setCaption( SetPref ? tr( "Scalar Bar Preferences" ) : tr( "Scalar Bar Properties" ) );
- setSizeGripEnabled( TRUE );
-
myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80;
myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12;
- Imin = 0.0; Imax = 0.0; Fmin = 0.0; Fmax = 0.0; Rmin = 0.0; Rmax = 0.0;
+ Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0;
myRangeMode = -1;
-
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
+
+ setSpacing(6);
+ //setMargin(11);
// Range ============================================================
RangeGroup = new QButtonGroup( tr( "Scalar range" ), this, "RangeGroup" );
RangeGroupLayout->addWidget( MaxLabel, 3, 2 );
RangeGroupLayout->addWidget( MaxEdit, 3, 3 );
- TopLayout->addWidget( RangeGroup );
+ //TopLayout->addWidget( RangeGroup );
// Colors and Labels ========================================================
QGroupBox* ColLabGroup = new QGroupBox( tr( "Colors and labels" ), this, "ColLabGroup" );
ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
ColLabGroupLayout->addWidget( LabelSpin, 0, 3);
- TopLayout->addWidget( ColLabGroup );
+ //TopLayout->addWidget( ColLabGroup );
// Orientation ==========================================================
QButtonGroup* OrientGroup = new QButtonGroup( tr( "Orientation" ), this, "OrientGroup" );
OrientGroupLayout->addWidget( RBvert, 0, 0 );
OrientGroupLayout->addWidget( RBhori, 0, 1 );
- TopLayout->addWidget( OrientGroup );
+ // TopLayout->addWidget( OrientGroup );
// Origin ===============================================================
QGroupBox* OriginGroup = new QGroupBox( tr( "Origin" ), this, "OriginGroup" );
OriginGroupLayout->addWidget( YLabel, 0, 2);
OriginGroupLayout->addWidget( YSpin, 0, 3);
- TopLayout->addWidget( OriginGroup );
+ //TopLayout->addWidget( OriginGroup );
// Dimensions =========================================================
QGroupBox* DimGroup = new QGroupBox( tr( "Dimensions" ), this, "DimGroup" );
DimGroupLayout->addWidget( HeightLabel, 0, 2);
DimGroupLayout->addWidget( HeightSpin, 0, 3);
- TopLayout->addWidget( DimGroup );
+ //TopLayout->addWidget( DimGroup );
// Save check box ===========================================================
+ QHBox* aSaveBox = new QHBox(this);
if ( !SetPref ) {
- CBSave = new QCheckBox( tr( "Save as default values" ), this, "CBSave" );
- TopLayout->addWidget( CBSave );
+ CBSave = new QCheckBox( tr( "Save as default values" ), aSaveBox, "CBSave" );
+ //TopLayout->addWidget( CBSave );
}
else {
CBSave = 0;
}
-
- // Common buttons ===========================================================
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
-
- QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( GroupButtons );
+ myTextBtn = new QPushButton("Text properties...", aSaveBox);
+ myTextDlg = new VisuGUI_TextPrefDlg(this);
+ myTextDlg->setTitleVisible(!SetPref);
// signals and slots connections ===========================================
connect( RangeGroup, SIGNAL( clicked( int ) ), this, SLOT( changeRange( int ) ) );
connect( OrientGroup, SIGNAL( clicked( int ) ), this, SLOT( changeDefaults( int ) ) );
connect( XSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
connect( YSpin, SIGNAL( valueChanged( double ) ), this, SLOT( XYChanged( double ) ) );
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
changeRange( 0 );
changeDefaults( 0 );
-}
-
-/*!
- Destructor
-*/
-VisuGUI_ScalarBarDlg::~VisuGUI_ScalarBarDlg()
-{
+ myIsStoreTextProp = false;
}
/**
* Initializes dialog box values from resources
*/
-void VisuGUI_ScalarBarDlg::initFromResources() {
+void VisuGUI_ScalarBarPane::initFromResources() {
int sbCol=64,sbLab=5,orient=1;
float sbX1=0.01,sbY1=0.1,sbW=0.1,sbH=0.8;
float sbVmin=0., sbVmax=0.;
sbVmax=0.;
}
- setRange( sbVmin, sbVmax, 0.0, 0.0, sbRange );
+ setRange( sbVmin, sbVmax, /*0.0, 0.0,*/ sbRange );
setPosAndSize( sbX1, sbY1, sbW, sbH, orient == 1);
setScalarBarData( sbCol, sbLab );
+
+ QString aIsBoldTitle = QAD_CONFIG->getSetting("Visu:IsBoldTitle");
+ if (aIsBoldTitle.isEmpty())
+ myTextDlg->setBoldTitle(true);
+ else
+ myTextDlg->setBoldTitle(aIsBoldTitle.compare("true") == 0);
+
+ QString aIsItalicTitle = QAD_CONFIG->getSetting("Visu:IsItalicTitle");
+ if (aIsItalicTitle.isEmpty())
+ myTextDlg->setItalicTitle(true);
+ else
+ myTextDlg->setItalicTitle(aIsItalicTitle.compare("true") == 0);
+
+ QString aIsShadowTitle = QAD_CONFIG->getSetting("Visu:IsShadowTitle");
+ if (aIsShadowTitle.isEmpty())
+ myTextDlg->setShadowTitle(true);
+ else
+ myTextDlg->setShadowTitle(aIsShadowTitle.compare("true") == 0);
+
+ QString aTitFontType = QAD_CONFIG->getSetting("Visu:TitFontType");
+ if (!aTitFontType.isEmpty()) {
+ switch (aTitFontType.toInt()) {
+ case 0: myTextDlg->setTitleFont(VTK_ARIAL); break;
+ case 1: myTextDlg->setTitleFont(VTK_COURIER); break;
+ case 2: myTextDlg->setTitleFont(VTK_TIMES); break;
+ }
+ } else {
+ myTextDlg->setTitleFont(VTK_ARIAL);
+ }
+ float R,G,B;
+ QString aRTitColor = QAD_CONFIG->getSetting("Visu:TitleColorR");
+ R = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
+ if (R > 1) R = 1;
+ if (R < 0) R = 0;
+
+ QString aGTitColor = QAD_CONFIG->getSetting("Visu:TitleColorG");
+ G = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
+ if (G > 1) G = 1;
+ if (G < 0) G = 0;
+
+ QString aBTitColor = QAD_CONFIG->getSetting("Visu:TitleColorB");
+ B = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
+ if (B > 1) B = 1;
+ if (B < 0) B = 0;
+
+ myTextDlg->setTitleColor(QColor((int)(R*255.),
+ (int)(G*255.),
+ (int)(B*255.)));
+ ///
+
+ QString aIsBoldLabel = QAD_CONFIG->getSetting("Visu:IsBoldLabel");
+ if (aIsBoldLabel.isEmpty())
+ myTextDlg->setBoldLabel(true);
+ else
+ myTextDlg->setBoldLabel(aIsBoldLabel.compare("true") == 0);
+
+ QString aIsItalicLabel = QAD_CONFIG->getSetting("Visu:IsItalicLabel");
+ if (aIsItalicLabel.isEmpty())
+ myTextDlg->setItalicLabel(true);
+ else
+ myTextDlg->setItalicLabel(aIsItalicLabel.compare("true") == 0);
+
+ QString aIsShadowLabel = QAD_CONFIG->getSetting("Visu:IsShadowLabel");
+ if (aIsShadowLabel.isEmpty())
+ myTextDlg->setShadowLabel(true);
+ else
+ myTextDlg->setShadowLabel(aIsShadowLabel.compare("true") == 0);
+
+ QString aLblFontType = QAD_CONFIG->getSetting("Visu:LblFontType");
+ if (!aLblFontType.isEmpty()) {
+ switch (aLblFontType.toInt()) {
+ case 0: myTextDlg->setLabelFont(VTK_ARIAL); break;
+ case 1: myTextDlg->setLabelFont(VTK_COURIER); break;
+ case 2: myTextDlg->setLabelFont(VTK_TIMES); break;
+ }
+ } else {
+ myTextDlg->setLabelFont(VTK_ARIAL);
+ }
+ QString aRLblColor = QAD_CONFIG->getSetting("Visu:LabelColorR");
+ R = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
+ if (R > 1) R = 1;
+ if (R < 0) R = 0;
+
+ QString aGLblColor = QAD_CONFIG->getSetting("Visu:LabelColorG");
+ G = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
+ if (G > 1) G = 1;
+ if (G < 0) G = 0;
+
+ QString aBLblColor = QAD_CONFIG->getSetting("Visu:LabelColorB");
+ B = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
+ if (B > 1) B = 1;
+ if (B < 0) B = 0;
+
+ myTextDlg->setLabelColor(QColor((int)(R*255.),
+ (int)(G*255.),
+ (int)(B*255.)));
}
/**
* Stores dialog values to resources
*/
-void VisuGUI_ScalarBarDlg::storeToResources() {
+void VisuGUI_ScalarBarPane::storeToResources() {
int orient = (RBvert->isChecked())? 1 : 0;
float sbX1 = XSpin->value();
float sbY1 = YSpin->value();
QAD_CONFIG->addSetting("Visu:SBScaling", "LOGARITHMIC");
else
QAD_CONFIG->addSetting("Visu:SBScaling", "LINEAR");
+
+ ////
+
+ if (myIsStoreTextProp) {
+ if (myTextDlg->isBoldTitle())
+ QAD_CONFIG->addSetting("Visu:IsBoldTitle","true");
+ else
+ QAD_CONFIG->addSetting("Visu:IsBoldTitle","false");
+
+ if (myTextDlg->isItalicTitle())
+ QAD_CONFIG->addSetting("Visu:IsItalicTitle","true");
+ else
+ QAD_CONFIG->addSetting("Visu:IsItalicTitle","false");
+
+ if (myTextDlg->isShadowTitle())
+ QAD_CONFIG->addSetting("Visu:IsShadowTitle","true");
+ else
+ QAD_CONFIG->addSetting("Visu:IsShadowTitle","false");
+
+ switch (myTextDlg->getTitleFont()) {
+ case VTK_ARIAL: QAD_CONFIG->addSetting("Visu:TitFontType",0); break;
+ case VTK_COURIER: QAD_CONFIG->addSetting("Visu:TitFontType",1); break;
+ case VTK_TIMES: QAD_CONFIG->addSetting("Visu:TitFontType",2); break;
+ }
+ QColor aColor = myTextDlg->getTitleColor();
+ QAD_CONFIG->addSetting("Visu:TitleColorR", aColor.red()/255.);
+ QAD_CONFIG->addSetting("Visu:TitleColorG", aColor.green()/255.);
+ QAD_CONFIG->addSetting("Visu:TitleColorB", aColor.blue()/255.);
+ ///
+
+ if (myTextDlg->isBoldLabel())
+ QAD_CONFIG->addSetting("Visu:IsBoldLabel","true");
+ else
+ QAD_CONFIG->addSetting("Visu:IsBoldLabel","false");
+
+ if (myTextDlg->isItalicLabel())
+ QAD_CONFIG->addSetting("Visu:IsItalicLabel","true");
+ else
+ QAD_CONFIG->addSetting("Visu:IsItalicLabel","false");
+
+ if (myTextDlg->isShadowLabel())
+ QAD_CONFIG->addSetting("Visu:IsShadowLabel","true");
+ else
+ QAD_CONFIG->addSetting("Visu:IsShadowLabel","false");
+
+ switch (myTextDlg->getLabelFont()) {
+ case VTK_ARIAL: QAD_CONFIG->addSetting("Visu:LblFontType",0); break;
+ case VTK_COURIER: QAD_CONFIG->addSetting("Visu:LblFontType",1); break;
+ case VTK_TIMES: QAD_CONFIG->addSetting("Visu:LblFontType",2); break;
+ }
+ aColor = myTextDlg->getLabelColor();
+ QAD_CONFIG->addSetting("Visu:LabelColorR", aColor.red()/255.);
+ QAD_CONFIG->addSetting("Visu:LabelColorG", aColor.green()/255.);
+ QAD_CONFIG->addSetting("Visu:LabelColorB", aColor.blue()/255.);
+ }
}
/**
* Initialise dialog box from presentation object
*/
-void VisuGUI_ScalarBarDlg::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
+void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
initFromResources();
myModeCombo->setCurrentItem(thePrs->GetScalarMode());
setPosAndSize( thePrs->GetPosX(),
thePrs->GetPosY(),
thePrs->GetWidth(),
thePrs->GetHeight(),
- thePrs->GetOrientation());
+ thePrs->GetBarOrientation());
switch(thePrs->GetScaling()){
case VISU::LOGARITHMIC :
setLogarithmic(true);
thePrs->GetScalarMapPL()->GetSourceRange(aRange);
Rmin = aRange[0]; Rmax = aRange[1];
setRange( thePrs->GetMin(), thePrs->GetMax(),
- 0.0, 0.0, thePrs->IsRangeFixed() );
+ /*0.0, 0.0,*/ thePrs->IsRangeFixed() );
setScalarBarData( thePrs->GetNbColors(), thePrs->GetLabels() );
bool isScalarMode = (thePrs->GetField()->myNbComp > 1);
myModeLbl->setEnabled(isScalarMode);
myModeCombo->setEnabled(isScalarMode);
+
+ myTextDlg->setTitleText(QString(thePrs->GetTitle()));
+
+ myTextDlg->setBoldTitle(thePrs->IsBoldTitle());
+ myTextDlg->setItalicTitle(thePrs->IsItalicTitle());
+ myTextDlg->setShadowTitle(thePrs->IsShadowTitle());
+ myTextDlg->setTitleFont(thePrs->GetTitFontType());
+ float R, G, B;
+ thePrs->GetTitleColor(&R, &G, &B);
+ myTextDlg->setTitleColor(QColor((int)(R*255.),
+ (int)(G*255.),
+ (int)(B*255.)));
+
+ myTextDlg->setBoldLabel(thePrs->IsBoldLabel());
+ myTextDlg->setItalicLabel(thePrs->IsItalicLabel());
+ myTextDlg->setShadowLabel(thePrs->IsShadowLabel());
+ myTextDlg->setLabelFont(thePrs->GetLblFontType());
+ thePrs->GetLabelColor(&R, &G, &B);
+ myTextDlg->setLabelColor(QColor((int)(R*255.),
+ (int)(G*255.),
+ (int)(B*255.)));
}
/**
* Store values to presentation object
*/
-void VisuGUI_ScalarBarDlg::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
+int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) {
thePrs->SetScalarMode(myModeCombo->currentItem());
thePrs->SetPosition(XSpin->value(), YSpin->value());
thePrs->SetSize(WidthSpin->value(), HeightSpin->value());
- thePrs->SetOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
+ thePrs->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
if(isLogarithmic())
thePrs->SetScaling(VISU::LOGARITHMIC);
else
thePrs->SetLabels(LabelSpin->value());
if (isToSave()) storeToResources();
+
+ if (myIsStoreTextProp) {
+ thePrs->SetTitle(myTextDlg->getTitleText().latin1());
+
+ thePrs->SetBoldTitle(myTextDlg->isBoldTitle());
+ thePrs->SetItalicTitle(myTextDlg->isItalicTitle());
+ thePrs->SetShadowTitle(myTextDlg->isShadowTitle());
+ thePrs->SetTitFontType(myTextDlg->getTitleFont());
+ QColor aTitColor = myTextDlg->getTitleColor();
+ thePrs->SetTitleColor(aTitColor.red()/255.,
+ aTitColor.green()/255.,
+ aTitColor.blue()/255.);
+
+ thePrs->SetBoldLabel(myTextDlg->isBoldLabel());
+ thePrs->SetItalicLabel(myTextDlg->isItalicLabel());
+ thePrs->SetShadowLabel(myTextDlg->isShadowLabel());
+ thePrs->SetLblFontType(myTextDlg->getLabelFont());
+ QColor aLblColor = myTextDlg->getLabelColor();
+ thePrs->SetLabelColor(aLblColor.red()/255.,
+ aLblColor.green()/255.,
+ aLblColor.blue()/255.);
+ }
+
+ return 1;
}
/*!
Called when orientation is changed
*/
-void VisuGUI_ScalarBarDlg::changeDefaults( int )
+void VisuGUI_ScalarBarPane::changeDefaults( int )
{
if ( RBvert->isChecked() ) {
XSpin->setValue( myVerX );
/*!
Called when Range mode is changed
*/
-void VisuGUI_ScalarBarDlg::changeRange( int )
+void VisuGUI_ScalarBarPane::changeRange( int )
{
int mode = -1;
if ( RBFrange->isChecked() )
/*!
Called when X,Y position is changed
*/
-void VisuGUI_ScalarBarDlg::XYChanged( double )
+void VisuGUI_ScalarBarPane::XYChanged( double )
{
QAD_SpinBoxDbl* snd = (QAD_SpinBoxDbl*)sender();
if ( snd == XSpin ) {
/*!
Sets default values and range mode
*/
-void VisuGUI_ScalarBarDlg::setRange( double imin, double imax, double fmin, double fmax, bool sbRange )
+void VisuGUI_ScalarBarPane::setRange( double imin, double imax/*, double fmin, double fmax*/, bool sbRange )
{
- Imin = imin; Imax = imax; Fmin = fmin; Fmax = fmax;
+ Imin = imin; Imax = imax;// Fmin = fmin; Fmax = fmax;
if ( RBIrange->isChecked() ) {
MinEdit->setText( QString::number( Imin ) );
MaxEdit->setText( QString::number( Imax ) );
/*!
Sets size and position
*/
-void VisuGUI_ScalarBarDlg::setPosAndSize( double x, double y, double w, double h, bool vert )
+void VisuGUI_ScalarBarPane::setPosAndSize( double x, double y, double w, double h, bool vert )
{
if ( vert ) {
myVerX = x;
/*!
Sets colors and labels number
*/
-void VisuGUI_ScalarBarDlg::setScalarBarData( int colors, int labels )
+void VisuGUI_ScalarBarPane::setScalarBarData( int colors, int labels )
{
ColorSpin->setValue( colors );
LabelSpin->setValue( labels );
/*!
Gets orientation
*/
-int VisuGUI_ScalarBarDlg::getOrientation()
+int VisuGUI_ScalarBarPane::getOrientation()
{
if (RBvert->isChecked() )
return 1;
return 0;
}
-/*!
- Gets Scalar Bar's x position
-*/
-double VisuGUI_ScalarBarDlg::getX()
-{
- return XSpin->value();
-}
-
-/*!
- Gets Scalar Bar's y position
-*/
-double VisuGUI_ScalarBarDlg::getY()
-{
- return YSpin->value();
-}
-
-/*!
- Gets Scalar Bar's width
-*/
-double VisuGUI_ScalarBarDlg::getWidth()
-{
- return WidthSpin->value();
-}
-
-/*!
- Gets Scalar Bar's height
-*/
-double VisuGUI_ScalarBarDlg::getHeight()
-{
- return HeightSpin->value();
-}
-
-/*!
- Gets Scalar Bar's number of colors
-*/
-int VisuGUI_ScalarBarDlg::getNbColors()
-{
- return ColorSpin->value();
-}
-
-/*!
- Gets Scalar Bar's number of labels
-*/
-int VisuGUI_ScalarBarDlg::getNbLabels()
-{
- return LabelSpin->value();
-}
-
-/*!
- Returns true if imposed range is used
-*/
-bool VisuGUI_ScalarBarDlg::isIRange()
-{
- return RBIrange->isChecked();
-}
-
-/*!
- Gets Min value
-*/
-double VisuGUI_ScalarBarDlg::getMin()
-{
- return MinEdit->text().toDouble();
-}
-/*!
- Gets Max value
-*/
-double VisuGUI_ScalarBarDlg::getMax()
-{
- return MaxEdit->text().toDouble();
-}
-
-/*!
- return true if "save pref" flag is on
-*/
-bool VisuGUI_ScalarBarDlg::isToSave()
-{
- return CBSave ? CBSave->isChecked() : false;
-}
-
-/*!
- Returns true if "Logarithmic scaling" check box is on
-*/
-bool VisuGUI_ScalarBarDlg::isLogarithmic()
-{
- return CBLog->isChecked();
-}
-
-/*!
- Sets "Logarithmic scaling" check box on/off
-*/
-void VisuGUI_ScalarBarDlg::setLogarithmic( bool on )
-{
- CBLog->setChecked( on );
-}
/*!
Called when <OK> button is clicked, validates data and closes dialog
*/
-void VisuGUI_ScalarBarDlg::accept()
+bool VisuGUI_ScalarBarPane::check()
{
double minVal = MinEdit->text().toDouble();
double maxVal = MaxEdit->text().toDouble();
QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
tr("MSG_MINMAX_VALUES"),
tr("VISU_BUT_OK"));
- return;
+ return false;
}
}
// check if logarithmic mode is on and check imposed range to not contain negative values
tr("VISU_WARNING"),
tr("WRN_LOGARITHMIC_RANGE"),
tr("VISU_BUT_OK"));
- return;
+ return false;
}
}
else {
changeRange(1);
//MinEdit->setText( QString::number( Rmin ) );
//MaxEdit->setText( QString::number( Rmax ) );
- return;
+ return false;
}
}
}
- QDialog::accept();
+ return true;
}
+
+
+void VisuGUI_ScalarBarPane::onTextPref() {
+ myIsStoreTextProp = myTextDlg->exec();
+}
+
+
+
+
+
+//#######################################################################################
+
+
+/*!
+ Constructor
+*/
+VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg(bool SetPref)
+ : QDialog( QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setName( "VisuGUI_ScalarBarDlg" );
+ setCaption( SetPref ? tr( "Scalar Bar Preferences" ) : tr( "Scalar Bar Properties" ) );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ myScalarPane = new VisuGUI_ScalarBarPane(this, SetPref);
+ TopLayout->addWidget(myScalarPane);
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+}
+
+
+
+/*!
+ Called when <OK> button is clicked, validates data and closes dialog
+*/
+void VisuGUI_ScalarBarDlg::accept()
+{
+ if (myScalarPane->check()) QDialog::accept();
+}
+
+
+
+
+
+//#######################################################################################
+
+
+
+
+
+VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg(QWidget* parent) :
+ QDialog(parent, 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setName( "VisuGUI_TextPrefDlg" );
+ setCaption( tr("TIT_TEXT_PREF") );
+ setSizeGripEnabled( TRUE );
+
+ QVBoxLayout* TopLayout = new QVBoxLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ QGroupBox* aTitleGrp = new QGroupBox( this );
+ aTitleGrp->setTitle(tr("LBL_TITLE"));
+ aTitleGrp->setColumnLayout(0, Qt::Vertical );
+ QGridLayout* aTitleLayout = new QGridLayout( aTitleGrp->layout() );
+ aTitleLayout->setSpacing( 6 );
+ aTitleLayout->setMargin( 3 );
+
+ myTitleEdt = new QLineEdit(aTitleGrp);
+ aTitleLayout->addMultiCellWidget(myTitleEdt, 0, 0, 0, 4);
+
+ QStrList aFontsLst;
+ aFontsLst.append("Arial");
+ aFontsLst.append("Courier");
+ aFontsLst.append("Times");
+
+ myTitColor = new QToolButton(aTitleGrp);
+ connect( myTitColor, SIGNAL(clicked()), this, SLOT(setTitleColor()) );
+ aTitleLayout->addWidget(myTitColor, 1, 0);
+
+ myTitFontCombo = new QComboBox(aTitleGrp);
+ myTitFontCombo->insertStrList(aFontsLst);
+ aTitleLayout->addWidget(myTitFontCombo, 1, 1);
+
+ myTitBoldChk = new QCheckBox(tr("LBL_BOLD"), aTitleGrp);
+ aTitleLayout->addWidget(myTitBoldChk, 1, 2);
+
+ myTitItalicChk = new QCheckBox(tr("LBL_ITALIC"), aTitleGrp);
+ aTitleLayout->addWidget(myTitItalicChk, 1, 3);
+
+ myTitShadowChk = new QCheckBox(tr("LBL_SHADOW"), aTitleGrp);
+ aTitleLayout->addWidget(myTitShadowChk, 1, 4);
+
+ TopLayout->addWidget( aTitleGrp );
+
+ QGroupBox* aLabelsGrp = new QGroupBox( this );
+ aLabelsGrp->setTitle(tr("LBL_LABELS"));
+ aLabelsGrp->setColumnLayout(0, Qt::Vertical );
+ QGridLayout* aLabelLayout = new QGridLayout( aLabelsGrp->layout() );
+ aLabelLayout->setSpacing( 6 );
+ aLabelLayout->setMargin( 3 );
+
+ myLblColor = new QToolButton(aLabelsGrp);
+ connect( myLblColor, SIGNAL(clicked()), this, SLOT(setLabelColor()) );
+ aLabelLayout->addWidget(myLblColor, 0, 0);
+
+ myLblFontCombo = new QComboBox(aLabelsGrp);
+ myLblFontCombo->insertStrList(aFontsLst);
+ aLabelLayout->addWidget(myLblFontCombo, 0, 1);
+
+ myLblBoldChk = new QCheckBox(tr("LBL_BOLD"), aLabelsGrp);
+ aLabelLayout->addWidget(myLblBoldChk, 0, 2);
+
+ myLblItalicChk = new QCheckBox(tr("LBL_ITALIC"), aLabelsGrp);
+ aLabelLayout->addWidget(myLblItalicChk, 0, 3);
+
+ myLblShadowChk = new QCheckBox(tr("LBL_SHADOW"), aLabelsGrp);
+ aLabelLayout->addWidget(myLblShadowChk, 0, 4);
+
+ TopLayout->addWidget( aLabelsGrp );
+
+ // Common buttons ===========================================================
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+
+ TopLayout->addWidget( GroupButtons );
+
+ connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+}
+
+
+void VisuGUI_TextPrefDlg::setTitleColor() {
+ QColor aColor = QColorDialog::getColor( getTitleColor(), this );
+ if (aColor.isValid()) setTitleColor(aColor);
+}
+
+void VisuGUI_TextPrefDlg::setLabelColor() {
+ QColor aColor = QColorDialog::getColor( getLabelColor(), this );
+ if (aColor.isValid()) setLabelColor(aColor);
+}
+
+
+
+#define GETFONT(FuncName, Control) \
+int VisuGUI_TextPrefDlg::FuncName() \
+{ \
+ switch (Control->currentItem()) { \
+ case 0: return VTK_ARIAL; \
+ case 1: return VTK_COURIER; \
+ case 2: return VTK_TIMES; \
+ } \
+}
+
+#define SETFONT(FuncName, Control) \
+void VisuGUI_TextPrefDlg::FuncName(int theFont) \
+{ \
+ switch (theFont) { \
+ case VTK_ARIAL: Control->setCurrentItem(0); break; \
+ case VTK_COURIER: Control->setCurrentItem(1); break; \
+ case VTK_TIMES: Control->setCurrentItem(2); break; \
+ } \
+}
+
+GETFONT(getTitleFont, myTitFontCombo);
+SETFONT(setTitleFont, myTitFontCombo);
+
+GETFONT(getLabelFont, myLblFontCombo);
+SETFONT(setLabelFont, myLblFontCombo);
+
+#undef GETFONT
+#undef SETFONT
#include <qspinbox.h>
#include <qlineedit.h>
#include <qcombobox.h>
+#include <qvbox.h>
+#include <qtoolbutton.h>
-namespace VISU{
- class ScalarMap_i;
-}
+#include "VISU_ScalarMap_i.hh"
-class VisuGUI_ScalarBarDlg : public QDialog
-{
+
+class VisuGUI_TextPrefDlg: public QDialog
+{
Q_OBJECT
public:
- VisuGUI_ScalarBarDlg( bool SetPref = FALSE );
- ~VisuGUI_ScalarBarDlg();
+ VisuGUI_TextPrefDlg(QWidget* parent);
+ ~VisuGUI_TextPrefDlg() {};
+
+ bool isBoldTitle() { return myTitBoldChk->isChecked();}
+ void setBoldTitle(bool isBold) { myTitBoldChk->setChecked(isBold);}
+
+ bool isItalicTitle() { return myTitItalicChk->isChecked();}
+ void setItalicTitle(bool isItalic) { myTitItalicChk->setChecked(isItalic);}
+
+ bool isShadowTitle() { return myTitShadowChk->isChecked();}
+ void setShadowTitle(bool isShadow) { myTitShadowChk->setChecked(isShadow);}
+
+ QString getTitleText() { return myTitleEdt->text();}
+ void setTitleText(QString theText) { myTitleEdt->setText(theText);}
+
+ QColor getTitleColor() { return myTitColor->paletteBackgroundColor();}
+ void setTitleColor(QColor theColor) { myTitColor->setPaletteBackgroundColor(theColor);}
+
+ int getTitleFont();
+ void setTitleFont(int theFont);
+
+
+ bool isBoldLabel() { return myLblBoldChk->isChecked();}
+ void setBoldLabel(bool isBold) { myLblBoldChk->setChecked(isBold);}
- void setRange( double imin, double imax, double fmin, double fmax, bool sbRange );
- bool isIRange();
- double getMin();
- double getMax();
+ bool isItalicLabel() { return myLblItalicChk->isChecked();}
+ void setItalicLabel(bool isItalic) { myLblItalicChk->setChecked(isItalic);}
+
+ bool isShadowLabel() { return myLblShadowChk->isChecked();}
+ void setShadowLabel(bool isShadow) { myLblShadowChk->setChecked(isShadow);}
+
+ QColor getLabelColor() { return myLblColor->paletteBackgroundColor();}
+ void setLabelColor(QColor theColor) { myLblColor->setPaletteBackgroundColor(theColor);}
+
+ int getLabelFont();
+ void setLabelFont(int theFont);
+
+ void setTitleVisible(bool isVisible)
+ { (isVisible)? myTitleEdt->show() : myTitleEdt->hide();}
+
+private slots:
+ void setTitleColor();
+ void setLabelColor();
+
+ private:
+ QLineEdit* myTitleEdt;
+ QComboBox* myTitFontCombo;
+ QCheckBox* myTitBoldChk;
+ QCheckBox* myTitItalicChk;
+ QCheckBox* myTitShadowChk;
+ QToolButton* myTitColor;
+
+ QComboBox* myLblFontCombo;
+ QCheckBox* myLblBoldChk;
+ QCheckBox* myLblItalicChk;
+ QCheckBox* myLblShadowChk;
+ QToolButton* myLblColor;
+};
+
+
+class VisuGUI_ScalarBarPane : public QVBox
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_ScalarBarPane(QWidget* parent, bool SetPref);
+ ~VisuGUI_ScalarBarPane() {};
+
+ void setRange( double imin, double imax, /*double fmin, double fmax,*/ bool sbRange );
+ bool isIRange() {return RBIrange->isChecked();}
+ double getMin() {return MinEdit->text().toDouble();}
+ double getMax() {return MaxEdit->text().toDouble();}
int getOrientation();
void setPosAndSize( double x, double y, double w, double h, bool vert );
- double getX();
- double getY();
- double getWidth();
- double getHeight();
+ double getX() {return XSpin->value();}
+ double getY() {return YSpin->value();}
+ double getWidth() {return WidthSpin->value();}
+ double getHeight() {return HeightSpin->value();}
void setScalarBarData( int colors, int labels );
- int getNbColors();
- int getNbLabels();
- bool isLogarithmic();
- void setLogarithmic( bool on );
- bool isToSave();
+ int getNbColors() {return ColorSpin->value();}
+ int getNbLabels() {return LabelSpin->value();}
+ bool isLogarithmic() {return CBLog->isChecked();}
+ void setLogarithmic( bool on ) {CBLog->setChecked( on );}
+ bool isToSave() {return CBSave ? CBSave->isChecked() : false;}
void initFromResources();
void storeToResources();
void initFromPrsObject(VISU::ScalarMap_i* thePrs);
- void storeToPrsObject(VISU::ScalarMap_i* thePrs);
+ int storeToPrsObject(VISU::ScalarMap_i* thePrs);
+ bool check();
protected:
QButtonGroup* RangeGroup;
QCheckBox* CBLog;
QLabel* myModeLbl;
QComboBox* myModeCombo;
+ QPushButton* myTextBtn;
+ VisuGUI_TextPrefDlg* myTextDlg;
- double Imin, Imax, Fmin, Fmax, Rmin, Rmax;
+ double Imin, Imax, /* Fmin, Fmax,*/ Rmin, Rmax;
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
int myRangeMode;
-
-protected slots:
- void accept();
+ bool myIsStoreTextProp;
private slots:
void changeDefaults( int );
void changeRange( int );
void XYChanged( double );
+ void onTextPref();
+};
+
+
+
+class VisuGUI_ScalarBarDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_ScalarBarDlg( bool SetPref = FALSE );
+ ~VisuGUI_ScalarBarDlg() {};
+
+ bool isToSave() {return myScalarPane->isToSave();}
+
+ void initFromResources() {myScalarPane->initFromResources();}
+ void storeToResources() {myScalarPane->storeToResources();}
+
+ void initFromPrsObject(VISU::ScalarMap_i* thePrs) {myScalarPane->initFromPrsObject(thePrs);}
+ int storeToPrsObject(VISU::ScalarMap_i* thePrs) {return myScalarPane->storeToPrsObject(thePrs);}
+
+
+protected slots:
+ void accept();
+
+ protected:
+ VisuGUI_ScalarBarPane* myScalarPane;
+
};
#endif // VISUGUI_SCALARBARDLG_H
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_SelVectCompDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-using namespace std;
-#include "VisuGUI_SelVectCompDlg.h"
-#include <qlayout.h>
-
-/*!
- Constructor
-*/
-VisuGUI_SelVectCompDlg::VisuGUI_SelVectCompDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "VisuGUI_SelVectCompDlg" );
- setCaption( tr( "Vector Field" ) );
- setSizeGripEnabled( true );
-
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- Comment1_2 = new QLabel( tr( "Select a component of the vector, or modulus," ), this, "Comment1_2" );
- Comment1_2->setAlignment( AlignCenter );
-
- Comment2_2 = new QLabel( tr( "to be displayed as a scalar result" ), this, "Comment2_2" );
- Comment2_2->setAlignment( AlignCenter );
-
- SelComp = new QButtonGroup( this, "SelComp" );
- SelComp->setColumnLayout(0, Qt::Vertical );
- SelComp->layout()->setSpacing( 0 );
- SelComp->layout()->setMargin( 0 );
- QGridLayout* SelCompLayout = new QGridLayout( SelComp->layout() );
- SelCompLayout->setAlignment( Qt::AlignTop );
- SelCompLayout->setSpacing( 6 );
- SelCompLayout->setMargin( 11 );
-
- Comp1 = new QRadioButton( tr( "Component 1" ), SelComp, "Comp1" );
- SelCompLayout->addWidget( Comp1, 0, 0 );
-
- Modulus = new QRadioButton( tr( "Modulus" ), SelComp, "Modulus" );
- Modulus->setChecked( TRUE );
- SelCompLayout->addWidget( Modulus, 0, 1 );
-
- Comp2 = new QRadioButton( tr( "Component 2" ), SelComp, "Comp2" );
- SelCompLayout->addWidget( Comp2, 1, 0 );
-
- Comp3 = new QRadioButton( tr( "Component 3" ), SelComp, "Comp3" );
- SelCompLayout->addWidget( Comp3, 2, 0 );
-
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- GroupButtons->setTitle( tr( "" ) );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
- buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- TopLayout->addWidget( Comment1_2, 0, 0 );
- TopLayout->addWidget( Comment2_2, 1, 0 );
- TopLayout->addWidget( SelComp, 2, 0 );
- TopLayout->addWidget( GroupButtons, 3, 0 );
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
-/*!
- Destructor
-*/
-VisuGUI_SelVectCompDlg::~VisuGUI_SelVectCompDlg()
-{
-}
-
-/*!
- Gets selection
-*/
-int VisuGUI_SelVectCompDlg::whatIsChecked()
-{
- int ret = 0;
- if ( Modulus->isChecked() )
- ret = 0;
- else if ( Comp1->isChecked() )
- ret = 1;
- else if ( Comp2->isChecked() )
- ret = 2;
- else if ( Comp3->isChecked() )
- ret = 3;
- return ret;
-}
-
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_SelVectCompDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-#ifndef VISUGUI_SELVECTCOMPDLG_H
-#define VISUGUI_SELVECTCOMPDLG_H
-
-#include <qdialog.h>
-#include <qgroupbox.h>
-#include <qbuttongroup.h>
-#include <qradiobutton.h>
-#include <qpushbutton.h>
-#include <qlabel.h>
-
-class VisuGUI_SelVectCompDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- VisuGUI_SelVectCompDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~VisuGUI_SelVectCompDlg();
-
- int whatIsChecked();
-
-private:
- QLabel* Comment1_2;
- QLabel* Comment2_2;
- QButtonGroup* SelComp;
- QRadioButton* Comp1;
- QRadioButton* Modulus;
- QRadioButton* Comp2;
- QRadioButton* Comp3;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-};
-
-#endif // VISUGUI_SELVECTCOMPDLG_H
#include "SALOME_Selection.h"
#include "VISU_Actor.h"
#include "VISU_PrsObject_i.hh"
+#include "VISU_Prs3d_i.hh"
+#include "VISU_PipeLine.hxx"
+#include "VisuGUI.h"
+#include "QAD_MessageBox.h"
+#include "VTKViewer_ViewFrame.h"
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <qlabel.h>
#include <qspinbox.h>
#include <qlistbox.h>
+#include <qlayout.h>
+#include <qhbuttongroup.h>
+#include <qradiobutton.h>
#include <vtkDataSet.h>
#include <vtkCell.h>
+#include <qvalidator.h>
-#include "VisuGUI_CellsResultsDlg.h"
-#include "VisuGUI_PointsResultsDlg.h"
#include "VisuGUI_Selection.h"
-template<class TData, class TDialog> void SetMessage(TData* theData, int theId, TDialog* theDialog){
- // Scalar result
- QString Msg_1;
- if (vtkDataArray *Scalar = theData->GetScalars()){
- float aVal = Scalar->GetTuple1(theId);
- Msg_1.sprintf("%6.3g",aVal);
- }else
- Msg_1.sprintf("NO DATA");
- theDialog->ScalValue->setText( Msg_1.latin1() );
+
+extern VisuGUI *visuGUI;
+
+
+VisuGUI_SelectionDlg::VisuGUI_SelectionDlg()
+ : QDialog( QAD_Application::getDesktop(), 0, false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+{
+ setCaption( "Data on elements" );
+ setSizeGripEnabled( TRUE );
+
+ QGridLayout* TopLayout = new QGridLayout(this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+ TopLayout->setRowStretch(0, 0);
+ TopLayout->setRowStretch(1, 0);
+ TopLayout->setRowStretch(2, 1);
+ TopLayout->setRowStretch(3, 0);
+
+ QHButtonGroup* aTypeBox = new QHButtonGroup("Selection", this);
+
+ QRadioButton* aPointBtn = new QRadioButton("Point", aTypeBox);
+ QRadioButton* aCellBtn = new QRadioButton("Cell", aTypeBox);
+ QRadioButton* aActorBtn = new QRadioButton("Actor", aTypeBox);
+ aPointBtn->setChecked(true);
+
+ connect(aTypeBox, SIGNAL(clicked(int)), this, SLOT(onSelectionChange(int)));
+
+ TopLayout->addWidget(aTypeBox, 0, 0);
+
+ QWidget* aNamePane = new QWidget(this);
+ QGridLayout* aNameLay = new QGridLayout(aNamePane);
+
+ QLabel* aMeshLbl = new QLabel("Mesh name: ", aNamePane);
+ myMeshName = new QLabel(aNamePane);
+
+ QLabel* aFieldLbl = new QLabel("Field name: ", aNamePane);
+ myFieldName = new QLabel(aNamePane);
+
+ aNameLay->addWidget(aMeshLbl, 0, 0);
+ aNameLay->addWidget(myMeshName, 0, 1);
+ aNameLay->addWidget(aFieldLbl, 1, 0);
+ aNameLay->addWidget(myFieldName, 1, 1);
+
+ TopLayout->addWidget(aNamePane, 1, 0);
+
+ myWidgetStack = new QWidgetStack(this);
+
+ // Create Points pane
+ myPointsPane = new QVBox(myWidgetStack);
+ myPointsPane->layout()->setSpacing(6);
+
+ QGroupBox* aDataGrp = new QGroupBox(2, Qt::Horizontal, "Data of Point", myPointsPane);
+ aDataGrp->layout()->setSpacing(6);
+
+ QLabel* aIDLbl = new QLabel("ID:", aDataGrp);
+ myIDValLbl = new QLineEdit("", aDataGrp);
+ QIntValidator* aIntValidator = new QIntValidator(myIDValLbl);
+ aIntValidator->setBottom(0);
+ myIDValLbl->setValidator(aIntValidator);
+ connect(myIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onPointIdEdit(const QString&)));
+
+ QLabel* aValueLbl = new QLabel("Scalar Value:", aDataGrp);
+ myScalarValLbl = new QLabel("", aDataGrp);
+ QLabel* aVectorLbl = new QLabel("Vector Value:", aDataGrp);
+ myVectorValLbl = new QLabel("", aDataGrp);
+ myVectorValLbl->setMinimumWidth(150);
+
+ QGroupBox* aCoordGrp = new QGroupBox(2, Qt::Horizontal, "Coordinates", myPointsPane);
+ aCoordGrp->layout()->setSpacing(6);
+ QLabel* aXLbl = new QLabel("X:", aCoordGrp);
+ myXValLbl = new QLabel("", aCoordGrp);
+ QLabel* aYLbl = new QLabel("Y:", aCoordGrp);
+ myYValLbl = new QLabel("", aCoordGrp);
+ QLabel* aZLbl = new QLabel("Z:",aCoordGrp );
+ myZValLbl = new QLabel("", aCoordGrp);
+
+
+ myWidgetStack->addWidget(myPointsPane, 0);
+
+ // Create Cells pane
+ myCellsPane = new QWidget(myWidgetStack);
+ QGridLayout* aCellLayout = new QGridLayout(myCellsPane);
+ aCellLayout->setSpacing(6);
+ aCellLayout->setRowStretch(0, 0);
+ aCellLayout->setRowStretch(1, 1);
+
+ QGroupBox* aCellGrp = new QGroupBox(2, Qt::Horizontal, "Data of Cell", myCellsPane);
+
+ QLabel* aCellIDLbl = new QLabel("ID:", aCellGrp);
+ myCellIDValLbl = new QLineEdit("", aCellGrp);
+ myCellIDValLbl->setValidator(aIntValidator);
+ connect(myCellIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onCellIdEdit(const QString&)));
+
+ QLabel* aCellValueLbl = new QLabel("Scalar Value:", aCellGrp);
+ myCellScalarValLbl = new QLabel("", aCellGrp);
+ QLabel* aCellVectorLbl = new QLabel("Vector Value:", aCellGrp);
+ myCellVectorValLbl = new QLabel("", aCellGrp);
+
+ aCellLayout->addWidget(aCellGrp, 0, 0);
+
+ myListPoints = new QTable(myCellsPane);
+ myListPoints->setReadOnly(true);
+ myListPoints->setNumCols(6);
+ myListPoints->setNumRows(0);
+ myListPoints->setColumnWidth(0, 40);
+ myListPoints->setColumnWidth(1, 40);
+ myListPoints->setColumnWidth(2, 40);
+ myListPoints->setColumnWidth(3, 40);
+ myListPoints->setSelectionMode(QTable::NoSelection);
+ QHeader* aHeader = myListPoints->horizontalHeader();
+ aHeader->setLabel( 0, "ID" );
+ aHeader->setLabel( 1, "X" );
+ aHeader->setLabel( 2, "Y" );
+ aHeader->setLabel( 3, "Z" );
+ aHeader->setLabel( 4, "Scalar" );
+ aHeader->setLabel( 5, "Vector" );
+
+ aCellLayout->addWidget(myListPoints, 1, 0);
+
+ myWidgetStack->addWidget(myCellsPane, 1);
- // Vector result
- QString Msg_2;
- if (vtkDataArray *Vector = theData->GetVectors()){
- float *aVal = Vector->GetTuple3(theId);
- Msg_2.sprintf("%6.3g; %6.3g; %6.3g",aVal[0],aVal[1],aVal[2]);
- }else
- Msg_2.sprintf("NO DATA");
- theDialog->VectTxt->setText( Msg_2.latin1() );
+ // Actor Pane
+ myActorsPane = new QVBox(myWidgetStack);
+ myActorsPane->layout()->setSpacing(6);
+
+ QGroupBox* aPosGrp = new QGroupBox(2, Qt::Horizontal, "Position", myActorsPane);
+ aPosGrp->layout()->setSpacing(6);
+ QLabel* aXPosLbl = new QLabel("X:", aPosGrp);
+ myXPosLbl = new QLabel("0", aPosGrp);
+ QLabel* aYPosLbl = new QLabel("Y:", aPosGrp);
+ myYPosLbl = new QLabel("0", aPosGrp);
+ QLabel* aZPosLbl = new QLabel("Z:", aPosGrp);
+ myZPosLbl = new QLabel("0", aPosGrp);
+
+ QGroupBox* aSizeGrp = new QGroupBox(2, Qt::Horizontal, "Size", myActorsPane);
+ aSizeGrp->layout()->setSpacing(6);
+ QLabel* aXSizeLbl = new QLabel("dX:", aSizeGrp);
+ myDXLbl = new QLabel("0", aSizeGrp);
+ QLabel* aYSizeLbl = new QLabel("dY:", aSizeGrp);
+ myDYLbl = new QLabel("0", aSizeGrp);
+ QLabel* aZSizeLbl = new QLabel("dZ:",aSizeGrp );
+ myDZLbl = new QLabel("0", aSizeGrp);
+
+ myWidgetStack->addWidget(myActorsPane, 2);
+
+
+ TopLayout->addWidget(myWidgetStack, 2, 0);
+
+ // Create buttons group
+ QHBox* aBtnBox = new QHBox(this);
+ QHBoxLayout* aBtnLayout = (QHBoxLayout*)aBtnBox->layout();
+ aBtnLayout->addStretch();
+
+ QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
+ connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
+
+ TopLayout->addWidget(aBtnBox, 3, 0);
+
+ mySelection = SALOME_Selection::Selection(visuGUI->GetActiveStudy()->getSelection());
+ connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent()));
+
+ onSelectionChange(0);
}
-// ============================================================================================ //
-// PICKING CELL //
-// ============================================================================================ //
-
-void VisuGUI_Selection::PickingCell(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId){
- if(theId >= 0){
- VisuGUI_CellsResultsDlg *aResultsDlg = new VisuGUI_CellsResultsDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
- vtkCellData *aData = theDataSet->GetCellData();
- vtkCell *aCell = theDataSet->GetCell(theId);
-
- float aPntCoord[12][3];
- int aNbOfPoints = aCell->GetNumberOfPoints();
- vtkIdList *aPointList = aCell->GetPointIds();
- QListViewItem* anItem = NULL;
- for(int i = 0; i < aNbOfPoints; i++){
- float aCoord[3];
- int idCurrent = aPointList->GetId(i);
- theDataSet->GetPoint(idCurrent,aCoord);
- for (int j=0; j<3; j++)
- aPntCoord[i][j]=aCoord[j];
- anItem = new QListViewItem(aResultsDlg->ListPoints,
- anItem,
- QString::number( idCurrent ),
- QString::number( aPntCoord[i][0] ),
- QString::number( aPntCoord[i][1] ),
- QString::number( aPntCoord[i][2] ));
- }
- SetMessage(aData,theId,aResultsDlg);
+void VisuGUI_SelectionDlg::onSelectionChange(int theId) {
+ clearFields();
+ switch (theId) {
+ case 0: // Points
+ myWidgetStack->raiseWidget(myPointsPane);
+ QAD_Application::getDesktop()->SetSelectionMode(1, true);
+ break;
+ case 1: // Cells
+ myWidgetStack->raiseWidget(myCellsPane);
+ QAD_Application::getDesktop()->SetSelectionMode(3, true);
+ break;
+ case 2: // Actor
+ myWidgetStack->raiseWidget(myActorsPane);
+ QAD_Application::getDesktop()->SetSelectionMode(4, true);
+ }
+ onSelectionEvent();
+// if (VTKViewer_ViewFrame* vf = visuGUI->GetVtkViewFrame())
+// vf->Repaint();
+}
+
- aResultsDlg->IdCell->setText( QString::number( theId ) );
- aResultsDlg->NbPoint->setText( QString::number( aNbOfPoints ) );
- aResultsDlg->exec();
- delete aResultsDlg;
+void VisuGUI_SelectionDlg::closeEvent(QCloseEvent* theEvent) {
+ QAD_Application::getDesktop()->SetSelectionMode(4, true);
+ disconnect(mySelection,0,0,0);
+ QDialog::closeEvent(theEvent);
+}
+
+template<class TData> QString getValue(TData* theData, int theId){
+ if (vtkDataArray *aScalar = theData->GetScalars()){
+ float aVal = aScalar->GetTuple1(theId);
+ return QString::number(aVal);
+ } else {
+ return QString("No data");
}
}
+template<class TData> QString getVector(TData* theData, int theId){
+ if (vtkDataArray *aVector = theData->GetVectors()) {
+ float *aVal = aVector->GetTuple3(theId);
+ return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]);
+ } else {
+ return QString("No data");
+ }
+}
-// ============================================================================================ //
-// PICKING POINT //
-// ============================================================================================ //
-void VisuGUI_Selection::PickingPoint(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId){
- if(theId >= 0){
- VisuGUI_PointsResultsDlg *aResultsDlg = new VisuGUI_PointsResultsDlg(QAD_Application::getDesktop(), 0, TRUE, 0);
- vtkPointData *aData = theDataSet->GetPointData();
+#define ABS(a) (a>=0)?a:-a
- float Coord[3];
- theDataSet->GetPoint(theId,Coord);
- aResultsDlg->CoordX->setText( QString::number( Coord[0] ) );
- aResultsDlg->CoordY->setText( QString::number( Coord[1] ) );
- aResultsDlg->CoordZ->setText( QString::number( Coord[2] ) );
- aResultsDlg->IdPoint->setText( QString::number(theId) );
+void VisuGUI_SelectionDlg::onSelectionEvent() {
+ Handle(SALOME_InteractiveObject) anIO;
+ int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
+ if(VISU::Prs3d_i* aPrs3d = visuGUI->GetSelectedPrs3d(&anIO)){
+ SALOMEDS::SObject_var aSObject = visuGUI->GetStudyDocument()->FindObjectID(anIO->getEntry());
+ QString aMeshName = VisuGUI::getValue(aSObject, "myMeshName");
+ QString aFieldName = VisuGUI::getValue(aSObject, "myFieldName");
+ myMeshName->setText((aMeshName == "NULL")? QString("No name") : aMeshName);
+ myFieldName->setText((aFieldName == "NULL")? QString("No name") : aFieldName);
- SetMessage(aData,theId,aResultsDlg);
+ VISU_Actor* anVISUActor = visuGUI->GetActor(aPrs3d);
+ if (anVISUActor) {
+ float aCoord[6];
+ anVISUActor->GetBounds(aCoord);
+ myXPosLbl->setText(QString::number( aCoord[0] ));
+ myYPosLbl->setText(QString::number( aCoord[2] ));
+ myZPosLbl->setText(QString::number( aCoord[4] ));
+
+ myDXLbl->setText(QString::number( ABS(aCoord[1]-aCoord[0]) ));
+ myDYLbl->setText(QString::number( ABS(aCoord[3]-aCoord[2]) ));
+ myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) ));
+ }
+ TColStd_MapOfInteger aMapIndex;
+ mySelection->GetIndex(anIO, aMapIndex);
+ TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex);
+ if(anIter.More()){
+ VISU_Actor* anActor = visuGUI->GetActor(aPrs3d);
+ vtkDataSet* aDataSet = anActor->GetMapper()->GetInput();
+ // vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput();
+ int aID = anIter.Key();
+ vtkPointData* aPntData = aDataSet->GetPointData();
+
+ switch (aType) {
+ case 0:
+ {
+ float aCoord[3];
+ aDataSet->GetPoint(aID, aCoord);
+ myXValLbl->setText( QString::number( aCoord[0] ) );
+ myYValLbl->setText( QString::number( aCoord[1] ) );
+ myZValLbl->setText( QString::number( aCoord[2] ) );
+ myIDValLbl->setText( QString::number(aID) );
+ myScalarValLbl->setText(getValue(aPntData, aID));
+ myVectorValLbl->setText(getVector(aPntData, aID));
+ // adjustSize();
+ //qApp->processEvents();
+ }
+ break;
+ case 1:
+ {
+ int aMaxId = aDataSet->GetNumberOfCells();
+ //cout<<"### MaxId="<<aMaxId<<endl;
+ //cout<<"### SelectedId="<<aID<<endl;
+ vtkCellData* aData = aDataSet->GetCellData();
+ vtkCell* aCell = aDataSet->GetCell(aID);
+ if (aCell == NULL) return;
+
+ int aNbOfPoints = aCell->GetNumberOfPoints();
+ if (aNbOfPoints <=1 ) { // Cell is point
+ clearFields();
+ return;
+ }
+
+ myCellIDValLbl->setText( QString::number(aID) );
+ myCellScalarValLbl->setText(getValue(aData, aID));
+ myCellVectorValLbl->setText(getVector(aData, aID));
+
+ float aCoord[3];
+ vtkIdList *aPointList = aCell->GetPointIds();
+ QListViewItem* anItem = NULL;
+ myListPoints->setNumRows(aNbOfPoints);
+ for(int i = 0; i < aNbOfPoints; i++){
+ int idCurrent = aPointList->GetId(i);
+ aDataSet->GetPoint(idCurrent,aCoord);
+ myListPoints->verticalHeader()->setLabel(i, QString::number( i ));
+ myListPoints->setText(i, 0, QString::number( idCurrent ));
+ myListPoints->setText(i, 1, QString::number( aCoord[0] ));
+ myListPoints->setText(i, 2, QString::number( aCoord[1] ));
+ myListPoints->setText(i, 3, QString::number( aCoord[2] ));
+ myListPoints->setText(i, 4, getValue(aPntData, idCurrent));
+ myListPoints->setText(i, 5, getVector(aPntData, idCurrent));
+ }
+ }
+ break;
+ }
+ }
+ } else {
+ clearFields();
+ }
+}
+#undef ABS
+
- aResultsDlg->exec();
- delete aResultsDlg;
+void VisuGUI_SelectionDlg::clearFields() {
+ int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
+ switch (aType) {
+ case 0:
+ myXValLbl->setText( "" );
+ myYValLbl->setText( "" );
+ myZValLbl->setText( "" );
+ myIDValLbl->setText( "" );
+ myScalarValLbl->setText("");
+ myVectorValLbl->setText("");
+ break;
+ case 1:
+ myCellIDValLbl->setText( "" );
+ myCellScalarValLbl->setText("");
+ myCellVectorValLbl->setText("");
+ myListPoints->setNumRows(0);
+ break;
+ case 2:
+ myXPosLbl->setText("");
+ myYPosLbl->setText("");
+ myZPosLbl->setText("");
+ myDXLbl->setText("");
+ myDYLbl->setText("");
+ myDZLbl->setText("");
}
}
-void VisuGUI_Selection::Highlight(QAD_Study *theActiveStudy, const Handle(SALOME_InteractiveObject)& theIO, int theId){
- MESSAGE("HighlightCell");
- SALOME_Selection *aSel = SALOME_Selection::Selection(theActiveStudy->getSelection());
- aSel->AddIObject(theIO);
- aSel->AddOrRemoveIndex(theIO, theId, false);
-}
+
+#define SELECTBYNUM(METHODNAME, DATASETMETHOD) \
+void VisuGUI_SelectionDlg::METHODNAME(const QString& theText) { \
+ int anId = theText.toInt(); \
+ Handle(SALOME_InteractiveObject) anIO; \
+ if(VISU::Prs3d_i* aPrs3d = visuGUI->GetSelectedPrs3d(&anIO)){ \
+ TColStd_MapOfInteger aMapIndex; \
+ mySelection->GetIndex(anIO, aMapIndex); \
+ TColStd_MapIteratorOfMapOfInteger anIter(aMapIndex); \
+ if(anIter.More()){ \
+ vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput(); \
+ int aMaxId = aDataSet->DATASETMETHOD(); \
+ if(0 <= anId && anId < aMaxId){ \
+ mySelection->AddIObject(anIO); \
+ mySelection->AddOrRemoveIndex(anIO, anId, false); \
+ } \
+ } \
+ } else { \
+ myMeshName->setText(tr ("WRN_NO_AVAILABLE_DATA")); \
+ myFieldName->setText(""); \
+ } \
+}
+
+SELECTBYNUM(onPointIdEdit, GetNumberOfPoints);
+SELECTBYNUM(onCellIdEdit, GetNumberOfCells);
+
+#undef SELECTBYNUM
+
#include "SALOMEconfig.h"
#include "QAD_Desktop.h"
#include "VISU_Actor.h"
+#include "SALOME_Selection.h"
#include <vtkDataSet.h>
-
-#define SelectionPoint 1
-#define SelectionEdge 2
-#define SelectionCell 3
-#define SelectionActor 4
-
-namespace VisuGUI_Selection{
- void PickingCell(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId);
- void PickingPoint(QAD_Study *theActiveStudy, vtkDataSet *theDataSet, int theId);
- void Highlight(QAD_Study *theActiveStudy, const Handle(SALOME_InteractiveObject)& theIO, int theId);
+
+#include <qdialog.h>
+#include <qwidgetstack.h>
+#include <qhbox.h>
+#include <qvbox.h>
+#include <qtable.h>
+#include <qlineedit.h>
+
+
+class VisuGUI_SelectionDlg: public QDialog {
+ Q_OBJECT
+
+public:
+ VisuGUI_SelectionDlg();
+ ~VisuGUI_SelectionDlg(){};
+
+protected:
+ void closeEvent(QCloseEvent* theEvent);
+
+private slots:
+ void onSelectionChange(int theId);
+ void onSelectionEvent();
+ void onPointIdEdit(const QString& theText);
+ void onCellIdEdit(const QString& theText);
+
+ private:
+ void clearFields();
+
+ QLabel* myMeshName;
+ QLabel* myFieldName;
+
+ QWidgetStack* myWidgetStack;
+ QVBox* myPointsPane;
+ QWidget* myCellsPane;
+ QLabel* myXValLbl;
+ QLabel* myYValLbl;
+ QLabel* myZValLbl;
+
+ QLineEdit* myIDValLbl;
+ QLabel* myScalarValLbl;
+ QLabel* myVectorValLbl;
+
+ QTable* myListPoints;
+ QLineEdit* myCellIDValLbl;
+ QLabel* myCellScalarValLbl;
+ QLabel* myCellVectorValLbl;
+
+ QVBox* myActorsPane;
+ QLabel* myXPosLbl;
+ QLabel* myYPosLbl;
+ QLabel* myZPosLbl;
+ QLabel* myDXLbl;
+ QLabel* myDYLbl;
+ QLabel* myDZLbl;
+
+ SALOME_Selection* mySelection;
};
+
#endif
#include <qlayout.h>
#include <qgroupbox.h>
#include <qcolordialog.h>
+#include <qtabwidget.h>
-using namespace std;
-extern VisuGUI *visuGUI;
+using namespace std;
VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg()
: QDialog( QAD_Application::getDesktop(), "VisuGUI_StreamLinesDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
+ myPrs = NULL;
setCaption("Stream lines Preferences");
setSizeGripEnabled( TRUE );
- QGridLayout* TopLayout = new QGridLayout( this );
- TopLayout->setSpacing( 6 );
+ QVBoxLayout* aBoxLayout = new QVBoxLayout(this);
+ aBoxLayout->setSpacing( 6 );
+ aBoxLayout->setMargin( 11 );
+
+ QTabWidget* aTabBox = new QTabWidget(this);
+
+ QFrame* aTopBox = new QFrame(this);
+ aTopBox->setMargin( 11 );
+ QGridLayout* TopLayout = new QGridLayout( aTopBox );
+ TopLayout->setAlignment( Qt::AlignTop );
+ TopLayout->setSpacing( 8 );
TopLayout->setMargin( 11 );
// Source box
- QGroupBox* aSourceBox = new QGroupBox(tr("Source"), this);
+ QGroupBox* aSourceBox = new QGroupBox(tr("Source"), aTopBox);
aSourceBox->setColumnLayout(0, Qt::Vertical);
QGridLayout* aSrcLayout = new QGridLayout( aSourceBox->layout() );
aSrcLayout->setSpacing( 6 );
TopLayout->addMultiCellWidget(aSourceBox, 0, 0, 0, 1);
- QLabel* aStepLenLbl = new QLabel( tr( "Step Length" ), this);
+ QLabel* aStepLenLbl = new QLabel( tr( "Step Length" ), aTopBox);
TopLayout->addWidget(aStepLenLbl, 1, 0);
- myStepLen = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 0.1);
+ myStepLen = new QAD_SpinBoxDbl( aTopBox, DBL_MIN, DBL_MAX, 0.1);
myStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TopLayout->addWidget(myStepLen, 1, 1);
connect(myStepLen, SIGNAL(valueChanged(double)), this, SLOT(StepLengthChanged(double)));
- QLabel* aIntegStepLenLbl = new QLabel( tr( "Integration Step" ), this);
+ QLabel* aIntegStepLenLbl = new QLabel( tr( "Integration Step" ), aTopBox);
TopLayout->addWidget(aIntegStepLenLbl, 2, 0);
- myIntegStepLen = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 0.1);
+ myIntegStepLen = new QAD_SpinBoxDbl( aTopBox, DBL_MIN, DBL_MAX, 0.1);
myIntegStepLen->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TopLayout->addWidget(myIntegStepLen, 2, 1);
connect(myIntegStepLen, SIGNAL(valueChanged(double)), this, SLOT(IntegrationStepChanged(double)));
- QLabel* aPropagationLbl = new QLabel( tr( "Propagation Time" ), this);
+ QLabel* aPropagationLbl = new QLabel( tr( "Propagation Time" ), aTopBox);
TopLayout->addWidget(aPropagationLbl, 3, 0);
- myPropTime = new QAD_SpinBoxDbl( this, DBL_MIN, DBL_MAX, 1);
+ myPropTime = new QAD_SpinBoxDbl(aTopBox, DBL_MIN, DBL_MAX, 1);
myPropTime->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
TopLayout->addWidget(myPropTime, 3, 1);
connect(myPropTime, SIGNAL(valueChanged(double)), this, SLOT(PropagationTimeChanged(double)));
- QLabel* aDirLbl = new QLabel( tr( "Direction" ), this);
+ QLabel* aDirLbl = new QLabel( tr( "Direction" ),aTopBox);
TopLayout->addWidget(aDirLbl, 4, 0);
- myDirCombo = new QComboBox(this);
+ myDirCombo = new QComboBox(aTopBox);
myDirCombo->insertItem("Forward");
myDirCombo->insertItem("Backward");
myDirCombo->insertItem("Both");
TopLayout->addWidget(myDirCombo, 4, 1);
- myUseScalar = new QCheckBox( tr( "Magnitude coloring" ), this, "UseMagn" );
+ myUseScalar = new QCheckBox( tr( "Magnitude coloring" ), aTopBox, "UseMagn" );
connect( myUseScalar, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) );
TopLayout->addWidget(myUseScalar, 5, 0);
- SelColor = new QPushButton( tr( "Use Color" ), this, "SelColor" );
+ SelColor = new QPushButton( tr( "Use Color" ), aTopBox, "SelColor" );
connect( SelColor, SIGNAL( clicked() ), this, SLOT( setVColor() ) );
TopLayout->addWidget( SelColor, 5, 1);
+
+ aTabBox->addTab(aTopBox, "Stream Lines");
+ myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+ myScalarPane->setMargin( 5 );
+ aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+ aBoxLayout->addWidget(aTabBox);
QGroupBox* aGroupButtons = new QGroupBox( this, "GroupButtons" );
aGroupButtons->setColumnLayout(0, Qt::Vertical );
aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 );
connect( aOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
- TopLayout->addMultiCellWidget( aGroupButtons, 6, 6, 0, 1 );
+
+ aBoxLayout->addWidget(aGroupButtons);
+
enableSetColor();
}
void VisuGUI_StreamLinesDlg::initFromPrsObject(VISU::StreamLines_i* thePrs) {
- myPropTime->setValue(thePrs->GetPropagationTime());
-
- myStepLen->setRange(VISU_StreamLinesPL::GetMinStepLength(thePrs->GetIntegrationStep()),
- VISU_StreamLinesPL::GetMaxStepLength(thePrs->GetPropagationTime()));
- myStepLen->setValue(thePrs->GetStepLength());
+ myScalarPane->initFromPrsObject(thePrs);
+
+ myPrs = thePrs;
+ static int aNbOfSteps = 30;
+ VISU_StreamLinesPL* aStreamLinesPL = thePrs->GetStreamLinesPL();
+ float aMin, aMax;
+ aMin = aStreamLinesPL->GetMinPropagationTime();
+ aMax = aStreamLinesPL->GetMaxPropagationTime();
+ myPropTime->setRange(aMin,aMax);
+ myPropTime->setValue(aStreamLinesPL->GetPropagationTime());
+ myPropTime->setLineStep((aMax-aMin)/aNbOfSteps);
+
+ aMin = aStreamLinesPL->GetMinStepLength();
+ aMax = aStreamLinesPL->GetMaxStepLength();
+ myStepLen->setRange(aMin,aMax);
+ myStepLen->setValue(aStreamLinesPL->GetStepLength());
+ myStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
- myIntegStepLen->setRange(thePrs->GetMinIntegrationStep(),thePrs->GetMaxIntegrationStep());
- myIntegStepLen->setValue(thePrs->GetIntegrationStep());
+ aMin = aStreamLinesPL->GetMinIntegrationStep();
+ aMax = aStreamLinesPL->GetMaxIntegrationStep();
+ myIntegStepLen->setRange(aMin,aMax);
+ myIntegStepLen->setValue(aStreamLinesPL->GetIntegrationStep());
+ myIntegStepLen->setLineStep((aMax-aMin)/aNbOfSteps);
switch (thePrs->GetDirection()) {
case VISU::StreamLines::FORWARD:
#define INITPRS(PRSLIST, PRSNUM) \
for (int i = 0; i < PRSLIST.count(); i++) { \
- VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i])); \
+ VISU::Prs3d_i* aPrs = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(PRSLIST[i]).in()); \
if (aPrs == NULL) continue; \
if (aSrcEntry == aPrs->GetEntry()) { \
onSourceTypeChange(PRSNUM); \
}
+int VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
+ bool isAccepted = myScalarPane->storeToPrsObject(thePrs);
+ if(isAccepted){
+ thePrs->ShowColored(myUseScalar->isChecked());
+ if(!thePrs->IsColored()){
+ SALOMEDS::Color aColor;
+ aColor.R = myColor.red()/255.;
+ aColor.G = myColor.green()/255.;
+ aColor.B = myColor.blue()/255.;
+ thePrs->SetColor(aColor);
+ }
-void VisuGUI_StreamLinesDlg::storeToPrsObject(VISU::StreamLines_i* thePrs) {
- //Order of setting of the values are important
- thePrs->SetIntegrationStep(myIntegStepLen->value());
- thePrs->SetPropagationTime(myPropTime->value());
- thePrs->SetStepLength(myStepLen->value());
- switch (myDirCombo->currentItem()) {
- case 0:
- thePrs->SetDirection(VISU::StreamLines::FORWARD);
- break;
- case 1:
- thePrs->SetDirection(VISU::StreamLines::BACKWARD);
- break;
- case 2:
- thePrs->SetDirection(VISU::StreamLines::BOTH);
- }
- thePrs->ShowColored(myUseScalar->isChecked());
- if(!thePrs->IsColored()){
- SALOMEDS::Color aColor;
- aColor.R = myColor.red()/255.;
- aColor.G = myColor.green()/255.;
- aColor.B = myColor.blue()/255.;
- thePrs->SetColor(aColor);
- }
- thePrs->SetUsedPoints(myPntPercent->value());
-
- int aSrcSelection = myUseSrcCombo->currentItem();
- int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1;
- if ((aSrcSelection > 0) && (aSrcItem > -1)) {
- VISU::Prs3d_var aPrs;
- VISU::VISUType aType;
- QString aName;
- switch (aSrcSelection){
- case 1: // Entity
- aPrs = myEntityList[aSrcItem];
- aType = VISU::TENTITY;
- aName = myEntitiesLst[aSrcItem];
+ VISU::StreamLines::Direction aDirection = VISU::StreamLines::BOTH;
+ switch (myDirCombo->currentItem()) {
+ case 0:
+ aDirection = VISU::StreamLines::FORWARD;
break;
- case 2: // Family
- aPrs = myFamilyList[aSrcItem];
- aType = VISU::TFAMILY;
- aName = myFamilisLst[aSrcItem];
- break;
- case 3: // Group
- aPrs = myGroupList[aSrcItem];
- aType = VISU::TGROUP;
- aName = myGroupsLst[aSrcItem];
- break;
- case 4: // Presentation
- aPrs = myPrsList[aSrcItem];
+ case 1:
+ aDirection = VISU::StreamLines::BACKWARD;
break;
+ case 2:
+ aDirection = VISU::StreamLines::BOTH;
}
- if (!CORBA::is_nil( aPrs )) {
- thePrs->SetSource(aPrs);
- } else if (aSrcSelection == 4) {
- thePrs->SetSource(VISU::Prs3d::_nil());
- } else { // Create Mesh presentation
- thePrs->SetSource(createMesh(aType, aName));
+
+ VISU::Prs3d_var aPrs;
+ int aSrcSelection = myUseSrcCombo->currentItem();
+ int aSrcItem = (mySrcCombo->count() > 0)? mySrcCombo->currentItem() : -1;
+ if ((aSrcSelection > 0) && (aSrcItem > -1)) {
+ VISU::VISUType aType;
+ QString aName;
+ switch (aSrcSelection){
+ case 1: // Entity
+ aPrs = myEntityList[aSrcItem];
+ aType = VISU::TENTITY;
+ aName = myEntitiesLst[aSrcItem];
+ break;
+ case 2: // Family
+ aPrs = myFamilyList[aSrcItem];
+ aType = VISU::TFAMILY;
+ aName = myFamilisLst[aSrcItem];
+ break;
+ case 3: // Group
+ aPrs = myGroupList[aSrcItem];
+ aType = VISU::TGROUP;
+ aName = myGroupsLst[aSrcItem];
+ break;
+ case 4: // Presentation
+ aPrs = myPrsList[aSrcItem];
+ break;
+ }
+ if(CORBA::is_nil(aPrs) && aSrcSelection != 4){
+ aPrs = createMesh(aType, aName);
+ }
}
- } else
- thePrs->SetSource(VISU::Prs3d::_nil());
+ isAccepted = thePrs->SetParams(myIntegStepLen->value(),
+ myPropTime->value(),
+ myStepLen->value(),
+ aPrs,
+ myPntPercent->value(),
+ aDirection);
+ }
+ if(!isAccepted)
+ QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+ tr ("ERR_CANT_BUILD_PRESENTATION"),
+ tr ("VISU_BUT_OK") );
+ return isAccepted;
}
/*!
}
void VisuGUI_StreamLinesDlg::IntegrationStepChanged(double theValue) {
- PropagationTimeChanged(myPropTime->value());
}
void VisuGUI_StreamLinesDlg::PropagationTimeChanged(double theValue) {
- myStepLen->setMinValue(VISU_StreamLinesPL::GetMinStepLength(myIntegStepLen->value()));
- myStepLen->setMaxValue(VISU_StreamLinesPL::GetMaxStepLength(myPropTime->value()));
+ myStepLen->setMaxValue(theValue);
}
void VisuGUI_StreamLinesDlg::onSourceTypeChange(int theIndex) {
}
-VISU::Mesh_var VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QString theName) {
+VISU::Mesh_ptr VisuGUI_StreamLinesDlg::createMesh(VISU::VISUType theType, QString theName) {
CORBA::Object_var anObject = VISU::SObjectToObject(mySelectionObj);
VISU::Result_var aResult;
if (!CORBA::is_nil(anObject)) {
}
}
}
- CORBA::Object_var aMesh;
+ VISU::Mesh_var aMesh;
QString aMeshName = VISU::Storable::FindValue(aMap,"myMeshName");
switch (theType) {
case VISU::TFAMILY:
}
break;
}
- VISU::Mesh_i* pPresent = NULL;
- if(!CORBA::is_nil(aMesh))
- pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh));
- if (pPresent == NULL) {
+ if(!CORBA::is_nil(aMesh)){ // Create Actor
+ VISU::Mesh_i* pPresent = dynamic_cast<VISU::Mesh_i*>(VISU::GetServant(aMesh).in());
+ if(VTKViewer_ViewFrame* vf = VisuGUI::GetVtkViewFrame()){
+ try{
+ pPresent->SetPresentationType(VISU::POINT);
+ VISU_Actor *anActor = pPresent->CreateActor();
+ vf->AddActor(anActor);
+ }catch(...){
+ QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+ tr ("ERR_CANT_CREATE_ACTOR"),
+ tr ("VISU_BUT_OK") );
+ }
+ }
+ }else{
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
tr ("ERR_CANT_BUILD_PRESENTATION"),
tr ("VISU_BUT_OK") );
- return VISU::Mesh::_nil();
}
- // Create Actor
- if(VTKViewer_ViewFrame* vf = visuGUI->GetVtkViewFrame()){
- try{
- pPresent->SetPresentationType(VISU::POINT);
- VISU_Actor *anActor = pPresent->CreateActor();
- vf->AddActor(anActor);
- }catch(std::runtime_error& exc){
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_CREATE_ACTOR"),
- tr ("VISU_BUT_OK") );
- }
- }
- return pPresent->_this();
+ return aMesh._retn();
+}
+
+void VisuGUI_StreamLinesDlg::accept() {
+ if (myScalarPane->check()) QDialog::accept();
}
#ifndef VISUGUI_STREAMLINESDLG_H
#define VISUGUI_STREAMLINESDLG_H
+#include "VisuGUI_ScalarBarDlg.h"
#include "QAD_SpinBoxDbl.h"
#include <qdialog.h>
~VisuGUI_StreamLinesDlg() {};
void initFromPrsObject(VISU::StreamLines_i* thePrs);
- void storeToPrsObject(VISU::StreamLines_i* thePrs);
+ int storeToPrsObject(VISU::StreamLines_i* thePrs);
void setColor( QColor color );
void enableMagnColor( bool enable );
+protected slots:
+ void accept();
+
private slots:
void onSelectionActive(bool theActive);
void StepLengthChanged(double theValue);
void onSourceTypeChange(int theIndex);
private:
- VISU::Mesh_var createMesh(VISU::VISUType theType, QString theName);
+ VISU::Mesh_ptr createMesh(VISU::VISUType theType, QString theName);
QAD_SpinBoxDbl* myStepLen;
QAD_SpinBoxDbl* myIntegStepLen;
QStringList myPrsLst;
SALOMEDS::SObject_var mySelectionObj;
+ VisuGUI_ScalarBarPane* myScalarPane;
+ VISU::StreamLines_i* myPrs;
private slots:
void setVColor();
void enableSetColor();
connect( myTypeCombo, SIGNAL( activated(int) ),
this, SLOT( onTypeChanged(int) ) );
- QPushButton* aBarBtn = new QPushButton("Scalar Bar...", aPropBox);
- connect( aBarBtn, SIGNAL( clicked() ),
- this, SLOT( onScalarBarDlg() ) );
+ // QPushButton* aBarBtn = new QPushButton("Scalar Bar...", aPropBox);
+ //connect( aBarBtn, SIGNAL( clicked() ),
+ // this, SLOT( onScalarBarDlg() ) );
myPropBtn = new QPushButton("Properties...", aPropBox);
- myPropBtn->setEnabled(theAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP);
+ // myPropBtn->setEnabled(theAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP);
connect( myPropBtn, SIGNAL( clicked() ),
this, SLOT( onPreferencesDlg() ) );
QHBoxLayout* aBtnLayout = new QHBoxLayout(aBtnBox->layout());
aBtnLayout->addStretch();
- QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox);
+ QPushButton* aCloseBtn = new QPushButton(tr("VISU_BUT_OK"), aBtnBox);
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close()));
aMainLayout->addWidget(aBtnBox);
aData.myPrsType = VISU::TSTREAMLINES;
break;
}
- myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
+ //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
}
//************************************************************************
break;
}
myAnimator->clearData(aData);
- myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
+ //myPropBtn->setEnabled(aData.myPrsType != VISU::TSCALARMAP);
//myAnimator->generatePresentations(myFieldLst->currentItem());
}
//************************************************************************
-void SetupDlg::onScalarBarDlg() {
+/*void SetupDlg::onScalarBarDlg() {
QApplication::setOverrideCursor( Qt::waitCursor );
FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem());
if (aData.myPrs == 0)
aScalarBarDlg->storeToPrsObject(aData.myPrs[i]);
}
}
-
+*/
//************************************************************************
void SetupDlg::onPreferencesDlg() {
QApplication::setOverrideCursor( Qt::waitCursor );
myAnimator->generatePresentations(myFieldLst->currentItem());
QApplication::restoreOverrideCursor();
+#define EDITPRS(TYPE, DLG) \
+ { \
+ DLG* aDlg = new DLG(); \
+ aDlg->initFromPrsObject(dynamic_cast<TYPE*>(aData.myPrs[0])); \
+ if (aDlg->exec()) { \
+ for (int i = 0; i < aData.myNbFrames; i++) \
+ aDlg->storeToPrsObject(dynamic_cast<TYPE*>(aData.myPrs[i])); \
+ } \
+ delete aDlg; \
+ }
+
+
switch (myTypeCombo->currentItem()) {
+ case 0: //Scalar Map
+ EDITPRS(VISU::ScalarMap_i, VisuGUI_ScalarBarDlg);
+ break;
case 1: //Iso Surfaces
- {
- VisuGUI_IsoSurfacesDlg* aDlg = new VisuGUI_IsoSurfacesDlg();
- aDlg->initFromPrsObject(dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[0]));
- if (aDlg->exec()) {
- for (int i = 0; i < aData.myNbFrames; i++)
- aDlg->storeToPrsObject(dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[i]));
- }
- }
+ EDITPRS(VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg);
break;
case 2: //Cut Planes
+ // EDITPRS(VISU::CutPlanes_i, VisuGUI_CutPlanesDlg);
{
- VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg();
+ VisuGUI_CutPlanesDlg* aDlg = new VisuGUI_CutPlanesDlg(false, true);
aDlg->initFromPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[0]));
if (aDlg->exec()) {
for (int i = 0; i < aData.myNbFrames; i++)
aDlg->storeToPrsObject(dynamic_cast<VISU::CutPlanes_i*>(aData.myPrs[i]));
}
+ delete aDlg;
}
break;
case 3: //Deformed Shape
- {
- VisuGUI_MagnitudeDlg* aDlg = new VisuGUI_MagnitudeDlg();
- aDlg->initFromPrsObject(dynamic_cast<VISU::DeformedShape_i*>(aData.myPrs[0]));
- if (aDlg->exec()) {
- for (int i = 0; i < aData.myNbFrames; i++)
- aDlg->storeToPrsObject(dynamic_cast<VISU::DeformedShape_i*>(aData.myPrs[i]));
- }
- }
+ EDITPRS(VISU::DeformedShape_i, VisuGUI_MagnitudeDlg);
break;
case 4: //Vectors
- {
- VisuGUI_VectorsDlg* aDlg = new VisuGUI_VectorsDlg();
- aDlg->initFromPrsObject(dynamic_cast<VISU::Vectors_i*>(aData.myPrs[0]));
- if (aDlg->exec()) {
- for (int i = 0; i < aData.myNbFrames; i++)
- aDlg->storeToPrsObject(dynamic_cast<VISU::Vectors_i*>(aData.myPrs[i]));
- }
- }
+ EDITPRS(VISU::Vectors_i, VisuGUI_VectorsDlg);
break;
case 5: //Stream Lines
- {
- VisuGUI_StreamLinesDlg* aDlg = new VisuGUI_StreamLinesDlg();
- aDlg->initFromPrsObject(dynamic_cast<VISU::StreamLines_i*>(aData.myPrs[0]));
- if (aDlg->exec()) {
- for (int i = 0; i < aData.myNbFrames; i++)
- aDlg->storeToPrsObject(dynamic_cast<VISU::StreamLines_i*>(aData.myPrs[i]));
- }
- }
+ EDITPRS(VISU::StreamLines_i, VisuGUI_StreamLinesDlg);
break;
}
+#undef EDITPRS
}
//************************************************************************
if (myAnimator->getNbFrames() == 0) {
myPlayFrame->setEnabled(false);
QApplication::restoreOverrideCursor();
- QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_NO_ANIMATIONDATA"));
+ QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_NO_ANIMATIONDATA"));
return;
}
mySlider->setMaxValue(myAnimator->getNbFrames()-1);
//************************************************************************
void VisuGUI_TimeAnimationDlg::onSetupDlg() {
+ if (myAnimator->getNbFrames() > 0) myAnimator->firstFrame();
SetupDlg* aDlg = new SetupDlg(this, myAnimator);
aDlg->exec();
myPlayFrame->setEnabled(false);
//************************************************************************
void VisuGUI_TimeAnimationDlg::onBrowse() {
- myPathEdit->setText(QAD_FileDlg::getExistingDirectory(this, "/","Select path"));
+ QString aPath = QAD_FileDlg::getExistingDirectory(this, "/","Select path");
+ if (!aPath.isEmpty())
+ myPathEdit->setText(aPath);
}
private slots:
void onFieldChange(int theIndex);
void onTypeChanged(int theIndex);
- void onScalarBarDlg();
+ // void onScalarBarDlg();
void onPreferencesDlg();
void onRangeCheck(bool theCheck);
void onMinValue(double theVal);
#include <qlayout.h>
#include <qcolordialog.h>
+#include <qtabwidget.h>
using namespace std;
TopLayout->setSpacing( 6 );
TopLayout->setMargin( 11 );
- TopGroup = new QButtonGroup( this, "TopGroup" );
+ QTabWidget* aTabBox = new QTabWidget(this);
+
+ QVBox* aBox = new QVBox(this);
+ aBox->setMargin( 11 );
+
+ TopGroup = new QButtonGroup( aBox, "TopGroup" );
TopGroup->setColumnLayout(0, Qt::Vertical );
TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
+ TopGroup->layout()->setMargin( 5 );
QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
TopGroupLayout->setAlignment( Qt::AlignTop );
TopGroupLayout->setSpacing( 6 );
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
// top layout
- TopLayout->addWidget( TopGroup );
+ aTabBox->addTab(aBox, "Vectors");
+ myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+ myScalarPane->setMargin( 5 );
+ aTabBox->addTab(myScalarPane, "Scalar Bar");
+
+ TopLayout->addWidget( aTabBox );
TopLayout->addWidget( GroupButtons );
// signals and slots connections
enableSetColor();
}
-/*!
- Destructor
-*/
-VisuGUI_VectorsDlg::~VisuGUI_VectorsDlg()
-{
-}
void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) {
+ myScalarPane->initFromPrsObject(thePrs);
setScaleFactor(thePrs->GetScale());
setLineWidth((int)thePrs->GetLineWidth());
setUseMagnColor(thePrs->IsColored());
}
-void VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
+int VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
+ myScalarPane->storeToPrsObject(thePrs);
thePrs->SetScale(getScaleFactor());
thePrs->SetLineWidth(getLineWidth());
thePrs->ShowColored(getUseMagnColor());
thePrs->SetGlyphType(getGlyphType());
} else
thePrs->SetGlyphType(VISU::Vectors::NONE);
+ return 1;
}
}
+void VisuGUI_VectorsDlg::accept() {
+ if (myScalarPane->check()) QDialog::accept();
+}
#ifndef VISUGUI_VECTORSDLG_H
#define VISUGUI_VECTORSDLG_H
+#include "VisuGUI_ScalarBarDlg.h"
#include "QAD_SpinBoxDbl.h"
#include <qdialog.h>
public:
VisuGUI_VectorsDlg();
- ~VisuGUI_VectorsDlg();
+ ~VisuGUI_VectorsDlg() {};
void setScaleFactor( double sf );
double getScaleFactor();
void enableMagnColor( bool enable );
void initFromPrsObject(VISU::Vectors_i* thePrs);
- void storeToPrsObject(VISU::Vectors_i* thePrs);
-
+ int storeToPrsObject(VISU::Vectors_i* thePrs);
+protected slots:
+ void accept();
+
private:
QGroupBox* TopGroup;
QCheckBox* UseMagn;
QPushButton* buttonCancel;
QColor myColor;
+ VisuGUI_ScalarBarPane* myScalarPane;
private slots:
void enableGlyphType();
- void setVColor();
- void enableSetColor();
+ void setVColor();
+ void enableSetColor();
};
#endif // VISUGUI_VECTORSDLG_H
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_VisuAsDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-#include "VisuGUI_VisuAsDlg.h"
-
-#include "VISU_Actor.h"
-#include "VISU_Prs3d_i.hh"
-
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
-#include "VTKViewer_ViewFrame.h"
-
-#include <qlayout.h>
-
-using namespace std;
-
-/*!
- Constructor
-*/
-VisuGUI_VisuAsDlg::VisuGUI_VisuAsDlg( QWidget* parent, const char* name, bool modal, WFlags fl)
- : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- if ( !name )
- setName( "VisuGUI_VisuAsDlg" );
- setCaption( tr( "Visualize As" ) );
- setSizeGripEnabled( TRUE );
-
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- TopGroup = new QGroupBox( this, "TopGroup" );
- TopGroup->setColumnLayout(0, Qt::Vertical );
- TopGroup->layout()->setSpacing( 0 );
- TopGroup->layout()->setMargin( 0 );
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
- TopGroupLayout->setAlignment( Qt::AlignTop );
- TopGroupLayout->setSpacing( 6 );
- TopGroupLayout->setMargin( 11 );
-
- TypeLabel = new QLabel( tr( "Type of Object:" ), TopGroup, "TypeLabel" );
- TypeCombo = new QComboBox( FALSE, TopGroup, "TypeCombo" );
- TypeCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- TypeCombo->setMinimumSize( 150, 0 );
-
- ObjectsLabel = new QLabel( tr( "List of Objects" ), TopGroup, "ObjectsLabel" );
- ObjectsList = new QListBox( TopGroup, "ObjectsList" );
- ObjectsList->setSelectionMode( QListBox::Single );
- ObjectsList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- ObjectsList->setMinimumSize( 150, 80 );
-
- TopGroupLayout->addWidget( TypeLabel, 0, 0 );
- TopGroupLayout->addWidget( ObjectsLabel, 0, 1 );
- TopGroupLayout->addWidget( TypeCombo, 1, 0 );
- TopGroupLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 2, 0 );
- TopGroupLayout->addMultiCellWidget( ObjectsList, 1, 2, 1, 1 );
-
- // Common buttons ===========================================================
- GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setSpacing( 0 );
- GroupButtons->layout()->setMargin( 0 );
- QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setSpacing( 6 );
- GroupButtonsLayout->setMargin( 11 );
-
- buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
- GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
- buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
- buttonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
- // top layout
- TopLayout->addWidget( TopGroup );
- TopLayout->addWidget( GroupButtons );
-
- // signals and slots connections
- connect( TypeCombo, SIGNAL( activated( const QString& ) ), this, SLOT( RefreshListActors( const QString& ) ) );
- connect( ObjectsList, SIGNAL( selectionChanged() ), this, SLOT( updateButtonsState() ) );
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
- addType( tr( "All" ) );
-}
-
-/*!
- Destructor
-*/
-VisuGUI_VisuAsDlg::~VisuGUI_VisuAsDlg()
-{
-}
-
-/*!
- Adds type
-*/
-void VisuGUI_VisuAsDlg::addType( QString type )
-{
- int ind = TypeCombo->currentItem();
- if ( TypeCombo->count() <= 0 ) ind = -1;
- TypeCombo->insertItem( type );
- if ( ind != TypeCombo->currentItem() )
- RefreshListActors( TypeCombo->currentText() );
-}
-
-/*!
- Called when user selects objects type from combo box
-*/
-void VisuGUI_VisuAsDlg::RefreshListActors( const QString &VAType )
-{
- int test = 0;
- if ( VAType == QString( "All" ) )
- test = -1;
- else if ( VAType == QString( "Deformed Shape" ) )
- test = VISU::TDEFORMEDSHAPE;
- else if ( VAType == QString( "Vectors" ) )
- test = VISU::TVECTORS;
- else if ( VAType == QString( "Scalar Map" ) )
- test = VISU::TSCALARMAP;
- else if ( VAType == QString( "Iso-Surfaces" ) )
- test = VISU::TISOSURFACE;
- else if ( VAType == QString( "Cut Planes" ) )
- test = VISU::TCUTPLANES;
- else
- return;
-
- ObjectsList->clear();
-
- QAD_Study *myActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
- int nbSf = myActiveStudy->getStudyFramesCount();
- for ( int i = 0; i < nbSf; i++ ) {
- QAD_StudyFrame* sf = myActiveStudy->getStudyFrame(i);
- if ( sf->getTypeView() == VIEW_VTK ) {
- vtkRenderer* aRenderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer();
- vtkActorCollection* ac = aRenderer->GetActors();
- vtkActor *anActor;
- for( ac->InitTraversal(); ( anActor = ac->GetNextActor() ) != NULL; ) {
- if ( anActor->IsA( "VISU_Actor" ) ) {
- VISU_Actor* VISUActor = VISU_Actor::SafeDownCast( anActor );
- if ( ActorTypeIsValid( VISUActor, test ) )
- ObjectsList->insertItem( VISUActor->getName() );
- }
- }
- }
- }
- updateButtonsState();
-}
-
-/*!
- Checks if type of actor is valid according to test value [ static ]
-*/
-bool VisuGUI_VisuAsDlg::ActorTypeIsValid( VISU_Actor* Actor, int test )
-{
- VISU::Prs3d_i* aPrs3d = Actor->GetPrs3d();
- if(!aPrs3d) return false;
- if(test == -1) {
- switch(aPrs3d->GetType()){
- case VISU::TSCALARMAP:
- case VISU::TISOSURFACE:
- case VISU::TDEFORMEDSHAPE:
- case VISU::TCUTPLANES:
- case VISU::TCUTLINES:
- case VISU::TVECTORS:
- case VISU::TSTREAMLINES:
- return true;
- default:
- return false;
- }
- }else{
- return aPrs3d->GetType() == test;
- }
-}
-
-/*!
- Gets object selected
-*/
-QString VisuGUI_VisuAsDlg::getObject()
-{
- for( int i = 0; i < ObjectsList->count(); i++ ) {
- if ( ObjectsList->isSelected( i ) ) {
- return ObjectsList->text( i );
- }
- }
- return QString::null;
-}
-
-/*!
- Called when selection changed
-*/
-void VisuGUI_VisuAsDlg::updateButtonsState()
-{
- bool selected = false;
- for( int i = 0; i < ObjectsList->count(); i++ ) {
- if ( ObjectsList->isSelected( i ) ) {
- selected = true;
- break;
- }
- }
- buttonOk->setEnabled( selected );
-}
-
-
-
-
-
+++ /dev/null
-// VISU VISUGUI : GUI of VISU component
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : VisuGUI_VisuAsDlg.h
-// Author : Laurent CORNABE & Hubert ROLLAND
-// Module : VISU
-// $Header$
-
-#ifndef VISUGUI_VISUASDLG_H
-#define VISUGUI_VISUASDLG_H
-
-#include <qdialog.h>
-#include <qcombobox.h>
-#include <qgroupbox.h>
-#include <qlistbox.h>
-#include <qpushbutton.h>
-#include <qlabel.h>
-
-class VISU_Actor;
-
-class VisuGUI_VisuAsDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- VisuGUI_VisuAsDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~VisuGUI_VisuAsDlg();
-
- void addType( QString type );
- QString getObject();
- static bool ActorTypeIsValid(VISU_Actor *Actor, int test);
-
-private:
- QGroupBox* TopGroup;
- QLabel* TypeLabel;
- QComboBox* TypeCombo;
- QLabel* ObjectsLabel;
- QListBox* ObjectsList;
- QGroupBox* GroupButtons;
- QPushButton* buttonOk;
- QPushButton* buttonCancel;
-
-private slots:
- void RefreshListActors( const QString &VAType );
- void updateButtonsState();
-};
-
-#endif // VISUGUI_VISUASDLG_H
# Libraries targets
LIB = libVISUEngine.la
LIB_SRC = VISUConfig.cc VISU_Gen_i.cc VISU_Result_i.cc \
- VISU_ViewManager_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
+ VISU_ViewManager_i.cc VISU_PrsObject_i.cc VISU_Table_i.cc \
VISU_Prs3d_i.cc VISU_Mesh_i.cc VISU_ScalarMap_i.cc \
VISU_IsoSurfaces_i.cc VISU_DeformedShape_i.cc \
VISU_CutPlanes_i.cc VISU_CutLines_i.cc \
LIB_MOC = VISU_TimeAnimation.h
-LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl SALOME_Exception.idl SALOME_Session.idl MED.idl
+LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl \
+ SALOME_Exception.idl SALOME_GenericObj.idl \
+ SALOME_Session.idl MED.idl
LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl
# Executables targets
VISU_TimeAnimation.h
# additionnal information to compil and link file
-
CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \
- $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS -lSalomeHDFPersist \
- -lSalomeContainer -lOpUtil -lSalomeGUI -lVTKViewer \
- -lVisuConvertor -lVisuPipeLine -lVisuObject \
+ $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
+ -I${KERNEL_ROOT_DIR}/include/salome
+
+LDFLAGS += $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS \
+ -lSalomeContainer -lOpUtil -lSalomeGUI -lVTKViewer -lSalomeHDFPersist \
+ -lVisuConvertor -lVisuPipeLine -lVisuObject -lSalomeGenericObj \
-L${KERNEL_ROOT_DIR}/lib/salome
-LIBS+= $(PYTHON_LIBS) $(MED2_LIBS) $(HDF5_LIBS) -lPlot2d -lSalomeHDFPersist -lSALOMELocalTrace -lRegistry -lqsplitterP -lSalomeLifeCycleCORBA -lSalomeObject -lSalomeNotification -L${KERNEL_ROOT_DIR}/lib/salome
+LIBS+= $(PYTHON_LIBS) $(MED2_LIBS) $(HDF5_LIBS) -lPlot2d \
+ -L${KERNEL_ROOT_DIR}/lib/salome
# additional file to be cleaned
MOSTLYCLEAN =
CLEAN =
DISTCLEAN =
-@CONCLUDE@
+@CONCLUDE@
\ No newline at end of file
//===========================================================================
QMutex* Base_i::myMutex = NULL; //apo - &VISUMutex;
CORBA::ORB_var Base_i::myOrb;
- PortableServer::POA_var Base_i::myPOA;
+ PortableServer::POA_var Base_i::myPoa;
SALOME_NamingService* Base_i::myNamingService;
SALOME_LifeCycleCORBA* Base_i::myEnginesLifeCycle;
VISU_Gen_i* Base_i::myVisuGenImpl;
+
+ Base_i::Base_i() {}
+
Base_i::~Base_i() {}
+
char* Base_i::GetID(){
- CORBA::Object_ptr anObject = _this();
- CORBA::String_var aString = myOrb->object_to_string(anObject);
- return aString._retn();
- //return CORBA::string_dup(myOrb->object_to_string(_this()));
+ if(myID == ""){
+ CORBA::Object_var anObject = _this();
+ CORBA::String_var anIOR = myOrb->object_to_string(anObject);
+ myID = anIOR.in();
+ }
+ return CORBA::string_dup(myID.c_str());
}
//===========================================================================
ToStream(strOut);
strOut<<ends;
if(MYDEBUG) MESSAGE("Storable::ToString - "<<strOut.str());
- //apo - auto_ptr<char> aRet(strOut.str());
return strOut.str();
}
QString strIn( theLocalPersistentID.c_str() );
TRestoringMap aMap;
StrToMap(strIn,aMap);
- //CORBA::String_var aResultID(GetResultSO(theSObject)->GetID());
- //aMap.insert(TRestoringMap::value_type("ResultID", strdup(aResultID)));
bool isExist;
QString aComment = VISU::Storable::FindValue(aMap,"myComment",&isExist);
if ( isExist ) {
//===========================================================================
- PortableServer::Servant GetServant(CORBA::Object_ptr theObject){
+ PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject){
if(CORBA::is_nil(theObject)) return NULL;
try{
PortableServer::POA_ptr aPOA = Base_i::GetPOA();
- return aPOA->reference_to_servant(theObject);
+ PortableServer::Servant aServant = aPOA->reference_to_servant(theObject);
+ return aServant;
} catch (...) {
- INFOS("GetServant - Unknown exception was accured!");
+ INFOS("GetServant - Unknown exception was accured!!!");
return NULL;
}
}
anObj = anORB->string_to_object(aValue);
}
}catch(...){
- INFOS("SObjectToObject - Unknown exception was accured!");
+ INFOS("SObjectToObject - Unknown exception was accured!!!");
}
return anObj;
}
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr);
aCmnt->SetValue(theComment);
- INFOS("CreateAttributes - Comment = "<<theComment);
+ INFOS("CreateAttributes - Comment = "<<theComment);
}
if(strcmp(theRefFatherEntry,"") != 0){
SALOMEDS::SObject_var aRefFather = theStudyDocument->FindObjectID(theRefFatherEntry);
}
CORBA::String_var anEntry = newObj->GetID();
string aRet(anEntry);
- if(0 && MYDEBUG) MESSAGE("CreateAttributes - anEntry = "<<aRet<<"; IOR = "<<theIOR);
+ if(MYDEBUG)
+ INFOS("CreateAttributes - StudyId = "<<theStudyDocument->StudyId()<<"; anEntry = "<<aRet<<"; IOR = '"<<theIOR<<"'");
return aRet;
}
}
public virtual PortableServer::RefCountServantBase
{
public:
+ Base_i();
virtual ~Base_i();
virtual char* GetID();
virtual VISU::VISUType GetType() = 0;
+
+ protected:
+ std::string myID;
+
protected:
static QMutex* myMutex;
static CORBA::ORB_var myOrb;
- static PortableServer::POA_var myPOA;
+ static PortableServer::POA_var myPoa;
static SALOME_NamingService* myNamingService;
static VISU_Gen_i* myVisuGenImpl;
static SALOME_LifeCycleCORBA* myEnginesLifeCycle;
+
public:
- static CORBA::ORB_ptr GetORB() { return myOrb;}
- static PortableServer::POA_ptr GetPOA() { return myPOA;}
+ static CORBA::ORB_var GetORB() { return myOrb;}
+ static PortableServer::POA_var GetPOA() { return myPoa;}
static SALOME_NamingService* GetNS() { return myNamingService;}
static SALOME_LifeCycleCORBA* GetLCC() { return myEnginesLifeCycle;}
static VISU_Gen_i* GetVisuGenImpl() { return myVisuGenImpl;}
const CORBA::Boolean IsMultifile();
QString GenerateName(const string& theFmt, int theId);
- PortableServer::Servant GetServant(CORBA::Object_ptr theObject);
+ PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject);
CORBA::Object_var SObjectToObject(SALOMEDS::SObject_ptr theSObject);
SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument);
// Copyright (C) 2003 CEA/DEN, EDF R&D
#include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_ConvertorUtils.hxx"
#include <valarray>
#include <vtkCellType.h>
#endif
int VISU::CutLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+ const char* theFieldName, int theIteration, int isMemoryCheck)
{
- return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
}
int VISU::CutLines_i::myNbPresent = 0;
const string VISU::CutLines_i::myComment = "CUTLINES";
const char* VISU::CutLines_i::GetComment() const { return myComment.c_str();}
-VISU::CutLines_i::CutLines_i(Result_i* theResult, bool theAddToStudy) :
+
+VISU::CutLines_i::CutLines_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult),
- ScalarMap_i(theResult, theAddToStudy)
+ Prs3d_i(theResult,theSObject),
+ ScalarMap_i(theResult,theAddToStudy,theSObject)
{
myCutLinesPL = NULL;
}
-void VISU::CutLines_i::Destroy(){
- ScalarMap_i::Destroy();
-}
+
void VISU::CutLines_i::SameAs(const CutLines_i* theOrigin){
CutLines_i* aCutLines = const_cast<CutLines_i*>(theOrigin);
VISU::ScalarMap_i::SameAs(theOrigin);
-
- //SetNbLines(aCutLines->GetNbLines());
- //SetDisplacement(aCutLines->GetDisplacement());
- //SetDisplacement2(aCutLines->GetDisplacement2());
- //SetOrientationType(aCutLines->GetOrientationType());
- //SetOrientationType2(aCutLines->GetOrientationType2());
- //SetRotateX(aCutLines->GetRotateX());
- //SetRotateY(aCutLines->GetRotateY());
- //SetRotateX2(aCutLines->GetRotateX2());
- //SetRotateY2(aCutLines->GetRotateY2());
}
+
VISU::Storable* VISU::CutLines_i::Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration)
{
return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
}
+
VISU::Storable* VISU::CutLines_i::Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&)
{
- ScalarMap_i::Restore(theMap);
+ DoHook();
SetNbLines(VISU::Storable::FindValue(theMap,"myNbLines").toInt());
SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement[0]").toDouble());
SetDisplacement2(VISU::Storable::FindValue(theMap,"myDisplacement[1]").toDouble());
- SetOrientationType(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[0]").toInt()));
- SetOrientationType(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()));
- SetRotateX(VISU::Storable::FindValue(theMap,"aRot[0][0]").toDouble());
- SetRotateY(VISU::Storable::FindValue(theMap,"aRot[0][1]").toDouble());
- SetRotateX2(VISU::Storable::FindValue(theMap,"aRot[1][0]").toDouble());
- SetRotateY2(VISU::Storable::FindValue(theMap,"aRot[1][1]").toDouble());
+ SetOrientation(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[0]").toInt()),
+ Storable::FindValue(theMap,"aRot[0][0]").toDouble(),
+ Storable::FindValue(theMap,"aRot[0][1]").toDouble());
+ SetOrientation2(CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane[1]").toInt()),
+ Storable::FindValue(theMap,"aRot[1][0]").toDouble(),
+ Storable::FindValue(theMap,"aRot[1][1]").toDouble());
+ if (VISU::Storable::FindValue(theMap,"myBasePlaneCondition").toInt())
+ SetDefault();
+ else
+ SetBasePlanePosition(VISU::Storable::FindValue(theMap,"myBasePlanePosition").toDouble());
- return Build(true);
+ QStringList aPosList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLinePosition") );
+ QStringList aCondList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myLineCondition") );
+ for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++)
+ if(aCondList[i].toInt() == 0)
+ SetLinePosition(i,aPosList[i].toDouble());
+
+ return ScalarMap_i::Restore(theMap);
}
+
void VISU::CutLines_i::ToStream(std::ostringstream& theStr){
ScalarMap_i::ToStream(theStr);
- Storable::DataToStream( theStr, "myNbLines", int(GetNbLines()) );
+
+ int aNbLines = GetNbLines();
+
+ Storable::DataToStream( theStr, "myNbLines", aNbLines );
Storable::DataToStream( theStr, "myDisplacement[0]", GetDisplacement() );
Storable::DataToStream( theStr, "myDisplacement[1]", GetDisplacement2() );
Storable::DataToStream( theStr, "myBasePlane[0]", int(GetOrientationType()) );
Storable::DataToStream( theStr, "aRot[0][1]", GetRotateY() );
Storable::DataToStream( theStr, "aRot[1][0]", GetRotateX2() );
Storable::DataToStream( theStr, "aRot[1][1]", GetRotateY2() );
-}
+ Storable::DataToStream( theStr, "myBasePlanePosition", GetBasePlanePosition() );
+ Storable::DataToStream( theStr, "myBasePlaneCondition", IsDefault() );
-VISU::Storable* VISU::CutLines_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- VISU::Result_i* pResult = GetResult(theSObject);
- if(pResult != NULL){
- VISU::CutLines_i* pResent = new VISU::CutLines_i(pResult);
- return pResent->Restore(theMap);
+ QString aStrPos, aStrCon;
+ for(int i = 0, iEnd = GetNbLines(); i < iEnd; i++){
+ aStrPos.append(QString::number(GetLinePosition(i)) + "|");
+ aStrCon.append(QString::number(IsDefaultPosition(i)) + "|");
}
- return NULL;
+ Storable::DataToStream( theStr, "myLinePosition", aStrPos.latin1());
+ Storable::DataToStream( theStr, "myLineCondition", aStrCon.latin1());
}
-
VISU::CutLines_i::~CutLines_i(){
if(MYDEBUG) MESSAGE("CutLines_i::~CutLines_i()");
}
-void VISU::CutLines_i::SetOrientationType(VISU::CutPlanes::Orientation theOrient){
- myCutLinesPL->SetPlaneOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient));
+void VISU::CutLines_i::SetOrientation(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle)
+{
+ myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
+ theXAngle,theYAngle);
}
-void VISU::CutLines_i::SetOrientationType2(VISU::CutPlanes::Orientation theOrient){
- myCutLinesPL->SetPlaneOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),1);
+void VISU::CutLines_i::SetOrientation2(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle)
+{
+ myCutLinesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
+ theXAngle,theYAngle,1);
}
VISU::CutPlanes::Orientation VISU::CutLines_i::GetOrientationType() {
return VISU::CutPlanes::Orientation(myCutLinesPL->GetPlaneOrientation(1));
}
+CORBA::Double VISU::CutLines_i::GetRotateX(){
+ return myCutLinesPL->GetRotateX();
+}
+CORBA::Double VISU::CutLines_i::GetRotateY(){
+ return myCutLinesPL->GetRotateY();
+}
+
+CORBA::Double VISU::CutLines_i::GetRotateX2(){
+ return myCutLinesPL->GetRotateX(1);
+}
+CORBA::Double VISU::CutLines_i::GetRotateY2(){
+ return myCutLinesPL->GetRotateY(1);
+}
+
void VISU::CutLines_i::SetDisplacement(CORBA::Double theDisp) {
myCutLinesPL->SetDisplacement(theDisp);
}
-void VISU::CutLines_i::SetRotateX(CORBA::Double theAngle){
- myCutLinesPL->SetRotateX(theAngle);
-}
-CORBA::Double VISU::CutLines_i::GetRotateX(){
- return myCutLinesPL->GetRotateX();
-}
-
-void VISU::CutLines_i::SetRotateY(CORBA::Double theAngle){
- myCutLinesPL->SetRotateY(theAngle);
-}
-CORBA::Double VISU::CutLines_i::GetRotateY(){
- return myCutLinesPL->GetRotateY();
-}
-
-void VISU::CutLines_i::SetRotateX2(CORBA::Double theAngle){
- myCutLinesPL->SetRotateX(theAngle,1);
-}
-CORBA::Double VISU::CutLines_i::GetRotateX2(){
- return myCutLinesPL->GetRotateX(1);
-}
-
-void VISU::CutLines_i::SetRotateY2(CORBA::Double theAngle){
- myCutLinesPL->SetRotateY(theAngle,1);
-}
-CORBA::Double VISU::CutLines_i::GetRotateY2(){
- return myCutLinesPL->GetRotateY(1);
-}
-
void VISU::CutLines_i::DoHook(){
if(!myPipeLine) myPipeLine = VISU_CutLinesPL::New();
myCutLinesPL = dynamic_cast<VISU_CutLinesPL*>(myPipeLine);
}
void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
-
- if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
- Update();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
- SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
-
- typedef set<long> TLineCont;
- typedef map<float,TLineCont> TXMap;
- typedef map<float,float> TXYMap;
- typedef vector<TXYMap> TCurveVect;
-
- const VISU::TField::TValField& aValField = myField->myValField;
- const VISU::TField::TValForTime& aValForTime = aValField.find((int)myIteration)->second;
- const VISU::TField::TTime& aTime = aValForTime.myTime;
- QString aTitle;
- //aTitle.sprintf("%s %s",myTitle.c_str(),aTime.second.c_str());
- aTitle.sprintf("%s",myTitle.c_str());
- aTitle = aTitle.simplifyWhiteSpace();
- aTableOfReal->SetTitle(aTitle.latin1());
-
- int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputs();
- if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
- TCurveVect aCurveVect(iLineEnd);
- TLineCont aLineCont;
- TXMap aXMap;
- const float *aDirLn = myCutLinesPL->GetDirLn();
- const float *aBasePnt = myCutLinesPL->GetBasePnt();
- const float *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
- for(int iLine = 0; iLine < iLineEnd; iLine++){
- vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
- aDataSet->Update();
- int aNbPoints = aDataSet->GetNumberOfPoints();
- vtkPointData *aPointData = aDataSet->GetPointData();
- vtkDataArray *aScalars = aPointData->GetScalars();
- vtkCellDataToPointData *aFilter = NULL;
- if(!aScalars) {
- aFilter = vtkCellDataToPointData::New();
- aFilter->SetInput(aDataSet);
- aFilter->PassCellDataOn();
- aDataSet = aFilter->GetOutput();
+ try{
+ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal");
+ Update();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+ anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal");
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+
+ typedef set<float> TXCont;
+ typedef map<float,float> TXYMap;
+ typedef map<int,TXYMap> TXYMapCont;
+ typedef map<long,long> TLineIdCont;
+
+ const VISU::TField::TValField& aValField = myField->myValField;
+ const VISU::TField::TValForTime& aValForTime = aValField.find((int)myIteration)->second;
+ const VISU::TField::TTime& aTime = aValForTime.myTime;
+ QString aTitle;
+ //aTitle.sprintf("%s %s",myTitle.c_str(),aTime.second.c_str());
+ aTitle.sprintf("%s",myTitle.c_str());
+ aTitle = aTitle.simplifyWhiteSpace();
+ aTableOfReal->SetTitle(aTitle.latin1());
+
+ int iLineEnd = myCutLinesPL->GetAppendPolyData()->GetNumberOfInputs();
+ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLineEnd = "<<iLineEnd);
+ TXCont aXCont;
+ TXYMapCont aXYMapCont;
+ TLineIdCont aLineIdCont; // Define internal numeration of lines
+ const float *aDirLn = myCutLinesPL->GetDirLn();
+ const float *aBasePnt = myCutLinesPL->GetBasePnt();
+ const float *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn();
+ for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){
+ vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine);
aDataSet->Update();
+ int aNbPoints = aDataSet->GetNumberOfPoints();
+ if(!aNbPoints) continue;
+ vtkPointData *aPointData = aDataSet->GetPointData();
+ vtkDataArray *aScalars = aPointData->GetScalars();
+ vtkCellDataToPointData *aFilter = NULL;
+ if(!aScalars) {
+ aFilter = vtkCellDataToPointData::New();
+ aFilter->SetInput(aDataSet);
+ aFilter->PassCellDataOn();
+ aDataSet = aFilter->GetOutput();
+ aDataSet->Update();
+ }
+ aPointData = aDataSet->GetPointData();
+ aScalars = aPointData->GetScalars();
+ if(!aScalars) continue;
+ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
+ aLineIdCont[iLine] = jLine++;
+ TXYMap& aXYMap = aXYMapCont[iLine];
+ float aPnt[3], aVect[3], aDist;
+ for(int i = 0; i < aNbPoints; i++){
+ aDataSet->GetPoint(i,aPnt);
+ Sub(aPnt,aBasePnt,aVect);
+ aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
+ // the workaround
+ if(aDist < 0.0) aDist = 0.0;
+ if(aDist > 1.0) aDist = 1.0;
+ aXYMap[aDist] = aScalars->GetTuple1(i);
+ }
+ if(aFilter){
+ aFilter->UnRegisterAllOutputs();
+ aFilter->Delete();
+ }
}
- aPointData = aDataSet->GetPointData();
- aScalars = aPointData->GetScalars();
- if(!aScalars) continue;
- if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<<iLine<<"; aNbPoints = "<<aNbPoints);
- aLineCont.insert(iLine);
- TXYMap& aXYMap = aCurveVect[iLine];
- float aPnt[3], aVect[3], aDist;
- for(int i = 0; i < aNbPoints; i++){
- aDataSet->GetPoint(i,aPnt);
- Sub(aPnt,aBasePnt,aVect);
- aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
- // the workaround
- if(aDist < 0.0) aDist = 0.0;
- if(aDist > 1.0) aDist = 1.0;
- aXYMap[aDist] = aScalars->GetTuple1(i);
- //aXMap[aDist].insert(iLine);
+ if(aXYMapCont.size() == 0)
+ throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXYMapCont.size() == 0 !!!");
+ //Resorting of theXYMap
+ TXYMapCont::iterator aXYMapContIter = aXYMapCont.begin();
+ for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+ TXYMap& aXYMap = aXYMapContIter->second, aNewXYMap;
+ if(aXYMap.size() > 2){
+ // Try to smooth the values of the line by applying linear approximation
+ TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
+ aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+ aXCont.insert(aXYMapIter[0]->first);
+ for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
+ float aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
+ aY[2] = (aY[0] + aY[1])/2.0;
+ float aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
+ aX[2] = (aX[0] + aX[1])/2.0;
+ aNewXYMap[aX[2]] = aY[2];
+ aXCont.insert(aX[2]);
+ }
+ aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
+ aXCont.insert(aXYMapIter[0]->first);
+ aXYMap = aNewXYMap;
+ }else{
+ TXYMap::const_iterator aXYMapIter = aXYMap.begin();
+ for(; aXYMapIter != aXYMap.end(); aXYMapIter++)
+ aXCont.insert(aXYMapIter->first);
+ }
}
- if(aFilter) aFilter->Delete();
- }
- iLineEnd = aLineCont.size();
- if(iLineEnd == 0){
- MESSAGE("CutPlanes_i::BuildTableOfReal aLineCont.size() == 0 !!!");
- return;
- }
- //Resorting of theXYMap
- for(int iLine = 0; iLine < iLineEnd; iLine++){
- TXYMap& aXYMap = aCurveVect[iLine], aNewXYMap;
- if(aXYMap.size() > 2){
- TXYMap::const_iterator aXYMapIter[2] = {aXYMap.begin(), ++aXYMap.begin()};
- aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
- aXMap[aXYMapIter[0]->first].insert(iLine);
- for(; aXYMapIter[1] != aXYMap.end(); aXYMapIter[0]++, aXYMapIter[1]++){
- float aY[3] = {aXYMapIter[0]->second, aXYMapIter[1]->second, 0.0};
- aY[2] = (aY[0] + aY[1])/2.0;
- float aX[3] = {aXYMapIter[0]->first, aXYMapIter[1]->first, 0.0};
- aX[2] = (aX[0] + aX[1])/2.0;
- aNewXYMap[aX[2]] = aY[2];
- aXMap[aX[2]].insert(iLine);
+ if(aXCont.size() == 0)
+ throw std::runtime_error("CutPlanes_i::BuildTableOfReal aXCont.size() == 0 !!!");
+ QString aString;
+ int iEnd = aXCont.size();
+ aTableOfReal->SetNbColumns(iEnd);
+ TXCont::const_iterator aXContIter = aXCont.begin();
+ for(long i = 0; aXContIter != aXCont.end(); aXContIter++, i++){
+ float aDist = *aXContIter;
+ aTableOfReal->PutValue(aDist,1,i+1);
+ aString.sprintf("%d",i);
+ aTableOfReal->SetColumnTitle(i+1,aString.latin1());
+ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist);
+ TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
+ for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+ long iLine = aXYMapContIter->first;
+ long iLineId = aLineIdCont[iLine];
+ const TXYMap& aXYMap = aXYMapCont[iLine];
+ TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
+ // Can we find some value that belong to the line and have the same X coordinate?
+ if(aXYMapIter == aXYMap.end()) continue;
+ float aVal = aXYMapIter->second;
+ aTableOfReal->PutValue(aVal,iLineId+2,i+1);
}
- aNewXYMap[aXYMapIter[0]->first] = aXYMapIter[0]->second;
- aXMap[aXYMapIter[0]->first].insert(iLine);
- aXYMap = aNewXYMap;
- }else{
- TXYMap::const_iterator aXYMapIter = aXYMap.begin();
- for(; aXYMapIter != aXYMap.end(); aXYMapIter++){
- aXMap[aXYMapIter->first].insert(iLine);
- }
}
- }
- QString aString;
- aTableOfReal->SetNbColumns(aXMap.size());
- TXMap::const_iterator aXMapIter = aXMap.begin();
- for(long i = 0; aXMapIter != aXMap.end(); aXMapIter++, i++){
- float aDist = aXMapIter->first;
- aTableOfReal->PutValue(aDist,1,i+1);
- aString.sprintf("%d",i);
- aTableOfReal->SetColumnTitle(i+1,aString.latin1());
- const TLineCont& aLineCont = aXMapIter->second;
- long jEnd = aLineCont.size();
- if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal aDist = "<<aDist<<"; jEnd = "<<jEnd);
- TLineCont::const_iterator aLineContIter = aLineCont.begin();
- for(; aLineContIter != aLineCont.end(); aLineContIter++){
- long iLine = *aLineContIter;
- const TXYMap& aXYMap = aCurveVect[iLine];
- TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist);
- if(aXYMapIter == aXYMap.end()) continue;
- float aVal = aXYMapIter->second;
- aTableOfReal->PutValue(aVal,iLine+2,i+1);
+ {
+ aTableOfReal->SetRowTitle(1,"X");
+ aTableOfReal->SetRowUnit(1,"-");
+ QString aUnitName = myField->myUnitNames[0].c_str();
+ int aScalarMode = myCutLinesPL->GetScalarMode();
+ if(aScalarMode != 0)
+ aUnitName = myField->myUnitNames[aScalarMode-1].c_str();
+ aUnitName = aUnitName.simplifyWhiteSpace();
+ if(aUnitName.isEmpty()) aUnitName = "-";
+ TXYMapCont::const_iterator aXYMapContIter = aXYMapCont.begin();
+ for(; aXYMapContIter != aXYMapCont.end(); aXYMapContIter++){
+ long iLine = aXYMapContIter->first;
+ long iLineId = aLineIdCont[iLine];
+ aString.sprintf("Y%d",iLine);
+ if(MYDEBUG)
+ MESSAGE("CutPlanes_i::BuildTableOfReal - SetRowTitle("<<iLineId+2<<",'"<<aString<<"')");
+ aTableOfReal->SetRowTitle(iLineId+2,aString.latin1());
+ aTableOfReal->SetRowUnit(iLineId+2,aUnitName.latin1());
+ }
}
- }
-
- aTableOfReal->SetRowTitle(1,"X");
- TLineCont::const_iterator aLineContIter = aLineCont.begin();
- QString aUnitName = myField->myUnitNames[0].c_str();
- int aScalarMode = myCutLinesPL->GetScalarMode();
- if(aScalarMode != 0)
- aUnitName = myField->myUnitNames[aScalarMode-1].c_str();
- aUnitName = aUnitName.simplifyWhiteSpace();
- for(long i = 0; aLineContIter != aLineCont.end(); aLineContIter++, i++){
- long iLine = *aLineContIter;
- aString.sprintf("Y%d",iLine);
- aTableOfReal->SetRowTitle(i+2,aString.latin1());
- aTableOfReal->SetRowUnit(i+2,aUnitName.latin1());
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ }catch (...){
+ INFOS("Unknown exception was accured !!!");
}
}
CutLines_i();
CutLines_i(const CutLines_i&);
public:
- CutLines_i(Result_i* theResult, bool theAddToStudy = true);
+ CutLines_i(Result_i* theResult, bool theAddToStudy = true,
+ SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const CutLines_i* theOrigin);
virtual ~CutLines_i();
- virtual void Destroy();
virtual VISU::VISUType GetType() { return VISU::TCUTLINES;};
- virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient);
- virtual VISU::CutPlanes::Orientation GetOrientationType();
+ virtual void SetOrientation(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle);
+ virtual void SetOrientation2(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle);
- virtual void SetOrientationType2(VISU::CutPlanes::Orientation theOrient);
+ virtual VISU::CutPlanes::Orientation GetOrientationType();
virtual VISU::CutPlanes::Orientation GetOrientationType2();
+ virtual CORBA::Double GetRotateX();
+ virtual CORBA::Double GetRotateY();
+
+ virtual CORBA::Double GetRotateX2();
+ virtual CORBA::Double GetRotateY2();
+
virtual void SetDisplacement(CORBA::Double theDisp);
virtual CORBA::Double GetDisplacement();
virtual void SetNbLines(CORBA::Long theNb);
virtual CORBA::Long GetNbLines();
-
- virtual void SetRotateX(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateX();
- virtual void SetRotateY(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateY();
-
- virtual void SetRotateX2(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateX2();
- virtual void SetRotateY2(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateY2();
-
typedef VISU::CutLines TInterface;
VISU_CutLinesPL* GetCutLinesPL(){ return myCutLinesPL;}
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual Storable* Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
void BuildTableOfReal(SALOMEDS::SObject_ptr theSObject);
#endif
int VISU::CutPlanes_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+ const char* theFieldName, int theIteration, int isMemoryCheck)
{
- return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
}
const char* VISU::CutPlanes_i::GetComment() const { return myComment.c_str();}
-VISU::CutPlanes_i::CutPlanes_i(Result_i* theResult, bool theAddToStudy) :
+VISU::CutPlanes_i::CutPlanes_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult),
- ScalarMap_i(theResult, theAddToStudy)
+ Prs3d_i(theResult,theSObject),
+ ScalarMap_i(theResult,theAddToStudy,theSObject)
{
myCutPlanesPL = NULL;
}
-void VISU::CutPlanes_i::Destroy(){
- ScalarMap_i::Destroy();
-}
-
-
void VISU::CutPlanes_i::SameAs(const CutPlanes_i* theOrigin){
CutPlanes_i* aCutPlanes = const_cast<CutPlanes_i*>(theOrigin);
VISU::ScalarMap_i::SameAs(theOrigin);
-
- //SetNbPlanes(aCutPlanes->GetNbPlanes());
- //SetDisplacement(aCutPlanes->GetDisplacement());
- //SetOrientationType(aCutPlanes->GetOrientationType());
- //SetRotateX(aCutPlanes->GetRotateX());
- //SetRotateY(aCutPlanes->GetRotateY());
}
VISU::Storable* VISU::CutPlanes_i::Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&)
{
- ScalarMap_i::Restore(theMap);
-
+ DoHook();
SetNbPlanes(VISU::Storable::FindValue(theMap,"myNbPlanes").toInt());
SetDisplacement(VISU::Storable::FindValue(theMap,"myDisplacement").toDouble());
- SetOrientationType(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()));
- SetRotateX(VISU::Storable::FindValue(theMap,"aRot[0]").toDouble());
- SetRotateY(VISU::Storable::FindValue(theMap,"aRot[1]").toDouble());
+ SetOrientation(VISU::CutPlanes::Orientation(VISU::Storable::FindValue(theMap,"myBasePlane").toInt()),
+ Storable::FindValue(theMap,"aRot[0]").toDouble(),
+ Storable::FindValue(theMap,"aRot[1]").toDouble());
+ QStringList aPosList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myPlanePosition") );
+ QStringList aCondList = QStringList::split("|",VISU::Storable::FindValue(theMap,"myPlaneCondition") );
+ for(int i = 0, iEnd = GetNbPlanes(); i < iEnd; i++)
+ if(aCondList[i].toInt() == 0)
+ SetPlanePosition(i,aPosList[i].toDouble());
- return Build(true);
+ return ScalarMap_i::Restore(theMap);
}
void VISU::CutPlanes_i::ToStream(std::ostringstream& theStr){
ScalarMap_i::ToStream(theStr);
- Storable::DataToStream( theStr, "myNbPlanes", int(GetNbPlanes()) );
- Storable::DataToStream( theStr, "myDisplacement", GetDisplacement() );
- Storable::DataToStream( theStr, "myBasePlane", int(GetOrientationType()) );
- Storable::DataToStream( theStr, "aRot[0]", GetRotateX() );
- Storable::DataToStream( theStr, "aRot[1]", GetRotateY() );
-}
+ int aNbPlanes = GetNbPlanes();
+ Storable::DataToStream( theStr, "myNbPlanes", int(GetNbPlanes()));
+ Storable::DataToStream( theStr, "myDisplacement", GetDisplacement());
+ Storable::DataToStream( theStr, "myBasePlane", int(GetOrientationType()));
+ Storable::DataToStream( theStr, "aRot[0]", GetRotateX());
+ Storable::DataToStream( theStr, "aRot[1]", GetRotateY());
-VISU::Storable* VISU::CutPlanes_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- VISU::Result_i* pResult = GetResult(theSObject);
- if(pResult != NULL){
- VISU::CutPlanes_i* pResent = new VISU::CutPlanes_i(pResult);
- return pResent->Restore(theMap);
+ QString aStrPos, aStrCon;
+ for(int i = 0, iEnd = GetNbPlanes(); i < iEnd; i++){
+ aStrPos.append(QString::number(GetPlanePosition(i)) + "|");
+ aStrCon.append(QString::number(IsDefault(i)) + "|");
}
- return NULL;
+ Storable::DataToStream( theStr, "myPlanePosition", aStrPos.latin1());
+ Storable::DataToStream( theStr, "myPlaneCondition", aStrCon.latin1());
}
}
-void VISU::CutPlanes_i::SetOrientationType(VISU::CutPlanes::Orientation theOrient){
- myCutPlanesPL->SetPlaneOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient));
+void VISU::CutPlanes_i::SetOrientation(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle)
+{
+ myCutPlanesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient),
+ theXAngle,theYAngle);
}
+
VISU::CutPlanes::Orientation VISU::CutPlanes_i::GetOrientationType() {
return VISU::CutPlanes::Orientation(myCutPlanesPL->GetPlaneOrientation());
}
+CORBA::Double VISU::CutPlanes_i::GetRotateX(){
+ return myCutPlanesPL->GetRotateX();
+}
+CORBA::Double VISU::CutPlanes_i::GetRotateY(){
+ return myCutPlanesPL->GetRotateY();
+}
void VISU::CutPlanes_i::SetDisplacement(CORBA::Double theDisp) {
}
-void VISU::CutPlanes_i::SetRotateX(CORBA::Double theAngle){
- myCutPlanesPL->SetRotateX(theAngle);
-}
-CORBA::Double VISU::CutPlanes_i::GetRotateX(){
- return myCutPlanesPL->GetRotateX();
-}
-
-
-void VISU::CutPlanes_i::SetRotateY(CORBA::Double theAngle){
- myCutPlanesPL->SetRotateY(theAngle);
-}
-CORBA::Double VISU::CutPlanes_i::GetRotateY(){
- return myCutPlanesPL->GetRotateY();
-}
-
-
void VISU::CutPlanes_i::DoHook(){
if(!myPipeLine) myPipeLine = VISU_CutPlanesPL::New();
myCutPlanesPL = dynamic_cast<VISU_CutPlanesPL*>(myPipeLine);
CutPlanes_i();
CutPlanes_i(const CutPlanes_i&);
public:
- CutPlanes_i(Result_i* theResult, bool theAddToStudy = true);
+ CutPlanes_i(Result_i* theResult, bool theAddToStudy = true,
+ SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const CutPlanes_i* theOrigin);
virtual ~CutPlanes_i();
- virtual void Destroy();
virtual VISU::VISUType GetType() { return VISU::TCUTPLANES;};
- virtual void SetOrientationType(VISU::CutPlanes::Orientation theOrient);
- virtual VISU::CutPlanes::Orientation GetOrientationType();
+ virtual void SetOrientation(VISU::CutPlanes::Orientation theOrient,
+ CORBA::Double theXAngle, CORBA::Double theYAngle);
+ virtual VISU::CutPlanes::Orientation GetOrientationType();
+ virtual CORBA::Double GetRotateX();
+ virtual CORBA::Double GetRotateY();
+
virtual void SetDisplacement(CORBA::Double theDisp);
virtual CORBA::Double GetDisplacement();
virtual void SetNbPlanes(CORBA::Long theNb);
virtual CORBA::Long GetNbPlanes();
- virtual void SetRotateX(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateX();
-
- virtual void SetRotateY(CORBA::Double theAngle);
- virtual CORBA::Double GetRotateY();
-
typedef VISU::CutPlanes TInterface;
VISU_CutPlanesPL* GetCutPlanesPL(){ return myCutPlanesPL;}
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual void ToStream(std::ostringstream& theStr);
-
+
virtual Storable* Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
static const string myComment;
virtual const char* GetComment() const;
#endif
int VISU::DeformedShape_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+ const char* theFieldName, int theIteration, int isMemoryCheck)
{
try{
- if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration)) return 0;
+ if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck)) return 0;
const VISU::TField& aField = theResult->GetInput()->GetField(theMeshName,(VISU::TEntity)theEntity,theFieldName);
return aField.myNbComp > 1;
}catch(std::runtime_error& exc){
const string VISU::DeformedShape_i::myComment = "DEFORMEDSHAPE";
const char* VISU::DeformedShape_i::GetComment() const { return myComment.c_str();}
-VISU::DeformedShape_i::DeformedShape_i(Result_i* theResult, bool theAddToStudy) :
+
+VISU::DeformedShape_i::DeformedShape_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult),
- ScalarMap_i(theResult, theAddToStudy)
+ Prs3d_i(theResult,theSObject),
+ ScalarMap_i(theResult,theAddToStudy,theSObject)
{
if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i");
myDeformedShapePL = NULL;
}
-void VISU::DeformedShape_i::Destroy(){
- ScalarMap_i::Destroy();
-}
+
void VISU::DeformedShape_i::SameAs(const DeformedShape_i* theOrigin)
{
DeformedShape_i* aDefShape = const_cast<DeformedShape_i*>(theOrigin);
VISU::ScalarMap_i::SameAs(theOrigin);
- //SetScale(aDefShape->GetScale());
SetColor(aDefShape->GetColor());
ShowColored(aDefShape->IsColored());
}
return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
}
+
VISU::Storable* VISU::DeformedShape_i::Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&)
{
- ScalarMap_i::Restore(theMap);
-
+ DoHook();
SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble());
-
myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt();
myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
- return Build(true);
+ return ScalarMap_i::Restore(theMap);
}
+
void VISU::DeformedShape_i::ToStream(std::ostringstream& theStr){
ScalarMap_i::ToStream(theStr);
Storable::DataToStream( theStr, "myColor.B", myColor.B );
}
-VISU::Storable* VISU::DeformedShape_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- VISU::Result_i* pResult = GetResult(theSObject);
- if(pResult != NULL){
- VISU::DeformedShape_i* pResent = new VISU::DeformedShape_i(pResult);
- return pResent->Restore(theMap);
- }
- return NULL;
-}
-
VISU::DeformedShape_i::~DeformedShape_i(){
if(MYDEBUG) MESSAGE("DeformedShape_i::~DeformedShape_i()");
}
-void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor){
+void VISU::DeformedShape_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
if(IsColored()){
anActor->SetBarVisibility(true);
DeformedShape_i();
DeformedShape_i(const DeformedShape_i&);
public:
- DeformedShape_i(Result_i* theResult, bool theAddToStudy = true);
+ DeformedShape_i(Result_i* theResult, bool theAddToStudy = true,
+ SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const DeformedShape_i* theOrigin);
virtual ~DeformedShape_i();
- virtual void Destroy();
virtual VISU::VISUType GetType() { return VISU::TDEFORMEDSHAPE;};
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual Storable* Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
virtual void SetMapScale(double theMapScale = 1.0);
virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
throw (std::runtime_error&);
- virtual void UpdateActor(VISU_Actor* theActor);
+ virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
};
}
-#endif
-
+#endif
extern "C" {
PortableServer::ObjectId *
- VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
- const char *instanceName, const char *interfaceName)
- {
- if(MYDEBUG) MESSAGE("VisuEngine_factory : "<<interfaceName);
- VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(orb, poa, contId, instanceName, interfaceName);
- return pVISU_Gen->getId() ;
- }
+ VISUEngine_factory(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableServer::ObjectId * contId,
+ const char *instanceName, const char *interfaceName)
+ {
+ if(MYDEBUG) MESSAGE("VisuEngine_factory : "<<interfaceName);
+ VISU::VISU_Gen_i * pVISU_Gen = new VISU::VISU_Gen_i(orb, poa, contId, instanceName, interfaceName);
+ return pVISU_Gen->getId() ;
+ }
VISU::VISU_Gen_ptr
GetVisuGen(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA,
SALOME_NamingService* theNamingService, QMutex* theMutex)
aSComponent = aStudyBuilder->NewComponent("VISU");
SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName");
SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- //NRI aName->SetValue("Visu");
+ //NRI aName->SetValue("Visu");
CORBA::ORB_var anORB = Base_i::GetORB();
SALOME_NamingService *NamingService = new SALOME_NamingService( anORB );
CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog");
void RegistryStorable() throw(std::logic_error&) {
Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore));
- Storable::Registry(Mesh_i::myComment.c_str(),&(Mesh_i::Restore));
- Storable::Registry(ScalarMap_i::myComment.c_str(),&(ScalarMap_i::Restore));
- Storable::Registry(DeformedShape_i::myComment.c_str(),&(DeformedShape_i::Restore));
- Storable::Registry(CutPlanes_i::myComment.c_str(),&(CutPlanes_i::Restore));
- Storable::Registry(CutLines_i::myComment.c_str(),&(CutLines_i::Restore));
- Storable::Registry(IsoSurfaces_i::myComment.c_str(),&(IsoSurfaces_i::Restore));
- Storable::Registry(StreamLines_i::myComment.c_str(),&(StreamLines_i::Restore));
- Storable::Registry(Vectors_i::myComment.c_str(),&(Vectors_i::Restore));
+ Storable::Registry(Mesh_i::myComment.c_str(),&(Restore<Mesh_i>));
+ Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore<ScalarMap_i>));
+ Storable::Registry(DeformedShape_i::myComment.c_str(),&(Restore<DeformedShape_i>));
+ Storable::Registry(CutPlanes_i::myComment.c_str(),&(Restore<CutPlanes_i>));
+ Storable::Registry(CutLines_i::myComment.c_str(),&(Restore<CutLines_i>));
+ Storable::Registry(IsoSurfaces_i::myComment.c_str(),&(Restore<IsoSurfaces_i>));
+ Storable::Registry(StreamLines_i::myComment.c_str(),&(Restore<StreamLines_i>));
+ Storable::Registry(Vectors_i::myComment.c_str(),&(Restore<Vectors_i>));
Storable::Registry(Table_i::myComment.c_str(),&(Table_i::Restore));
Storable::Registry(Curve_i::myComment.c_str(),&(Curve_i::Restore));
Storable::Registry(Container_i::myComment.c_str(),&(Container_i::Restore));
Mutex mt(theMutex,qApp);
Base_i::myMutex = theMutex; //apo
Base_i::myOrb = CORBA::ORB::_duplicate(theORB);
- Base_i::myPOA = PortableServer::POA::_duplicate(thePOA);
+ Base_i::myPoa = PortableServer::POA::_duplicate(thePOA);
Base_i::myNamingService = theNamingService;
static SALOME_LifeCycleCORBA aEnginesLifeCycle(theNamingService);
Base_i::myEnginesLifeCycle = &aEnginesLifeCycle;
SALOMEDS::ListOfOpenStudies_var aListOfOpenStudies = aStudyManager->GetOpenStudies();
if(aListOfOpenStudies->length() > 0) {
CORBA::String_var aStudyName = aListOfOpenStudies[0];
- aFileInfo.setFile(aStudyName.in());
- myStudyDocument = aStudyManager->GetStudyByName(aFileInfo.baseName());
- }else{
+ //aFileInfo.setFile(aStudyName.in());
+ myStudyDocument = aStudyManager->GetStudyByName(aStudyName/*aFileInfo.baseName()*/);
+ }else
if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : there is no opened study in StudyManager !!!");
- }
-
- Base_i::myPOA->activate_object(this);
}
VISU_Gen_i::~VISU_Gen_i(){
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - myMutex = "<<myMutex);
if(myMutex){
Mutex mt(myMutex,qApp);
- CORBA::String_var aString = SALOMEDS_Tool::GetTmpDir();
- TCollection_AsciiString aTmpDir = isMultiFile? (const Standard_CString)theURL: (const Standard_CString)aString.in();
+ TCollection_AsciiString aTmpDir = isMultiFile? strdup(theURL): SALOMEDS_Tool::GetTmpDir();
if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aTmpDir);
int aCounter = 0;
TColStd_SequenceOfAsciiString aFileNames;
SALOMEDS::SObject_var gotBranch = itBig->Value();
CORBA::Object_var anObj = SObjectToObject(gotBranch);
if(CORBA::is_nil(anObj)) continue;
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
- if(pResult && abs(pResult->GetSourceId()) == Result_i::eFile){
- const QFileInfo& aFileInfo = pResult->GetFileInfo();
- QString aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
- QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
- static QString aCommand;
- aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
- if(system(aCommand) == -1){
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
- continue;
- }else
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
- TCollection_AsciiString aString(strdup(aFileName.latin1()));
- aFileNames.Append(aString);
+ Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj).in());
+ if(pResult){
+ const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
+ if(aSourceId == Result_i::eFile || aSourceId == Result_i::eRestoredFile){
+ const QFileInfo& aFileInfo = pResult->GetFileInfo();
+ QString aPrefix("");
+ if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
+ QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
+ static QString aCommand;
+ aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
+ if(system(aCommand) == -1){
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+ continue;
+ }else
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aCommand = "<<aCommand);
+ TCollection_AsciiString aString(strdup(aFileName.latin1()));
+ aFileNames.Append(aString);
+ }
}
}
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
SALOMEDS::SObject_var gotBranch = itBig->Value();
CORBA::Object_var anObj = SObjectToObject(gotBranch);
if(CORBA::is_nil(anObj)) continue;
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
- if(pResult && abs(pResult->GetSourceId()) == Result_i::eFile){
- const QFileInfo& aFileInfo = pResult->GetFileInfo();
- QString aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
- QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
- static QString aCommand;
- aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
-
- if(system(aCommand) == -1){
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
- continue;
- }else
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
- TCollection_AsciiString aString(strdup(aFileName.latin1()));
-
- HDFascii::ConvertFromHDFToASCII(strdup((aTmpDir + aString).ToCString()), true);
-
- aFileNames.Append(aString);
+ Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj).in());
+ if(pResult){
+ const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
+ if(aSourceId == Result_i::eFile || aSourceId == Result_i::eRestoredFile){
+ const QFileInfo& aFileInfo = pResult->GetFileInfo();
+ QString aPrefix("");
+ if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL());
+ QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str();
+ static QString aCommand;
+ aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
+
+ if(system(aCommand) == -1){
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+ continue;
+ }else
+ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
+ TCollection_AsciiString aString(strdup(aFileName.latin1()));
+
+ HDFascii::ConvertFromHDFToASCII(strdup((aTmpDir + aString).ToCString()), true);
+
+ aFileNames.Append(aString);
+ }
}
}
SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0);
CORBA::ORB_ptr anORB = GetORB();
CORBA::Object_var anObj = anORB->string_to_object(aString);
if(!CORBA::is_nil(anObj)){
- Storable* pStorable = dynamic_cast<Storable*>(GetServant(anObj));
+ Storable* pStorable = dynamic_cast<Storable*>(GetServant(anObj).in());
if(pStorable != NULL){
Mutex mt(myMutex,qApp);
aString = pStorable->ToString().c_str();
void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){
if(myMutex){
- if(!CORBA::is_nil(theStudy))
+ if(CORBA::is_nil(theStudy))
+ INFOS("VISU_Gen_i::SetCurrentStudy : CORBA::is_nil(theStudy)");
+ if(!CORBA::is_nil(theStudy)){
+ CORBA::String_var aName = theStudy->Name();
+ INFOS("VISU_Gen_i::SetCurrentStudy - StudyId = "<<theStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+ }
}else
- myVisuGen->SetCurrentStudy(SALOMEDS::Study::_duplicate(theStudy));
+ myVisuGen->SetCurrentStudy(theStudy);
}
SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){
if(myMutex)
return myVisuGen->ImportTables(theFileName);
}
+ CORBA::Boolean VISU_Gen_i::ExportTableToFile(SALOMEDS::SObject_ptr theTable,
+ const char* theFileName)
+ {
+ return VISU::ExportTableToFile(theTable, theFileName);
+ }
+
Result_ptr VISU_Gen_i::ImportFile(const char* theFileName){
if(myMutex){
if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
Mutex mt(myMutex,qApp);
- VISU::Result_var aResult;
aFileInfo.setFile(theFileName);
Result_i* pResult = new Result_i(myStudyDocument);
+ if(pResult->Create(theFileName) != NULL)
+ return pResult->_this();
+ else{
+ pResult->_remove_ref();
+ return VISU::Result::_nil();
+ }
+ }
+ return myVisuGen->ImportFile(theFileName);
+ }
+
+ Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){
+ if(myMutex){
+ if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
+ Mutex mt(myMutex,qApp);
+ VISU::Result_var aResult;
+ aFileInfo.setFile(theFileName);
+ Result_i* pResult = new Result_i(myStudyDocument,Result_i::eRestoredFile);
if(pResult->Create(theFileName) != NULL)
aResult = pResult->_this();
return aResult._retn();
}
- return myVisuGen->ImportFile(theFileName);
+ return myVisuGen->CopyAndImportFile(theFileName);
}
Result_ptr VISU_Gen_i::ImportMed(SALOMEDS::SObject_ptr theMedSObject){
if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
Mutex mt(myMutex,qApp);
Result_i* pResult = new Result_i(myStudyDocument);
- if(pResult->Create(theMedSObject) != NULL)
- return Result::_duplicate(pResult->_this());
- return Result::_nil();
+ if(pResult->Create(theMedSObject) != NULL)
+ return pResult->_this();
+ else{
+ pResult->_remove_ref();
+ return VISU::Result::_nil();
+ }
}
return myVisuGen->ImportMed(theMedSObject);
}
if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil();
Mutex mt(myMutex,qApp);
Result_i* pResult = new Result_i(myStudyDocument);
- if(pResult->Create(theField) != NULL)
- return Result::_duplicate(pResult->_this());
- return Result::_nil();
+ if(pResult->Create(theField) != NULL)
+ return pResult->_this();
+ else{
+ pResult->_remove_ref();
+ return VISU::Result::_nil();
+ }
}
return myVisuGen->ImportMedField(theField);
}
if(myMutex){
if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
Mutex mt(myMutex,qApp);
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+ Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
Mesh_i* aPresent = new Mesh_i(pResult);
- if(aPresent->Create(theMeshName,theEntity) != NULL)
- return Mesh::_duplicate(aPresent->_this());
- return Mesh::_nil();
+ if(aPresent->Create(theMeshName,theEntity) != NULL)
+ return aPresent->_this();
+ else{
+ aPresent->_remove_ref();
+ return VISU::Mesh::_nil();
+ }
}
return myVisuGen->MeshOnEntity(theResult,theMeshName,theEntity);
}
if(myMutex){
if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
Mutex mt(myMutex,qApp);
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+ Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
Mesh_i* aPresent = new Mesh_i(pResult);
- if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL)
- return Mesh::_duplicate(aPresent->_this());
- return Mesh::_nil();
+ if(aPresent->Create(theMeshName,theEntity,theFamilyName) != NULL)
+ return aPresent->_this();
+ else{
+ aPresent->_remove_ref();
+ return VISU::Mesh::_nil();
+ }
}
return myVisuGen->FamilyMeshOnEntity(theResult,theMeshName,theEntity,theFamilyName);
}
if(myMutex){
if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil();
Mutex mt(myMutex,qApp);
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+ Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
Mesh_i* aPresent = new Mesh_i(pResult);
- if(aPresent->Create(theMeshName,theGroupName) != NULL)
- return Mesh::_duplicate(aPresent->_this());
- return Mesh::_nil();
+ if(aPresent->Create(theMeshName,theGroupName) != NULL)
+ return aPresent->_this();
+ else{
+ aPresent->_remove_ref();
+ return VISU::Mesh::_nil();
+ }
}
return myVisuGen->GroupMesh(theResult,theMeshName,theGroupName);
}
ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration)
{
- if(myMutex) return Prs3dOnField<VISU::ScalarMap_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ if(myMutex) return Prs3dOnField<VISU::ScalarMap_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,true)._retn();
return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration)
{
- if(myMutex) return Prs3dOnField<VISU::DeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ if(myMutex) return Prs3dOnField<VISU::DeformedShape_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration)
{
- if(myMutex) return Prs3dOnField<VISU::Vectors_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ if(myMutex) return Prs3dOnField<VISU::Vectors_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration)
{
- if(myMutex) return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ if(myMutex) return Prs3dOnField<VISU::IsoSurfaces_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration)
{
- if(myMutex) return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ if(myMutex) return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration)
{
- if(myMutex) return Prs3dOnField<VISU::CutPlanes_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ if(myMutex) return Prs3dOnField<VISU::CutPlanes_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, CORBA::Double theIteration)
{
- if(myMutex) return Prs3dOnField<VISU::CutLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ if(myMutex) return Prs3dOnField<VISU::CutLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration);
}
if(myMutex){
if(myStudyDocument->GetProperties()->IsLocked()) return Table::_nil();
Mutex mt(myMutex,qApp);
- Table_i* aPresent = new Table_i(myStudyDocument,theTableEntry);
- if(aPresent->Create() != NULL)
- return Table::_duplicate(aPresent->_this());
- return Table::_nil();
+ Table_i* pPresent = new Table_i(myStudyDocument,theTableEntry);
+ if(pPresent->Create() != NULL)
+ return pPresent->_this();
+ else{
+ pPresent->_remove_ref();
+ return VISU::Table::_nil();
+ }
}
return myVisuGen->CreateTable(theTableEntry);
}
Mutex mt(myMutex,qApp);
PortableServer::POA_ptr aPOA = GetPOA();
Table_i* pTable = dynamic_cast<Table_i*>(aPOA->reference_to_servant(theTable));
- Curve_i* aPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow);
- if(aPresent->Create() != NULL) {
- return Curve::_duplicate(aPresent->_this());
+ Curve_i* pPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow);
+ if(pPresent->Create() != NULL)
+ return pPresent->_this();
+ else{
+ pPresent->_remove_ref();
+ return VISU::Curve::_nil();
}
- return Curve::_nil();
}
return myVisuGen->CreateCurve(theTable,theHRow,theVRow);
}
if(myMutex){
if(myStudyDocument->GetProperties()->IsLocked()) return Container::_nil();
Mutex mt(myMutex,qApp);
- Container_i* aPresent = new Container_i(myStudyDocument);
- if(aPresent->Create() != NULL) {
- return Container::_duplicate(aPresent->_this());
+ Container_i* pPresent = new Container_i(myStudyDocument);
+ if(pPresent->Create() != NULL)
+ return pPresent->_this();
+ else{
+ pPresent->_remove_ref();
+ return VISU::Container::_nil();
}
- return Container::_nil();
}
return myVisuGen->CreateContainer();
}
if(myStudyDocument->GetProperties()->IsLocked()) return Animation::_nil();
Mutex mt(myMutex,qApp);
if(MYDEBUG) MESSAGE("VISU_Gen_i::CreateAnimation : "<<myMutex);
- VISU_TimeAnimation* anAnim = new VISU_TimeAnimation(myStudyDocument,theView3D);
- return Animation::_duplicate(anAnim->_this());
+ if(VISU_TimeAnimation* anAnim = new VISU_TimeAnimation(myStudyDocument,theView3D)){
+ return anAnim->_this();
+ }else
+ return VISU::Animation::_nil();
+
}
return myVisuGen->CreateAnimation(theView3D);
}
void VISU_Gen_i::Close(SALOMEDS::SComponent_ptr theComponent){
if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : "<<myMutex);
if(myMutex){
- Mutex mt(myMutex,qApp);
- SALOMEDS::Study_var aStudy = theComponent->GetStudy();
- if(!aStudy->_is_nil()){
- SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent);
- for (int i = 0; itBig->More(); itBig->Next(),i++) {
- SALOMEDS::SObject_var gotBranch = itBig->Value();
- if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : itBig->Next() = "<<i);
- CORBA::Object_var anObj = SObjectToObject(gotBranch);
- if(CORBA::is_nil(anObj)) continue;
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(anObj));
- if(!pResult) continue;
- if(pResult->GetSourceId() == Result_i::eRestoredFile){ //Try remove its file and directory
- const QFileInfo& aFileInfo = pResult->GetFileInfo();
- static QString aCommand;
- aCommand.sprintf("rm %s",aFileInfo.filePath().latin1());
- if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
- aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",aFileInfo.dirPath().latin1());
- if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
- }
- }
- }
+ //Mutex mt(myMutex,qApp);
+ //SALOMEDS::Study_var aStudy = theComponent->GetStudy();
+ //if(!aStudy->_is_nil()){
+ // SALOMEDS::ChildIterator_var aChildIter = aStudy->NewChildIterator(theComponent);
+ // aChildIter->InitEx(true);
+ // for (int i = 0; aChildIter->More(); aChildIter->Next(),i++) {
+ // SALOMEDS::SObject_var aSObject = aChildIter->Value();
+ // if(MYDEBUG) MESSAGE("VISU_Gen_i::Close : aChildIter->Next() = "<<i);
+ // CORBA::Object_var anObj = SObjectToObject(aSObject);
+ // if(CORBA::is_nil(anObj)) continue;
+ // PortableServer::ServantBase_var aServant = GetServant(anObj);
+ // if(aServant.in() == NULL) continue;
+ // if(VISU::Base_i* pBase = dynamic_cast<VISU::Base_i*>(aServant.in())){
+ // VISU::VISUType aType = pBase->GetType();
+ // switch(aType){
+ // case VISU::TRESULT:
+ // if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(pBase)){
+ // //Try remove its file and directory
+ // if(pResult->GetSourceId() == Result_i::eRestoredFile){
+ // const QFileInfo& aFileInfo = pResult->GetFileInfo();
+ // static QString aCommand;
+ // aCommand.sprintf("rm %s",aFileInfo.filePath().latin1());
+ // if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
+ // aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",aFileInfo.dirPath().latin1());
+ // if(system(aCommand) != -1 && MYDEBUG) MESSAGE("VISU_Gen_i::Close - "<<aCommand);
+ // }
+ // }
+ // break;
+ // default:
+ // break;
+ // }
+ // }
+ // }
+ //}
return;
}
myVisuGen->Close(theComponent);
if(myMutex){
Mutex mt(myMutex,qApp);
SALOMEDS::SObject_var aResultSO;
- Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject));
+ Result_i* aResultObj = dynamic_cast<Result_i*>(GetServant(theObject).in());
if (!aResultObj) return aResultSO._retn();
const QFileInfo& aFileInfo = aResultObj->GetFileInfo();
CORBA::String_var anEntry = aResultObj->Create(aFileInfo.filePath().latin1())->GetID();
if (!CORBA::is_nil(anObj)){
Result_var aResultObj = Result::_narrow(anObj);
if(!aResultObj->_is_nil()){
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(aResultObj));
- if(pResult != NULL){
- if(abs(pResult->GetSourceId()) > Result_i::eFile)
- if((pResult->GetFileInfo()).filePath() == "MED") return false;
+ if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(aResultObj).in())){
+ const Result_i::TSourceId& aSourceId = pResult->GetSourceId();
+ if(aSourceId == Result_i::eComponent || aSourceId == Result_i::eRestoredComponent)
+ if((pResult->GetFileInfo()).filePath() == "MED")
+ return false;
return true;
}
}
}
}
- } catch (...) {
+ }catch (...){
INFOS("Unknown exception was accured!");
}
return false;
}
SALOMEDS::TMPFile* VISU_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {
- if(MYDEBUG) MESSAGE("VISU_Gen_i::CopyFrom : "<<myMutex);
if(myMutex){
Mutex mt(myMutex,qApp);
return NULL;
}
- Storable* pStorable = dynamic_cast<Storable*>(GetServant(aCorbaObj));
+ Storable* pStorable = dynamic_cast<Storable*>(GetServant(aCorbaObj).in());
if (!pStorable) {
return NULL;
}
SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false);
ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str());
-// ifstream stmIn((string(aTmpDir) + string("copy_persistent")).c_str(),ios::in);
stmIn.seekg(0, ios::end);
int aLength = stmIn.tellg();
stmIn.seekg(0, ios::beg);
char* aString = new char[aLength+1];
stmIn.read(aString, aLength);
aString[aLength] = 0;
- myIsMultiFile = true;
+ myIsMultiFile = false;
string aFileName(aTmpDir.in());
if(aSeq->length() > 1) aFileName += aSeq[1].in();
virtual ViewManager_ptr GetViewManager();
virtual SALOMEDS::SObject_ptr ImportTables(const char* theFileName);
+ virtual CORBA::Boolean ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName );
//Create Result
virtual Result_ptr ImportFile(const char* theFileName);
+ virtual Result_ptr CopyAndImportFile(const char* theFileName);
virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField);
virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName);
//Create 3D collored Presentation Of Different Types
- template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_ptr_type
+ template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
Prs3dOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, CORBA::Double theIteration)
+ const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
{
typedef typename TPrs3d_i::TInterface TPrs3d;
+ typename TPrs3d::_var_type aPrs3d;
if(myStudyDocument->GetProperties()->IsLocked()) return TPrs3d::_nil();
Mutex mt(myMutex,qApp);
- Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
+ Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in());
if(TPrs3d_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,int(theIteration))){
- TPrs3d_i* aPresent = new TPrs3d_i(pResult);
- if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) != NULL){
+ TPrs3d_i* aPresent = new TPrs3d_i(pResult,theAddToStudy);
+ if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) != NULL)
return aPresent->_this();
- }
+ else
+ aPresent->_remove_ref();
}
return TPrs3d::_nil();
}
#endif
int VISU::IsoSurfaces_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+ const char* theFieldName, int theIteration, int isMemoryCheck)
{
- return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ return VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,isMemoryCheck);
}
int VISU::IsoSurfaces_i::myNbPresent = 0;
const string VISU::IsoSurfaces_i::myComment = "ISOSURFACES";
const char* VISU::IsoSurfaces_i::GetComment() const { return myComment.c_str();}
-VISU::IsoSurfaces_i::IsoSurfaces_i(Result_i* theResult, bool theAddToStudy) :
+
+VISU::IsoSurfaces_i::IsoSurfaces_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult),
- ScalarMap_i(theResult, theAddToStudy)
+ Prs3d_i(theResult,theSObject),
+ ScalarMap_i(theResult,theAddToStudy,theSObject)
{
myIsoSurfacesPL = NULL;
}
-void VISU::IsoSurfaces_i::Destroy(){
- ScalarMap_i::Destroy();
-}
+
void VISU::IsoSurfaces_i::SameAs(const IsoSurfaces_i* theOrigin) {
IsoSurfaces_i* aIsoSurfaces = const_cast<IsoSurfaces_i*>(theOrigin);
VISU::ScalarMap_i::SameAs(theOrigin);
-
- //SetNbSurfaces(aIsoSurfaces->GetNbSurfaces());
- //SetSubRange(aIsoSurfaces->GetSubMin(),aIsoSurfaces->GetSubMax());
}
+
VISU::Storable* VISU::IsoSurfaces_i::Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration)
{
return ScalarMap_i::Create(theMeshName,theEntity,theFieldName,theIteration);
}
+
VISU::Storable* VISU::IsoSurfaces_i::Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&)
{
- ScalarMap_i::Restore(theMap);
-
+ DoHook();
SetNbSurfaces(VISU::Storable::FindValue(theMap,"myNbSurface").toInt());
float aMin = VISU::Storable::FindValue(theMap,"myRange[0]").toDouble();
float aMax = VISU::Storable::FindValue(theMap,"myRange[1]").toDouble();
SetSubRange(aMin,aMax);
- return Build(true);
+ return ScalarMap_i::Restore(theMap);
}
void VISU::IsoSurfaces_i::ToStream(std::ostringstream& theStr){
Storable::DataToStream( theStr, "myRange[1]", GetSubMax() );
}
-VISU::Storable* VISU::IsoSurfaces_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- VISU::Result_i* pResult = GetResult(theSObject);
- if(pResult != NULL){
- VISU::IsoSurfaces_i* pResent = new VISU::IsoSurfaces_i(pResult);
- return pResent->Restore(theMap);
- }
- return NULL;
-}
-
VISU::IsoSurfaces_i::~IsoSurfaces_i(){
if(MYDEBUG) MESSAGE("IsoSurfaces_i::~IsoSurfaces_i()");
IsoSurfaces_i();
IsoSurfaces_i(const IsoSurfaces_i&);
public:
- IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true);
+ IsoSurfaces_i(Result_i* theResult, bool theAddToStudy = true,
+ SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const IsoSurfaces_i* theOrigin);
virtual ~IsoSurfaces_i();
- virtual void Destroy();
virtual VISU::VISUType GetType() { return VISU::TISOSURFACE;};
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual Storable* Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
virtual void SetMapScale(double theMapScale = 1.0);
};
const char* VISU::Mesh_i::GetComment() const { return myComment.c_str();}
-VISU::Mesh_i::Mesh_i(Result_i* theResult) :
+VISU::Mesh_i::Mesh_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult)
+ Prs3d_i(theResult,theSObject)
{
myPipeLine = myMeshPL = VISU_MeshPL::New();;
}
+
+void VISU::Mesh_i::RemoveFromStudy(){
+ VISU::RemoveFromStudy(mySObject);
+}
+
+
void VISU::Mesh_i::SameAs(const Mesh_i* theOrigin){
return; // "SameAs" command for mesh is not valid in current architecture
}
-void VISU::Mesh_i::Destroy(){
- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID(GetEntry());
- if(!aSObj->_is_nil()){
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- aStudyBuilder->RemoveAttribute(aSObj,"AttributeIOR");
- }
- Prs3d_i::Destroy();
-}
+
int VISU::Mesh_i::IsPossible(Result_i* theResult, const char* theMeshName, Entity theEntity, const char* theFamilyName){
try{
- vtkIdType aSize = INCMEMORY*
+ INFOS("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+ float aSize = INCMEMORY*
theResult->GetInput()->GetMeshOnEntitySize(theMeshName,(VISU::TEntity)theEntity,theFamilyName);
- if(MYDEBUG) MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<aSize);
- if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
- return false;
+ bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+ INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+ return aResult;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
int VISU::Mesh_i::IsPossible(Result_i* theResult, const char* theMeshName, const char* theGroupName){
try{
- vtkIdType aSize = INCMEMORY*
+ INFOS("Mesh_i::IsPossible - theMeshName = '"<<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
+ float aSize = INCMEMORY*
theResult->GetInput()->GetMeshOnGroupSize(theMeshName,theGroupName);
- if(MYDEBUG) MESSAGE("Mesh_i::IsPossible - CheckAvailableMemory = "<<aSize);
- if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
- return false;
+ bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+ INFOS("Mesh_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+ return aResult;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
}
return 0;
}
+
+
VISU::Storable* VISU::Mesh_i::Create(const char* theMeshName, const char* theGroupName){
myMeshName = theMeshName;
myEntity = VISU::TEntity(-1);
return Build(false);
}
+
VISU::Storable* VISU::Mesh_i::Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&)
{
return Build(true);
}
+
void VISU::Mesh_i::ToStream(std::ostringstream& theStr){
Prs3d_i::ToStream(theStr);
Storable::DataToStream( theStr, "myLinkColor.B", myLinkColor.B );
}
-VISU::Storable* VISU::Mesh_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- VISU::Result_i* pResult = GetResult(theSObject);
- if(pResult != NULL){
- VISU::Mesh_i* pResent = new VISU::Mesh_i(pResult);
- return pResent->Restore(theMap);
- }
- return NULL;
-}
-
VISU::Mesh_i::~Mesh_i(){
if(MYDEBUG) MESSAGE("Mesh_i::~Mesh_i()");
VISU::Storable* VISU::Mesh_i::Build(int theRestoring){
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
try{
if(myResult->GetInput() == NULL)
throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
string aResultEntry = myResult->GetEntry();
string anEntry = FindEntryWithComment(myStudy,aResultEntry.c_str(),aComment.latin1());
if(anEntry == "") throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!");
- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID(anEntry.c_str());
+ mySObject = myStudy->FindObjectID(anEntry.c_str());
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(aSObj,"AttributeIOR");
+ SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(mySObject,"AttributeIOR");
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var aString = GetID();
anIOR->SetValue(aString);
}
- return this;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
+ return NULL;
}catch(...){
INFOS("Unknown exception was accured!");
+ return NULL;
}
- return NULL;
+ aStudyBuilder->CommitCommand();
+ return this;
}
return anActor;
}
-void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor){
+
+void VISU::Mesh_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
if(VISU_MeshAct* anActor = dynamic_cast<VISU_MeshAct*>(theActor)){
if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor");
VISU::Prs3d_i::UpdateActor(anActor);
Mesh_i();
Mesh_i(const Mesh_i&);
public:
- Mesh_i(Result_i* theResult);
+ Mesh_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const Mesh_i* theOrigin);
virtual ~Mesh_i();
- virtual void Destroy();
+ virtual void RemoveFromStudy();
virtual VISU::VISUType GetType() { return VISU::TMESH;};
virtual Storable* Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
throw (std::runtime_error&);
- virtual void UpdateActor(VISU_Actor* theActor);
+ virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
};
}
#include "VISU_Result_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_Actor.h"
+
+#include <vtkGeometryFilter.h>
+
using namespace VISU;
using namespace std;
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#endif
-VISU::Prs3d_i::Prs3d_i(Result_i* theResult) :
- PrsObject_i(theResult->GetStudyDocument()),
- myResult(theResult)
+VISU::Prs3d_i::Prs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) :
+ PrsObject_i(theResult->GetStudyDocument()),
+ myResult(theResult)
{
+ myResult->Register();
+ mySObject = SALOMEDS::SObject::_duplicate(theSObject);
myAddToStudy = true;
myPipeLine = NULL;
+ CORBA::String_var aName = myStudy->Name();
+ INFOS("Prs3d_i - this = "<<this<<"; StudyId = "<<myStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
}
void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
}
VISU::Prs3d_i::~Prs3d_i() {
- if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i()");
+ INFOS("~Prs3d_i() - this = "<<this<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
myPipeLine->Delete();
+ myResult->Destroy();
}
-void VISU::Prs3d_i::Destroy() {
- CORBA::Object_var anObj = _this();
- PortableServer::POA_ptr aPOA = Base_i::GetPOA();
- PortableServer::ObjectId_var anId = aPOA->reference_to_id(anObj);
- aPOA->deactivate_object(anId.in());
- this->_remove_ref();
-}
-
-
void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO)
throw (std::runtime_error&)
{
Update();
if(myAddToStudy){
Handle(SALOME_InteractiveObject) anIO = theIO;
- if (anIO.IsNull())
- anIO = new SALOME_InteractiveObject(strdup(GetEntry()),"VISU",strdup(GetName()));
+ if(anIO.IsNull()){
+ CORBA::String_var anEntry = mySObject->GetID();
+ anIO = new SALOME_InteractiveObject(strdup(anEntry.in()),"VISU",strdup(GetName()));
+ }
theActor->setIO(anIO);
}
theActor->SetPipeLine(GetPipeLine());
}catch(std::runtime_error& ex){
throw ex;
}catch(...){
- throw std::runtime_error("Prs3d_i::CreateActor >> unexpected exception was caught!!!");
+ throw std::runtime_error("CreateActor >> unexpected exception was caught!!!");
}
}
-void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor){
- theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
- theActor->Modified();
+void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) throw (std::runtime_error&){
+ try{
+ vtkGeometryFilter* aGeometryFilter = vtkGeometryFilter::New();
+ vtkDataSet *aDataSet = theActor->GetMapper()->GetInput();
+ aGeometryFilter->SetInput(aDataSet);
+ vtkPolyData* aPolyData = aGeometryFilter->GetOutput();
+ aPolyData->Update();
+ static int INCMEMORY = 7;
+ float aSize = INCMEMORY*aPolyData->GetActualMemorySize()*1024.0;
+ int isPoss = VISU_PipeLine::CheckAvailableMemory(aSize);
+ INFOS("UpdateActor - aSize = "<<aSize<<"; isPoss = "<<isPoss);
+ aPolyData->Delete();
+ if (aSize <= 0)
+ throw std::runtime_error("Prs3d_i::UpdateActor >> Actor is empty !!!");
+ if(!isPoss)
+ throw std::runtime_error("Prs3d_i::UpdateActor >> There is no enough memory !!!");
+
+ theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
+ theActor->Modified();
+ }catch(std::runtime_error& ex){
+ throw ex;
+ }catch(...){
+ throw std::runtime_error("Prs3d_i::UpdateActor >> unexpected exception was caught!!!");
+ }
}
VISU::Storable* VISU::Prs3d_i::Restore(const Storable::TRestoringMap& theMap)
Storable::DataToStream( theStr, "myName", myName.c_str() );
}
-void VISU::Prs3d_i::Update(){
- myPipeLine->Update();
+void VISU::Prs3d_i::Update() throw (std::runtime_error&){
+ try{
+ myPipeLine->Update();
+ }catch(...){
+ throw std::runtime_error("Prs3d_i::Update >> unexpected exception was caught!!!");
+ }
}
VISU_PipeLine* VISU::Prs3d_i::GetPipeLine(){
return myPipeLine;
}
-VISU::Result_i* VISU::Prs3d_i::GetResult(SALOMEDS::SObject_ptr theSObject){
+
+SALOMEDS::SObject_var VISU::Prs3d_i::GetSObject(){
+ return mySObject;
+}
+
+void VISU::Prs3d_i::GetBounds(float aBounds[6]){
+ myPipeLine->GetMapper()->GetBounds(aBounds);
+}
+
+VISU::Result_i* VISU::GetResult(SALOMEDS::SObject_ptr theSObject){
VISU::Result_var aResult = FindResult(theSObject);
if(!aResult->_is_nil())
- return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()));
+ return dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult.in()).in());
return NULL;
}
#define VISU_Prs3d_i_HeaderFile
#include "VISU_PrsObject_i.hh"
+#include "SALOME_GenericObj_i.hh"
#include "Handle_SALOME_InteractiveObject.hxx"
#include "VISU_Convertor.hxx"
namespace VISU{
class Result_i;
- class Prs3d_i : public virtual POA_VISU::Prs3d,
- public virtual PrsObject_i
+ class Prs3d_i :
+ public virtual POA_VISU::Prs3d,
+ public virtual SALOME::GenericObj_i,
+ public virtual PrsObject_i
+
{
Prs3d_i();
Prs3d_i(const Prs3d_i&);
+
public:
- Prs3d_i(Result_i* theResult);
+ Prs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const Prs3d_i* theOrigin);
virtual ~Prs3d_i();
- virtual void Destroy();
+ virtual void RemoveFromStudy() = 0;
protected:
+ bool myAddToStudy;
Result_i *myResult;
VISU_PipeLine *myPipeLine;
+ SALOMEDS::SObject_var mySObject;
- bool myAddToStudy;
- void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL) throw (std::runtime_error&);
+ void CreateActor(VISU_Actor* theActor, const Handle(SALOME_InteractiveObject)& theIO = NULL)
+ throw (std::runtime_error&);
+ virtual VISU_PipeLine* GetPipeLine();
public:
- virtual void Update();
- virtual VISU_PipeLine* GetPipeLine();
+ virtual void Update() throw(std::runtime_error&);
VISU_PipeLine* GetPL();
+ void GetBounds(float aBounds[6]);
+
virtual const char* GetComment() const = 0;
virtual QString GenerateName() = 0;
throw(std::logic_error&);
virtual void ToStream(std::ostringstream& theStr);
- virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) throw (std::runtime_error&) = 0;
- virtual void UpdateActor(VISU_Actor* theActor);
+ virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
+ throw (std::runtime_error&) = 0;
+ virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
Result_i* GetResult() const { return myResult;}
-
- static Result_i* GetResult(SALOMEDS::SObject_ptr theSObject);
+ virtual SALOMEDS::SObject_var GetSObject();
};
+ Result_i* GetResult(SALOMEDS::SObject_ptr theSObject);
+ template<class TPrs3d>
+ Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+ const string& thePrefix, const Storable::TRestoringMap& theMap)
+ throw(std::logic_error&)
+ {
+ VISU::Result_i* pResult = GetResult(theSObject);
+ if(pResult != NULL){
+ TPrs3d* pPrs3d = new TPrs3d(pResult,theSObject);
+ return pPrs3d->Restore(theMap);
+ }
+ return NULL;
+ }
}
#endif
using namespace std;
#ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
{
myName = theName;
SALOMEDS::SObject_var mySO = myStudy->FindObjectID( GetEntry() );
- if ( !mySO->_is_nil() ) {
+ if(!mySO->_is_nil()){
SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( mySO, "AttributeName" );
SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
}
QString VISU::PrsObject_i::GetEntry() {
CORBA::String_var anIOR = GetID();
- SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR);
- CORBA::String_var anEntry = aSObject->GetID();
+ SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR.in());
+ CORBA::String_var anEntry;
+ if(!CORBA::is_nil(aSObject.in()))
+ anEntry = aSObject->GetID();
+ else
+ INFOS("PrsObject_i::GetEntry - Cannot find SObject in the Study with StudyId = "<<myStudy->StudyId()<<" !!!");
return anEntry.in();
}
#include "VISU_Result_i.hh"
#include "VISU_Convertor_impl.hxx"
#include "VISU_CorbaMedConvertor.hxx"
+#include "VISU_PipeLine.hxx"
#include "QAD_Config.h"
#include "SALOMEDS_Tool.hxx"
#include <qstring.h>
#include <qfileinfo.h>
+#include <memory>
#include <fstream>
#include <vtkUnstructuredGridReader.h>
return aResult;
}
+void VISU::RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly){
+ if(!theSObject->_is_nil()){
+ SALOMEDS::Study_var aStudy = theSObject->GetStudy();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
+ if(theIsAttrOnly)
+ aStudyBuilder->RemoveAttribute(theSObject,"AttributeIOR");
+ else
+ aStudyBuilder->RemoveObjectWithChildren(theSObject);
+ }
+}
+
QString GenerateName(const char* theName){
typedef map<string,int> TNameMap;
static TNameMap aMap;
const string VISU::Result_i::myComment = "RESULT";
const char* VISU::Result_i::GetComment() const { return myComment.c_str();}
-VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy) {
+VISU::Result_i::Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId) {
myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+ mySourceId = aSourceId;
myInput = NULL;
myIsDone = 0;
+ CORBA::String_var aName = theStudy->Name();
+ INFOS("Result_i::Result_i - this = "<<this<<"; StudyId = "<<
+ theStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
+}
+
+
+void VISU::Result_i::RemoveFromStudy(){
+ VISU::RemoveFromStudy(mySObject,false);
+}
+
+
+int VISU::Result_i::IsPossible(){
+ try{
+ float aSize = myInput->GetSize();
+ bool aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+ INFOS("Result_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<float(aResult));
+ return aResult;
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was accured!");
+ }
+ return 0;
}
+
CORBA::Boolean VISU::Result_i::BuildAll(){
if(MYDEBUG) MESSAGE("Result_i::Build - myIsDone = "<<myIsDone);
if(myIsDone) return 1;
+ if(!IsPossible()) return 0;
try{
const VISU::TMeshMap& aMeshMap = myInput->GetMeshMap();
VISU::TMeshMap::const_iterator aMeshMapIter = aMeshMap.begin();
VISU::TField::TValField::const_iterator aValFieldIter = aValField.begin();
for(; aValFieldIter != aValField.end(); aValFieldIter++){
int aTimeStamp = aValFieldIter->first;
- myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+ try{
+ myInput->GetTimeStampOnMesh(aMeshName,anEntity,aFieldName,aTimeStamp);
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was accured!!!");
+ }
}
}
- }
- //Importing groups
- const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
- VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
- for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
- const string& aGroupName = aGroupMapIter->first;
- myInput->GetMeshOnGroup(aMeshName,aGroupName);
- }
- //Import families
- aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
- const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
- const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
- const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
- VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const string& aFamilyName = aFamilyMapIter->first;
- myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
- }
- }
- //Import mesh on entity
- aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
- const VISU::TEntity& anEntity = aMeshOnEntityMapIter->first;
- myInput->GetMeshOnEntity(aMeshName,anEntity);
+ //Importing groups
+ const VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
+ VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
+ for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
+ const string& aGroupName = aGroupMapIter->first;
+ try{
+ myInput->GetMeshOnGroup(aMeshName,aGroupName);
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was accured!!!");
+ }
+ }
+ //Import families
+ const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+ VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ const string& aFamilyName = aFamilyMapIter->first;
+ try{
+ myInput->GetMeshOnEntity(aMeshName,anEntity,aFamilyName);
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was accured!!!");
+ }
+ }
+ //Import mesh on entity
+ try{
+ myInput->GetMeshOnEntity(aMeshName,anEntity);
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was accured!!!");
+ }
}
}
myIsDone = 1;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
- INFOS("Unknown exception was accured!");
+ INFOS("Unknown exception was accured!!!");
}
return myIsDone;
}
VISU::Storable* VISU::Result_i::Build(SALOMEDS::SObject_ptr theSObject)
throw (std::runtime_error&)
{
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
+ aStudyBuilder->NewCommand(); // There is a transaction
if(MYDEBUG) MESSAGE("Result_i::Build");
- const TMeshMap& aMeshMap = myInput->GetMeshMap();
- if(!aMeshMap.empty()) {//apo
+ try{
+ const TMeshMap& aMeshMap = myInput->GetMeshMap();
+ if(aMeshMap.empty())
+ throw std::runtime_error("Build - There is no any mesh information in the file !!!");
mySComponent = FindOrCreateVisuComponent(myStudyDocument);
CORBA::String_var aSComponentEntry = mySComponent->GetID(), anIOR(GetID());
string aRefFatherEntry = GetRefFatherEntry();
QString aComment;
- aComment.sprintf("myComment=%s;myType=%d;myFileName=%s",
- GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1());
+ aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
+ GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1(),
+ myInitFileName.c_str()); // Restoring of Python dump
string aResultEntry = CreateAttributes(myStudyDocument,aSComponentEntry,aRefFatherEntry.c_str(),
anIOR,myName.c_str(),"",aComment.latin1(),true);
mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str());
VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
const string& aFamilyName = aFamilyMapIter->first;
+ const VISU::TFamily& aFamily = aFamilyMapIter->second;
aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
}
}
}
+ QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
+ bool isBuildAll = aIsBuild.isEmpty()? 0 : aIsBuild.toInt();
+ if(isBuildAll) BuildAll();
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ return NULL;
+ }catch(...){
+ INFOS("Unknown exception was accured!!!");
+ return NULL;
}
- QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
- if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) BuildAll();
+ aStudyBuilder->CommitCommand();
return this;
}
VISU::Storable* VISU::Result_i::Create(const char* theFileName){
try{
- mySourceId = eFile;
- myInput = CreateConvertor(theFileName);
- if(myInput == NULL) return NULL;
myFileInfo.setFile(theFileName);
+ myInitFileName = myFileInfo.filePath().latin1();
myName = ::GenerateName(myFileInfo.fileName()).latin1();
- VISU::Storable* aStorable = Build();
- return aStorable;
+ if(GetSourceId() == eRestoredFile){
+ auto_ptr<char> aTmpDir(SALOMEDS_Tool::GetTmpDir());
+ static QString aCommand;
+ aCommand.sprintf("cp %s %s",myFileInfo.absFilePath().latin1(),aTmpDir.get());
+ if(system(aCommand) == -1){
+ INFOS("Create - Can't execute the command :"<<aCommand);
+ return NULL;
+ }
+ if(MYDEBUG) MESSAGE("Result_i::Create - aCommand = "<<aCommand);
+ myFileInfo.setFile(QString(aTmpDir.get()) + myFileInfo.fileName());
+ }
+ myInput = CreateConvertor(myFileInfo.absFilePath().latin1());
+ if(!myInput)
+ throw std::runtime_error("Create - Cannot create a Convertor for this file!!!");
+ return Build();
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
- INFOS("Unknown exception was accured!");
+ INFOS("Unknown exception was accured!!!");
}
return NULL;
}
VISU::Storable* VISU::Result_i::Create(SALOMEDS::SObject_ptr theMedSObject){
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOMEDS::SObject_ptr");
try{
- mySourceId = eComponent;
myInput = CreateMEDConvertor(theMedSObject);
if(myInput == NULL) return NULL;
string aCompDataType = GetComponentDataType(theMedSObject);
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
- INFOS("Unknown exception was accured!");
+ INFOS("Unknown exception was accured!!!");
}
return NULL;
}
VISU::Storable* VISU::Result_i::Create(SALOME_MED::FIELD_ptr theField){
if(MYDEBUG) MESSAGE("Result_i::Create MedObject from SALOME_MED::FIELD_ptr");
try{
- mySourceId = eComponent;
myInput = CreateMEDFieldConvertor(theField);
if(myInput == NULL) return NULL;
string aCompDataType = "MED";
myFileInfo.setFile(aCompDataType.c_str());
+ myInitFileName = aCompDataType;
myName = ::GenerateName("aResult").latin1();
VISU::Storable* aStorable = Build();
return aStorable;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
- INFOS("Unknown exception was accured!");
+ INFOS("Unknown exception was accured!!!");
}
return NULL;
}
mySObject = SALOMEDS::SObject::_duplicate(theSObject);
myStudyDocument = mySObject->GetStudy();
mySComponent = mySObject->GetFatherComponent();
- myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
+ myName = VISU::Storable::FindValue(theMap,"myName").latin1();
+ myInitFileName = VISU::Storable::FindValue(theMap,"myInitFileName").latin1();
SALOMEDS::SObject_var aRefSObj, aTargetRefSObj;
if(mySObject->FindSubObject(1,aRefSObj) && aRefSObj->ReferencedObject(aTargetRefSObj)){
mySourceId = eRestoredComponent;
SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder();
SALOMEDS::Driver_var aDriver = SALOMEDS::Driver::_narrow(aEngComp);
aStudyBuilder->LoadWith(aCompRefSObj,aDriver);
- if(strcmp(aDataType,"MED") == 0){
+ if(strcmp(aDataType,"MED") == 0)
myInput = CreateMEDConvertor(aTargetRefSObj);
- }else
+ else
throw std::runtime_error("GetInput - There is no convertor for the aDataType !!!");
}else{
myFileInfo.setFile(thePrefix.c_str());
- string aStudyPrefix(SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()));
+ string aStudyPrefix("");
+ if (IsMultifile()) aStudyPrefix = (SALOMEDS_Tool::GetNameFromPath(myStudyDocument->URL()));
if(!myFileInfo.isFile()){
string aFileName = thePrefix + aStudyPrefix + "_" + myName;
myFileInfo.setFile(aFileName.c_str());
return NULL;
} else if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - "<<aCommand);
SALOMEDS::ListOfFileNames_var anEmptyList = new SALOMEDS::ListOfFileNames;
- SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList, true);
+ SALOMEDS_Tool::RemoveTemporaryFiles(aResultPath, anEmptyList.in(), true);
}
mySourceId = eRestoredFile;
delete(aResultPath);
delete(aHDFFileName);
- } else if (!IsMultifile()) mySourceId = eRestoredFile;
- else mySourceId = eFile;
-
+ } else if (!IsMultifile())
+ mySourceId = eRestoredFile;
+ else
+ mySourceId = eFile;
+ if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = "<<mySourceId);
myInput = CreateMedConvertor(myFileInfo.filePath().latin1());
QString aComment;
- aComment.sprintf("myComment=%s;myType=%d;myName=%s;myFileName=%s",
- GetComment(),VISU::TRESULT,myName.c_str(),myFileInfo.filePath().latin1());
+ aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
+ GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1(),
+ myInitFileName.c_str()); // Restoring of Python dump
SALOMEDS::GenericAttribute_var anAttr;
if(!theSObject->FindAttribute(anAttr, "AttributeComment"))
throw std::runtime_error("Build - There is no AttributeComment for the SObject !!!");
aCmnt->SetValue(aComment.latin1());
}
QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
- if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) BuildAll();
+ if(aIsBuild.isEmpty()? 0 : aIsBuild.toInt())
+ BuildAll();
return this;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
- INFOS("Unknown exception was accured!");
+ INFOS("Unknown exception was accured!!!");
}
return NULL;
}
void VISU::Result_i::ToStream(std::ostringstream& theStr){
if(MYDEBUG) MESSAGE(GetComment());
Storable::DataToStream(theStr,"myName",myName.c_str());
+ Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str());
}
VISU::Storable* VISU::Result_i::Restore(SALOMEDS::SObject_ptr theSObject,
const SALOMEDS::SComponent_var& VISU::Result_i::GetSComponent() const { return mySComponent;}
VISU::Result_i::~Result_i() {
- if(MYDEBUG) MESSAGE("Result_i::~Result_i()");
+ INFOS("Result_i::~Result_i() - this = "<<this);
+ if(GetSourceId() == eRestoredFile){
+ static QString aCommand;
+ aCommand.sprintf("rm %s",myFileInfo.filePath().latin1());
+ INFOS("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
+ aCommand.sprintf("rmdir --ignore-fail-on-non-empty %s",myFileInfo.dirPath().latin1());
+ INFOS("Result_i::~Result_i - system("<<aCommand<<") = "<<system(aCommand));
+ }
if(myInput) delete myInput;
}
#define __VISU_RESULT_I_H__
#include "VISUConfig.hh"
+#include "SALOME_GenericObj_i.hh"
class VISU_Convertor;
namespace VISU{
class Result_i : public virtual POA_VISU::Result,
- public virtual Storable
+ public virtual Storable,
+ public virtual SALOME::GenericObj_i
{
Result_i();
Result_i(const Result_i &);
+
public:
- Result_i(SALOMEDS::Study_ptr theStudy);
+ enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
+ Result_i(SALOMEDS::Study_ptr theStudy, const TSourceId& aSourceId = eFile);
virtual ~Result_i();
+ virtual void RemoveFromStudy();
virtual VISU::VISUType GetType() { return VISU::TRESULT;}
virtual CORBA::Boolean BuildAll();
typedef VISU_Convertor TInput;
- enum TSourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
+
private:
TSourceId mySourceId;
TInput *myInput;
CORBA::Boolean myIsDone;
- string myName;
+ string myName, myInitFileName;
QFileInfo myFileInfo;
+
protected:
virtual Storable* Build(SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil())
throw (std::runtime_error&);
+
public:
+ virtual int IsPossible();
+
virtual Storable* Create(const char* theFileName);
virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
TInput* GetInput();
const string& GetName() const { return myName;}
const QFileInfo& GetFileInfo() const { return myFileInfo;}
- Result_i::TSourceId GetSourceId() const { return mySourceId;}
+ const Result_i::TSourceId& GetSourceId() const { return mySourceId;}
+
private:
SALOMEDS::SObject_var mySObject;
SALOMEDS::Study_var myStudyDocument;
SALOMEDS::SComponent_var mySComponent;
+
public:
string GetRefFatherEntry();
string GetEntry();
const SALOMEDS::SObject_var& GetSObject() const;
const SALOMEDS::Study_var& GetStudyDocument() const;
const SALOMEDS::SComponent_var& GetSComponent() const;
+
};
+
Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
+ void RemoveFromStudy(SALOMEDS::SObject_ptr theSObject, int theIsAttrOnly = true);
}
#endif
static int INCMEMORY = 4;
int VISU::ScalarMap_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+ const char* theFieldName, int theIteration, int isMemoryCheck)
{
try{
- vtkIdType aSize = INCMEMORY*
+ float aSize = INCMEMORY*
theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
- if(MYDEBUG) MESSAGE("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<aSize);
- if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
- return false;
+ bool aResult = true;
+ if(isMemoryCheck){
+ aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+ INFOS("ScalarMap_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+ }
+ return aResult;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
const string VISU::ScalarMap_i::myComment = "SCALARMAP";
const char* VISU::ScalarMap_i::GetComment() const { return myComment.c_str();}
-VISU::ScalarMap_i::ScalarMap_i(Result_i* theResult, bool theAddToStudy) :
+VISU::ScalarMap_i::ScalarMap_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult)
+ Prs3d_i(theResult,theSObject)
{
myAddToStudy = theAddToStudy;
myScalarMapPL = NULL;
}
-void VISU::ScalarMap_i::Destroy(){
- if(myAddToStudy){
- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID(GetEntry());
- if(!aSObj->_is_nil()){
- SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
- aStudyBuilder->RemoveObject(aSObj);
- }
- }
- Prs3d_i::Destroy();
+
+void VISU::ScalarMap_i::RemoveFromStudy(){
+ VISU::RemoveFromStudy(mySObject,false);
}
SetScaling(aScalarMap->GetScaling());
- SetOrientation(aScalarMap->GetOrientation());
+ SetBarOrientation(aScalarMap->GetBarOrientation());
SetPosition(aScalarMap->GetPosX(), aScalarMap->GetPosY());
SetSize(aScalarMap->GetWidth(), aScalarMap->GetHeight());
SetNbColors(aScalarMap->GetNbColors());
SetLabels(aScalarMap->GetLabels());
SetTitle(aScalarMap->GetTitle());
+ SetBoldTitle(aScalarMap->IsBoldTitle());
+ SetItalicTitle(aScalarMap->IsItalicTitle());
+ SetShadowTitle(aScalarMap->IsShadowTitle());
+ SetTitFontType(aScalarMap->GetTitFontType());
+ float r,g,b;
+ aScalarMap->GetTitleColor(&r,&g,&b);
+ SetTitleColor(r,g,b);
+
+ SetBoldLabel(aScalarMap->IsBoldLabel());
+ SetItalicLabel(aScalarMap->IsItalicLabel());
+ SetShadowLabel(aScalarMap->IsShadowLabel());
+ SetLblFontType(aScalarMap->GetLblFontType());
+ aScalarMap->GetLabelColor(&r,&g,&b);
+ SetLabelColor(r,g,b);
+
Build(-1);
Update();
}
else
SetScaling(VISU::LINEAR);
+ // Fonts properties definition
+ QString aIsBoldTitle = QAD_CONFIG->getSetting("Visu:IsBoldTitle");
+ myIsBoldTitle = (aIsBoldTitle.isEmpty())? true : (aIsBoldTitle.compare("true") == 0);
+
+ QString aIsItalicTitle = QAD_CONFIG->getSetting("Visu:IsItalicTitle");
+ myIsItalicTitle = (aIsItalicTitle.isEmpty())? true : (aIsItalicTitle.compare("true") == 0);
+
+ QString aIsShadowTitle = QAD_CONFIG->getSetting("Visu:IsShadowTitle");
+ myIsShadowTitle = (aIsShadowTitle.isEmpty())? true : (aIsShadowTitle.compare("true") == 0);
+
+ QString aTitFontType = QAD_CONFIG->getSetting("Visu:TitFontType");
+ if (!aTitFontType.isEmpty()) {
+ switch (aTitFontType.toInt()) {
+ case 0: myTitFontType = VTK_ARIAL; break;
+ case 1: myTitFontType = VTK_COURIER; break;
+ case 2: myTitFontType = VTK_TIMES; break;
+ }
+ } else {
+ myTitFontType = VTK_ARIAL;
+ }
+ QString aRTitColor = QAD_CONFIG->getSetting("Visu:TitleColorR");
+ myTitleColor[0] = (aRTitColor.isEmpty())? 1 : aRTitColor.toFloat();
+ if (myTitleColor[0] > 1) myTitleColor[0] = 1;
+ if (myTitleColor[0] < 0) myTitleColor[0] = 0;
+
+ QString aGTitColor = QAD_CONFIG->getSetting("Visu:TitleColorG");
+ myTitleColor[1] = (aGTitColor.isEmpty())? 1 : aGTitColor.toFloat();
+ if (myTitleColor[1] > 1) myTitleColor[1] = 1;
+ if (myTitleColor[1] < 0) myTitleColor[1] = 0;
+
+ QString aBTitColor = QAD_CONFIG->getSetting("Visu:TitleColorB");
+ myTitleColor[2] = (aBTitColor.isEmpty())? 1 : aBTitColor.toFloat();
+ if (myTitleColor[2] > 1) myTitleColor[2] = 1;
+ if (myTitleColor[2] < 0) myTitleColor[2] = 0;
+
+ ///
+
+ QString aIsBoldLabel = QAD_CONFIG->getSetting("Visu:IsBoldLabel");
+ myIsBoldLabel = (aIsBoldLabel.isEmpty())? true : (aIsBoldLabel.compare("true") == 0);
+
+ QString aIsItalicLabel = QAD_CONFIG->getSetting("Visu:IsItalicLabel");
+ myIsItalicLabel = (aIsItalicLabel.isEmpty())? true : (aIsItalicLabel.compare("true") == 0);
+
+ QString aIsShadowLabel = QAD_CONFIG->getSetting("Visu:IsShadowLabel");
+ myIsShadowLabel = (aIsShadowLabel.isEmpty())? true : (aIsShadowLabel.compare("true") == 0);
+
+ QString aLblFontType = QAD_CONFIG->getSetting("Visu:LblFontType");
+ if (!aLblFontType.isEmpty()) {
+ switch (aLblFontType.toInt()) {
+ case 0: myLblFontType = VTK_ARIAL; break;
+ case 1: myLblFontType = VTK_COURIER; break;
+ case 2: myLblFontType = VTK_TIMES; break;
+ }
+ } else {
+ myLblFontType = VTK_ARIAL;
+ }
+ QString aRLblColor = QAD_CONFIG->getSetting("Visu:LabelColorR");
+ myLabelColor[0] = (aRLblColor.isEmpty())? 1 : aRLblColor.toFloat();
+ if (myLabelColor[0] > 1) myLabelColor[0] = 1;
+ if (myLabelColor[0] < 0) myLabelColor[0] = 0;
+
+ QString aGLblColor = QAD_CONFIG->getSetting("Visu:LabelColorG");
+ myLabelColor[1] = (aGLblColor.isEmpty())? 1 : aGLblColor.toFloat();
+ if (myLabelColor[1] > 1) myLabelColor[1] = 1;
+ if (myLabelColor[1] < 0) myLabelColor[1] = 0;
+
+ QString aBLblColor = QAD_CONFIG->getSetting("Visu:LabelColorB");
+ myLabelColor[2] = (aBLblColor.isEmpty())? 1 : aBLblColor.toFloat();
+ if (myLabelColor[2] > 1) myLabelColor[2] = 1;
+ if (myLabelColor[2] < 0) myLabelColor[2] = 0;
+
+
myMeshName = theMeshName;
myEntity = (VISU::TEntity)theEntity;
myFieldName =theFieldName;
VISU::Storable* VISU::ScalarMap_i::Restore(const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
+ throw(std::logic_error&)
{
DoHook();
-
- Prs3d_i::Restore(theMap);
-
- myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
-
myMeshName = VISU::Storable::FindValue(theMap,"myMeshName").latin1();
myEntity = (VISU::TEntity)VISU::Storable::FindValue(theMap,"myEntity").toInt();
myFieldName = VISU::Storable::FindValue(theMap,"myFieldName").latin1();
myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
+ myTitFontType = VISU::Storable::FindValue(theMap,"myTitFontType").toInt();
+ myIsBoldTitle = VISU::Storable::FindValue(theMap,"myIsBoldTitle").toInt();
+ myIsItalicTitle = VISU::Storable::FindValue(theMap,"myIsItalicTitle").toInt();
+ myIsShadowTitle = VISU::Storable::FindValue(theMap,"myIsShadowTitle").toInt();
+ myTitleColor[0] = VISU::Storable::FindValue(theMap,"myTitleColor[0]").toFloat();
+ myTitleColor[1] = VISU::Storable::FindValue(theMap,"myTitleColor[1]").toFloat();
+ myTitleColor[2] = VISU::Storable::FindValue(theMap,"myTitleColor[2]").toFloat();
+
+ myLblFontType = VISU::Storable::FindValue(theMap,"myLblFontType").toInt();
+ myIsBoldLabel = VISU::Storable::FindValue(theMap,"myIsBoldLabel").toInt();
+ myIsItalicLabel = VISU::Storable::FindValue(theMap,"myIsItalicLabel").toInt();
+ myIsShadowLabel = VISU::Storable::FindValue(theMap,"myIsShadowLabel").toInt();
+ myLabelColor[0] = VISU::Storable::FindValue(theMap,"myLabelColor[0]").toFloat();
+ myLabelColor[1] = VISU::Storable::FindValue(theMap,"myLabelColor[1]").toFloat();
+ myLabelColor[2] = VISU::Storable::FindValue(theMap,"myLabelColor[2]").toFloat();
+
+ Prs3d_i::Restore(theMap);
+ myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study.
return Build(true);
}
Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
Storable::DataToStream( theStr, "myWidth", myWidth );
Storable::DataToStream( theStr, "myHeight", myHeight );
+
+ Storable::DataToStream( theStr, "myTitFontType", myTitFontType );
+ Storable::DataToStream( theStr, "myIsBoldTitle", myIsBoldTitle );
+ Storable::DataToStream( theStr, "myIsItalicTitle", myIsItalicTitle );
+ Storable::DataToStream( theStr, "myIsShadowTitle", myIsShadowTitle );
+ Storable::DataToStream( theStr, "myTitleColor[0]", myTitleColor[0] );
+ Storable::DataToStream( theStr, "myTitleColor[1]", myTitleColor[1] );
+ Storable::DataToStream( theStr, "myTitleColor[2]", myTitleColor[2] );
+
+ Storable::DataToStream( theStr, "myLblFontType", myLblFontType );
+ Storable::DataToStream( theStr, "myIsBoldLabel", myIsBoldLabel );
+ Storable::DataToStream( theStr, "myIsItalicLabel", myIsItalicLabel );
+ Storable::DataToStream( theStr, "myIsShadowLabel", myIsShadowLabel );
+ Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] );
+ Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] );
+ Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] );
}
}
-VISU::Storable* VISU::ScalarMap_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- if(VISU::Result_i* pResult = GetResult(theSObject)){
- VISU::ScalarMap_i* pResent = new VISU::ScalarMap_i(pResult);
- return pResent->Restore(theMap);
- }
- return NULL;
-}
-
-
-VISU::ScalarMap_i::~ScalarMap_i(){
- if(MYDEBUG) MESSAGE("ScalarMap_i::~ScalarMap_i()");
-}
+VISU::ScalarMap_i::~ScalarMap_i(){}
VISU::Storable* VISU::ScalarMap_i::Build(int theRestoring){
if(MYDEBUG)
MESSAGE("ScalarMap_i::Build - "<<myFieldName<<"; theRestoring = "<<theRestoring);
+ SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder();
+ if(myAddToStudy) aStudyBuilder->NewCommand(); // There is a transaction
try{
if(myResult->GetInput() == NULL)
throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!");
const VISU::TField::TValField& aValField = myField->myValField;
const VISU::TField::TValForTime& aValForTime = aValField.find(myIteration)->second;
aComment.sprintf("%s %s",myFieldName.c_str(),VISU_Convertor::GenerateName(aValForTime.myTime).c_str());
- myTitle = aComment.simplifyWhiteSpace().latin1();
+ if (theRestoring == 0) myTitle = aComment.simplifyWhiteSpace().latin1();
}
if(myAddToStudy){
myName = GenerateName().latin1();
GetComment(),myMeshName.c_str(),myEntity,myFieldName.c_str(),myIteration,myField->myNbComp);
CORBA::String_var anIOR = GetID();
CreateAttributes(myStudy,anEntry.c_str(),aRefFatherEntry.c_str(),anIOR,myName.c_str(),"",aComment.latin1(),true);
+ mySObject = myStudy->FindObjectIOR(anIOR);
}
- return this;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
+ return NULL;
}catch(...){
INFOS("Unknown exception was accured!");
+ return NULL;
}
- return NULL;
+ if(myAddToStudy) aStudyBuilder->CommitCommand();
+ return this;
}
myScalarMapPL = dynamic_cast<VISU_ScalarMapPL*>(myPipeLine);
}
-void VISU::ScalarMap_i::Update(){
+void VISU::ScalarMap_i::Update() throw(std::runtime_error&){
VISU::Prs3d_i::Update();
}
return anActor;
}
-void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor){
+void VISU::ScalarMap_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
VISU::Prs3d_i::UpdateActor(theActor);
VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
aScalarBar->SetWidth(myWidth);
aScalarBar->SetHeight(myHeight);
aScalarBar->SetNumberOfLabels(myNumberOfLabels);
+
+ vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty();
+ aTitleProp->SetFontFamily(myTitFontType);
+ aTitleProp->SetColor(myTitleColor);
+ (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
+ (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
+ (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
+
+ vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty();
+ aLabelProp->SetFontFamily(myLblFontType);
+ aLabelProp->SetColor(myLabelColor);
+ (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
+ (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
+ (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+
aScalarBar->Modified();
}
}
ScalarMap_i(const ScalarMap_i&);
public:
- ScalarMap_i(Result_i* theResult, bool theAddToStudy = true);
+ ScalarMap_i(Result_i* theResult, bool theAddToStudy = true,
+ SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const ScalarMap_i* theOrigin);
virtual ~ScalarMap_i();
- virtual void Destroy();
+ virtual void RemoveFromStudy();
virtual VISU::VISUType GetType() { return VISU::TSCALARMAP;};
virtual void SetNbColors(CORBA::Long theNbColors);
virtual CORBA::Long GetNbColors();
- virtual void SetOrientation(VISU::ScalarMap::Orientation theOrientation){
+ virtual void SetBarOrientation(VISU::ScalarMap::Orientation theOrientation){
myOrientation = theOrientation;
}
- virtual VISU::ScalarMap::Orientation GetOrientation() { return myOrientation;}
+ virtual VISU::ScalarMap::Orientation GetBarOrientation() { return myOrientation;}
virtual void SetPosition(CORBA::Double X, CORBA::Double Y) { myPosition[0] = X; myPosition[1] = Y;}
virtual CORBA::Double GetPosX() { return myPosition[0];}
virtual void SetTitle(const char* theName) { myTitle = theName;}
virtual char* GetTitle() { return CORBA::string_dup(myTitle.c_str());}
+ virtual bool IsBoldTitle() { return myIsBoldTitle;}
+ virtual void SetBoldTitle(bool isBold) { myIsBoldTitle = isBold;}
+
+ virtual bool IsItalicTitle() { return myIsItalicTitle;}
+ virtual void SetItalicTitle(bool isItalic) { myIsItalicTitle = isItalic;}
+
+ virtual bool IsShadowTitle() { return myIsShadowTitle;}
+ virtual void SetShadowTitle(bool isShadow) { myIsShadowTitle = isShadow;}
+
+ virtual int GetTitFontType() { return myTitFontType;}
+ virtual void SetTitFontType(int theType) { myTitFontType = theType;}
+
+ virtual void GetTitleColor(float* theR, float* theG, float* theB)
+ {*theR = myTitleColor[0]; *theG = myTitleColor[1]; *theB = myTitleColor[2];}
+ virtual void SetTitleColor(float theR, float theG, float theB)
+ {myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; }
+
+ /////
+ virtual bool IsBoldLabel() { return myIsBoldLabel;}
+ virtual void SetBoldLabel(bool isBold) { myIsBoldLabel = isBold;}
+
+ virtual bool IsItalicLabel() { return myIsItalicLabel;}
+ virtual void SetItalicLabel(bool isItalic) { myIsItalicLabel = isItalic;}
+
+ virtual bool IsShadowLabel() { return myIsShadowLabel;}
+ virtual void SetShadowLabel(bool isShadow) {myIsShadowLabel = isShadow;}
+
+ virtual int GetLblFontType() { return myLblFontType;}
+ virtual void SetLblFontType(int theType) { myLblFontType = theType;}
+
+ virtual void GetLabelColor(float* theR, float* theG, float* theB)
+ {*theR = myLabelColor[0]; *theG = myLabelColor[1]; *theB = myLabelColor[2];}
+ virtual void SetLabelColor(float theR, float theG, float theB)
+ {myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; }
+
typedef VISU::ScalarMap TInterface;
VISU_ScalarMapPL* GetScalarMapPL(){ return myScalarMapPL;}
float myPosition[2], myWidth, myHeight;
VISU::ScalarMap::Orientation myOrientation;
+ //Font management
+ bool myIsBoldTitle;
+ bool myIsItalicTitle;
+ bool myIsShadowTitle;
+ int myTitFontType;
+ float myTitleColor[3];
+
+ bool myIsBoldLabel;
+ bool myIsItalicLabel;
+ bool myIsShadowLabel;
+ int myLblFontType;
+ float myLabelColor[3];
+
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
const string& thePrefix, const Storable::TRestoringMap& theMap)
throw(std::logic_error&);
- virtual void Update();
+ virtual void Update() throw(std::runtime_error&);
virtual void SetMapScale(double theMapScale = 1.0);
const VISU::TField* GetField() const { return myField;}
virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
throw (std::runtime_error&);
- virtual void UpdateActor(VISU_Actor* theActor);
+ virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
};
}
static int MYDEBUGWITHFILES = 0;
#endif
-static int INCMEMORY = 2;
-
int VISU::StreamLines_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+ const char* theFieldName, int theIteration, int isMemoryCheck)
{
try{
- vtkIdType aSize =
- (VISU_StreamLinesPL::myMaxIncrementMemorySize+INCMEMORY)*
- theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
- if(MYDEBUG) MESSAGE("StreamLines_i::IsPossible - CheckAvailableMemory = "<<aSize);
- if(VISU_PipeLine::CheckAvailableMemory(aSize)) return true;
- return false;
+ if(!VISU::ScalarMap_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false)) return 0;
+ VISU_Convertor::TOutput *anOutput =
+ theResult->GetInput()->GetTimeStampOnMesh(theMeshName,VISU::TEntity(theEntity),theFieldName,theIteration);
+ bool aResult = VISU_StreamLinesPL::IsPossible(anOutput);
+ INFOS("StreamLines_i::IsPossible - aResult = "<<aResult);
+ return aResult;
}catch(std::runtime_error& exc){
INFOS("Follow exception was accured :\n"<<exc.what());
}catch(...){
const char* VISU::StreamLines_i::GetComment() const { return myComment.c_str();}
-VISU::StreamLines_i::StreamLines_i(Result_i* theResult, bool theAddToStudy) :
+VISU::StreamLines_i::StreamLines_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult),
- ScalarMap_i(theResult, theAddToStudy),
- DeformedShape_i(theResult, theAddToStudy)
+ Prs3d_i(theResult,theSObject),
+ ScalarMap_i(theResult,theAddToStudy,theSObject),
+ DeformedShape_i(theResult,theAddToStudy,theSObject)
{
myStreamLinesPL = NULL;
+ myAppendFilter = vtkAppendFilter::New();
}
-void VISU::StreamLines_i::Destroy(){
- DeformedShape_i::Destroy();
-}
-
-
void VISU::StreamLines_i::SameAs(const StreamLines_i* theOrigin) {
StreamLines_i* aStreamLines = const_cast<StreamLines_i*>(theOrigin);
VISU::DeformedShape_i::SameAs(theOrigin);
-
- //Order of setting of the values are important
- //SetIntegrationStep(aStreamLines->GetIntegrationStep());
- //SetPropagationTime(aStreamLines->GetPropagationTime());
- //SetStepLength(aStreamLines->GetStepLength());
-
- //SetUsedPoints(aStreamLines->GetUsedPoints());
- //SetDirection(aStreamLines->GetDirection());
-
SetSource(aStreamLines->GetSource());
}
VISU::Storable* VISU::StreamLines_i::Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&)
{
- DeformedShape_i::Restore(theMap);
-
- //Order of setting of the values are important
- SetIntegrationStep(VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble());
- SetPropagationTime(VISU::Storable::FindValue(theMap,"myPropagationTime").toDouble());
- SetStepLength(VISU::Storable::FindValue(theMap,"myStepLength").toDouble());
-
- SetDirection(VISU::StreamLines::Direction(VISU::Storable::FindValue(theMap,"myDirection").toInt()));
- SetUsedPoints(VISU::Storable::FindValue(theMap,"myPercents").toDouble());
+ DoHook();
+ VISU::Storable* aStorable = DeformedShape_i::Restore(theMap);
+
+ double anIntegrationStep = VISU::Storable::FindValue(theMap,"myIntegrationStep").toDouble();
+ double aPropagationTime = VISU::Storable::FindValue(theMap,"myPropagationTime").toDouble();
+ double aStepLength = VISU::Storable::FindValue(theMap,"myStepLength").toDouble();
+ int aDirection = VISU::StreamLines::Direction(VISU::Storable::FindValue(theMap,"myDirection").toInt());
+ double aPercents = VISU::Storable::FindValue(theMap,"myPercents").toDouble();
+ SetParams(anIntegrationStep,
+ aPropagationTime,
+ aStepLength,
+ VISU::Prs3d::_nil(),
+ aPercents,
+ VISU::StreamLines::Direction(aDirection));
mySourceEntry = VISU::Storable::FindValue(theMap,"mySourceEntry").latin1();
- return Build(true);
+ return aStorable;
}
}
-VISU::Storable* VISU::StreamLines_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- VISU::Result_i* pResult = GetResult(theSObject);
- if(pResult != NULL){
- VISU::StreamLines_i* pResent = new VISU::StreamLines_i(pResult);
- return pResent->Restore(theMap);
- }
- return NULL;
-}
-
-
VISU::StreamLines_i::~StreamLines_i(){
if(MYDEBUG) MESSAGE("StreamLines_i::~StreamLines_i()");
+ myAppendFilter->UnRegisterAllOutputs();
+ myAppendFilter->Delete();
}
-void VISU::StreamLines_i::SetDirection(VISU::StreamLines::Direction theDirection) {
- myStreamLinesPL->SetDirection(theDirection);
-}
-VISU::StreamLines::Direction VISU::StreamLines_i::GetDirection() {
- return VISU::StreamLines::Direction(myStreamLinesPL->GetDirection());
+CORBA::Boolean
+VISU::StreamLines_i::SetParams(CORBA::Double theIntStep,
+ CORBA::Double thePropogationTime,
+ CORBA::Double theStepLength,
+ VISU::Prs3d_ptr thePrs3d,
+ CORBA::Double thePercents,
+ VISU::StreamLines::Direction theDirection)
+{
+ VISU::Prs3d_i* aPrs3di = NULL;
+ vtkPointSet* aSource = NULL;
+ if(!thePrs3d->_is_nil())
+ if(aPrs3di = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d).in())){
+ for(int i = myAppendFilter->GetNumberOfInputs()-1; i >= 0; i--)
+ myAppendFilter->RemoveInput(myAppendFilter->GetInput(i));
+ myAppendFilter->AddInput(aPrs3di->GetPL()->GetMapper()->GetInput());
+ aSource = myAppendFilter->GetOutput();
+ }
+ int isAccepted = myStreamLinesPL->SetParams(theIntStep,
+ thePropogationTime,
+ theStepLength,
+ aSource,
+ thePercents,
+ theDirection,
+ 1);
+ if(isAccepted == 1) SetSource(aPrs3di);
+ return isAccepted == 1;
}
-void VISU::StreamLines_i::SetStepLength(CORBA::Double theStep) {
- myStreamLinesPL->SetStepLength(theStep);
-}
-CORBA::Double VISU::StreamLines_i::GetStepLength() {
- return myStreamLinesPL->GetStepLength();
+void VISU::StreamLines_i::SetSource(VISU::Prs3d_ptr thePrs3d){
+ if(!thePrs3d->_is_nil()){
+ VISU::Prs3d_i* aPrs3di = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d).in());
+ SetSource(aPrs3di);
+ }
}
-
-
-void VISU::StreamLines_i::SetPropagationTime(CORBA::Double theTime) {
- myStreamLinesPL->SetPropagationTime(theTime);
+void VISU::StreamLines_i::SetSource(VISU::Prs3d_i* thePrs3d){
+ mySourceEntry = "";
+ if(thePrs3d){
+ SALOMEDS::SObject_var aSObject = thePrs3d->GetSObject();
+ CORBA::String_var aString = aSObject->GetID();
+ mySourceEntry = aString.in();
+ }
}
-CORBA::Double VISU::StreamLines_i::GetPropagationTime() {
- return myStreamLinesPL->GetPropagationTime();
+void VISU::StreamLines_i::SetSource(){
+ if(!myStreamLinesPL->GetSource() && mySourceEntry == "") return;
+ if(myStreamLinesPL->GetSource() == myAppendFilter->GetOutput()) return;
+ VISU::Prs3d_var aPrs3d = GetSource();
+ SetParams(GetIntegrationStep(),
+ GetPropagationTime(),
+ GetStepLength(),
+ aPrs3d,
+ GetUsedPoints(),
+ GetDirection());
}
-void VISU::StreamLines_i::SetIntegrationStep(CORBA::Double theStep) {
- myStreamLinesPL->SetIntegrationStep(theStep);
-}
CORBA::Double VISU::StreamLines_i::GetIntegrationStep() {
return myStreamLinesPL->GetIntegrationStep();
}
+CORBA::Double VISU::StreamLines_i::GetPropagationTime() {
+ return myStreamLinesPL->GetPropagationTime();
+}
-void VISU::StreamLines_i::SetUsedPoints(CORBA::Double thePercents) {
- myStreamLinesPL->SetUsedPoints(thePercents);
+CORBA::Double VISU::StreamLines_i::GetStepLength() {
+ return myStreamLinesPL->GetStepLength();
}
-CORBA::Double VISU::StreamLines_i::GetUsedPoints() {
- return myStreamLinesPL->GetUsedPoints();
+
+VISU::StreamLines::Direction VISU::StreamLines_i::GetDirection() {
+ return VISU::StreamLines::Direction(myStreamLinesPL->GetDirection());
}
-void VISU::StreamLines_i::SetSource(VISU::Prs3d_ptr thePrs3d){
- if(!thePrs3d->_is_nil())
- if(VISU::Prs3d_i* aPrs3di = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(thePrs3d))){
- CORBA::String_var aString = thePrs3d->GetID();
- SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(aString);
- if(!CORBA::is_nil(aSObject)){
- vtkAppendFilter* anAppendFilter = vtkAppendFilter::New();
- anAppendFilter->AddInput(aPrs3di->GetPipeLine()->GetMapper()->GetInput());
- myStreamLinesPL->SetSource(anAppendFilter->GetOutput());
- anAppendFilter->Register(myStreamLinesPL);
- anAppendFilter->Delete();
- aString = aSObject->GetID();
- mySourceEntry = aString.in();
- return;
- }
- }
- myStreamLinesPL->SetSource(NULL);
- mySourceEntry = "";
-}
VISU::Prs3d_ptr VISU::StreamLines_i::GetSource(){
VISU::Prs3d_var aPrs3d;
if(MYDEBUG) MESSAGE("StreamLines_i::GetSource() mySourceEntry = '"<<mySourceEntry<<"'");
return aPrs3d._retn();
}
-
-float VISU::StreamLines_i::GetMaxIntegrationStep(){
- return myStreamLinesPL->GetMaxIntegrationStep();
+CORBA::Double VISU::StreamLines_i::GetUsedPoints() {
+ return myStreamLinesPL->GetUsedPoints();
}
-float VISU::StreamLines_i::GetMinIntegrationStep(){
- return myStreamLinesPL->GetMinIntegrationStep();
+void VISU::StreamLines_i::DoHook(){
+ if(!myPipeLine) myPipeLine = VISU_StreamLinesPL::New();
+ myStreamLinesPL = dynamic_cast<VISU_StreamLinesPL*>(myPipeLine);
+
+ DeformedShape_i::DoHook();
}
-float VISU::StreamLines_i::GetBasePropagationTime(){
- return myStreamLinesPL->GetBasePropagationTime();
+void VISU::StreamLines_i::Update() throw(std::runtime_error&){
+ SetSource();
+ VISU::DeformedShape_i::Update();
}
-void VISU::StreamLines_i::DoHook(){
- if(!myPipeLine) myPipeLine = VISU_StreamLinesPL::New();
- myStreamLinesPL = dynamic_cast<VISU_StreamLinesPL*>(myPipeLine);
+VISU_Actor* VISU::StreamLines_i::CreateActor(const Handle(SALOME_InteractiveObject)& theIO)
+ throw (std::runtime_error&)
+{
+ return VISU::DeformedShape_i::CreateActor(theIO);
+}
- DeformedShape_i::DoHook();
+
+void VISU::StreamLines_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
+ VISU::DeformedShape_i::UpdateActor(theActor);
}
#include "VISU_DeformedShape_i.hh"
class VISU_StreamLinesPL;
+class vtkAppendFilter;
namespace VISU{
class StreamLines_i : public virtual POA_VISU::StreamLines,
StreamLines_i();
StreamLines_i(const StreamLines_i&);
public:
- StreamLines_i(Result_i* theResult, bool theAddToStudy = true);
+ StreamLines_i(Result_i* theResult, bool theAddToStudy = true,
+ SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const StreamLines_i* theOriginal);
virtual ~StreamLines_i();
- virtual void Destroy();
virtual VISU::VISUType GetType() { return VISU::TSTREAMLINES;}
- virtual void SetDirection(VISU::StreamLines::Direction theDirection);
- virtual VISU::StreamLines::Direction GetDirection();
-
- virtual void SetStepLength(CORBA::Double theStep);
- virtual CORBA::Double GetStepLength();
-
- virtual void SetPropagationTime(CORBA::Double theTime);
- virtual CORBA::Double GetPropagationTime();
-
- virtual void SetIntegrationStep(CORBA::Double theStep);
+ virtual CORBA::Boolean SetParams(CORBA::Double theIntStep,
+ CORBA::Double thePropogationTime,
+ CORBA::Double theStepLength,
+ VISU::Prs3d_ptr thePrs3d,
+ CORBA::Double thePercents,
+ VISU::StreamLines::Direction theDirection);
virtual CORBA::Double GetIntegrationStep();
-
- virtual void SetUsedPoints(CORBA::Double thePercents);
+ virtual CORBA::Double GetPropagationTime();
+ virtual CORBA::Double GetStepLength();
virtual CORBA::Double GetUsedPoints();
-
- virtual void SetSource(VISU::Prs3d_ptr thePrs3d);
virtual VISU::Prs3d_ptr GetSource();
+ virtual VISU::StreamLines::Direction GetDirection();
typedef VISU::StreamLines TInterface;
VISU_StreamLinesPL* GetStreamLinesPL(){ return myStreamLinesPL;}
protected:
virtual void DoHook();
+ virtual void SetSource(VISU::Prs3d_ptr thePrs3d);
+ virtual void SetSource(VISU::Prs3d_i* thePrs3d);
+ virtual void SetSource();
VISU_StreamLinesPL* myStreamLinesPL;
+ vtkAppendFilter* myAppendFilter;
string mySourceEntry;
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual void ToStream(std::ostringstream& theStr);
- virtual Storable* Restore(const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
-
static const string myComment;
virtual const char* GetComment() const;
virtual QString GenerateName();
- virtual float GetMinIntegrationStep();
- virtual float GetMaxIntegrationStep();
- virtual float GetBasePropagationTime();
+ virtual Storable* Restore(const Storable::TRestoringMap& theMap)
+ throw(std::logic_error&);
+
+ virtual void Update() throw(std::runtime_error&);
+
+ virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
+ throw (std::runtime_error&);
+ virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
virtual QString GetSourceEntry() { return QString(mySourceEntry.c_str()); }
};
#include <strstream>
#include <qfileinfo.h>
+#include <qfile.h>
using namespace std;
#else
static int MYDEBUG = 0;
#endif
-
//----------------------------------------------------------------
// Table Object
//----------------------------------------------------------------
VISU::Table_i::Table_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry )
: PrsObject_i(theStudy)
{
- myObjectEntry = theObjectEntry;
+ mySObj = SALOMEDS::SObject::_duplicate((theStudy->FindObjectID(theObjectEntry)));
myOrientation = VISU::Table::HORIZONTAL;
}
/*!
*/
VISU::Table_i::~Table_i()
{
+ INFOS("Table_i::~Table_i");
}
/*!
Gets number of rows in table
*/
CORBA::Long VISU::Table_i::GetNbRows()
{
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+ SALOMEDS::SObject_var SO = mySObj;
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
if ( !SO->_is_nil() ) {
SALOMEDS::GenericAttribute_var anAttr;
*/
CORBA::Long VISU::Table_i::GetNbColumns()
{
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+ SALOMEDS::SObject_var SO = mySObj;
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
if ( !SO->_is_nil() ) {
SALOMEDS::GenericAttribute_var anAttr;
*/
VISU::Storable* VISU::Table_i::Build( int theRestoring )
{
+
// look for reference SObject with table attribute
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myObjectEntry.c_str() );
+ SALOMEDS::SObject_var SO = mySObj;
+
if ( !SO->_is_nil() ) {
CutLines_i* pCutLines = NULL;
CORBA::Object_var anObj = SObjectToObject(SO);
if(!CORBA::is_nil(anObj)){
VISU::CutLines_var aCutLines = VISU::CutLines::_narrow(anObj);
if(!aCutLines->_is_nil())
- pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines));
+ pCutLines = dynamic_cast<CutLines_i*>(GetServant(aCutLines).in());
}
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
- if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ||
- Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) || pCutLines) {
- // look for component
- if ( !theRestoring ) {
+ // look for component
+ if ( !theRestoring ) {
SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
// create SObject and set attributes
QString aComment;
aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TTABLE);
string anEntry = CreateAttributes( myStudy,
- SComponent->GetID(),
- "",
- GetID(),
- GetName(),
- "",
- aComment.latin1(),
- true );
+ SO->GetID(),//SComponent->GetID(),
+ "",
+ GetID(),
+ GetName(),
+ "",
+ aComment.latin1(),
+ true );
// create SObject referenced to real table object
- SALOMEDS::SObject_var newSO = myStudy->FindObjectID( anEntry.c_str() );
+ mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID( anEntry.c_str() ));
if(pCutLines) {
- pCutLines->BuildTableOfReal(newSO);
- myObjectEntry = anEntry;
+ pCutLines->BuildTableOfReal(mySObj);
}
- SALOMEDS::SObject_var refSO = Builder->NewObject( newSO );
+ SALOMEDS::SObject_var refSO = Builder->NewObject( mySObj );
Builder->Addreference( refSO, SO );
}
- return this;
- }
+ return this;
}
return NULL;
}
/*!
Restores table object from stream
*/
-VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap )
+VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
throw( std::logic_error& )
{
if(MYDEBUG) MESSAGE(GetComment());
myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
- myObjectEntry = (const char *)(VISU::Storable::FindValue(theMap,"myObjectEntry"));
myTitle = (const char*)(VISU::Storable::FindValue(theMap,"myTitle"));
myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() );
+ mySObj = SALOMEDS::SObject::_duplicate(SO);
return Build( true );
}
/*!
void VISU::Table_i::ToStream( std::ostringstream& theStr )
{
Storable::DataToStream( theStr, "myName", myName.c_str() );
- Storable::DataToStream( theStr, "myObjectEntry", myObjectEntry.c_str() );
Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
Storable::DataToStream( theStr, "myOrientation", myOrientation );
}
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
VISU::Table_i* pResent = new VISU::Table_i( aStudy, "" );
- return pResent->Restore( theMap );
+ return pResent->Restore( theMap, theSObject);
}
/*!
Gets title for the original table object
*/
const char* VISU::Table_i::GetTableTitle()
{
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( GetObjectEntry() );
+ SALOMEDS::SObject_var SO = mySObj;
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
/*!
Restores table object from the stream [ static ]
*/
-static VISU::Table_i* GetTable( SALOMEDS::Study_var& theStudy, const VISU::Storable::TRestoringMap& theMap ) {
- string anEntry = VISU::Storable::FindValue( theMap, "TableID" ).latin1();
- SALOMEDS::SObject_var aSObject = theStudy->FindObjectID( anEntry.c_str() );
- CORBA::Object_var anObject = VISU::SObjectToObject( aSObject );
+static VISU::Table_i* GetTable( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSO ) {
+ CORBA::Object_var anObject = VISU::SObjectToObject( theSO );
if( !CORBA::is_nil( anObject ) ) {
CORBA::Object_ptr aTable = VISU::Table::_narrow( anObject );
if( !CORBA::is_nil( aTable ) )
- return dynamic_cast<VISU::Table_i*>( VISU::GetServant( aTable ) );
+ return dynamic_cast<VISU::Table_i*>(VISU::GetServant(aTable).in());
}
return NULL;
}
*/
VISU::Curve_i::~Curve_i()
{
+ INFOS("Curve_i::~Curve_i");
}
/*!
Creates curve object
/*!
Builds presentation of curve
*/
-VISU::Storable* VISU::Curve_i::Build( int theRestoring )
+VISU::Storable* VISU::Curve_i::Build(int theRestoring )
{
if ( myTable != NULL ) {
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetEntry() );
int nbRows = myTable->GetNbRows();
- if ( !SO->_is_nil() && myHRow > 0 && myHRow <= nbRows && myVRow > 0 && myVRow <= nbRows ) {
+ if ( myHRow > 0 && myHRow <= nbRows && myVRow > 0 && myVRow <= nbRows ) {
if ( !theRestoring ) {
// look for component
SALOMEDS::SComponent_var SComponent = VISU::FindOrCreateVisuComponent( myStudy );
QString aComment;
aComment.sprintf("myComment=%s;myType=%d",GetComment(),VISU::TCURVE);
string anEntry = CreateAttributes( myStudy,
- myTable->GetEntry(),
- "",
- GetID(),
- GetName(),
- "",
- aComment.latin1(),
- true );
+ myTable->GetObjectEntry(),
+ "",
+ GetID(),
+ GetName(),
+ "",
+ aComment.latin1(),
+ true );
+ // create SObject referenced to real table object
+ mySObj = SALOMEDS::SObject::_duplicate(myStudy->FindObjectID(anEntry.c_str()));
}
return this;
}
CORBA::Boolean VISU::Curve_i::IsValid()
{
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+ SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string title;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+ SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string title;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+ SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string units;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+ SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
string units;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+ SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
{
theHorList = 0; theVerList = 0;
// getting table SObject by it's entry
- SALOMEDS::SObject_var SO = myStudy->FindObjectID( myTable->GetObjectEntry() );
+ SALOMEDS::SObject_var SO = myStudy->FindObjectID(myTable->GetObjectEntry());
SALOMEDS::StudyBuilder_var Builder = myStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeTableOfInteger_var anInt;
SALOMEDS::Color color = GetColor();
crv->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) );
crv->setAutoAssign( IsAuto() );
- crv->setIO(new SALOME_InteractiveObject(strdup(GetEntry()),"VISU",strdup(GetName())));
+ crv->setIO(new SALOME_InteractiveObject(strdup(mySObj->GetID()),"VISU",strdup(GetName())));
if ( myTable )
- crv->setTableIO(new SALOME_InteractiveObject(strdup(myTable->GetEntry()),"VISU",strdup(myTable->GetName())));
+ crv->setTableIO(new SALOME_InteractiveObject(strdup(myTable->GetObjectEntry()),"VISU",strdup(myTable->GetName())));
return crv;
}
/*!
Restores curve object from stream
*/
-VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap )
+VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO)
throw( std::logic_error& )
{
if(MYDEBUG) MESSAGE(GetComment());
- myName = (const char*)(VISU::Storable::FindValue(theMap,"myName"));
+ mySObj = SALOMEDS::SObject::_duplicate(theSO);
+ myName = VISU::Storable::FindValue(theMap,"myName").latin1();
myHRow = VISU::Storable::FindValue(theMap,"myHRow").toInt();
myVRow = VISU::Storable::FindValue(theMap,"myVRow").toInt();
myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
myMarker = ( VISU::Curve::MarkerType )( VISU::Storable::FindValue(theMap,"myMarker").toInt() );
myLine = ( VISU::Curve::LineType )( VISU::Storable::FindValue(theMap,"myLine").toInt() );
+ myLineWidth = VISU::Storable::FindValue(theMap,"myLineWidth").toInt();
+ myAuto = VISU::Storable::FindValue(theMap,"myAuto").toInt();
return Build( true );
}
/*!
*/
void VISU::Curve_i::ToStream( std::ostringstream& theStr )
{
- Storable::DataToStream( theStr, "TableID", GetTableID());
- Storable::DataToStream( theStr, "myName", myName.c_str() );
- Storable::DataToStream( theStr, "myHRow", myHRow );
- Storable::DataToStream( theStr, "myVRow", myVRow );
- Storable::DataToStream( theStr, "myColor.R", myColor.R );
- Storable::DataToStream( theStr, "myColor.G", myColor.G );
- Storable::DataToStream( theStr, "myColor.B", myColor.B );
- Storable::DataToStream( theStr, "myMarker", myMarker );
- Storable::DataToStream( theStr, "myLine", myLine );
+ Storable::DataToStream( theStr, "myName", myName.c_str() );
+ Storable::DataToStream( theStr, "myHRow", myHRow );
+ Storable::DataToStream( theStr, "myVRow", myVRow );
+ Storable::DataToStream( theStr, "myColor.R", myColor.R );
+ Storable::DataToStream( theStr, "myColor.G", myColor.G );
+ Storable::DataToStream( theStr, "myColor.B", myColor.B );
+ Storable::DataToStream( theStr, "myMarker", myMarker );
+ Storable::DataToStream( theStr, "myLine", myLine );
+ Storable::DataToStream( theStr, "myLineWidth", myLineWidth );
+ Storable::DataToStream( theStr, "myAuto", myAuto );
}
/*!
Gets reference table's entry
*/
const char* VISU::Curve_i::GetTableID() {
- return CORBA::string_dup(myTable->GetEntry());
+ return CORBA::string_dup(myTable->GetObjectEntry());
}
/*!
Called from engine to restore curve from the file
throw(std::logic_error&)
{
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
- VISU::Table_i* pTable = GetTable( aStudy, theMap );
+ VISU::Table_i* pTable = GetTable(aStudy, theSObject->GetFather());
if( pTable != NULL ) {
VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0 );
- return pResent->Restore( theMap );
+ return pResent->Restore( theMap, theSObject);
}
return NULL;
}
*/
const char* VISU::Container_i::GenerateName()
{
- return VISU::GenerateName( "Container", ++myNbPresent );
+ return VISU::GenerateName( "Plot2DView", ++myNbPresent );
}
/*!
Gets comment string
*/
VISU::Container_i::~Container_i()
{
+ INFOS("Container_i::~Container_i");
myCurves.clear();
}
/*!
*/
CORBA::Long VISU::Container_i::GetNbCurves()
{
+ Update();
return myCurves.count();
}
/*!
// if real Curve Object exists
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( anObject );
if( !CORBA::is_nil( aCurve ) )
- return dynamic_cast<VISU::Curve_i*>(VISU::GetServant( aCurve ) );
+ return dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurve).in());
}
}
return NULL;
throw( std::logic_error& )
{
if(MYDEBUG) MESSAGE(GetComment());
- myName = (const char*)(VISU::Storable::FindValue( theMap, "myName" ));
+ myName = VISU::Storable::FindValue( theMap, "myName" ).latin1();
QString val = VISU::Storable::FindValue( theMap, "myCurves" );
myCurves = QStringList::split( QString( "*" ), val, false );
return Build( true );
typedef vector<TRow> TRows;
-struct TTable2D{
+struct TTable2D {
string myTitle;
vector<string> myColumnUnits;
vector<string> myColumnTitles;
}
return aFileObject;
}
+
+template<class TTableAttr> bool ExportTableToFile(const TTableAttr& aTabAttr,
+ const char* theFileName)
+{
+ if (!CORBA::is_nil(aTabAttr)) {
+ QFile aFile(theFileName);
+ aFile.open(IO_WriteOnly);
+
+ /* extract the tabe info and write it into file */
+
+ QString aTitle(aTabAttr->GetTitle()); /*Table title*/
+ int aRowsNb = aTabAttr->GetNbRows();
+ int aColNb = aTabAttr->GetNbColumns();
+
+ SALOMEDS::StringSeq_var aRowTitles = aTabAttr->GetRowTitles();
+ QString anAbscissTitle(aRowTitles[0]); /*Absciss row title (X coord)*/
+ anAbscissTitle.stripWhiteSpace();
+
+ SALOMEDS::StringSeq_var aRowUnits = aTabAttr->GetRowUnits();
+ QString anAbscissUnit(aRowUnits[0]);
+ anAbscissUnit.stripWhiteSpace();
+
+ SALOMEDS::StringSeq_var aColumnTitles = aTabAttr->GetColumnTitles();
+ if (aRowsNb > 2 && aTitle.length() ) aTitle = aTitle + " - ";
+
+ QString aLine;
+ for (int i = 2; i <= aRowsNb; i++ )
+ {
+ /* TITLE */
+ QString anOrdinate(aRowTitles[i-1]), aTail;
+ anOrdinate.stripWhiteSpace();
+
+ aLine = "#TITLE: " + aTitle +
+ ((anOrdinate.length())? anOrdinate :
+ (aRowsNb>2)? aTail.sprintf("%d",i-1) : aTail.sprintf("") ) + "\n";
+ aFile.writeBlock(aLine, aLine.length() );
+
+ /* COLUMN_TITLES */
+ if ( anAbscissTitle.length() || anOrdinate.length() ) {
+ aLine = "#COLUMN_TITLES: " + anAbscissTitle + " | " + anOrdinate + "\n";
+ aFile.writeBlock(aLine, aLine.length() );
+ }
+
+ /* COLUMN_UNITS */
+ aLine = anAbscissUnit + " " +aRowUnits[i-1];
+ if (!aLine.stripWhiteSpace().isEmpty()) {
+ aLine = "#COLUMN_UNITS: " + aLine + "\n";
+ aFile.writeBlock(aLine, aLine.length() );
+ }
+
+ /* CURVE COORDINATES */
+ for (int j = 1; j <= aColNb; j++)
+ {
+ if ( aTabAttr -> HasValue(i,j) && aTabAttr -> HasValue(1, j)) {
+ aLine = aLine.sprintf("%.16g %.16g",
+ (double)(aTabAttr->GetValue(1,j)),
+ (double)(aTabAttr->GetValue(i,j))); /* aTabAttr->GetValue(1,j) - X coord */
+ if ( !aLine.stripWhiteSpace().isEmpty() ) {
+ QString aColTitle(aColumnTitles[j-1]);
+ if ( !aColTitle.stripWhiteSpace().isEmpty() )
+ aLine = aLine + " #TITLE: " + aColTitle ;
+ aFile.writeBlock(aLine + "\n", aLine.length() + 1);
+ }
+ }
+ }
+ aFile.writeBlock("\n", 1);
+ }
+ aFile.close();
+ return true;
+ }
+ return false;
+}
+
+bool VISU::ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName)
+{
+ //Find table
+ SALOMEDS::GenericAttribute_var anAttr ;
+ if (theTable->FindAttribute(anAttr, "AttributeTableOfReal"))
+ {
+ SALOMEDS::AttributeTableOfReal_var aTabAttr = SALOMEDS::AttributeTableOfReal ::_narrow(anAttr);
+ return ExportTableToFile ( aTabAttr , theFileName);
+
+ }
+ else if (theTable->FindAttribute(anAttr, "AttributeTableOfInteger")) {
+
+ SALOMEDS::AttributeTableOfInteger_var aTabAttr = SALOMEDS::AttributeTableOfInteger ::_narrow(anAttr);
+ return ExportTableToFile ( aTabAttr , theFileName);
+
+ }
+ return false;
+}
protected:
VISU::Table::Orientation myOrientation;
string myTitle;
- string myObjectEntry;
+ SALOMEDS::SObject_var mySObj;
public:
virtual Storable* Create();
- virtual Storable* Restore( const Storable::TRestoringMap& theMap )
+ virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO)
throw(std::logic_error&);
static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
const string& thePrefix, const Storable::TRestoringMap& theMap)
virtual const char* GenerateName();
virtual const char* GetTableTitle();
- virtual char* GetObjectEntry() { return CORBA::string_dup( myObjectEntry.c_str() ); }
+ virtual char* GetObjectEntry() { return CORBA::string_dup( mySObj->GetID() ); }
};
SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
-
+ bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
//==============================================================================
class Curve_i : public virtual POA_VISU::Curve,
public virtual PrsObject_i
int myLineWidth;
string myTitle;
bool myAuto;
+ SALOMEDS::SObject_var mySObj;
public:
virtual Storable* Create();
- virtual Storable* Restore( const Storable::TRestoringMap& theMap )
+ virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO)
throw(std::logic_error&);
static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
const string& thePrefix, const Storable::TRestoringMap& theMap)
myView = 0;
if(!CORBA::is_nil(theView3D)){
- VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D));
+ VISU::View3D_i* pView = dynamic_cast<VISU::View3D_i*>(GetServant(theView3D).in());
QAD_StudyFrame* aStudyFrame = pView->GetStudyFrame();
myView = VISU::GetViewFrame(aStudyFrame);
}
SALOMEDS::SObject_var aTimeStamp;
anIter->Next(); // First is reference on support
long i = 0;
- double aMin = 0, aMax = 0;
+ double aMin = VTK_LARGE_FLOAT, aMax = -VTK_LARGE_FLOAT;
for(;anIter->More();anIter->Next()) {
if (i == aData.myNbTimes) {
MESSAGE("There are extra timestamps in field");
if (aFixRange.compare("true") != 0) {
for (i = 0; i < aData.myNbFrames; i++)
aData.myPrs[i]->SetRange(aMin, aMax);
+ if(aData.myPrsType == VISU::TISOSURFACE)
+ for (i = 0; i < aData.myNbFrames; i++)
+ if(VISU::IsoSurfaces_i* aPrs = dynamic_cast<VISU::IsoSurfaces_i*>(aData.myPrs[i]))
+ aPrs->SetSubRange(aMin, aMax);
}
}
aData.myActors[myFrame]->VisibilityOn();
}
}
- myView->Repaint();
+ myView->Repaint(false);
if (isDumping) {
QPixmap px = QPixmap::grabWindow(myView->getViewWidget()->winId());
QString aFile(myDumpPath);
aSObj = aSObj->GetFather();
CORBA::Object_var anObject = VISU::SObjectToObject(aSObj);
if(CORBA::is_nil(anObject)) return NULL;
- return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject));
+ return dynamic_cast<VISU::Result_i*>(VISU::GetServant(anObject).in());
}
static int MYDEBUGWITHFILES = 0;
#endif
+static int INCMEMORY = 4+12;
+
int VISU::Vectors_i::IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration)
+ const char* theFieldName, int theIteration, int isMemoryCheck)
{
- return DeformedShape_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration);
+ bool aResult = false;
+ try{
+ aResult = DeformedShape_i::IsPossible(theResult,theMeshName,theEntity,theFieldName,theIteration,false);
+ if(isMemoryCheck && aResult){
+ float aSize = INCMEMORY*
+ theResult->GetInput()->GetTimeStampSize(theMeshName,(VISU::TEntity)theEntity,theFieldName,theIteration);
+ aResult = VISU_PipeLine::CheckAvailableMemory(aSize);
+ INFOS("Vectors_i::IsPossible - CheckAvailableMemory = "<<float(aSize)<<"; aResult = "<<aResult);
+ }
+ }catch(std::runtime_error& exc){
+ INFOS("Follow exception was accured :\n"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was accured!");
+ }
+ return aResult;
}
const char* VISU::Vectors_i::GetComment() const { return myComment.c_str();}
-VISU::Vectors_i::Vectors_i(Result_i* theResult, bool theAddToStudy) :
+VISU::Vectors_i::Vectors_i(Result_i* theResult, bool theAddToStudy, SALOMEDS::SObject_ptr theSObject) :
PrsObject_i(theResult->GetStudyDocument()),
- Prs3d_i(theResult),
- ScalarMap_i(theResult, theAddToStudy),
- DeformedShape_i(theResult, theAddToStudy)
+ Prs3d_i(theResult,theSObject),
+ ScalarMap_i(theResult,theAddToStudy,theSObject),
+ DeformedShape_i(theResult,theAddToStudy,theSObject)
{
myVectorsPL = NULL;
}
-void VISU::Vectors_i::Destroy(){
- DeformedShape_i::Destroy();
-}
-
-
void VISU::Vectors_i::SameAs(const VISU::Vectors_i* theOrigin) {
Vectors_i* aVectors = const_cast<Vectors_i*>(theOrigin);
VISU::DeformedShape_i::SameAs(theOrigin);
SetLineWidth(aVectors->GetLineWidth());
- //SetGlyphType(aVectors->GetGlyphType());
- //SetGlyphPos(aVectors->GetGlyphPos());
}
VISU::Storable* VISU::Vectors_i::Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&)
{
- DeformedShape_i::Restore(theMap);
-
+ DoHook();
SetGlyphType(VISU::Vectors::GlyphType(VISU::Storable::FindValue(theMap,"myTypeGlyph").toInt()));
SetGlyphPos(VISU::Vectors::GlyphPos(VISU::Storable::FindValue(theMap,"myPosGlyph").toInt()));
SetLineWidth(VISU::Storable::FindValue(theMap,"myLineWidth").toDouble());
- return Build(true);
+ return DeformedShape_i::Restore(theMap);
}
+
void VISU::Vectors_i::ToStream(std::ostringstream& theStr){
DeformedShape_i::ToStream(theStr);
Storable::DataToStream( theStr, "myLineWidth", GetLineWidth());
}
-VISU::Storable* VISU::Vectors_i::Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&)
-{
- VISU::Result_i* pResult = GetResult(theSObject);
- if(pResult != NULL){
- VISU::Vectors_i* pResent = new VISU::Vectors_i(pResult);
- return pResent->Restore(theMap);
- }
- return NULL;
-}
-
VISU::Vectors_i::~Vectors_i(){
if(MYDEBUG) MESSAGE("Vectors_i::~Vectors_i()");
}
-void VISU::Vectors_i::UpdateActor(VISU_Actor* theActor){
+void VISU::Vectors_i::UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&){
if(VISU_VectorsAct* anActor = dynamic_cast<VISU_VectorsAct*>(theActor)){
VISU::DeformedShape_i::UpdateActor(anActor);
anActor->GetProperty()->SetLineWidth(GetLineWidth());
Vectors_i();
Vectors_i(const Vectors_i&);
public:
- Vectors_i(Result_i* theResult, bool theAddToStudy = true);
+ Vectors_i(Result_i* theResult, bool theAddToStudy = true,
+ SALOMEDS::SObject_ptr theSObject = SALOMEDS::SObject::_nil());
virtual void SameAs(const Vectors_i* theOrigin);
virtual ~Vectors_i();
- virtual void Destroy();
virtual VISU::VISUType GetType() { return VISU::TVECTORS;};
public:
static int IsPossible(Result_i* theResult, const char* theMeshName, VISU::Entity theEntity,
- const char* theFieldName, int theIteration);
+ const char* theFieldName, int theIteration, int isMemoryCheck = true);
virtual Storable* Create(const char* theMeshName, VISU::Entity theEntity,
const char* theFieldName, int theIteration);
virtual Storable* Restore(const Storable::TRestoringMap& theMap)
throw(std::logic_error&);
- static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
- const string& thePrefix, const Storable::TRestoringMap& theMap)
- throw(std::logic_error&);
-
static const string myComment;
virtual const char* GetComment() const;
virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL)
throw (std::runtime_error&);
- virtual void UpdateActor(VISU_Actor* theActor);
+ virtual void UpdateActor(VISU_Actor* theActor) throw(std::runtime_error&);
};
}
#endif
anVISUActor = thePrs->CreateActor();
vf->AddActor(anVISUActor);
}catch(std::runtime_error& exc){
- INFOS("Null actor is created");
+ INFOS(exc.what());
return NULL;
}
}
if(!aStudy){
CORBA::String_var aName = theStudy->Name();
aFileInfo.setFile(aName.in());
- aStudy = aDesktop->loadStudy(aFileInfo.baseName());
+ if (aFileInfo.exists())
+ aStudy = aDesktop->loadStudy(aFileInfo.baseName());
+ else aStudy = aDesktop->loadStudy(aName.in());
if (!aStudy)
MESSAGE("ViewManager_i::ERROR: Can't load study");
}
CORBA::Object_var aView = VISU::View::_narrow(theView);
if(!CORBA::is_nil(aView)){
if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - VISU::View"<<(!CORBA::is_nil(aView)));
- VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(aView));
+ VISU::View_i* pView = dynamic_cast<VISU::View_i*>(VISU::GetServant(aView).in());
if(MYDEBUG) MESSAGE("ViewManager_i::Destroy - dynamic_cast"<<pView);
if(pView) {
pView->Close();
myStudy = aDesktop->findStudy(theStudy);
if(!myStudy){
aFileInfo.setFile(aName.in());
- myStudy = aDesktop->loadStudy(aFileInfo.baseName());
+ if ( aFileInfo.exists() )
+ myStudy = aDesktop->loadStudy(aFileInfo.baseName());
+ else myStudy = aDesktop->loadStudy(aName.in());
}
if(MYDEBUG) MESSAGE("View_i::View_i - isStudyOpened = "<<myStudy<<"; aName = "<<aName.in());
}
Mutex mt(myMutex,qApp,MYDELAY);
CORBA::Object_ptr anObj = thePrsObj;
// is it Curve ?
- if(Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+ if(Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(anObj).in())) {
UpdatePlot2d(myView,eDisplay,aCurve);
}
// is it Container ?
- if(Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+ if(Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(anObj).in())) {
int nbCurves = aContainer->GetNbCurves();
for ( int i = 1; i <= nbCurves; i++ ) {
VISU::Curve_i* aCurve = aContainer->GetCurve( i );
myView->Repaint();
}
// is it Table ?
- if(Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+ if(Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(anObj).in())) {
SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
if ( !TableSO->_is_nil() ) {
SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
if( !CORBA::is_nil( childObject ) ) {
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
if( !CORBA::is_nil( aCurve ) )
- UpdatePlot2d(myView,eDisplay,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+ UpdatePlot2d(myView,eDisplay,dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aCurve).in()));
}
}
myView->Repaint();
Mutex mt(myMutex,qApp,MYDELAY);
CORBA::Object_ptr anObj = thePrsObj;
// is it Curve ?
- if(Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+ if(Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(anObj).in())) {
UpdatePlot2d(myView,eErase,aCurve);
}
// is it Container ?
- if(Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+ if(Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(anObj).in())) {
int nbCurves = aContainer->GetNbCurves();
for ( int i = 1; i <= nbCurves; i++ ) {
VISU::Curve_i* aCurve = aContainer->GetCurve( i );
myView->Repaint();
}
// is it Table ?
- if(Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+ if(Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(anObj).in())) {
SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
if ( !TableSO->_is_nil() ) {
SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
if( !CORBA::is_nil( childObject ) ) {
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
if( !CORBA::is_nil( aCurve ) )
- UpdatePlot2d(myView,eErase,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+ UpdatePlot2d(myView,eErase,dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aCurve).in()));
}
}
myView->Repaint();
Mutex mt(myMutex,qApp,MYDELAY);
CORBA::Object_ptr anObj = thePrsObj;
// is it Curve ?
- if(Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(anObj))) {
+ if(Curve_i* aCurve = dynamic_cast<Curve_i*>(VISU::GetServant(anObj).in())) {
UpdatePlot2d(myView,eDisplayOnly,aCurve);
}
// is it Container ?
- if(Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(anObj))) {
+ if(Container_i* aContainer = dynamic_cast<Container_i*>(VISU::GetServant(anObj).in())) {
int nbCurves = aContainer->GetNbCurves();
for ( int i = 1; i <= nbCurves; i++ ) {
VISU::Curve_i* aCurve = aContainer->GetCurve( i );
myView->Repaint();
}
// is it Table ?
- if(Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(anObj))) {
+ if(Table_i* aTable = dynamic_cast<Table_i*>(VISU::GetServant(anObj).in())) {
SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() );
if ( !TableSO->_is_nil() ) {
SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO );
if( !CORBA::is_nil( childObject ) ) {
CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject );
if( !CORBA::is_nil( aCurve ) )
- UpdatePlot2d(myView,eDisplayOnly,dynamic_cast<VISU::Curve_i*>( VISU::GetServant( aCurve ) ));
+ UpdatePlot2d(myView,eDisplayOnly,dynamic_cast<VISU::Curve_i*>( VISU::GetServant(aCurve).in()));
}
}
myView->Repaint();
if(MYDEBUG) MESSAGE("TableView_i::Create - "<<(!theTable->_is_nil()));
Mutex mt(myMutex,qApp,MYDELAY);
if(!theTable->_is_nil()){
- VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable.in()));
+ VISU::Table_i* table = dynamic_cast<VISU::Table_i*>(VISU::GetServant(theTable.in()).in());
if(MYDEBUG) MESSAGE("TableView_i::Create - dynamic_cast = "<<table);
if(table != NULL) {
SALOMEDS::SObject_var aSObject = myStudy->getStudyDocument()->FindObjectID(table->GetObjectEntry());
aScaleFactor[1] = VISU::Storable::FindValue(theMap,"myScaleFactor[1]").toDouble();
aScaleFactor[2] = VISU::Storable::FindValue(theMap,"myScaleFactor[2]").toDouble();
- myStudyFrame->setTitle(myName.c_str());
+ //myStudyFrame->setTitle(myName.c_str());
SetBackground(aColor);
SetPointOfView(aPosition);
SetViewUp(aViewUp);
if(MYDEBUG) MESSAGE("View3D_i::Erase");
Mutex mt(myMutex,qApp,MYDELAY);
CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in()))
UpdateViewer(myStudyFrame,eErase,aPrs);
}
void View3D_i::Display(PrsObject_ptr thePrsObj) {
if(MYDEBUG) MESSAGE("View3D_i::Display");
Mutex mt(myMutex,qApp,MYDELAY);
CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in()))
UpdateViewer(myStudyFrame,eDisplay,aPrs);
}
void View3D_i::DisplayOnly(PrsObject_ptr thePrsObj) {
if(MYDEBUG) MESSAGE("View3D_i::DisplayOnly");
Mutex mt(myMutex,qApp,MYDELAY);
CORBA::Object_ptr anObj = thePrsObj;
- if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj)))
+ if(Prs3d_i* aPrs = dynamic_cast<Prs3d_i*>(VISU::GetServant(anObj).in()))
UpdateViewer(myStudyFrame,eDisplayOnly,aPrs);
}