Changeset 4957 for geovis/trunk
- Timestamp:
- Jan 28, 2015, 4:39:03 PM (10 years ago)
- Location:
- geovis/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/RenderServer.h
r4636 r4957 21 21 class Stats; 22 22 23 #define GEOVIS_VERSION_STRING "0.6. 0"23 #define GEOVIS_VERSION_STRING "0.6.1" 24 24 25 25 #define MSECS_ELAPSED(t1, t2) \ -
geovis/trunk/Renderer.cpp
r4956 r4957 34 34 #include <osgEarth/FileUtils> 35 35 #include <osgEarth/Cache> 36 #include <osgEarth/CachePolicy> 36 37 #include <osgEarthDrivers/cache_filesystem/FileSystemCache> 37 38 #include <osgEarth/MapNode> … … 1122 1123 bool Renderer::addImageLayer(const char *name, 1123 1124 osgEarth::TileSourceOptions& opts, 1125 bool enableCache, 1124 1126 bool makeShared, 1125 1127 bool visible) … … 1139 1141 if (makeShared) { 1140 1142 layerOpts.shared() = true; 1143 } 1144 if (!enableCache) { 1145 TRACE("Disabling cache for layer %s", name); 1146 layerOpts.cachePolicy() = osgEarth::CachePolicy(osgEarth::CachePolicy::USAGE_NO_CACHE); 1141 1147 } 1142 1148 if (!visible) { … … 1241 1247 void Renderer::setImageLayerVisibility(const char *name, bool state) 1242 1248 { 1243 #if OSGEARTH_MIN_VERSION_REQUIRED(2, 4, 0)1244 1249 if (!_map.valid()) { 1245 1250 ERROR("No map"); … … 1253 1258 TRACE("Image layer not found: %s", name); 1254 1259 } 1255 #endif1256 1260 } 1257 1261 1258 1262 void Renderer::addElevationLayer(const char *name, 1259 osgEarth::TileSourceOptions& opts) 1263 osgEarth::TileSourceOptions& opts, 1264 bool enableCache, 1265 bool visible) 1260 1266 { 1261 1267 if (!_map.valid()) { … … 1268 1274 } 1269 1275 osgEarth::ElevationLayerOptions layerOpts(name, opts); 1276 if (!enableCache) { 1277 layerOpts.cachePolicy() = osgEarth::CachePolicy(osgEarth::CachePolicy::USAGE_NO_CACHE); 1278 } 1279 if (!visible) { 1280 layerOpts.visible() = false; 1281 } 1270 1282 // XXX: GDAL does not report vertical datum, it should be specified here 1271 1283 // Common options: geodetic (default), egm96, egm84, egm2008 … … 1307 1319 void Renderer::setElevationLayerVisibility(const char *name, bool state) 1308 1320 { 1309 #if OSGEARTH_MIN_VERSION_REQUIRED(2, 4, 0)1310 1321 if (!_map.valid()) { 1311 1322 ERROR("No map"); … … 1319 1330 TRACE("Elevation layer not found: %s", name); 1320 1331 } 1321 #endif1322 1332 } 1323 1333 … … 1711 1721 void Renderer::setModelLayerVisibility(const char *name, bool state) 1712 1722 { 1713 #if OSGEARTH_MIN_VERSION_REQUIRED(2, 4, 0)1714 1723 if (!_map.valid()) { 1715 1724 ERROR("No map"); … … 1723 1732 TRACE("Model layer not found: %s", name); 1724 1733 } 1725 #endif1726 1734 } 1727 1735 -
geovis/trunk/Renderer.h
r4956 r4957 216 216 217 217 bool addImageLayer(const char *name, osgEarth::TileSourceOptions& opts, 218 bool makeShared = false, bool visible = true); 218 bool enableCache = true, bool makeShared = false, 219 bool visible = true); 219 220 220 221 void removeImageLayer(const char *name); … … 250 251 } 251 252 252 void addElevationLayer(const char *name, osgEarth::TileSourceOptions& opts); 253 void addElevationLayer(const char *name, osgEarth::TileSourceOptions& opts, 254 bool enableCache = true, bool visible = true); 253 255 254 256 void removeElevationLayer(const char *name); -
geovis/trunk/RendererCmd.cpp
r4655 r4957 956 956 } 957 957 } 958 bool cache = true; 959 if (objc > 7) { 960 if (GetBooleanFromObj(interp, objv[6], &cache) != TCL_OK) { 961 return TCL_ERROR; 962 } 963 } 958 964 if (driver[0] == 'd' && strcmp(driver, "debug") == 0) { 959 965 osgEarth::Drivers::DebugOptions opts; 960 966 name = Tcl_GetString(objv[5]); 961 ret = g_renderer->addImageLayer(name, opts );967 ret = g_renderer->addImageLayer(name, opts, cache); 962 968 } else if (driver[0] == 'g' && strcmp(driver, "gdal") == 0) { 963 969 osgEarth::Drivers::GDALOptions opts; 964 970 opts.url() = url; 965 name = Tcl_GetString(objv[ 6]);966 ret = g_renderer->addImageLayer(name, opts );971 name = Tcl_GetString(objv[7]); 972 ret = g_renderer->addImageLayer(name, opts, cache); 967 973 } else if (driver[0] == 't' && strcmp(driver, "tms") == 0) { 968 974 osgEarth::Drivers::TMSOptions opts; … … 972 978 //opts.tmsType() = tmsType; 973 979 //opts.format() = format; 974 name = Tcl_GetString(objv[ 6]);975 ret = g_renderer->addImageLayer(name, opts );980 name = Tcl_GetString(objv[7]); 981 ret = g_renderer->addImageLayer(name, opts, cache); 976 982 } else if (driver[0] == 'w' && strcmp(driver, "wms") == 0) { 977 983 osgEarth::Drivers::WMSOptions opts; 978 char *wmsLayers = Tcl_GetString(objv[ 6]);979 char *format = Tcl_GetString(objv[ 7]);984 char *wmsLayers = Tcl_GetString(objv[7]); 985 char *format = Tcl_GetString(objv[8]); 980 986 bool transparent; 981 if (GetBooleanFromObj(interp, objv[ 8], &transparent) != TCL_OK) {987 if (GetBooleanFromObj(interp, objv[9], &transparent) != TCL_OK) { 982 988 return TCL_ERROR; 983 989 } … … 987 993 opts.transparent() = transparent; 988 994 989 name = Tcl_GetString(objv[ 9]);990 ret = g_renderer->addImageLayer(name, opts );995 name = Tcl_GetString(objv[10]); 996 ret = g_renderer->addImageLayer(name, opts, cache); 991 997 } else if (driver[0] == 'x' && strcmp(driver, "xyz") == 0) { 992 998 osgEarth::Drivers::XYZOptions opts; … … 996 1002 //opts.invertY() = invertY; 997 1003 //opts.format() = Tcl_GetString(objv[6]); 998 name = Tcl_GetString(objv[ 6]);999 ret = g_renderer->addImageLayer(name, opts );1004 name = Tcl_GetString(objv[7]); 1005 ret = g_renderer->addImageLayer(name, opts, cache); 1000 1006 } else { 1001 1007 Tcl_AppendResult(interp, "unknown image driver \"", driver, -
geovis/trunk/geovis_protocol.txt
r4636 r4957 133 133 134 134 Specific image layer types: 135 map layer add image gdal <url> < layerName>135 map layer add image gdal <url> <cache> <layerName> 136 136 Add a GDAL image layer from a file or URL 137 map layer add image wms <url> < layers> <format> <transparent> <layerName>137 map layer add image wms <url> <cache> <layers> <format> <transparent> <layerName> 138 138 Add a WMS image layer from a URL + layer string 139 139 <url> = URL of WMS service 140 <cache> = bool indicating if tiles should be cached on disk 140 141 <layers> = layers string for WMS server 141 142 <format> = Image format to return (e.g. 'png') 142 143 <transparent> = bool 143 map layer add image tms <url> < layerName>144 map layer add image tms <url> <cache> <layerName> 144 145 Add a TMS image layer from a URL 145 146 <url> = URL of TMS service 146 map layer add image xyz <urlPattern> <layerName> 147 <cache> = bool indicating if tiles should be cached on disk 148 map layer add image xyz <urlPattern> <cache> <layerName> 147 149 Add an image layer from a web map using a template URL 150 <cache> = bool indicating if tiles should be cached on disk 148 151 149 152 Elevation layers:
Note: See TracChangeset
for help on using the changeset viewer.