97 lines
2.6 KiB
Plaintext
97 lines
2.6 KiB
Plaintext
|
/* -*-c++-*- */
|
||
|
/* osgEarth - Geospatial SDK for OpenSceneGraph
|
||
|
* Copyright 2020 Pelican Mapping
|
||
|
* http://osgearth.org
|
||
|
*
|
||
|
* osgEarth is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||
|
* the Free Software Foundation; either version 2 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||
|
*/
|
||
|
#ifndef OSGEARTH_VIEWPOINTS_EXTENSION
|
||
|
#define OSGEARTH_VIEWPOINTS_EXTENSION 1
|
||
|
|
||
|
#include <osgEarth/Extension>
|
||
|
#include <osgEarth/Viewpoint>
|
||
|
#include <osgGA/GUIEventAdapter>
|
||
|
#include <osgGA/GUIEventHandler>
|
||
|
#include <osg/View>
|
||
|
#include <vector>
|
||
|
|
||
|
#ifdef OSGEARTH_HAVE_CONTROLS_API
|
||
|
#include <osgEarth/Controls>
|
||
|
using namespace osgEarth::Util::Controls;
|
||
|
#endif
|
||
|
|
||
|
namespace osgEarth { namespace Viewpoints
|
||
|
{
|
||
|
using namespace osgEarth;
|
||
|
|
||
|
/**
|
||
|
* Loads a collection of viewpoints and makes them available
|
||
|
* through a Controls UI.
|
||
|
*/
|
||
|
#ifdef OSGEARTH_HAVE_CONTROLS_API
|
||
|
class ViewpointsExtension :
|
||
|
public Extension,
|
||
|
public ExtensionInterface<osg::View>,
|
||
|
public ExtensionInterface<Control>,
|
||
|
public ConfigOptions
|
||
|
#else
|
||
|
class ViewpointsExtension :
|
||
|
public Extension,
|
||
|
public ExtensionInterface<osg::View>,
|
||
|
public ConfigOptions
|
||
|
#endif
|
||
|
{
|
||
|
public:
|
||
|
META_OE_Extension(osgEarth, ViewpointsExtension, viewpoints);
|
||
|
|
||
|
// CTORs
|
||
|
ViewpointsExtension();
|
||
|
ViewpointsExtension(const ConfigOptions& options);
|
||
|
|
||
|
// DTOR
|
||
|
virtual ~ViewpointsExtension();
|
||
|
|
||
|
|
||
|
public: // Extension
|
||
|
|
||
|
void setDBOptions(const osgDB::Options* dbOptions);
|
||
|
|
||
|
// Use "this" since this class derives from ConfigOptions.
|
||
|
const ConfigOptions& getConfigOptions() const { return *this; }
|
||
|
|
||
|
|
||
|
public: // ExtensionInterface<osg::View>
|
||
|
|
||
|
bool connect(osg::View* view);
|
||
|
|
||
|
bool disconnect(osg::View* view);
|
||
|
|
||
|
|
||
|
#ifdef OSGEARTH_HAVE_CONTROLS_API
|
||
|
public: // ExtensionInterface<Control>
|
||
|
|
||
|
bool connect(Control* control);
|
||
|
|
||
|
bool disconnect(Control* control);
|
||
|
#endif
|
||
|
|
||
|
private:
|
||
|
osg::ref_ptr<const osgDB::Options> _dbOptions;
|
||
|
osg::ref_ptr<osgGA::GUIEventHandler> _handler;
|
||
|
};
|
||
|
|
||
|
} } // namespace osgEarth::Viewpoints
|
||
|
|
||
|
#endif // OSGEARTH_VIEWPOINTS_EXTENSION
|