OrbitViewController.hh
00001 /*
00002  * Copyright 2011 Nate Koenig & Andrew Howard
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  *
00016 */
00017 #ifndef ORBITVIEWCONTROLLER_HH
00018 #define ORBITVIEWCONTROLLER_HH
00019 
00020 #include "rendering/ViewController.hh"
00021 #include "math/Vector3.hh"
00022 
00023 namespace gazebo
00024 {
00025     namespace rendering
00026   {
00027     class Visual;
00028 
00031 
00033     class OrbitViewController : public ViewController
00034     {
00036       public: OrbitViewController(UserCamera *camera);
00037 
00039       public: virtual ~OrbitViewController();
00040   
00041       public: virtual void Init();
00042       public: virtual void Init(const math::Vector3 &_focalPoint);
00043 
00045       public: void SetDistanceRange(double _minDist, double _maxDist);
00046 
00048       public: virtual void Update();
00049   
00051       public: virtual void HandleMouseEvent(const common::MouseEvent &event);
00052 
00054       public: static std::string GetTypeString();
00055   
00057       private: void Translate(math::Vector3 vec);
00058 
00060       private: void Zoom(float _amount);
00061   
00063       private: void NormalizeYaw(float &v);
00064   
00066       private: void NormalizePitch(float &v);
00067   
00068       private: float yaw, pitch;
00069       private: float distance;
00070       private: float minDist, maxDist;
00071       private: math::Vector3 focalPoint;
00072 
00073       private: VisualPtr refVisual;
00074     };
00076   }
00077 }
00078 #endif