//
//  TMKMapView.h
//  TnMapKit
//
//  Created by Holzhauer, James on 2/3/14.
//  Copyright (c) 2014 TeleNav. All rights reserved.
//
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

#ifdef VIRTUOS_METAL
#import <MetalKit/MetalKit.h>
#else
#import <GLKit/GLKit.h>
#endif

#import "TMKEngineTypes.h"
#import "TMKTouchDelegate.h"

@class TMKAnnotation; 
@class TMKOverlay; //for add/remove shapes API
@class TMKEngineState;

__attribute__((visibility("default")))

#ifdef VIRTUOS_METAL
@interface TMKMapView : MTKView
#else
@interface TMKMapView : GLKView
#endif

// Initialization
// Default frame is complete window boundary
// Default position and zoom level based on .json configuration

- (id)init;
- (id)initWithFrame:(CGRect)frame;
- (id)initWithFrame:(CGRect)frame atCameraPosition:(CLLocation*)location andZoomLevel:(NSNumber*)zoomLevel;

// Touch delegate (defined in TMKTouchDelegate)

@property (nonatomic, weak) id<TMKTouchDelegate> touchDelegate;

// The current touch mode (enumeration as defined in
// TMKEngineTypes). Default value is TMKTouchMode_All.

@property (nonatomic) TMKTouchMode touchMode;

// The current zoom level (valid levels are 0 to N)

@property (nonatomic) float zoomLevel;

// Default transition time (amount of time a view changing (position,
// orientation, etc...) transition lasts, in seconds) Default value is
// 0.5 seconds

@property (nonatomic) NSTimeInterval defaultTransitionTime;

// Determines the view's rendering mode, for example, 2D-North-Up
// (enumeration as defined in TMKEngineTypes). Default value is
// TMKRenderMode_NorthUp_3D

@property (nonatomic) TMKRenderMode renderMode;

// Determines whether or not to render in day or night mode.  Default
// value is FALSE.

@property (nonatomic) BOOL nightMode;

// Determines whether or not to display measurements utilizing metric
// units.  Default value is FALSE.

@property (nonatomic) BOOL useMetricUnits;

// Camera management
- (void)lookAtLocation:(CLLocation*)location;
- (void)lookAtAnnotations:(NSSet*)annotations withMargin:(float)margin;
- (void)lookAtRegionWithinNorthLat:(double)north
                           westLon:(double)west
                          southLat:(double)south
                           eastLon:(double)east
                        withMargin:(float)margin;
// For framing
- (float)calculateZoomForAnnotations:(NSSet*)annotations 
                          centeredAt:(TMKAnnotationID*)centerAnno 
                              inRect:(CGSize)rect withMargin:(float)margin;

- (CLLocation*)calculateRegionForLocations:(NSArray*)locations 
                                    inRect:(CGRect)rect 
                                withMargin:(float)margin;

// Annotation layer management
- (TMKMapLayer*)unusedAnnotationLayer; //get an unused annotation layer

- (void)disableAnnotationLayer:(TMKMapLayer*)layer; //disable a layer or layers
- (void)disableAnnotationLayers:(NSArray*)layers;
- (void)disableAllAnnotationLayers;

- (void)enableAnnotationLayer:(TMKMapLayer*)layer; //enable a layer or layers
- (void)enableAnnotationLayers:(NSArray*)layers;

// Annotation manipulation
- (void)updateAnnotationPosition:(TMKAnnotationID*)anno 
                        location:(CLLocation*)location;

// Annotation addition/removal (see TMKAnnotation for parameters class)
- (TMKAnnotationID*)addAnnotation:(TMKAnnotation*)annoParam;
- (void)removeAnnotation:(TMKAnnotationID*)anno; //delete annotation from view
- (void)removeAllAnnotations;

// Activate a popup without waiting for a user to click it
- (void)activatePopup:(TMKAnnotationPopup*)popup;
- (void)removePopup;

// Add/remove shapes (see TMKOverlay for parameters and functions for building a shape model)
- (TMKOverlayID*)addOverlay:(TMKOverlay*)Overlay;
- (void)removeOverlay:(TMKOverlayID*)OverlayId;
- (void)removeAllOverlays;

// Query
- (CLLocation*)getLocationForScreenPoint:(CGPoint)point;
- (UIImage*)currentImage;

// call when switching displays with new framebuffer frame size
- (void)reloadMapSettingForOutputSwitching:(CGRect)frame; //automatically calls setFrame with new frame

- (BOOL)setDeclinationAngleFor3D:(NSArray*)declination;
- (BOOL)setDeclinationAngleFor2D:(NSNumber*)declination;
- (NSArray*)configuredDeclination3D;
- (NSNumber*)configuredDeclination2D;

// Inspect TMKView engine state (non-mutable)
- (TMKEngineState*)engineState;

// Set a Touch Delegate to handle some touch events.
// Your Touch Delegate Object must comply with the @protocol TMKTouchDelegate
- (void)setTouchDelegate:(id<TMKTouchDelegate>)touchDelegate;

@end
#pragma clang diagnostic pop
