<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,Shadow,12"/>
- <parameter name="scalar_bar_label_precision" value="3" />
+ <parameter name="scalar_bar_label_precision" value="6" />
<parameter name="scalar_bar_logarithmic" value="false"/>
<!-- RKV : Begin -->
<!-- Do filter by scalars or don't -->
<parameter name="sweeping_time_step" value="0.2" />
<parameter name="sweeping_modes" value="0" />
<parameter name="sweeping_is2PI" value="0" />
- <parameter name="speed" value="1"/>
- <parameter name="cycled_animation" value="false"/>
- <parameter name="use_proportional_timing" value="false"/>
+ <parameter name="speed" value="1"/>
+ <parameter name="cycled_animation" value="false"/>
+ <parameter name="use_proportional_timing" value="false"/>
<parameter name="clean_memory_at_each_frame" value="false"/>
<parameter name="mouse_behaviour" value="0" />
<parameter name="speed_increment" value="10" />
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// VISU OBJECT : interactive object for VISU entities implementation
-// File :
-// Author :
+// File :
+// Author :
// Module : VISU
#include "VISU_Actor.h"
+#include "VISU_ActorFactory.h"
#include "VISU_PickingSettings.h"
#include "VISU_GaussPtsDeviceActor.h"
#include "VTKViewer_FramedTextActor.h"
#include "VTKViewer_ShrinkFilter.h"
#include "VTKViewer_GeometryFilter.h"
-#include "VISU_ActorFactory.h"
+
#include "SALOME_InteractiveObject.hxx"
-
+
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+
#include <stdexcept>
#include <sstream>
myFeatureEdges->Delete();
myEventCallbackCommand->Delete();
- myEventCallbackCommand->SetClientData(this);
+ myEventCallbackCommand->SetClientData(this);
myEventCallbackCommand->SetCallback(VISU_Actor::ProcessEvents);
if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() )
- aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
-
+ aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+
//Definition of values labeling pipeline
myValLblDataSet = vtkUnstructuredGrid::New();
myValMaskPoints = vtkMaskPoints::New();
myValMaskPoints->SetInput(myValCellCenters->GetOutput());
myValMaskPoints->SetOnRatio(1);
-
+
myValSelectVisiblePoints = vtkSelectVisiblePoints::New();
myValSelectVisiblePoints->SetInput(myValMaskPoints->GetOutput());
myValSelectVisiblePoints->SelectInvisibleOff();
myValSelectVisiblePoints->SetTolerance(0.1);
-
+
+ char aFormat[16] = "%g";
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ if (aResourceMgr) {
+ int aFloatingPrec = aResourceMgr->integerValue("VISU", "floating_point_precision", 6);
+ sprintf(aFormat, "%%.%dg", aFloatingPrec);
+ //cout << "$$$ aFormat = " << aFormat << endl;
+ }
+
myValLabeledDataMapper = vtkLabeledDataMapper::New();
myValLabeledDataMapper->SetInput(myValSelectVisiblePoints->GetOutput());
- myValLabeledDataMapper->SetLabelFormat("%g");
+ //myValLabeledDataMapper->SetLabelFormat("%g");
+ //myValLabeledDataMapper->SetLabelFormat("%.20g");
+ myValLabeledDataMapper->SetLabelFormat(aFormat);
myValLabeledDataMapper->SetLabelModeToLabelScalars();
-
+
vtkTextProperty* aClsTextProp = vtkTextProperty::New();
aClsTextProp->SetFontFamilyToTimes();
static int aCellsFontSize = 12;
aClsTextProp->SetShadow(0);
myValLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
aClsTextProp->Delete();
-
+
myIsValLabeled = false;
myValLabels = vtkActor2D::New();
}
//----------------------------------------------------------------------------
-void
+void
VISU_Actor
::setIO(const Handle(SALOME_InteractiveObject)& theIO)
{
- Superclass::setIO(theIO);
- myName = theIO->getName();
+ Superclass::setIO(theIO);
+ myName = theIO->getName();
}
//----------------------------------------------------------------------------
-void
+void
VISU_Actor
::SetPrs3d(VISU::Prs3d_i* thePrs3d)
-{
+{
myPrs3d = thePrs3d;
}
-VISU::Prs3d_i*
+VISU::Prs3d_i*
VISU_Actor
::GetPrs3d()
-{
+{
return myPrs3d;
}
//----------------------------------------------------------------------------
void
VISU_Actor
-::SetPipeLine(VISU_PipeLine* thePipeLine)
+::SetPipeLine(VISU_PipeLine* thePipeLine)
{
myPipeLine = thePipeLine;
if(thePipeLine){
if(vtkMapper *aMapper = myPipeLine->GetMapper()){
if(vtkDataSet *aDataSet = aMapper->GetInput()){
- SetShrinkable(thePipeLine->IsShrinkable());
- SetFeatureEdgesAllowed(thePipeLine->IsFeatureEdgesAllowed());
- SetMapperInput(aDataSet);
+ SetShrinkable(thePipeLine->IsShrinkable());
+ SetFeatureEdgesAllowed(thePipeLine->IsFeatureEdgesAllowed());
+ SetMapperInput(aDataSet);
}
}
}
this->Modified();
}
-VISU_PipeLine*
+VISU_PipeLine*
VISU_Actor
-::GetPipeLine()
-{
+::GetPipeLine()
+{
return myPipeLine.GetPointer();
}
-VISU_PipeLine*
+VISU_PipeLine*
VISU_Actor
-::GetCurrentPL()
-{
+::GetCurrentPL()
+{
return GetPipeLine();
}
//----------------------------------------------------------------------------
void
VISU_Actor
-::SetRepresentation(int theMode)
-{
+::SetRepresentation(int theMode)
+{
Superclass::SetRepresentation(theMode);
if(myRepresentation == VTK_POINTS)
{
VISU_Actor
::SetShrink()
{
- if(!myIsShrinkable)
+ if(!myIsShrinkable)
return;
if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
myShrinkFilter->SetInput(aDataSet);
VISU_Actor
::UnShrink()
{
- if(!myIsShrunk)
+ if(!myIsShrunk)
return;
if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){
myPassFilter[1]->SetInput(aDataSet);
bool
VISU_Actor
-::IsShrunkable()
-{
+::IsShrunkable()
+{
return myIsShrinkable;
}
//----------------------------------------------------------------------------
bool
VISU_Actor
-::IsFeatureEdgesAllowed()
-{
+::IsFeatureEdgesAllowed()
+{
return myIsFeatureEdgesAllowed;
}
VISU_Actor
::SetFeatureEdgesEnabled(bool theIsFeatureEdgesEnabled)
{
- if ( !myIsFeatureEdgesAllowed || myIsFeatureEdgesEnabled == theIsFeatureEdgesEnabled )
+ if ( !myIsFeatureEdgesAllowed || myIsFeatureEdgesEnabled == theIsFeatureEdgesEnabled )
return;
if ( vtkPolyData* aPolyData = myPassFilter[ 2 ]->GetPolyDataOutput() )
void
VISU_Actor
::GetFeatureEdgesFlags(bool& theIsFeatureEdges,
- bool& theIsBoundaryEdges,
- bool& theIsManifoldEdges,
- bool& theIsNonManifoldEdges)
+ bool& theIsBoundaryEdges,
+ bool& theIsManifoldEdges,
+ bool& theIsNonManifoldEdges)
{
theIsFeatureEdges = myFeatureEdges->GetFeatureEdges();
theIsBoundaryEdges = myFeatureEdges->GetBoundaryEdges();
void
VISU_Actor
::SetFeatureEdgesFlags(bool theIsFeatureEdges,
- bool theIsBoundaryEdges,
- bool theIsManifoldEdges,
- bool theIsNonManifoldEdges)
+ bool theIsBoundaryEdges,
+ bool theIsManifoldEdges,
+ bool theIsNonManifoldEdges)
{
myFeatureEdges->SetFeatureEdges(theIsFeatureEdges);
myFeatureEdges->SetBoundaryEdges(theIsBoundaryEdges);
vtkFloatingPointType
VISU_Actor
::GetOpacity()
-{
+{
return GetProperty()->GetOpacity();
}
theRenderer->RemoveActor(myAnnotationActor.GetPointer());
theRenderer->RemoveActor(myTextActor.GetPointer());
theRenderer->RemoveActor(myValLabels);
- Superclass::RemoveFromRender(theRenderer);
+ Superclass::RemoveFromRender(theRenderer);
myDestroySignal(this);
}
//----------------------------------------------------------------------------
-void
+void
VISU_Actor
::SetVisibility(int theMode)
{
return GetFactory()->GetActiveState();
}
//----------------------------------------------------------------------------
-void
+void
VISU_Actor
::SetVTKMapping(bool theIsVTKMapping)
{
myIsVTKMapping = theIsVTKMapping;
}
-bool
+bool
VISU_Actor
::IsVTKMapping() const
{
}
//----------------------------------------------------------------------------
-vtkDataSet*
+vtkDataSet*
VISU_Actor
::GetInput()
{
return VISU::GetElemVTKID(GetMapper()->GetInput(), theID);
}
-vtkCell*
+vtkCell*
VISU_Actor
::GetElemCell(vtkIdType theObjID)
{
//----------------------------------------------------------------------------
bool
VISU_Actor
-::isSubElementsHighlighted()
-{
- return myIsSubElementsHighlighted;
+::isSubElementsHighlighted()
+{
+ return myIsSubElementsHighlighted;
}
inline
void
ChangeZoom(vtkFloatingPointType theZoomFactor,
- vtkRenderer* theRenderer,
- vtkIdType theInitialHasIndex,
- vtkIdType theCurrentHasIndex)
+ vtkRenderer* theRenderer,
+ vtkIdType theInitialHasIndex,
+ vtkIdType theCurrentHasIndex)
{
//printf( "VISU_Actor::ChangeZoom( %d, %d )", theInitialHasIndex, theCurrentHasIndex );
if(theInitialHasIndex + theCurrentHasIndex == 1){
}
/*!
- Updates visibility of the highlight devices
+ Updates visibility of the highlight devices
*/
void
VISU_Actor
{
vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor();
ChangeZoom(aZoomFactor,
- GetRenderer(),
- anInitialHasIndex,
- aCurrentHasIndex);
+ GetRenderer(),
+ anInitialHasIndex,
+ aCurrentHasIndex);
}
}
*/
bool
VISU_Actor
-::PreHighlight(vtkInteractorStyle* theInteractorStyle,
- SVTK_SelectionEvent* theSelectionEvent,
- bool theIsHighlight)
+::PreHighlight(vtkInteractorStyle* theInteractorStyle,
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight)
{
bool aRet = Superclass::PreHighlight(theInteractorStyle,
- theSelectionEvent,
- theIsHighlight);
+ theSelectionEvent,
+ theIsHighlight);
#ifndef ENABLE_ANNOTATION
return aRet;
-#endif
+#endif
//
myAnnotationActor->SetVisibility(0);
if(theIsHighlight){
switch(mySelectionMode){
- case CellSelection:{
+ case CellSelection:{
vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer();
- myCellPicker->Pick(theSelectionEvent->myX,
- theSelectionEvent->myY,
- 0.0,
- aRenderer);
+ myCellPicker->Pick(theSelectionEvent->myX,
+ theSelectionEvent->myY,
+ 0.0,
+ aRenderer);
if(myCellPicker->GetActor() != this)
- return false;
+ return false;
vtkIdType aVTKId = myCellPicker->GetCellId();
if(aVTKId >= 0 && mySelector->IsValid(this,aVTKId,true) && hasIO()){
- vtkIdType anObjId = GetElemObjId(aVTKId);
- if(vtkCell* aCell = GetElemCell(anObjId)){
- vtkPoints* aPts = aCell->GetPoints();
- if(int aNbPts = aCell->GetNumberOfPoints()){
- vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0};
- for(int i = 0; i < aNbPts; i++){
- vtkFloatingPointType *aPntCoord = aPts->GetPoint(i);
- aCoord[0] += aPntCoord[0];
- aCoord[1] += aPntCoord[1];
- aCoord[2] += aPntCoord[2];
- }
- // Display coordinates
- vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0};
- aRenderer->SetWorldPoint(aWorldCoord);
- aRenderer->WorldToDisplay();
- vtkFloatingPointType aSelectionPoint[3];
- aRenderer->GetDisplayPoint(aSelectionPoint);
- myAnnotationActor->SetPosition(aSelectionPoint);
- //
- // To prepare the annotation text
- std::ostringstream aStr;
- aStr<<"Cell ID: "<< anObjId;
- std::string aString = aStr.str();
- myAnnotationMapper->SetInput(aString.c_str());
-
- myAnnotationActor->SetVisibility(1);
- return true;
- }
- }
+ vtkIdType anObjId = GetElemObjId(aVTKId);
+ if(vtkCell* aCell = GetElemCell(anObjId)){
+ vtkPoints* aPts = aCell->GetPoints();
+ if(int aNbPts = aCell->GetNumberOfPoints()){
+ vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0};
+ for(int i = 0; i < aNbPts; i++){
+ vtkFloatingPointType *aPntCoord = aPts->GetPoint(i);
+ aCoord[0] += aPntCoord[0];
+ aCoord[1] += aPntCoord[1];
+ aCoord[2] += aPntCoord[2];
+ }
+ // Display coordinates
+ vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0};
+ aRenderer->SetWorldPoint(aWorldCoord);
+ aRenderer->WorldToDisplay();
+ vtkFloatingPointType aSelectionPoint[3];
+ aRenderer->GetDisplayPoint(aSelectionPoint);
+ myAnnotationActor->SetPosition(aSelectionPoint);
+ //
+ // To prepare the annotation text
+ std::ostringstream aStr;
+ aStr<<"Cell ID: "<< anObjId;
+ std::string aString = aStr.str();
+ myAnnotationMapper->SetInput(aString.c_str());
+
+ myAnnotationActor->SetVisibility(1);
+ return true;
+ }
+ }
}
break;
}
- case NodeSelection:{
+ case NodeSelection:{
vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer();
- myPointPicker->Pick(theSelectionEvent->myX,
- theSelectionEvent->myY,
- 0.0,
- aRenderer);
+ myPointPicker->Pick(theSelectionEvent->myX,
+ theSelectionEvent->myY,
+ 0.0,
+ aRenderer);
if(myPointPicker->GetActor() != this)
- return false;
+ return false;
vtkIdType aVtkId = myPointPicker->GetPointId();
if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
- vtkIdType anObjId = GetNodeObjId( aVtkId );
- if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){
- // Display coordinates
- vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0};
- aRenderer->SetWorldPoint(aWorldCoord);
- aRenderer->WorldToDisplay();
- vtkFloatingPointType aSelectionPoint[3];
- aRenderer->GetDisplayPoint(aSelectionPoint);
- myAnnotationActor->SetPosition(aSelectionPoint);
- //
- // To prepare the annotation text
- std::ostringstream aStr;
- aStr<<"Node ID: "<< anObjId;
- std::string aString = aStr.str();
- myAnnotationMapper->SetInput(aString.c_str());
-
- myAnnotationActor->SetVisibility(1);
- return true;
- }
+ vtkIdType anObjId = GetNodeObjId( aVtkId );
+ if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){
+ // Display coordinates
+ vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0};
+ aRenderer->SetWorldPoint(aWorldCoord);
+ aRenderer->WorldToDisplay();
+ vtkFloatingPointType aSelectionPoint[3];
+ aRenderer->GetDisplayPoint(aSelectionPoint);
+ myAnnotationActor->SetPosition(aSelectionPoint);
+ //
+ // To prepare the annotation text
+ std::ostringstream aStr;
+ aStr<<"Node ID: "<< anObjId;
+ std::string aString = aStr.str();
+ myAnnotationMapper->SetInput(aString.c_str());
+
+ myAnnotationActor->SetVisibility(1);
+ return true;
+ }
}
break;
}
*/
bool
VISU_Actor
-::Highlight(vtkInteractorStyle* theInteractorStyle,
- SVTK_SelectionEvent* theSelectionEvent,
- bool theIsHighlight)
+::Highlight(vtkInteractorStyle* theInteractorStyle,
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight)
{
return Superclass::Highlight(theInteractorStyle,
- theSelectionEvent,
- theIsHighlight);
+ theSelectionEvent,
+ theIsHighlight);
}
//-------------------------------------------------------------------------
VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode != ActorSelection;
-
+
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex( getIO(), aMapIndex );
bool aCurrentHasIndex = aMapIndex.Extent() == 1;
{
case ActorSelection:
{
- ResetTextActor();
- break;
+ ResetTextActor();
+ break;
}
case CellSelection:
{
- if( !aCurrentHasIndex )
- {
- myTextActor->SetVisibility(false);
- break;
- }
-
- int anObjId = aMapIndex(1);
- vtkCellData* aCellData = aDataSet->GetCellData();
- if(vtkCell* aCell = GetElemCell(anObjId)){
- vtkPoints* aPts = aCell->GetPoints();
- if(int aNbPts = aCell->GetNumberOfPoints()){
- vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0};
- for(int i = 0; i < aNbPts; i++){
- vtkFloatingPointType *aPntCoord = aPts->GetPoint(i);
- aCoord[0] += aPntCoord[0];
- aCoord[1] += aPntCoord[1];
- aCoord[2] += aPntCoord[2];
- }
-
- aFlyTo = true;
- aFlyToCoord[0] = aCoord[0] / aNbPts;
- aFlyToCoord[1] = aCoord[1] / aNbPts;
- aFlyToCoord[2] = aCoord[2] / aNbPts;
-
- vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0};
- aRenderer->SetWorldPoint(aWorldCoord);
- aRenderer->WorldToDisplay();
- vtkFloatingPointType aSelectionPoint[3];
- aRenderer->GetDisplayPoint(aSelectionPoint);
- myTextActor->SetPosition(aSelectionPoint);
- myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
- myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
- myTextActor->SetWorldPoint(aWorldCoord);
-
- std::ostringstream aStr;
- aStr << "Cell ID: " << anObjId;
-
- vtkCell* aCell = GetElemCell(anObjId);
- int aVTKID = GetElemVTKID(anObjId);
- if (aCell) {
- int aNbOfPoints = aCell->GetNumberOfPoints();
- if ( aNbOfPoints > 0 ) {
- aStr << getScalar(aCellData, aVTKID);
- aStr << getVector(aCellData, aVTKID);
- }
- }
-
- std::string aString = aStr.str();
- myTextActor->SetText(aString.c_str());
- }
- }
- break;
+ if( !aCurrentHasIndex )
+ {
+ myTextActor->SetVisibility(false);
+ break;
+ }
+
+ int anObjId = aMapIndex(1);
+ vtkCellData* aCellData = aDataSet->GetCellData();
+ if(vtkCell* aCell = GetElemCell(anObjId)){
+ vtkPoints* aPts = aCell->GetPoints();
+ if(int aNbPts = aCell->GetNumberOfPoints()){
+ vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0};
+ for(int i = 0; i < aNbPts; i++){
+ vtkFloatingPointType *aPntCoord = aPts->GetPoint(i);
+ aCoord[0] += aPntCoord[0];
+ aCoord[1] += aPntCoord[1];
+ aCoord[2] += aPntCoord[2];
+ }
+
+ aFlyTo = true;
+ aFlyToCoord[0] = aCoord[0] / aNbPts;
+ aFlyToCoord[1] = aCoord[1] / aNbPts;
+ aFlyToCoord[2] = aCoord[2] / aNbPts;
+
+ vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0};
+ aRenderer->SetWorldPoint(aWorldCoord);
+ aRenderer->WorldToDisplay();
+ vtkFloatingPointType aSelectionPoint[3];
+ aRenderer->GetDisplayPoint(aSelectionPoint);
+ myTextActor->SetPosition(aSelectionPoint);
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetWorldPoint(aWorldCoord);
+
+ std::ostringstream aStr;
+ aStr << "Cell ID: " << anObjId;
+
+ vtkCell* aCell = GetElemCell(anObjId);
+ int aVTKID = GetElemVTKID(anObjId);
+ if (aCell) {
+ int aNbOfPoints = aCell->GetNumberOfPoints();
+ if ( aNbOfPoints > 0 ) {
+ aStr << getScalar(aCellData, aVTKID);
+ aStr << getVector(aCellData, aVTKID);
+ }
+ }
+
+ std::string aString = aStr.str();
+ myTextActor->SetText(aString.c_str());
+ }
+ }
+ break;
}
case NodeSelection:
- {
- if( !aCurrentHasIndex )
- {
- myTextActor->SetVisibility(false);
- break;
- }
-
- int anObjId = aMapIndex(1);
- vtkPointData* aPntData = aDataSet->GetPointData();
- if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){
- aFlyTo = true;
- aFlyToCoord[0] = aCoord[0];
- aFlyToCoord[1] = aCoord[1];
- aFlyToCoord[2] = aCoord[2];
-
- vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0};
- aRenderer->SetWorldPoint(aWorldCoord);
- aRenderer->WorldToDisplay();
- vtkFloatingPointType aSelectionPoint[3];
- aRenderer->GetDisplayPoint(aSelectionPoint);
- myTextActor->SetPosition(aSelectionPoint);
- myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
- myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
- myTextActor->SetWorldPoint(aWorldCoord);
-
- std::ostringstream aStr;
- aStr << "Point ID: " << anObjId;
-
- int aVTKID = GetNodeVTKID(anObjId);
- if(aVTKID >= 0) {
- aStr << getScalar(aPntData, aVTKID);
- aStr << getVector(aPntData, aVTKID);
- }
-
- const VISU::PIDMapper& aMapper = GetPipeLine()->GetIDMapper();
- //VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anObjId);
- VISU::TStructuredId aVec = aMapper->GetIndexesOfNode(anObjId);
-
- aStr << "\nCoordinates: " << "[";
- aStr << aCoord[0];
- //if( aVec.size() > 0 )
- if (aVec[0] != -1)
- aStr << " (" << aVec[0] << ")";
- aStr << "; ";
-
- aStr << aCoord[1];
- //if( aVec.size() > 1 )
- if (aVec[1] != -1)
- aStr << " (" << aVec[1] << ")";
- aStr << "; ";
-
- aStr << aCoord[2];
- //if( aVec.size() > 2 )
- if (aVec[2] != -1)
- aStr << " (" << aVec[2] << ")";
- aStr << "]";
-
- std::string aString = aStr.str();
- myTextActor->SetText(aString.c_str());
- }
- break;
+ {
+ if( !aCurrentHasIndex )
+ {
+ myTextActor->SetVisibility(false);
+ break;
+ }
+
+ int anObjId = aMapIndex(1);
+ vtkPointData* aPntData = aDataSet->GetPointData();
+ if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){
+ aFlyTo = true;
+ aFlyToCoord[0] = aCoord[0];
+ aFlyToCoord[1] = aCoord[1];
+ aFlyToCoord[2] = aCoord[2];
+
+ vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0};
+ aRenderer->SetWorldPoint(aWorldCoord);
+ aRenderer->WorldToDisplay();
+ vtkFloatingPointType aSelectionPoint[3];
+ aRenderer->GetDisplayPoint(aSelectionPoint);
+ myTextActor->SetPosition(aSelectionPoint);
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetWorldPoint(aWorldCoord);
+
+ std::ostringstream aStr;
+ aStr << "Point ID: " << anObjId;
+
+ int aVTKID = GetNodeVTKID(anObjId);
+ if(aVTKID >= 0) {
+ aStr << getScalar(aPntData, aVTKID);
+ aStr << getVector(aPntData, aVTKID);
+ }
+
+ const VISU::PIDMapper& aMapper = GetPipeLine()->GetIDMapper();
+ //VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anObjId);
+ VISU::TStructuredId aVec = aMapper->GetIndexesOfNode(anObjId);
+
+ aStr << "\nCoordinates: " << "[";
+ aStr << aCoord[0];
+ //if( aVec.size() > 0 )
+ if (aVec[0] != -1)
+ aStr << " (" << aVec[0] << ")";
+ aStr << "; ";
+
+ aStr << aCoord[1];
+ //if( aVec.size() > 1 )
+ if (aVec[1] != -1)
+ aStr << " (" << aVec[1] << ")";
+ aStr << "; ";
+
+ aStr << aCoord[2];
+ //if( aVec.size() > 2 )
+ if (aVec[2] != -1)
+ aStr << " (" << aVec[2] << ")";
+ aStr << "]";
+
+ std::string aString = aStr.str();
+ myTextActor->SetText(aString.c_str());
+ }
+ break;
}
case EdgeOfCellSelection:
- break;
+ break;
default:
- break;
+ break;
}
}
{
vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor();
ChangeZoom(aZoomFactor,
- GetRenderer(),
- anInitialHasIndex,
- aCurrentHasIndex);
+ GetRenderer(),
+ anInitialHasIndex,
+ aCurrentHasIndex);
}
// FlyTo
vtkRenderWindowInteractor* anInteractor = myInteractor;
vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
-
+
double aPosition[3];
GetPosition( aPosition );
for( int i = 0; i < 3; i++ )
GetBounds(aCoord);
vtkFloatingPointType aWorldCoord[4] = { ( aCoord[0] + aCoord[1] ) / 2,
- ( aCoord[2] + aCoord[3] ) / 2,
- ( aCoord[4] + aCoord[5] ) / 2, 1.0};
+ ( aCoord[2] + aCoord[3] ) / 2,
+ ( aCoord[4] + aCoord[5] ) / 2, 1.0};
vtkRenderer* aRenderer = GetRenderer();
aRenderer->SetWorldPoint(aWorldCoord);
aRenderer->WorldToDisplay();
}
//-------------------------------------------------------------------------
-void
+void
VISU_Actor
-::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* vtkNotUsed(theCallData))
+::ProcessEvents(vtkObject* vtkNotUsed(theObject),
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
{
if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
if(VISU_Actor* self = dynamic_cast<VISU_Actor*>(anObject)) {
if(theEvent == VISU::UpdatePickingSettingsEvent)
- self->UpdatePickingSettings();
+ self->UpdatePickingSettings();
}
}
vtkDataSet* aGrid = GetValLabelsInput();
if ( !aGrid )
return;
-
+
bool isOnPnt = VISU::IsDataOnPoints( aGrid );
bool isOnCell = VISU::IsDataOnCells( aGrid );
if ( !isOnPnt && !isOnCell )
return;
}
}
-
+
myIsValLabeled = theIsValLabeled;
if ( myIsValLabeled )
}
else
myValLabels->SetVisibility( false );
-
+
Modified();
}
vtkTextProperty* VISU_Actor::GetsValLabelsProps() const
{
- return myValLabeledDataMapper->GetLabelTextProperty();
+ return myValLabeledDataMapper->GetLabelTextProperty();
}
//----------------------------------------------------------------------------
}
-
-VISU_Actor::EQuadratic2DRepresentation
+VISU_Actor::EQuadratic2DRepresentation
VISU_Actor::GetQuadratic2DRepresentation() const
{
if(Superclass::GetQuadraticArcMode()){
#include "VISU_ConvertorUtils.hxx"
#include "VISU_MeshValue.hxx"
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+
#include <sstream>
#include <vtkObjectFactory.h>
return myGaussMetric;
}
+//----------------------------------------------------------------------------
+vtkFloatingPointType CutValue (vtkFloatingPointType theValue, int theDecimals)
+{
+ vtkFloatingPointType v = theValue;
+ vtkFloatingPointType aDegree = 0.0;
+ if (abs((long long)v) > 1)
+ aDegree = (long long)log10(abs((long long)v)) + 1;
+ aDegree = theDecimals - aDegree;
+ //printf("$$$ 1 v = %.20g , aDegree = %lld \n", v, (long long)aDegree);
+ if (aDegree > 0) {
+ aDegree = pow(10, aDegree);
+ v = ((vtkFloatingPointType)((long long)(v * aDegree))) / aDegree;
+ //printf("$$$ 2 v = %.20g , aDegree = %lld \n", v, (long long)aDegree);
+ }
+ return v;
+}
//----------------------------------------------------------------------------
template<typename TValueType>
TValueType* theOutputPtr,
vtkIdType theNbOfTuples)
{
+ // jfa try begin
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ int aDecimals = aResourceMgr->integerValue("VISU", "floating_point_precision", 6);
+ // jfa try end
+
vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
std::vector<vtkFloatingPointType> anArray(aNbComp < 3? 3: aNbComp);
for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] +
aVector[1]*aVector[1] +
aVector[2]*aVector[2]);
- *theOutputPtr = TValueType(aScalar);
+ //*theOutputPtr = TValueType(aScalar);
+ // jfa try begin
+ *theOutputPtr = TValueType(CutValue(aScalar, aDecimals));
+ // jfa try end
theOutputPtr++;
}
}
vtkIdType theNbOfTuples,
VISU::TGaussMetric theGaussMetric)
{
+ // jfa try begin
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ int aDecimals = aResourceMgr->integerValue("VISU", "floating_point_precision", 6);
+ // jfa try end
+
vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
if (aNbComp != 3) // Min, Max, Avg
return;
case VISU::MAXIMUM_METRIC: *theOutputPtr = TValueType(anArray[1]); break;
case VISU::AVERAGE_METRIC: *theOutputPtr = TValueType(anArray[2]); break;
}
+ // jfa try begin
+ *theOutputPtr = TValueType(CutValue(*theOutputPtr, aDecimals));
+ // jfa try end
theOutputPtr++;
}
}
vtkIdType theNbOfTuples,
vtkIdType theComponentId)
{
+ // jfa try begin
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ int aDecimals = aResourceMgr->integerValue("VISU", "floating_point_precision", 6);
+ // jfa try end
+
vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents();
- for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
+ for (vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) {
*theOutputPtr = *(theInputPtr + theComponentId);
+ // jfa try begin
+ *theOutputPtr = TValueType(CutValue(*theOutputPtr, aDecimals));
+ // jfa try end
theInputPtr += aNbComp;
theOutputPtr++;
}
// File : VISU_LookupTable.cxx
// Author : Vitaliy Smetannikov
// Module : VISU
-//
+
#include "VISU_LookupTable.hxx"
#include <vtkObjectFactory.h>
//----------------------------------------------------------------------------
VISU_LookupTable
::VISU_LookupTable(int sze, int ext):
- vtkLookupTable(sze, ext),
- myScale(1.0),
- myBicolor(false)
+ vtkLookupTable(sze, ext),
+ myScale(1.0),
+ myBicolor(false)
{}
//----------------------------------------------------------------------------
void
VISU_LookupTable
::MarkValueByColor( vtkFloatingPointType theValue,
- unsigned char* theColor )
-{
+ unsigned char* theColor )
+{
vtkIdType anIndex = this->GetIndex( theValue );
unsigned char *aTablePtr = this->GetPointer( anIndex );
CopyColor( aTablePtr, theColor );
{
unsigned char aRedPtr[3] = {255, 0, 0};
unsigned char aBluePtr[3] = {0, 0, 255};
-
+
vtkFloatingPointType aRange[2];
this->GetTableRange(aRange);
vtkIdType aNbColors = this->GetNumberOfColors();
-
+
vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors;
vtkFloatingPointType aValue = aRange[0]+0.5*aDelta;
for(int i = 0; i < aNbColors; i++){
//----------------------------------------------------------------------------
-void
+void
VISU_LookupTable
::SetMapScale(vtkFloatingPointType theScale)
{
}
-int
+int
VISU_LookupTable
-::ComputeLogRange(vtkFloatingPointType inRange[2],
- vtkFloatingPointType outRange[2])
+::ComputeLogRange(vtkFloatingPointType inRange[2],
+ vtkFloatingPointType outRange[2])
{
if(inRange[0] >= inRange[1])
return -1;
return -1;
}
-unsigned char*
+unsigned char*
VISU_LookupTable
-::MapValue(vtkFloatingPointType v)
+::MapValue(vtkFloatingPointType v)
{
if(GetScale() == VTK_SCALE_LOG10) {
vtkFloatingPointType aLowBound = log10(this->TableRange[0]);
}
// Apply log to value, with appropriate constraints.
-inline
-vtkFloatingPointType
-VISU_ApplyLogScale(vtkFloatingPointType v,
- vtkFloatingPointType range[2],
- vtkFloatingPointType logRange[2])
+inline
+vtkFloatingPointType
+VISU_ApplyLogScale(vtkFloatingPointType v,
+ vtkFloatingPointType range[2],
+ vtkFloatingPointType logRange[2])
{
// is the range set for negative numbers?
- if (range[0] < 0)
- {
- if (v < 0)
- {
+ if (range[0] < 0) {
+ if (v < 0) {
v = log10(-static_cast<double>(v));
- }
- else if (range[0] > range[1])
- {
+ }
+ else if (range[0] > range[1]) {
v = logRange[0];
- }
- else
- {
+ }
+ else {
v = logRange[1];
- }
}
- else
- {
- if (v > 0)
- {
+ }
+ else {
+ if (v > 0) {
v = log10(static_cast<double>(v));
- }
- else if (range[0] < range[1])
- {
+ }
+ else if (range[0] < range[1]) {
v = logRange[0];
- }
- else
- {
+ }
+ else {
v = logRange[1];
- }
}
+ }
return v;
-}
+}
// Apply shift/scale to the scalar value v and do table lookup.
-inline
+inline
unsigned char *
-VISU_LinearLookup(vtkFloatingPointType v,
- unsigned char *table,
- vtkFloatingPointType maxIndex,
- vtkFloatingPointType shift,
- vtkFloatingPointType scale,
- bool bicolor)
+VISU_LinearLookup(vtkFloatingPointType v,
+ unsigned char *table,
+ vtkFloatingPointType maxIndex,
+ vtkFloatingPointType shift,
+ vtkFloatingPointType scale,
+ bool bicolor)
{
if( !bicolor )
{
// of 8-bit chunks
template<class T>
void
-VISU_LookupTableMapData(vtkLookupTable *self,
- T *input,
- unsigned char *output,
- int length,
- int inIncr,
- int outFormat,
- vtkFloatingPointType theMapScale,
- bool bicolor)
+VISU_LookupTableMapData(vtkLookupTable *self,
+ T *input,
+ unsigned char *output,
+ int length,
+ int inIncr,
+ int outFormat,
+ vtkFloatingPointType theMapScale,
+ bool bicolor)
{
int i = length;
vtkFloatingPointType *range = self->GetTableRange();
unsigned char *cptr;
vtkFloatingPointType alpha;
- if ( (alpha=self->GetAlpha()) >= 1.0 ) //no blending required
- {
+ if ( (alpha=self->GetAlpha()) >= 1.0 ) //no blending required
+ {
if (self->GetScale() == VTK_SCALE_LOG10)
- {
+ {
vtkFloatingPointType val;
vtkFloatingPointType logRange[2];
VISU_LookupTable::ComputeLogRange(range, logRange);
shift = -logRange[0];
if (logRange[1] <= logRange[0])
- {
+ {
scale = VTK_LARGE_FLOAT;
- }
+ }
else
- {
+ {
scale = (maxIndex + 1)/(logRange[1] - logRange[0]);
- }
+ }
/* correct scale
scale = maxIndex/(logRange[1] - logRange[0]);
*/
if (outFormat == VTK_RGBA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
- *output++ = *cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_RGB)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_LUMINANCE_ALPHA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
*output++ = cptr[3];
input += inIncr;
- }
}
+ }
else // outFormat == VTK_LUMINANCE
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
input += inIncr;
- }
}
- }//if log scale
+ }
+ }//if log scale
else //not log scale
- {
+ {
shift = -range[0];
if (range[1] <= range[0])
- {
+ {
scale = VTK_LARGE_FLOAT;
- }
+ }
else
- {
+ {
scale = (maxIndex + 1)/(range[1] - range[0]);
- }
+ }
/* correct scale
scale = maxIndex/(range[1] - range[0]);
*/
if (outFormat == VTK_RGBA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
- *output++ = *cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_RGB)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_LUMINANCE_ALPHA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
*output++ = cptr[3];
input += inIncr;
- }
}
+ }
else // outFormat == VTK_LUMINANCE
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
input += inIncr;
- }
}
- }//if not log lookup
- }//if blending not needed
+ }
+ }//if not log lookup
+ }//if blending not needed
else //blend with the specified alpha
- {
+ {
if (self->GetScale() == VTK_SCALE_LOG10)
- {
+ {
vtkFloatingPointType val;
vtkFloatingPointType logRange[2];
VISU_LookupTable::ComputeLogRange(range, logRange);
shift = -logRange[0];
if (logRange[1] <= logRange[0])
- {
+ {
scale = VTK_LARGE_FLOAT;
- }
+ }
else
- {
+ {
scale = (maxIndex + 1)/(logRange[1] - logRange[0]);
- }
+ }
/* correct scale
scale = maxIndex/(logRange[1] - logRange[0]);
*/
if (outFormat == VTK_RGBA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = static_cast<unsigned char>((*cptr)*alpha); cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_RGB)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_LUMINANCE_ALPHA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
*output++ = static_cast<unsigned char>(alpha*cptr[3]);
input += inIncr;
- }
}
+ }
else // outFormat == VTK_LUMINANCE
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
val = VISU_ApplyLogScale(*input, range, logRange);
- cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
input += inIncr;
- }
}
- }//log scale with blending
+ }
+ }//log scale with blending
else //no log scale with blending
- {
+ {
shift = -range[0];
if (range[1] <= range[0])
- {
+ {
scale = VTK_LARGE_FLOAT;
- }
+ }
else
- {
+ {
scale = (maxIndex + 1)/(range[1] - range[0]);
- }
+ }
/* correct scale
scale = maxIndex/(range[1] - range[0]);
*/
if (outFormat == VTK_RGBA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = static_cast<unsigned char>((*cptr)*alpha); cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_RGB)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
*output++ = *cptr++;
*output++ = *cptr++;
*output++ = *cptr++;
input += inIncr;
- }
}
+ }
else if (outFormat == VTK_LUMINANCE_ALPHA)
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
*output++ = static_cast<unsigned char>(cptr[3]*alpha);
input += inIncr;
- }
}
+ }
else // outFormat == VTK_LUMINANCE
+ {
+ while (--i >= 0)
{
- while (--i >= 0)
- {
- cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
- *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
+ cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor);
+ *output++ = static_cast<unsigned char>(cptr[0]*0.30 + cptr[1]*0.59 +
cptr[2]*0.11 + 0.5);
input += inIncr;
- }
}
- }//no log scale
- }//alpha blending
+ }
+ }//no log scale
+ }//alpha blending
}
// Although this is a relatively expensive calculation,
// for subsequent renders.
template<class T>
void
-VISU_LookupTableMapMag(vtkLookupTable *self,
- T *input,
- unsigned char *output,
- int length,
- int inIncr,
- int outFormat,
- vtkFloatingPointType theMapScale,
- bool bicolor)
+VISU_LookupTableMapMag(vtkLookupTable *self,
+ T *input,
+ unsigned char *output,
+ int length,
+ int inIncr,
+ int outFormat,
+ vtkFloatingPointType theMapScale,
+ bool bicolor)
{
double tmp, sum;
double *mag;
mag = new double[length];
for (i = 0; i < length; ++i)
- {
+ {
sum = 0;
for (j = 0; j < inIncr; ++j)
- {
- tmp = (double)(*input);
+ {
+ tmp = (double)(*input);
sum += (tmp * tmp);
++input;
- }
- mag[i] = sqrt(sum);
}
+ mag[i] = sqrt(sum);
+ }
VISU_LookupTableMapData(self, mag, output, length, 1, outFormat, theMapScale, bicolor);
}
-void VISU_LookupTable::MapScalarsThroughTable2(void *input,
- unsigned char *output,
- int inputDataType,
- int numberOfValues,
- int inputIncrement,
- int outputFormat)
+void VISU_LookupTable::MapScalarsThroughTable2(void *input,
+ unsigned char *output,
+ int inputDataType,
+ int numberOfValues,
+ int inputIncrement,
+ int outputFormat)
{
if (this->UseMagnitude && inputIncrement > 1)
- {
+ {
switch (inputDataType)
- {
+ {
case VTK_BIT:
vtkErrorMacro("Cannot comput magnitude of bit array.");
break;
case VTK_CHAR:
VISU_LookupTableMapMag(this,static_cast<char *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
- return;
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ return;
case VTK_UNSIGNED_CHAR:
VISU_LookupTableMapMag(this,static_cast<unsigned char *>(input),output,
numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
default:
vtkErrorMacro(<< "MapImageThroughTable: Unknown input ScalarType");
return;
- }
}
+ }
switch (inputDataType)
- {
+ {
case VTK_BIT:
- {
+ {
vtkIdType i, id;
vtkBitArray *bitArray = vtkBitArray::New();
bitArray->SetVoidArray(input,numberOfValues,1);
vtkUnsignedCharArray *newInput = vtkUnsignedCharArray::New();
newInput->SetNumberOfValues(numberOfValues);
for (id=i=0; i<numberOfValues; i++, id+=inputIncrement)
- {
+ {
newInput->SetValue(i, bitArray->GetValue(id));
- }
+ }
VISU_LookupTableMapData(this,
- static_cast<unsigned char*>(newInput->GetPointer(0)),
- output,numberOfValues,
- inputIncrement,outputFormat,myScale,myBicolor);
+ static_cast<unsigned char*>(newInput->GetPointer(0)),
+ output,numberOfValues,
+ inputIncrement,outputFormat,myScale,myBicolor);
newInput->Delete();
bitArray->Delete();
- }
- break;
-
+ }
+ break;
+
case VTK_CHAR:
VISU_LookupTableMapData(this,static_cast<char *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_UNSIGNED_CHAR:
VISU_LookupTableMapData(this,static_cast<unsigned char *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_SHORT:
VISU_LookupTableMapData(this,static_cast<short *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_UNSIGNED_SHORT:
VISU_LookupTableMapData(this,static_cast<unsigned short *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_INT:
VISU_LookupTableMapData(this,static_cast<int *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_UNSIGNED_INT:
VISU_LookupTableMapData(this,static_cast<unsigned int *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_LONG:
VISU_LookupTableMapData(this,static_cast<long *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_UNSIGNED_LONG:
VISU_LookupTableMapData(this,static_cast<unsigned long *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_FLOAT:
VISU_LookupTableMapData(this,static_cast<float *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
case VTK_DOUBLE:
VISU_LookupTableMapData(this,static_cast<double *>(input),output,
- numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
+ numberOfValues,inputIncrement,outputFormat,myScale,myBicolor);
break;
-
+
default:
vtkErrorMacro(<< "MapImageThroughTable: Unknown input ScalarType");
return;
- }
-}
-
+ }
+}
if ( !aFileInfo.exists() ) {
// file not exist
errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
- arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
}
else {
try {
- if ( !toUseBuildProgress ) {
- // build progress is not used, use build flags from settings
- bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
- bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
- bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
- bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
- bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
-
- QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
- application()->putInfo( anInfo );
-
- VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
-
- if ( CORBA::is_nil( aResult.in() ) ) {
- errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
- arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
- }
- else {
- aResult->SetBuildFields( toBuildFields, toBuildMinMax );
- aResult->SetBuildGroups( toBuildGroups );
- aResult->Build( toBuildAll, toBuildAtOnce );
- application()->putInfo( anInfo + tr("INF_DONE") );
- }
- } // if ( !toUseBuildProgress )
- else {
- // use build progress
- wc.suspend();
- VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
- aBuildProgressDlg->setFileName( aFileInfo.filePath() );
- aBuildProgressDlg->setGenerator( GetVisuGen(this) );
- aBuildProgressDlg->exec();
- wc.resume();
- }
+ if ( !toUseBuildProgress ) {
+ // build progress is not used, use build flags from settings
+ bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
+ bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
+ bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
+ bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
+ bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
+
+ QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
+ application()->putInfo( anInfo );
+
+ VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
+
+ if ( CORBA::is_nil( aResult.in() ) ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ aResult->SetBuildFields( toBuildFields, toBuildMinMax );
+ aResult->SetBuildGroups( toBuildGroups );
+ aResult->Build( toBuildAll, toBuildAtOnce );
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
+ } // if ( !toUseBuildProgress )
+ else {
+ // use build progress
+ wc.suspend();
+ VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
+ aBuildProgressDlg->setFileName( aFileInfo.filePath() );
+ aBuildProgressDlg->setGenerator( GetVisuGen(this) );
+ aBuildProgressDlg->exec();
+ wc.resume();
+ }
} // try
catch(...) {
- errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
}
} // else // if ( !aFileInfo.exists() )
} // for (...)
if ( errors.count() > 0 ) {
SUIT_MessageBox::critical( GetDesktop(this),
- tr("ERR_ERROR"),
- tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
else {
UpdateObjBrowser(this);
anInitialPath = QDir::currentPath();
QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
- anInitialPath,
- aFilter,
- tr("TLT_IMPORT_TABLE"));
+ anInitialPath,
+ aFilter,
+ tr("TLT_IMPORT_TABLE"));
if ( aFiles.count() == 0 )
return; // nothing selected
if ( !aFileInfo.exists() ) {
errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
- arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
+ arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
}
else {
try {
- QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
- application()->putInfo( anInfo );
-
- CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
-
- if (CORBA::is_nil(anObject.in())) {
- errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
- arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
- }
- else {
- application()->putInfo( anInfo + tr("INF_DONE") );
- }
+ QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
+ application()->putInfo( anInfo );
+
+ CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
+
+ if (CORBA::is_nil(anObject.in())) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
+ arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
+ }
+ else {
+ application()->putInfo( anInfo + tr("INF_DONE") );
+ }
}
catch(...) {
- errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+ errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
}
}
}
if ( errors.count() > 0 ) {
SUIT_MessageBox::critical( GetDesktop(this),
- tr("ERR_ERROR"),
- tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+ tr("ERR_ERROR"),
+ tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
else {
UpdateObjBrowser(this);
if (!aTabAttr) return;
aTitle = aTabAttr->GetTitle().c_str();
} else {
- _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
- if (!aTabAttr) return;
+ _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
+ if (!aTabAttr) return;
aTitle = aTabAttr->GetTitle().c_str();
}
aTitle.simplified();
QString aFile = aFileInfo.filePath();
if (!aFile.isEmpty()) {
application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
- aDir = Qtx::dir(aFile, true);
+ aDir = Qtx::dir(aFile, true);
aResourceMgr->setValue("VISU", "OutputDir", aDir);
- try {
- GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
+ try {
+ GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
application()->putInfo(aFile + " " + tr("INF_DONE"));
- } catch(std::exception& exc) {
- INFOS(exc.what());
- SUIT_MessageBox::warning(GetDesktop(this),
+ } catch(std::exception& exc) {
+ INFOS(exc.what());
+ SUIT_MessageBox::warning(GetDesktop(this),
tr("WRN_VISU"),
- tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
+ tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
- } catch(...) {
- INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
- SUIT_MessageBox::warning( GetDesktop(this),
+ } catch(...) {
+ INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
+ SUIT_MessageBox::warning( GetDesktop(this),
tr("WRN_VISU"),
- tr("ERR_ERROR_DURING_EXPORT") );
+ tr("ERR_ERROR_DURING_EXPORT") );
- }
+ }
}
}
}
if( aTblObj ) {
_PTR(GenericAttribute) anAttr;
if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
- _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
- SalomeApp_Study* salome_study = GetAppStudy( theModule );
- for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
- salome_study->deleteReferencesTo( aChildIter->Value() );
- _PTR(SObject) aSO = aChildIter->Value();
- if(aSO){
- Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
- if (aRestoringMap["myComment"] == "CURVE") {
- CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
- if(!CORBA::is_nil(aCORBAObject)){
- PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
- if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
- PlotRemoveCurve(theModule, aCurve);
- }
- }
- }
- }
-
- }
+ _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
+ SalomeApp_Study* salome_study = GetAppStudy( theModule );
+ for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
+ salome_study->deleteReferencesTo( aChildIter->Value() );
+ _PTR(SObject) aSO = aChildIter->Value();
+ if(aSO){
+ Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
+ if (aRestoringMap["myComment"] == "CURVE") {
+ CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
+ if(!CORBA::is_nil(aCORBAObject)){
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
+ PlotRemoveCurve(theModule, aCurve);
+ }
+ }
+ }
+ }
+
+ }
aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
- //UpdateObjBrowser(theModule,true,aTblObj);
+ //UpdateObjBrowser(theModule,true,aTblObj);
break;
}
}
switch (aType) {
case VISU::TPOINTMAP3D:
if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
- displayer()->Display(anIO->getEntry());
- aViewWindow->highlight(anIO, 1);
- aViewWindow->getRenderer()->ResetCameraClippingRange();
- aViewWindow->Repaint();
- break;
+ displayer()->Display(anIO->getEntry());
+ aViewWindow->highlight(anIO, 1);
+ aViewWindow->getRenderer()->ResetCameraClippingRange();
+ aViewWindow->Repaint();
+ break;
}
else {
- if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
- aPlot2d->Repaint();
- displayer()->Display(anIO->getEntry());
+ if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
+ aPlot2d->Repaint();
+ displayer()->Display(anIO->getEntry());
}
case VISU::TCURVE:
case VISU::TCONTAINER:
default: {
VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
if(aPrs3d){
- if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
- displayer()->Display(anIO->getEntry());
- aViewWindow->highlight(anIO, 1);
- aViewWindow->getRenderer()->ResetCameraClippingRange();
- aViewWindow->Repaint();
- }
+ if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
+ displayer()->Display(anIO->getEntry());
+ aViewWindow->highlight(anIO, 1);
+ aViewWindow->getRenderer()->ResetCameraClippingRange();
+ aViewWindow->Repaint();
+ }
}
}
}
LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
if (!aSelectionMgr)
return;
-
+
SALOME_ListIO aSel, aList;
aSelectionMgr->selectedObjects(aSel);
extractContainers(aSel, aList);
aChild = anIter->Value();
CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
if(!CORBA::is_nil(aCORBAObject)){
- PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
- if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
- hasCurvesChildren = true;
+ PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
+ if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
+ hasCurvesChildren = true;
}
}
if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
return;
} else {
- // activate SVTK Viewer
+ // activate SVTK Viewer
getApp()->getViewManager( SVTK_Viewer::Type(), true );
return;
}
for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
if (anActor->GetVisibility() > 0)
if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
- RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
+ RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
anVISUActor->VisibilityOff();
}
}
//----------------------------------------------------------------------------
VISU::Prs3d_i*
GetPrsToModify(const SalomeApp_Module* theModule,
- Handle(SALOME_InteractiveObject)& theIO)
+ Handle(SALOME_InteractiveObject)& theIO)
{
VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
if(aSelectionInfo.empty())
QColor aColor (int(255*anOldColor.R),
- int(255*anOldColor.G),
- int(255*anOldColor.B));
+ int(255*anOldColor.G),
+ int(255*anOldColor.B));
QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
if (aColorNew.isValid()) {
aNewColor.R = aColorNew.red()/255.;
aGauss->SetBarVisible( theVisibility );
RecreateActor(this, aGauss);
update = true;
- }
- }
+ }
+ }
}
}
}
anIO = it.Value();
if (anIO->hasEntry()) {
if (IsRemovable(anIO->getEntry(), this)) {
- aNameList.append("\n - ");
- // Get Name Of the Main Object if it's a referenced object
- VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
- if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
- _PTR(SObject) aRefSObject;
- if (aSObject->ReferencedObject(aRefSObject)) {
- QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
- aNameList.append( aRefName );
- }
- else
- aNameList.append(anIO->getName());
- }
- anEntries[i++] = anIO->getEntry();
+ aNameList.append("\n - ");
+ // Get Name Of the Main Object if it's a referenced object
+ VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
+ _PTR(SObject) aRefSObject;
+ if (aSObject->ReferencedObject(aRefSObject)) {
+ QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
+ aNameList.append( aRefName );
+ }
+ else
+ aNameList.append(anIO->getName());
+ }
+ anEntries[i++] = anIO->getEntry();
}
}
}
nbSelected = i;
if (nbSelected < 1) {
SUIT_MessageBox::warning(GetDesktop(this),
- QObject::tr("WRN_VISU"),
- QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
+ QObject::tr("WRN_VISU"),
+ QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
return;
}
if ( SUIT_MessageBox::question( GetDesktop(this),
- QObject::tr( "WRN_VISU" ),
- QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
- SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
+ QObject::tr( "WRN_VISU" ),
+ QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
+ SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
return;
// There is a transaction
emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
_PTR(SObject) aRefSObject;
if (aSObject->ReferencedObject(aRefSObject)) {
- // It can be a reference on curve, published under a container.
- // In this case the curve should be removed from the container.
- // See bug 10441.
- VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
- VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
- if(aRefBase && aRefBase->GetType() == VISU::TMESH){
- DeleteSObject(this, aCStudy, aRefSObject);
- UpdateObjBrowser(this, true, aRefSObject);
- }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
- CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
- VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
- _PTR(SObject) aParentSO = aSObject->GetFather();
- VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
- if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
- if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
- if(aContainer->GetNbCurves() > 0){
- aContainer->RemoveCurve(aCurve);
- UpdateObjBrowser(this, true, aParentSO);
- }
- }
- }
- }
+ // It can be a reference on curve, published under a container.
+ // In this case the curve should be removed from the container.
+ // See bug 10441.
+ VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
+ VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
+ if(aRefBase && aRefBase->GetType() == VISU::TMESH){
+ DeleteSObject(this, aCStudy, aRefSObject);
+ UpdateObjBrowser(this, true, aRefSObject);
+ }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
+ CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
+ VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
+ _PTR(SObject) aParentSO = aSObject->GetFather();
+ VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
+ if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
+ if(aContainer->GetNbCurves() > 0){
+ aContainer->RemoveCurve(aCurve);
+ UpdateObjBrowser(this, true, aParentSO);
+ }
+ }
+ }
+ }
}
else{
- DeleteSObject(this, aCStudy, aSObject);
- UpdateObjBrowser(this, true, aSObject);
+ DeleteSObject(this, aCStudy, aSObject);
+ UpdateObjBrowser(this, true, aSObject);
}
}
}
if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
- _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
- _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
- if(IsSObjectTable(aSObject)){
- VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
- if(aDlg->exec() == QDialog::Accepted){
- if(!IsStudyLocked(aStudy)){
- // if study is not locked - create new container, create curves and insert them
- // into container, then plot container if current viewer is of VIEW_PLOT2D type
- int horIndex;
- QList<int> verIndices, zIndices;
- aDlg->getCurvesSource( horIndex, verIndices, zIndices );
- if( horIndex >= 0 && verIndices.count() > 0 ){
- CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
- if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
- for( int i = 0; i < verIndices.count(); i++ ){
- VISU::Curve_var aCurveObject =
- GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
- if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
- bool isAuto;
- int marker, line, lineWidth;
- QColor color;
- if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
- line, lineWidth, color) && !isAuto )
- {
- SALOMEDS::Color c;
- c.R = color.red() /255.;
- c.G = color.green()/255.;
- c.B = color.blue() /255.;
- aCurve->SetColor( c );
- aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
- aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
- }
- aContainer->AddCurve(aCurveObject);
- }
- }
- UpdateObjBrowser(this);
- PlotContainer( this, aContainer, VISU::eDisplay );
- }
- }
- } else {
- // get name of SObject
- QString aSObjectName;
- _PTR(GenericAttribute) anAttr;
- if(aSObject->FindAttribute( anAttr, "AttributeName" )){
- _PTR(AttributeName) aName = anAttr;
- aSObjectName = QString( aName->Value().c_str() );
- }
- // if study is locked just get curves info and plot them
- // if current viewer is of VIEW_PLOT2D type
- QList<Plot2d_Curve*> container;
- aDlg->getCurves( container );
- if ( !container.isEmpty() ) {
- GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
- GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
- }
- }
- }
- delete aDlg;
- }
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
+ if(IsSObjectTable(aSObject)){
+ VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+ if(aDlg->exec() == QDialog::Accepted){
+ if(!IsStudyLocked(aStudy)){
+ // if study is not locked - create new container, create curves and insert them
+ // into container, then plot container if current viewer is of VIEW_PLOT2D type
+ int horIndex;
+ QList<int> verIndices, zIndices;
+ aDlg->getCurvesSource( horIndex, verIndices, zIndices );
+ if( horIndex >= 0 && verIndices.count() > 0 ){
+ CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
+ if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
+ for( int i = 0; i < verIndices.count(); i++ ){
+ VISU::Curve_var aCurveObject =
+ GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+ bool isAuto;
+ int marker, line, lineWidth;
+ QColor color;
+ if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+ line, lineWidth, color) && !isAuto )
+ {
+ SALOMEDS::Color c;
+ c.R = color.red() /255.;
+ c.G = color.green()/255.;
+ c.B = color.blue() /255.;
+ aCurve->SetColor( c );
+ aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+ aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+ }
+ aContainer->AddCurve(aCurveObject);
+ }
+ }
+ UpdateObjBrowser(this);
+ PlotContainer( this, aContainer, VISU::eDisplay );
+ }
+ }
+ } else {
+ // get name of SObject
+ QString aSObjectName;
+ _PTR(GenericAttribute) anAttr;
+ if(aSObject->FindAttribute( anAttr, "AttributeName" )){
+ _PTR(AttributeName) aName = anAttr;
+ aSObjectName = QString( aName->Value().c_str() );
+ }
+ // if study is locked just get curves info and plot them
+ // if current viewer is of VIEW_PLOT2D type
+ QList<Plot2d_Curve*> container;
+ aDlg->getCurves( container );
+ if ( !container.isEmpty() ) {
+ GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
+ GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
+ }
+ }
+ }
+ delete aDlg;
+ }
}
}
}else if(!aSelectionItem.myIO.IsNull()){
if(IsSObjectTable(aSObject)){
VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
if(aDlg->exec() == QDialog::Accepted){
- _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
+ _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
if(!IsStudyLocked(aStudy)){
// if study is not locked - create new table and container objects, create curves
// and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
if ( horIndex >= 0 && verIndices.count() > 0 ) {
VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
if(!CORBA::is_nil(aTableObject)){
- VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
+ VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
- for ( int i = 0; i < verIndices.count(); i++ ) {
- VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
- ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
- if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
- bool isAuto;
- int marker, line, lineWidth;
- QColor color;
- if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
- line, lineWidth, color) && !isAuto )
- {
- SALOMEDS::Color c;
- c.R = color.red()/255.;
- c.G = color.green()/255.;
- c.B = color.blue()/255.;
- aCurve->SetColor( c );
- aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
- aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
- }
- aContainerObject->AddCurve(aCurveObject);
- }
- }
- UpdateObjBrowser(this);
- PlotContainer( this, aContainer, VISU::eDisplay );
- }
- }
+ for ( int i = 0; i < verIndices.count(); i++ ) {
+ VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
+ ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+ if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
+ bool isAuto;
+ int marker, line, lineWidth;
+ QColor color;
+ if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
+ line, lineWidth, color) && !isAuto )
+ {
+ SALOMEDS::Color c;
+ c.R = color.red()/255.;
+ c.G = color.green()/255.;
+ c.B = color.blue()/255.;
+ aCurve->SetColor( c );
+ aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
+ aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
+ }
+ aContainerObject->AddCurve(aCurveObject);
+ }
+ }
+ UpdateObjBrowser(this);
+ PlotContainer( this, aContainer, VISU::eDisplay );
+ }
+ }
} else {
- // get name of SObject
- QString aSObjectName;
- _PTR(GenericAttribute) anAttr;
- if(aSObject->FindAttribute(anAttr, "AttributeName")){
- _PTR(AttributeName) aName = anAttr;
- aSObjectName = QString( aName->Value().c_str() );
- }
+ // get name of SObject
+ QString aSObjectName;
+ _PTR(GenericAttribute) anAttr;
+ if(aSObject->FindAttribute(anAttr, "AttributeName")){
+ _PTR(AttributeName) aName = anAttr;
+ aSObjectName = QString( aName->Value().c_str() );
+ }
// if study is locked just get curves info and plot them
QList<Plot2d_Curve*> container;
aDlg->getCurves( container );
ViewManagerList aViewManagerList;
getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
SUIT_ViewManager* aViewManager;
- foreach( aViewManager, aViewManagerList ) {
+ foreach( aViewManager, aViewManagerList ) {
if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
aViewer->renameAll( anIO, Name.toLatin1().constData() );
if (!isAny) {
SUIT_MessageBox::warning(GetDesktop(this),
- QObject::tr("WRN_VISU"),
- QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
+ QObject::tr("WRN_VISU"),
+ QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
}
}
if( myPanels.find( SelectionPanelId ) != myPanels.end() )
{
if( VisuGUI_SelectionPanel* aSelectionPanel =
- dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+ dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
{
- if( aSelectionPanel->isVisible() )
- aSelectionPanel->hide();
- else
- aSelectionPanel->show();
+ if( aSelectionPanel->isVisible() )
+ aSelectionPanel->hide();
+ else
+ aSelectionPanel->show();
}
}
}
else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
{
if( VisuGUI_SelectionPanel* aSelectionPanel =
- dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
- aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
+ dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
+ aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
}
}
// At least one action must be checked
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()));
+ 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()));
+ this, SLOT(OnValuesLabelingParams()));
- createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
+ createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
this, SLOT(OnArcQuadMode()));
-
+
createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
this, SLOT(OnLineQuadMode()));
parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
-
+
}
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 );
QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
"'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
- "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
+ "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
- "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
- "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
+ "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
+ "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
// VISU root commands
QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
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_CLEAR_CONTAINER ), aRule );
mgr->setRule( action( VISU_EDIT_SCALARMAP ),
- "selcount=1 and type='VISU::TSCALARMAP'" );
+ "selcount=1 and type='VISU::TSCALARMAP'" );
mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
- "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
+ "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
- "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
+ "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
mgr->setRule( action( VISU_EDIT_CUTPLANES ),
- "selcount=1 and type='VISU::TCUTPLANES'" );
+ "selcount=1 and type='VISU::TCUTPLANES'" );
mgr->setRule( action( VISU_EDIT_CUTLINES ),
- "selcount=1 and type='VISU::TCUTLINES'" );
+ "selcount=1 and type='VISU::TCUTLINES'" );
mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
- "selcount=1 and type='VISU::TCUTSEGMENT'" );
+ "selcount=1 and type='VISU::TCUTSEGMENT'" );
mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
- "selcount=1 and type='VISU::TISOSURFACES'" );
+ "selcount=1 and type='VISU::TISOSURFACES'" );
mgr->setRule( action( VISU_EDIT_VECTORS ),
- "selcount=1 and type='VISU::TVECTORS'" );
+ "selcount=1 and type='VISU::TVECTORS'" );
mgr->setRule( action( VISU_EDIT_STREAMLINES ),
- "selcount=1 and type='VISU::TSTREAMLINES'" );
+ "selcount=1 and type='VISU::TSTREAMLINES'" );
mgr->setRule( action( VISU_EDIT_PLOT3D ),
- "selcount=1 and type='VISU::TPLOT3D'" );
+ "selcount=1 and type='VISU::TPLOT3D'" );
mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
- "selcount=1 and type='VISU::TPOINTMAP3D'" );
+ "selcount=1 and type='VISU::TPOINTMAP3D'" );
aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
mgr->setRule( action( VISU_EDIT_PLOT3D ),
- "selcount=1 and type='VISU::TPLOT3D'" );
+ "selcount=1 and type='VISU::TPLOT3D'" );
//aRule = "client='ObjectBrowser' and type='MEDFIELD'";
//mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
if (!anIO.IsNull() && anIO->hasEntry()) {
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
if ( !aSObject )
- continue;
+ continue;
if ( !isOBClient ) {
- QString aName = QString( aSObject->GetName().c_str() );
- while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
- aName.remove( (aName.length() - 1), 1 );
- theTitle = aName;
+ QString aName = QString( aSObject->GetName().c_str() );
+ while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
+ aName.remove( (aName.length() - 1), 1 );
+ theTitle = aName;
}
CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
if (CORBA::is_nil(aCORBAObject)) {
- VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
- if (aType == VISU::TTIMESTAMP) {
- _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
- _PTR(SObject) aPrs;
- for (; anIter->More(); anIter->Next()) {
- aPrs = anIter->Value();
- if (!aPrs)
- continue;
- std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
- nbPrs += aSubList.size();
- }
- }
+ VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
+ if (aType == VISU::TTIMESTAMP) {
+ _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
+ _PTR(SObject) aPrs;
+ for (; anIter->More(); anIter->Next()) {
+ aPrs = anIter->Value();
+ if (!aPrs)
+ continue;
+ std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
+ nbPrs += aSubList.size();
+ }
+ }
}
}
}
if (!anIO.IsNull() && anIO->hasEntry()) {
_PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
if ( !aSObject )
- continue;
+ continue;
VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
if (aType == VISU::TCURVE) {
- isCurves = true;
+ isCurves = true;
} else {
- VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
- if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
- if (aPrsObject->GetType() == VISU::TCUTPLANES) {
- if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
- isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
- }
- }
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
+ if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
+ if (aPrsObject->GetType() == VISU::TCUTPLANES) {
+ if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
+ isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
+ }
+ }
}
}
}
if (aSFather1) {
std::string aValue = aSFather1->GetName();
if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
- theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
+ theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
}
}
}
action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
bool aResult = SalomeApp_Module::deactivateModule( theStudy );
-
+
emit moduleDeactivated();
return aResult;
void VisuGUI::studyActivated()
{
GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
-
+
}
/*
setPreferenceProperty( numcol, "max", 256 );
addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
- LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
+ LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
setPreferenceProperty( lPrec, "min", 1 );
setPreferenceProperty( lPrec, "max", 100 );
-
+
int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
//setPreferenceProperty( frame, "orientation", "vertical" );
setPreferenceProperty( frame, "columns", "2" );
//setPreferenceProperty( psSzFrame, "columns", "2" );
int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
- frame, LightApp_Preferences::GroupBox );
+ frame, LightApp_Preferences::GroupBox );
setPreferenceProperty( posVSizeGr, "columns", 2 );
int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
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,
// group: "Origin & Size Horizontal"
int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
- frame, LightApp_Preferences::GroupBox );
+ frame, LightApp_Preferences::GroupBox );
setPreferenceProperty( posHSizeGr, "columns", 2 );
int xh = addPreference( tr( "VISU_X" ), 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( "VISU_BAR_HEIGHT" ), posHSizeGr,
{
int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
setPreferenceProperty( cacheGroup, "columns", 2 );
-
+
int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
- LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
-
+ LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
+
modes.clear();
modes.append( tr( "VISU_MINIMAL" ) );
modes.append( tr( "VISU_LIMITED" ) );
setPreferenceProperty( memory_mode, "strings", modes );
-
+
indices.clear();
indices.append( 0 );
indices.append( 1 );
setPreferenceProperty( memory_mode, "indexes", indices );
-
+
int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
- LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
+ LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
setPreferenceProperty( memory_limit, "min", 1 );
setPreferenceProperty( memory_limit, "max", 5000 );
setPreferenceProperty( memory_limit, "step", 10 );
{
int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
setPreferenceProperty( animationGroup, "columns", 3 );
-
- int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
- addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
- addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
- addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
-
+
+ int speed = addPreference( tr( "Speed" ), animationGroup,
+ LightApp_Preferences::IntSpin, "VISU", "speed" );
+ addPreference( tr( "Cycled animation" ), animationGroup,
+ LightApp_Preferences::Bool, "VISU", "cycled_animation" );
+ addPreference( tr( "Use proportional timing" ), animationGroup,
+ LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
+ addPreference( tr( "Clean memory at each frame" ), animationGroup,
+ LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
+
setPreferenceProperty( speed, "min", 1 );
setPreferenceProperty( speed, "max", 99 );
}
{
int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
setPreferenceProperty( sweepGroup, "columns", 2 );
-
- int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
+
+ int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
+ LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
QStringList sweep_modes;
sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
indices.append( 2 );
setPreferenceProperty( modeSw, "strings", sweep_modes );
setPreferenceProperty( modeSw, "indexes", indices );
-
+
int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
- LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
+ LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
/* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
- LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
+ LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
- LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
+ LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
QStringList ranges;
ranges.append( tr( "PERIOD_PI" ) );
indices.append( 1 );
setPreferenceProperty( rangeSw, "strings", ranges );
setPreferenceProperty( rangeSw, "indexes", indices );
-
+
setPreferenceProperty( timestep, "min", 0.1 );
setPreferenceProperty( timestep, "step", 0.1 );
setPreferenceProperty( timestep, "max", 1000 );
addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
- LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
+ LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
setPreferenceProperty( point_precision, "min", 1 );
setPreferenceProperty( point_precision, "max", 16 );
setPreferenceProperty( point_precision, "step", 1 );
setPreferenceProperty( featureEdgesGr, "columns", 2 );
int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
- LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
+ LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
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
addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
// color
- addPreference( tr( "COLOR" ), valLblFontGr,
+ addPreference( tr( "COLOR" ), valLblFontGr,
LightApp_Preferences::Color, "VISU", "values_labeling_color" );
}
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
}
- }
-
+ }
+
if ( !aWarning.isEmpty() ){
aWarning += "The default values are applied instead.";
SUIT_MessageBox::warning(GetDesktop(this),
SUIT_ViewManager*
VisuGUI
::getViewManager(const QString& theType,
- const bool theIsCreate)
+ const bool theIsCreate)
{
return getApp()->getViewManager(theType,theIsCreate);
}
if (!anIO.IsNull() && anIO->hasEntry()) {
aSObject = aCStudy->FindObjectID(anIO->getEntry());
if ( !aSObject )
- continue;
+ continue;
VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
if (aPrsObject->GetType() == VISU::TCUTPLANES) {
- aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
- if (aCutPrs)
- break;
+ aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
+ if (aCutPrs)
+ break;
}
}
}
Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
if (aType != TTIMESTAMP )
- return;
+ return;
QString aMeshName = aRestoringMap["myMeshName"];
QString anEntity = aRestoringMap["myEntityId"];
int aPos;
SUIT_ViewWindow* aViewWindow = 0;
// if (anIsVVTK) {
-// aViewWindow = GetViewWindow<VVTK_Viewer>(this);
-// aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
+// aViewWindow = GetViewWindow<VVTK_Viewer>(this);
+// aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
// } else {
- aViewWindow = GetViewWindow<SVTK_Viewer>(this);
- aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
- // }
+ aViewWindow = GetViewWindow<SVTK_Viewer>(this);
+ aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
+ // }
GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
VISU::Plot3D_i* aPrs3d =
CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
- aTimeStampSObj,
- (const char*)aMeshName.toLatin1(),
- (Entity)anEntity.toInt(),
- (const char*)aFieldName.toLatin1(),
- aTimeStampId.toInt(),
- ColoredPrs3d_i::EPublishUnderTimeStamp);
+ aTimeStampSObj,
+ (const char*)aMeshName.toLatin1(),
+ (Entity)anEntity.toInt(),
+ (const char*)aFieldName.toLatin1(),
+ aTimeStampId.toInt(),
+ ColoredPrs3d_i::EPublishUnderTimeStamp);
if (aPrs3d) {
- SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
- int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
- if (!aValue) {
- VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
- aDlg->initFromPrsObject(aPrs3d, true);
- int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
- double aRotX = aCutPrs->GetRotateX();
- double aRotY = aCutPrs->GetRotateY();
- double aPlanePos = aCutPrs->GetPlanePosition(0);
- aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
-
- if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
- DeletePrs3d(this, aPrs3d);
- delete aDlg;
- return;
- }
- delete aDlg;
- UpdateObjBrowser(this, true, aTimeStampSObj);
- }
- SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
- if ( aSVtkWindow ) {
- PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
- aSVtkWindow->onFitAll();
-
- AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
- }
- if (aPrs3d)
- emit presentationCreated(aPrs3d);
+ SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
+ int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
+ if (!aValue) {
+ VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
+ aDlg->initFromPrsObject(aPrs3d, true);
+ int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
+ double aRotX = aCutPrs->GetRotateX();
+ double aRotY = aCutPrs->GetRotateY();
+ double aPlanePos = aCutPrs->GetPlanePosition(0);
+ aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
+
+ if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
+ DeletePrs3d(this, aPrs3d);
+ delete aDlg;
+ return;
+ }
+ delete aDlg;
+ UpdateObjBrowser(this, true, aTimeStampSObj);
+ }
+ SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
+ if ( aSVtkWindow ) {
+ PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
+ aSVtkWindow->onFitAll();
+
+ AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
+ }
+ if (aPrs3d)
+ emit presentationCreated(aPrs3d);
}
}
application()->putInfo(QObject::tr("INF_DONE"));
QFileInfo aFileInfo =
SUIT_FileDlg::getFileName(GetDesktop(this),
- aPath,
- aFilter,
- tr("MEN_EXPORT_MED"), // "Export To Med File"
- false);
+ aPath,
+ aFilter,
+ tr("MEN_EXPORT_MED"), // "Export To Med File"
+ false);
QString aFile = aFileInfo.filePath();
if ( aFile.length() > 0 ) {
}
/*!
- \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
+ \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()
*/
TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
- if(!aPrs3d)
+ if (!aPrs3d)
return;
SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
- if(!aViewWindow)
+ if (!aViewWindow)
return;
VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
- if(!anActor)
+ if (!anActor)
return;
- if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
+ 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) )
+ 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
+ \brief SLOT called when "Labeling parameters" popup menu item of presentation
is clicked launch dialog box for changing parameters of labeling
\sa OnValuesLabeling()
*/
{
Handle(SALOME_InteractiveObject) anIO;
if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
- EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
+ EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
}
/*!
\brief Adds preferences for dfont of VTK viewer
\param param parameter
\return identifier of preferences
*/
-int VisuGUI::addVtkFontPref(
- const QString& label,
- const int pId,
- const QString& param,
+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;
}
/*!
- \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
+ \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
\ of presentation is cliked
*/
void VisuGUI::OnArcQuadMode(){
}
/*!
- \brief SLOT called when "2D Quadratic -> Lines" popup menu item
+ \brief SLOT called when "2D Quadratic -> Lines" popup menu item
\ of presentation is cliked
*/
void VisuGUI::OnLineQuadMode(){
ChangeQuadratic2DRepresentation(this,VISU::LINES);
}
-
// File : VisuGUI_GaussPointsDlg.cxx
// Author : Oleg UVAROV
// Module : VISU
-//
+
#include "VisuGUI_GaussPointsDlg.h"
#include "VISUConfig.hh"
QButtonGroup* BarTypeGroup = new QButtonGroup( ActiveBarGroup );
QGroupBox* aGB = new QGroupBox( ActiveBarGroup );
QVBoxLayout* aVBLay = new QVBoxLayout( aGB );
-
+
BarTypeGroup->setExclusive( true );
//aGB->setFrameStyle( QFrame::NoFrame );
aVBLay->setMargin( 0 );
RangeGroup->addButton( RBFieldRange );
RangeGroup->addButton( RBImposedRange );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
+
+ QDoubleValidator* dv = new QDoubleValidator(this);
+ dv->setDecimals(aPrecision);
+
MinEdit = new QLineEdit( aGB );
MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MinEdit->setMinimumWidth( 70 );
- MinEdit->setValidator( new QDoubleValidator(this) );
+ MinEdit->setValidator( dv );
MinEdit->setText( "0.0" );
QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB);
MinLabel->setBuddy(MinEdit);
MaxEdit = new QLineEdit( aGB );
MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MaxEdit->setMinimumWidth( 70 );
- MaxEdit->setValidator( new QDoubleValidator(this) );
+ MaxEdit->setValidator( dv );
MaxEdit->setText( "0.0" );
QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB);
MaxLabel->setBuddy(MaxEdit);
aMainLayout->addWidget( aSaveBox );
QHBoxLayout* aHBoxLay = new QHBoxLayout( aSaveBox );
-
+
myTextBtn = new QPushButton("Text properties...", aSaveBox);
aHBoxLay->addWidget( myTextBtn );
-
+
myBarBtn = new QPushButton("Bar properties...", aSaveBox);
aHBoxLay->addWidget( myBarBtn );
MinEdit->setEnabled( false );
MaxEdit->setEnabled( false );
- MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
- MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(myPrsCopy->GetMin(), 'g', aPrecision));
+ MaxEdit->setText(QString::number(myPrsCopy->GetMax(), 'g', aPrecision));
}
MinEdit->setEnabled( RBImposedRange->isChecked() );
MaxEdit->setEnabled( RBImposedRange->isChecked() );
- MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
- MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(myPrsCopy->GetMin(), 'g', aPrecision));
+ MaxEdit->setText(QString::number(myPrsCopy->GetMax(), 'g', aPrecision));
}
MinEdit->setEnabled( false );
MaxEdit->setEnabled( false );
- MinEdit->setText( QString::number( myPrsCopy->GetMin() ) );
- MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(myPrsCopy->GetMin(), 'g', aPrecision));
+ MaxEdit->setText(QString::number(myPrsCopy->GetMax(), 'g', aPrecision));
}
{
myPrsCopy->SetScalarMode( theMode );
if ( UseFieldRange() ) {
- MinEdit->setText( QString::number( myPrsCopy->GetSourceMin() ) );
- MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax() ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(myPrsCopy->GetSourceMin(), 'g', aPrecision));
+ MaxEdit->setText(QString::number(myPrsCopy->GetSourceMax(), 'g', aPrecision));
}
}
* Initialise dialog box from presentation object
*/
void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs,
- bool theInit )
+ bool theInit )
{
myPrsCopy = thePrs;
MaxEdit->setEnabled( false );
}
- MinEdit->setText( QString::number( thePrs->GetMin() ) );
- MaxEdit->setText( QString::number( thePrs->GetMax() ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(thePrs->GetMin(), 'g', aPrecision));
+ MaxEdit->setText(QString::number(thePrs->GetMax(), 'g', aPrecision));
setPosAndSize( thePrs->GetPosX(),
- thePrs->GetPosY(),
- thePrs->GetWidth(),
- thePrs->GetHeight(),
- thePrs->GetBarOrientation());
+ thePrs->GetPosY(),
+ thePrs->GetWidth(),
+ thePrs->GetHeight(),
+ thePrs->GetBarOrientation());
- if(RBvert->isChecked()) {
+ if (RBvert->isChecked()) {
myVerTS = thePrs->GetTitleSize();
myVerLS = thePrs->GetLabelSize();
myVerBW = thePrs->GetBarWidth();
QString anUnit = QString(aUnitNames[i].c_str()).simplified();
if(anUnit.isNull() || anUnit == "")
anUnit = "-";
-
+
aComponent = aComponent + ", " + anUnit;
myModeCombo->addItem(aComponent);
thePrs->SetShadowTitle(isTitleShadow);
thePrs->SetTitFontType(aTitleFontFamily);
thePrs->SetTitleColor(aTitColor.red()/255.,
- aTitColor.green()/255.,
- aTitColor.blue()/255.);
+ aTitColor.green()/255.,
+ aTitColor.blue()/255.);
// "Label"
QColor aLblColor (255, 255, 255);
thePrs->SetShadowLabel(isLabelShadow);
thePrs->SetLblFontType(aLabelFontFamily);
thePrs->SetLabelColor(aLblColor.red()/255.,
- aLblColor.green()/255.,
- aLblColor.blue()/255.);
+ aLblColor.green()/255.,
+ aLblColor.blue()/255.);
}
return 1;
PrsGroup->addButton( myResultsButton );
PrsGroup->addButton( myGeometryButton );
PrsGroup->addButton( myDefShapeButton );
-
+
myTabBox = new QTabWidget (this);
aDefShapeLayout->setAlignment(Qt::AlignTop);
aDefShapeLayout->setSpacing(6);
aDefShapeLayout->setMargin(11);
-
+
SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
QLabel* aScaleLabel = new QLabel( tr( "SCALE_FACTOR" ), myDefShapeBox );
myScaleSpinBox = new QtxDoubleSpinBox( 0.0, 10.0, 0.1, aPrecision*(-1), 32, myDefShapeBox );
-
+
aDefShapeLayout->addWidget( aScaleLabel, 0, 0 );
aDefShapeLayout->addWidget( myScaleSpinBox, 0, 1 );
{}
void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
- bool theInit )
+ bool theInit )
{
if( theInit )
myPrsCopy = VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish);
myPrsCopy->SetMagnification( mySizeBox->getMagnification() );
myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() );
- VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs);
-
+ VISU::TSameAsFactory<VISU::TGAUSSPOINTS>().Copy(myPrsCopy, thePrs);
+
//Set created Gauss points presentation selected,
//Issue 0019874(EDF 746 VISU: Picking alphanumeric Gauss)
if(thePrs){
SALOME_ListIO aListIO;
- // LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule);
+ //LightApp_SelectionMgr* aSelectionMgr = VISU::GetSelectionMgr(myModule);
Handle(SALOME_InteractiveObject) anIO = thePrs->GetIO();
if(anIO && anIO->hasEntry()) {
aListIO.Append(anIO);
VISU::UpdateObjBrowser(myModule,true);
- //IPAL20836 aSelectionMgr->setSelectedObjects(aListIO);
+ //IPAL20836 aSelectionMgr->setSelectedObjects(aListIO);
}
else
myInputPane->SetRestoreInitialSelection(true);
aWarning.append( "presentation might be too important to ensure an acceptable frame rate.\n\n" );
aWarning.append( "Can you please confirm that you want to continue anyway?" );
if( SUIT_MessageBox::warning( this, tr( "Warning" ), aWarning, tr( "&OK" ), tr( "&Cancel" ) ) == 1 )
- return;
+ return;
}
/*
// File : VisuGUI_Prs3dDlg.cxx
// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
-//
+
#include "VisuGUI_Prs3dDlg.h"
#include "VisuGUI.h"
QGroupBox* aTitleGrp = new QGroupBox ( tr("LBL_TITLE"), this);
QVBoxLayout* aVBLay = new QVBoxLayout( aTitleGrp );
- // edit line
+ // edit line
myTitleEdt = new QLineEdit (aTitleGrp);
aVBLay->addWidget( myTitleEdt);
aHBLay = new QHBoxLayout( aHBox );
aHBLay->setSpacing(5);
-
+
myLabelFont = new SVTK_FontWidget (aHBox);
aHBLay->addWidget( myLabelFont );
else {
SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"),
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ "application")).arg(aHelpFileName),
QObject::tr("BUT_OK"));
}
}
aMainLay->setMargin( 5 );
// dimensions
-
+
QGroupBox* aDimGrp = new QGroupBox( this );
QGridLayout* aDimGrpLay = new QGridLayout( aDimGrp );
aDimGrpLay->setSpacing( 5 );
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->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->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 ) );
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( aPrecLbl, 2, 0 );
aDimGrpLay->addWidget( myPrecisionSpin, 2, 1 );
aDimGrpLay->addWidget( myUnitsChk, 2, 2, 1, 2 );
-
+
aMainLay->addWidget( aDimGrp );
// Common buttons ===========================================================
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::setRatios( int titleRatioSize, int labelRatioWidth,
- int barRatioWidth, int barRatioHeight )
+ int barRatioWidth, int barRatioHeight )
{
myTitleSizeSpin->setValue( myTitleSize = titleRatioSize );
myLabelSizeSpin->setValue( myLabelSize = labelRatioWidth );
//----------------------------------------------------------------------------
void VisuGUI_BarPrefDlg::getRatios( int& titleRatioSize, int& labelRatioWidth,
- int& barRatioWidth, int& barRatioHeight )
+ int& barRatioWidth, int& barRatioHeight )
{
titleRatioSize = myTitleSizeSpin->value();
labelRatioWidth = myLabelSizeSpin->value();
}
else {
SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
- tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
- arg( app->resourceMgr()->stringValue( "ExternalBrowser",
- "application" ) ).
- arg( aHelpFileName ) );
+ tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+ arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+ "application" ) ).
+ arg( aHelpFileName ) );
}
}
{
QString dVal;
int aBWH = myOrientation == 1 ? myBarWidthSpin->value() : myBarHeightSpin->value();
- if( ( myLabelSizeSpin->value()+ aBWH ) > 100 )
+ if( ( myLabelSizeSpin->value()+ aBWH ) > 100 )
{
SUIT_MessageBox::warning( this, tr( "WRN_VISU" ), tr( "MSG_BIG_SCALE" ) );
return;
- }
-
+ }
+
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();
Constructor
*/
VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool theIsDisplayGaussMetric, bool thePreview )
- : QWidget( parent ),
+ : QWidget( parent ),
myPreviewActor( 0 ),
myScalarMap( 0 ),
myScalarMapPL( 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);
-
+
propertyName = QString("scalar_bar_horizontal_");
myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.);
myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.);
RangeGroup->addButton( RBIrange, 1 );
RBFrange->setChecked( true );
+ int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 );
+ QDoubleValidator* dv = new QDoubleValidator(this);
+ dv->setDecimals(aPrecision);
+
MinEdit = new QLineEdit( aGB );
MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
//MinEdit->setMinimumWidth( 70 );
- MinEdit->setValidator( new QDoubleValidator(this) );
+ MinEdit->setValidator( dv );
MinEdit->setText( "0.0" );
QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB);
MinLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
MaxEdit = new QLineEdit( aGB );
MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
//MaxEdit->setMinimumWidth( 70 );
- MaxEdit->setValidator( new QDoubleValidator(this) );
+ MaxEdit->setValidator( dv );
MaxEdit->setText( "0.0" );
QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB);
MaxLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
LabelSpin->setMinimum( 2 );
LabelSpin->setMaximum( 65 );
LabelSpin->setSingleStep( 1 );
-
+
LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
//LabelSpin->setMinimumWidth( 70 );
LabelSpin->setValue( 5 );
QHBoxLayout* aVBLay = new QHBoxLayout( aSaveBox );
aVBLay->addWidget( myTextBtn = new QPushButton("Text properties...", aSaveBox) );
aVBLay->addWidget( myBarBtn = new QPushButton("Bar properties...", aSaveBox) );
-
+
aMainLayout->addWidget( myTextDlg = new VisuGUI_TextPrefDlg(this) );
myTextDlg->setTitleVisible(!thePreview);
myBarDlg = new VisuGUI_BarPrefDlg(this);
aMainLayout->addWidget( CheckGroup );
//QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup );
QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup );
-
+
myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup);
myPreviewCheck->setChecked(false);
CheckGroupLayout->addWidget(myPreviewCheck, 0, 0);
-
+
myHideBar = new QCheckBox(tr("HIDE_SCALAR_BAR"), CheckGroup);
myHideBar->setChecked(false);
CheckGroupLayout->addWidget(myHideBar, 0, 1);
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( myTextBtn, SIGNAL( clicked() ), this, SLOT( onTextPref() ) );
connect( myBarBtn, SIGNAL( clicked() ), this, SLOT( onBarPref() ) );
connect( myPreviewCheck, SIGNAL( toggled( bool )), this, SLOT( onPreviewCheck( bool ) ) );
-
+
connect( CBDistr, SIGNAL( toggled( bool ) ), this, SLOT( onShowDistribution( bool ) )); // RKV
-
+
connect( ColorSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
connect( LabelSpin, SIGNAL( valueChanged( int ) ), this, SLOT( updatePreview() ));
connect( WidthSpin, SIGNAL( valueChanged( double ) ), this, SLOT( updatePreview() ));
}
else
aResourceMgr->setValue("VISU", "scalar_range_type", 0);
-
+
aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic());
aResourceMgr->setValue("VISU", "scalar_bar_show_distribution", isShowDistribution()); // RKV
-
+
////
if (myIsStoreTextProp) {
isTitleBold, isTitleItalic, isTitleShadow);
QFont aTitleFont;
-
+
aTitleFont.setBold(isTitleBold);
aTitleFont.setItalic(isTitleItalic);
aTitleFont.setOverline(isTitleShadow);
-
+
QString titleFontFamily;
switch (aTitleFontFamily) {
case VTK_ARIAL:
break;
}
aTitleFont.setFamily(titleFontFamily);
-
+
aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont);
-
+
aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor);
-
+
// "Label"
QColor aLabelColor (255, 255, 255);
int aLabelFontFamily = VTK_ARIAL;
QFont aLabelFont;
-
+
aLabelFont.setBold(isLabelBold);
aLabelFont.setItalic(isLabelItalic);
aLabelFont.setOverline(isLabelShadow);
}
aLabelFont.setFamily(labelFontFamily);
-
+
aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont);
aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor);
QString anUnit = QString(aUnitNames[i].c_str()).simplified();
if(anUnit.isNull() || anUnit == "")
anUnit = "-";
-
+
aComponent = aComponent + ", " + anUnit;
myModeCombo->addItem(aComponent);
myModeLbl->setEnabled(isScalarMode);
myModeCombo->setEnabled(isScalarMode);
- // Gauss Metric option should be visible only if at least one
+ // Gauss Metric option should be visible only if at least one
// of mesh values on geometry is based on multiple gauss points
bool isEnableGaussMetric = false;
if( myIsDisplayGaussMetric ) {
if ( anIter != aValField.end() ) {
VISU::PValForTime aValForTime = anIter->second;
if( aValForTime && aValForTime->GetMaxNbGauss() > 1 )
- isEnableGaussMetric = true;
+ isEnableGaussMetric = true;
}
}
myTitle = aTitle.in();
setPosAndSize( myScalarMap->GetPosX(),
- myScalarMap->GetPosY(),
- myScalarMap->GetWidth(),
- myScalarMap->GetHeight(),
- myScalarMap->GetBarOrientation());
+ myScalarMap->GetPosY(),
+ myScalarMap->GetWidth(),
+ myScalarMap->GetHeight(),
+ myScalarMap->GetBarOrientation());
if(RBvert->isChecked()) {
myVerTS = myScalarMap->GetTitleSize();
myScalarMapPL = VISU_ScalarMapPL::New();
if(myScalarMap->GetSpecificPL())
myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL(), true);
-
+
if ( myBusy ) return;
myBusy = true;
myPreviewActor->GetScalarBar()->VisibilityOn();
myPreviewActor->PickableOff();
//myPreviewActor->SetBarVisibility(!myHideBar->isChecked());
-
+
myScalarMapPL->SetScalarMode(myModeCombo->currentIndex());
if(isLogarithmic())
myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
myScalarMapPL->SetScalarRange( aRange );
}
- myScalarMapPL->SetNbColors(sbCol);
+ myScalarMapPL->SetNbColors(sbCol);
myScalarMapPL->Update();
-
+
aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
aScalarBarActor->SetDistribution( myScalarMapPL->GetDistribution() );
aScalarBarActor->SetDistributionVisibility( isShowDistribution() );
-
+
if (!myTextDlg->getTitleText().isEmpty()) {
VISU::PValForTime aValForTime;
const VISU::PField& aField = myScalarMap->GetScalarField();
std::strstream aStream;
const VISU::TTime& aTime = aValForTime->myTime;
aStream<< myTextDlg->getTitleText().toLatin1().data() <<" ";
- if(myBarDlg->isUnitsVisible())
- aStream<<VISU_Convertor::GenerateName(aTime)<<std::ends;
+ if(myBarDlg->isUnitsVisible())
+ aStream<<VISU_Convertor::GenerateName(aTime)<<std::ends;
else {
- QString aName;
- aName.sprintf("%g", aTime.first);
- aStream << aName.toLatin1().data() << std::ends;
+ QString aName;
+ aName.sprintf("%g", aTime.first);
+ aStream << aName.toLatin1().data() << std::ends;
}
std::string aScalarBarTitle = aStream.str();
aScalarBarActor->SetTitle(aScalarBarTitle.c_str());
bool isTitleItalic;
bool isTitleShadow;
myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily,
- isTitleBold,isTitleItalic,isTitleShadow);
+ isTitleBold,isTitleItalic,isTitleShadow);
vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty();
aTitleProp->SetFontFamily(aTitleFontFamily);
aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255.,
- vtkFloatingPointType(aTitleColor.green())/255.,
- vtkFloatingPointType(aTitleColor.blue())/255.);
+ vtkFloatingPointType(aTitleColor.green())/255.,
+ vtkFloatingPointType(aTitleColor.blue())/255.);
(isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff();
(isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff();
(isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff();
-
+
// label text property
QColor aLabelColor;
int aLabelFontFamily;
bool isLabelItalic;
bool isLabelShadow;
myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily,
- isLabelBold, isLabelItalic, isLabelShadow);
+ isLabelBold, isLabelItalic, isLabelShadow);
vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty();
aLabelProp->SetFontFamily(aLabelFontFamily);
aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255.,
- vtkFloatingPointType(aLabelColor.green())/255.,
- vtkFloatingPointType(aLabelColor.blue())/255.);
+ vtkFloatingPointType(aLabelColor.green())/255.,
+ vtkFloatingPointType(aLabelColor.blue())/255.);
(isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff();
(isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff();
(isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff();
- int VerTS, VerTH, VerLS, VerBW, VerBH;
+ int VerTS, VerLS, VerBW, VerBH;
myBarDlg->getRatios(VerTS, VerLS, VerBW, VerBH);
aScalarBarActor->SetRatios(VerTS, VerLS, VerBW, VerBH);
void VisuGUI_ScalarBarPane::deleteScalarBar()
{
if ( myBusy ) return;
-
+
if (myPreviewActor == 0) return;
vtkRenderer* aRend = myPreviewActor->GetRenderer();
vtkRenderWindow* aWnd = aRend->GetRenderWindow();
myScalarMap->SetShadowTitle(isTitleShadow);
myScalarMap->SetTitFontType(aTitleFontFamily);
myScalarMap->SetTitleColor(aTitColor.red()/255.,
- aTitColor.green()/255.,
- aTitColor.blue()/255.);
+ aTitColor.green()/255.,
+ aTitColor.blue()/255.);
// "Label"
QColor aLblColor (255, 255, 255);
myScalarMap->SetShadowLabel(isLabelShadow);
myScalarMap->SetLblFontType(aLabelFontFamily);
myScalarMap->SetLabelColor(aLblColor.red()/255.,
- aLblColor.green()/255.,
- aLblColor.blue()/255.);
+ aLblColor.green()/255.,
+ aLblColor.blue()/255.);
myIsStoreTextProp = false;
}
myScalarMap->SetScalarMode(theMode);
if ( RBFrange->isChecked() ) {
- MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) );
- MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(myScalarMap->GetSourceMin(), 'g', aPrecision));
+ MaxEdit->setText(QString::number(myScalarMap->GetSourceMax(), 'g', aPrecision));
}
updatePreview();
myScalarMap->SetGaussMetric((VISU::GaussMetric)theGaussMetric);
if ( RBFrange->isChecked() ) {
- MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) );
- MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(myScalarMap->GetSourceMin(), 'g', aPrecision));
+ MaxEdit->setText(QString::number(myScalarMap->GetSourceMax(), 'g', aPrecision));
}
updatePreview();
*/
void VisuGUI_ScalarBarPane::setRange( double imin, double imax, bool sbRange )
{
- MinEdit->setText( QString::number( imin ) );
- MaxEdit->setText( QString::number( imax ) );
+ SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
+ int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0);
+
+ MinEdit->setText(QString::number(imin, 'g', aPrecision));
+ MaxEdit->setText(QString::number(imax, 'g', aPrecision));
+
if( sbRange )
RBIrange->setChecked( true );
else
if ( RBIrange->isChecked() ) {
if (minVal >= maxVal) {
SUIT_MessageBox::warning( this,tr("WRN_VISU"),
- tr("MSG_MINMAX_VALUES"),
- tr("BUT_OK"));
+ tr("MSG_MINMAX_VALUES"),
+ tr("BUT_OK"));
return false;
}
}
if ( CBLog->isChecked() ) {
if ( minVal <= 0.0 || maxVal <= 0.0 ) {
if ( RBIrange->isChecked() ) {
- SUIT_MessageBox::warning( this,
+ SUIT_MessageBox::warning( this,
tr("WRN_VISU"),
tr("WRN_LOGARITHMIC_RANGE"),
tr("BUT_OK"));
} else {
- if ( minVal == 0 || maxVal == 0 )
- SUIT_MessageBox::warning( this,
- tr("WRN_VISU"),
- tr("WRN_LOGARITHMIC_RANGE"),
- tr("BUT_OK"));
- else
- SUIT_MessageBox::warning( this,
- tr("WRN_VISU"),
- tr("WRN_LOGARITHMIC_FIELD_RANGE"),
- tr("BUT_OK"));
- RBIrange->setChecked(true);
- changeRange(1);
+ if ( minVal == 0 || maxVal == 0 )
+ SUIT_MessageBox::warning( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_RANGE"),
+ tr("BUT_OK"));
+ else
+ SUIT_MessageBox::warning( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+ tr("BUT_OK"));
+ RBIrange->setChecked(true);
+ changeRange(1);
}
return false;
}
}
else {
SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
- tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
- arg( app->resourceMgr()->stringValue( "ExternalBrowser",
- "application" ) ).
- arg( aHelpFileName ) );
+ tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+ arg( app->resourceMgr()->stringValue( "ExternalBrowser",
+ "application" ) ).
+ arg( aHelpFileName ) );
}
}
QDialog::keyPressEvent( e );
if ( e->isAccepted() )
return;
-
+
if ( e->key() == Qt::Key_F1 ) {
e->accept();
onHelp();
//----------------------------------------------------------------------------
void VisuGUI_ScalarBarBaseDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
- bool theInit )
+ bool theInit )
{
myScalarPane->initFromPrsObject( thePrs );
}
// 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
+// 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
/*!
\class VisuGUI_ValuesLabelingDlg
- \brief This class is intended for changing parameters of labeling values
+ \brief This class is intended for changing parameters of labeling values
of 3D colored presentations
*/
aBtnLay->addWidget( aHelp, 0, 3 );
myFont->setMode( QtxFontEdit::Custom );
- myFont->setFeatures( QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic |
+ myFont->setFeatures( QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic |
QtxFontEdit::Shadow | QtxFontEdit::UserSize | QtxFontEdit::Size );
QStringList fam;
fam.append( tr( "VISU_FONT_ARIAL" ) );
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() ) );
}
/*!
- \brief Initializes dialog fields using specified presentation
+ \brief Initializes dialog fields using specified presentation
\param thePrs presentation
- \param theInit not used
+ \param theInit not used
\sa storeToPrsObject()
*/
void VisuGUI_ValuesLabelingDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, bool )
int VisuGUI_ValuesLabelingDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs )
{
if ( !thePrs )
- return 0;
+ return 0;
QFont aFont = myFont->currentFont();
// color
QColor aColor = myColor->color();
- thePrs->SetValLblFontColor(
+ thePrs->SetValLblFontColor(
aColor.red() / 255., aColor.green() / 255., aColor.blue() / 255. );
return 1;
{
return "viewing_3d_presentations_page.html#labeling_parameters_anchor";
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-