MEPP2 Project
TabBoxDragger2.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 
13 #include <osg/ShapeDrawable>
14 #include <osg/Geometry>
15 #include <osg/LineWidth>
16 #include <osg/Quat>
17 
18 using namespace osgManipulator;
19 
21 {
22  for(int i = 0; i < 6; ++i)
23  {
24  _planeDraggers.push_back(
25  new TabPlaneDragger(1.0f)); // MT : here 20.0f by default
26  addChild(_planeDraggers[i].get());
27  addDragger(_planeDraggers[i].get());
28  }
29 
30  {
31  _planeDraggers[0]->setMatrix(
32  osg::Matrix::translate(osg::Vec3(0.0, 0.5, 0.0)));
33  }
34  {
35  osg::Quat rotation;
36  rotation.makeRotate(osg::Vec3(0.0f, -1.0f, 0.0f),
37  osg::Vec3(0.0f, 1.0f, 0.0f));
38  _planeDraggers[1]->setMatrix(
39  osg::Matrix(rotation) *
40  osg::Matrix::translate(osg::Vec3(0.0, -0.5, 0.0)));
41  }
42  {
43  osg::Quat rotation;
44  rotation.makeRotate(osg::Vec3(0.0f, 0.0f, 1.0f),
45  osg::Vec3(0.0f, 1.0f, 0.0f));
46  _planeDraggers[2]->setMatrix(
47  osg::Matrix(rotation) *
48  osg::Matrix::translate(osg::Vec3(0.0, 0.0, -0.5)));
49  }
50 
51  {
52  osg::Quat rotation;
53  rotation.makeRotate(osg::Vec3(0.0f, 1.0f, 0.0f),
54  osg::Vec3(0.0f, 0.0f, 1.0f));
55  _planeDraggers[3]->setMatrix(
56  osg::Matrix(rotation) *
57  osg::Matrix::translate(osg::Vec3(0.0, 0.0, 0.5)));
58  }
59 
60  {
61  osg::Quat rotation;
62  rotation.makeRotate(osg::Vec3(1.0f, 0.0f, 0.0f),
63  osg::Vec3(0.0f, 1.0f, 0.0f));
64  _planeDraggers[4]->setMatrix(
65  osg::Matrix(rotation) *
66  osg::Matrix::translate(osg::Vec3(-0.5, 0.0, 0.0)));
67  }
68 
69  {
70  osg::Quat rotation;
71  rotation.makeRotate(osg::Vec3(0.0f, 1.0f, 0.0f),
72  osg::Vec3(1.0f, 0.0f, 0.0f));
73  _planeDraggers[5]->setMatrix(
74  osg::Matrix(rotation) *
75  osg::Matrix::translate(osg::Vec3(0.5, 0.0, 0.0)));
76  }
77 
78  setParentDragger(getParentDragger());
79 }
80 
82 
83 void
84 TabBoxDragger2::setupDefaultGeometry()
85 {
86  for(unsigned int i = 0; i < _planeDraggers.size(); ++i)
87  _planeDraggers[i]->setupDefaultGeometry(false);
88 }
89 
90 void
91 TabBoxDragger2::setPlaneColor(const osg::Vec4 &color)
92 {
93  for(unsigned int i = 0; i < _planeDraggers.size(); ++i)
94  _planeDraggers[i]->setPlaneColor(color);
95 }
FEVV::Filters::translate
void translate(const HalfedgeGraph &g, PointMap &pm, typename GeometryTraits::Scalar offset_x, typename GeometryTraits::Scalar offset_y, typename GeometryTraits::Scalar offset_z, const GeometryTraits &gt)
Translate a mesh.
Definition: translation.hpp:38
osgManipulator::TabBoxDragger2::TabBoxDragger2
TabBoxDragger2()
Definition: TabBoxDragger2.cpp:20
osgManipulator::TabBoxDragger2::setPlaneColor
void setPlaneColor(const osg::Vec4 &color)
Definition: TabBoxDragger2.cpp:91
osgManipulator::TabBoxDragger2::_planeDraggers
std::vector< osg::ref_ptr< TabPlaneDragger > > _planeDraggers
Definition: TabBoxDragger2.h:36
TabBoxDragger2.h
osgManipulator::TabBoxDragger2::~TabBoxDragger2
virtual ~TabBoxDragger2()
Definition: TabBoxDragger2.cpp:81
osgManipulator
Definition: TabBoxDragger2.h:15
boost::get
boost::property_map< FEVV::DataStructures::AIF::AIFMesh, boost::vertex_index_t >::const_type get(const boost::vertex_index_t &, const FEVV::DataStructures::AIF::AIFMesh &)
Returns the vertex index property map of the mesh.
Definition: Graph_properties_aif.h:108