GL Studio C++ Runtime API
gls_map_symbology_standard_data_source.h
Go to the documentation of this file.
1 /*! \file
2  \brief The disti::GlsMapSymbologyStdDataSource class.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2008 The DiSTI Corporation.<br>
7  11486 Corporate Blvd; Suite 190<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_SYMBOLOGY_STANDARD_DATA_SOURCE_H_
41 #define INCLUDED_GLS_MAP_SYMBOLOGY_STANDARD_DATA_SOURCE_H_
42 
45 
46 //////////////////// Provides support for creating DLLs ////////////////////////
47 #if( defined( GLSGEN_EXPORT_GLSMAPSYMBOLOGY ) || defined( GLSGEN_IMPORT_GLSMAPSYMBOLOGY ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
48  && defined( _MSC_VER )
49 # if defined( GLSGEN_EXPORT_GLSMAPSYMBOLOGY ) || defined( GLS_EXPORT_GENERATED )
50 # define GLSGEN_GLSMAPSYMBOLOGY_EXPORT __declspec( dllexport )
51 # else
52 # define GLSGEN_GLSMAPSYMBOLOGY_EXPORT __declspec( dllimport )
53 # endif
54 #else
55 # define GLSGEN_GLSMAPSYMBOLOGY_EXPORT
56 #endif
57 ///////////////////////////////////////////////////////////////////////////////
58 
59 #define LIB_BASE_NAME "gls_map_toolkit"
60 #include "gls_auto_lib.h"
61 #undef LIB_BASE_NAME
62 
63 namespace disti
64 {
65 /** The GlsMapSymbology class is a Group that contains a collection of DisplayObjects
66  * that can be thought of as 'icon templates'. When drawing, the MapSymbologyLayer will query
67  * it's MapSymbologyDataSource for the list of visible icons and paths, then render them to
68  * the map using the icon templates. The MapSymbologyDataSource interface is simple, while
69  * still allowing the MapSymbologyDataSource the ability to override the appearance
70  * of icons and paths.
71  *
72  * When a new GlsMapSymbology instance is first created, it will create it's
73  * own GlsMapSymbologyStdDataSource which provides an interface for the user to create/update icons and paths
74  * without having to write their own MapSymbologyDataSource class. While this class provides
75  * much of the common functionality that is needed, some users will still want to create their
76  * own MapSymbologyDataSource to provide the best performance when working with their own datasets.
77  * These users have the option of deriving from the BasicDataSource class (a template class which
78  * provides basic functionality) or deriving directly from MapSymbologyDataSource interface
79  * to optimize all of the MapSymbologyDataSource code for their data set.
80  */
81 ////////////////////////////////////////////////////////
82 // GlsMapSymbologyStdDataSource
83 ////////////////////////////////////////////////////////
84 
85 /** Resource storage class used by GlsMapSymbologyStdResourceList */
87 {
88 public:
89  // Get the resource name. May return NULL.
90  const char* GetName() const { return _name; }
91  // Get the resource value. May return NULL.
92  const char* GetValue() const { return _value; }
93 
94  // Set the resource name. Passing NULL will free internal storage.
95  GLSGEN_GLSMAPSYMBOLOGY_EXPORT void SetName( const char* );
96  // Set the resource value. Passing NULL will free internal storage.
97  GLSGEN_GLSMAPSYMBOLOGY_EXPORT void SetValue( const char* );
98 
100  : _name( 0 )
101  , _nameBufSize( 0 )
102  , _value( 0 )
103  , _valueBufSize( 0 )
104  {}
105  GLSGEN_GLSMAPSYMBOLOGY_EXPORT ~GlsMapSymbologyStdNameValuePair();
106 
108  {
109  SetName( o.GetName() );
110  SetValue( o.GetValue() );
111  return *this;
112  }
113 
115  : _name( 0 )
116  , _nameBufSize( 0 )
117  , _value( 0 )
118  , _valueBufSize( 0 )
119  {
120  *this = o;
121  }
122 
123 protected:
124  char* _name;
125  int _nameBufSize;
126  char* _value;
127  int _valueBufSize;
128 };
129 
130 /** Resource storage class */
132 {
133  friend class GlsMapSymbologyStdDataSource;
134 
135 public:
136  /// Set the value of a resource
137  /// The resource is added to the list if it is
138  /// not already included
139  /// \param name The name of the resource to set
140  /// \param value The new value of the resource
141  GLSGEN_GLSMAPSYMBOLOGY_EXPORT void SetResource( const char* name, const char* value );
142 
143  /// Get the given resource value. May return NULL.
144  const char* GetResource( const char* name );
145 
146  GlsMapSymbologyStdNameValuePair* LookupResource( const char* name );
147 
148 protected:
150  ListType _resources;
151 };
152 
153 /** Icon data storage class used by GlsMapSymbologyStdDataSource
154  * Extends GlsMapSymbologyBasicIcon to store resource values that
155  * are applied to the geometry before drawing. */
157 {
158  friend class GlsMapSymbologyStdDataSource;
159 
160 public:
161  /// Set a resource (property) value for the icon
162  inline void SetResource( const char* name, const char* value ) { _resources.SetResource( name, value ); }
163  /// Get a resource (property) value for the icon
164  inline const char* GetResource( const char* name ) { return _resources.GetResource( name ); }
165 
166 protected:
168 };
169 
170 /** Path data storage class used by GlsMapSymbologyStdDataSource
171  * Extends GlsMapSymbologyBasicPath to store resource values that
172  * are applied to the geometry before drawing. */
174 {
175  friend class GlsMapSymbologyStdDataSource;
176 
177 public:
178  /// Set a resource (property) value for the path
179  inline void SetResource( const char* name, const char* value ) { _resources.SetResource( name, value ); }
180  /// Set a resource (property) value for the path
181  inline const char* GetResource( const char* name ) { return _resources.GetResource( name ); }
182 
183 protected:
185 };
186 
187 /** Std data source used by the GlsMapSymbology class by default.
188  * Extends the GlsMapSymbologyBasicDataSource to store resource values that
189  * will be applied to the paths/icons when they are drawn. */
190 class GlsMapSymbologyStdDataSource : public GlsMapSymbologyBasicDataSource<GlsMapSymbologyStdIcon, GlsMapSymbologyStdPath>
191 {
192  GLSGEN_GLSMAPSYMBOLOGY_EXPORT virtual void SetupIconForRendering( GlsMapSymbology* layer, long iconID, DisplayObject* iconGeometry );
193  GLSGEN_GLSMAPSYMBOLOGY_EXPORT virtual void SetupPathForRendering( GlsMapSymbology* layer, long pathID, DisplayObject* pathGeometry );
194 };
195 
196 } // namespace disti
197 
198 #endif
Definition: gls_map_symbology_standard_data_source.h:173
The disti::MapSymbologyDataSource class.
Basic icon data storage that may be used with the GlsMapSymbologyBasicDataSource class.
Definition: gls_map_symbology_basic_data_source.h:61
Definition: display.h:98
Definition: gls_map_symbology_standard_data_source.h:131
void SetResource(const char *name, const char *value)
Set a resource (property) value for the path.
Definition: gls_map_symbology_standard_data_source.h:179
Basic path data storage that may be used with the GlsMapSymbologyBasicDataSource class.
Definition: gls_map_symbology_basic_data_source.h:83
Definition: gls_map_symbology_standard_data_source.h:86
Definition: gls_map_symbology_basic_data_source.h:161
Definition: gls_map_symbology_standard_data_source.h:156
The disti::GlsMapSymbologyBasicDataSource class.
const char * GetResource(const char *name)
Get a resource (property) value for the icon.
Definition: gls_map_symbology_standard_data_source.h:164
const char * GetResource(const char *name)
Set a resource (property) value for the path.
Definition: gls_map_symbology_standard_data_source.h:181
Definition: gls_map_symbology_standard_data_source.h:190
The gls_auto_lib.
const char * GetResource(const char *name)
Get the given resource value. May return NULL.
void SetResource(const char *name, const char *value)
Set a resource (property) value for the icon.
Definition: gls_map_symbology_standard_data_source.h:162
void SetResource(const char *name, const char *value)
Definition: gls_map_symbology.h:86
Definition: bmpimage.h:46