]> SALOME platform Git repositories - modules/visu.git/blob - src/OBJECT/VISU_PickingSettings.cxx
Salome HOME
Test EXPORTS definition with target name as suggested by cmake
[modules/visu.git] / src / OBJECT / VISU_PickingSettings.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU OBJECT : interactive object for VISU entities implementation
23 //  File   : VISU_PickingSettings.cxx
24 //  Author : Oleg UVAROV
25 //  Module : VISU
26 //
27 #include "VISU_PickingSettings.h"
28
29 #include "SUIT_ResourceMgr.h"
30 #include "SUIT_Session.h"
31
32 #include <vtkObjectFactory.h>
33
34 vtkStandardNewMacro( VISU_PickingSettings );
35
36 VISU_PickingSettings* VISU_PickingSettings::Get()
37 {
38   static VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::New();
39
40   if( aPickingSettings->GetIsInitial() )
41   {
42     SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
43
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 ) );
54
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 );
61
62     aPickingSettings->SetIsInitial( false );
63   }
64
65   return aPickingSettings;
66 }
67
68 VISU_PickingSettings::VISU_PickingSettings()
69 {
70   this->IsInitial              = true;
71
72   this->PyramidHeight          = -1;
73   this->CursorSize             = -1;
74   this->PointTolerance         = -1;
75   this->Color[0]               = -1;
76   this->Color[1]               = -1;
77   this->Color[2]               = -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;
85 }
86
87 VISU_PickingSettings::~VISU_PickingSettings()
88 {
89 }