Version: 8.3.0
FormSchemaView.cxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2 //
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, or (at your option) any later version.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #include "FormSchemaView.hxx"
21 #include "GraphicsView.hxx"
22 
23 //#define _DEVDEBUG_
24 #include "YacsTrace.hxx"
25 
26 using namespace std;
27 using namespace YACS::HMI;
28 
30 {
31  setupUi(this);
32 
33  vboxLayout->removeWidget(gv_schema);
34  delete gv_schema;
35  gv_schema = new GraphicsView(this);
36  gv_schema->setObjectName(QString::fromUtf8("gv_schema"));
37  vboxLayout->insertWidget(0, gv_schema);
38 
39  _prevRotate=0;
40  dial->setWrapping(true);
41  dial->setRange(0, 359);
42  dial->setValue(0);
43 
44  _prevHsPos=500;
45  hs_position->setRange(0, 999);
46  hs_position->setValue(500);
47 
48  _prevVsPos=500;
49  vs_position->setRange(0, 999);
50  vs_position->setValue(500);
51 
52  _prevZoom=0;
53  vs_zoom->setRange(-100, 100);
54  vs_zoom->setValue(0);
55 
56 }
57 
59 {
60 }
61 
63 {
64  DEBTRACE("FormSchemaView::on_dial_valueChanged " << val);
65  int delta = val - _prevRotate;
66  _prevRotate = val;
67  gv_schema->rotate(delta);
68 }
69 
71 {
72  DEBTRACE("FormSchemaView::on_hs_poistion_valueChanged " << val);
73  int delta = val - _prevHsPos;
74  _prevHsPos = val;
75  gv_schema->translate(val,0);
76 }
77 
79 {
80  DEBTRACE("FormSchemaView::on_vs_poistion_valueChanged " << val);
81  int delta = val - _prevVsPos;
82  _prevVsPos = val;
83  gv_schema->translate(0, val);
84 }
85 
87 {
88  DEBTRACE("FormSchemaView::on_vs_zoom_valueChanged " << val);
89  int delta = val - _prevZoom;
90  double s=1;
91  if (delta>=0) s=delta/25.0;
92  else s=25/delta;
93  _prevZoom = val;
94  gv_schema->scale(s, s);
95 }