mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-14 09:38:33 +05:00
Implementation of the Point 2 of the 20948: EDF 1468 SMESH: Histogram of the quality controls.
This commit is contained in:
parent
9ae572587c
commit
18e0bef9d9
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.4 KiB |
@ -64,8 +64,9 @@ To manage the quality controls call pop-up in the VTK viewer and select "Control
|
||||
<li> <b>Face Controls</b> provides access to the face quality controls;</li>
|
||||
<li> <b>Volume Controls</b> provides access to the volume quality controls;</li>
|
||||
<li> <b>Scalar Bar Properties</b> allows setting \subpage scalar_bar_dlg;</li>
|
||||
<li> <b>Export Distribution...</b> allows saving the distribution of quality control values in the text file;</li>
|
||||
<li> <b>Show Distribution</b> Shows/Hides the distribution histogram of the quality control values in the VTK Viewer.</li>
|
||||
<li> <b>Distribution -> Export ...</b> allows saving the distribution of quality control values in the text file;</li>
|
||||
<li> <b>Distribution -> Show </b> Shows/Hides the distribution histogram of the quality control values in the VTK Viewer.</li>
|
||||
<li> <b>Distribution -> Plot </b> Plots the distribution histogram of the quality control values in the Plot 2D Viewer.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
||||
<parameter name="scalar_bar_vertical_y" value="0.1" />
|
||||
<parameter name="distribution_visibility" value="false" />
|
||||
<parameter name="distribution_coloring_type" value="0" />
|
||||
<parameter name="distribution_color" value="255, 255, 255" />
|
||||
<parameter name="distribution_color" value="0, 85, 0" />
|
||||
<parameter name="DisplayMode" value="true" />
|
||||
<parameter name="auto_update" value="true" />
|
||||
<parameter name="update_limit" value="500000" />
|
||||
|
@ -55,6 +55,7 @@ libSMESHObject_la_CPPFLAGS = \
|
||||
$(KERNEL_CXXFLAGS) \
|
||||
$(GUI_CXXFLAGS) \
|
||||
$(MED_CXXFLAGS) \
|
||||
$(QWT_INCLUDES) \
|
||||
$(GEOM_CXXFLAGS) \
|
||||
$(CAS_CPPFLAGS) \
|
||||
$(VTK_INCLUDES) \
|
||||
|
@ -40,6 +40,10 @@
|
||||
#include "SUIT_Session.h"
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
#include <SPlot2d_Histogram.h>
|
||||
#endif
|
||||
|
||||
#include <vtkProperty.h>
|
||||
#include <vtkTimeStamp.h>
|
||||
#include <vtkObjectFactory.h>
|
||||
@ -517,6 +521,11 @@ SMESH_ActorDef::SMESH_ActorDef()
|
||||
myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
|
||||
SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
|
||||
myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]);
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
my2dHistogram = 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -608,6 +617,10 @@ SMESH_ActorDef::~SMESH_ActorDef()
|
||||
myImplicitBoolean->Delete();
|
||||
|
||||
myTimeStamp->Delete();
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
if(my2dHistogram)
|
||||
delete my2dHistogram;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2097,3 +2110,57 @@ void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMa
|
||||
myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
|
||||
myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
|
||||
|
||||
if(my2dHistogram)
|
||||
my2dHistogram->clearAllPoints();
|
||||
|
||||
if(SMESH::Controls::NumericalFunctor* fun =
|
||||
dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
|
||||
{
|
||||
|
||||
if(!my2dHistogram) {
|
||||
my2dHistogram = new SPlot2d_Histogram();
|
||||
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(getIO()->getEntry(),"SMESH",getName());
|
||||
my2dHistogram->setIO(anIO);
|
||||
}
|
||||
|
||||
int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
|
||||
std::vector<int> nbEvents;
|
||||
std::vector<double> funValues;
|
||||
SMESH_VisualObjDef::TEntityList elems;
|
||||
if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
|
||||
dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
|
||||
std::vector<int> elemIds;
|
||||
|
||||
for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
|
||||
elemIds.push_back( (*e)->GetID());
|
||||
|
||||
vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
|
||||
double * range = lookupTable->GetRange();
|
||||
fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range);
|
||||
|
||||
for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
|
||||
my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
|
||||
|
||||
if(funValues.size() >= 2)
|
||||
my2dHistogram->setWidth((funValues[1] - funValues[0]) * 0.8) ;
|
||||
|
||||
}
|
||||
|
||||
//Color of the histogram
|
||||
if(myScalarBarActor->GetDistributionColoringType() == SMESH_MULTICOLOR_TYPE)
|
||||
my2dHistogram->setAutoAssign(true);
|
||||
else {
|
||||
double rgb[3];
|
||||
myScalarBarActor->GetDistributionColor(rgb);
|
||||
QColor aColor = QColor( (int)( rgb[0]*255 ), (int)( rgb[1]*255 ), (int)( rgb[2]*255 ) );
|
||||
my2dHistogram->setColor(aColor);
|
||||
|
||||
}
|
||||
|
||||
return my2dHistogram;
|
||||
}
|
||||
#endif
|
||||
|
@ -40,6 +40,10 @@ class SMESH_ScalarBarActor;
|
||||
class vtkPlane;
|
||||
class vtkImplicitBoolean;
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
class SPlot2d_Histogram;
|
||||
#endif
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
const vtkIdType DeleteActorEvent = vtkCommand::UserEvent + 100;
|
||||
@ -143,6 +147,11 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
|
||||
|
||||
virtual void UpdateScalarBar() = 0;
|
||||
virtual void UpdateDistribution() = 0;
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
virtual SPlot2d_Histogram* GetPlot2Histogram() = 0;
|
||||
virtual SPlot2d_Histogram* UpdatePlot2Histogram() = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -74,6 +74,10 @@ class VTKViewer_CellCenters;
|
||||
class SMESH_DeviceActor;
|
||||
class SMESH_ScalarBarActor;
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
class SPlot2d_Histogram;
|
||||
#endif
|
||||
|
||||
|
||||
class SMESH_ActorDef : public SMESH_Actor
|
||||
{
|
||||
@ -198,6 +202,11 @@ class SMESH_ActorDef : public SMESH_Actor
|
||||
virtual void UpdateScalarBar();
|
||||
virtual void UpdateDistribution();
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
virtual SPlot2d_Histogram* GetPlot2Histogram() { return my2dHistogram; }
|
||||
virtual SPlot2d_Histogram* UpdatePlot2Histogram();
|
||||
#endif
|
||||
|
||||
|
||||
virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation);
|
||||
virtual EQuadratic2DRepresentation GetQuadratic2DRepresentation();
|
||||
@ -279,6 +288,10 @@ class SMESH_ActorDef : public SMESH_Actor
|
||||
TCippingPlaneCont myCippingPlaneCont;
|
||||
long myControlsPrecision;
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
SPlot2d_Histogram* my2dHistogram;
|
||||
#endif
|
||||
|
||||
bool myIsFacesOriented;
|
||||
|
||||
VTK::MarkerTexture myMarkerTexture;
|
||||
|
@ -241,6 +241,7 @@ libSMESH_la_CPPFLAGS = \
|
||||
$(PYTHON_INCLUDES) \
|
||||
$(KERNEL_CXXFLAGS) \
|
||||
$(GUI_CXXFLAGS) \
|
||||
$(QWT_INCLUDES) \
|
||||
$(GEOM_CXXFLAGS) \
|
||||
$(MED_CXXFLAGS) \
|
||||
$(BOOST_CPPFLAGS) \
|
||||
|
@ -123,6 +123,11 @@
|
||||
#include <SALOME_ListIO.hxx>
|
||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
#include <SPlot2d_ViewModel.h>
|
||||
#include <SPlot2d_Histogram.h>
|
||||
#endif
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
|
||||
@ -861,6 +866,52 @@
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
void PlotDistribution() {
|
||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||
if( !app )
|
||||
return;
|
||||
|
||||
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
|
||||
SALOME_ListIO selected;
|
||||
if ( aSel )
|
||||
aSel->selectedObjects( selected );
|
||||
|
||||
if ( selected.Extent() == 1 ) {
|
||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||
if ( anIO->hasEntry() ) {
|
||||
//Find Actor by entry before getting Plot2d viewer,
|
||||
//because after call getViewManager( Plot2d_Viewer::Type(), true ) active window is Plot2d Viewer
|
||||
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
||||
|
||||
SUIT_ViewManager* aViewManager = app->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary
|
||||
|
||||
if( !aViewManager )
|
||||
return;
|
||||
|
||||
SPlot2d_Viewer* aView = dynamic_cast<SPlot2d_Viewer*>(aViewManager->getViewModel());
|
||||
if ( !aView )
|
||||
return;
|
||||
|
||||
Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
|
||||
if ( !aPlot )
|
||||
return;
|
||||
|
||||
if ( anActor && anActor->GetControlMode() != SMESH_Actor::eNone ) {
|
||||
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
|
||||
QString functorName = functorToString( anActor->GetFunctor());
|
||||
QString aHistogramName("%1 : %2");
|
||||
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
|
||||
aHistogram->setName(aHistogramName);
|
||||
aHistogram->setHorTitle(functorName);
|
||||
aHistogram->setVerTitle(QObject::tr("DISTRIBUTION_NB_ENT"));
|
||||
aPlot->displayObject(aHistogram, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //DISABLE_PLOT2DVIEWER
|
||||
|
||||
void DisableAutoColor(){
|
||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
SALOME_ListIO selected;
|
||||
@ -1220,6 +1271,17 @@
|
||||
anActor->SetControlMode(aControl);
|
||||
anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
|
||||
SMESH::RepaintCurrentView();
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
if(anActor->GetPlot2Histogram()) {
|
||||
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
|
||||
QString functorName = functorToString( anActor->GetFunctor());
|
||||
QString aHistogramName("%1 : %2");
|
||||
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
|
||||
aHistogram->setName(aHistogramName);
|
||||
aHistogram->setHorTitle(functorName);
|
||||
SMESH::ProcessIn2DViewers(anActor);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1849,6 +1911,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
if( anIO->hasEntry() ) {
|
||||
if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
|
||||
anActor->SetControlMode( SMESH_Actor::eNone );
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
SMESH::ProcessIn2DViewers(anActor,SMESH::RemoveFrom2dViewer);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1859,20 +1924,29 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( this );
|
||||
break;
|
||||
}
|
||||
case 202:
|
||||
case 2021:
|
||||
{
|
||||
// dump control distribution data to the text file
|
||||
::SaveDistribution();
|
||||
break;
|
||||
}
|
||||
|
||||
case 203:
|
||||
case 2022:
|
||||
{
|
||||
// show/ distribution
|
||||
::ShowDistribution();
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
case 2023:
|
||||
{
|
||||
// plot distribution
|
||||
::PlotDistribution();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Auto-color
|
||||
case 1136:
|
||||
::AutoColor();
|
||||
@ -3319,8 +3393,11 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
createSMESHAction( 419, "SPLIT_TO_TETRA", "ICON_SPLIT_TO_TETRA" );
|
||||
createSMESHAction( 200, "RESET" );
|
||||
createSMESHAction( 201, "SCALAR_BAR_PROP" );
|
||||
createSMESHAction( 202, "SAVE_DISTRIBUTION" );
|
||||
createSMESHAction( 203, "SHOW_DISTRIBUTION","",0, true );
|
||||
createSMESHAction( 2021, "SAVE_DISTRIBUTION" );
|
||||
createSMESHAction( 2022, "SHOW_DISTRIBUTION","",0, true );
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
createSMESHAction( 2023, "PLOT_DISTRIBUTION" );
|
||||
#endif
|
||||
createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
|
||||
createSMESHAction( 212, "SHADE", "ICON_SHADE", 0, true );
|
||||
createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
|
||||
@ -3947,19 +4024,24 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
|
||||
popupMgr()->insert( separator(), anId, -1 );
|
||||
|
||||
popupMgr()->insert( action( 202 ), anId, -1 ); // SAVE_DISTRIBUTION
|
||||
popupMgr()->setRule( action( 202 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
|
||||
aSubId = popupMgr()->insert( tr( "MEN_DISTRIBUTION_CTRL" ), anId, -1 ); // NODE CONTROLS
|
||||
|
||||
popupMgr()->insert( action( 203 ), anId, -1 ); // SHOW_DISTRIBUTION
|
||||
popupMgr()->setRule( action( 203 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
|
||||
popupMgr()->setRule( action( 203 ), aMeshInVTK + "&& isNumFunctor && isDistributionVisible", QtxPopupMgr::ToggleRule);
|
||||
popupMgr()->insert( action( 2021 ), aSubId, -1 ); // SAVE_DISTRIBUTION
|
||||
popupMgr()->setRule( action( 2021 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
|
||||
|
||||
popupMgr()->insert( action( 2022 ), aSubId, -1 ); // SHOW_DISTRIBUTION
|
||||
popupMgr()->setRule( action( 2022 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
|
||||
popupMgr()->setRule( action( 2022 ), aMeshInVTK + "&& isNumFunctor && isDistributionVisible", QtxPopupMgr::ToggleRule);
|
||||
|
||||
popupMgr()->insert( separator(), -1, -1 );
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
popupMgr()->insert( action( 2023 ), aSubId, -1 ); // PLOT_DISTRIBUTION
|
||||
popupMgr()->setRule( action( 2023 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------
|
||||
// Display / Erase
|
||||
//-------------------------------------------------
|
||||
popupMgr()->insert( separator(), -1, -1 );
|
||||
QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
|
||||
aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
|
||||
popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
|
||||
|
@ -410,11 +410,12 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
|
||||
|
||||
int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
|
||||
if( coloringType == SMESH_MONOCOLOR_TYPE ) {
|
||||
myDMonoColor->setChecked(true);
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
|
||||
} else {
|
||||
myDMultiColor->setChecked(true);
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMultiColor));
|
||||
} else {
|
||||
myDMonoColor->setChecked(true);
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
|
||||
|
||||
}
|
||||
|
||||
QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
|
||||
@ -435,6 +436,7 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*
|
||||
connect( myXSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
|
||||
connect( myYSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) );
|
||||
connect( aOrientationGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( onOrientationChanged() ) );
|
||||
connect( myDistributionGrp, SIGNAL( toggled(bool) ), this, SLOT(onDistributionActivated(bool)) );
|
||||
connect( myDistribColorGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( onDistributionChanged( int ) ) );
|
||||
connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
|
||||
connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) );
|
||||
@ -520,17 +522,24 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
|
||||
myScalarBarActor->SetHeight( myHeightSpin->value() );
|
||||
|
||||
// Distribution
|
||||
bool distributionTypeChanged = false, colorChanged=false;
|
||||
myScalarBarActor->SetDistributionVisibility((int)myDistributionGrp->isChecked());
|
||||
if( myDistributionGrp->isChecked() ) {
|
||||
int ColoringType = myDMultiColor->isChecked() ? SMESH_MULTICOLOR_TYPE : SMESH_MONOCOLOR_TYPE;
|
||||
myScalarBarActor->SetDistributionColoringType(ColoringType);
|
||||
distributionTypeChanged = (ColoringType != myScalarBarActor->GetDistributionColoringType());
|
||||
if(distributionTypeChanged)
|
||||
myScalarBarActor->SetDistributionColoringType(ColoringType);
|
||||
|
||||
if( !myDMultiColor->isChecked() ) {
|
||||
QColor aTColor = myMonoColorBtn->color();
|
||||
double rgb[3];
|
||||
double rgb[3], oldRgb[3];;
|
||||
rgb [0] = aTColor.red()/255.;
|
||||
rgb [1] = aTColor.green()/255.;
|
||||
rgb [2] = aTColor.blue()/255.;
|
||||
myScalarBarActor->SetDistributionColor(rgb);
|
||||
myScalarBarActor->GetDistributionColor(oldRgb);
|
||||
colorChanged = (rgb[0] != oldRgb[0] || rgb[1] != oldRgb[1] || rgb[2] != oldRgb[2]);
|
||||
if(colorChanged)
|
||||
myScalarBarActor->SetDistributionColor(rgb);
|
||||
}
|
||||
}
|
||||
|
||||
@ -553,6 +562,17 @@ bool SMESHGUI_Preferences_ScalarBarDlg::onApply()
|
||||
|
||||
if( nbColorsChanged || rangeChanges)
|
||||
myActor->UpdateDistribution();
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
if( myActor->GetPlot2Histogram() &&
|
||||
(nbColorsChanged ||
|
||||
rangeChanges ||
|
||||
distributionTypeChanged ||
|
||||
colorChanged ))
|
||||
SMESH::ProcessIn2DViewers(myActor);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
SMESH::RepaintCurrentView();
|
||||
return true;
|
||||
@ -656,17 +676,20 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
|
||||
myIniH = myScalarBarActor->GetHeight();
|
||||
setOriginAndSize( myIniX, myIniY, myIniW, myIniH );
|
||||
|
||||
myDistributionGrp->setChecked((bool)myScalarBarActor->GetDistributionVisibility());
|
||||
int coloringType = myScalarBarActor->GetDistributionColoringType();
|
||||
myScalarBarActor->GetDistributionColor( aTColor );
|
||||
myMonoColorBtn->setColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) );
|
||||
if ( coloringType == SMESH_MONOCOLOR_TYPE ) {
|
||||
myDMonoColor->setChecked(true);
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMonoColor));
|
||||
} else {
|
||||
myDMultiColor->setChecked(true);
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMultiColor));
|
||||
}
|
||||
myDistributionGrp->setChecked((bool)myScalarBarActor->GetDistributionVisibility());
|
||||
onDistributionActivated(myScalarBarActor->GetDistributionVisibility());
|
||||
|
||||
|
||||
myRangeGrp->setEnabled( true );
|
||||
myFontGrp->setEnabled( true );
|
||||
myLabColorGrp->setEnabled( true );
|
||||
@ -674,6 +697,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
|
||||
myOriginDimGrp->setEnabled( true );
|
||||
myOkBtn->setEnabled( true );
|
||||
myApplyBtn->setEnabled( true );
|
||||
myDistributionGrp->setEnabled( true );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -686,6 +710,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
|
||||
myOriginDimGrp->setEnabled( false );
|
||||
myOkBtn->setEnabled( false );
|
||||
myApplyBtn->setEnabled( false );
|
||||
myDistributionGrp->setEnabled( false );
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
@ -746,9 +771,32 @@ void SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize( const double x,
|
||||
*/
|
||||
//=================================================================================================
|
||||
void SMESHGUI_Preferences_ScalarBarDlg::onDistributionChanged( int id ) {
|
||||
myMonoColorBtn->setEnabled(myDistribColorGrp->id(myDMonoColor) == id);
|
||||
myDistributionColorLbl->setEnabled(myDistribColorGrp->id(myDMonoColor) == id);
|
||||
|
||||
bool isActive = myDistribColorGrp->id(myDMonoColor) == id;
|
||||
|
||||
myMonoColorBtn->setEnabled(isActive);
|
||||
myDistributionColorLbl->setEnabled(isActive);
|
||||
}
|
||||
//=================================================================================================
|
||||
/*!
|
||||
* SMESHGUI_Preferences_ScalarBarDlg::onDistributionActivated
|
||||
*
|
||||
* Called when distribution group check box is changed
|
||||
*/
|
||||
//=================================================================================================
|
||||
void SMESHGUI_Preferences_ScalarBarDlg::onDistributionActivated(bool on) {
|
||||
if(on) {
|
||||
if(myDMonoColor->isChecked())
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMonoColor) );
|
||||
else if(myDMultiColor->isChecked())
|
||||
onDistributionChanged(myDistribColorGrp->id(myDMultiColor) );
|
||||
}
|
||||
else {
|
||||
myMonoColorBtn->setEnabled(false);
|
||||
myDistributionColorLbl->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
/*!
|
||||
|
@ -80,6 +80,7 @@ protected slots:
|
||||
void onXYChanged();
|
||||
void onOrientationChanged();
|
||||
void onDistributionChanged( int );
|
||||
void onDistributionActivated( bool );
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_Filter.h"
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_ActorUtils.h>
|
||||
@ -56,6 +57,12 @@
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_Study.h>
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
#include <SPlot2d_ViewModel.h>
|
||||
#include <SPlot2d_Histogram.h>
|
||||
#include <Plot2d_ViewManager.h>
|
||||
#endif
|
||||
|
||||
// SALOME KERNEL includes
|
||||
#include <utilities.h>
|
||||
|
||||
@ -652,6 +659,9 @@ namespace SMESH
|
||||
VISUAL_OBJ_CONT.erase(aKey);
|
||||
}
|
||||
}
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
ProcessIn2DViewers(theActor,RemoveFrom2dViewer);
|
||||
#endif
|
||||
theActor->Delete();
|
||||
vtkWnd->Repaint();
|
||||
}
|
||||
@ -1303,4 +1313,44 @@ namespace SMESH
|
||||
DistanceToPosition( theBounds, theNormal, theDist, theOrigin );
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
//=======================================================================
|
||||
/**
|
||||
Get histogram from the input actor
|
||||
Repaint/Remove the histogram in/from each opened Plot2D Viewer
|
||||
*/
|
||||
//=======================================================================
|
||||
void ProcessIn2DViewers( SMESH_Actor *theActor, Viewer2dActionType aType ) {
|
||||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
|
||||
|
||||
if(!anApp || !theActor)
|
||||
return;
|
||||
|
||||
SPlot2d_Histogram* aHistogram = 0;
|
||||
if(theActor->GetPlot2Histogram())
|
||||
aHistogram = theActor->UpdatePlot2Histogram();
|
||||
else
|
||||
return;
|
||||
|
||||
ViewManagerList aViewManagerList;
|
||||
anApp->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
|
||||
|
||||
aType = aHistogram->getPointList().empty() ? RemoveFrom2dViewer : aType;
|
||||
|
||||
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()) {
|
||||
if(aType == UpdateIn2dViewer )
|
||||
aViewFrame->displayObject(aHistogram, true);
|
||||
else if (aType == RemoveFrom2dViewer)
|
||||
aViewFrame->eraseObject(aHistogram, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //DISABLE_PLOT2DVIEWER
|
||||
} // end of namespace SMESH
|
||||
|
@ -40,6 +40,11 @@
|
||||
#include <SALOME_InteractiveObject.hxx>
|
||||
#include <VTKViewer_Filter.h>
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
class SPlot2d_Histogram;
|
||||
#endif
|
||||
|
||||
|
||||
class TColStd_IndexedMapOfInteger;
|
||||
|
||||
class SALOMEDSClient_Study;
|
||||
@ -198,6 +203,16 @@ SMESHGUI_EXPORT
|
||||
vtkFloatingPointType theDist,
|
||||
vtkFloatingPointType theBounds[6],
|
||||
vtkFloatingPointType theOrigin[3] );
|
||||
|
||||
#ifndef DISABLE_PLOT2DVIEWER
|
||||
|
||||
typedef enum {UpdateIn2dViewer = 0, RemoveFrom2dViewer } Viewer2dActionType;
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
void ProcessIn2DViewers( SMESH_Actor* theActor, Viewer2dActionType = UpdateIn2dViewer );
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_VTKUTILS_H
|
||||
|
@ -654,14 +654,26 @@
|
||||
<message>
|
||||
<source>MEN_RESET</source>
|
||||
<translation>Reset</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_DISTRIBUTION_CTRL</source>
|
||||
<translation>Distribution</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SAVE_DISTRIBUTION</source>
|
||||
<translation>Export Distribution...</translation>
|
||||
<translation>Export ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_SHOW_DISTRIBUTION</source>
|
||||
<translation>Show Distribution</translation>
|
||||
<translation>Show</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_PLOT_DISTRIBUTION</source>
|
||||
<translation>Plot</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DISTRIBUTION_NB_ENT</source>
|
||||
<translation>Number of entities</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_REVOLUTION</source>
|
||||
|
Loading…
Reference in New Issue
Block a user