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