- Timestamp:
- Aug 31, 2016 5:40:20 PM (8 years ago)
- Location:
- geovis/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/Renderer.cpp
r6511 r6518 2253 2253 bool enableCache, 2254 2254 bool lighting, 2255 bool visible) 2255 bool visible, 2256 bool terrainPatch) 2256 2257 { 2257 2258 if (!_map.valid()) { … … 2269 2270 } 2270 2271 layerOpts.lightingEnabled() = lighting; 2272 if (terrainPatch) { 2273 layerOpts.terrainPatch() = true; 2274 } 2271 2275 osgEarth::ModelLayer *layer = new osgEarth::ModelLayer(layerOpts); 2272 2276 if (pos < (unsigned int)_map->getNumModelLayers()) { -
geovis/trunk/Renderer.h
r6517 r6518 404 404 bool enableCache = true, 405 405 bool lighting = true, 406 bool visible = true); 406 bool visible = true, 407 bool terrainPatch = false); 407 408 408 409 void removeModelLayer(const char *name); -
geovis/trunk/RendererCmd.cpp
r6516 r6518 1773 1773 } 1774 1774 1775 bool lighting = true;1776 1775 osgEarth::Drivers::FeatureGeomModelOptions geomOpts; 1777 1776 char *styleSheetStr = (char *)malloc((size_t)(ssSize+1L)); … … 1929 1928 Tcl_DecrRefCount(selectorsObj); 1930 1929 } 1930 bool terrainPatch = false; 1931 if (objc > 13) { 1932 if (GetBooleanFromObj(interp, objv[13], &terrainPatch) != TCL_OK) { 1933 return TCL_ERROR; 1934 } 1935 } 1936 bool lighting = true; 1931 1937 geomOpts.enableLighting() = lighting; 1932 1938 geomOpts.minRange() = 0.f; 1933 1939 geomOpts.maxRange() = FLT_MAX; 1934 if (objc > 1 3) {1940 if (objc > 14) { 1935 1941 float min, max; 1936 if (GetFloatFromObj(interp, objv[1 3], &min) != TCL_OK ||1937 GetFloatFromObj(interp, objv[1 4], &max) != TCL_OK) {1942 if (GetFloatFromObj(interp, objv[14], &min) != TCL_OK || 1943 GetFloatFromObj(interp, objv[15], &max) != TCL_OK) { 1938 1944 return TCL_ERROR; 1939 1945 } … … 1973 1979 return TCL_ERROR; 1974 1980 } 1975 g_renderer->addModelLayer(name, geomOpts, pos, cache, lighting, visible); 1981 g_renderer->addModelLayer(name, geomOpts, pos, cache, lighting, visible, 1982 terrainPatch); 1976 1983 } else if (type[0] == 'm' && strcmp(type, "mask") == 0) { 1977 1984 char *driver = Tcl_GetString(objv[5]); … … 1987 1994 std::string url; 1988 1995 if (objc > 8) { 1989 char *urlIn = Tcl_GetString(objv[8]); 1990 url = g_renderer->getCanonicalPath(std::string(urlIn)); 1991 if (url.empty()) { 1992 Tcl_AppendResult(interp, "file not found: \"", 1993 urlIn, "\"", (char*)NULL); 1994 return TCL_ERROR; 1996 if (driver[0] == 'w' && strcmp(driver, "wkt") == 0) { 1997 url = Tcl_GetString(objv[8]); 1998 if (url.empty()) { 1999 Tcl_AppendResult(interp, "Empty WKT length", 2000 (char*)NULL); 2001 return TCL_ERROR; 2002 } 2003 } else { 2004 char *urlIn = Tcl_GetString(objv[8]); 2005 url = g_renderer->getCanonicalPath(std::string(urlIn)); 2006 if (url.empty()) { 2007 Tcl_AppendResult(interp, "file not found: \"", 2008 urlIn, "\"", (char*)NULL); 2009 return TCL_ERROR; 2010 } 1995 2011 } 1996 2012 } … … 2019 2035 opts.typeName() = typeName; 2020 2036 maskOpts.featureOptions() = opts; 2037 } else if (driver[0] == 'w' && strcmp(driver, "wkt") == 0) { 2038 // Inline geometry, url is length of following data 2039 char *ptr; 2040 long len = strtol(url.c_str(), &ptr, 10); 2041 if (len <= 0 || *ptr != '\0') { 2042 Tcl_AppendResult(interp, "Failed to parse WKT length: \"", 2043 url.c_str(), "\"", (char*)NULL); 2044 return TCL_ERROR; 2045 } 2046 char *wkt = (char *)malloc((size_t)len); 2047 if (!SocketRead(wkt, len)) { 2048 free(wkt); 2049 Tcl_AppendResult(interp, "Failed to read WKT string", 2050 (char*)NULL); 2051 return TCL_ERROR; 2052 } 2053 osgEarth::Drivers::OGRFeatureOptions opts; 2054 opts.name() = name; 2055 TRACE("Geometry: \"%s\"", wkt); 2056 osgEarth::Config conf("geometry", std::string(wkt)); 2057 free(wkt); 2058 opts.geometryConfig() = conf; 2059 maskOpts.featureOptions() = opts; 2060 } else if (driver[0] == 'w' && strcmp(driver, "wkt_file") == 0) { 2061 osgEarth::Drivers::OGRFeatureOptions opts; 2062 opts.name() = name; 2063 opts.geometryUrl() = url; 2064 maskOpts.featureOptions() = opts; 2021 2065 } else { 2022 2066 Tcl_AppendResult(interp, "unknown mask driver \"", driver, … … 2062 2106 } 2063 2107 modelOpts.location() = osg::Vec3d(x, y, z); 2064 //double rotx = 0.0, roty = 0.0, rotz = 0.0; 2065 //modelOpts.orientation() = osg::Vec3d(rotx, roty, rotz); 2108 double rotx = 0.0, roty = 0.0, rotz = 0.0; 2109 if (objc > 12) { 2110 if (Tcl_GetDoubleFromObj(interp, objv[10], &rotx) != TCL_OK || 2111 Tcl_GetDoubleFromObj(interp, objv[11], &roty) != TCL_OK || 2112 Tcl_GetDoubleFromObj(interp, objv[12], &rotz) != TCL_OK) { 2113 return TCL_ERROR; 2114 } 2115 } 2116 if (rotx != 0.0 || roty != 0.0 || rotz != 0.0) { 2117 modelOpts.orientation() = osg::Vec3d(rotx, roty, rotz); 2118 } 2066 2119 modelOpts.paged() = false; 2067 2120 bool lighting = true; 2068 g_renderer->addModelLayer(name, modelOpts, pos, cache, lighting, visible); 2121 bool terrainPatch = false; 2122 if (objc > 13) { 2123 if (GetBooleanFromObj(interp, objv[13], &terrainPatch) != TCL_OK) { 2124 return TCL_ERROR; 2125 } 2126 } 2127 g_renderer->addModelLayer(name, modelOpts, pos, cache, lighting, 2128 visible, terrainPatch); 2069 2129 } else if (type[0] == 'i' && strcmp(type, "icon") == 0) { 2070 2130 char *driver = Tcl_GetString(objv[5]); -
geovis/trunk/geovis_protocol.txt
r6512 r6518 268 268 <clamptechnique> = drape|gpu|scene|map 269 269 270 map layer add <layerName> feature <driver> <format> <typeName> <url> <cache> <styleLen> <?scriptLen?> <?selectorsLen?> <? visibilityRangeMin?> <?visibilityRangeMax?>270 map layer add <layerName> feature <driver> <format> <typeName> <url> <cache> <styleLen> <?scriptLen?> <?selectorsLen?> <?terrainPatch?> <?visibilityRangeMin?> <?visibilityRangeMax?> 271 271 Data payload follows command: style, then script, then selectors 272 272 <styleLen> = Number of bytes in style sheet. Stylesheet payload consists of … … 278 278 <selectorsLen> = Number of bytes in selectors. Selectors payload consists 279 279 of a Tcl list of name/value pairs 280 <terrainPatch> = Boolean indicating if layer should be used for elevation 281 queries. 280 282 map layer add <layerName> icon <driver> <format> <typeName> <url> <cache> <icon> <scale> <heading> <declutter> <placement> <alignment> <?visibilityRangeMin?> <?visibilityRangeMax?> 281 283 Add an icon feature layer from a file or URL … … 298 300 Create a terrain mask layer to cut a hole in the terrain geometry. The 299 301 first feature found is assumed to be a boundary polygon. 302 <driver> = db|ogr|tfs|wfs|wkt|wkt_file 300 303 <minLOD> minimum LOD to at which to apply the mask, defaults to 0. 301 302 map layer add <layerName> model simple <url> <x> <y> <?z?> 304 map layer add <layerName> mask wkt <format> <typeName> <length> <?minLOD?> 305 Like generic mask layer command, but instead of a <url>, included data in 306 the payload which is a WKT literal string. 307 <format> and <typeName> are unused 308 <length> = length of following data for inline WKT string 309 map layer add <layerName> mask wkt_file <format> <typeName> <url> <?minLOD?> 310 <url> = URL for a text file containing a WKT string 311 <format> and <typeName> are unused 312 313 map layer add <layerName> model simple <url> <x> <y> <?z?> <?rotx?> <?roty?> <?rotz?> <?terrainPatch?> 303 314 <url> = Path to a 3D model file that OSG can load (e.g. .osg file) 304 315 <x>,<y>,<z> = Map coordinates for placing the model 316 <rotx>,<roty>,<rotz> = Rotations (in degrees) to apply to orient model 317 <terrainPatch> = boolean indicating if model should be used for elevation 318 queries. 305 319 306 320 map layer delete <layerName>
Note: See TracChangeset
for help on using the changeset viewer.