NODE, /*!< Node corresponds to a geometrical point. */
EDGE, /*!< Edge corresponds to a geometrical line connecting two points. */
FACE, /*!< Face corresponds to a geometrical plane bounded by several lines. */
- CELL, /*!< Cell is a volumic element of a mesh */
+ CELL, /*!< Cell is a volumic element of a mesh */
NONE /*!< Indicates undefined entity value */
};
MS_70
};
+ /*!
+ * Tables' sort order
+ */
+ enum SortOrder {
+ AscendingOrder, /*!< The table items are sorted ascending */
+ DescendingOrder /*!< The table items are sorted descending */
+ };
+
+ /*!
+ * Tables' sort policy (specifies how empty cells are taken into account when sorting)
+ */
+ enum SortPolicy {
+ EmptyLowest, /*!< Empty cells are considered as lowest values */
+ EmptyHighest, /*!< Empty cells are considered as highest values */
+ EmptyFirst, /*!< Empty cells are always first */
+ EmptyLast, /*!< Empty cells are always last */
+ EmptyIgnore /*!< Empty cells are ignored (stay at initial positions) */
+ };
+
/*!
* This enumeration contains a set of elements defining the type of the %VISU object.
* This enumeration is used for navigation between a set of %VISU interfaces.
* \return Long value corresponding to the number of columns of the table
*/
long GetNbColumns();
+
+ /*!
+ * Sorts the specified row of the table.
+ * \param theRow Index of the row to sort
+ * \param theSortOrder Sort order (see <VAR>SortOrder</VAR> enumeration)
+ * \param theSortPolicy Sort policy (see <VAR>SortPolicy</VAR> enumeration)
+ */
+ void SortRow(in long theRow, in SortOrder theSortOrder, in SortPolicy theSortPolicy);
+
+ /*!
+ * Sorts the specified column of the table.
+ * \param theRow Index of the column to sort
+ * \param theSortOrder Sort order (see <VAR>SortOrder</VAR> enumeration)
+ * \param theSortPolicy Sort policy (see <VAR>SortPolicy</VAR> enumeration)
+ */
+ void SortColumn(in long theColumn, in SortOrder theSortOrder, in SortPolicy theSortPolicy);
+
+ /*!
+ * Sorts the table by the specified row.
+ * \param theRow Index of the row, by which the table has to be sort
+ * \param theSortOrder Sort order (see <VAR>SortOrder</VAR> enumeration)
+ * \param theSortPolicy Sort policy (see <VAR>SortPolicy</VAR> enumeration)
+ */
+ void SortByRow(in long theRow, in SortOrder theSortOrder, in SortPolicy theSortPolicy);
+
+ /*!
+ * Sorts the table by the specified column.
+ * \param theColumn Index of the column, by which the table has to be sort
+ * \param theSortOrder Sort order (see <VAR>SortOrder</VAR> enumeration)
+ * \param theSortPolicy Sort policy (see <VAR>SortPolicy</VAR> enumeration)
+ */
+ void SortByColumn(in long theColumn, in SortOrder theSortOrder, in SortPolicy theSortPolicy);
};
//-------------------------------------------------------
return myOrientation;
}
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::SortRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy)
+{
+ SALOMEDS::SObject_var SO = mySObj;
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ if ( !SO->_is_nil() ) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+ SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+ anInt->SortRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+ SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+ aReal->SortRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ UpdateCurves();
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::SortColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy)
+{
+ SALOMEDS::SObject_var SO = mySObj;
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ if ( !SO->_is_nil() ) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+ SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+ anInt->SortColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+ SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+ aReal->SortColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ UpdateCurves();
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy)
+{
+ SALOMEDS::SObject_var SO = mySObj;
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ if ( !SO->_is_nil() ) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+ SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+ anInt->SortByRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+ SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+ aReal->SortByRow( theRow, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ UpdateCurves();
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy)
+{
+ SALOMEDS::SObject_var SO = mySObj;
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ if ( !SO->_is_nil() ) {
+ SALOMEDS::GenericAttribute_var anAttr;
+ if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+ SALOMEDS::AttributeTableOfInteger_var anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+ anInt->SortByColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+ SALOMEDS::AttributeTableOfReal_var aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+ aReal->SortByColumn( theColumn, (SALOMEDS::AttributeTable::SortOrder)theSortOrder,
+ (SALOMEDS::AttributeTable::SortPolicy)theSortPolicy );
+ }
+ UpdateCurves();
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::UpdateCurves()
+{
+ SALOMEDS::SObject_var SO = mySObj;
+ SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+ SALOMEDS::ChildIterator_var CI = GetStudyDocument()->NewChildIterator( SO );
+ for ( CI->InitEx( true ); CI->More(); CI->Next() ) {
+ CORBA::Object_var anObj = SObjectToObject( CI->Value() );
+ VISU::Curve_var aCurve = VISU::Curve::_narrow( anObj );
+ if ( !aCurve->_is_nil() )
+ if( VISU::Curve_i* pCurve = dynamic_cast<VISU::Curve_i*>( GetServant( aCurve ).in() ) )
+ UpdatePlot2d( NULL, eDisplay, pCurve ); // first parameter is null to update curves in all views
+ }
+}
+
//----------------------------------------------------------------------------
SALOMEDS::SObject_var
VISU::Table_i
virtual CORBA::Long GetNbRows();
virtual CORBA::Long GetNbColumns();
+ virtual void SortRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
+ virtual void SortColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
+ virtual void SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
+ virtual void SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
+
virtual void RemoveFromStudy();
protected:
Storable* Build(int theRestoring);
+ void UpdateCurves();
protected:
VISU::Table::Orientation myOrientation;
#include "SVTK_ViewModel.h"
#include "VTKViewer_Algorithm.h"
#include "SPlot2d_Curve.h"
+#include "SPlot2d_ViewModel.h"
#include "Plot2d_ViewFrame.h"
#include "Plot2d_ViewWindow.h"
#include "Plot2d_ViewModel.h"
+#include "Plot2d_ViewManager.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
return anVISUActor;
}
+ struct TUpdatePlot2dEvent: public SALOME_Event
+ {
+ int myDisplaying;
+ Curve_i* myCurve;
+
+ TUpdatePlot2dEvent (const int theDisplaying, Curve_i* theCurve):
+ myDisplaying(theDisplaying),
+ myCurve(theCurve)
+ {}
+
+ virtual void Execute()
+ {
+ SalomeApp_Application* anApp = NULL;
+ CORBA::String_var studyName = myCurve->GetStudyDocument()->Name();
+ std::string aStudyName = studyName.in();
+ SUIT_Session* aSession = SUIT_Session::session();
+ QList<SUIT_Application*> anApplications = aSession->applications();
+ QList<SUIT_Application*>::Iterator anIter = anApplications.begin();
+ while (anIter != anApplications.end()) {
+ SUIT_Application* aSUITApp = *anIter;
+ if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
+ if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ if (aStudyName == aCStudy->Name()) {
+ anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
+ break;
+ }
+ }
+ }
+ }
+ anIter++;
+ }
+ if (!anApp)
+ return;
+
+ ViewManagerList aViewManagerList;
+ anApp->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
+ SUIT_ViewManager* aViewManager;
+ foreach( aViewManager, aViewManagerList ) {
+ if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
+ if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel())) {
+ if (Plot2d_ViewFrame* aViewFrame = aViewer->getActiveViewFrame()) {
+ UpdatePlot2d(aViewFrame, myDisplaying, myCurve);
+ }
+ }
+ }
+ }
+ }
+ };
+
void UpdatePlot2d (Plot2d_ViewFrame *theView,int theDisplaying, Curve_i* theCurve)
{
if(MYDEBUG) MESSAGE("UpdatePlot2d - theDisplaying = " << theDisplaying);
- if (!theView)
+ if (!theView) {
+ // update all views
+ ProcessVoidEvent(new TUpdatePlot2dEvent(theDisplaying, theCurve));
return;
+ }
QList<Plot2d_Curve*> clist;
theView->getCurves(clist);
if (theDisplaying == eEraseAll) {