GL Studio C++ Runtime API
gls_map_cadrg.h
Go to the documentation of this file.
1 /*! \file
2  \brief Declaration of the CADRGMapChartDataSource.
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_GLS_MAP_CADRG_H_INCLUDED
41 #define INCLUDED_GLS_MAP_CADRG_H_INCLUDED
42 
44 
45 #define LIB_BASE_NAME "gls_map_cadrg"
46 #include "gls_auto_lib.h"
47 #undef LIB_BASE_NAME
48 
49 #include <string>
50 namespace disti
51 {
52 class Image;
53 class CADRGMapChartLayerCache;
54 class CADRGMap;
55 
56 // FIND_TOC is the default value and will depend on the A.TOC file.
57 // FIND_CADRG_FILES will ignore an existing A.TOC file and attempt to load data files directly.
58 enum ParseDirectoryRules
59 {
60  FIND_TOC,
61  FIND_CADRG_FILES,
62 };
63 
64 // PROCESS_LATER will delay loading of data files metadata and textures which will miminize memory usage at the expense of slightly slower loading time.
65 enum JustInTimeFileLoading
66 {
67  PROCESS_LATER = true,
68  PROCESS_NOW = false,
69 };
70 
71 /// \defgroup ds_CADRG CADRG
72 /// CADRG data source
73 
74 /// Runtime implementation of an CADRGMapChartDataSource
75 /// \ingroup ds_CADRG
76 /// @{
78 {
79 protected:
80  GeoRect _availableCoverage;
81  MapChartCellList _masterCellList;
82 
83  unsigned long _userDefinedCADRGLayer;
84  unsigned long _userDefinedCIBLayer;
85 
86  bool _useUserDefinedCADRGLayer;
87  bool _useUserDefinedCIBLayer;
88  const JustInTimeFileLoading _useJITFileLoading;
89 
90  CADRGMapChartLayerCache* _layerCache; ///< Container for "old" data that is loaded but not currently shown.
91  CADRGMap* _cadrgMapStore; ///< Storage for map data.
93  const CADRGMapChartDataSource& operator=( const CADRGMapChartDataSource& );
94 
95  void LoadFilesFromCoverage( const GeoRect& coverage_param, unsigned long layer );
96 
97 public:
98  explicit CADRGMapChartDataSource( JustInTimeFileLoading = PROCESS_LATER );
100 
101  /// Use CADRG data from the specified directory
102  void ParseDirectory( const char* directoryPath, ParseDirectoryRules = FIND_TOC );
103 
104  /// Uses the currentScaleString value to derive a new map layer from the existing layer identified by currentScaleString.
105  /// \param currentScaleString should be the string of an existing layer e.g. "1:5M".
106  /// The valid of currentScaleString values are:
107  /// string - layer name
108  /// "1:5M" - GNC
109  /// "1:2M" - JNC
110  /// "1:1M" - ONC
111  /// "1:500K" - TPC
112  /// "1:250K" - JOG
113  /// "1:100K" - TLM
114  /// "1:50K" - TLM
115  /// \param customScaleString the string to be added to the above list of strings e.g."Custom1:5M".
116  /// \param customExtension the two character non-numeric file extension that can be used to find files for this layer.
117  void AddCustomMapLayer( const char* currentScaleString, const char* customScaleString, const char* customExtension );
118 
119  /// Gets the size of the layer container. This gives an upper bound to SetCADRGLayer when using custom layers.
120  unsigned int GetLayerCount() const;
121 
122  /// Get whether source will delay loading metdata for all files until they are shown.
123  JustInTimeFileLoading IsJustInTimeFileLoadingEnabled( void ) const;
124 
125  /// Set the target rate in hz at which cells will be loaded
126  /// \param targetCellLoadRate target rate in hz else 0.0 for no target rate ( i.e. load as quickly as possible )
127  void SetTargetCellLoadRate( const double targetCellLoadRate );
128 
129  /// Get the target rate in hz at which cells will be loaded
130  /// \return target rate in hz else 0.0 for no target rate ( i.e. load as quickly as possible )
131  double GetTargetCellLoadRate( void ) const;
132 
133  // see base class
134  bool GetAvailableCoverage( GeoRect* dest ) DISTI_METHOD_OVERRIDE;
135  // see base class
136  unsigned long GetBestLayer( GlsMapView* view, GlsMapChart* chart ) const DISTI_METHOD_OVERRIDE;
137  // see base class
138  void GetCellList( const GeoRect& coverage, unsigned long layerID, double viewLogicalHeight, double viewGeoHeight, MapChartCellList& viewList ) DISTI_METHOD_OVERRIDE;
139  /// Set the user-specificed layer to display for CADRG data.
140  /// Note: This value will NOT be used unless the SetUseCADRGLayerFlag is true.
141  /// The valid values are:
142  /// 0 - OVERVIEW1
143  /// 1 - GNC - 1:5M
144  /// 2 - JNC - 1:2M
145  /// 3 - ONC - 1:1M
146  /// 4 - TPC - 1:500K
147  /// 5 - JOG - 1:250K
148  /// 6 - TLM - 1:100K
149  /// 7 - TLM - 1:50K
150  /// \param layer The layer to display. Should be in the range [0, LayerCount() - 1].
151  void SetCADRGLayer( const unsigned long& layer );
152 
153  /// Set the layer to display for CADRG data by scale string.
154  /// Note: This value will NOT be used unless the SetUseCADRGLayerFlag is true.
155  /// The valid values are:
156  /// string - layer name
157  /// "1:5M" - GNC
158  /// "1:2M" - JNC
159  /// "1:1M" - ONC
160  /// "1:500K" - TPC
161  /// "1:250K" - JOG
162  /// "1:100K" - TLM
163  /// "1:50K" - TLM
164  /// \param str The scale string of the layer to display. The strings are defined in the CADRG standard, i.e. "1:1M".
165  void SetCADRGLayer( const std::string& str );
166 
167  /// Get the currently set layer for CADRG data.
168  /// \returns The currently set layer for CADRG data.
169  inline unsigned long GetCADRGLayer( void ) { return _userDefinedCADRGLayer; }
170 
171  /// Set the layer to display for CIB data.
172  /// Note: This value will NOT be used unless the SetUseCADRGLayerFlag is true.
173  /// The valid values are:
174  /// 8 - 10M
175  /// 9 - 5M
176  /// \param layer The layer to display. Should be in the range [8, 10].
177  void SetCIBLayer( const unsigned long& layer );
178 
179  /// Set the layer to display for CIB data by scale string.
180  /// Note: This value will NOT be used unless the SetUseCADRGLayerFlag is true.
181  /// The valid values are:
182  /// "10M"
183  /// "5M"
184  /// \param str The scale string of the layer to display. The strings are defined int the CADRG standard, i.e. "1M".
185  void SetCIBLayer( const std::string& str );
186 
187  /// Get the currently set layer for CIB data.
188  /// \returns The currently set layer for CIB data.
189  inline unsigned long GetCIBLayer( void ) { return _userDefinedCIBLayer; }
190 
191  /// Set the use CADRG layer flag, which turns on and off the use of the user specified layer for CADRG data.
192  inline void SetUseCADRGLayerFlag( bool layerFlag ) { _useUserDefinedCADRGLayer = layerFlag; }
193 
194  /// Get the current setting of the use CADRG layer flag.
195  inline bool GetUseCADRGLayerFlag( void ) { return _useUserDefinedCADRGLayer; }
196 
197  /// Set the use CIB layer flag, which turns on and off the use of the user specified layer for CIB data.
198  inline void SetUseCIBLayerFlag( bool layerFlag ) { _useUserDefinedCIBLayer = layerFlag; }
199 
200  /// Get the current setting of the use CIB layer flag.
201  inline bool GetUseCIBLayerFlag( void ) { return _useUserDefinedCIBLayer; }
202 
203  /// Set the count of the layer cache
204  /// \param cacheCount max number of layers to cache else 0u to disable layer caching
205  ///
206  void SetLayerCacheCount( const unsigned int cacheCount );
207 
208  /// Get the count of the layer cache
209  /// \return max number of layers to cache ( 0u if layer caching is disabled )
210  ///
211  unsigned int GetLayerCacheCount( void ) const;
212 
213  /// Updates the coverage area that is returned
214  /// by GetAvailableCoverage. This is called automatically
215  /// when something causes the coverage area to change.
216  /// This method is slow, users of the class should not need to call it directly.
217  void CalcAvailableCoverage();
218 
219  /// Not normally called by user
220  Image* LoadCellImage( MapChartCell* cell );
221 };
222 /// @}
223 
224 } // namespace disti
225 #endif
Definition: image.h:162
Definition: gls_map_chart_data_source.h:210
void SetTargetCellLoadRate(const double targetCellLoadRate)
void SetCIBLayer(const unsigned long &layer)
Definition: gls_map_util.h:414
The GlsMapView is a special group that controls the map view parameters. It contains all of the objec...
Definition: gls_map_view.h:86
Definition: gls_map_cadrg.h:77
unsigned int GetLayerCount() const
Gets the size of the layer container. This gives an upper bound to SetCADRGLayer when using custom la...
bool GetUseCIBLayerFlag(void)
Get the current setting of the use CIB layer flag.
Definition: gls_map_cadrg.h:201
unsigned long GetBestLayer(GlsMapView *view, GlsMapChart *chart) const DISTI_METHOD_OVERRIDE
Image * LoadCellImage(MapChartCell *cell)
Not normally called by user.
void ParseDirectory(const char *directoryPath, ParseDirectoryRules=FIND_TOC)
Use CADRG data from the specified directory.
CADRGMapChartLayerCache * _layerCache
Container for "old" data that is loaded but not currently shown.
Definition: gls_map_cadrg.h:90
unsigned long GetCADRGLayer(void)
Definition: gls_map_cadrg.h:169
The disti::GlsMapChartDataSource class.
unsigned int GetLayerCacheCount(void) const
unsigned long GetCIBLayer(void)
Definition: gls_map_cadrg.h:189
CADRGMap * _cadrgMapStore
Storage for map data.
Definition: gls_map_cadrg.h:91
void SetUseCIBLayerFlag(bool layerFlag)
Set the use CIB layer flag, which turns on and off the use of the user specified layer for CIB data...
Definition: gls_map_cadrg.h:198
The MapChartCell class represents an area within a 2D map.
Definition: gls_map_chart_data_source.h:64
void SetCADRGLayer(const unsigned long &layer)
void SetUseCADRGLayerFlag(bool layerFlag)
Set the use CADRG layer flag, which turns on and off the use of the user specified layer for CADRG da...
Definition: gls_map_cadrg.h:192
The gls_auto_lib.
bool GetAvailableCoverage(GeoRect *dest) DISTI_METHOD_OVERRIDE
void AddCustomMapLayer(const char *currentScaleString, const char *customScaleString, const char *customExtension)
double GetTargetCellLoadRate(void) const
void GetCellList(const GeoRect &coverage, unsigned long layerID, double viewLogicalHeight, double viewGeoHeight, MapChartCellList &viewList) DISTI_METHOD_OVERRIDE
Definition: gls_map_chart.h:70
bool GetUseCADRGLayerFlag(void)
Get the current setting of the use CADRG layer flag.
Definition: gls_map_cadrg.h:195
JustInTimeFileLoading IsJustInTimeFileLoadingEnabled(void) const
Get whether source will delay loading metdata for all files until they are shown. ...
Definition: bmpimage.h:46
void SetLayerCacheCount(const unsigned int cacheCount)