GlsMap Toolkit
1.7.0
|
#include <gls_map_shapefile.h>
Classes | |
class | RenderingAttorney |
struct | ShapePoint |
Public Types | |
typedef Shapefile::LibraryID | LibraryID |
typedef Shapefile::LayerID | LayerID |
typedef void(* | RenderPointFeatureCB) (void *const userData, const char *featureSet, const char *featureType, double longitude, double latitude, const glsColor &color, const GeoRect ®ion, const double logicalHeight) |
typedef void(* | RenderLineFeatureCB) (void *const userData, const char *featureSet, const char *featureType, const DynamicArray< ShapePoint > &points, const GeoRect ®ion, const double logicalHeight) |
Public Member Functions | |
ShapefileMapChartDataSource () | |
~ShapefileMapChartDataSource () | |
bool | LoadLibraryAs (const char *shapefileRootPath, LibraryID libraryID) |
bool | UnloadLibrary (LibraryID libraryID) |
DynamicArray< LibraryID > | GetLoadedLibraries () const |
bool | EnableLibraryRendering (LibraryID libraryID, bool enable=true) |
bool | IsLibraryRenderingEnabled (LibraryID libraryID, bool &isEnabled) const |
DynamicArray< const char * > | GetOrderedFeatureSetNames (LibraryID libraryID) const |
bool | SetOrderedFeatureSetNames (LibraryID libraryID, const DynamicArray< const char * > &orderedFeatureSetNames) |
DynamicArray< const char * > | GetFeatureTypes (LibraryID libraryID, const char *featureSet) const |
bool | GetFeatureSetVisibility (LibraryID libraryID, const char *featureSet, const char *featureType, bool &isVisible) const |
bool | SetFeatureSetVisibility (LibraryID libraryID, const char *featureSet, const char *featureType, bool isVisible) |
bool | GetFeatureSetPointStyle (LibraryID libraryID, const char *featureSet, const char *featureType, glsColor &color, RenderPointFeatureCB &renderCB, void *&userData, bool &useMapScale) const |
bool | SetFeatureSetPointStyle (LibraryID libraryID, const char *featureSet, const char *featureType, const glsColor &color, const RenderPointFeatureCB renderCB=NULL, void *const userData=NULL, const bool useMapScale=NULL) |
bool | GetFeatureSetLineStyle (LibraryID libraryID, const char *featureSet, const char *featureType, glsColor &color, float &width, uint16_t &stipplePattern, int &stippleMultiplier) const |
bool | GetFeatureSetLineStyle (const LibraryID libraryID, const char *const featureSet, const char *const featureType, RenderLineFeatureCB &renderCB, void *&userData) const |
bool | SetFeatureSetLineStyle (LibraryID libraryID, const char *featureSet, const char *featureType, glsColor color, float width=DEF_LINE_WIDTH, uint16_t stipplePattern=DEF_LINE_STIPPLE_PATTERN, int stippleMultiplier=0) |
bool | SetFeatureSetLineStyle (LibraryID libraryID, const char *featureSet, const char *featureType, const RenderLineFeatureCB renderCB, void *const userData=NULL) |
bool | GetFeatureSetFillStyle (LibraryID libraryID, const char *featureSet, const char *featureType, glsColor &color, bool &drawBoundary, glsColor &boundaryColor, float &boundaryWidth, uint16_t &boundaryStipplePattern, int &boundaryStippleMultiplier) const |
bool | SetFeatureSetFillStyle (LibraryID libraryID, const char *featureSet, const char *featureType, const glsColor &color, bool drawBoundary=false, const glsColor &boundaryColor=glsColor(0, 0, 0, 255), float boundaryWidth=DEF_LINE_WIDTH, uint16_t boundaryStipplePattern=DEF_LINE_STIPPLE_PATTERN, int boundaryStippleMultiplier=0) |
bool | GetFeatureSetTextStyle (LibraryID libraryID, const char *featureSet, const char *featureType, GlsFontBase *&glsFont, glsColor &textColor, double &scale, double &xOffset, double &yOffset, bool &isVisible) const |
bool | SetFeatureSetTextStyle (LibraryID libraryID, const char *featureSet, const char *featureType, GlsFontBase *glsFont, const glsColor &textColor=glsColor(0, 0, 0, 255), double scale=1.0, double xOffset=0.0f, double yOffset=0.0f, bool isVisible=true) |
bool | SetCacheDimensions (LibraryID libraryID, double degreesLongitude, double degreesLatitude) |
bool | LowerAsyncCellRenderPriority (bool belowNormal) |
bool | GetAvailableCoverage (GeoRect *dest) DISTI_METHOD_OVERRIDE |
LayerID | GetBestLayer (GlsMapView *view, GlsMapChart *chart) const DISTI_METHOD_OVERRIDE |
void | GetCellList (const GeoRect &coverage, LayerID layerID, double viewLogicalHeight, double viewGeoHeight, MapChartCellList &viewList) DISTI_METHOD_OVERRIDE |
Public Member Functions inherited from disti::GlsMapChartDataSource | |
virtual | ~GlsMapChartDataSource () |
virtual void | PostDraw (GlsMapView *view, GlsMapChart *chart) |
virtual bool | AreAllCellsLoaded (GlsMapView *view, GlsMapChart *chart) |
Additional Inherited Members | |
Protected Member Functions inherited from disti::GlsMapChartDataSource | |
GlsMapChartDataSource () | |
A feature set often (but not always) comes from a single .shp file with a single Shapefile layer and contains different subtypes of features (e.g., natural.shp may have feature types "forest", "river", etc.).
For instance, the "natural" feature set could have black as the line color for all its features but override it to blue for rivers and green for forests.
typedef void( * disti::ShapefileMapChartDataSource::RenderLineFeatureCB) (void *const userData, const char *featureSet, const char *featureType, const DynamicArray< ShapePoint > &points, const GeoRect ®ion, const double logicalHeight) |
Draw callback for a user supplied line feature render routine. This routine is called with the model matrix loaded appropriately as to draw at the correct location.
userData | user supplied data for callback (supplied with SetPointFeatureRenderCB()) |
featureSet | The name of the feature set (often corresponds to a single .shp file). |
featureType | The name of a type of feature within the feature set (e.g., in a "natural" feature set, there might be "water" and "forest" among others). |
points | the vertices of the path. |
region | region of the chart that is rendering |
logicalHeight | height in logical units corresponding to height of render region |
typedef void( * disti::ShapefileMapChartDataSource::RenderPointFeatureCB) (void *const userData, const char *featureSet, const char *featureType, double longitude, double latitude, const glsColor &color, const GeoRect ®ion, const double logicalHeight) |
Draw callback for a user supplied point feature render routine. This routine is called with the model matrix loaded appropriately as to draw at the correct location using the origin (i.e., a vertex draw to (0,0) will map to the correct location as described by pointCoord. This routine does not need to save the model stack as the caller will push and pop (save) it accordingly.
userData | user supplied data for callback (supplied with SetPointFeatureRenderCB()) |
featureSet | The name of the feature set (often corresponds to a single .shp file). |
featureType | The name of a type of feature within the feature set (e.g., in a "natural" feature set, there might be "water" and "forest" among others). |
longitude | longitude of point feature |
latitude | longitude of point feature |
color | color assigned to point feature |
region | region of the chart that is rendering |
logicalHeight | height in logical units corresponding to height of render region |
bool disti::ShapefileMapChartDataSource::EnableLibraryRendering | ( | LibraryID | libraryID, |
bool | enable = true |
||
) |
Enable a given library to render. By default, only one library is set to render at a time. This function allows the user to render multiple libraries at a time, which may be useful if the libraries have orthogonal features in them, e.g., one library for roads, one for buildings, etc. (More commonly, a library has multiple feature sets within it, and each library covers the same geographic area but represents a different scale or level of detail.) Libraries are rendered in the order of their LibraryIDs, starting with the smallest value on the "bottom" of the texture and the next smallest writing on top of it (possibly overwriting).
libraryID | The library to update. If not found, this function emits a warning to the console and returns false without changing rendering. |
enable | Whether the library should be enabled (defaults to true). |
|
virtual |
See base class
Reimplemented from disti::GlsMapChartDataSource.
bool disti::ShapefileMapChartDataSource::GetFeatureSetFillStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
glsColor & | color, | ||
bool & | drawBoundary, | ||
glsColor & | boundaryColor, | ||
float & | boundaryWidth, | ||
uint16_t & | boundaryStipplePattern, | ||
int & | boundaryStippleMultiplier | ||
) | const |
Retrieves the current fill style of the features in feature set.
libraryID | The library to query. | |
featureSet | The name of the feature set (often corresponds to a single .shp file). If null or not found, it emits a warning to the console and returns false. | |
featureType | The name of a type of feature within the feature set (e.g., in the "natural" feature set, there might be "water" and "forest" among others). If null or empty, it returns the default visibility for the feature set. If not found, it emits a warning to the console and returns false. | |
[out] | color | The fill color for the requested features. |
[out] | drawBoundary | Whether or not to draw the area boundary |
[out] | boundaryColor | The boundary color for the requested features. |
[out] | boundaryWidth | The line width |
[out] | boundaryStipplePattern | The stipple pattern for lines (see documentation of glLineStipple()) |
[out] | boundaryStippleMultiplier | The multiplier for stippling (see documentation of glLineStipple()) |
bool disti::ShapefileMapChartDataSource::GetFeatureSetLineStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
glsColor & | color, | ||
float & | width, | ||
uint16_t & | stipplePattern, | ||
int & | stippleMultiplier | ||
) | const |
Retrieves the current line style of the features in feature set.
libraryID | The library to query. | |
featureSet | The name of the feature set (often corresponds to a single .shp file). If null or not found, it emits a warning to the console and returns false. | |
featureType | The name of a type of feature within the feature set (e.g., in the "natural" feature set, there might be "water" and "forest" among others). If null or empty, it returns the default line style for the feature set. If not found, it emits a warning to the console and returns false. | |
[out] | color | The line color for the requested features. |
[out] | width | The line width for the requested features. |
[out] | stipplePattern | The line stipple pattern for the requested features. |
[out] | stippleMultiplier | The line stipple multiplier for the requested features. |
bool disti::ShapefileMapChartDataSource::GetFeatureSetLineStyle | ( | const LibraryID | libraryID, |
const char *const | featureSet, | ||
const char *const | featureType, | ||
RenderLineFeatureCB & | renderCB, | ||
void *& | userData | ||
) | const |
Retrieves the current line callback for the feature set.
libraryID | The library to query. | |
featureSet | The name of the feature set (often corresponds to a single .shp file). If null or not found, it emits a warning to the console and returns false. | |
featureType | The name of a type of feature within the feature set (e.g., in the "natural" feature set, there might be "water" and "forest" among others). If null or empty, it returns the default line style for the feature set. If not found, it emits a warning to the console and returns false. | |
[out] | renderCB | The line callback |
[out] | userData | The user data passed to the callback |
bool disti::ShapefileMapChartDataSource::GetFeatureSetPointStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
glsColor & | color, | ||
RenderPointFeatureCB & | renderCB, | ||
void *& | userData, | ||
bool & | useMapScale | ||
) | const |
Retrieves the current point style of the features in feature set.
libraryID | The library to query. | |
featureSet | The name of the feature set (often corresponds to a single .shp file). If null or not found, it emits a warning to the console and returns false. | |
featureType | The name of a type of feature within the feature set (e.g., in the "natural" feature set, there might be "water" and "forest" among others). If null or empty, it returns the default point style for the feature set. If not found, it emits a warning to the console and returns false. | |
[out] | color | The point color for the requested features. |
[out] | renderCB | render callback else NULL for no callback |
[out] | userData | user supplied data to be handed to callback |
[out] | useMapScale | true if point feature should scale with the map (will become larger as the view zooms in), false is point feature should scale to attempt maintain the same size in logical space regardless of the map zoom |
bool disti::ShapefileMapChartDataSource::GetFeatureSetTextStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
GlsFontBase *& | glsFont, | ||
glsColor & | textColor, | ||
double & | scale, | ||
double & | xOffset, | ||
double & | yOffset, | ||
bool & | isVisible | ||
) | const |
Retrieves the current text style of the features in feature set.
libraryID | The library to query. | |
featureSet | The name of the feature set (often corresponds to a single .shp file). If null or not found, it emits a warning to the console and returns false. | |
featureType | The name of a type of feature within the feature set (e.g., in the "natural" feature set, there might be "water" and "forest" among others). If null or empty, it returns the default visibility for the feature set. If not found, it emits a warning to the console and returns false. | |
[out] | glsFont | The instance of a font in this GL Studio project |
[out] | textColor | The text color for the requested features. |
[out] | isVisible | Whether the text is visible for the requested features. |
[out] | scale | The scale of the text (default = 1.0) |
[out] | xOffset | horizontal offset from the default text location (text starts at the center of its objects extents) |
[out] | yOffset | vertical offset from the default text location (text starts at the center of its objects extents) |
bool disti::ShapefileMapChartDataSource::GetFeatureSetVisibility | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
bool & | isVisible | ||
) | const |
Retrieves the current visibility of the features in the given feature set, optionally limited to a single feature type.
libraryID | The library to query. | |
featureSet | The name of the feature set (often corresponds to a single .shp file). If null, empty, or not found, it emits a warning to the console and returns false. | |
featureType | The name of a type of feature within the feature set (e.g., in a "natural" feature set, there might be "water" and "forest" among others). If null or empty, it returns the default visibility for the feature set. If not found, it emits a warning to the console and returns false. | |
[out] | isVisible | Whether the requested features are visible. |
DynamicArray<const char*> disti::ShapefileMapChartDataSource::GetFeatureTypes | ( | LibraryID | libraryID, |
const char * | featureSet | ||
) | const |
Returns a list of feature types in the given featureSetName within the given library.
libraryID | The library to query. |
featureSet | The name of the feature set. If null or not found, this function emits an error to the console and returns an empty array. |
DynamicArray< ShapefileMapChartDataSource::LibraryID > disti::ShapefileMapChartDataSource::GetLoadedLibraries | ( | ) | const |
Returns a list of all currently loaded library IDs.
DynamicArray< const char * > disti::ShapefileMapChartDataSource::GetOrderedFeatureSetNames | ( | LibraryID | libraryID | ) | const |
Returns a list of feature set names in the order they are to be drawn, from bottom to top.
libraryID | The library to query. If not found, the function emits a warning to the console and returns an empty array. |
bool disti::ShapefileMapChartDataSource::IsLibraryRenderingEnabled | ( | LibraryID | libraryID, |
bool & | isEnabled | ||
) | const |
Query whether a given library is set to render.
libraryID | The library to update. If not found, this function emits a warning to the console and returns false without changing the output parameter. | |
[out] | isEnabled | Whether the library is enabled |
bool disti::ShapefileMapChartDataSource::LoadLibraryAs | ( | const char * | shapefileRootPath, |
LibraryID | libraryID | ||
) |
Load a Shapefile (or files) from the given path and associate it with a given library identifier.
shapefileRootPath | path to Shapefile or directory containing Shapefile(s). Multiple files in one folder will be considered one library. If null, empty, or not found, the function emits an error and returns false. |
libraryID | The library ID (see note), often the scale of this library. It acts as a handle to this library for other operations on it using this data source. |
If the path loads successfully but the ID has already been used, it will unload the old data and replace it with the data from this path after emitting a warning to the console (unload first to avoid the warning).
The library ID also controls what order multiple enabled libraries are rendered in, starting with the lowest libraryID and going to the largest.
bool disti::ShapefileMapChartDataSource::SetCacheDimensions | ( | LibraryID | libraryID, |
double | degreesLongitude, | ||
double | degreesLatitude | ||
) |
Sets the geographical size of the region to cache. Each library has its own cache region.
libraryID | The library whose cache size to adjust. |
degreesLongitude | the width of cache size in degrees of longitude |
degreesLatitude | the height of cache size in degrees of latitude |
bool disti::ShapefileMapChartDataSource::SetFeatureSetFillStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
const glsColor & | color, | ||
bool | drawBoundary = false , |
||
const glsColor & | boundaryColor = glsColor( 0, 0, 0, 255 ) , |
||
float | boundaryWidth = DEF_LINE_WIDTH , |
||
uint16_t | boundaryStipplePattern = DEF_LINE_STIPPLE_PATTERN , |
||
int | boundaryStippleMultiplier = 0 |
||
) |
Sets the fill style for polygon features in the feature set.
libraryID | The library to query. |
featureSet | The name of the feature set. If null, sets the style for all features sets. If non-null and not found, this function emits a warning to the console and returns false |
featureType | The name of the feature. If null or empty, it applies to the default attributes for the feature set. If not found, it creates a new feature attribute override entry. |
color | The RGBA color value for filling polygons. |
boundaryColor | The boundary color for the requested features. |
drawBoundary | Whether or not to draw the area boundary |
boundaryWidth | The line width |
boundaryStipplePattern | The stipple pattern for lines (see documentation of glLineStipple()) |
boundaryStippleMultiplier | The multiplier for stippling (see documentation of glLineStipple()) |
bool disti::ShapefileMapChartDataSource::SetFeatureSetLineStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
glsColor | color, | ||
float | width = DEF_LINE_WIDTH , |
||
uint16_t | stipplePattern = DEF_LINE_STIPPLE_PATTERN , |
||
int | stippleMultiplier = 0 |
||
) |
Sets the line style (outline for polygon features) for features in a set.
libraryID | The library to query. |
featureSet | The name of the feature set. If null, sets the style for all features sets. If non-null and not found, this function emits a warning to the console and returns false |
featureType | The name of the feature. If null or empty, it applies to the default attributes for the feature set. If not found, it creates a new feature attribute override entry. |
color | The RGBA color value for lines |
width | The line width |
stipplePattern | The stipple pattern for lines (see documentation of glLineStipple()) |
stippleMultiplier | The multiplier for stippling (see documentation of glLineStipple()) |
bool disti::ShapefileMapChartDataSource::SetFeatureSetLineStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
const RenderLineFeatureCB | renderCB, | ||
void *const | userData = NULL |
||
) |
Sets the line callback for features in a set.
libraryID | The library to query. |
featureSet | The name of the feature set. If null, sets the style for all features sets. If non-null and not found, this function emits a warning to the console and returns false |
featureType | The name of the feature. If null or empty, it applies to the default attributes for the feature set. If not found, it creates a new feature attribute override entry. |
renderCB | the line callback |
userData | The optional user data passed to the callback, can be NULL if unused. |
bool disti::ShapefileMapChartDataSource::SetFeatureSetPointStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
const glsColor & | color, | ||
const RenderPointFeatureCB | renderCB = NULL , |
||
void *const | userData = NULL , |
||
const bool | useMapScale = NULL |
||
) |
Sets the point style (outline for polygon features) for features in a set.
libraryID | The library to query. |
featureSet | The name of the feature set. If null, sets the style for all features sets. If non-null and not found, this function emits a warning to the console and returns false |
featureType | The name of the feature. If null or empty, it applies to the default attributes for the feature set. If not found, it creates a new feature attribute override entry. |
color | The RGBA color value for points |
renderCB | render callback else NULL for no callback |
userData | user supplied data to be handed to callback |
useMapScale | true if point feature should scale with the map (will become larger as the view zooms in), false is point feature should scale to attempt maintain the same size in logical space regardless of the map zoom |
bool disti::ShapefileMapChartDataSource::SetFeatureSetTextStyle | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
GlsFontBase * | glsFont, | ||
const glsColor & | textColor = glsColor( 0, 0, 0, 255 ) , |
||
double | scale = 1.0 , |
||
double | xOffset = 0.0f , |
||
double | yOffset = 0.0f , |
||
bool | isVisible = true |
||
) |
Sets the text style for a feature set.
libraryID | The library to query. |
featureSet | The name of the feature set. If null, sets the style for all features sets. If non-null and not found, this function emits a warning to the console and returns false |
featureType | The name of the feature. If null or empty, it applies to the default attributes for the feature set. If not found, it creates a new feature attribute override entry. |
glsFont | The instance of a font in this GL Studio project |
textColor | Color of the text. (Defaults to black.) |
isVisible | Whether the text is visible for the requested features. |
scale | The scale of the text (default = 1.0) |
xOffset | horizontal offset from the default text location (text starts at the center of its objects extents) |
yOffset | vertical offset from the default text location (text starts at the center of its objects extents) |
bool disti::ShapefileMapChartDataSource::SetFeatureSetVisibility | ( | LibraryID | libraryID, |
const char * | featureSet, | ||
const char * | featureType, | ||
bool | isVisible | ||
) |
Sets the visibility for features in a feature set.
libraryID | The library to update. |
featureSet | The name of the feature set. If null, sets the visibility for all features sets. If non-null and not found, this function emits a warning to the console and returns false without changing visibility. |
featureType | The type of feature within the feature set. If null or empty, it applies to the default feature set. If not found, it creates a new feature attribute override entry. |
isVisible | The visibility to be applied. |
bool disti::ShapefileMapChartDataSource::SetOrderedFeatureSetNames | ( | LibraryID | libraryID, |
const DynamicArray< const char * > & | orderedFeatureSetNames | ||
) |
Sets the feature set names in the order they are to be drawn.
libraryID | The library to update. |
orderedFeatureSetNames | The list of names in order from bottom to top. If any feature set name is null, empty, or does not exist or if a name is missing from the list, a warning is emitted to the console, and the function returns false without changing draw order. |
bool disti::ShapefileMapChartDataSource::UnloadLibrary | ( | LibraryID | libraryID | ) |
Unloads a given library.