/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2012 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_ANNO_LOCAL_GEOMETRY_NODE_H
#define OSGEARTH_ANNO_LOCAL_GEOMETRY_NODE_H 1

#include <osgEarthAnnotation/LocalizedNode>
#include <osgEarth/MapNode>
#include <osgEarthSymbology/Geometry>
#include <osgEarthSymbology/Style>

namespace osgEarth { namespace Annotation
{	
    using namespace osgEarth;
    using namespace osgEarth::Symbology;

    /**
     * Simple node that renders geometry into a scene graph node. The geometry
     * is in a local tangent plane that may be positioned somewhere on the 
     * Map's surface.
     */
    class OSGEARTHANNO_EXPORT LocalGeometryNode : public LocalizedNode
    {
    public:
        /**
         * Constructs a new localized node that renders a Geometry
         */
        LocalGeometryNode( 
            MapNode*     mapNode,
            Geometry*    geom, 
            const Style& style, 
            bool         draped     =false );

        /**
         * Construcst a new localized node that renders a pre-built
         * node (in a local cartesian space)
         */
        LocalGeometryNode( 
            MapNode*     mapNode,
            osg::Node*   node, 
            const Style& style      =Style(), 
            bool         draped     =false );

        virtual ~LocalGeometryNode() { }

    public:

        LocalGeometryNode(
            MapNode*              mapNode,
            const Config&         conf,
            const osgDB::Options* dbOptions );

        virtual Config getConfig() const;

    protected:

        optional<Style> _style;
        bool  _draped;
        osg::ref_ptr<Geometry> _geom;

        void init(const osgDB::Options*);
    };

} } // namespace osgEarth::Annotation

#endif // OSGEARTH_ANNO_LOCAL_GEOMETRY_NODE_H
