/*
 *  TnMapVectorData.h
 *
 *  Created by Jian Huang on 12/22/10.
 *  Copyright 2010 TeleNav. All rights reserved.
 *
 */

#ifndef TN_MAP_VECTOR_DATA_H
#define TN_MAP_VECTOR_DATA_H

#include <string>
#include "foundation/SharedPtr.h"
#include "foundation/WeakPtr.h"

#include "TnMapTileDataRequest.h"
#include "TnMapAnnotationParams.h"



enum eTnMapArrowStyle {

    eTnMapArrowStyle_Arrow_Positive,
    eTnMapArrowStyle_Arrow_Negative,
    eTnMapArrowStyle_Segment
};

class TnMapVectorData : public TnMapTileDataRequest
{
public:

    typedef Tn::Foundation::shared_ptr<TnMapVectorData> ptr;
    typedef Tn::Foundation::weak_ptr<TnMapVectorData> wptr;

    bool m_requestRegions;
    bool m_requestEdges;
    bool m_requestPoints;
    bool m_lowDetail;
    uint32_t m_zoomLevel;
    TnMapVectorData(bool requestRegions,
                    bool requestEdges,
                    bool requestPoints,
                    bool lowDetail,
                    uint32_t zoomLevel);

    virtual ~TnMapVectorData();

    virtual TnMapTileId const & GetTileId() const = 0;

    /* interfaces for vector edge data */

    virtual void NewEdge(std::string const & name, std::string const & style) = 0;

    virtual void AddEdgePoint(double degreesLatitude, 
                              double degreesLongitude, 
                              double metersHeight) = 0;

    virtual void AddLeftTraffic(std::string const & tmcId, uint32_t begin, uint32_t count) = 0;

    virtual void AddRightTraffic(std::string const & tmcId, uint32_t begin, uint32_t count) = 0;

	virtual void AddLandmarkRef(int32_t depth, int32_t col, int32_t row) = 0;

    /* interfaces for vector polygon data */

    /*
      Polygons consist of one or more contours. Counter-clockwise
      contours are filled in, while clockwise contours are 'cutouts'
      or 'islands.'

      For now, 'type' is a server-specific number used to determine
      the color and layer. This will be replaced with a more general
      mechansim in the future.
    */

    virtual void NewPolygon(std::string const & name, std::string const & style) = 0;

    virtual void NewContour() = 0;

    virtual void AddPolygonPoint(double degreesLatitude, 
                                 double degreesLongitude,
                                 double metersHeight) = 0;

    /* intefaces for text data */

    /*! This specifies a one-way arrow. */

    virtual void NewArrow(std::vector<Tn::math::LatLonHeight> const & llh, //!< lat long heights making up the arrow outline
                          eTnMapArrowStyle arrowType    //!<    positive, negative, or segment
                                                    ) = 0;


    /*! Map labels. Supports unicode via a client-provided glyph
     *  proxy. The 'AddPoint' function is used to specify the position
     *  in the case of point labels, and a spline in the case of
     *  feature labels.
     *
     *  The style parameters represent entries in the JSON
     *  configuration file specifying a given rendering style. The
     *  style is a string representing a dot-separated path to a JSON
     *  node containing all the elements needed for a given supported
     *  label style.
     *
     *  Currently supported styles:
     *
     *  billboard
     *
     *     This puts up a 3D billboard used to label a road. The
     *     billboard is built to fit the text.
     *
     *  flat_feature
     *
     *     This is typically used to specify flat 2D feature
     *     (i.e. e.g. roads).
     *
     *  flat_point
     *
     *     This is used to specify a point label (i.e. e.g. city,
     *     park, etc.).
     *
     *  See config_mmde_label.json file for examples.
     *
     *  Within the JSON presentation parameters, the 'font_size'
     *  parameter is the font size that will be sent to the glyph
     *  proxy when it requests the glyph. The 'render_size' is the
     *  size the font will actually be rendered on the screen. Since
     *  the correlation between points and pixels is not under direct
     *  control of the engine, both parameters are made availble. If a
     *  glyph is too pixelated when it appears on the screen, use a
     *  larger 'font_size'.
     *
     *  The 'style2D' parameter specifies the rendering style for when
     *  the map is viewed orthogonally.
     *
     *  The 'style3D' parameter specifies the rendering style for when
     *  the map is viewed in 3D mode. 
     *
     *  For a label that should only appear in one viewing mode,
     *  provide an empty string for the other case.
     */

    /*
     *  In this version of NewLabel, the 'style' parameter specifies a
     *  rendering style to be applied in both the orthogonal case and
     *  the 3D case.
     */

    virtual void NewLabel(std::string const & label, 
                          std::string const & style) = 0;
    
    virtual void NewLabel(std::string const & label,
                          std::set<std::string> const & styles) = 0;

    virtual void AddLabelPoint(double degreesLatitude, 
                               double degreesLongitude,
                               double metersHeight) = 0;

    /*! New Annotation API. 
     *
     *  The 'icon' parameter specifies the resource name of the icon's
     *  bitmap. (Eventually, ITnMapEngine::Pickables will be
     *  supported.)
     *
     *  The 'style' parameter specifies the JSON address to the node
     *  in the currently-loaded configuration specifying the presentation
     *  parameters.
     *
     *  The 'text' parameter specifies text to be optionally placed on
     *  the annotation graphic. 
     *
     *  Within the JSON presentation parameters, icon_x and icon_y
     *  specify the pivot point. The 'font_size' parameter is the font
     *  size that will be sent to the glyph proxy when it requests the
     *  glyph. The 'render_size' is the size the font will actually be
     *  rendered on the screen. Since the correlation between points
     *  and pixels is not under direct control of the engine, both
     *  parameters are made availble. If a glyph is too pixelated when
     *  it appears on the screen, use a larger 'font_size'.
     *
     */
    
    /*! CreateAnnotation API
     *  Hopefully the last Annotation API
     *  Utilizes the TnMapAnnotationParams class
     *  
     *  The TnMapAnnotationParams class holds all of the common API calls while
     *  also providing access to configuration based variables
     *
     *  Creating annotations for a given layer will automatically
     *  replace the annotations in that layer. However, this leaves no
     *  way to merely clear a layer without creating an
     *  annotation. Consequently, there is also a ClearAnnotationLayer
     *  function.
     *
     */
        
    virtual void CreateAnnotation(TnMapAnnotationParams params,
                                  ITnMapEngine::Pickable::const_ptr const &
                                  pickable = ITnMapEngine::Pickable::const_ptr()) = 0;
    
    // Factory method to get AnnotationParams variable from the implementation's config
    virtual TnMapAnnotationParams GetDefaultAnnotationParams(std::string const & style, uint32_t zoomLevel) const = 0;

    virtual void ClearAnnotationLayer(eTnMapLayer layer) = 0;

    /*! This specifies the annotation layers that the proxy is being
     *  asked to provide. If the pointer is null, then the proxy is
     *  requested to provide ALL the annotation layers. */

    virtual TnMapLayerSet RequestedLayers() = 0;
    
    
    virtual bool CompletedSuccessfully() const = 0;
};
#endif

