//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2009      Patrick Spendrin <ps_ml@gmx.de>
//

#ifndef GEODATAFEATUREPRIVATE_H
#define GEODATAFEATUREPRIVATE_H

#include <QtCore/QString>
#include <QtCore/QAtomicInt>

#include "GeoDataFeature.h"
#include "GeoDataRegion.h"

namespace Marble
{

class GeoDataFeaturePrivate
{
  public:
    GeoDataFeaturePrivate() :
        m_name(),
        m_description(),
        m_descriptionCDATA(),
        m_address(),
        m_phoneNumber(),
        m_styleUrl(),        
        m_popularity( 0 ),
        m_popularityIndex( 19 ),
        m_visible( true ),
        m_visualCategory( GeoDataFeature::Default ),
        m_role(' '),
        m_style( 0 ),
        m_styleMap( 0 ),
        m_region(),
        ref( 0 )
    {
    }

    GeoDataFeaturePrivate( const GeoDataFeaturePrivate& other ) :
        m_name( other.m_name ),
        m_description( other.m_description ),
        m_descriptionCDATA( other.m_descriptionCDATA),
        m_address( other.m_address ),
        m_phoneNumber( other.m_phoneNumber ),
        m_styleUrl( other.m_styleUrl ),
        m_popularity( other.m_popularity ),
        m_popularityIndex( other.m_popularityIndex ),
        m_visible( other.m_visible ),
        m_visualCategory( other.m_visualCategory ),
        m_role( other.m_role ),
        m_style( other.m_style ),               //FIXME: both style and stylemap need to be reworked internally!!!!
        m_styleMap( other.m_styleMap ),
        m_region( other.m_region ),
        ref( 0 )
    {
    }

    void operator=( const GeoDataFeaturePrivate& other )
    {
        m_name = other.m_name;
        m_description = other.m_description;
        m_descriptionCDATA = other.m_descriptionCDATA;
        m_address = other.m_address;
        m_phoneNumber = other.m_phoneNumber;
        m_styleUrl = other.m_styleUrl;
        m_popularity = other.m_popularity;
        m_popularityIndex = other.m_popularityIndex;
        m_visible = other.m_visible;
        m_role = other.m_role;
        m_style = other.m_style;
        m_styleMap = other.m_styleMap;
        m_visualCategory = other.m_visualCategory;
        m_region = other.m_region;
    }
    
    virtual void* copy() 
    { 
        GeoDataFeaturePrivate* copy = new GeoDataFeaturePrivate;
        *copy = *this;
        return copy;
    }

    virtual EnumFeatureId featureId() const
    {
        return InvalidFeatureId;
    }

    virtual ~GeoDataFeaturePrivate()
    {
    }

    virtual QString nodeType() const
    {
        return Marble::GeoDataTypes::GeoDataFeatureType;
    }

    QString     m_name;         // Name of the feature. Is shown on screen
    QString     m_description;  // A longer textual description
    bool        m_descriptionCDATA; // True if description should be considered CDATA
    QString     m_address;      // The address.  Optional
    QString     m_phoneNumber;  // Phone         Optional
    QString     m_styleUrl;     // styleUrl     Url#tag to a document wide style
    qint64      m_popularity;   // Population(!)
    int         m_popularityIndex; // Index of population

    bool        m_visible;      // True if this feature should be shown.
    GeoDataFeature::GeoDataVisualCategory  m_visualCategory; // the visual category


    QChar       m_role;

    GeoDataStyle*    m_style;
    GeoDataStyleMap* m_styleMap;
    GeoDataLookAt*   m_lookAt;

    GeoDataRegion m_region;
    
    QAtomicInt  ref;
};

} // namespace Marble

#endif //GEODATAFEATUREPRIVATE_H
