GL Studio C++ Runtime API
gls_map_dnc.h
Go to the documentation of this file.
1 /*! \file
2  \brief The DNCMapChartDataSource class.
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_DNC_H
41 #define INCLUDED_GLS_MAP_DNC_H
42 
43 #include "dnc_util.h"
44 #include "gls_cpp_lang_support.h"
46 #include "vpf_table.h"
47 #include "vpf_table_header.h"
48 #include "vpf_util.h"
49 
50 #define LIB_BASE_NAME "gls_map_dnc"
51 #include "gls_auto_lib.h"
52 #undef LIB_BASE_NAME
53 
54 namespace disti
55 {
56 // forward ref
57 class Mutex;
58 class GlsFontBase;
59 class DNCDatabase;
60 class DNCLibrary;
61 class DNCAsyncCellRenderThread;
62 class DNCMapChartCell;
63 #if defined( _WIN32 )
64 class WGLExtensions;
65 #else
66 class GLXExtensions;
67 #endif // defined( _WIN32 )
68 
69 /// \defgroup ds_DNC DNC
70 /// DNC data source
71 
72 /// Map chart data source for loading Digital Nautical Chart (DNC, MIL-PRF-89023)
73 /// \ingroup ds_DNC
74 /// @{
76 {
77 public:
78  /** config library callback for a user supplied library configuration routine
79  * \param userData user supplied data for callback (supplied with SetConfigLibCB())
80  * \param dncSource DNC data source containing library to configure
81  * \param libNum zero based library number of library to configure else -1 for all libraries in source
82  */
83  typedef void ( *ConfigLibraryCB )( void* const userData, DNCMapChartDataSource& dncSource, const int libNum );
84 
85  /** Draw callback for a user supplied point feature render routine. This routine is called with the model matrix
86  * loaded appropriately as to draw at the correct location using the origin. (i.e. a vertex draw to (0,0) will map
87  * to the correct location as described by pointCoord. This routine does not need to save the model stack as the
88  * caller will push and pop (save) it accordingly.
89  * NOTE: if the point feature in question is configured to use display lists when rendering, then this callback
90  * will be called during the compilation of a display list. This means that any textures (and mipmaps) used when rendering
91  * the point feature must already be uploaded to GL.
92  * \param userData user supplied data for callback (supplied with SetPointFeatureRenderCB())
93  * \param dncSource DNC source containing point feature
94  * \param libNum zero based library number of library containing point
95  * \param covName name (as defined by MIL-PRF-89023) of coverage containing point
96  * ( see DNCUtil COVERAGE_NAME constants )
97  * \param featClassName name (as defined by MIL-PRF-89023) of feature class containing point
98  * ( see DNCUtil FEATURE_NAME constants )
99  * \param featIndex zero based index into feature class for point
100  * \param featTableHeader table header for point feature table containing point
101  * \param featRow row in feature table corresponding to the point feature data for point
102  * \param pointCoord location of point feature
103  * \param color color assigned to point feature
104  * \param region region of the chart that is rendering
105  * \param logicalHeight height in logical units corresponding to height of render region
106  */
107  typedef void ( *RenderPointFeatureCB )( void* const userData, DNCMapChartDataSource& dncSource, const unsigned int libNum, const char* const covName, const char* const featClassName,
108  const unsigned int featIndex, const VPFTableHeader& featTableHeader, const VPFTable::Row& featRow,
109  const VPFUtil::Coord2DShort& pointCoord, const glsColor& color,
110  const DNCUtil::GeoRegion& region, const double logicalHeight );
111 
112  /** Feature Iterator callback for a user supplied feature configuration routine.
113  * \param userData user supplied data for callback (supplied with IterateFeatures())
114  * \param dncSource DNC source containing feature
115  * \param libNum zero based library number of library containing feature
116  * \param covName name (as defined by MIL-PRF-89023) of coverage containing feature
117  * ( see DNCUtil COVERAGE_NAME constants )
118  * \param featClassName name (as defined by MIL-PRF-89023) of feature class containing feature
119  * ( see DNCUtil FEATURE_NAME constants )
120  * \param featType type of feature
121  * \param featIndex zero based index into feature class for feature
122  * \param featTableHeader table header for feature table containing feature
123  * \param featRow row in feature table corresponding to the feature data for the feature
124  * \return true if a configuration change was made to a feature else false
125  */
126  typedef bool ( *FeatureIteratorCB )( void* const userData, DNCMapChartDataSource& dncSource, const unsigned int libNum, const char* const covName, const char* const featClassName,
127  const VPFUtil::FeatureType featType, const unsigned int featIndex, const VPFTableHeader& featTableHeader, const VPFTable::Row& featRow );
128 
129  /** GL polygon stipple pattern */
130  typedef GLubyte GLPolyStipplePattern[ 128u ];
131 
132  /** Ctor */
134 
135  /** Dtor
136  * \sa StopRendering
137  */
139 
140  /** Stop the rendering thread. This method should be called before
141  * any data that may be accessed by the DNC render callbacks is deleted.
142  * This is typically called by the destructor of the component that
143  * owns this data source.
144  * StopRendering should only be called when you are about to delete the
145  * data source and it is no longer needed since the data source is
146  * not usable after the rendering thread has been killed.
147  */
148  void StopRendering();
149 
150  /** Load a DNC database and initialize the data source.
151  * If the database load succeeded, IsValid() will return true.
152  * The method should only be called once per DNCMapChartDataSource instance, subsequent calls will have no effect.
153  * \param dncRootPath path to dnc root database directory
154  */
155  void LoadPath( const char* const dncRootPath );
156 
157  /** Determine if the data source is valid
158  * \pre LoadPath has been called
159  * \return true if valid else false
160  */
161  bool IsValid( void ) const { return ( _isValid ); }
162 
163  // See base class
164  bool GetAvailableCoverage( GeoRect* dest ) DISTI_METHOD_OVERRIDE;
165  // See base class
166  unsigned long GetBestLayer( GlsMapView* view, GlsMapChart* chart ) const DISTI_METHOD_OVERRIDE;
167  // See base class
168  void GetCellList( const GeoRect& coverage, unsigned long layerID, double viewLogicalHeight, double viewGeoHeight, MapChartCellList& viewList ) DISTI_METHOD_OVERRIDE;
169  // See base class
170  void PostDraw( GlsMapView* view, GlsMapChart* chart ) DISTI_METHOD_OVERRIDE;
171 
172  /** Get the number of libraries in the database
173  * \return number of libraries in the database else 0
174  */
175  unsigned int GetLibraryCount( void ) const;
176 
177  /** Get the name of the given library
178  * \param libNum zero based library number
179  * \return name of library else NULL
180  */
181  const char* GetLibraryName( const unsigned int libNum ) const;
182 
183  /** Get the security classification for the given library ( NOTE: library must be loaded to determine security class )
184  * \param libNum zero based library number
185  * \return security class for library else VPFUtil::SECURITY_CLASS_UNCLASSIFIED if library is not loaded or is invalid
186  */
187  VPFUtil::SecurityClass GetLibrarySecurityClass( const unsigned int libNum );
188 
189  /** Load a library in the database
190  * \param libNum zero based library number ( < GetLibraryCount() )
191  * \param async true to load asynchronously (check IsLibraryLoaded() to see when library is finally loaded)
192  * \param preTessellate true to pre-tessellate area features during loading else false to tessellate on demand when rendering
193  * \return true if success else false
194  */
195  bool LoadDNCLibrary( const unsigned int libNum, const bool async, const bool preTessellate );
196 
197  /** Determine if a given library is loading asynchronously. NOTE: call IsLibraryLoaded() to see if loading is complete
198  * \param libNum zero based library number for lib in question
199  * \return true if loading else false
200  */
201  bool IsLibraryLoading( const unsigned int libNum ) const;
202 
203  /** Determine if a given library is loaded
204  * \param libNum zero based library number for lib in question
205  * \return true if loading else false
206  */
207  bool IsLibraryLoaded( const unsigned int libNum );
208 
209  /** Unload a library in the database
210  * \param libNum zero based library number ( < GetLibraryCount() )
211  * \param async true to unload asynchronously ( IsLibraryLoaded() will still return false immediately )
212  * \return true if success else false
213  */
214  bool UnloadDNCLibrary( const unsigned int libNum, const bool async );
215 
216  /** Lock and get the given library. NOTE: Must call UnlockLibrary when done if this routine returns true.
217  * \param libNum zero based library number ( < GetLibraryCount() )
218  * \param lib [out] receives pointer to locked library (NULL if library is not loaded)
219  * \return true if library was locked (even if library is not loaded e.g. lib=NULL)
220  */
221  bool LockLibrary( const unsigned int libNum, DNCLibrary** lib );
222 
223  /** Unlock the given library. Any pointer received from a previous LockLibrary call is now invalid.
224  * \param libNum zero based library number ( < GetLibraryCount() )
225  * \return true if success else false
226  */
227  bool UnlockLibrary( const unsigned int libNum );
228 
229  /** Show/Hide a library. A library will not be available for tiles if it is hidden
230  * \param libNum zero based libray number
231  * \param visible true to show else false to hide
232  * \return true on success else false
233  */
234  bool SetLibraryVisible( const unsigned int libNum, const bool visible );
235 
236  /** Notify that a library has had its configuration changed and those changes should be reflected in
237  * map cells. NOTE: This should be called any time a library config change is made in realtime ( i.e. not made
238  * from a config callback )
239  * \return true if success else false
240  */
241  bool NotfiyLibraryConfigChanged( void );
242 
243  /** Determine if a library is visible (available for tiles)
244  * \param libNum zero based libray number
245  * \return true if visible else false
246  */
247  bool IsLibraryVisible( const unsigned int libNum );
248 
249  /** Get the number of map chart cells that are currently completed (rendered) for the given library
250  * \param libNum zero based libray number
251  * \return number of map chart cells that are currently completed (rendered) for the given library
252  */
253  unsigned int GetCompletedCellCount( const unsigned int libNum );
254 
255  /** Get the geographic extents of a library in the database
256  * \param libNum zero based library number ( < GetLibraryCount() )
257  * \param swCornerLon [out] receives longitude of southwest corner of library on success
258  * \param swCornerLat [out] receives latitude of southwest corner of library on success
259  * \param neCornerLon [out] receives longitude of northeast corner of library on success
260  * \param neCornerLat [out] receives latitude of northeast corner of library on success
261  * \return true if success else false
262  */
263  bool GetLibraryExtents( const unsigned int libNum, float& swCornerLon, float& swCornerLat, float& neCornerLon, float& neCornerLat ) const;
264 
265  /** Test a point against the actual coverage of a given library
266  * \param libNum zero based library number
267  * \param longitude longitude of point
268  * \param latitude latitude of point
269  * \return true if in actual library coverage else false
270  */
271  bool LibraryCoveragePointTest( const unsigned int libNum, const double longitude, const double latitude ) const;
272 
273  /** Get the actual coverage area for a library
274  * \param libNum zero based library number
275  * \param area [out] receives area in degrees (lonxlat) on success
276  * \return true on success else false
277  */
278  bool GetLibraryCoverageArea( const unsigned int libNum, double& area ) const;
279 
280  /** Get the scale of the chart in a given library
281  * \param libNum zero based library number ( < GetLibraryCount() )
282  * \param scale [out] reveives the denominator of the chart scale expressed as a fraction (e.g. 80000 --> chart scale of 1/80000)
283  * \return true if success else false
284  */
285  bool GetLibraryScale( const unsigned int libNum, unsigned int& scale );
286 
287  /** Query a library in the database about its features
288  * \param libNum zero based library number ( < GetLibraryCount() )
289  * \param region geographic region to query
290  * \param onlyVisibleFeatures true to only return currently visible features else false for all features
291  * \return query results else NULL
292  */
293  const DNCUtil::QueryResults* QueryFeatures( const unsigned int libNum, const DNCUtil::GeoRegion& region, const bool onlyVisibleFeatures );
294 
295  /** Show/Hide all coverages and features in a library
296  * \param libNum zero based library number else -1 for all loaded libraries
297  * \param show true to show else false to hide
298  * \return true if success else false
299  */
300  bool ShowAll( const int libNum, const bool show );
301 
302  /** Show/Hide a particular (or all) coverage(s) in a library
303  * \param libNum zero based library number else -1 for all loaded libraries
304  * \param covName name (as defined by MIL-PRF-89023) of coverage to show/hide else NULL for all coverages.
305  * ( see DNCUtil COVERAGE_NAME constants )
306  * \param visible true to show else false to hide
307  * \return true if at least one coverage show/hide status was set else false
308  */
309  bool SetCoverageVisible( const int libNum, const char* const covName, const bool visible );
310 
311  /** Show/Hide feature(s) in a library
312  * \param libNum zero based library number else -1 for all loaded libraries
313  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
314  * ( see DNCUtil COVERAGE_NAME constants )
315  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
316  * ( see DNCUtil FEATURE_NAME constants )
317  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
318  * ( see MIL-PRF-89023 )
319  * \param intAttribColName additional integer attribute column else NULL to ignore
320  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
321  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
322  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
323  * \param desFeatIndex zero based feature index for specific feature else -1 for all
324  * \param visible true to show else false to hide
325  * \return true if at least one feature show/hide status was set else false
326  */
327  bool SetFeatureVisible( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
328  const char* const intAttribColName, const unsigned int intAttribVal,
329  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
330  const bool visible );
331 
332  /** Set feature(s) color in a library
333  * \param libNum zero based library number else -1 for all loaded libraries
334  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
335  * ( see DNCUtil COVERAGE_NAME constants )
336  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
337  * ( see DNCUtil FEATURE_NAME constants )
338  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
339  * ( see MIL-PRF-89023 )
340  * \param intAttribColName additional integer attribute column else NULL to ignore
341  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
342  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
343  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
344  * \param desFeatIndex zero based feature index for specific feature else -1 for all
345  * \param color color
346  * \return true if at least one feature color was changed
347  */
348  bool SetFeatureColor( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
349  const char* const intAttribColName, const unsigned int intAttribVal,
350  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
351  const glsColor& color );
352 
353  /** Set point feature(s) render callback in a library
354  * \param libNum zero based library number else -1 for all loaded libraries
355  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
356  * ( see DNCUtil COVERAGE_NAME constants )
357  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
358  * ( see DNCUtil FEATURE_NAME constants )
359  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
360  * ( see MIL-PRF-89023 )
361  * \param intAttribColName additional integer attribute column else NULL to ignore
362  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
363  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
364  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
365  * \param desFeatIndex zero based feature index for specific feature else -1 for all
366  * \param renderCB render callback else NULL for no callback
367  * \param userData user supplied data to be handed to callback
368  * \param useMapScale true if point feature should scale with the map (will become larger as the view zooms in),
369  * false is point feature should scale to attempt maintain the same size in logical space regardless
370  * of the map zoom
371  * \return true if at least one point feature callback was changed
372  */
373  bool SetPointFeatureRenderCB( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
374  const char* const intAttribColName, const unsigned int intAttribVal,
375  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
376  RenderPointFeatureCB const renderCB, void* const userData,
377  const bool useMapScale );
378 
379  /** Set feature(s) line stippling in a library ( sets area boundary stipple for area features )
380  * \param libNum zero based library number else -1 for all loaded libraries
381  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
382  * ( see DNCUtil COVERAGE_NAME constants )
383  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
384  * ( see DNCUtil FEATURE_NAME constants )
385  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
386  * ( see MIL-PRF-89023 )
387  * \param intAttribColName additional integer attribute column else NULL to ignore
388  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
389  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
390  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
391  * \param desFeatIndex zero based feature index for specific feature else -1 for all
392  * \param stippleFactor (0 if not stippled line) stipple factor (>=1) if line is stippled (see glLineStipple() )
393  * \param stipplePattern stipple pattern if line is stippled (see glLineStipple() )
394  * \return true if at least one feature line stipple was changed
395  */
396  bool SetFeatureLineStipple( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
397  const char* const intAttribColName, const unsigned int intAttribVal,
398  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
399  const GLint stippleFactor, const GLushort stipplePattern );
400 
401  /** Set text feature(s) font in a library
402  * \param libNum zero based library number else -1 for all loaded libraries
403  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
404  * ( see DNCUtil COVERAGE_NAME constants )
405  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
406  * ( see DNCUtil FEATURE_NAME constants )
407  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
408  * ( see MIL-PRF-89023 )
409  * \param intAttribColName additional integer attribute column else NULL to ignore
410  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
411  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
412  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
413  * \param desFeatIndex zero based feature index for specific feature else -1 for all
414  * \param font font for text feature
415  * \return true if at least one text feature font was changed
416  */
417  bool SetTextFeatureFont( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
418  const char* const intAttribColName, const unsigned int intAttribVal,
419  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
420  GlsFontBase* const font );
421 
422  /** Set area feature(s) polygon stipple pattern in a library
423  * \param libNum zero based library number else -1 for all loaded libraries
424  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
425  * ( see DNCUtil COVERAGE_NAME constants )
426  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
427  * ( see DNCUtil FEATURE_NAME constants )
428  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
429  * ( see MIL-PRF-89023 )
430  * \param intAttribColName additional integer attribute column else NULL to ignore
431  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
432  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
433  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
434  * \param desFeatIndex zero based feature index for specific feature else -1 for all
435  * \param polyStipplePattern polygon stipple pattern else NULL to disable polygon stipple
436  * \return true if at least one feature polygon stipple was changed
437  */
438  bool SetAreaFeaturePolygonStipple( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
439  const char* const intAttribColName, const unsigned int intAttribVal,
440  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
441  const GLPolyStipplePattern* const polyStipplePattern );
442 
443  /** Show/Hide area feature(s) boundary in a library
444  * \param libNum zero based library number else -1 for all loaded libraries
445  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
446  * ( see DNCUtil COVERAGE_NAME constants )
447  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
448  * ( see DNCUtil FEATURE_NAME constants )
449  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
450  * ( see MIL-PRF-89023 )
451  * \param intAttribColName additional integer attribute column else NULL to ignore
452  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
453  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
454  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
455  * \param desFeatIndex zero based feature index for specific feature else -1 for all
456  * \param visible true to show boundary else false to hide
457  * \return true if at least one area boundary visibility was changed
458  */
459  bool SetAreaFeatureBoundaryVisible( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
460  const char* const intAttribColName, const unsigned int intAttribVal,
461  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
462  const bool visible );
463 
464  /** Set area feature(s) boundary color in a library
465  * \param libNum zero based library number else -1 for all loaded libraries
466  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
467  * ( see DNCUtil COVERAGE_NAME constants )
468  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
469  * ( see DNCUtil FEATURE_NAME constants )
470  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
471  * ( see MIL-PRF-89023 )
472  * \param intAttribColName additional integer attribute column else NULL to ignore
473  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
474  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
475  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
476  * \param desFeatIndex zero based feature index for specific feature else -1 for all
477  * \param color color
478  * \return true if at least one area feature boundary color was changed
479  */
480  bool SetAreaFeatureBoundaryColor( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
481  const char* const intAttribColName, const unsigned int intAttribVal,
482  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex,
483  const glsColor& color );
484 
485  /** Set the draw order for a feature class in a coverage of a library. All features behid given draw order will be pushed down the
486  * draw order (further back in draw order).
487  * \param libNum zero based library number else -1 for all loaded libraries
488  * \param covName name (as defined by MIL-PRF-89023) of coverage ( see DNCUtil COVERAGE_NAME constants )
489  * \param featClassName name (as defined by MIL-PRF-89023) of feature class ( see DNCUtil FEATURE_NAME constants )
490  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for feature classes that do
491  * use FACC codes ( see MIL-PRF-89023 )
492  * \param drawOrder zero based desired draw order ( draw Order 0 is the last to draw )
493  * \return true if success else false
494  */
495  bool SetFeatureDrawOrder( const int libNum, const char* const covName, const char* const featClassName, const char* const faccCode,
496  const unsigned int drawOrder );
497 
498  /** Iterate over features
499  * \param featureIteratorCB user supplied callback to be called when iterating
500  * \param userData user supplied data to be handed to callback
501  * \param libNum zero based library number else -1 for all loaded libraries
502  * \param covName name (as defined by MIL-PRF-89023) of coverage else NULL for all coverages.
503  * ( see DNCUtil COVERAGE_NAME constants )
504  * \param featClassName name (as defined by MIL-PRF-89023) of feature class else NULL for all features.
505  * ( see DNCUtil FEATURE_NAME constants )
506  * \param faccCode Feature and Attribute Coding Catalog feature code else NULL for all feature codes
507  * ( see MIL-PRF-89023 )
508  * \param intAttribColName additional integer attribute column else NULL to ignore
509  * \param intAttribVal integer attribute value to compare against if intAttribColName != NULL
510  * \param charAttribColName additional character attribute column else NULL to ignore additional attribute
511  * \param charAttribVal character attribute value to compare against if charAttribColName != NULL
512  * \param desFeatIndex zero based feature index for specific feature else -1 for all
513  * \return true if at least one feature configuration was changed
514  */
515  bool IterateFeatures( FeatureIteratorCB const featureIteratorCB, void* const userData, const int libNum, const char* const covName,
516  const char* const featClassName, const char* const faccCode,
517  const char* const intAttribColName, const unsigned int intAttribVal,
518  const char* const charAttribColName, const char* const charAttribVal, const int desFeatIndex );
519 
520  /** Set the callback for automatically configuring libraries when loaded
521  * \param configLibCB callback else NULL to clear callback
522  * \param userData user supplied data to be handed to callback
523  * \param reconfigAll true to reconfig all loaded libraries with new callback (if NULL != configLibCB) else false
524  */
525  void SetConfigLibCB( ConfigLibraryCB const configLibCB, void* const userData, const bool reconfigAll );
526 
527  /** Lower/Restore the priority of the async cell render thread
528  * \param belowNormal true to set thread priority to below normal else false to set priority to normal
529  * \return true if success else false
530  */
531  bool LowerAsyncCellRenderPriority( const bool belowNormal );
532 
533  /** Lower/Restore the priority of the async load threads
534  * \param belowNormal true to set thread priority to below normal else false to set priority to normal
535  * \return true if success else false
536  */
537  bool LowerAsyncLoadPriority( const bool belowNormal );
538 
539  /** Lower/Restore the priority of the async unload thread
540  * \param belowNormal true to set thread priority to below normal else false to set priority to normal
541  * \return true if success else false
542  */
543  bool LowerAsyncUnloadPriority( const bool belowNormal );
544 
545 protected:
546  /** Helper for library loading */
547  struct LibrarySlot
548  {
549  Mutex* libMutex; /**< mutex for lib pointer */
550  DNCLibrary* lib; /**< DNC library if library is loaded else NULL */
551  bool visible; /**< true if library is available for tiles else NULL */
552 
553  /** Ctor */
554  LibrarySlot( void );
555 
556  /** Dtor */
557  ~LibrarySlot();
558  };
559 
560  /** array of library slots */
562 
563  /** array of DNC map cell pointers */
565 
566  /** Refresh the given library in the _libPointers array to check for new library load / unloads and autoconfigure libraries as needed
567  * \param libNum zero based library number of lib in question
568  * \return true if lib pointer changed
569  */
570  bool RefreshLib( const unsigned int libNum );
571 
572  /** Refresh the _libPointers array to check for new library load / unloads and autoconfigure libraries as needed
573  */
574  void RefreshLibList( void );
575 
576  /** Check for and delete unused cells in the _cellPointers array, pickup any tiles from the render thread.
577  */
578  void RefreshCellList( void );
579 
580  /** Invalidate the textures associated with any cells referencing the given library number.
581  * NOTE: It is assumed that the given library is locked with LockLibrary() before calling this routine.
582  * \param libNum zero based library number in question
583  */
584  void InvalidateCells( const unsigned int libNum );
585 
586  /** Populate the given cell list with cells for the given library number and layer that intersect the given view coverage.
587  * This routine will create cells as needed and popuplate the _cellPointers arrayfor tiles that need
588  * to be created.
589  * \param libNum zero based lib number
590  * \param libExtents extents of library
591  * \param view view coverage
592  * \param layer layer number
593  * \param viewLogicalHeight The height of the view in logical space
594  * \param viewGeoHeight The height of the view in geographic space
595  * \param cellList cellList to populate
596  */
597  void PopulateCells( const unsigned int libNum, const GeoRect& libExtents, const GeoRect& view, const unsigned long layer, double viewLogicalHeight, double viewGeoHeight, MapChartCellList& cellList );
598 
599  /** Find a cell in the _cellPointers list that matches the given library number, rect and layer
600  * \param libNum zero based library number
601  * \param tileRect rect for cell
602  * \param tileLogicalHeight The height of the view in logical space
603  * \param layer layer number
604  * \return matching cell in list else NULL
605  */
606  DNCMapChartCell* FindCell( const unsigned int libNum, const double tileLogicalHeight, const GeoRect& tileRect, const unsigned long layer );
607 
608  /** Get next cell to be rendered. NOTE: returned cell will already have had its ref count increased by one
609  * \return next cell to be rendered else NULL if no cell to be rendered
610  */
611  DNCMapChartCell* GetNextCellToRender( void );
612 
613  VPFUtil::WarningBool _isValid; /**< true if source is valid else false */
614  DNCDatabase* _dncDb; /**< DNC database else NULL */
615  LibraryArray _libraries; /**< LibrarySlots 's for each lib in the database */
616  ConfigLibraryCB _configLibCB; /**< user supplied library configuration callback else false */
617  void* _configUserData; /**< user supplied data for library config callback else NULL */
618  Mutex* _cellPointersMutex; /**< lock for _cellPointers */
619  CellPointerArray _cellPointers; /**< array of pointers to map cells */
620  DNCAsyncCellRenderThread* _renderThread; /**< async cell rendering thread else NULL */
621 
622  bool _firstTimeLoaded;
623 
624 #if defined( _WIN32 )
625  WGLExtensions* _glEx; /**< Win32 gl extensions else NULL */
626 #else
627  GLXExtensions* _glEx; /**< GLX extensions else NULL */
628 #endif
629 
630  /** static function for routing to GetNextCellToRender(). NOTE: returned cell will already have had its ref count increased by one
631  * \param pArguments pointer to DNCMapChartDataSource
632  * \return next cell to render else NULL
633  */
634  static DNCMapChartCell* getNextCellToRender( void* const pArguments );
635 };
636 /// @}
637 
638 } // end namespace disti
639 
640 #endif // _GLS_MAP_DNC_H
Mutex * _cellPointersMutex
Definition: gls_map_dnc.h:618
bool IterateFeatures(FeatureIteratorCB const featureIteratorCB, void *const userData, const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex)
const char * GetLibraryName(const unsigned int libNum) const
bool LowerAsyncCellRenderPriority(const bool belowNormal)
bool SetAreaFeatureBoundaryVisible(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, const bool visible)
void LoadPath(const char *const dncRootPath)
bool GetLibraryCoverageArea(const unsigned int libNum, double &area) const
FeatureType
Definition: vpf_util.h:173
bool SetFeatureDrawOrder(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const unsigned int drawOrder)
Definition: gls_map_chart_data_source.h:210
Definition: dnc_util.h:188
Util functions for VPF.
bool SetPointFeatureRenderCB(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, RenderPointFeatureCB const renderCB, void *const userData, const bool useMapScale)
bool IsLibraryLoading(const unsigned int libNum) const
void(* RenderPointFeatureCB)(void *const userData, DNCMapChartDataSource &dncSource, const unsigned int libNum, const char *const covName, const char *const featClassName, const unsigned int featIndex, const VPFTableHeader &featTableHeader, const VPFTable::Row &featRow, const VPFUtil::Coord2DShort &pointCoord, const glsColor &color, const DNCUtil::GeoRegion &region, const double logicalHeight)
Definition: gls_map_dnc.h:107
bool LowerAsyncLoadPriority(const bool belowNormal)
Definition: dnc_util.h:470
GLXExtensions * _glEx
Definition: gls_map_dnc.h:627
DNC related utility data types and constants.
bool IsLibraryVisible(const unsigned int libNum)
Definition: gls_map_util.h:414
bool(* FeatureIteratorCB)(void *const userData, DNCMapChartDataSource &dncSource, const unsigned int libNum, const char *const covName, const char *const featClassName, const VPFUtil::FeatureType featType, const unsigned int featIndex, const VPFTableHeader &featTableHeader, const VPFTable::Row &featRow)
Definition: gls_map_dnc.h:126
bool ShowAll(const int libNum, const bool show)
bool LoadDNCLibrary(const unsigned int libNum, const bool async, const bool preTessellate)
The GlsMapView is a special group that controls the map view parameters. It contains all of the objec...
Definition: gls_map_view.h:86
const DNCUtil::QueryResults * QueryFeatures(const unsigned int libNum, const DNCUtil::GeoRegion &region, const bool onlyVisibleFeatures)
ConfigLibraryCB _configLibCB
Definition: gls_map_dnc.h:616
Definition: gls_map_dnc.h:547
The VPFTableHeader class.
Definition: vpf_table_header.h:51
void PostDraw(GlsMapView *view, GlsMapChart *chart) DISTI_METHOD_OVERRIDE
CellPointerArray _cellPointers
Definition: gls_map_dnc.h:619
bool LibraryCoveragePointTest(const unsigned int libNum, const double longitude, const double latitude) const
bool GetLibraryExtents(const unsigned int libNum, float &swCornerLon, float &swCornerLat, float &neCornerLon, float &neCornerLat) const
DNCLibrary * lib
Definition: gls_map_dnc.h:550
void SetConfigLibCB(ConfigLibraryCB const configLibCB, void *const userData, const bool reconfigAll)
bool SetAreaFeaturePolygonStipple(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, const GLPolyStipplePattern *const polyStipplePattern)
void GetCellList(const GeoRect &coverage, unsigned long layerID, double viewLogicalHeight, double viewGeoHeight, MapChartCellList &viewList) DISTI_METHOD_OVERRIDE
void InvalidateCells(const unsigned int libNum)
bool SetFeatureLineStipple(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, const GLint stippleFactor, const GLushort stipplePattern)
The disti::GlsMapChartDataSource class.
DynamicArray< DNCMapChartCell *, true > CellPointerArray
Definition: gls_map_dnc.h:564
Definition: gls_mutex.h:52
Definition: gls_map_dnc.h:75
bool SetCoverageVisible(const int libNum, const char *const covName, const bool visible)
DynamicArray< LibrarySlot, false > LibraryArray
Definition: gls_map_dnc.h:561
Definition: vpf_util.h:193
bool GetLibraryScale(const unsigned int libNum, unsigned int &scale)
static DNCMapChartCell * getNextCellToRender(void *const pArguments)
VPFUtil::SecurityClass GetLibrarySecurityClass(const unsigned int libNum)
unsigned int GetLibraryCount(void) const
bool SetAreaFeatureBoundaryColor(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, const glsColor &color)
Definition: gls_color.h:53
bool visible
Definition: gls_map_dnc.h:551
SecurityClass
Definition: vpf_util.h:183
bool SetFeatureVisible(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, const bool visible)
bool IsValid(void) const
Definition: gls_map_dnc.h:161
The gls_auto_lib.
Definition: vpf_util.h:272
bool LockLibrary(const unsigned int libNum, DNCLibrary **lib)
The VPFTable class.
DNCMapChartCell * FindCell(const unsigned int libNum, const double tileLogicalHeight, const GeoRect &tileRect, const unsigned long layer)
VPFUtil::WarningBool _isValid
Definition: gls_map_dnc.h:613
DNCDatabase * _dncDb
Definition: gls_map_dnc.h:614
bool RefreshLib(const unsigned int libNum)
Mutex * libMutex
Definition: gls_map_dnc.h:549
bool SetLibraryVisible(const unsigned int libNum, const bool visible)
LibraryArray _libraries
Definition: gls_map_dnc.h:615
void(* ConfigLibraryCB)(void *const userData, DNCMapChartDataSource &dncSource, const int libNum)
Definition: gls_map_dnc.h:83
bool SetTextFeatureFont(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, GlsFontBase *const font)
bool LowerAsyncUnloadPriority(const bool belowNormal)
Macros and helper code to determine what subset of C++11/14/17 is available.
unsigned int GetCompletedCellCount(const unsigned int libNum)
bool SetFeatureColor(const int libNum, const char *const covName, const char *const featClassName, const char *const faccCode, const char *const intAttribColName, const unsigned int intAttribVal, const char *const charAttribColName, const char *const charAttribVal, const int desFeatIndex, const glsColor &color)
Definition: gls_map_chart.h:70
unsigned long GetBestLayer(GlsMapView *view, GlsMapChart *chart) const DISTI_METHOD_OVERRIDE
bool IsLibraryLoaded(const unsigned int libNum)
GLubyte GLPolyStipplePattern[128u]
Definition: gls_map_dnc.h:130
bool UnloadDNCLibrary(const unsigned int libNum, const bool async)
Definition: bmpimage.h:46
void PopulateCells(const unsigned int libNum, const GeoRect &libExtents, const GeoRect &view, const unsigned long layer, double viewLogicalHeight, double viewGeoHeight, MapChartCellList &cellList)
DNCAsyncCellRenderThread * _renderThread
Definition: gls_map_dnc.h:620
void * _configUserData
Definition: gls_map_dnc.h:617
bool UnlockLibrary(const unsigned int libNum)
DNCMapChartCell * GetNextCellToRender(void)
Definition: gls_font_base.h:85
bool GetAvailableCoverage(GeoRect *dest) DISTI_METHOD_OVERRIDE