GL Studio C++ Runtime API
gls_map_aif.h
Go to the documentation of this file.
1 /*! \file
2  \brief The AifMapChartDataSource class definition.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2017 The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 #ifndef INCLUDED_GLSMAPAIF_H
41 #define INCLUDED_GLSMAPAIF_H
42 
45 #include "gls_map_util.h"
46 #include <map>
47 #include <string>
48 #include <vector>
49 
50 #define LIB_BASE_NAME "gls_map_aif"
51 #include "gls_auto_lib.h"
52 #undef LIB_BASE_NAME
53 
54 namespace disti
55 {
56 class AifMapChartCell;
57 class AIFMapChartLayerCache;
58 class GeoRect;
59 
60 /// Type definitions for a multimap containing resoulution to AifMapChartCell pointer mappings.
61 typedef std::pair<double, AifMapChartCell*> ResolutionCellPair;
62 typedef std::multimap<double, AifMapChartCell*> ResolutionCellMultiMap;
63 
64 /// Type definitions for a multimap containing overlay name to resolution/cell multimap mappings.
65 typedef std::pair<std::string, ResolutionCellMultiMap> OverlayCellPair;
66 typedef std::multimap<std::string, ResolutionCellMultiMap> OverlayCellMultiMap;
67 
68 /// Type definitions for a vector of overlay name / resolution pairs.
69 typedef std::pair<std::string, double> OverlayListPair;
70 typedef std::vector<OverlayListPair> OverlayListType;
71 
72 typedef std::vector<double> ResolutionList;
73 
74 /// \defgroup ds_AIF AIF
75 /// AIF data source
76 
77 /// Runtime implementation of an AifMapChartDataSource
78 /// \ingroup ds_AIF
79 /// @{
81 {
82 public:
83  /// Create a new AifMapChartDataSource.
84  /// \param UseDefaultCache whether to use the default caching system. See \ref AIFMapChartLayerCache for more information
85  AifMapChartDataSource( bool UseDefaultCache = true );
86 
87  /// Destructs a AifMapChartDataSource object.
89 
90  /// Load an AIF File with the given file name.
91  /// \param filename The name of the AIF file to load. Can be absolute or relative to the executing directory.
92  void LoadAifFile( std::string filename );
93 
94  /// If using custom cache, set it here. Caller responsible for its deallocation if necessary
95  /// \param cache Custom cache to use
96  virtual void SetCache( AIFMapChartLayerCache& cache );
97 
98  /// See base class
99  bool GetAvailableCoverage( GeoRect* dest ) DISTI_METHOD_OVERRIDE;
100 
101  /// See base class
102  void GetCellList( const GeoRect& coverage, unsigned long layerID, double viewLogicalHeight, double viewGeoHeight, MapChartCellList& viewList ) DISTI_METHOD_OVERRIDE;
103 
104  /// Add an overlay layer to the list of layers to display.
105  /// \param overlay The name of the overlay layer to display. Must correspond to an overlay defined in the AIF file.
106  /// \param resolution The resolution of the overlay to display. Must correspond to a resolution of an overlay defined in the AIF file.
107  void AddOverlay( const std::string& overlay, double resolution );
108 
109  /// Insert an overlay layer to the list of layers to display at the given position.
110  /// \param index The index to insert the overlay at, if -1 or greater than the length of the overlay list then inserts at end.
111  /// \param overlay The name of the overlay layer to display. Must correspond to an overlay defined in the AIF file.
112  /// \param resolution The resolution of the overlay to display. Must correspond to a resolution of an overlay defined in the AIF file.
113  void InsertOverlay( int index, const std::string& overlay, double resolution );
114 
115  /// Remove an overlay layer from the list of layers to display.
116  /// \param overlay The name of the overlay layer to remove. Must correspond to an overlay defined in the AIF file.
117  /// \param resolution The resolution of the overlay to remove. Must correspond to a resolution of an overlay defined in the AIF file.
118  void RemoveOverlay( const std::string& overlay, double resolution );
119 
120  /// Remove all overlay layers with the given overlay name.
121  /// \param overlay The name of the set of overlay layers to remove.
122  void RemoveOverlay( const std::string& overlay );
123 
124  /// Remove all overlay layers with the given resolution.
125  /// \param resolution The resolution of the set of overlay layers to remove.
126  void RemoveOverlay( double resolution );
127 
128  /// \param memSize Set the cached size (megabytes) of images
129  void SetCacheSize( const float memSize );
130 
131  /// Get the cached size (megabytes) of images
132  float GetCacheSize() const;
133 
134  /// Get the amount of memory used
135  float GetCurrentCacheAllocated();
136 
137  /// Install the view manager. The view manager (after being initialized by the user)
138  /// will set this class up to add/remove overlays automatically based on the view height
139  /// \param mgr Manager to install
140  void InstallViewManager( AIFViewManager& mgr );
141 
142  /// Uninstall the view manager.
143  void UninstallViewManager();
144 
145  /// Precache based on geo-rect area. This uses the AIFMapChartCache as the mechanism to
146  /// precache images
147  /// \param area Geometric rect area to pre-cache
148  void PreCache( const GeoRect& area );
149 
150  /// Precache based on resolution
151  /// \param resolution Resolution to precache at.
152  void PreCache( const double resolution );
153 
154  /// Set the target rate in hz at which cells will be loaded
155  /// \param targetCellLoadRate target rate in hz else 0.0 for no target rate
156  /// ( i.e. load as quickly as possible )
157  void SetTargetCellLoadRate( const double targetCellLoadRate );
158 
159  /// Get the target rate in hz at which cells will be loaded
160  /// \return target rate in hz else 0.0 for no target rate ( i.e. load as quickly as possible )
161  double GetTargetCellLoadRate() const;
162 
163 protected:
164  /// The multimap containing all loaded cells for this Map Chart Data Source.
165  OverlayCellMultiMap _cells;
166 
167  /// A list of the resolutions in this AIF file for speeding up the
168  /// selection of a resolution at cell load list time.
169  ResolutionList _resolutionList;
170 
171  /// The lat/lon boundries of the data contained in this Map Chart Data Source.
173 
174  /// A list of all currently displayed overlay layers.
175  OverlayListType _overlayList;
176 
177  /// The cache
179 
180  /// The View manager
182 
183  /// Using default cache
185 };
186 
187 } // namespace disti
188 
189 #endif
GeoRect _extents
The lat/lon boundries of the data contained in this Map Chart Data Source.
Definition: gls_map_aif.h:172
void AddOverlay(const std::string &overlay, double resolution)
Definition: aif_map_chart_cache.h:51
AIFViewManager * _pViewMgr
The View manager.
Definition: gls_map_aif.h:181
virtual void SetCache(AIFMapChartLayerCache &cache)
Definition: gls_map_chart_data_source.h:210
std::pair< std::string, ResolutionCellMultiMap > OverlayCellPair
Type definitions for a multimap containing overlay name to resolution/cell multimap mappings...
Definition: gls_map_aif.h:65
Definition: gls_map_util.h:414
void GetCellList(const GeoRect &coverage, unsigned long layerID, double viewLogicalHeight, double viewGeoHeight, MapChartCellList &viewList) DISTI_METHOD_OVERRIDE
See base class.
OverlayListType _overlayList
A list of all currently displayed overlay layers.
Definition: gls_map_aif.h:175
void InsertOverlay(int index, const std::string &overlay, double resolution)
std::pair< double, AifMapChartCell * > ResolutionCellPair
Type definitions for a multimap containing resoulution to AifMapChartCell pointer mappings...
Definition: gls_map_aif.h:58
std::pair< std::string, double > OverlayListPair
Type definitions for a vector of overlay name / resolution pairs.
Definition: gls_map_aif.h:69
Utility classes for GL Studio Map toolkit.
void SetCacheSize(const float memSize)
void PreCache(const GeoRect &area)
double GetTargetCellLoadRate() const
bool _usingDefaultCache
Using default cache.
Definition: gls_map_aif.h:184
Definition: gls_map_aif.h:80
The disti::GlsMapChartDataSource class.
AIFMapChartLayerCache * _pCache
The cache.
Definition: gls_map_aif.h:178
float GetCurrentCacheAllocated()
Get the amount of memory used.
void LoadAifFile(std::string filename)
float GetCacheSize() const
Get the cached size (megabytes) of images.
AifMapChartDataSource(bool UseDefaultCache=true)
The gls_auto_lib.
Definition: gls_map_aif_view_manager.h:51
void RemoveOverlay(const std::string &overlay, double resolution)
void InstallViewManager(AIFViewManager &mgr)
void UninstallViewManager()
Uninstall the view manager.
The AIF View Manager class.
ResolutionList _resolutionList
Definition: gls_map_aif.h:169
void SetTargetCellLoadRate(const double targetCellLoadRate)
~AifMapChartDataSource()
Destructs a AifMapChartDataSource object.
Definition: bmpimage.h:46
OverlayCellMultiMap _cells
The multimap containing all loaded cells for this Map Chart Data Source.
Definition: gls_map_aif.h:165
bool GetAvailableCoverage(GeoRect *dest) DISTI_METHOD_OVERRIDE
See base class.