<li>\subpage plot_3d_page</li>
<li>\subpage gauss_points_presentations_page</li>
</ul>
+Over the Field presentation of any type you can display field values
+as \subpage values_labeling_page "text labels".
<br><em>To create a field presentation (\ref fields_anchor "see also"):</em>
\par
The new field presentation will be located in the time stamp subfolder in the Object Browser and displayed
-*/
\ No newline at end of file
+*/
\n The Python interface of \b Post-Pro module is described in \subpage idl_interface_page "Access to Post-Pro module functionality" page.
-*/
\ No newline at end of file
+*/
<li><b>Origin:</b> you can enter X & Y coordinates of the origin of
the scalar bar.</li>
<li><b>Dimensions:</b> you can enter \b Width and \b Height of the
-scalar bar.</li>
+scalar bar specified in % of the size of view.</li>
<li><b>Text properties</b> button allows you to define from the
following dialog box:
\image html barproperty.png
<ul>
-<li>Relative \b width and \b height of \b Title (in percents),</li>
-<li>Relative \b width and \b height of \b Labels (in percents),</li>
-<li>Relative \b width and \b height of \b Bar (in percents),</li>
+<li>Relative \b size of \b Title (in percents of the width of scalar bar widget),</li>
+<li>Relative \b size of \b Labels (in percents of the width of scalar bar widget),</li>
+<li>Relative \b width and \b height of \b Bar (in percents of the width and height of scalar bar widget),</li>
<li>Visibility of \b Units in \b Title,</li>
-<li>Format of \b Labels.</li>
+<li>Precision of \b Labels which specifies the number of characters to be printed, the number of decimal places, or the number of significant digits</li>
</ul>
</li>
<li> <b> Preview </b> checkbox allows to see a preview of the
presentations.</li>
</ul>
-/note The following option is relevant only for Gauss Points presentations.
+\note The following option is relevant only for Gauss Points presentations.
\n Gauss Points Presentations presume that two different scalar bars
are displayed simultaneously:
--- /dev/null
+/*!
+
+\page values_labeling_page Values labeling
+
+<br><h2>Displaying value labels</h2>
+
+In VISU you can display values applied to the cells or nodes of 3D presentation intended for visualization of calculation data.
+
+<em>To display labels for values:</em>
+<ol>
+<li>Display your presentation in 3d viewer</li>
+<li>Right-click on the presentation in the 3D viewer and from the associated pop-up menu choose <b>Values labeling</b>.</li>
+</ol>
+
+It will looks as follow:
+
+\image html values_labeling.png
+
+<br><h2>Parameters of values labeling</h2>
+
+You have ability to change parameters of values labeling such as font and color. Default parameters can be specified using "Preferences" dialog box. Also you can change parameters for each presentation.
+
+<em>To change parameters of the presentation:</em>
+<ol>
+<li>Display your presentation in 3d viewer</li>
+<li>Right-click on the presentation in the 3D viewer and from the associated pop-up menu choose <b>Labeling parameters</b>.</li>
+<li>Use "Parameters of values labeling" dialog box for the operation</li>
+</ol>
+
+It will looks as follows:
+
+\image html labeling_parameters.png
+
+*/
* \return The type of representation of the mesh.
*/
PresentationType GetPresentationType();
+
+ /*!
+ * Switches shrink mode of presentation
+ * Note: SetPresentationType(SHRINK) is same as SetShrink(True)
+ */
+ void SetShrink(in boolean toShrink);
+
+ /*!
+ * Returns current state of shrink mode
+ */
+ boolean IsShrank();
};
interface ScalarMap : ColoredPrs3d, ScaledPrs3d {
+ /*!
+ * Returns visibility state of scalar bar
+ */
+ boolean IsBarVisible();
+
+ /*!
+ * Sets visibility state of scalar bar
+ */
+ void SetBarVisible(in boolean theVisible);
+
};
//-------------------------------------------------------
<parameter name="show_manifold_edges" value="false"/>
<parameter name="show_non_manifold_edges" value="false"/>
<parameter name="feature_edges_coloring" value="false"/>
- <parameter name="scalar_bar_horizontal_height" value="0.05"/>
- <parameter name="scalar_bar_horizontal_width" value="0.5" />
- <parameter name="scalar_bar_horizontal_x" value="0.01"/>
+ <parameter name="scalar_bar_horizontal_height" value="0.08"/>
+ <parameter name="scalar_bar_horizontal_width" value="0.8" />
+ <parameter name="scalar_bar_horizontal_x" value="0.1"/>
<parameter name="scalar_bar_horizontal_y" value="0.01"/>
- <parameter name="scalar_bar_horizontal_title_height" value="0"/>
- <parameter name="scalar_bar_horizontal_title_width" value="0"/>
- <parameter name="scalar_bar_horizontal_label_height" value="0"/>
- <parameter name="scalar_bar_horizontal_label_width" value="0"/>
+ <parameter name="scalar_bar_horizontal_title_size" value="0"/>
+ <parameter name="scalar_bar_horizontal_label_size" value="0"/>
<parameter name="scalar_bar_horizontal_bar_height" value="0"/>
<parameter name="scalar_bar_horizontal_bar_width" value="0"/>
<parameter name="scalar_bar_label_color" value="255, 255, 255"/>
- <parameter name="scalar_bar_label_font" value="Arial,Bold,Italic,Underline,12"/>
- <parameter name="scalar_bar_label_format" value="%-#6.3g" />
+ <parameter name="scalar_bar_label_font" value="Arial,Bold,Italic,Shadow,12"/>
+ <parameter name="scalar_bar_label_precision" value="3" />
<parameter name="scalar_bar_logarithmic" value="false"/>
<!-- RKV : Begin -->
<!-- Do filter by scalars or don't -->
<parameter name="scalar_bar_num_labels" value="5" />
<parameter name="scalar_bar_orientation" value="0" />
<parameter name="scalar_bar_title_color" value="255, 255, 255"/>
- <parameter name="scalar_bar_title_font" value="Arial,Bold,Italic,Underline,12"/>
+ <parameter name="scalar_bar_title_font" value="Arial,Bold,Italic,Shadow,12"/>
<parameter name="scalar_bar_display_units" value="true"/>
- <parameter name="scalar_bar_vertical_height" value="0.5" />
- <parameter name="scalar_bar_vertical_width" value="0.05"/>
+ <parameter name="scalar_bar_vertical_height" value="0.8" />
+ <parameter name="scalar_bar_vertical_width" value="0.08"/>
<parameter name="scalar_bar_vertical_x" value="0.01"/>
- <parameter name="scalar_bar_vertical_y" value="0.01"/>
+ <parameter name="scalar_bar_vertical_y" value="0.1"/>
<parameter name="scalar_bar_vertical_title_height" value="0"/>
<parameter name="scalar_bar_vertical_title_width" value="0"/>
<parameter name="scalar_bar_vertical_label_height" value="0"/>
<parameter name="recorder_progressive" value="true" />
<parameter name="cache_memory_mode" value="1" />
<parameter name="cache_memory_limit" value="512" />
+ <parameter name="values_labeling_color" value="255, 255, 255"/>
+ <parameter name="values_labeling_font" value="Arial,Bold,Italic,Shadow,12"/>
</section>
<section name="resources">
<!-- Module resources -->
// File :
// Author :
// Module : VISU
-// $Header$
-//
+
#include "VISU_Actor.h"
#include "VISU_PickingSettings.h"
#include <vtkUnstructuredGrid.h>
#include <vtkPassThroughFilter.h>
#include <vtkFeatureEdges.h>
+#include <vtkActor2D.h>
+#include <vtkMaskPoints.h>
+#include <vtkLabeledDataMapper.h>
+#include <vtkSelectVisiblePoints.h>
+#include <vtkTextProperty.h>
+#include <vtkProperty2D.h>
#include <vtkShrinkFilter.h>
#include <vtkShrinkPolyData.h>
aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
myEventCallbackCommand.GetPointer(),
myPriority);
+
+ //Definition of values labeling pipeline
+
+ myValLblDataSet = vtkUnstructuredGrid::New();
+
+ myValCellCenters = vtkCellCenters::New();
+ myValCellCenters->SetInput(myValLblDataSet);
+
+ myValMaskPoints = vtkMaskPoints::New();
+ myValMaskPoints->SetInput(myValCellCenters->GetOutput());
+ myValMaskPoints->SetOnRatio(1);
+
+ myValSelectVisiblePoints = vtkSelectVisiblePoints::New();
+ myValSelectVisiblePoints->SetInput(myValMaskPoints->GetOutput());
+ myValSelectVisiblePoints->SelectInvisibleOff();
+ myValSelectVisiblePoints->SetTolerance(0.1);
+
+ myValLabeledDataMapper = vtkLabeledDataMapper::New();
+ myValLabeledDataMapper->SetInput(myValSelectVisiblePoints->GetOutput());
+ myValLabeledDataMapper->SetLabelFormat("%g");
+ myValLabeledDataMapper->SetLabelModeToLabelScalars();
+
+ vtkTextProperty* aClsTextProp = vtkTextProperty::New();
+ aClsTextProp->SetFontFamilyToTimes();
+ static int aCellsFontSize = 12;
+ aClsTextProp->SetFontSize(aCellsFontSize);
+ aClsTextProp->SetBold(1);
+ aClsTextProp->SetItalic(0);
+ aClsTextProp->SetShadow(0);
+ myValLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
+ aClsTextProp->Delete();
+
+ myIsValLabeled = false;
+
+ myValLabels = vtkActor2D::New();
+ myValLabels->SetMapper(myValLabeledDataMapper);
+ myValLabels->GetProperty()->SetColor(0,1,0);
+ myValLabels->SetVisibility( myIsValLabeled );
}
//----------------------------------------------------------------------------
VISU_Actor
::~VISU_Actor()
{
+ // Deleting of values labeling pipeline
+ myValLblDataSet->Delete();
+ myValLabeledDataMapper->RemoveAllInputs();
+ myValLabeledDataMapper->Delete();
+ myValSelectVisiblePoints->Delete();
+ myValMaskPoints->Delete();
+ myValCellCenters->Delete();
+ myValLabels->Delete();
+
if(MYDEBUG) MESSAGE("~VISU_Actor() - this = "<<this);
Superclass::SetProperty(NULL);
SetDebug(MYVTKDEBUG);
Superclass::AddToRender(theRenderer);
theRenderer->AddActor(myAnnotationActor.GetPointer());
theRenderer->AddActor(myTextActor.GetPointer());
+
+ myValSelectVisiblePoints->SetRenderer( theRenderer );
+ theRenderer->AddActor2D( myValLabels );
+
}
//==================================================================
{
theRenderer->RemoveActor(myAnnotationActor.GetPointer());
theRenderer->RemoveActor(myTextActor.GetPointer());
+ theRenderer->RemoveActor(myValLabels);
Superclass::RemoveFromRender(theRenderer);
myDestroySignal(this);
}
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::SetVisibility(int theMode)
+{
+ Superclass::SetVisibility( theMode );
+ myValLabels->SetVisibility( myIsValLabeled && theMode );
+}
+
//----------------------------------------------------------------------------
void
VISU_Actor
Update();
}
+
+// ---------------------------------------------------------------
+
+void VISU_Actor::SetValuesLabeled( const bool theIsValLabeled )
+{
+ vtkDataSet* aGrid = GetValLabelsInput();
+ if ( !aGrid )
+ return;
+
+ bool isOnPnt = VISU::IsDataOnPoints( aGrid );
+ bool isOnCell = VISU::IsDataOnCells( aGrid );
+ if ( !isOnPnt && !isOnCell )
+ {
+ // try to specify location of scalars "manually"
+ vtkCellData* aCData = aGrid->GetCellData();
+ if ( aCData )
+ {
+ vtkDataArray* anArr = aCData->GetScalars();
+ if ( anArr && anArr->GetNumberOfTuples() )
+ isOnCell = true;
+ }
+
+ if ( !isOnCell )
+ {
+ vtkPointData* aPData = aGrid->GetPointData();
+ if ( aPData )
+ {
+ vtkDataArray* anArr = aPData->GetScalars();
+ if ( anArr && anArr->GetNumberOfTuples() )
+ isOnPnt = true;
+ }
+ }
+
+ if ( !isOnPnt && !isOnCell )
+ {
+ myValLabels->SetVisibility( false );
+ return;
+ }
+ }
+
+ myIsValLabeled = theIsValLabeled;
+
+ if ( myIsValLabeled )
+ {
+ vtkDataSet* aDataSet = aGrid;
+
+ if ( isOnCell )
+ {
+ myValCellCenters->SetInput( aDataSet );
+ myValMaskPoints->SetInput( myValCellCenters->GetOutput() );
+ }
+ else if ( isOnPnt )
+ myValMaskPoints->SetInput( aDataSet );
+
+ myValLabels->SetVisibility( GetVisibility() );
+ }
+ else
+ myValLabels->SetVisibility( false );
+
+ Modified();
+}
+
+//----------------------------------------------------------------------------
+
+bool VISU_Actor::GetValuesLabeled() const
+{
+ return myIsValLabeled;
+}
+
+//----------------------------------------------------------------------------
+
+vtkTextProperty* VISU_Actor::GetsValLabelsProps() const
+{
+ return myValLabeledDataMapper->GetLabelTextProperty();
+}
+
+//----------------------------------------------------------------------------
+
+vtkDataSet* VISU_Actor::GetValLabelsInput()
+{
+ vtkDataSet* aDataSet = 0;
+ VISU_PipeLine* aPL = GetPipeLine();
+ if ( aPL )
+ aDataSet = aPL->GetOutput();
+ if ( !aDataSet )
+ aDataSet = GetInput();
+ return aDataSet;
+}
+
// File :
// Author :
// Module : VISU
-// $Header$
-//
+
#ifndef VISU_ACTOR_H
#define VISU_ACTOR_H
class vtkPlane;
class vtkImplicitFunctionCollection;
class vtkFeatureEdges;
+class vtkTextProperty;
+class vtkCellCenters;
+class vtkSelectVisiblePoints;
+class vtkLabeledDataMapper;
+class vtkMaskPoints;
+class vtkActor2D;
class VISU_FramedTextActor;
void
SetPrs3d(VISU::Prs3d_i* thePrs3d);
+ virtual
+ void
+ SetVisibility(int theMode);
+
//----------------------------------------------------------------------------
virtual
VISU_PipeLine*
UpdatePickingSettings();
//----------------------------------------------------------------------------
+ //! Methods for values labeling
+ virtual
+ void
+ SetValuesLabeled( const bool theIsValLabeled );
+
+ virtual
+ bool
+ GetValuesLabeled() const;
+
+ virtual
+ vtkDataSet*
+ GetValLabelsInput();
+
+ vtkTextProperty*
+ GetsValLabelsProps() const;
+
protected:
VISU_Actor();
Selection_Mode myLastSelectionMode;
bool myIsSubElementsHighlighted;
+
+ // fields for values labeling
+ bool myIsValLabeled;
+ vtkDataSet* myValLblDataSet;
+ vtkActor2D* myValLabels;
+ vtkMaskPoints* myValMaskPoints;
+ vtkCellCenters* myValCellCenters;
+ vtkLabeledDataMapper* myValLabeledDataMapper;
+ vtkSelectVisiblePoints* myValSelectVisiblePoints;
};
#endif //VISU_ACTOR_H
// File : VISU_VectorsAct.cxx
// Author : Laurent CORNABE with help of Nicolas REJNERI
// Module : VISU
-// $Header$
-//
+
#include "VISU_VectorsAct.h"
#include "VISU_VectorsPL.hxx"
#include <SVTK_Actor.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyData.h>
#include <vtkPassThroughFilter.h>
+#include <VISU_UsedPointsFilter.hxx>
+#include <vtkUnstructuredGrid.h>
+#include <VISU_MergeFilter.hxx>
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_VectorsAct);
return aSize;
}
+
+//----------------------------------------------------------------------------
+vtkDataSet*
+VISU_VectorsAct
+::GetValLabelsInput()
+{
+ VISU_VectorsPL* aPL = dynamic_cast<VISU_VectorsPL*>( GetPipeLine() );
+ if ( aPL )
+ {
+ return aPL->GetMergedInput();
+ /*VISU_UsedPointsFilter* aFilter = aPL->GetUsedPointsFilter();
+ vtkSmartPointer< VISU_MergeFilter > aFilter = aPL->myMergeFilter;
+ if ( aFilter )
+ {
+ aFilter->Update();
+ return aFilter->GetOutput();
+ }*/
+ }
+
+ return Superclass::GetValLabelsInput();
+}
// File : VISU_VectorsAct.h
// Author : Laurent CORNABE with help of Nicolas REJNERI
// Module : VISU
-// $Header$
-//
+
#ifndef VISU_VectorsAct_HeaderFile
#define VISU_VectorsAct_HeaderFile
virtual
unsigned long int
GetMemorySize();
+
+ virtual
+ vtkDataSet*
+ GetValLabelsInput();
protected:
VISU_VectorsAct();
this->LastSize[0] = 0;
this->LastSize[1] = 0;
- this->TitleRatioWidth = 0;
+ this->TitleRatioSize = 0;
this->LabelRatioWidth = 0;
this->BarRatioWidth = 0;
- this->TitleRatioHeight = 0;
- this->LabelRatioHeight = 0;
this->BarRatioHeight = 0;
// RKV : Begin
else
targetWidth = (int)(0.01*LabelRatioWidth*size[0]);
- if(LabelRatioHeight == 0)
- if ( this->Orientation == VTK_ORIENT_VERTICAL )
- targetHeight = (int)(0.86*size[1]/this->NumberOfLabels);
- else
- targetHeight = (int)(0.25*size[1]);
+ if ( this->Orientation == VTK_ORIENT_VERTICAL )
+ targetHeight = (int)(0.86*size[1]/this->NumberOfLabels);
else
- targetHeight = (int)(0.01*LabelRatioHeight*size[1]);
+ targetHeight = (int)(0.25*size[1]);
vtkTextMapper::SetMultipleConstrainedFontSize(viewport,
targetWidth,
int targetWidth, targetHeight;
- if(TitleRatioWidth == 0)
+ if(TitleRatioSize == 0)
targetWidth = size[0];
else
- targetWidth = (int)(0.01*TitleRatioWidth*size[0]);
+ targetWidth = (int)(0.01*TitleRatioSize*size[0]);
- if(TitleRatioHeight == 0)
- if ( this->Orientation == VTK_ORIENT_VERTICAL )
- targetHeight = (int)(0.1*size[1]);
- else
- targetHeight = (int)(0.25*size[1]);
+ if ( this->Orientation == VTK_ORIENT_VERTICAL )
+ targetHeight = (int)(0.1*size[1]);
else
- targetHeight = (int)(0.01*TitleRatioHeight*size[1]);
+ targetHeight = (int)(0.25*size[1]);
this->TitleMapper->SetConstrainedFontSize(
viewport, targetWidth, targetHeight);
}
// RKV : End
-void VISU_ScalarBarActor::SetRatios(int titleRatioWidth, int titleRatioHeight,
- int labelRatioWidth, int labelRatioHeight,
+void VISU_ScalarBarActor::SetRatios(int titleRatioSize, int labelRatioWidth,
int barRatioWidth, int barRatioHeight)
{
- TitleRatioWidth=titleRatioWidth;
- if(TitleRatioWidth>100)
- TitleRatioWidth=100;
- else if(TitleRatioWidth<0)
- TitleRatioWidth=0;
-
- TitleRatioHeight=titleRatioHeight;
- if(TitleRatioHeight>100)
- TitleRatioHeight=100;
- else if(TitleRatioHeight<0)
- TitleRatioHeight=0;
+ TitleRatioSize=titleRatioSize;
+ if(TitleRatioSize>100)
+ TitleRatioSize=100;
+ else if(TitleRatioSize<0)
+ TitleRatioSize=0;
LabelRatioWidth=labelRatioWidth;
if(LabelRatioWidth>100)
else if(LabelRatioWidth<0)
LabelRatioWidth=0;
- LabelRatioHeight=labelRatioHeight;
- if(LabelRatioHeight>100)
- LabelRatioHeight=100;
- else if(LabelRatioHeight<0)
- LabelRatioHeight=0;
-
BarRatioWidth=barRatioWidth;
if(BarRatioWidth>100)
BarRatioWidth=100;
BarRatioHeight=0;
}
-void VISU_ScalarBarActor::GetRatios(int& titleRatioWidth, int& titleRatioHeight,
- int& labelRatioWidth, int& labelRatioHeight,
- int& barRatioWidth, int& barRatioHeight)
+void VISU_ScalarBarActor::GetRatios(int& titleRatioSize, int& labelRatioWidth,
+ int& barRatioWidth, int& barRatioHeight)
{
- titleRatioWidth=TitleRatioWidth;
- titleRatioHeight=TitleRatioHeight;
+ titleRatioSize=TitleRatioSize;
labelRatioWidth=LabelRatioWidth;
- labelRatioHeight=LabelRatioHeight;
barRatioWidth=BarRatioWidth;
barRatioHeight=BarRatioHeight;
}
// Description:
// Set/Get the scalar bar dimention properties in persents.
// 0 <= ration <= 100
- void SetRatios(int titleRatioWidth, int titleRatioHeight,
- int labelRatioWidth, int labelRatioHeight,
+ void SetRatios(int titleRatioSize,int labelRatioWidth,
int barRatioWidth, int barRatioHeight);
- void GetRatios(int& titleRatioWidth, int& titleRatioHeight,
- int& labelRatioWidth, int& labelRatioHeight,
+ void GetRatios(int& titleRatioSize, int& labelRatioWidth,
int& barRatioWidth, int& barRatioHeight);
// Description:
int Orientation;
char *Title;
char *LabelFormat;
- int TitleRatioWidth;
+ int TitleRatioSize;
int LabelRatioWidth;
int BarRatioWidth;
- int TitleRatioHeight;
- int LabelRatioHeight;
int BarRatioHeight;
vtkTextMapper **TextMappers;
# File : Makefile.am
# Author : Marc Tajchman (CEA)
# Module : VISU
-# $Header$
-#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
lib_LTLIBRARIES= libVISU.la
VisuGUI_Slider.h \
VisuGUI_InputPane.h \
VisuGUI_CacheDlg.h \
- VisuGUI_FieldFilter.h
+ VisuGUI_FieldFilter.h \
+ VisuGUI_ValuesLabelingDlg.h
dist_libVISU_la_SOURCES= \
VisuGUI.cxx \
VisuGUI_FieldFilter.cxx \
VisuGUI_ClippingPanel.cxx \
VisuGUI_ClippingPlaneDlg.cxx \
- VisuGUI_FilterScalarsDlg.cxx
+ VisuGUI_FilterScalarsDlg.cxx \
+ VisuGUI_ValuesLabelingDlg.cxx
MOC_FILES= \
VisuGUI_moc.cxx \
VisuGUI_FileInfoDlg_moc.cxx \
VisuGUI_ClippingPanel_moc.cxx \
VisuGUI_ClippingPlaneDlg_moc.cxx \
- VisuGUI_FilterScalarsDlg_moc.cxx
+ VisuGUI_FilterScalarsDlg_moc.cxx \
+ VisuGUI_ValuesLabelingDlg_moc.cxx
nodist_libVISU_la_SOURCES=$(MOC_FILES)
<translation>Labels format</translation>
</message>
<message>
- <source>VISU_TITLE_WIDTH</source>
- <translation>Title width (%):</translation>
+ <source>VISU_TITLE_SIZE</source>
+ <translation>Title size (%):</translation>
</message>
<message>
<source>VISU_TITLE_HEIGHT</source>
<translation>Title height (%):</translation>
</message>
<message>
- <source>VISU_LABEL_WIDTH</source>
- <translation>Label width (%):</translation>
+ <source>VISU_LABEL_SIZE</source>
+ <translation>Label size (%):</translation>
</message>
<message>
<source>VISU_LABEL_HEIGHT</source>
</context>
<context>
<name>VisuGUI</name>
+ <message>
+ <source>PRECISION</source>
+ <translation>Precision</translation>
+ </message>
<message>
<source>DLG_LINEWIDTH_CMT1</source>
<translation>Set value between</translation>
<message>
<source>MEN_FILTER_SCALARS</source>
<translation>Filter by Scalars...</translation>
+ </message>
+ <message>
+ <source>MEN_VALUES_LABELING</source>
+ <translation>Values labeling</translation>
+ </message>
+ <message>
+ <source>VISU_VALUES_LABELING_PARAMS</source>
+ <translation>Labeling parameters</translation>
</message>
<message><source>TOOL_IMPORT</source><translation>Import</translation></message>
<message><source>TOOL_REPRESENTATION</source><translation>Representation</translation></message>
<source>UNKNOWN_IMPORT_ERROR</source>
<translation>Unknown error</translation>
</message>
+ <message>
+ <source>VALUES_LABELING</source>
+ <translation>Values labeling</translation>
+ </message>
+ <message>
+ <source>LABELS</source>
+ <translation>Labels</translation>
+ </message>
+ <message>
+ <source>COLOR</source>
+ <translation>Color</translation>
+ </message>
</context>
<context>
<name>VisuGUI_AxisWg</name>
</message>
<message>
<source>DIMENSIONS_GRP</source>
- <translation>Dimensions</translation>
+ <translation>Dimensions (in % of the size of view)</translation>
</message>
<message>
<source>FIELD_RANGE_BTN</source>
<source>FILTER_BY_SCALARS</source>
<translation>Filter by scalars</translation>
</message>
+ <message>
+ <source>VALUES_LABELING</source>
+ <translation>Values labeling</translation>
+ </message>
<message>
<source>LBL_WIDTH</source>
<translation>Width:</translation>
<source>WRN_LOGARITHMIC_RANGE</source>
<translation>Logarithmic scaling: use imposed range values > 0</translation>
</message>
+ <message>
+ <source>HIDE_SCALAR_BAR</source>
+ <translation>Hide scalar bar</translation>
+ </message>
</context>
<context>
<name>VisuGUI_DeformedShapeAndScalarMapDlg</name>
</context>
<context>
<name>VisuGUI_BarPrefDlg</name>
+ <message>
+ <source>DIMENSIONS</source>
+ <translation>Dimensions (in % of the size of widget)</translation>
+ </message>
+ <message>
+ <source>WIDTH</source>
+ <translation>Width</translation>
+ </message>
+ <message>
+ <source>PRECISION</source>
+ <translation>Precision</translation>
+ </message>
<message>
<source>&OK</source>
<translation></translation>
</message>
<message>
<source>LBL_TITLE_W</source>
- <translation>Title width (%)</translation>
- </message>
- <message>
- <source>LBL_TITLE_H</source>
- <translation>Title height (%)</translation>
+ <translation>Title size (%)</translation>
</message>
<message>
<source>LBL_LABEL_W</source>
- <translation>Label width (%)</translation>
+ <translation>Label size (%)</translation>
</message>
<message>
<source>LBL_LABEL_H</source>
</message>
<message>
<source>MSG_BIG_SCALE</source>
- <translation>The common (Title, Label, Bar) width or height should not be greater then 100%.</translation>
+ <translation>The common Label size and Bar width or height should not be greater then 100%.</translation>
+ </message>
+ <message>
+ <source>MSG_BIG_SCALE_TLT</source>
+ <translation>The Title size should not be greater then 100%.</translation>
</message>
<message>
<source>AUTO</source>
<translation>Max:</translation>
</message>
</context>
+ <context>
+ <name>VisuGUI_ValuesLabelingDlg</name>
+ <message>
+ <source>PARAMETERS_OF_VALUES_LABELING</source>
+ <translation>Parameters of values labeling</translation>
+ </message>
+ <message>
+ <source>LABELS</source>
+ <translation>Labels</translation>
+ </message>
+ <message>
+ <source>FONT</source>
+ <translation>Font</translation>
+ </message>
+ <message>
+ <source>COLOR</source>
+ <translation>Color</translation>
+ </message>
+ </context>
</TS>
// File : VisuGUI.cxx
// Author :
// Module : VISU
-// $Header$
#include "VisuGUI.h"
#include "VisuGUI_Slider.h"
#include "VisuGUI_Sweep.h"
-
+#include <VISU_ScalarMapAct.h>
+#include <VISU_GaussPtsAct.h>
+#include <VisuGUI_ValuesLabelingDlg.h>
using namespace VISU;
createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
this, SLOT(OnFilterScalars()));
+
+ createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
+ tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
+ this, SLOT(OnValuesLabeling()));
+
+ createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
+ tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
+ this, SLOT(OnValuesLabelingParams()));
+
}
void
// delete
mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
+
+ // labeling
+ mgr->insert( separator(), -1, -1, -1 );
+ mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
+ mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
+ mgr->insert( separator(), -1, -1, -1 );
// table commands
mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
+
+ // labeling
+
+ aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
+ mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
+ mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
// view parameters
aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
- QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+ //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
+ QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
//QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
" 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
setPreferenceProperty( fontGr, "columns", 2 );
- int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
+ addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
- int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
- addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
- QStringList fam;
- fam.append( tr( "VISU_FONT_ARIAL" ) );
- fam.append( tr( "VISU_FONT_COURIER" ) );
- fam.append( tr( "VISU_FONT_TIMES" ) );
- int wflag = ( QtxFontEdit::All & ( ~( QtxFontEdit::Size | QtxFontEdit::UserSize ) ) );
-
- setPreferenceProperty( tfont, "families", fam );
- setPreferenceProperty( tfont, "system", false );
- setPreferenceProperty( tfont, "widget_flags", wflag );
- setPreferenceProperty( lfont, "families", fam );
- setPreferenceProperty( lfont, "system", false );
- setPreferenceProperty( lfont, "widget_flags", wflag );
+ addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
+ addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
// group: "Colors & Labels"
int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
setPreferenceProperty( numlab, "min", 2 );
setPreferenceProperty( numlab, "max", 65 );
- addPreference( tr( "VISU_LABELS_FORMAT" ), colorsLabelsGr,
- LightApp_Preferences::String, "VISU", "scalar_bar_label_format" );
+ int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
+ setPreferenceProperty( lPrec, "min", 1 );
+ setPreferenceProperty( lPrec, "max", 100 );
+
int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
setPreferenceProperty( frame, "orientation", "horizontal" );
int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
- int twv = addPreference( tr( "VISU_TITLE_WIDTH" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_width" );
- int thv = addPreference( tr( "VISU_TITLE_HEIGHT" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_height" );
-
- int lwv = addPreference( tr( "VISU_LABEL_WIDTH" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_width" );
- int lhv = addPreference( tr( "VISU_LABEL_HEIGHT" ), posVSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_height" );
-
+ int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
+
+ int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
+
int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
setPreferenceProperty( hv, "min", 0.0 );
setPreferenceProperty( twv, "min", 0 );
setPreferenceProperty( twv, "special", "auto" );
- setPreferenceProperty( thv, "min", 0 );
- setPreferenceProperty( thv, "special", "auto" );
setPreferenceProperty( lwv, "min", 0 );
setPreferenceProperty( lwv, "special", "auto" );
- setPreferenceProperty( lhv, "min", 0 );
- setPreferenceProperty( lhv, "special", "auto" );
setPreferenceProperty( bwv, "min", 0 );
setPreferenceProperty( bwv, "special", "auto" );
setPreferenceProperty( bhv, "min", 0 );
setPreferenceProperty( wv, "max", 1.0 );
setPreferenceProperty( hv, "max", 1.0 );
setPreferenceProperty( twv, "max", 100 );
- setPreferenceProperty( thv, "max", 100 );
setPreferenceProperty( lwv, "max", 100 );
- setPreferenceProperty( lhv, "max", 100 );
setPreferenceProperty( bwv, "max", 100 );
setPreferenceProperty( bhv, "max", 100 );
int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
- int twh = addPreference( tr( "Title width (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_width" );
- int thh = addPreference( tr( "Title height (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_height" );
-
- int lwh = addPreference( tr( "Label width (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_width" );
- int lhh = addPreference( tr( "Label height (%)" ), posHSizeGr,
- LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_height" );
-
- int bwh = addPreference( tr( "Bar width (%)" ), posHSizeGr,
+ int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
+
+ int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
+ LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
+
+ int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
- int bhh = addPreference( tr( "Bar height (%)" ), posHSizeGr,
+ int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
setPreferenceProperty( xh, "step", 0.1 );
setPreferenceProperty( hh, "min", 0.0 );
setPreferenceProperty( twh, "min", 0 );
setPreferenceProperty( twh, "special", "auto" );
- setPreferenceProperty( thh, "min", 0 );
- setPreferenceProperty( thh, "special", "auto" );
setPreferenceProperty( lwh, "min", 0 );
setPreferenceProperty( lwh, "special", "auto" );
- setPreferenceProperty( lhh, "min", 0 );
- setPreferenceProperty( lhh, "special", "auto" );
setPreferenceProperty( bwh, "min", 0 );
setPreferenceProperty( bwh, "special", "auto" );
setPreferenceProperty( bhh, "min", 0 );
setPreferenceProperty( wh, "max", 1.0 );
setPreferenceProperty( hh, "max", 1.0 );
setPreferenceProperty( twh, "max", 100 );
- setPreferenceProperty( thh, "max", 100 );
setPreferenceProperty( lwh, "max", 100 );
- setPreferenceProperty( lhh, "max", 100 );
setPreferenceProperty( bwh, "max", 100 );
setPreferenceProperty( bhh, "max", 100 );
addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
//addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
+
+ // TAB: "Values labels"
+
+ int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
+
+ // "Font" group
+ int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
+ setPreferenceProperty( valLblFontGr, "columns", 2 );
+
+ // font
+ addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
+
+ // color
+ addPreference( tr( "COLOR" ), valLblFontGr,
+ LightApp_Preferences::Color, "VISU", "values_labeling_color" );
+
}
void VisuGUI::preferencesChanged( const QString& a, const QString& b)
float aTol = 1.00000009999999;
QString aWarning;
if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
- sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1);
- sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW);
+ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
+ sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
if(sbX1+sbW > aTol){
aWarning = "Origin and Size Vertical: X+Width > 1\n";
sbX1=0.01;
}
}
else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
- sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1);
- sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH);
+ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
+ sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
if(sbY1+sbH > aTol){
aWarning = "Origin and Size Vertical: Y+Height > 1\n";
sbY1=0.01;
}
}
else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
- sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1);
- sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW);
+ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
+ sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
if(sbX1+sbW > aTol){
aWarning = "Origin and Size Horizontal: X+Width > 1\n";
sbX1=0.2;
}
}
else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
- sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1);
- sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH);
+ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
+ sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
if(sbY1+sbH > aTol){
aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
sbY1=0.01;
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
}
- } else if(b == QString("scalar_bar_label_format")) {
- QString dVal;
- dVal.sprintf(aResourceMgr->stringValue("VISU", "scalar_bar_label_format",dVal).toLatin1().data(), 1.1);
- if(dVal.toDouble() == 0.) {
- aWarning = "Label format is incorrect ";
- aWarning += dVal;
- aWarning += "\n";
- dVal="%-#6.3g";
- aResourceMgr->setValue("VISU", "scalar_bar_label_format", dVal);
- }
- }
+ }
+
if ( !aWarning.isEmpty() ){
aWarning += "The default values are applied instead.";
SUIT_MessageBox::warning(GetDesktop(this),
VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
aDlg->show();
}
+
+/*!
+ \brief SLOT called when "Labeling" popup menu item of presentation is clicked
+ activates/deactivates labeling of results of the screen. This functionality works
+ to numbering in SMESH module but is intended for showing results on the screen
+ instead of elements numbers
+ \sa OnValuesLabelingParams()
+*/
+void VisuGUI::OnValuesLabeling()
+{
+ // to do: rewrite for several actors if necessary
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
+ if ( aSelectionInfo.empty() )
+ return;
+
+ TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
+ VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+ if(!aPrs3d)
+ return;
+
+ SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
+ if(!aViewWindow)
+ return;
+
+ VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
+ if(!anActor)
+ return;
+
+ if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
+ {
+ aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
+ aViewWindow->Repaint();
+ }
+ else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
+ {
+ aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
+ aViewWindow->Repaint();
+ }
+}
+
+/*!
+ \brief SLOT called when "Labeling parameters" popup menu item of presentation
+ is clicked launch dialog box for changing parameters of labeling
+ \sa OnValuesLabeling()
+*/
+void VisuGUI::OnValuesLabelingParams()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
+ EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
+}
+/*!
+ \brief Adds preferences for dfont of VTK viewer
+ \param label label
+ \param pIf group identifier
+ \param param parameter
+ \return identifier of preferences
+*/
+int VisuGUI::addVtkFontPref(
+ const QString& label,
+ const int pId,
+ const QString& param,
+ const bool useSize )
+{
+ int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
+
+ setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
+
+ QStringList fam;
+ fam.append( tr( "VISU_FONT_ARIAL" ) );
+ fam.append( tr( "VISU_FONT_COURIER" ) );
+ fam.append( tr( "VISU_FONT_TIMES" ) );
+
+ setPreferenceProperty( tfont, "fonts", fam );
+
+ int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
+ if ( useSize )
+ f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
+
+ setPreferenceProperty( tfont, "features", f );
+
+ return tfont;
+}
// File : VisuGUI.h
// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
-// $Header$
-//
+
#ifndef VisuGUI_HeaderFile
#define VisuGUI_HeaderFile
void OnManageCache();
void OnFilterScalars();
+
+ void OnValuesLabeling();
+ void OnValuesLabelingParams();
// MULTIPR
void OnMultiprViewFullRes();
void createPopupMenus();
void createPanels();
void activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO );
+ int addVtkFontPref( const QString& label, const int pId, const QString& param, const bool useSize );
private:
QMap< PanelId, VisuGUI_Panel* > myPanels;
#define VISU_SWEEP_PANEL 4300
#define VISU_FILTERSCALARS 4301
+#define VISU_VALUES_LABELING 4302
+#define VISU_VALUES_LABELING_PARAMS 4303
+
+
#endif
void VisuGUI_DeformedShapeAndScalarMapDlg::AddAllTimes(const QString& theFieldName){
TEntity2Fields::const_iterator anIter = myEntity2Fields.begin();
+ int currentTimeStampId = (myTimeStampsCombo->count() > 0) ? myTimeStampsCombo->currentIndex() : 0;
for(; anIter != myEntity2Fields.end(); anIter++){
const TFieldName2TimeStamps& aFieldName2TimeStamps = anIter->second;
TFieldName2TimeStamps::const_iterator aFieldIter = aFieldName2TimeStamps.begin();
QString aTimeStampTime = aTimeStampIter->second;
myTimeStampsCombo->addItem(aTimeStampTime);
}
+ if(currentTimeStampId >= myTimeStampID.size())
+ currentTimeStampId = myTimeStampID.size()-1;
+ myTimeStampsCombo->setCurrentIndex(currentTimeStampId);
return;
}
}
#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_GaussPoints_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "VISU_GaussPointsPL.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VISU_Convertor.hxx"
VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent):
QWidget(parent)
{
- myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80;
- myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12;
- myVerTW = myVerTH = myVerLW = myVerLH = myVerBW = myVerBH = 0;
- myHorTW = myHorTH = myHorLW = myHorLH = myHorBW = myHorBH = 0;
+ myVerX = 0.01; myVerY = 0.10; myVerW = 0.08; myVerH = 0.80;
+ myHorX = 0.10; myHorY = 0.01; myHorW = 0.80; myHorH = 0.08;
+ myVerTS = myVerLS = myVerBW = myVerBH = 0;
+ myHorTS = myHorLS = myHorBW = myHorBH = 0;
Imin = 0.0; Imax = 0.0;
myRangeMode = -1;
thePrs->GetBarOrientation());
if(RBvert->isChecked()) {
- myVerTW = thePrs->GetTitleWidth();
- myVerTH = thePrs->GetTitleHeight();
- myVerLW = thePrs->GetLabelWidth();
- myVerLH = thePrs->GetLabelHeight();
+ myVerTS = thePrs->GetTitleSize();
+ myVerLS = thePrs->GetLabelSize();
myVerBW = thePrs->GetBarWidth();
myVerBH = thePrs->GetBarHeight();
} else {
- myHorTW = thePrs->GetTitleWidth();
- myHorTH = thePrs->GetTitleHeight();
- myHorLW = thePrs->GetLabelWidth();
- myHorLH = thePrs->GetLabelHeight();
+ myHorTS = thePrs->GetTitleSize();
+ myHorLS = thePrs->GetLabelSize();
myHorBW = thePrs->GetBarWidth();
myHorBH = thePrs->GetBarHeight();
}
- myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat());
+ myBarDlg->setLabelsPrecision( VISU::ToPrecision( thePrs->GetLabelsFormat() ) );
myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
SpacingSpin->setValue(thePrs->GetSpacing());
vtkFloatingPointType R, G, B;
thePrs->GetTitleColor(R, G, B);
- myBarDlg->setLabelsFormat(thePrs->GetLabelsFormat());
+ int lp = VISU::ToPrecision( thePrs->GetLabelsFormat() );
+ myBarDlg->setLabelsPrecision( lp );
myBarDlg->setUnitsVisible(thePrs->IsUnitsVisible());
myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)),
thePrs->SetLabels(LabelSpin->value());
if(RBvert->isChecked()) {
- thePrs->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ thePrs->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- thePrs->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ thePrs->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- thePrs->SetLabelsFormat(myBarDlg->getLabelsFormat().toLatin1().data());
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ thePrs->SetLabelsFormat( f.c_str() );
thePrs->SetUnitsVisible(myBarDlg->isUnitsVisible());
if (myIsStoreTextProp) {
void VisuGUI_GaussScalarBarPane::onBarPref()
{
if(RBvert->isChecked())
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
if(myBarDlg->exec()) {
if(RBvert->isChecked())
- myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->getRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->getRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
}
double Imin, Imax;
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
- int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
- int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ int myHorTS, myHorLS, myHorBW, myHorBH;
+ int myVerTS, myVerLS, myVerBW, myVerBH;
int myRangeMode;
bool myIsStoreTextProp;
#include "VISU_ScalarMapAct.h"
#include "VISU_ScalarMap_i.hh"
#include "VISU_Result_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include "LightApp_Application.h"
setWindowTitle(tr("TIT_TEXT_PREF"));
setSizeGripEnabled(TRUE);
- QVBoxLayout* TopLayout = new QVBoxLayout(this);
- TopLayout->setSpacing(6);
- TopLayout->setMargin(11);
+ QVBoxLayout* aMainLay = new QVBoxLayout(this);
+ aMainLay->setSpacing(6);
+ aMainLay->setMargin(11);
// "Title" grp
QGroupBox* aTitleGrp = new QGroupBox ( tr("LBL_TITLE"), this);
myTitleFont = new SVTK_FontWidget (aHBox);
aHBLay->addWidget( myTitleFont );
- TopLayout->addWidget(aTitleGrp);
+ aMainLay->addWidget(aTitleGrp);
// "Labels" grp
QGroupBox* aLabelsGrp = new QGroupBox (tr("LBL_LABELS"), this);
myLabelFont = new SVTK_FontWidget (aHBox);
aHBLay->addWidget( myLabelFont );
- TopLayout->addWidget(aLabelsGrp);
+ aMainLay->addWidget(aLabelsGrp);
// Common buttons ===========================================================
QGroupBox* GroupButtons = new QGroupBox( this );
buttonHelp->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonHelp, 0, 3 );
- TopLayout->addWidget( GroupButtons );
+ aMainLay->addWidget( GroupButtons );
connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
Constructor
*/
VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg( QWidget* parent )
- : QDialog( parent )
+ : QDialog( parent ),
+ myOrientation( 1 )
{
setModal( true );
setWindowTitle( tr( "TIT_BAR_PREF" ) );
QString propertyName = QString( "scalar_bar_vertical_" );
- myTitleWidth = myTitleHeight = myLabelWidth = myLabelHeight = myBarWidth = myBarHeight = 0;
+ myTitleSize = myLabelSize = myBarWidth = myBarHeight = 0;
myUnits = true;
- myUnitsFormat = "%-#6.3g";
+ myPrecision = 3;
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
+ QVBoxLayout* aMainLay = new QVBoxLayout( this );
+ aMainLay->setSpacing( 5 );
+ aMainLay->setMargin( 5 );
+
+ // dimensions
+
+ QGroupBox* aDimGrp = new QGroupBox( this );
+ QGridLayout* aDimGrpLay = new QGridLayout( aDimGrp );
+ aDimGrpLay->setSpacing( 5 );
+ aDimGrpLay->setMargin( 5 );
+
+ myTitleSizeSpin = new QSpinBox( aDimGrp );
+ myTitleSizeSpin->setRange( 0, 100 );
+ myTitleSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myTitleSizeSpin->setMinimumWidth( 70 );
+ myTitleSizeSpin->setValue( 0 );
+ myTitleSizeSpin->setSpecialValueText( tr( "AUTO" ) );
+ QLabel* aTitleSizeLbl = new QLabel( tr( "LBL_TITLE_W" ), aDimGrp );
+
+ myLabelSizeSpin = new QSpinBox( aDimGrp );
+ myLabelSizeSpin->setRange( 0, 100 );
+ myLabelSizeSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myLabelSizeSpin->setMinimumWidth( 70 );
+ myLabelSizeSpin->setValue( 0 );
+ myLabelSizeSpin->setSpecialValueText( tr( "AUTO" ) );
+ QLabel* aLabelSizeLbl = new QLabel( tr( "LBL_LABEL_W" ), aDimGrp );
+
+ myBarWidthSpin = new QSpinBox( aDimGrp );
+ myBarWidthSpin->setRange( 0, 100 );
+ myBarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myBarWidthSpin->setMinimumWidth( 70 );
+ myBarWidthSpin->setValue( 0 );
+ myBarWidthSpin->setSpecialValueText( tr( "AUTO" ) );
+ QLabel* aBarWidthLbl = new QLabel( tr( "LBL_BAR_W" ), aDimGrp );
+
+ myBarHeightSpin = new QSpinBox( aDimGrp );
+ myBarHeightSpin->setRange( 0, 100 );
+ myBarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myBarHeightSpin->setMinimumWidth( 70 );
+ myBarHeightSpin->setValue( 0 );
+ myBarHeightSpin->setSpecialValueText( tr( "AUTO" ) );
+ QLabel* aBarHeightLbl = new QLabel( tr( "LBL_BAR_H" ), aDimGrp );
+
+ // format and units
+
+ QLabel* aPrecLbl = new QLabel( tr( "PRECISION" ), aDimGrp );
+ myPrecisionSpin = new QSpinBox( aDimGrp );
+ myPrecisionSpin->setRange( 1, 100 );
+
+ myUnitsChk = new QCheckBox( tr( "LBL_SHOW_UNITS" ), aDimGrp );
+
+ // layout
+
+ aDimGrpLay->addWidget( aTitleSizeLbl, 0, 0 );
+ aDimGrpLay->addWidget( myTitleSizeSpin, 0, 1 );
+ aDimGrpLay->addWidget( aLabelSizeLbl, 0, 2 );
+ aDimGrpLay->addWidget( myLabelSizeSpin, 0, 3 );
+ aDimGrpLay->addWidget( aBarWidthLbl, 1, 0 );
+ aDimGrpLay->addWidget( myBarWidthSpin, 1, 1 );
+ aDimGrpLay->addWidget( aBarHeightLbl, 1, 2 );
+ aDimGrpLay->addWidget( myBarHeightSpin, 1, 3 );
+ aDimGrpLay->addWidget( aPrecLbl, 2, 0 );
+ aDimGrpLay->addWidget( myPrecisionSpin, 2, 1 );
+ aDimGrpLay->addWidget( myUnitsChk, 2, 2, 1, 2 );
- QGroupBox* WidthHeightGroup = new QGroupBox ( this );
- QGridLayout* WidthHeightGroupLayout = new QGridLayout( WidthHeightGroup );
- WidthHeightGroupLayout->setAlignment( Qt::AlignTop );
- WidthHeightGroupLayout->setSpacing( 6 );
- WidthHeightGroupLayout->setMargin( 11 );
-
- TitleWidthSpin = new QSpinBox( WidthHeightGroup );
- TitleWidthSpin->setRange( 0, 100 );
- TitleWidthSpin->setSingleStep( 1 );
- TitleWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- TitleWidthSpin->setMinimumWidth( 70 );
- TitleWidthSpin->setValue( 0 );
- TitleWidthSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelTitleWidth = new QLabel( tr( "LBL_TITLE_W" ), WidthHeightGroup );
- LabelTitleWidth->setBuddy( TitleWidthSpin );
-
- TitleHeightSpin = new QSpinBox( WidthHeightGroup );
- TitleHeightSpin->setRange( 0, 100 );
- TitleHeightSpin->setSingleStep( 1 );
- TitleHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- TitleHeightSpin->setMinimumWidth( 70 );
- TitleHeightSpin->setValue( 0 );
- TitleHeightSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelTitleHeight = new QLabel( tr( "LBL_TITLE_H" ), WidthHeightGroup );
- LabelTitleHeight->setBuddy( TitleHeightSpin );
-
- CBUnits = new QCheckBox( tr( "LBL_SHOW_UNITS" ), WidthHeightGroup );
- CBUnits->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- LabelWidthSpin = new QSpinBox( WidthHeightGroup );
- LabelWidthSpin->setRange( 0, 100 );
- LabelWidthSpin->setSingleStep( 1 );
- LabelWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- LabelWidthSpin->setMinimumWidth( 70 );
- LabelWidthSpin->setValue( 0 );
- LabelWidthSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelLabelWidth = new QLabel( tr( "LBL_LABEL_W" ), WidthHeightGroup );
- LabelLabelWidth->setBuddy( LabelWidthSpin );
-
- LabelHeightSpin = new QSpinBox( WidthHeightGroup );
- LabelHeightSpin->setRange( 0, 100 );
- LabelHeightSpin->setSingleStep( 1 );
- LabelHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- LabelHeightSpin->setMinimumWidth( 70 );
- LabelHeightSpin->setValue( 0 );
- LabelHeightSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelLabelHeight = new QLabel( tr( "LBL_LABEL_H" ), WidthHeightGroup );
- LabelLabelHeight->setBuddy( LabelHeightSpin );
-
- UnitsEdit = new QLineEdit( WidthHeightGroup );
- UnitsEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- UnitsEdit->setMinimumWidth( 35 );
- UnitsEdit->setText( myUnitsFormat );
- QLabel* UnitsLabel = new QLabel( tr( "LBL_UNITS_FORMAT" ), WidthHeightGroup );
- UnitsLabel->setBuddy( UnitsEdit );
-
- BarWidthSpin = new QSpinBox( WidthHeightGroup );
- BarWidthSpin->setRange( 0, 100 );
- BarWidthSpin->setSingleStep( 1 );
- BarWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- BarWidthSpin->setMinimumWidth( 70 );
- BarWidthSpin->setValue( 0 );
- BarWidthSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelBarWidth = new QLabel( tr( "LBL_BAR_W" ), WidthHeightGroup );
- LabelBarWidth->setBuddy( BarWidthSpin );
-
- BarHeightSpin = new QSpinBox( WidthHeightGroup );
- BarHeightSpin->setRange( 0, 100 );
- BarHeightSpin->setSingleStep( 1 );
- BarHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- BarHeightSpin->setMinimumWidth( 70 );
- BarHeightSpin->setValue( 0 );
- BarHeightSpin->setSpecialValueText( tr( "AUTO" ) );
- QLabel* LabelBarHeight = new QLabel( tr( "LBL_BAR_H" ), WidthHeightGroup );
- LabelBarHeight->setBuddy( BarHeightSpin );
-
- WidthHeightGroupLayout->addWidget( LabelTitleWidth, 0, 0 );
- WidthHeightGroupLayout->addWidget( TitleWidthSpin, 0, 1 );
- WidthHeightGroupLayout->addWidget( LabelTitleHeight, 0, 2 );
- WidthHeightGroupLayout->addWidget( TitleHeightSpin, 0, 3 );
- WidthHeightGroupLayout->addWidget( CBUnits, 0, 4, 1, 2 );
- WidthHeightGroupLayout->addWidget( LabelLabelWidth, 1, 0 );
- WidthHeightGroupLayout->addWidget( LabelWidthSpin, 1, 1 );
- WidthHeightGroupLayout->addWidget( LabelLabelHeight, 1, 2 );
- WidthHeightGroupLayout->addWidget( LabelHeightSpin, 1, 3 );
- WidthHeightGroupLayout->addWidget( UnitsLabel, 1, 4 );
- WidthHeightGroupLayout->addWidget( UnitsEdit, 1, 5 );
- WidthHeightGroupLayout->addWidget( LabelBarWidth, 2, 0 );
- WidthHeightGroupLayout->addWidget( BarWidthSpin, 2, 1 );
- WidthHeightGroupLayout->addWidget( LabelBarHeight, 2, 2 );
- WidthHeightGroupLayout->addWidget( BarHeightSpin, 2, 3 );
-
- TopLayout->addWidget( WidthHeightGroup );
+ aMainLay->addWidget( aDimGrp );
// Common buttons ===========================================================
+
QGroupBox* GroupButtons = new QGroupBox( this );
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->addWidget( buttonCancel );
GroupButtonsLayout->addWidget( buttonHelp );
- TopLayout->addWidget( GroupButtons );
+ aMainLay->addWidget( GroupButtons );
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) );
- connect( TitleWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( TitleHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( LabelWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( LabelHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( BarWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( BarHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
- connect( CBUnits, SIGNAL( toggled( bool ) ), this, SIGNAL( updatePreview() ) );
- connect( UnitsEdit, SIGNAL( editingFinished() ), this, SIGNAL( updatePreview() ) );
+ connect( myTitleSizeSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myLabelSizeSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myBarWidthSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myBarHeightSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
+ connect( myUnitsChk, SIGNAL( toggled( bool ) ), this, SIGNAL( updatePreview() ) );
+ connect( myPrecisionSpin, SIGNAL( valueChanged( int ) ), this, SIGNAL( updatePreview() ) );
}
//----------------------------------------------------------------------------
-void VisuGUI_BarPrefDlg::setRatios( int titleRatioWidth, int titleRatioHeight,
- int labelRatioWidth, int labelRatioHeight,
- int barRatioWidth, int barRatioHeight )
+void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
+ int barRatioWidth, int barRatioHeight )
{
- TitleWidthSpin->setValue( myTitleWidth = titleRatioWidth );
- TitleHeightSpin->setValue( myTitleHeight = titleRatioHeight );
- LabelWidthSpin->setValue( myLabelWidth = labelRatioWidth );
- LabelHeightSpin->setValue( myLabelHeight = labelRatioHeight );
- BarWidthSpin->setValue( myBarWidth = barRatioWidth );
- BarHeightSpin->setValue( myBarHeight = barRatioHeight );
+ myTitleSizeSpin->setValue( myTitleSize = titleRatioSize );
+ myLabelSizeSpin->setValue( myLabelSize = labelRatioWidth );
+ myBarWidthSpin->setValue( myBarWidth = barRatioWidth );
+ myBarHeightSpin->setValue( myBarHeight = barRatioHeight );
}
//----------------------------------------------------------------------------
-void VisuGUI_BarPrefDlg::getRatios( int& titleRatioWidth, int& titleRatioHeight,
- int& labelRatioWidth, int& labelRatioHeight,
- int& barRatioWidth, int& barRatioHeight )
+void VisuGUI_BarPrefDlg::getRatios( int& titleRatioSize, int& labelRatioWidth,
+ int& barRatioWidth, int& barRatioHeight )
{
- titleRatioWidth = TitleWidthSpin->value();
- titleRatioHeight = TitleHeightSpin->value();
- labelRatioWidth = LabelWidthSpin->value();
- labelRatioHeight = LabelHeightSpin->value();
- barRatioWidth = BarWidthSpin->value();
- barRatioHeight = BarHeightSpin->value();
+ titleRatioSize = myTitleSizeSpin->value();
+ labelRatioWidth = myLabelSizeSpin->value();
+ barRatioWidth = myBarWidthSpin->value();
+ barRatioHeight = myBarHeightSpin->value();
}
//----------------------------------------------------------------------------
-void VisuGUI_BarPrefDlg::setLabelsFormat( const QString& format )
+void VisuGUI_BarPrefDlg::setLabelsPrecision( const int p )
{
- UnitsEdit->setText( myUnitsFormat = format );
+ myPrecisionSpin->setValue( p );
}
+//----------------------------------------------------------------------------
+int VisuGUI_BarPrefDlg::getLabelsPrecision() const
+{
+ return myPrecisionSpin->value();
+}
//----------------------------------------------------------------------------
-QString VisuGUI_BarPrefDlg::getLabelsFormat()
+void VisuGUI_BarPrefDlg::setOrientation( const int ori )
{
- return UnitsEdit->text();
+ myOrientation = ori;
}
+//----------------------------------------------------------------------------
+
+int VisuGUI_BarPrefDlg::getOrientation() const
+{
+ return myOrientation;
+}
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::onHelp()
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::setUnitsVisible(bool isVisible)
{
- CBUnits->setChecked( myUnits = isVisible );
+ myUnitsChk->setChecked( myUnits = isVisible );
}
//----------------------------------------------------------------------------
bool VisuGUI_BarPrefDlg::isUnitsVisible()
{
- return CBUnits->isChecked();
+ return myUnitsChk->isChecked();
}
*/
void VisuGUI_BarPrefDlg::reject()
{
- TitleWidthSpin->setValue( myTitleWidth );
- TitleHeightSpin->setValue( myTitleHeight );
- LabelWidthSpin->setValue( myLabelWidth );
- LabelHeightSpin->setValue( myLabelHeight );
- BarWidthSpin->setValue( myBarWidth );
- BarHeightSpin->setValue( myBarHeight );
- CBUnits->setChecked( myUnits );
- UnitsEdit->setText( myUnitsFormat );
+ myTitleSizeSpin->setValue( myTitleSize );
+ myLabelSizeSpin->setValue( myLabelSize );
+ myBarWidthSpin->setValue( myBarWidth );
+ myBarHeightSpin->setValue( myBarHeight );
+ myUnitsChk->setChecked( myUnits );
+ myPrecisionSpin->setValue( myPrecision );
QDialog::reject();
}
void VisuGUI_BarPrefDlg::accept()
{
QString dVal;
- dVal.sprintf( UnitsEdit->text().toLatin1().data(), 1.1 );
- if ( dVal.toDouble() == 0. ) {
- SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr ( "MSG_LABEL_FORMAT" ) );
+ int aBWH = myOrientation == 1 ? myBarWidthSpin->value() : myBarHeightSpin->value();
+ if( ( myLabelSizeSpin->value()+ aBWH ) > 100 )
+ {
+ SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) );
+ return;
}
- else {
- if(
- (
- TitleWidthSpin->value()+
- LabelWidthSpin->value()+
- BarWidthSpin->value()
- > 100
- ) ||
- (
- TitleHeightSpin->value()+
- LabelHeightSpin->value()+
- BarHeightSpin->value()
- > 100
- )
- ) {
- SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) );
- }
- else {
- myTitleWidth = TitleWidthSpin->value();
- myTitleHeight = TitleHeightSpin->value();
- myLabelWidth = LabelWidthSpin->value();
- myLabelHeight = LabelHeightSpin->value();
- myBarWidth = BarWidthSpin->value();
- myBarHeight = BarHeightSpin->value();
- myUnits = CBUnits->isChecked();
- myUnitsFormat = UnitsEdit->text();
- QDialog::accept();
- }
+
+ if ( myTitleSizeSpin->value() > 100 )
+ {
+ SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE_TLT" ) );
+ return;
}
+
+ myTitleSize = myTitleSizeSpin->value();
+ myLabelSize = myLabelSizeSpin->value();
+ myBarWidth = myBarWidthSpin->value();
+ myBarHeight = myBarHeightSpin->value();
+ myUnits = myUnitsChk->isChecked();
+ myPrecision = myPrecisionSpin->value();
+ QDialog::accept();
}
myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
- myVerTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
- myVerTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
- myVerLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
- myVerLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myVerTS = aResourceMgr->integerValue("VISU", propertyName + "title_size", 0);
+ myVerLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0);
myVerBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
myVerBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.);
myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.);
- myHorTW = aResourceMgr->integerValue("VISU", propertyName + "title_width", 0);
- myHorTH = aResourceMgr->integerValue("VISU", propertyName + "title_height",0);
- myHorLW = aResourceMgr->integerValue("VISU", propertyName + "label_width", 0);
- myHorLH = aResourceMgr->integerValue("VISU", propertyName + "label_height",0);
+ myHorTS = aResourceMgr->integerValue("VISU", propertyName + "title_size", 0);
+ myHorLS = aResourceMgr->integerValue("VISU", propertyName + "label_size", 0);
myHorBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0);
myHorBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0);
- aMainLayout->setSpacing(6);
- //setMargin(11);
+ //aMainLayout->setSpacing(6);
// Range ============================================================
RangeGroup = new QButtonGroup ( this );
QGroupBox* aGB = new QGroupBox( tr("SCALAR_RANGE_GRP"),this );
aMainLayout->addWidget( aGB );
- //RangeGroup->setColumnLayout(0, Qt::Vertical );
- //RangeGroup->layout()->setSpacing( 0 );
- //RangeGroup->layout()->setMargin( 0 );
QGridLayout* RangeGroupLayout = new QGridLayout( aGB );
RangeGroupLayout->setAlignment( Qt::AlignTop );
- RangeGroupLayout->setSpacing( 6 );
- RangeGroupLayout->setMargin( 11 );
+ //RangeGroupLayout->setSpacing( 6 );
+ //RangeGroupLayout->setMargin( 11 );
myModeLbl = new QLabel("Scalar Mode", aGB);
MinEdit = new QLineEdit( aGB );
MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- MinEdit->setMinimumWidth( 70 );
+ //MinEdit->setMinimumWidth( 70 );
MinEdit->setValidator( new QDoubleValidator(this) );
MinEdit->setText( "0.0" );
QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB);
MaxEdit = new QLineEdit( aGB );
MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- MaxEdit->setMinimumWidth( 70 );
+ //MaxEdit->setMinimumWidth( 70 );
MaxEdit->setValidator( new QDoubleValidator(this) );
MaxEdit->setText( "0.0" );
QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB);
RangeGroupLayout->addWidget( MaxLabel, 2, 2 );
RangeGroupLayout->addWidget( MaxEdit, 2, 3 );
- //TopLayout->addWidget( RangeGroup );
-
// Colors and Labels ========================================================
QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this);
aMainLayout->addWidget( ColLabGroup );
- //ColLabGroup->setColumnLayout(0, Qt::Vertical );
- //ColLabGroup->layout()->setSpacing( 0 );
- //ColLabGroup->layout()->setMargin( 0 );
QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup );
ColLabGroupLayout->setAlignment( Qt::AlignTop );
- ColLabGroupLayout->setSpacing( 6 );
- ColLabGroupLayout->setMargin( 11 );
+ //ColLabGroupLayout->setSpacing( 6 );
+ //ColLabGroupLayout->setMargin( 11 );
QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup);
ColorSpin = new QSpinBox( ColLabGroup );
ColorSpin->setMaximum( 256 );
ColorSpin->setSingleStep( 1 );
ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- ColorSpin->setMinimumWidth( 70 );
+ //ColorSpin->setMinimumWidth( 70 );
ColorSpin->setValue( 64 );
QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup);
LabelSpin->setSingleStep( 1 );
LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- LabelSpin->setMinimumWidth( 70 );
+ //LabelSpin->setMinimumWidth( 70 );
LabelSpin->setValue( 5 );
ColLabGroupLayout->addWidget( ColorLabel, 0, 0);
ColLabGroupLayout->addWidget( LabelLabel, 0, 2);
ColLabGroupLayout->addWidget( LabelSpin, 0, 3);
- //TopLayout->addWidget( ColLabGroup );
-
// Orientation ==========================================================
QButtonGroup* OrientGroup = new QButtonGroup ( this );
QGroupBox* OrientGB = new QGroupBox( tr("ORIENTATION_GRP"),this );
aMainLayout->addWidget( OrientGB );
- //OrientGroup->setColumnLayout(0, Qt::Vertical );
- //OrientGroup->layout()->setSpacing( 0 );
- //OrientGroup->layout()->setMargin( 0 );
QGridLayout* OrientGroupLayout = new QGridLayout( OrientGB );
OrientGroupLayout->setAlignment( Qt::AlignTop );
- OrientGroupLayout->setSpacing( 6 );
- OrientGroupLayout->setMargin( 11 );
+ //OrientGroupLayout->setSpacing( 6 );
+ //OrientGroupLayout->setMargin( 11 );
RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGB);
RBvert->setChecked( true );
OrientGroupLayout->addWidget( RBvert, 0, 0 );
OrientGroupLayout->addWidget( RBhori, 0, 1 );
- // TopLayout->addWidget( OrientGroup );
-
// Origin ===============================================================
QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this);
aMainLayout->addWidget( OriginGroup );
- //OriginGroup->setColumnLayout(0, Qt::Vertical );
- //OriginGroup->layout()->setSpacing( 0 );
- // OriginGroup->layout()->setMargin( 0 );
QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup );
OriginGroupLayout->setAlignment( Qt::AlignTop );
- OriginGroupLayout->setSpacing( 6 );
- OriginGroupLayout->setMargin( 11 );
+ //OriginGroupLayout->setSpacing( 6 );
+ //OriginGroupLayout->setMargin( 11 );
QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup);
XSpin = new QtxDoubleSpinBox( OriginGroup );
VISU::initSpinBox(XSpin, 0.0, +1.0);
XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- XSpin->setMinimumWidth( 70 );
+ //XSpin->setMinimumWidth( 70 );
XSpin->setValue( 0.01 );
QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup);
YSpin = new QtxDoubleSpinBox( OriginGroup );
VISU::initSpinBox(YSpin, 0.0, +1.0);
YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- YSpin->setMinimumWidth( 70 );
- YSpin->setValue( 0.01 );
+ //YSpin->setMinimumWidth( 70 );
+ YSpin->setValue( 0.1 );
OriginGroupLayout->addWidget( XLabel, 0, 0);
OriginGroupLayout->addWidget( XSpin, 0, 1);
OriginGroupLayout->addWidget( YLabel, 0, 2);
OriginGroupLayout->addWidget( YSpin, 0, 3);
- //TopLayout->addWidget( OriginGroup );
-
// Dimensions =========================================================
QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this );
aMainLayout->addWidget( DimGroup );
- //DimGroup->setColumnLayout(0, Qt::Vertical );
- //DimGroup->layout()->setSpacing( 0 );
- //DimGroup->layout()->setMargin( 0 );
QGridLayout* DimGroupLayout = new QGridLayout( DimGroup );
DimGroupLayout->setAlignment( Qt::AlignTop );
- DimGroupLayout->setSpacing( 6 );
- DimGroupLayout->setMargin( 11 );
+ //DimGroupLayout->setSpacing( 6 );
+ //DimGroupLayout->setMargin( 11 );
QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup);
WidthSpin = new QtxDoubleSpinBox( DimGroup );
VISU::initSpinBox(WidthSpin, 0.0, +1.0);
WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- WidthSpin->setMinimumWidth( 70 );
+ //WidthSpin->setMinimumWidth( 70 );
WidthSpin->setValue( 0.1 );
QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup);
HeightSpin = new QtxDoubleSpinBox( DimGroup );
VISU::initSpinBox(HeightSpin, 0.0, +1.0);
HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- HeightSpin->setMinimumWidth( 70 );
+ //HeightSpin->setMinimumWidth( 70 );
HeightSpin->setValue( 0.8 );
DimGroupLayout->addWidget( WidthLabel, 0, 0);
DimGroupLayout->addWidget( HeightLabel, 0, 2);
DimGroupLayout->addWidget( HeightSpin, 0, 3);
- //TopLayout->addWidget( DimGroup );
-
// Save check box ===========================================================
QWidget* aSaveBox = new QWidget(this);
aMainLayout->addWidget( aSaveBox );
QGroupBox* CheckGroup = new QGroupBox("", this );
aMainLayout->addWidget( CheckGroup );
- QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup );
+ //QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup );
+ QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup );
myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
myPreviewCheck->setChecked(false);
- //myPreviewCheck->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- CheckGroupLayout->addWidget(myPreviewCheck);
+ CheckGroupLayout->addWidget(myPreviewCheck, 0, 0);
+ myHideBar = new QCheckBox(tr("HIDE_SCALAR_BAR"), CheckGroup);
+ myHideBar->setChecked(false);
+ CheckGroupLayout->addWidget(myHideBar, 0, 1);
+
// RKV : Begin
CBDistr = new QCheckBox (tr("SHOW_DISTRIBUTION"), CheckGroup);
- //CBDistr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- CheckGroupLayout->addWidget(CBDistr);
+ CheckGroupLayout->addWidget(CBDistr, 1, 0);
// RKV : End
if (!thePreview) {
CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), CheckGroup);
- CheckGroupLayout->addWidget( CBSave );
+ CheckGroupLayout->addWidget( CBSave, 1, 1 );
}
else {
CBSave = 0;
}
if(RBvert->isChecked()) {
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- myBarDlg->setLabelsFormat(aResourceMgr->stringValue("VISU", propertyName + "label_format", "%-#6.3g"));
+ int lp = aResourceMgr->integerValue( "VISU", propertyName + "scalar_bar_label_precision", 3 );
+ myBarDlg->setLabelsPrecision( lp );
+
myBarDlg->setUnitsVisible(aResourceMgr->booleanValue("VISU", propertyName + "display_units", true));
// signals and slots connections ===========================================
- // connect( RangeGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( changeRange( int ) ) );
connect( RBFrange, SIGNAL( toggled( bool ) ), this, SLOT( onFieldRange( bool ) ) );
connect( RBIrange, SIGNAL( toggled( bool ) ), this, SLOT( onImposedRange( bool ) ) );
if(orient == 0) {
sbX1=0.01;
sbY1=0.1;
- sbW=0.17;
+ sbW=0.1;
sbH=0.8;
} else {
- sbX1=0.2;
+ sbX1=0.1;
sbY1=0.01;
- sbW=0.6;
- sbH=0.12;
+ sbW=0.8;
+ sbH=0.08;
}
}
aTitleFont.setBold(isTitleBold);
aTitleFont.setItalic(isTitleItalic);
- aTitleFont.setUnderline(isTitleShadow);
+ aTitleFont.setOverline(isTitleShadow);
QString titleFontFamily;
switch (aTitleFontFamily) {
aLabelFont.setBold(isLabelBold);
aLabelFont.setItalic(isLabelItalic);
- aLabelFont.setUnderline(isLabelShadow);
+ aLabelFont.setOverline(isLabelShadow);
QString labelFontFamily;
switch (aLabelFontFamily) {
myScalarMap->GetBarOrientation());
if(RBvert->isChecked()) {
- myVerTW = myScalarMap->GetTitleWidth();
- myVerTH = myScalarMap->GetTitleHeight();
- myVerLW = myScalarMap->GetLabelWidth();
- myVerLH = myScalarMap->GetLabelHeight();
+ myVerTS = myScalarMap->GetTitleSize();
+ myVerLS = myScalarMap->GetLabelSize();
myVerBW = myScalarMap->GetBarWidth();
myVerBH = myScalarMap->GetBarHeight();
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- myHorTW = myScalarMap->GetTitleWidth();
- myHorTH = myScalarMap->GetTitleHeight();
- myHorLW = myScalarMap->GetLabelWidth();
- myHorLH = myScalarMap->GetLabelHeight();
+ myHorTS = myScalarMap->GetTitleSize();
+ myHorLS = myScalarMap->GetLabelSize();
myHorBW = myScalarMap->GetBarWidth();
myHorBH = myScalarMap->GetBarHeight();
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- myBarDlg->setLabelsFormat(myScalarMap->GetLabelsFormat());
+ myBarDlg->setLabelsPrecision( VISU::ToPrecision( myScalarMap->GetLabelsFormat() ) );
myBarDlg->setUnitsVisible(myScalarMap->IsUnitsVisible());
vtkFloatingPointType R, G, B;
myScalarMap->IsItalicLabel(),
myScalarMap->IsShadowLabel());
+ myHideBar->setChecked(!myScalarMap->IsBarVisible());
+
// Draw Preview
if (myPreviewCheck->isChecked()) {
createScalarBar();
VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar();
myPreviewActor->GetScalarBar()->VisibilityOn();
myPreviewActor->PickableOff();
+ //myPreviewActor->SetBarVisibility(!myHideBar->isChecked());
myScalarMapPL->SetScalarMode(myModeCombo->currentIndex());
if(isLogarithmic())
(isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
(isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
- int VerTW, VerTH, VerLW, VerLH, VerBW, VerBH;
- myBarDlg->getRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH);
- aScalarBarActor->SetRatios(VerTW, VerTH, VerLW, VerLH, VerBW, VerBH);
+ int VerTS, VerTH, VerLS, VerBW, VerBH;
+ myBarDlg->getRatios(VerTS, VerLS, VerBW, VerBH);
+ aScalarBarActor->SetRatios(VerTS, VerLS, VerBW, VerBH);
- aScalarBarActor->SetLabelFormat(myBarDlg->getLabelsFormat().toLatin1().data());
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ aScalarBarActor->SetLabelFormat( f.c_str() );
aScalarBarActor->Modified();
myScalarMap->SetPosition(XSpin->value(), YSpin->value());
myScalarMap->SetSize(WidthSpin->value(), HeightSpin->value());
if(RBvert->isChecked()) {
- myScalarMap->SetRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myScalarMap->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH);
} else {
- myScalarMap->SetRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myScalarMap->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH);
}
- myScalarMap->SetLabelsFormat(myBarDlg->getLabelsFormat().toLatin1().data());
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ myScalarMap->SetLabelsFormat( f.c_str() );
myScalarMap->SetUnitsVisible(myBarDlg->isUnitsVisible());
myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL);
myScalarMap->SetLabels(LabelSpin->value());
myScalarMap->SetIsDistributionVisible(isShowDistribution()); // RKV
+ myScalarMap->SetBarVisible(!myHideBar->isChecked());
+
if (isToSave()) storeToResources();
if (myIsStoreTextProp) {
void VisuGUI_ScalarBarPane::onBarPref()
{
if(RBvert->isChecked())
- myBarDlg->setRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->setRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->setRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->setRatios(myHorTS, myHorLS, myHorBW, myHorBH);
+ myBarDlg->setOrientation( getOrientation() );
if(myBarDlg->exec()) {
if(RBvert->isChecked())
- myBarDlg->getRatios(myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH);
+ myBarDlg->getRatios(myVerTS, myVerLS, myVerBW, myVerBH);
else
- myBarDlg->getRatios(myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH);
+ myBarDlg->getRatios(myHorTS, myHorLS, myHorBW, myHorBH);
updatePreview();
}
}
VisuGUI_BarPrefDlg (QWidget* parent);
~VisuGUI_BarPrefDlg() {};
- void setRatios(int titleRatioWidth, int titleRatioHeight,
- int labelRatioWidth, int labelRatioHeight,
+ void setRatios(int titleRatioSize, int labelRatioWidth,
int barRatioWidth, int barRatioHeight);
- void getRatios(int& titleRatioWidth, int& titleRatioHeight,
- int& labelRatioWidth, int& labelRatioHeight,
+ void getRatios(int& titleRatioSize, int& labelRatioWidth,
int& barRatioWidth, int& barRatioHeight);
void setUnitsVisible(bool isVisible);
bool isUnitsVisible();
- void setLabelsFormat( const QString& format);
- QString getLabelsFormat();
+ void setLabelsPrecision( const int p );
+ int getLabelsPrecision() const;
+
+ void setOrientation( const int ori );
+ int getOrientation() const;
+
private:
void keyPressEvent( QKeyEvent* e );
void onHelp();
protected:
- QSpinBox* TitleWidthSpin;
- QSpinBox* TitleHeightSpin;
- QSpinBox* LabelWidthSpin;
- QSpinBox* LabelHeightSpin;
- QSpinBox* BarWidthSpin;
- QSpinBox* BarHeightSpin;
- QCheckBox* CBUnits;
- QLineEdit* UnitsEdit;
-
- int myTitleWidth;
- int myTitleHeight;
- int myLabelWidth;
- int myLabelHeight;
+ QSpinBox* myTitleSizeSpin;
+ QSpinBox* myLabelSizeSpin;
+ QSpinBox* myBarWidthSpin;
+ QSpinBox* myBarHeightSpin;
+ QCheckBox* myUnitsChk;
+ QSpinBox* myPrecisionSpin;
+
+ int myTitleSize;
+ int myLabelSize;
int myBarWidth;
int myBarHeight;
bool myUnits;
- QString myUnitsFormat;
+ int myPrecision;
+ int myOrientation;
};
QCheckBox* CBSave;
QCheckBox* CBLog;
QCheckBox* CBDistr;
+ QCheckBox* myHideBar;
QLabel* myModeLbl;
QComboBox* myModeCombo;
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
- int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
- int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ int myHorTS, myHorLS, myHorBW, myHorBH;
+ int myVerTS, myVerTH, myVerLS, myVerBW, myVerBH;
bool myIsStoreTextProp;
private slots:
else if ( p == "isThereAreHiddenCurves" ) val = QVariant( findDisplayedCurves( ind, true ) );
else if ( p == "hasCurves" ) val = QVariant( hasCurves( ind ) );
else if ( p == "isPlot2dViewer" ) val = QVariant( Plot2dViewerType( ind ) );
+ else if ( p == "isValuesLabeled" ) val = QVariant( isValuesLabeled( ind ) );
}
return val;
return false;
}
+//----------------------------------------------------------------------------
+struct TIsValuesLabeled : TViewFunctor
+{
+ QString
+ virtual
+ get(VISU::Prs3d_i* thePrs3d,
+ SVTK_ViewWindow* theViewWindow,
+ VISU_Actor* theActor)
+ {
+ return theActor && theActor->GetValuesLabeled() ? "true" : "false";
+ }
+};
+
+QString VisuGUI_Selection::isValuesLabeled( const int ind ) const
+{
+ return TPopupDispatcher<TIsValuesLabeled>()(myModule, entry(ind));
+}
QString isShading( const int ) const;
QString isScalarMapAct( const int ) const;
bool isVisuComponent( const int ) const;
+ QString isValuesLabeled( const int ) const;
QString fullResolution( const int ) const;
QString mediumResolution( const int ) const;
#include "VISU_ColoredPrs3dFactory.hh"
#include "VISU_ViewManager_i.hh"
+#include "VISU_Prs3dUtils.hh"
#include <SVTK_ViewWindow.h>
#include <SALOME_Actor.h>
myVerY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. );
myVerW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. );
myVerH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. );
- myVerTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 );
- myVerTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 );
- myVerLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 );
- myVerLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 );
+ myVerTS = aResourceMgr->integerValue( "VISU", propertyName + "title_size", 0 );
+ myVerLS = aResourceMgr->integerValue( "VISU", propertyName + "label_size", 0 );
myVerBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 );
myVerBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 );
myHorY = aResourceMgr->doubleValue( "VISU", propertyName + "y", 0. );
myHorW = aResourceMgr->doubleValue( "VISU", propertyName + "width", 0. );
myHorH = aResourceMgr->doubleValue( "VISU", propertyName + "height", 0. );
- myHorTW = aResourceMgr->integerValue( "VISU", propertyName + "title_width", 0 );
- myHorTH = aResourceMgr->integerValue( "VISU", propertyName + "title_height", 0 );
- myHorLW = aResourceMgr->integerValue( "VISU", propertyName + "label_width", 0 );
- myHorLH = aResourceMgr->integerValue( "VISU", propertyName + "label_height", 0 );
+ myHorTS = aResourceMgr->integerValue( "VISU", propertyName + "title_size", 0 );
+ myHorLS = aResourceMgr->integerValue( "VISU", propertyName + "label_size", 0 );
myHorBW = aResourceMgr->integerValue( "VISU", propertyName + "bar_width", 0 );
myHorBH = aResourceMgr->integerValue( "VISU", propertyName + "bar_height", 0 );
QLabel* YLabel = new QLabel( tr( "LBL_Y" ), OriginGroup );
YSpin = new QtxDoubleSpinBox( 0.0, 1.0, 0.1, OriginGroup );
YSpin->setMinimumWidth( 70 );
- YSpin->setValue( 0.01 );
+ YSpin->setValue( 0.1 );
OriginGroupLayout->addWidget( XLabel );
OriginGroupLayout->addWidget( XSpin );
myBarDlg = new VisuGUI_BarPrefDlg( this );
if ( RBvert->isChecked() ) {
- myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->setRatios( myVerTS, myVerLS, myVerBW, myVerBH );
} else {
- myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ myBarDlg->setRatios( myHorTS, myHorLS, myHorBW, myHorBH );
}
- myBarDlg->setLabelsFormat( aResourceMgr->stringValue( "VISU", propertyName + "label_format", "%-#6.3g" ) );
+ int lp = aResourceMgr->integerValue( "VISU", propertyName + "scalar_bar_label_precision", 3 );
+ myBarDlg->setLabelsPrecision( lp );
+
myBarDlg->setUnitsVisible( aResourceMgr->booleanValue( "VISU", propertyName + "display_units", true ) );
// signals and slots connections ===========================================
void VisuGUI_TableScalarBarPane::onBarPref()
{
if ( RBvert->isChecked() )
- myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->setRatios( myVerTS, myVerLS, myVerBW, myVerBH );
else
- myBarDlg->setRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ myBarDlg->setRatios( myHorTS, myHorLS, myHorBW, myHorBH );
if ( myBarDlg->exec() ) {
if ( RBvert->isChecked() )
- myBarDlg->getRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->getRatios( myVerTS, myVerLS, myVerBW, myVerBH );
else
- myBarDlg->getRatios( myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH );
+ myBarDlg->getRatios( myHorTS, myHorLS, myHorBW, myHorBH );
}
}
myBarPrs->GetHeight(),
myBarPrs->GetBarOrientation() );
- myVerTW = myBarPrs->GetTitleWidth();
- myVerTH = myBarPrs->GetTitleHeight();
- myVerLW = myBarPrs->GetLabelWidth();
- myVerLH = myBarPrs->GetLabelHeight();
+ myVerTS = myBarPrs->GetTitleSize();
+ myVerLS = myBarPrs->GetLabelSize();
myVerBW = myBarPrs->GetBarWidth();
myVerBH = myBarPrs->GetBarHeight();
- myBarDlg->setRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ myBarDlg->setRatios( myVerTS, myVerLS, myVerBW, myVerBH );
- myBarDlg->setLabelsFormat( myBarPrs->GetLabelsFormat() );
+ myBarDlg->setLabelsPrecision( VISU::ToPrecision( myBarPrs->GetLabelsFormat() ) );
myBarDlg->setUnitsVisible( myBarPrs->IsUnitsVisible() );
myTextDlg->myTitleFont->SetData( QColor( (int)(R*255.), (int)(G*255.), (int)(B*255.) ),
myBarPrs->SetPosition( XSpin->value(), YSpin->value() );
myBarPrs->SetSize( WidthSpin->value(), HeightSpin->value() );
- myBarPrs->SetRatios( myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH );
+ if(RBvert->isChecked()) {
+ myBarPrs->SetRatios(myVerTS, myVerLS, myVerBW, myVerBH);
+ } else {
+ myBarPrs->SetRatios(myHorTS, myHorLS, myHorBW, myHorBH);
+ }
- myBarPrs->SetLabelsFormat( myBarDlg->getLabelsFormat().toLatin1().constData() );
+ std::string f = VISU::ToFormat( myBarDlg->getLabelsPrecision() );
+ myBarPrs->SetLabelsFormat( f.c_str() );
myBarPrs->SetUnitsVisible( myBarDlg->isUnitsVisible() );
myBarPrs->SetBarOrientation( ( RBvert->isChecked() )? VISU::ColoredPrs3dBase::VERTICAL : VISU::ColoredPrs3dBase::HORIZONTAL );
double myHorX, myHorY, myHorW, myHorH;
double myVerX, myVerY, myVerW, myVerH;
- int myHorTW, myHorTH, myHorLW, myHorLH, myHorBW, myHorBH;
- int myVerTW, myVerTH, myVerLW, myVerLH, myVerBW, myVerBH;
+ int myHorTS, myHorLS, myHorBW, myHorBH;
+ int myVerTS, myVerLS, myVerBW, myVerBH;
bool myIsStoreTextProp;
std::string myTitle;
switch (theType) {
case VISU::SHRINK:
if (aPrs3d) {
- if (anActor->IsShrunk())
- anActor->UnShrink();
- else
- anActor->SetShrink();
+ if (anActor->IsShrunk())
+ anActor->UnShrink();
+ else
+ anActor->SetShrink();
+ if (VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d)) {
+ aMesh->SetShrink(true);
+ }
} else if (aTable) {
if (anActorBase->IsShrunk())
anActorBase->UnShrink();
--- /dev/null
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : VisuGUI_ValuesLabelingDlg.cxx
+// Author : Litonin SERGEY
+// Module : SALOME
+
+#include "VisuGUI_ValuesLabelingDlg.h"
+#include "VisuGUI.h"
+
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+#include <QtxColorButton.h>
+#include <QtxFontEdit.h>
+#include <QVBoxLayout>
+
+/*!
+ \class VisuGUI_ValuesLabelingDlg
+ \brief This class is intended for changing parameters of labeling values
+ of 3D colored presentations
+*/
+
+/*!
+ \brief Constructor
+ \param theModule module
+*/
+VisuGUI_ValuesLabelingDlg::VisuGUI_ValuesLabelingDlg( SalomeApp_Module* theModule )
+: VisuGUI_Prs3dDlg( theModule )
+{
+ setWindowTitle( tr( "PARAMETERS_OF_VALUES_LABELING" ) );
+
+ // font groups
+
+ QGroupBox* aFGrp = new QGroupBox( tr( "LABELS" ), this );
+
+ QLabel* aFont = new QLabel( tr( "FONT" ) );
+ QLabel* aColor = new QLabel( tr( "COLOR" ) );
+ myFont = new QtxFontEdit( aFGrp );
+ myColor = new QtxColorButton( aFGrp );
+ myColor->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ QGridLayout* aFLay = new QGridLayout( aFGrp );
+ aFLay->setSpacing( 5 );
+ aFLay->setMargin( 5 );
+
+ aFLay->addWidget( aFont, 0, 0 );
+ aFLay->addWidget( myFont, 0, 1 );
+ aFLay->addWidget( aColor, 1, 0 );
+ aFLay->addWidget( myColor, 1, 1 );
+
+ // buttons
+
+ QGroupBox* aBtnGrp = new QGroupBox( this );
+ QGridLayout* aBtnLay = new QGridLayout( aBtnGrp );
+ aBtnLay->setAlignment( Qt::AlignTop );
+ aBtnLay->setSpacing( 5 );
+ aBtnLay->setMargin( 5 );
+
+ QPushButton* anOK = new QPushButton( tr("BUT_OK"), aBtnGrp );
+ anOK->setAutoDefault( true );
+ anOK->setDefault( true );
+ aBtnLay->addWidget( anOK, 0, 0 );
+ aBtnLay->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ QPushButton* aCancel = new QPushButton( tr("BUT_CANCEL") , aBtnGrp );
+ aCancel->setAutoDefault( true );
+ aBtnLay->addWidget( aCancel, 0, 2 );
+
+ QPushButton* aHelp = new QPushButton( tr("BUT_HELP") , aBtnGrp );
+ aHelp->setAutoDefault( true );
+ aBtnLay->addWidget( aHelp, 0, 3 );
+
+ myFont->setMode( QtxFontEdit::Custom );
+ myFont->setFeatures( QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic |
+ QtxFontEdit::Shadow | QtxFontEdit::UserSize | QtxFontEdit::Size );
+ QStringList fam;
+ fam.append( tr( "VISU_FONT_ARIAL" ) );
+ fam.append( tr( "VISU_FONT_COURIER" ) );
+ fam.append( tr( "VISU_FONT_TIMES" ) );
+ myFont->setFonts( fam );
+
+ // Layout widgets
+
+ QVBoxLayout* aMainLay = new QVBoxLayout( this );
+ aMainLay->setSpacing( 5 );
+ aMainLay->setMargin( 5 );
+ aMainLay->addWidget( aFGrp );
+ aMainLay->addWidget( aBtnGrp );
+
+ // Connect signals and slots
+ connect( anOK,SIGNAL( clicked() ), SLOT( accept() ) );
+ connect( aCancel, SIGNAL( clicked() ), SLOT( reject() ) );
+ connect( aHelp, SIGNAL( clicked() ), SLOT( onHelp() ) );
+
+ setFixedSize( minimumSizeHint() );
+}
+
+/*!
+ \brief Destructor
+*/
+VisuGUI_ValuesLabelingDlg::~VisuGUI_ValuesLabelingDlg()
+{
+}
+
+/*!
+ \brief Initializes dialog fields using specified presentation
+ \param thePrs presentation
+ \param theInit not used
+ \sa storeToPrsObject()
+*/
+void VisuGUI_ValuesLabelingDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool )
+{
+ if ( !thePrs )
+ return;
+
+ int aFType = thePrs->GetValLblFontType();
+
+ double aSize = thePrs->GetValLblFontSize();
+
+ bool isBold = thePrs->IsBoldValLbl();
+ bool isItalic = thePrs->IsItalicValLbl();
+ bool isShadow = thePrs->IsShadowValLbl();
+
+ vtkFloatingPointType aGRB[ 3 ];
+ thePrs->GetValLblFontColor( aGRB[ 0 ], aGRB[ 1 ], aGRB[ 2 ] );
+
+ // font
+ QFont aFont;
+
+ QString aFamily;
+ if ( aFType == VTK_ARIAL )
+ aFamily = "Arial";
+ else if ( aFType == VTK_COURIER )
+ aFamily = "Courier";
+ else if ( aFType == VTK_TIMES )
+ aFamily = "Times";
+
+ aFont.setFamily( aFamily );
+ aFont.setPointSize( aSize );
+ aFont.setBold( isBold );
+ aFont.setItalic( isItalic );
+ aFont.setOverline( isShadow );
+
+ myFont->setCurrentFont( aFont );
+
+ // color
+ QColor aColor( aGRB[ 0 ] * 255, aGRB[ 1 ] * 255, aGRB[ 2 ] * 255 );
+ myColor->setColor( aColor );
+}
+
+/*!
+ \brief Updates presentation in accordance with dialog input data
+ \param thePrs to be updated
+ \sa initFromPrsObject()
+*/
+int VisuGUI_ValuesLabelingDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
+{
+ if ( !thePrs )
+ return 0;
+
+ QFont aFont = myFont->currentFont();
+
+ // type
+ if ( aFont.family() == "Arial" )
+ thePrs->SetValLblFontType( VTK_ARIAL );
+ else if ( aFont.family() == "Courier" )
+ thePrs->SetValLblFontType( VTK_COURIER );
+ else if ( aFont.family() == "Times" )
+ thePrs->SetValLblFontType( VTK_TIMES );
+
+ // size
+ int aSize = aFont.pointSize();
+ if ( aSize > 0 )
+ thePrs->SetValLblFontSize( aSize );
+
+ // bold, italic, shadow
+ thePrs->SetBoldValLbl( aFont.bold() );
+ thePrs->SetItalicValLbl( aFont.italic() );
+ thePrs->SetShadowValLbl( aFont.overline() );
+
+ // color
+ QColor aColor = myColor->color();
+ thePrs->SetValLblFontColor(
+ aColor.red() / 255., aColor.green() / 255., aColor.blue() / 255. );
+
+ return 1;
+}
+
+/*!
+ \brief Gets help file name
+*/
+QString VisuGUI_ValuesLabelingDlg::GetContextHelpFilePath()
+{
+ return "values_labeling_page.html";
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : VisuGUI_ValuesLabelingDlg.h
+// Author : Sergey LITONIN
+// Module : SALOME
+
+#ifndef VisuGUI_ValuesLabelingDlg_H
+#define VisuGUI_ValuesLabelingDlg_H
+
+#include <VisuGUI_Prs3dDlg.h>
+
+class QtxFontEdit;
+class QtxColorButton;
+
+class VisuGUI_ValuesLabelingDlg : public VisuGUI_Prs3dDlg
+{
+ Q_OBJECT
+
+public:
+ VisuGUI_ValuesLabelingDlg( SalomeApp_Module* theModule );
+ ~VisuGUI_ValuesLabelingDlg();
+
+ virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool theInit );
+
+ virtual int storeToPrsObject( VISU::ColoredPrs3d_i* thePrs );
+
+protected:
+ virtual QString GetContextHelpFilePath();
+
+private:
+ QtxFontEdit* myFont;
+ QtxColorButton* myColor;
+};
+
+#endif // VisuGUI_ValuesLabelingDlg_H
+
+
+
+
+
+
+
+
+
+
+
+
+
+
SetUnitsVisible(anOrigin->IsUnitsVisible());
SetIsDistributionVisible(anOrigin->GetIsDistributionVisible());
- SetLabelsFormat(anOrigin->GetLabelsFormat());
-
+ SetLabelsFormat( anOrigin->GetLabelsFormat() );
+
SetBarOrientation(anOrigin->GetBarOrientation());
SetMinMaxController( anOrigin );
SetPosition(anOrigin->GetPosX(), anOrigin->GetPosY());
SetSize(anOrigin->GetWidth(), anOrigin->GetHeight());
- SetRatios(anOrigin->GetTitleWidth(), anOrigin->GetTitleHeight(),
- anOrigin->GetLabelWidth(), anOrigin->GetLabelHeight(),
+ SetRatios(anOrigin->GetTitleSize(), anOrigin->GetLabelSize(),
anOrigin->GetBarWidth(), anOrigin->GetBarHeight());
SetLabels(anOrigin->GetLabels());
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
-::SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
- CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+::SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize,
CORBA::Long theBarWidth, CORBA::Long theBarHeight)
{
- bool anIsSameValue = VISU::CheckIsSameValue(myTitleWidth, theTitleWidth);
- anIsSameValue &= VISU::CheckIsSameValue(myTitleHeight, theTitleHeight);
- anIsSameValue &= VISU::CheckIsSameValue(myLabelWidth, theLabelWidth);
- anIsSameValue &= VISU::CheckIsSameValue(myLabelHeight, theLabelHeight);
+ bool anIsSameValue = VISU::CheckIsSameValue(myTitleSize, theTitleSize);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelSize, theLabelSize);
anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
if(anIsSameValue)
VISU::TSetModified aModified(this);
- myTitleWidth = theTitleWidth;
- myTitleHeight = theTitleHeight;
- myLabelWidth = theLabelWidth;
- myLabelHeight = theLabelHeight;
+ myTitleSize = theTitleSize;
+ myLabelSize = theLabelSize;
myBarWidth = theBarWidth;
myBarHeight = theBarHeight;
myParamsTime.Modified();
//----------------------------------------------------------------------------
CORBA::Long
VISU::ColoredPrs3d_i
-::GetTitleWidth()
+::GetTitleSize()
{
- return myTitleWidth;
-}
-
-//----------------------------------------------------------------------------
-CORBA::Long
-VISU::ColoredPrs3d_i
-::GetTitleHeight()
-{
- return myTitleHeight;
+ return myTitleSize;
}
//----------------------------------------------------------------------------
CORBA::Long
VISU::ColoredPrs3d_i
-::GetLabelWidth()
+::GetLabelSize()
{
- return myLabelWidth;
-}
-
-//----------------------------------------------------------------------------
-CORBA::Long
-VISU::ColoredPrs3d_i
-::GetLabelHeight()
-{
- return myLabelHeight;
+ return myLabelSize;
}
//----------------------------------------------------------------------------
return myNumberOfLabels;
}
+//----------------------------------------------------------------------------
+
//----------------------------------------------------------------------------
void
VISU::ColoredPrs3d_i
SetIsDistributionVisible( aResourceMgr->booleanValue("VISU", "scalar_bar_show_distribution", false) ); // RKV
- QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" );
- SetLabelsFormat(aLabelsFormat.toLatin1().data());
+ int lp = aResourceMgr->integerValue( "VISU", "scalar_bar_label_precision", 3 );
+ SetLabelsFormat( VISU::ToFormat( lp ).c_str() );
// Orientation
int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
// Scalar Bar origin
QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" );
- vtkFloatingPointType aXorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.2;
+ vtkFloatingPointType aXorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.01 : 0.1;
aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin);
myPosition[0] = aXorigin;
- vtkFloatingPointType aYorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.012;
+ vtkFloatingPointType aYorigin = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL) ? 0.1 : 0.01;
aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin);
myPosition[1] = aYorigin;
// Scalar Bar size
- myWidth = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.1 : 0.6;
+ myWidth = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.08 : 0.8;
myWidth = aResourceMgr->doubleValue("VISU", propertyName + "width", myWidth);
- myHeight = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12;
+ myHeight = (myOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.08;
myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
- myTitleWidth = 0;
- myTitleWidth = aResourceMgr->integerValue("VISU", propertyName + "title_width", myTitleWidth);
-
- myTitleHeight = 0;
- myTitleHeight = aResourceMgr->integerValue("VISU", propertyName + "title_height", myTitleHeight);
+ myTitleSize = 0;
+ myTitleSize = aResourceMgr->integerValue("VISU", propertyName + "title_size", myTitleSize);
- myLabelWidth = 0;
- myLabelWidth = aResourceMgr->integerValue("VISU", propertyName + "label_width", myLabelWidth);
-
- myLabelHeight = 0;
- myLabelHeight = aResourceMgr->integerValue("VISU", propertyName + "label_height", myLabelHeight);
+ myLabelSize = 0;
+ myLabelSize = aResourceMgr->integerValue("VISU", propertyName + "label_size", myLabelSize);
myBarWidth = 0;
myBarWidth = aResourceMgr->integerValue("VISU", propertyName + "bar_width", myBarWidth);
myIsBoldTitle = f.bold();
myIsItalicTitle = f.italic();
- myIsShadowTitle = f.underline();
+ myIsShadowTitle = f.overline();
}
QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
myIsBoldLabel = f.bold();
myIsItalicLabel = f.italic();
- myIsShadowLabel = f.underline();
+ myIsShadowLabel = f.overline();
}
QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
myLabelColor[0] = aLabelColor.red() / 255.;
myLabelColor[1] = aLabelColor.green() / 255.;
myLabelColor[2] = aLabelColor.blue() / 255.;
+
+ // Parameters of labels displaed field values
+ myValLblFontType = VTK_ARIAL;
+ myIsBoldValLbl = true;
+ myIsItalicValLbl = myIsShadowValLbl = false;
+ myValLblFontSize = 12;
+ if( aResourceMgr->hasValue( "VISU", "values_labeling_font" ) )
+ {
+ // family
+ QFont f = aResourceMgr->fontValue( "VISU", "values_labeling_font" );
+ if ( f.family() == "Arial" )
+ myValLblFontType = VTK_ARIAL;
+ else if ( f.family() == "Courier" )
+ myValLblFontType = VTK_COURIER;
+ else if ( f.family() == "Times" )
+ myValLblFontType = VTK_TIMES;
+
+ // size
+ if ( f.pointSize() > -1 )
+ myValLblFontSize = f.pointSize();
+
+ // color
+ QColor aColor = aResourceMgr->colorValue(
+ "VISU", "values_labeling_color", QColor( 255, 255, 255 ) );
+ myValLblFontColor[ 0 ] = aColor.red() / 255.;
+ myValLblFontColor[ 1 ] = aColor.green() / 255.;
+ myValLblFontColor[ 2 ] = aColor.blue()/ 255.;
+
+ // bold, italic, shadow
+ myIsBoldValLbl = f.bold();
+ myIsItalicValLbl = f.italic();
+ myIsShadowValLbl = f.overline();
+ }
+
return this;
}
myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
- myTitleWidth = VISU::Storable::FindValue(theMap,"myTitleWidth").toInt();
- myTitleHeight = VISU::Storable::FindValue(theMap,"myTitleHeight").toInt();
- myLabelWidth = VISU::Storable::FindValue(theMap,"myLabelWidth").toInt();
- myLabelHeight = VISU::Storable::FindValue(theMap,"myLabelHeight").toInt();
+ myTitleSize = VISU::Storable::FindValue(theMap,"myTitleSize").toInt();
+ myLabelSize = VISU::Storable::FindValue(theMap,"myLabelSize").toInt();
myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
}
}
}
+
+ // Parameters of labels displayed field values
+
+ myValLblFontType = VISU::Storable::FindValue( theMap, "myValLblFontType", "0" ).toInt();
+ myIsBoldValLbl = VISU::Storable::FindValue( theMap, "myIsBoldValLbl", "1" ).toInt();
+ myIsItalicValLbl = VISU::Storable::FindValue( theMap, "myIsItalicValLbl", "0" ).toInt();
+ myIsShadowValLbl = VISU::Storable::FindValue( theMap, "myIsShadowValLbl", "0" ).toInt();
+ myValLblFontSize = VISU::Storable::FindValue( theMap, "myValLblFontSize", "12" ).toDouble();
+ myValLblFontColor[ 0 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[0]", "1" ).toFloat();
+ myValLblFontColor[ 1 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[1]", "1" ).toFloat();
+ myValLblFontColor[ 2 ] = VISU::Storable::FindValue( theMap, "myValLblFontColor[2]", "1" ).toFloat();
+
return this;
}
Storable::DataToStream( theStr, "myTitle", myTitle.c_str() );
Storable::DataToStream( theStr, "myUnitsVisible", myIsUnits );
Storable::DataToStream( theStr, "myNumberOfLabels", myNumberOfLabels );
+
Storable::DataToStream( theStr, "myLabelsFormat", myLabelsFormat.c_str() );
+
Storable::DataToStream( theStr, "myPosition[0]", myPosition[0] );
Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
Storable::DataToStream( theStr, "myWidth", myWidth );
Storable::DataToStream( theStr, "myHeight", myHeight );
- Storable::DataToStream( theStr, "myTitleWidth", myTitleWidth );
- Storable::DataToStream( theStr, "myTitleHeight", myTitleHeight );
- Storable::DataToStream( theStr, "myLabelWidth", myLabelWidth );
- Storable::DataToStream( theStr, "myLabelHeight", myLabelHeight );
+ Storable::DataToStream( theStr, "myTitleSize", myTitleSize );
+ Storable::DataToStream( theStr, "myLabelSize", myLabelSize );
Storable::DataToStream( theStr, "myBarWidth", myBarWidth );
Storable::DataToStream( theStr, "myBarHeight", myBarHeight );
Storable::DataToStream( theStr, "myLabelColor[0]", myLabelColor[0] );
Storable::DataToStream( theStr, "myLabelColor[1]", myLabelColor[1] );
Storable::DataToStream( theStr, "myLabelColor[2]", myLabelColor[2] );
+
+ // Parameters of labels displayed field values
+
+ Storable::DataToStream( theStr, "myValLblFontType", myValLblFontType );
+ Storable::DataToStream( theStr, "myIsBoldValLbl", myIsBoldValLbl );
+ Storable::DataToStream( theStr, "myIsItalicValLbl", myIsItalicValLbl );
+ Storable::DataToStream( theStr, "myIsShadowValLbl", myIsShadowValLbl );
+ Storable::DataToStream( theStr, "myValLblFontSize", myValLblFontSize );
+ Storable::DataToStream( theStr, "myValLblFontColor[0]", myValLblFontColor[ 0 ] );
+ Storable::DataToStream( theStr, "myValLblFontColor[1]", myValLblFontColor[ 1 ] );
+ Storable::DataToStream( theStr, "myValLblFontColor[2]", myValLblFontColor[ 2 ] );
+
std::ostringstream aGeomNameList;
std::string aMeshName = GetCMeshName();
}
//----------------------------------------------------------------------------
+
+
+int
+VISU::ColoredPrs3d_i
+::GetValLblFontType() const
+{
+ return myValLblFontType;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetValLblFontType( const int theType )
+{
+ if ( myValLblFontType == theType )
+ return;
+
+ VISU::TSetModified aModified( this );
+
+ myValLblFontType = theType;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+double
+VISU::ColoredPrs3d_i
+::GetValLblFontSize() const
+{
+ return myValLblFontSize;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetValLblFontSize( const double theSize )
+{
+ if ( VISU::CheckIsSameValue( myValLblFontSize, theSize ) )
+ return;
+
+ VISU::TSetModified aModified( this );
+
+ myValLblFontSize = theSize;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::GetValLblFontColor( vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB ) const
+{
+ theR = myValLblFontColor[ 0 ];
+ theG = myValLblFontColor[ 1 ];
+ theB = myValLblFontColor[ 2 ];
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetValLblFontColor( const vtkFloatingPointType theR,
+ const vtkFloatingPointType theG,
+ const vtkFloatingPointType theB )
+{
+ if ( VISU::CheckIsSameValue( myValLblFontColor[ 0 ], theR ) &&
+ VISU::CheckIsSameValue( myValLblFontColor[ 1 ], theG ) &&
+ VISU::CheckIsSameValue (myValLblFontColor[ 2 ], theB ) )
+ return;
+
+ VISU::TSetModified aModified(this);
+
+ myValLblFontColor[ 0 ] = theR;
+ myValLblFontColor[ 1 ] = theG;
+ myValLblFontColor[ 2 ] = theB;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+bool
+VISU::ColoredPrs3d_i
+::IsBoldValLbl() const
+{
+ return myIsBoldValLbl;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetBoldValLbl( const bool theVal )
+{
+ if ( myIsBoldValLbl == theVal )
+ return;
+
+ VISU::TSetModified aModified( this );
+
+ myIsBoldValLbl = theVal;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+bool
+VISU::ColoredPrs3d_i
+::IsItalicValLbl() const
+{
+ return myIsItalicValLbl;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetItalicValLbl( const bool theVal )
+{
+ if ( myIsItalicValLbl == theVal )
+ return;
+
+ VISU::TSetModified aModified( this );
+
+ myIsItalicValLbl = theVal;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
+bool
+VISU::ColoredPrs3d_i
+::IsShadowValLbl() const
+{
+ return myIsShadowValLbl;
+}
+
+//----------------------------------------------------------------------------
+
+void
+VISU::ColoredPrs3d_i
+::SetShadowValLbl( const bool theVal )
+{
+ if ( myIsShadowValLbl == theVal )
+ return;
+
+ VISU::TSetModified aModified( this );
+
+ myIsShadowValLbl = theVal;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+
virtual
void
- SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
- CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize,
CORBA::Long theBarWidth, CORBA::Long theBarHeight);
virtual
virtual
CORBA::Long
- GetTitleWidth();
-
- virtual
- CORBA::Long
- GetTitleHeight();
+ GetTitleSize();
virtual
CORBA::Long
- GetLabelWidth();
-
- virtual
- CORBA::Long
- GetLabelHeight();
+ GetLabelSize();
virtual
CORBA::Long
return myColoredPL;
}
+ virtual
+ int
+ GetValLblFontType() const;
+
+ virtual
+ void
+ SetValLblFontType( const int theType );
+
+ virtual
+ double
+ GetValLblFontSize() const;
+
+ virtual
+ void
+ SetValLblFontSize( const double theSize );
+
+ virtual
+ bool
+ IsBoldValLbl() const;
+
+ virtual
+ void
+ SetBoldValLbl( const bool theVal );
+
+ virtual
+ bool
+ IsItalicValLbl() const;
+
+ virtual
+ void
+ SetItalicValLbl( const bool theVal );
+
+ virtual
+ bool
+ IsShadowValLbl() const;
+
+ virtual
+ void
+ SetShadowValLbl( const bool theVal );
+
+ virtual
+ void
+ GetValLblFontColor( vtkFloatingPointType& theR,
+ vtkFloatingPointType& theG,
+ vtkFloatingPointType& theB ) const;
+
+ virtual
+ void
+ SetValLblFontColor( const vtkFloatingPointType theR,
+ const vtkFloatingPointType theG,
+ const vtkFloatingPointType theB );
+
//----------------------------------------------------------------------------
protected:
/*!
int myNumberOfLabels;
std::string myLabelsFormat;
+
VISU::ColoredPrs3dBase::Orientation myOrientation;
vtkFloatingPointType myPosition[2],
myWidth, myHeight,
- myTitleWidth, myTitleHeight,
- myLabelWidth, myLabelHeight,
+ myTitleSize, myLabelSize,
myBarWidth, myBarHeight;
//Font management
bool myIsDistributionVisible; // RKV
+ // Result labels
+ int myValLblFontType;
+ double myValLblFontSize;
+ bool myIsBoldValLbl;
+ bool myIsItalicValLbl;
+ bool myIsShadowValLbl;
+ vtkFloatingPointType myValLblFontColor[ 3 ];
};
aParam = "VISU.LOGARITHMIC";
break;
}
+ std::string aVisible = theServant->IsBarVisible()? "True" : "False";
theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
+ theStr<<thePrefix<<theName<<".SetBarVisible("<<aVisible<<")"<<endl;
return thePrefix;
}
break;
}
theStr<<thePrefix<<aName<<".SetPresentationType("<<aParam<<")"<<endl;
+ theStr<<thePrefix<<aName<<".SetShrink("<<(aServant->IsShrank()? "True" : "False")<<")"<<endl;
theStr<<thePrefix<<endl;
DumpChildrenToPython(theStudy,
theScalarBar->SetTitle(GetScalarBarTitle().c_str());
theScalarBar->SetOrientation(GetBarOrientation());
theScalarBar->SetNumberOfLabels(GetLabels());
- theScalarBar->SetRatios(GetTitleWidth(), GetTitleHeight(),
- GetLabelWidth(), GetLabelHeight(),
+ theScalarBar->SetRatios(GetTitleSize(), GetLabelSize(),
GetBarWidth(), GetBarHeight());
theScalarBar->SetLabelFormat(GetLabelsFormat());
theActor->SetRepresentation( VTK_POINTS );
else
theActor->SetRepresentation( VTK_SURFACE );
+
+ // Update values labels
+
+ vtkTextProperty* aProp = anActor->GetsValLabelsProps();
+ if ( aProp )
+ {
+ aProp->SetFontFamily( GetValLblFontType() );
+ aProp->SetFontSize( GetValLblFontSize() );
+ aProp->SetBold( IsBoldValLbl() );
+ aProp->SetItalic( IsItalicValLbl() );
+ aProp->SetShadow( IsShadowValLbl() );
+
+ vtkFloatingPointType anRGB[ 3 ];
+ GetValLblFontColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+ aProp->SetColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+ }
}
+
TSuperClass::UpdateActor(theActor);
}
SetMeshName(theMeshName.c_str());
myEntity = int(theEntity);//jfa IPAL9284
mySubMeshName = theFamilyName;
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ myIsShrank = aResourceMgr->booleanValue("VISU", "mesh_shrink", false);
return Build(false);
}
throw std::runtime_error("Mesh_i::Build - GetCResult()->GetInput() == NULL !!!");
if (!theRestoring) {
myPresentType = VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2));
+ myIsShrank = (myPresentType == VISU::SHRINK);
+
if(myEntity == VISU::NODE_ENTITY)
myPresentType = VISU::POINT;
SetName((const char*)GenerateName().toLatin1(), false);
return;
VISU::TSetModified aModified(this);
-
+ if (theType == VISU::SHRINK) {
+ myIsShrank = true;
+ }
myPresentType = theType;
myParamsTime.Modified();
}
myPresentType = VISU::PresentationType(VISU::Storable::FindValue(theMap,"myPresentType").toInt());
+ myIsShrank = (VISU::Storable::FindValue(theMap,"myIsShrank", "0").toInt() == 1)? true: false;
+
myCellColor.R = VISU::Storable::FindValue(theMap,"myCellColor.R").toDouble();
myCellColor.G = VISU::Storable::FindValue(theMap,"myCellColor.G").toDouble();
myCellColor.B = VISU::Storable::FindValue(theMap,"myCellColor.B").toDouble();
Storable::DataToStream( theStr, "myPresentType", int(myPresentType) );
+ Storable::DataToStream( theStr, "myIsShrank", (myIsShrank? "1":"0"));
+
Storable::DataToStream( theStr, "myCellColor.R", myCellColor.R );
Storable::DataToStream( theStr, "myCellColor.G", myCellColor.G );
Storable::DataToStream( theStr, "myCellColor.B", myCellColor.B );
try{
VISU::Prs3d_i::CreateActor(anActor);
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
- bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false);
- if (toShrink) anActor->SetShrink();
-
+ //bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false);
+ //if (toShrink) anActor->SetShrink();
+ if (anActor->IsShrunkable()) {
+ if (myIsShrank)
+ anActor->SetShrink();
+ else
+ anActor->UnShrink();
+ }
anActor->SetFeatureEdgesAngle( aResourceMgr->doubleValue("VISU", "feature_edges_angle", 0.0) );
anActor->SetFeatureEdgesFlags( aResourceMgr->booleanValue("VISU", "show_feature_edges", false),
aResourceMgr->booleanValue("VISU", "show_boundary_edges", false),
if(MYDEBUG) MESSAGE("Mesh_i::UpdateActor");
VISU::Prs3d_i::UpdateActor(anActor);
anActor->SetRepresentation(myPresentType);
+ if (anActor->IsShrunkable()) {
+ if (myIsShrank)
+ anActor->SetShrink();
+ else
+ anActor->UnShrink();
+ }
anActor->GetSurfaceProperty()->SetColor(myCellColor.R, myCellColor.G, myCellColor.B);
anActor->GetEdgeProperty()->SetColor(myLinkColor.R, myLinkColor.G, myLinkColor.B);
anActor->GetNodeProperty()->SetColor(myNodeColor.R, myNodeColor.G, myNodeColor.B);
}
//----------------------------------------------------------------------------
+
+
+void VISU::Mesh_i::SetShrink(CORBA::Boolean toShrink)
+{
+ if(toShrink == myIsShrank)
+ return;
+ VISU::TSetModified aModified(this);
+ myIsShrank = toShrink;
+ myParamsTime.Modified();
+}
+
+//----------------------------------------------------------------------------
+CORBA::Boolean VISU::Mesh_i::IsShrank()
+{
+ return myIsShrank;
+}
+
VISU::PresentationType
GetPresentationType();
+
+ virtual void SetShrink(CORBA::Boolean toShrink);
+
+ virtual CORBA::Boolean IsShrank();
+
VISU_MeshPL* GetSpecificPL() const
{
return myMeshPL;
SALOMEDS::Color myCellColor;
SALOMEDS::Color myNodeColor;
SALOMEDS::Color myLinkColor;
+ bool myIsShrank;
public:
static
SetRange(aMin, aMax);
}
- QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" );
- SetLabelsFormat(aLabelsFormat.toLatin1().constData());
+ int lp = aResourceMgr->integerValue( "VISU", "scalar_bar_label_precision", 3 );
+ SetLabelsFormat( VISU::ToFormat( lp ).c_str() );
// Orientation
int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0);
myHeight = (myBarOrientation == VISU::ColoredPrs3dBase::VERTICAL)? 0.8:0.12;
myHeight = aResourceMgr->doubleValue("VISU", propertyName + "height", myHeight);
- myTitleWidth = aResourceMgr->doubleValue("VISU", propertyName + "title_width", 0);
- myTitleHeight = aResourceMgr->doubleValue("VISU", propertyName + "title_height", 0);
- myLabelWidth = aResourceMgr->doubleValue("VISU", propertyName + "label_width", 0);
- myLabelHeight = aResourceMgr->doubleValue("VISU", propertyName + "label_height", 0);
+ myTitleSize = aResourceMgr->doubleValue("VISU", propertyName + "title_size", 0);
+ myLabelSize = aResourceMgr->doubleValue("VISU", propertyName + "label_size", 0);
myBarWidth = aResourceMgr->doubleValue("VISU", propertyName + "bar_width", 0);
myBarHeight = aResourceMgr->doubleValue("VISU", propertyName + "bar_height", 0);
myIsBoldTitle = f.bold();
myIsItalicTitle = f.italic();
- myIsShadowTitle = f.underline();
+ myIsShadowTitle = f.overline();
}
QColor aTextColor = aResourceMgr->colorValue( "VISU", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
myIsBoldLabel = f.bold();
myIsItalicLabel = f.italic();
- myIsShadowLabel = f.underline();
+ myIsShadowLabel = f.overline();
}
QColor aLabelColor = aResourceMgr->colorValue( "VISU", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
aScalarBar->SetWidth(GetWidth());
aScalarBar->SetHeight(GetHeight());
aScalarBar->SetNumberOfLabels(GetLabels());
- aScalarBar->SetRatios(myTitleWidth, myTitleHeight,
- myLabelWidth, myLabelHeight,
+ aScalarBar->SetRatios(myTitleSize, myLabelSize,
myBarWidth, myBarHeight);
aScalarBar->SetNumberOfLabels(GetLabels());
aScalarBar->SetLabelFormat(GetLabelsFormat());
myPosition[1] = VISU::Storable::FindValue(theMap,"myPosition[1]").toDouble();
myWidth = VISU::Storable::FindValue(theMap,"myWidth").toDouble();
myHeight = VISU::Storable::FindValue(theMap,"myHeight").toDouble();
- myTitleWidth = VISU::Storable::FindValue(theMap,"myTitleWidth").toInt();
- myTitleHeight = VISU::Storable::FindValue(theMap,"myTitleHeight").toInt();
- myLabelWidth = VISU::Storable::FindValue(theMap,"myLabelWidth").toInt();
- myLabelHeight = VISU::Storable::FindValue(theMap,"myLabelHeight").toInt();
+ myTitleSize = VISU::Storable::FindValue(theMap,"myTitleSize").toInt();
+ myLabelSize = VISU::Storable::FindValue(theMap,"myLabelSize").toInt();
myBarWidth = VISU::Storable::FindValue(theMap,"myBarWidth").toInt();
myBarHeight = VISU::Storable::FindValue(theMap,"myBarHeight").toInt();
Storable::DataToStream( theStr, "myPosition[1]", myPosition[1] );
Storable::DataToStream( theStr, "myWidth", myWidth );
Storable::DataToStream( theStr, "myHeight", myHeight );
- Storable::DataToStream( theStr, "myTitleWidth", myTitleWidth );
- Storable::DataToStream( theStr, "myTitleHeight", myTitleHeight );
- Storable::DataToStream( theStr, "myLabelWidth", myLabelWidth );
- Storable::DataToStream( theStr, "myLabelHeight", myLabelHeight );
+ Storable::DataToStream( theStr, "myTitleSize", myTitleSize );
+ Storable::DataToStream( theStr, "myLabelSize", myLabelSize );
Storable::DataToStream( theStr, "myBarWidth", myBarWidth );
Storable::DataToStream( theStr, "myBarHeight", myBarHeight );
}
//----------------------------------------------------------------------------
-CORBA::Long VISU::PointMap3d_i::GetTitleWidth()
+CORBA::Long VISU::PointMap3d_i::GetTitleSize()
{
- return myTitleWidth;
+ return myTitleSize;
}
//----------------------------------------------------------------------------
-CORBA::Long VISU::PointMap3d_i::GetTitleHeight()
-{
- return myTitleHeight;
-}
-
-//----------------------------------------------------------------------------
-CORBA::Long VISU::PointMap3d_i::GetLabelWidth()
+CORBA::Long VISU::PointMap3d_i::GetLabelSize()
{
- return myLabelWidth;
-}
-
-//----------------------------------------------------------------------------
-CORBA::Long VISU::PointMap3d_i::GetLabelHeight()
-{
- return myLabelHeight;
+ return myLabelSize;
}
//----------------------------------------------------------------------------
}
//----------------------------------------------------------------------------
-void VISU::PointMap3d_i::SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
- CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+void VISU::PointMap3d_i::SetRatios(CORBA::Long theTitleSize,
+ CORBA::Long theLabelSize,
CORBA::Long theBarWidth, CORBA::Long theBarHeight)
{
- bool anIsSameValue = VISU::CheckIsSameValue(myTitleWidth, theTitleWidth);
- anIsSameValue &= VISU::CheckIsSameValue(myTitleHeight, theTitleHeight);
- anIsSameValue &= VISU::CheckIsSameValue(myLabelWidth, theLabelWidth);
- anIsSameValue &= VISU::CheckIsSameValue(myLabelHeight, theLabelHeight);
+ bool anIsSameValue = VISU::CheckIsSameValue(myTitleSize, theTitleSize);
+ anIsSameValue &= VISU::CheckIsSameValue(myLabelSize, theLabelSize);
anIsSameValue &= VISU::CheckIsSameValue(myBarWidth, theBarWidth);
anIsSameValue &= VISU::CheckIsSameValue(myBarHeight, theBarHeight);
if(anIsSameValue)
return;
- myTitleWidth = theTitleWidth;
- myTitleHeight = theTitleHeight;
- myLabelWidth = theLabelWidth;
- myLabelHeight = theLabelHeight;
+ myTitleSize = theTitleSize;
+ myLabelSize = theLabelSize;
myBarWidth = theBarWidth;
myBarHeight = theBarHeight;
myParamsTime.Modified();
virtual void SetSize(CORBA::Double theWidth, CORBA::Double theHeight);
- virtual void SetRatios(CORBA::Long theTitleWidth, CORBA::Long theTitleHeight,
- CORBA::Long theLabelWidth, CORBA::Long theLabelHeight,
+ virtual void SetRatios(CORBA::Long theTitleSize, CORBA::Long theLabelSize,
CORBA::Long theBarWidth, CORBA::Long theBarHeight);
virtual CORBA::Double GetWidth();
virtual void SetLabelsFormat(const char* theFormat);
virtual char* GetLabelsFormat();
-
+
virtual void SetBarOrientation(VISU::ColoredPrs3dBase::Orientation theOrientation);
virtual VISU::ColoredPrs3dBase::Orientation GetBarOrientation();
vtkFloatingPointType theB);
//-------------------------------------------------------------------
- virtual CORBA::Long GetTitleWidth();
- virtual CORBA::Long GetTitleHeight();
- virtual CORBA::Long GetLabelWidth();
- virtual CORBA::Long GetLabelHeight();
+ virtual CORBA::Long GetTitleSize();
+ virtual CORBA::Long GetLabelSize();
virtual CORBA::Long GetBarWidth();
virtual CORBA::Long GetBarHeight();
std::string myLabelsFormat;
vtkFloatingPointType myPosition[2],
myWidth, myHeight,
- myTitleWidth, myTitleHeight,
- myLabelWidth, myLabelHeight,
+ myTitleSize,
+ myLabelSize,
myBarWidth, myBarHeight;
bool myIsFixedRange;
CORBA::Float myOffset[3];
ProcessVoidEvent(new TEvent(this));
}
+ //----------------------------------------------------------------------------
+
+ std::string ToFormat( const int thePrec )
+ {
+ // "%-#6.3g"
+ char str[ 255 ];
+ sprintf( str, "%%-#.%dg", thePrec );
+ return str;
+ }
//----------------------------------------------------------------------------
+
+ int ToPrecision( const char* theFormat )
+ {
+ int N = strlen( theFormat );
+ int k = -1;
+ char str[ 255 ];
+ bool isOk = false;
+ for ( int i = 0; i < N; i++ )
+ {
+ if ( theFormat[ i ] == '.' )
+ k = 0;
+ else if ( theFormat[ i ] == 'g' )
+ {
+ str[ k ] = 0;
+ isOk = true;
+ break;
+ }
+ else if ( k >= 0 )
+ str[ k++ ] = theFormat[ i ];
+ }
+
+ int res = 0;
+ if ( isOk )
+ res = atoi( str );
+
+ return res;
+ }
};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#include <vtkTimeStamp.h>
-
namespace VISU
{
//----------------------------------------------------------------------------
~TSetModified();
};
+ Standard_EXPORT std::string ToFormat( const int thePrec );
+ Standard_EXPORT int ToPrecision( const char* theFormat );
+
//----------------------------------------------------------------------------
}
//----------------------------------------------------------------------------
VISU::ScalarMap_i::
ScalarMap_i(EPublishInStudyMode thePublishInStudyMode) :
- ColoredPrs3d_i(thePublishInStudyMode)
+ ColoredPrs3d_i(thePublishInStudyMode),
+ myShowBar(true)
{}
//----------------------------------------------------------------------------
ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(aPrs3d);
SetScaling(anOrigin->GetScaling());
-
+ SetBarVisible(anOrigin->IsBarVisible());
Update();
}
}
else
SetScaling(VISU::LINEAR);
+ myShowBar = true;
return this;
}
SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt()));
+ QString aVal = VISU::Storable::FindValue(theMap,"myShowBar", "1");
+ SetBarVisible((aVal.toInt() == 1)? true : false);
+
// Check if the icon needs to be updated, update if necessary
SALOMEDS::Study_var aStudy = theSObject->GetStudy();
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
TSuperClass::ToStream(theStr);
Storable::DataToStream( theStr, "myScaling", GetScaling() );
+ Storable::DataToStream( theStr, "myShowBar", (IsBarVisible()? 1:0) );
}
return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true);
}
+void VISU::ScalarMap_i::SetBarVisible(CORBA::Boolean theVisible)
+{
+ if (myShowBar == theVisible)
+ return;
+ VISU::TSetModified aModified(this);
+ myShowBar = theVisible;
+ myParamsTime.Modified();
+}
//----------------------------------------------------------------------------
void
VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New();
try{
TSuperClass::CreateActor(anActor);
- anActor->SetBarVisibility(true);
+ anActor->SetBarVisibility(myShowBar);
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
int aDispMode = aResourceMgr->integerValue("VISU", "scalar_map_represent", 2);
bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false);
aScalarBar->GetPositionCoordinate()->SetValue(GetPosX(),GetPosY());
aScalarBar->SetWidth(GetWidth());
aScalarBar->SetHeight(GetHeight());
- aScalarBar->SetRatios(GetTitleWidth(), GetTitleHeight(),
- GetLabelWidth(), GetLabelHeight(),
+ aScalarBar->SetRatios(GetTitleSize(), GetLabelSize(),
GetBarWidth(), GetBarHeight());
aScalarBar->SetNumberOfLabels(GetLabels());
aScalarBar->SetLabelFormat(GetLabelsFormat());
IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
+ anActor->SetBarVisibility(myShowBar);
+
aScalarBar->Modified();
+
+ // Update values labels
+
+ vtkTextProperty* aProp = anActor->GetsValLabelsProps();
+ if ( aProp )
+ {
+ aProp->SetFontFamily( GetValLblFontType() );
+ aProp->SetFontSize( GetValLblFontSize() );
+ aProp->SetBold( IsBoldValLbl() );
+ aProp->SetItalic( IsItalicValLbl() );
+ aProp->SetShadow( IsShadowValLbl() );
+
+ vtkFloatingPointType anRGB[ 3 ];
+ GetValLblFontColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+ aProp->SetColor( anRGB[ 0 ], anRGB[ 1 ], anRGB[ 2 ] );
+ }
}
TSuperClass::UpdateActor(theActor);
}
{
return myScalarMapPL;
}
+
+ virtual CORBA::Boolean IsBarVisible() { return myShowBar; }
+
+ virtual void SetBarVisible(CORBA::Boolean theVisible);
protected:
//! Redefines VISU_ColoredPrs3d_i::DoSetInput
private:
VISU_ScalarMapPL* myScalarMapPL;
+ bool myShowBar;
};
}