1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // VISU OBJECT : interactive object for VISU entities implementation
23 // File : VISU_PickingSettings.cxx
24 // Author : Oleg UVAROV
27 #include "VISU_PickingSettings.h"
29 #include "SUIT_ResourceMgr.h"
30 #include "SUIT_Session.h"
32 #include <vtkObjectFactory.h>
34 vtkStandardNewMacro( VISU_PickingSettings );
36 VISU_PickingSettings* VISU_PickingSettings::Get()
38 static VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::New();
40 if( aPickingSettings->GetIsInitial() )
42 SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
44 aPickingSettings->SetCursorSize( aResourceMgr->doubleValue( "VISU", "picking_cursor_size", 0.5 ) );
45 aPickingSettings->SetPyramidHeight( aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", 10.0 ) );
46 aPickingSettings->SetPointTolerance( aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", 0.1 ) );
47 aPickingSettings->SetInfoWindowEnabled( aResourceMgr->booleanValue( "VISU", "picking_info_window", false ) );
48 aPickingSettings->SetInfoWindowTransparency( aResourceMgr->integerValue( "VISU", "picking_transparency", 50 ) / 100.0 );
49 aPickingSettings->SetInfoWindowPosition( aResourceMgr->integerValue( "VISU", "picking_position", VISU_PickingSettings::TopLeftCorner ) );
50 aPickingSettings->SetCameraMovementEnabled( aResourceMgr->booleanValue( "VISU", "picking_camera_movement", true ) );
51 aPickingSettings->SetZoomFactor( aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", 1.5 ) );
52 aPickingSettings->SetStepNumber( aResourceMgr->integerValue( "VISU", "picking_step_number", 10 ) );
53 aPickingSettings->SetDisplayParentMesh( aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", true ) );
55 QColor aSelectionColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", Qt::yellow );
56 vtkFloatingPointType aColor[3];
57 aColor[0] = aSelectionColor.red() / 255.0;
58 aColor[1] = aSelectionColor.green() / 255.0;
59 aColor[2] = aSelectionColor.blue() / 255.0;
60 aPickingSettings->SetColor( aColor );
62 aPickingSettings->SetIsInitial( false );
65 return aPickingSettings;
68 VISU_PickingSettings::VISU_PickingSettings()
70 this->IsInitial = true;
72 this->PyramidHeight = -1;
73 this->CursorSize = -1;
74 this->PointTolerance = -1;
78 this->InfoWindowEnabled = false;
79 this->InfoWindowTransparency = -1;
80 this->InfoWindowPosition = -1;
81 this->CameraMovementEnabled = false;
82 this->ZoomFactor = -1;
83 this->StepNumber = -1;
84 this->DisplayParentMesh = false;
87 VISU_PickingSettings::~VISU_PickingSettings()