Changeset 5915
- Timestamp:
- Oct 21, 2015, 3:49:03 AM (9 years ago)
- Location:
- geovis/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/PPMWriter.cpp
r3998 r5915 50 50 char header[200]; 51 51 52 TRACE("Entering (%dx%d)\n", width, height);52 FRAME("Entering (%dx%d)\n", width, height); 53 53 // Generate the PPM binary file header 54 54 snprintf(header, sizeof(header), "P6 %d %d %d\n", width, height, … … 95 95 response->setMessage(mesg, length, Response::DYNAMIC); 96 96 queue->enqueue(response); 97 TRACE("Leaving (%dx%d)\n", width, height);97 FRAME("Leaving (%dx%d)\n", width, height); 98 98 } 99 99 #else … … 127 127 char header[200]; 128 128 129 TRACE("Entering (%dx%d)\n", width, height);129 FRAME("Entering (%dx%d)\n", width, height); 130 130 // Generate the PPM binary file header 131 131 snprintf(header, sizeof(header), "P6 %d %d %d\n", width, height, … … 166 166 free(iov); 167 167 168 TRACE("Leaving (%dx%d)\n", width, height);168 FRAME("Leaving (%dx%d)\n", width, height); 169 169 } 170 170 -
geovis/trunk/RenderServer.cpp
r5895 r5915 292 292 } 293 293 fflush(g_fOut); 294 #ifdef TRACE_RESPONSE_QUEUE 294 295 TRACE("Wrote response of type %d", response->type()); 296 #endif 295 297 delete response; 296 298 if (feof(g_fOut)) … … 401 403 402 404 if (g_renderer->render()) { 403 TRACE("Rendered new frame");405 FRAME("Rendered new frame"); 404 406 imgData = g_renderer->getRenderedFrame(); 405 407 if (imgData == NULL) { 406 408 ERROR("Empty image"); 407 409 } else { 408 TRACE("Image: %d x %d", imgData->s(), imgData->t());410 FRAME("Image: %d x %d", imgData->s(), imgData->t()); 409 411 410 412 if (imgData->s() == g_renderer->getWindowWidth() && -
geovis/trunk/Renderer.cpp
r5895 r5915 35 35 36 36 #include <osgEarth/Version> 37 #include <osgEarth/Registry> 37 38 #include <osgEarth/FileUtils> 38 39 #include <osgEarth/Cache> … … 691 692 #if 1 692 693 osgEarth::Util::EarthManipulator::Settings *settings = _manipulator->getSettings(); 694 693 695 settings->bindMouse(osgEarth::Util::EarthManipulator::ACTION_ROTATE, 694 696 osgGA::GUIEventAdapter::MIDDLE_MOUSE_BUTTON, … … 700 702 osgGA::GUIEventAdapter::RIGHT_MOUSE_BUTTON, 701 703 osgGA::GUIEventAdapter::MODKEY_ALT, options); 704 705 if (_map->isGeocentric()) { 706 settings->setMinMaxDistance(1.0, 2.0e7); 707 } else { 708 osgEarth::GeoExtent extent = _map->getProfile()->getExtent(); 709 settings->setMinMaxDistance(1.0, getMaxDistanceFromExtent(extent)); 710 } 711 702 712 _manipulator->applySettings(settings); 703 713 #endif … … 762 772 mapOpts.profile() = osgEarth::ProfileOptions(); 763 773 if (strcmp(profile, "geodetic") == 0) { 764 mapOpts.profile()->srsString() = "epsg:4326"; 774 mapOpts.profile()->srsString() = "epsg:4326"; // WGS84 765 775 } else if (strcmp(profile, "spherical-mercator") == 0) { 766 776 // Projection used by Google/Bing/OSM … … 775 785 bounds[0], bounds[1], bounds[2], bounds[3]); 776 786 if (1) { 777 osg Earth::SpatialReference *fromSRS = osgEarth::SpatialReference::create("wgs84");778 osg Earth::SpatialReference *toSRS = osgEarth::SpatialReference::create(mapOpts.profile()->srsString().get());787 osg::ref_ptr<osgEarth::SpatialReference> fromSRS = osgEarth::SpatialReference::create("wgs84"); 788 osg::ref_ptr<osgEarth::SpatialReference> toSRS = osgEarth::SpatialReference::create(mapOpts.profile()->srsString().get()); 779 789 osgEarth::Bounds extents(bounds[0], bounds[1], bounds[2], bounds[3]); 780 790 extents.transform(fromSRS, toSRS); … … 2245 2255 // +y = zoom out, -y = zoom in 2246 2256 TRACE("camDist: %g", _manipulator->getDistance()); 2257 #ifdef LIMIT_ZOOM_BY_MAP_SCALE 2247 2258 if ((_mapScale < 0.0 && y > 0.0) || 2248 2259 (_mapScale < 0.1 && y < 0.0) || 2249 2260 (_mapScale > 40000.0 && y > 0.0)) 2250 2261 return; 2262 #endif 2251 2263 #if 1 2252 2264 _manipulator->zoom(0, y); … … 2260 2272 } 2261 2273 2274 bool Renderer::getImageLayerExtent(const char *name, osgEarth::GeoExtent &ext) 2275 { 2276 if (!_map.valid()) { 2277 ERROR("No map"); 2278 return false; 2279 } 2280 osgEarth::ImageLayer *layer = _map->getImageLayerByName(name); 2281 if (layer != NULL) { 2282 osgEarth::TileSource *ts = layer->getTileSource(); 2283 if (ts != NULL) { 2284 ext = ts->getDataExtentsUnion(); 2285 if (!ext.isValid() && ts->getProfile() != NULL) { 2286 ext = ts->getProfile()->getExtent(); 2287 } 2288 INFO("Image layer %s srs: %s extent: %g %g %g %g", 2289 name, ext.getSRS() ? ext.getSRS()->getName().c_str() : "nil", 2290 ext.xMin(), ext.yMin(), ext.xMax(), ext.yMax()); 2291 return true; 2292 } 2293 } else { 2294 TRACE("Image layer not found: %s", name); 2295 } 2296 return false; 2297 } 2298 2299 bool Renderer::getElevationLayerExtent(const char *name, osgEarth::GeoExtent &ext) 2300 { 2301 if (!_map.valid()) { 2302 ERROR("No map"); 2303 return false; 2304 } 2305 osgEarth::ElevationLayer *layer = _map->getElevationLayerByName(name); 2306 if (layer != NULL) { 2307 osgEarth::TileSource *ts = layer->getTileSource(); 2308 if (ts != NULL) { 2309 ext = ts->getDataExtentsUnion(); 2310 if (!ext.isValid() && ts->getProfile() != NULL) { 2311 ext = ts->getProfile()->getExtent(); 2312 } 2313 INFO("Elevation Layer %s srs: %s extent: %g %g %g %g", 2314 name, ext.getSRS() ? ext.getSRS()->getName().c_str() : "nil", 2315 ext.xMin(), ext.yMin(), ext.xMax(), ext.yMax()); 2316 return true; 2317 } 2318 } else { 2319 TRACE("Image layer not found: %s", name); 2320 } 2321 return false; 2322 } 2323 2324 bool Renderer::getModelLayerExtent(const char *name, osgEarth::GeoExtent &ext) 2325 { 2326 if (!_map.valid()) { 2327 ERROR("No map"); 2328 return false; 2329 } 2330 osgEarth::ModelLayer *layer = _map->getModelLayerByName(name); 2331 if (layer != NULL) { 2332 osgEarth::ModelSource *ms = layer->getModelSource(); 2333 if (ms != NULL) { 2334 osgEarth::DataExtentList& dataExtents = ms->getDataExtents(); 2335 if (dataExtents.size() > 0) { 2336 ext = dataExtents[0]; 2337 for (unsigned int i = 1; i < dataExtents.size(); i++) { 2338 ext.expandToInclude(dataExtents[i]); 2339 } 2340 } 2341 if (!ext.isValid()) { 2342 ERROR("Couldn't find extent of layer %s", name); 2343 return false; 2344 } 2345 INFO("Model Layer %s srs: %s extent: %g %g %g %g", 2346 name, ext.getSRS() ? ext.getSRS()->getName().c_str() : "nil", 2347 ext.xMin(), ext.yMin(), ext.xMax(), ext.yMax()); 2348 return true; 2349 } 2350 } else { 2351 TRACE("Image layer not found: %s", name); 2352 } 2353 return false; 2354 } 2355 2356 /** 2357 * \brief Set view to fit a bounding rectangle 2358 * 2359 * A camera distance is chosen such that the extent rectangle 2360 * will fit in the vertical field of view. 2361 * 2362 * \param ext input GeoExtent 2363 * \param durationSecs Animation duration for the view change. 2364 */ 2365 void Renderer::setViewpointFromExtent(const osgEarth::GeoExtent& ext, 2366 double durationSecs) 2367 { 2368 setViewpointFromRect(ext.xMin(), ext.yMin(), ext.xMax(), ext.yMax(), 2369 ext.getSRS(), durationSecs); 2370 } 2371 2372 /** 2373 * \brief Set view to fit a bounding rectangle 2374 * 2375 * A camera distance is chosen such that the extent rectangle 2376 * will fit in the vertical field of view. 2377 * 2378 * \param xmin Minimum X coord in the given SRS 2379 * \param ymin Minimum Y coord in the given SRS 2380 * \param xmax Maximum X coord in the given SRS 2381 * \param ymax Maximum Y coord in the given SRS 2382 * \param srs Optional SRS of bounding points. If omitted, wgs84 is assumed. 2383 * \param durationSecs Animation duration for the view change. 2384 */ 2385 void Renderer::setViewpointFromRect(double xmin, double ymin, 2386 double xmax, double ymax, 2387 const osgEarth::SpatialReference *srs, 2388 double durationSecs) 2389 { 2390 if (!_viewer.valid() || !_manipulator.valid() || getMapSRS() == NULL) 2391 return; 2392 2393 double x = 0.0, y = 0.0, distance = 0.0; 2394 double x1 = xmin, y1 = ymin, x2 = xmax, y2 = ymax; 2395 osgEarth::Units distanceUnits = getMapSRS()->getUnits(); 2396 if (getMapSRS()->isProjected() && !getMapSRS()->isPlateCarre()) { 2397 INFO("Projected"); 2398 osg::ref_ptr<const osgEarth::SpatialReference> fromSRS = 2399 srs ? srs : osgEarth::SpatialReference::create("wgs84"); 2400 fromSRS->transformExtentToMBR(getMapSRS(), x1, y1, x2, y2); 2401 double height = y2 - y1; 2402 double fovy, aspect, near, far; 2403 _viewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspect, near, far); 2404 distance = height / (2. * tan(osg::DegreesToRadians(fovy)/2.)); 2405 INFO("fov: %g a: %g n: %g f: %g (%g, %g, %g, %g)", fovy, aspect, near, far, x1, y1, x2, y2); 2406 x = x1 + (x2 - x1)/2.0; 2407 y = y1 + (y2 - y1)/2.0; 2408 INFO("x: %g y: %g, dist: %g", x, y, distance); 2409 } else if (getMapSRS()->isGeographic() && !getMapSRS()->isPlateCarre()) { 2410 // World coords are ECEF 2411 INFO("Geocentric"); 2412 osg::ref_ptr<const osgEarth::SpatialReference> fromSRS = 2413 srs ? srs : osgEarth::SpatialReference::create("wgs84"); 2414 fromSRS->transformExtentToMBR(getMapSRS(), x1, y1, x2, y2); 2415 INFO("(%g, %g, %g, %g)", x1, y1, x2, y2); 2416 // These are angular units 2417 x = x1 + (x2 - x1)/2.0; 2418 y = y1 + (y2 - y1)/2.0; 2419 // These will be ECEF 2420 osg::Vec3d world1, world2, world3, world4; 2421 // bottom 2422 getMapSRS()->transformToWorld(osg::Vec3d(x, y1, 0), world1); 2423 // top 2424 getMapSRS()->transformToWorld(osg::Vec3d(x, y2, 0), world2); 2425 // Focal point on surface 2426 getMapSRS()->transformToWorld(osg::Vec3d(x, y, 0), world3); 2427 // point on line between top and bottom points 2428 world4 = world1 + (world2 - world1)/2.0; 2429 INFO("world1: %g,%g,%g world2: %g,%g,%g", 2430 world1.x(), world1.y(), world1.z(), 2431 world2.x(), world2.y(), world2.z()); 2432 INFO("world3: %g,%g,%g world4: %g,%g,%g", 2433 world3.x(), world3.y(), world3.z(), 2434 world4.x(), world4.y(), world4.z()); 2435 double height = (world2 - world1).length(); 2436 double fovy, aspect, near, far; 2437 _viewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspect, near, far); 2438 distance = height / (2. * tan(osg::DegreesToRadians(fovy)/2.)); 2439 distance -= (world4 - world3).length(); 2440 if (distance < 0.0) distance = 0.0; 2441 distanceUnits = osgEarth::Units::METERS; 2442 INFO("fov: %g a: %g n: %g f: %g (%g, %g, %g, %g)", fovy, aspect, near, far, x1, y1, x2, y2); 2443 INFO("x: %g y: %g, dist: %g", x, y, distance); 2444 } else { 2445 assert(getMapSRS()->isPlateCarre()); 2446 ERROR("Plate Carree not supported"); 2447 return; 2448 } 2449 INFO("Map units: %d", getMapSRS()->getUnits().getType()); 2450 osgEarth::Viewpoint vpt; 2451 #ifdef NEW_VIEWPOINT_API 2452 vpt.focalPoint()->set(getMapSRS(), x, y, 0.0, osgEarth::ALTMODE_ABSOLUTE); 2453 vpt.range()->set(distance, distanceUnits); 2454 vpt.heading()->set(0.0, osgEarth::Units::DEGREES); 2455 vpt.pitch()->set(-90.0, osgEarth::Units::DEGREES); 2456 #else 2457 vpt.x() = x; 2458 vpt.y() = y; 2459 vpt.z() = 0.0; 2460 vpt.setRange(distance); 2461 vpt.setHeading(0.0); 2462 vpt.setPitch(-90.0); 2463 #endif 2464 _manipulator->setViewpoint(vpt, durationSecs); 2465 _needsRedraw = true; 2466 } 2467 2468 double Renderer::getMaxDistanceFromExtent(const osgEarth::GeoExtent& extent) 2469 { 2470 if (!_viewer.valid() || extent.getSRS() == NULL) 2471 return 2.0e7; 2472 2473 double x = 0.0, y = 0.0, distance = 0.0; 2474 double x1 = extent.xMin(), y1 = extent.yMin(), x2 = extent.xMax(), y2 = extent.yMax(); 2475 osgEarth::Units distanceUnits = extent.getSRS()->getUnits(); 2476 if (extent.getSRS()->isProjected() && !extent.getSRS()->isPlateCarre()) { 2477 INFO("Projected"); 2478 double height = y2 - y1; 2479 double fovy, aspect, near, far; 2480 _viewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspect, near, far); 2481 distance = height / (2. * tan(osg::DegreesToRadians(fovy)/2.)); 2482 INFO("fov: %g a: %g n: %g f: %g (%g, %g, %g, %g)", fovy, aspect, near, far, x1, y1, x2, y2); 2483 x = x1 + (x2 - x1)/2.0; 2484 y = y1 + (y2 - y1)/2.0; 2485 INFO("x: %g y: %g, dist: %g", x, y, distance); 2486 } else if (extent.getSRS()->isGeographic() && !extent.getSRS()->isPlateCarre()) { 2487 // World coords are ECEF 2488 INFO("Geocentric"); 2489 INFO("(%g, %g, %g, %g)", x1, y1, x2, y2); 2490 // These are angular units 2491 x = x1 + (x2 - x1)/2.0; 2492 y = y1 + (y2 - y1)/2.0; 2493 // These will be ECEF 2494 osg::Vec3d world1, world2, world3, world4; 2495 // bottom 2496 getMapSRS()->transformToWorld(osg::Vec3d(x, y1, 0), world1); 2497 // top 2498 getMapSRS()->transformToWorld(osg::Vec3d(x, y2, 0), world2); 2499 // Focal point on surface 2500 getMapSRS()->transformToWorld(osg::Vec3d(x, y, 0), world3); 2501 // point on line between top and bottom points 2502 world4 = world1 + (world2 - world1)/2.0; 2503 double height = (world2 - world1).length(); 2504 double fovy, aspect, near, far; 2505 _viewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspect, near, far); 2506 distance = height / (2. * tan(osg::DegreesToRadians(fovy)/2.)); 2507 distance -= (world4 - world3).length(); 2508 if (distance < 0.0) distance = 0.0; 2509 distanceUnits = osgEarth::Units::METERS; 2510 INFO("fov: %g a: %g n: %g f: %g (%g, %g, %g, %g)", fovy, aspect, near, far, x1, y1, x2, y2); 2511 INFO("x: %g y: %g, dist: %g", x, y, distance); 2512 } else { 2513 assert(extent.getSRS()->isPlateCarre()); 2514 ERROR("Plate Carree not supported"); 2515 } 2516 2517 return distance; 2518 } 2519 2262 2520 /** 2263 2521 * \brief Dolly camera to set distance from focal point 2264 2522 * 2265 * \param[in] dist distance in map? coordinates2523 * \param[in] dist distance in world coordinate units (typically meters) 2266 2524 */ 2267 2525 void Renderer::setCameraDistance(double dist) … … 2459 2717 _lastFrameTime = osg::Timer::instance()->delta_s(_startFrameTime, endFrameTick); 2460 2718 if (_lastFrameTime > _minFrameTime) { 2461 TRACE("BROKE FRAME by %.2f msec", (_lastFrameTime - _minFrameTime)*1000.0f);2462 } else { 2463 TRACE("Frame time: %.2f msec", _lastFrameTime*1000.0f);2719 FRAME("BROKE FRAME by %.2f msec", (_lastFrameTime - _minFrameTime)*1000.0f); 2720 } else { 2721 FRAME("Frame time: %.2f msec", _lastFrameTime*1000.0f); 2464 2722 } 2465 2723 #ifdef USE_THROTTLING_SLEEP 2466 2724 if (_lastFrameTime < _minFrameTime) { 2467 TRACE("Sleeping for %.2f msec", (_minFrameTime - _lastFrameTime)*1000.0f);2725 FRAME("Sleeping for %.2f msec", (_minFrameTime - _lastFrameTime)*1000.0f); 2468 2726 OpenThreads::Thread::microSleep(static_cast<unsigned int>(1000000.0*(_minFrameTime - _lastFrameTime))); 2469 2727 } … … 2480 2738 { 2481 2739 if (_viewer.valid() && checkNeedToDoFrame()) { 2482 TRACE("Enter needsRedraw=%d", _needsRedraw ? 1 : 0);2740 FRAME("Enter needsRedraw=%d", _needsRedraw ? 1 : 0); 2483 2741 _renderStartTime = osg::Timer::instance()->tick(); 2484 TRACE("Before frame()");2742 FRAME("Before frame()"); 2485 2743 _viewer->frame(); 2486 TRACE("After frame()");2744 FRAME("After frame()"); 2487 2745 _renderStopTime = osg::Timer::instance()->tick(); 2488 2746 _renderTime = osg::Timer::instance()->delta_s(_renderStartTime, _renderStopTime); 2489 TRACE("Render time: %g msec", _renderTime * 1000.0);2747 FRAME("Render time: %g msec", _renderTime * 1000.0); 2490 2748 #ifndef SLEEP_AFTER_QUEUE_FRAME 2491 2749 _lastFrameTime = _renderTime; 2492 2750 #ifdef USE_THROTTLING_SLEEP 2493 2751 if (_lastFrameTime < _minFrameTime) { 2494 TRACE("Sleeping for %.2f msec", (_minFrameTime - _lastFrameTime)*1000.0f);2752 FRAME("Sleeping for %.2f msec", (_minFrameTime - _lastFrameTime)*1000.0f); 2495 2753 OpenThreads::Thread::microSleep(static_cast<unsigned int>(1.0e6*(_minFrameTime - _lastFrameTime))); 2496 2754 } 2497 2755 #endif 2498 2756 #endif 2499 #ifdef WANT_ TRACE2757 #ifdef WANT_FRAME 2500 2758 if (_viewer->getViewerStats() != NULL) { 2501 2759 _viewer->getViewerStats()->report(std::cerr, _viewer->getViewerStats()->getLatestFrameNumber()); -
geovis/trunk/Renderer.h
r5895 r5915 72 72 virtual void operator()(osg::RenderInfo &renderInfo) const 73 73 { 74 TRACE("Enter ScreenCaptureCallback");74 FRAME("Enter ScreenCaptureCallback"); 75 75 int width, height; 76 76 if (renderInfo.getCurrentCamera() == NULL) { … … 84 84 width = (int)renderInfo.getCurrentCamera()->getViewport()->width(); 85 85 height = (int)renderInfo.getCurrentCamera()->getViewport()->height(); 86 TRACE("readPixels: %d x %d", width, height);86 FRAME("readPixels: %d x %d", width, height); 87 87 #if 0 //USE_OFFSCREEN_FRAMEBUFFER 88 88 _image = _texture->getImage(); … … 267 267 void moveImageLayer(const char *name, unsigned int pos); 268 268 269 bool getImageLayerExtent(const char *name, osgEarth::GeoExtent &ext); 270 269 271 void setImageLayerVisibleRange(const char *name, float min, float max); 270 272 … … 309 311 void moveElevationLayer(const char *name, unsigned int pos); 310 312 313 bool getElevationLayerExtent(const char *name, osgEarth::GeoExtent &ext); 314 311 315 void setElevationLayerVisibleRange(const char *name, float min, float max); 312 316 … … 342 346 void moveModelLayer(const char *name, unsigned int pos); 343 347 348 bool getModelLayerExtent(const char *name, osgEarth::GeoExtent &ext); 349 344 350 //void setModelLayerVisibleRange(const char *name, float min, float max); 345 351 … … 373 379 374 380 void setViewpoint(const osgEarth::Viewpoint& v, double durationSecs = 0.0); 381 382 double getMaxDistanceFromExtent(const osgEarth::GeoExtent& extent); 383 384 void setViewpointFromExtent(const osgEarth::GeoExtent& ext, 385 double durationSecs = 0.0); 386 387 void setViewpointFromRect(double xmin, double ymin, 388 double xmax, double ymax, 389 const osgEarth::SpatialReference *srs = NULL, 390 double durationSecs = 0.0); 375 391 376 392 void resetCamera(bool resetOrientation = true); -
geovis/trunk/RendererCmd.cpp
r5895 r5915 37 37 #include <osgEarthDrivers/osg/ColorRampOptions> 38 38 #include <osgEarthDrivers/debug/DebugOptions> 39 #include <osgEarthDrivers/arcgis/ArcGISOptions> 39 40 #include <osgEarthDrivers/gdal/GDALOptions> 40 41 #include <osgEarthDrivers/tms/TMSOptions> … … 583 584 584 585 static int 586 CameraSetByExtentOp(ClientData clientData, Tcl_Interp *interp, int objc, 587 Tcl_Obj *const *objv) 588 { 589 double xmin, ymin, xmax, ymax; 590 double duration = 0.0; 591 if (Tcl_GetDoubleFromObj(interp, objv[2], &xmin) != TCL_OK || 592 Tcl_GetDoubleFromObj(interp, objv[3], &ymin) != TCL_OK || 593 Tcl_GetDoubleFromObj(interp, objv[4], &xmax) != TCL_OK || 594 Tcl_GetDoubleFromObj(interp, objv[5], &ymax) != TCL_OK) { 595 return TCL_ERROR; 596 } 597 if (objc > 6) { 598 if (Tcl_GetDoubleFromObj(interp, objv[6], &duration) != TCL_OK) { 599 return TCL_ERROR; 600 } 601 } 602 osg::ref_ptr<const osgEarth::SpatialReference> srs = g_renderer->getMapSRS(); 603 if (objc > 7) { 604 char *srsInit = Tcl_GetString(objv[7]); 605 if (strlen(srsInit) > 0) { 606 srs = osgEarth::SpatialReference::get(srsInit); 607 } 608 } 609 g_renderer->setViewpointFromRect(xmin, ymin, xmax, ymax, srs.get(), duration); 610 return TCL_OK; 611 } 612 613 static int 614 CameraSetByLayerExtentOp(ClientData clientData, Tcl_Interp *interp, int objc, 615 Tcl_Obj *const *objv) 616 { 617 const char *name = Tcl_GetString(objv[2]); 618 double duration = 0.0; 619 if (objc > 3) { 620 if (Tcl_GetDoubleFromObj(interp, objv[3], &duration) != TCL_OK) { 621 return TCL_ERROR; 622 } 623 } 624 osgEarth::GeoExtent ext; 625 if (g_renderer->getImageLayerExtent(name, ext)) { 626 g_renderer->setViewpointFromExtent(ext, duration); 627 return TCL_OK; 628 } else if (g_renderer->getElevationLayerExtent(name, ext)) { 629 g_renderer->setViewpointFromExtent(ext, duration); 630 return TCL_OK; 631 } else if (g_renderer->getModelLayerExtent(name, ext)) { 632 g_renderer->setViewpointFromExtent(ext, duration); 633 return TCL_OK; 634 } 635 return TCL_ERROR; 636 } 637 638 static int 585 639 CameraSetDistanceOp(ClientData clientData, Tcl_Interp *interp, int objc, 586 640 Tcl_Obj *const *objv) … … 676 730 {"delete", 2, CameraDeleteViewpointOp, 3, 3, "name"}, 677 731 {"dist", 2, CameraSetDistanceOp, 3, 3, "distance"}, 732 {"extent", 1, CameraSetByExtentOp, 6, 8, "xmin ymin xmax ymax ?duration? ?srs?"}, 678 733 {"get", 2, CameraGetViewpointOp, 2, 2, ""}, 679 734 {"go", 2, CameraGoOp, 4, 6, "x y ?zoomFactor? ?duration?"}, 735 {"lextent", 1, CameraSetByLayerExtentOp, 3, 4, "layerName ?duration?"}, 680 736 {"orient", 1, CameraOrientOp, 6, 6, "qw qx qy qz"}, 681 737 {"pan", 1, CameraPanOp, 4, 4, "panX panY"}, … … 1391 1447 osgEarth::Drivers::DebugOptions opts; 1392 1448 ret = g_renderer->addImageLayer(name, opts, cache, coverage, shared, visible, minLOD, maxLOD); 1449 } else if (driver[0] == 'a' && strcmp(driver, "arcgis") == 0) { 1450 osgEarth::Drivers::ArcGISOptions opts; 1451 opts.url() = url; 1452 opts.token() = Tcl_GetString(objv[9]); 1453 //opts.format() = Tcl_GetString(objv[10]); 1454 //opts.layers() = Tcl_GetString(objv[11]); 1455 ret = g_renderer->addImageLayer(name, opts, cache, coverage, shared, visible, minLOD, maxLOD); 1456 g_renderer->setImageLayerVisibleRange(name, minRange, maxRange); 1393 1457 } else if (driver[0] == 'g' && strcmp(driver, "gdal") == 0) { 1394 1458 osgEarth::Drivers::GDALOptions opts; … … 2554 2618 } 2555 2619 } 2556 #if 12557 2620 // Check if min > max 2558 2621 if (bounds[0] > bounds[2] || … … 2577 2640 return TCL_ERROR; 2578 2641 } 2642 // As of osgearth 2.7, these are not permitted as map profiles. 2643 // Use epsg:32663 instead 2644 Tcl_AppendResult(interp, "Invalid profile: can't use geographic coordinate system as projection. Consider using an equirectangular projection (epsg:32663) instead.", (char*)NULL); 2645 return TCL_ERROR; 2579 2646 } else if (strcmp(profile, "spherical-mercator") == 0 || 2580 2647 strcmp(profile, "epsg:900913") == 0 || … … 2583 2650 strcmp(profile, "epsg:102113") == 0) { 2584 2651 for (int i = 0; i < 4; i++) { 2585 if (bounds[i] < -20037508.34 || bounds[i] > 20037508.34) {2652 if (bounds[i] < -20037508.34278925 || bounds[i] > 20037508.34278925) { 2586 2653 Tcl_AppendResult(interp, "invalid bounds", (char*)NULL); 2587 2654 return TCL_ERROR; … … 2590 2657 } else if (strcmp(profile, "epsg:32662") == 0 || 2591 2658 strcmp(profile, "epsg:32663") == 0) { 2592 if (bounds[0] < -20037508.3428 || bounds[0] > 20037508.3428 || 2593 bounds[2] < -20037508.3428 || bounds[2] > 20037508.3428 || 2594 bounds[1] < -10018754.1714 || bounds[1] > 10018754.1714 || 2595 bounds[3] < -10018754.1714 || bounds[3] > 10018754.1714) { 2659 // epsg:32662 is deprecated: spherical method applied to ellipsoid WGS84 2660 // Equirectangular projection (WGS84/World Equidistant Cylindrical) 2661 if (bounds[0] < -20037508.34278925 || bounds[0] > 20037508.34278925 || 2662 bounds[2] < -20037508.34278925 || bounds[2] > 20037508.34278925 || 2663 bounds[1] < -10018754.17139463 || bounds[1] > 10018754.17139463 || 2664 bounds[3] < -10018754.17139463 || bounds[3] > 10018754.17139463) { 2596 2665 Tcl_AppendResult(interp, "invalid bounds", (char*)NULL); 2597 2666 return TCL_ERROR; 2598 2667 } 2599 2668 } 2600 #endif2601 2669 g_renderer->resetMap(type, bgColor, profile, bounds); 2602 2670 } else { 2671 // If no bounds are given, this must be a named profile with implicit bounds 2603 2672 if (osgEarth::Registry::instance()->getNamedProfile(profile) == NULL) { 2604 2673 Tcl_AppendResult(interp, "bad named profile \"", profile, -
geovis/trunk/ResponseQueue.cpp
r4629 r5915 48 48 #ifdef QUEUE_ONLY_ONE_FRAME 49 49 /* Examine the list and remove any queued responses of the same type. */ 50 #ifdef TRACE_RESPONSE_QUEUE 50 51 TRACE("Before # of elements is %d", _list.size()); 52 #endif 51 53 for (std::list<Response *>::iterator itr = _list.begin(); 52 54 itr != _list.end();) { … … 71 73 /* Add the new response to the end of the list. */ 72 74 _list.push_back(response); 75 #ifdef TRACE_RESPONSE_QUEUE 73 76 TRACE("After # of elements is %d", _list.size()); 77 #endif 74 78 if (sem_post(&_ready) < 0) { 75 79 ERROR("can't post semaphore: %s", strerror(errno)); … … 103 107 response = _list.front(); 104 108 _list.pop_front(); 109 #ifdef TRACE_RESPONSE_QUEUE 105 110 TRACE("Dequeued response of type %d", response->type()); 111 #endif 106 112 } 107 113 if (pthread_mutex_unlock(&_idle) != 0) { -
geovis/trunk/Trace.h
r4655 r5915 37 37 #define TRACE(...) 38 38 #endif /*WANT_TRACE*/ 39 #ifdef WANT_FRAME 40 #define FRAME(...) GeoVis::logMessage(LOG_DEBUG, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 41 #else 42 #define FRAME(...) 43 #endif /*WANT_FRAME*/ 39 44 #define WARN(...) GeoVis::logMessage(LOG_WARNING, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) 40 45 #define INFO(...) GeoVis::logMessage(LOG_INFO, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
Note: See TracChangeset
for help on using the changeset viewer.