Mostly canvas doxygen improvements and C++11 refactoring.

This commit is contained in:
Thomas Geymayer
2018-03-02 09:07:01 +01:00
parent 711a4fe0c8
commit 62ae6ca35e
48 changed files with 210 additions and 147 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
// The canvas for rendering with the 2d API ///@file
/// The canvas for rendering with the 2d API
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+9 -11
View File
@@ -71,18 +71,18 @@ namespace canvas
public osg::NodeCallback public osg::NodeCallback
{ {
public: public:
CullCallback(const CanvasWeakPtr& canvas); explicit CullCallback(const CanvasWeakPtr& canvas);
private: private:
CanvasWeakPtr _canvas; CanvasWeakPtr _canvas;
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv); void operator()(osg::Node* node, osg::NodeVisitor* nv) override;
}; };
typedef osg::ref_ptr<CullCallback> CullCallbackPtr; typedef osg::ref_ptr<CullCallback> CullCallbackPtr;
Canvas(SGPropertyNode* node); explicit Canvas(SGPropertyNode* node);
virtual ~Canvas(); virtual ~Canvas();
virtual void onDestroy(); void onDestroy() override;
void setCanvasMgr(CanvasMgr* canvas_mgr); void setCanvasMgr(CanvasMgr* canvas_mgr);
CanvasMgr* getCanvasMgr() const; CanvasMgr* getCanvasMgr() const;
@@ -184,11 +184,9 @@ namespace canvas
bool propagateEvent( EventPtr const& event, bool propagateEvent( EventPtr const& event,
EventPropagationPath const& path ); EventPropagationPath const& path );
virtual void childAdded( SGPropertyNode * parent, void childAdded(SGPropertyNode* parent, SGPropertyNode* child) override;
SGPropertyNode * child ); void childRemoved(SGPropertyNode* parent, SGPropertyNode* child) override;
virtual void childRemoved( SGPropertyNode * parent, void valueChanged(SGPropertyNode * node) override;
SGPropertyNode * child );
virtual void valueChanged (SGPropertyNode * node);
osg::Texture2D* getTexture() const; osg::Texture2D* getTexture() const;
@@ -254,8 +252,8 @@ namespace canvas
static SystemAdapterPtr _system_adapter; static SystemAdapterPtr _system_adapter;
Canvas(const Canvas&); // = delete; Canvas(const Canvas&) = delete;
Canvas& operator=(const Canvas&); // = delete; Canvas& operator=(const Canvas&) = delete;
}; };
} // namespace canvas } // namespace canvas
+5 -4
View File
@@ -1,4 +1,5 @@
// Canvas Event for event model similar to DOM Level 3 Event Model ///@file
/// Canvas Event for event model similar to DOM Level 3 Event Model
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -125,10 +126,10 @@ namespace canvas
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string Event::typeToStr(int type) std::string Event::typeToStr(int type)
{ {
TypeMap const& type_map = getTypeMap(); auto const& map_by_id = getTypeMap().by<id>();
TypeMap::map_by<id>::const_iterator it = type_map.by<id>().find(type); auto it = map_by_id.find(type);
if( it == type_map.by<id>().end() ) if( it == map_by_id.end() )
return "unknown"; return "unknown";
return it->second; return it->second;
} }
+7
View File
@@ -115,7 +115,14 @@ namespace canvas
*/ */
bool defaultPrevented() const; bool defaultPrevented() const;
/**
* Register a new type string or get the id of an existing type string
*
* @param type Type string
* @return Id of the given @a type
*/
static int getOrRegisterType(const std::string& type); static int getOrRegisterType(const std::string& type);
static int strToType(const std::string& type); static int strToType(const std::string& type);
static std::string typeToStr(int type); static std::string typeToStr(int type);
+6 -3
View File
@@ -1,4 +1,5 @@
// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model ///@file
/// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -17,9 +18,11 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#include <simgear_config.h> #include <simgear_config.h>
#include "CanvasEventManager.hxx" #include "CanvasEventManager.hxx"
#include <simgear/canvas/events/MouseEvent.hxx> #include "elements/CanvasElement.hxx"
#include <simgear/canvas/elements/CanvasElement.hxx> #include "events/MouseEvent.hxx"
#include <cmath> #include <cmath>
namespace simgear namespace simgear
+2 -1
View File
@@ -1,4 +1,5 @@
// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model ///@file
/// Manage event handling inside a Canvas similar to the DOM Level 3 Event Model
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Mapping between canvas gui Event types and their names ///@file
/// Mapping between canvas gui Event types and their names
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+5 -3
View File
@@ -1,5 +1,6 @@
// Visitor for traversing a canvas element hierarchy similar to the traversal ///@file
// of the DOM Level 3 Event Model /// Visitor for traversing a canvas element hierarchy similar to the traversal
/// of the DOM Level 3 Event Model
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -18,9 +19,10 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#include <simgear_config.h> #include <simgear_config.h>
#include "CanvasEvent.hxx" #include "CanvasEvent.hxx"
#include "CanvasEventVisitor.hxx" #include "CanvasEventVisitor.hxx"
#include <simgear/canvas/elements/CanvasElement.hxx> #include "elements/CanvasElement.hxx"
namespace simgear namespace simgear
{ {
+3 -2
View File
@@ -1,5 +1,6 @@
// Visitor for traversing a canvas element hierarchy similar to the traversal ///@file
// of the DOM Level 3 Event Model /// Visitor for traversing a canvas element hierarchy similar to the traversal
/// of the DOM Level 3 Event Model
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+3 -3
View File
@@ -1,4 +1,5 @@
// Canvas with 2D rendering API ///@file
/// Canvas with 2D rendering API
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -17,12 +18,11 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#include <simgear_config.h> #include <simgear_config.h>
#include "CanvasMgr.hxx" #include "CanvasMgr.hxx"
#include "Canvas.hxx" #include "Canvas.hxx"
#include "CanvasEventManager.hxx" #include "CanvasEventManager.hxx"
#include <boost/bind.hpp>
namespace simgear namespace simgear
{ {
namespace canvas namespace canvas
+3 -2
View File
@@ -1,4 +1,5 @@
// Canvas with 2D rendering API ///@file
/// Canvas with 2D rendering API
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -61,7 +62,7 @@ namespace canvas
protected: protected:
virtual void elementCreated(PropertyBasedElementPtr element); void elementCreated(PropertyBasedElementPtr element) override;
}; };
} // namespace canvas } // namespace canvas
+2 -1
View File
@@ -1,4 +1,5 @@
// Canvas placement for placing a canvas texture onto osg objects. ///@file
/// Canvas placement for placing a canvas texture onto osg objects
// //
// It also provides a SGPickCallback for passing mouse events to the canvas and // It also provides a SGPickCallback for passing mouse events to the canvas and
// manages emissive lighting of the placed canvas. // manages emissive lighting of the placed canvas.
+2 -2
View File
@@ -1,5 +1,5 @@
///@file ///@file
/// Placement for putting a canvas texture onto OpenSceneGraph objects. /// Placement for putting a canvas texture onto OpenSceneGraph objects
/// ///
/// It also provides a SGPickCallback for passing mouse events to the canvas and /// It also provides a SGPickCallback for passing mouse events to the canvas and
/// manages emissive lighting of the placed canvas. /// manages emissive lighting of the placed canvas.
@@ -60,7 +60,7 @@ namespace canvas
*/ */
void setCaptureEvents(bool enable); void setCaptureEvents(bool enable);
virtual bool childChanged(SGPropertyNode* child); bool childChanged(SGPropertyNode* child) override;
protected: protected:
typedef SGSharedPtr<SGPickCallback> PickCallbackPtr; typedef SGSharedPtr<SGPickCallback> PickCallbackPtr;
+2 -1
View File
@@ -1,4 +1,5 @@
// Base class for canvas placements ///@file
/// Base class for canvas placements
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+4 -4
View File
@@ -1,4 +1,5 @@
// Base class for canvas placements ///@file
/// Base class for canvas placements
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -40,9 +41,8 @@ namespace canvas
protected: protected:
SGPropertyNode_ptr _node; SGPropertyNode_ptr _node;
private: Placement(const Placement&) = delete;
Placement(const Placement&) /* = delete */; Placement& operator=(const Placement&) = delete;
Placement& operator=(const Placement&) /* = delete */;
}; };
} // namespace canvas } // namespace canvas
+6 -1
View File
@@ -1,4 +1,5 @@
// Adapter for using the canvas with different applications ///@file
/// Adapter for using the canvas with different applications
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -29,6 +30,10 @@ namespace HTTP { class Client; }
namespace canvas namespace canvas
{ {
/**
* Provides access to different required systems of the application to the
* Canvas
*/
class SystemAdapter class SystemAdapter
{ {
public: public:
+2 -1
View File
@@ -1,4 +1,5 @@
// Window for placing a Canvas onto it (for dialogs, menus, etc.) ///@file
/// Window for placing a Canvas onto it (for dialogs, menus, etc.)
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Window for placing a Canvas onto it (for dialogs, menus, etc.) ///@file
/// Window for placing a Canvas onto it (for dialogs, menus, etc.)
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+5 -4
View File
@@ -1,4 +1,5 @@
// Owner Drawn Gauge helper class ///@file
/// Owner Drawn Gauge helper class
// //
// Written by Harald JOHNSEN, started May 2005. // Written by Harald JOHNSEN, started May 2005.
// //
@@ -6,9 +7,9 @@
// //
// Ported to OSG by Tim Moore - Jun 2007 // Ported to OSG by Tim Moore - Jun 2007
// //
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April 2012 // Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April
// Supports now multisampling/mipmapping, usage of the stencil buffer and placing // 2012 Supports now multisampling/mipmapping, usage of the stencil buffer and
// the texture in the scene by certain filter criteria // placing the texture in the scene by certain filter criteria.
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
+5 -4
View File
@@ -1,4 +1,5 @@
// Owner Drawn Gauge helper class ///@file
/// Owner Drawn Gauge helper class
// //
// Written by Harald JOHNSEN, started May 2005. // Written by Harald JOHNSEN, started May 2005.
// //
@@ -6,9 +7,9 @@
// //
// Ported to OSG by Tim Moore - Jun 2007 // Ported to OSG by Tim Moore - Jun 2007
// //
// Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April 2012 // Heavily modified to be usable for the 2d Canvas by Thomas Geymayer - April
// Supports now multisampling/mipmapping, usage of the stencil buffer and placing // 2012 Supports now multisampling/mipmapping, usage of the stencil buffer and
// the texture in the scene by certain filter criteria // placing the texture in the scene by certain filter criteria.
// //
// This library is free software; you can redistribute it and/or // This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public // modify it under the terms of the GNU Library General Public
+2 -1
View File
@@ -1,4 +1,5 @@
// osg::Operation to initialize the OpenVG context used for path rendering ///@file
/// osg::Operation to initialize the OpenVG context used for path rendering
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// osg::Operation to initialize the OpenVG context used for path rendering ///@file
/// osg::Operation to initialize the OpenVG context used for path rendering
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Canvas forward declarations ///@file
/// Canvas forward declarations
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Interface for 2D Canvas element ///@file
/// Interface for 2D Canvas element
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+6 -8
View File
@@ -95,7 +95,7 @@ namespace canvas
* *
*/ */
virtual ~Element() = 0; virtual ~Element() = 0;
virtual void onDestroy(); void onDestroy() override;
ElementPtr getParent() const; ElementPtr getParent() const;
CanvasWeakPtr getCanvas() const; CanvasWeakPtr getCanvas() const;
@@ -105,7 +105,7 @@ namespace canvas
* *
* @param dt Frame time in seconds * @param dt Frame time in seconds
*/ */
virtual void update(double dt); void update(double dt) override;
bool addEventListener(const std::string& type, const EventListener& cb); bool addEventListener(const std::string& type, const EventListener& cb);
virtual void clearEventListener(); virtual void clearEventListener();
@@ -154,11 +154,9 @@ namespace canvas
*/ */
osg::Vec2f posToLocal(const osg::Vec2f& pos) const; osg::Vec2f posToLocal(const osg::Vec2f& pos) const;
virtual void childAdded( SGPropertyNode * parent, void childAdded(SGPropertyNode* parent, SGPropertyNode* child) override;
SGPropertyNode * child ); void childRemoved(SGPropertyNode* parent, SGPropertyNode* child) override;
virtual void childRemoved( SGPropertyNode * parent, void valueChanged(SGPropertyNode* child) override;
SGPropertyNode * child );
virtual void valueChanged(SGPropertyNode * child);
virtual bool setStyle( const SGPropertyNode* child, virtual bool setStyle( const SGPropertyNode* child,
const StyleInfo* style_info = 0 ); const StyleInfo* style_info = 0 );
@@ -597,7 +595,7 @@ namespace canvas
osg::ref_ptr<osg::Drawable> _drawable; osg::ref_ptr<osg::Drawable> _drawable;
Element(const Element&);// = delete Element(const Element&) = delete;
template<class Derived> template<class Derived>
static Derived& derived_cast(Element& el) static Derived& derived_cast(Element& el)
+3 -1
View File
@@ -1,4 +1,5 @@
// A group of 2D Canvas elements ///@file
/// A group of 2D Canvas elements
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -168,6 +169,7 @@ namespace canvas
if( !_scene_group.valid() ) if( !_scene_group.valid() )
return warnSceneGroupExpired("clearEventListener"); return warnSceneGroupExpired("clearEventListener");
// TODO should this be recursive?
for(size_t i = 0; i < _scene_group->getNumChildren(); ++i) for(size_t i = 0; i < _scene_group->getNumChildren(); ++i)
getChildByIndex(i)->clearEventListener(); getChildByIndex(i)->clearEventListener();
} }
+12 -10
View File
@@ -1,4 +1,5 @@
// A group of 2D Canvas elements ///@file
/// A group of 2D Canvas elements
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -86,14 +87,15 @@ namespace canvas
*/ */
ElementPtr getElementById(const std::string& id); ElementPtr getElementById(const std::string& id);
virtual void clearEventListener(); void clearEventListener() override;
virtual bool traverse(EventVisitor& visitor); bool traverse(EventVisitor& visitor) override;
virtual bool setStyle( const SGPropertyNode* child, bool setStyle( const SGPropertyNode* child,
const StyleInfo* style_info = 0 ); const StyleInfo* style_info = 0 ) override;
virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const; osg::BoundingBox
getTransformedBounds(const osg::Matrix& m) const override;
protected: protected:
@@ -105,11 +107,11 @@ namespace canvas
*/ */
virtual ElementFactory getChildFactory(const std::string& type) const; virtual ElementFactory getChildFactory(const std::string& type) const;
virtual void updateImpl(double dt); void updateImpl(double dt) override;
virtual void childAdded(SGPropertyNode * child); void childAdded(SGPropertyNode * child) override;
virtual void childRemoved(SGPropertyNode * child); void childRemoved(SGPropertyNode * child) override;
virtual void childChanged(SGPropertyNode * child); void childChanged(SGPropertyNode * child) override;
void handleZIndexChanged(ElementPtr child, int z_index = 0); void handleZIndexChanged(ElementPtr child, int z_index = 0);
+2 -1
View File
@@ -1,4 +1,5 @@
// An image on the Canvas ///@file
/// An image on the Canvas
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+5 -4
View File
@@ -1,4 +1,5 @@
// An image on the Canvas ///@file
/// An image on the Canvas
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -53,7 +54,7 @@ namespace canvas
ElementWeakPtr parent = 0 ); ElementWeakPtr parent = 0 );
virtual ~Image(); virtual ~Image();
virtual void valueChanged(SGPropertyNode* child); void valueChanged(SGPropertyNode* child) override;
void setSrcCanvas(CanvasPtr canvas); void setSrcCanvas(CanvasPtr canvas);
CanvasWeakPtr getSrcCanvas() const; CanvasWeakPtr getSrcCanvas() const;
@@ -108,9 +109,9 @@ namespace canvas
SRC_CANVAS = DEST_SIZE << 1 SRC_CANVAS = DEST_SIZE << 1
}; };
virtual void updateImpl(double dt); void updateImpl(double dt) override;
virtual void childChanged(SGPropertyNode * child); void childChanged(SGPropertyNode * child) override;
void setupDefaultDimensions(); void setupDefaultDimensions();
SGRect<int> getTextureDimensions() const; SGRect<int> getTextureDimensions() const;
+3 -2
View File
@@ -1,5 +1,6 @@
// A group of 2D Canvas elements which get automatically transformed according ///@file
// to the map parameters. /// A group of 2D Canvas elements which get automatically transformed according
/// to the map parameters.
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+8 -9
View File
@@ -1,5 +1,6 @@
// A group of 2D Canvas elements which get automatically transformed according ///@file
// to the map parameters. /// A group of 2D Canvas elements which get automatically transformed according
/// to the map parameters.
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -46,16 +47,14 @@ namespace canvas
virtual ~Map(); virtual ~Map();
protected: protected:
virtual void updateImpl(double dt); void updateImpl(double dt) override;
void updateProjection(SGPropertyNode* type_node); void updateProjection(SGPropertyNode* type_node);
virtual void childAdded( SGPropertyNode* parent, void childAdded(SGPropertyNode* parent, SGPropertyNode* child) override;
SGPropertyNode* child ); void childRemoved(SGPropertyNode* parent, SGPropertyNode* child) override;
virtual void childRemoved( SGPropertyNode* parent, void valueChanged(SGPropertyNode* child) override;
SGPropertyNode* child ); void childChanged(SGPropertyNode* child) override;
virtual void valueChanged(SGPropertyNode* child);
virtual void childChanged(SGPropertyNode* child);
using GeoNodes = using GeoNodes =
std::unordered_map<SGPropertyNode*, std::shared_ptr<GeoNodePair>>; std::unordered_map<SGPropertyNode*, std::shared_ptr<GeoNodePair>>;
+12 -8
View File
@@ -1,4 +1,5 @@
// An OpenVG path on the Canvas ///@file
/// An OpenVG path on the Canvas
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -230,9 +231,12 @@ namespace canvas
vgDestroyPaint(_paint_fill); vgDestroyPaint(_paint_fill);
} }
virtual const char* className() const { return "PathDrawable"; } const char* className() const override
virtual osg::Object* cloneType() const { return new PathDrawable(_path_element); } { return "PathDrawable"; }
virtual osg::Object* clone(const osg::CopyOp&) const { return new PathDrawable(_path_element); } osg::Object* cloneType() const override
{ return new PathDrawable(_path_element); }
osg::Object* clone(const osg::CopyOp&) const override
{ return new PathDrawable(_path_element); }
/** /**
* Replace the current path segments with the new ones * Replace the current path segments with the new ones
@@ -383,7 +387,7 @@ namespace canvas
/** /**
* Draw callback * Draw callback
*/ */
virtual void drawImplementation(osg::RenderInfo& renderInfo) const void drawImplementation(osg::RenderInfo& renderInfo) const override
{ {
if( _attributes_dirty & PATH ) if( _attributes_dirty & PATH )
return; return;
@@ -555,13 +559,13 @@ namespace canvas
/** /**
* Compute the bounding box * Compute the bounding box
*/ */
virtual osg::BoundingBox osg::BoundingBox
#if OSG_VERSION_LESS_THAN(3,3,2) #if OSG_VERSION_LESS_THAN(3,3,2)
computeBound() computeBound()
#else #else
computeBoundingBox() computeBoundingBox()
#endif #endif
const const override
{ {
if( _path == VG_INVALID_HANDLE || (_attributes_dirty & PATH) ) if( _path == VG_INVALID_HANDLE || (_attributes_dirty & PATH) )
return osg::BoundingBox(); return osg::BoundingBox();
@@ -667,7 +671,7 @@ namespace canvas
struct PathUpdateCallback: struct PathUpdateCallback:
public osg::Drawable::UpdateCallback public osg::Drawable::UpdateCallback
{ {
virtual void update(osg::NodeVisitor*, osg::Drawable* drawable) void update(osg::NodeVisitor*, osg::Drawable* drawable) override
{ {
static_cast<PathDrawable*>(drawable)->update(); static_cast<PathDrawable*>(drawable)->update();
} }
+7 -5
View File
@@ -1,4 +1,5 @@
// An OpenVG path on the Canvas ///@file
/// An OpenVG path on the Canvas
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -40,7 +41,8 @@ namespace canvas
ElementWeakPtr parent = 0 ); ElementWeakPtr parent = 0 );
virtual ~Path(); virtual ~Path();
virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const; osg::BoundingBox
getTransformedBounds(const osg::Matrix& m) const override;
/** Add a segment with the given command and coordinates */ /** Add a segment with the given command and coordinates */
Path& addSegment(uint8_t cmd, std::initializer_list<float> coords = {}); Path& addSegment(uint8_t cmd, std::initializer_list<float> coords = {});
@@ -86,10 +88,10 @@ namespace canvas
bool _hasRect : 1; bool _hasRect : 1;
SGRectf _rect; SGRectf _rect;
virtual void updateImpl(double dt); void updateImpl(double dt) override;
virtual void childRemoved(SGPropertyNode * child); void childRemoved(SGPropertyNode * child) override;
virtual void childChanged(SGPropertyNode * child); void childChanged(SGPropertyNode * child) override;
void parseRectToVGPath(); void parseRectToVGPath();
}; };
+6 -5
View File
@@ -1,4 +1,5 @@
// A text on the Canvas ///@file
/// A text on the Canvas
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -17,6 +18,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#include <simgear_config.h> #include <simgear_config.h>
#include "CanvasText.hxx" #include "CanvasText.hxx"
#include <simgear/canvas/Canvas.hxx> #include <simgear/canvas/Canvas.hxx>
#include <simgear/canvas/CanvasSystemAdapter.hxx> #include <simgear/canvas/CanvasSystemAdapter.hxx>
@@ -56,21 +58,20 @@ namespace canvas
SGVec2i sizeForWidth(int w) const; SGVec2i sizeForWidth(int w) const;
virtual osg::BoundingBox osg::BoundingBox
#if OSG_VERSION_LESS_THAN(3,3,2) #if OSG_VERSION_LESS_THAN(3,3,2)
computeBound() computeBound()
#else #else
computeBoundingBox() computeBoundingBox()
#endif #endif
const; const override;
protected: protected:
friend class TextLine; friend class TextLine;
canvas::Text *_text_element; canvas::Text *_text_element;
virtual void computePositions(unsigned int contextID) const; void computePositions(unsigned int contextID) const override;
}; };
class TextLine class TextLine
+2 -1
View File
@@ -1,4 +1,5 @@
// A text on the Canvas ///@file
/// A text on the Canvas
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Geographic projections for Canvas map element ///@file
/// Geographic projections for Canvas map element
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Canvas user defined event ///@file
/// Canvas user defined event
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
+6 -1
View File
@@ -38,6 +38,7 @@ namespace canvas
public: public:
/** /**
* @brief Construct a user defined event from a type string
* *
* @param type_str Event type name (if name does not exist yet it will * @param type_str Event type name (if name does not exist yet it will
* be registered as new event type) * be registered as new event type)
@@ -49,6 +50,10 @@ namespace canvas
StringMap const& data = StringMap() ); StringMap const& data = StringMap() );
/** /**
* @brief Construct a user defined event from a (previously registered)
* type id
*
* @see getOrRegisterType()
* *
* @param type_id Event type id * @param type_id Event type id
* @param bubbles If this event should take part in the bubbling phase * @param bubbles If this event should take part in the bubbling phase
@@ -76,7 +81,7 @@ namespace canvas
* @see #bubbles * @see #bubbles
* @see CustomEvent() * @see CustomEvent()
*/ */
virtual bool canBubble() const { return bubbles; } bool canBubble() const override { return bubbles; }
StringMap detail; //!< User data map StringMap detail; //!< User data map
bool bubbles; //!< Whether the event supports bubbling bool bubbles; //!< Whether the event supports bubbling
+2 -1
View File
@@ -1,4 +1,5 @@
// Input device event ///@file
/// Input device event
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Keyboard event ///@file
/// Keyboard event
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
+2 -1
View File
@@ -1,4 +1,5 @@
// Mouse event ///@file
/// Mouse event
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
+1 -1
View File
@@ -38,7 +38,7 @@ namespace canvas
MouseEvent(const osgGA::GUIEventAdapter& ea); MouseEvent(const osgGA::GUIEventAdapter& ea);
MouseEvent* clone(int type = 0) const override; MouseEvent* clone(int type = 0) const override;
virtual bool canBubble() const; bool canBubble() const override;
osg::Vec2f getScreenPos() const { return screen_pos; } osg::Vec2f getScreenPos() const { return screen_pos; }
osg::Vec2f getClientPos() const { return client_pos; } osg::Vec2f getClientPos() const { return client_pos; }
+2 -1
View File
@@ -1,4 +1,5 @@
// Keyboard event demo. Press some keys and get some info... ///@file
/// Keyboard event demo. Press some keys and get some info...
// //
// Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2014 Thomas Geymayer <tomgey@gmail.com>
// //
-2
View File
@@ -5,8 +5,6 @@
#include <signal.h> #include <signal.h>
#include <iostream> #include <iostream>
#include <boost/foreach.hpp>
#include <simgear/io/sg_file.hxx> #include <simgear/io/sg_file.hxx>
#include <simgear/io/HTTPClient.hxx> #include <simgear/io/HTTPClient.hxx>
+28 -19
View File
@@ -72,10 +72,10 @@ namespace simgear {
std::string strip( const std::string& s ); std::string strip( const std::string& s );
/** /**
* Return a new string with any trailing \r and \n characters removed. * Return a new string with any trailing \\r and \\n characters removed.
* Typically useful to clean a CR-terminated line obtained from * Typically useful to clean a CR-terminated line obtained from
* std::getline() which, upon reading CRLF (\r\n), discards the Line * std::getline() which, upon reading CRLF (\\r\\n), discards the Line
* Feed character (\n) but leaves the Carriage Return (\r) in the * Feed character (\\n) but leaves the Carriage Return (\\r) in the
* string. * string.
* @param s Input string * @param s Input string
* @return The cleaned string * @return The cleaned string
@@ -83,7 +83,7 @@ namespace simgear {
std::string stripTrailingNewlines(const std::string& s); std::string stripTrailingNewlines(const std::string& s);
/** /**
* Strip any trailing \r and \n characters from a string. * Strip any trailing \\r and \\n characters from a string.
* Should have slightly less overhead than stripTrailingNewlines(). * Should have slightly less overhead than stripTrailingNewlines().
* @param s Input string (modified in-place) * @param s Input string (modified in-place)
*/ */
@@ -112,11 +112,12 @@ namespace simgear {
* Produces a result similar to the perl and python functions of the * Produces a result similar to the perl and python functions of the
* same name. * same name.
* *
* @param s The string to split into words, * @param s The string to split into words
* @param sep Word delimiters. If not specified then any whitespace is a separator, * @param sep Word delimiters. If not specified then any whitespace is
* @param maxsplit If given, splits at no more than maxsplit places, * a separator
* resulting in at most maxsplit+1 words. * @param maxsplit If given, splits at no more than maxsplit places,
* @return Array of words. * resulting in at most maxsplit+1 words
* @return Array of words
*/ */
string_list string_list
split( const std::string& s, split( const std::string& s,
@@ -124,11 +125,11 @@ namespace simgear {
int maxsplit = 0 ); int maxsplit = 0 );
/** /**
* split a string on any of several characters. Commonly used to deal * Split a string on any of several characters. Commonly used to deal
* with strings containing whitespace, newlines. To parse CSS style * with strings containing whitespace, newlines. To parse CSS style
* string, use with '\n\t ,' as the seperator list. * string, use with '\\n\\t ,' as the separator list.
* *
* Note consecutive seperators will not produce empty entries in the * @note Consecutive separators will not produce empty entries in the
* the result, i.e splitting 'a,b,,c,d' with a ',' will produce a result * the result, i.e splitting 'a,b,,c,d' with a ',' will produce a result
* with four entries, not five. * with four entries, not five.
*/ */
@@ -226,14 +227,22 @@ namespace simgear {
bool to_bool(const std::string& s); bool to_bool(const std::string& s);
/** /**
* Like strcmp(), but for dotted versions strings NN.NN.NN * Compare dotted versions strings NN.NN.NN (analogous to strcmp())
* any number of terms are supported. *
* @return 0 if versions match, -ve number if v1 is lower, +ve if v1 * @note Any number of terms are supported.
* is greater *
* @param maxComponents is the maximum number of components to look at. * @param v1 First version
* This can be used to ignore (say) the patch level by setting it to 2 * @param v2 Second version
* @param maxComponents The maximum number of components to look at. This
* can be used to ignore (say) the patch level by
* setting it to 2
* @return 0 if versions match,
* -ve number if @a v1 is lower,
* +ve if @a v1 is greater
*/ */
int compare_versions(const std::string& v1, const std::string& v2, int maxComponents = 0); int compare_versions( const std::string& v1,
const std::string& v2,
int maxComponents = 0 );
/** /**
* Convert a string to upper case. * Convert a string to upper case.
+2 -1
View File
@@ -1,4 +1,5 @@
// Base class for property controlled subsystems ///@file
/// Base class for property controlled subsystems
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
+9 -8
View File
@@ -1,4 +1,5 @@
// Base class for property controlled subsystems ///@file
/// Base class for property controlled subsystems
// //
// Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com> // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
// //
@@ -33,10 +34,10 @@ namespace simgear
public SGPropertyChangeListener public SGPropertyChangeListener
{ {
public: public:
virtual void init(); void init() override;
virtual void shutdown(); void shutdown() override;
virtual void update (double delta_time_sec); void update (double delta_time_sec) override;
/** /**
* Create a new PropertyBasedElement * Create a new PropertyBasedElement
@@ -88,10 +89,10 @@ namespace simgear
ElementFactory element_factory ); ElementFactory element_factory );
virtual ~PropertyBasedMgr() = 0; virtual ~PropertyBasedMgr() = 0;
virtual void childAdded( SGPropertyNode * parent, void childAdded( SGPropertyNode * parent,
SGPropertyNode * child ); SGPropertyNode * child ) override;
virtual void childRemoved( SGPropertyNode * parent, void childRemoved( SGPropertyNode * parent,
SGPropertyNode * child ); SGPropertyNode * child ) override;
virtual void elementCreated(PropertyBasedElementPtr element) {} virtual void elementCreated(PropertyBasedElementPtr element) {}
+1 -1
View File
@@ -23,7 +23,7 @@
// $Id$ // $Id$
/** /**
* \file audio sample.hxx * \file
* Provides a audio sample encapsulation * Provides a audio sample encapsulation
*/ */