/* -*-c++-*- */
/* osgEarth - Geospatial SDK for OpenSceneGraph
* Copyright 2019 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.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* 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_ANNOTATION_ANNOTATION_DATA_H
#define OSGEARTH_ANNOTATION_ANNOTATION_DATA_H 1

#include <osgEarthAnnotation/Common>
#include <osgEarth/Viewpoint>
#include <osgEarth/DateTimeRange>

namespace osgEarth { namespace Annotation
{	
    using namespace osgEarth;
    
    /**
     * Stores annotation metadata/extra information that can be stored
     * in a UserData slot
     *
     * NOTE: This is only here to support the KML loader, and should be
     * refactored out of here.
     */
    class OSGEARTHANNO_EXPORT AnnotationData : public osg::Referenced
    {
    public:
        /**
         * Construct a new annotation data structure.
         */
        AnnotationData();

        /**
         * Deserialize an annotation data structure.
         */
        AnnotationData( const Config& conf );

    public:
        /**
         * Readable name of the annotation.
         */
        void setName( const std::string& value ) { _name = value; }
        const std::string& getName() const { return _name; }

        /**
         * Readable description of the annotation.
         */
        void setDescription( const std::string& value ) { _description = value; }
        const std::string& getDescription() const { return _description; }

        /**
         * Viewpoint associated with this annotation.
         */
        void setViewpoint( const Viewpoint& vp ) {
            if ( _viewpoint )
                delete _viewpoint;
            _viewpoint = new Viewpoint(vp);
        }

        const Viewpoint* getViewpoint() const {
            return _viewpoint;
        }

        /**
        * DateTime range of the annotation
        */
        void setDateTimeRange(const DateTimeRange& value) { _dateTimeRange = value; }
        const DateTimeRange& getDateTimeRange() const { return _dateTimeRange; }


    public: // serialization

        virtual void mergeConfig(const Config& conf);
        Config getConfig() const;

    public:
        virtual ~AnnotationData();

    protected:
        std::string   _name;
        std::string   _description;
        float         _priority;
        Viewpoint*    _viewpoint;
        DateTimeRange _dateTimeRange;
    };

} } // namespace osgEarth::Annotation

#endif //OSGEARTH_ANNOTATION_ANNOTATION_DATA_H
