Changeset 6253
- Timestamp:
- Apr 7, 2016, 6:35:03 AM (9 years ago)
- Location:
- geovis/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/MouseCoordsTool.h
r4349 r6253 56 56 // Out of range of map extents 57 57 if (_label.valid()) { 58 _label->setText(""); 58 _label->setText(osgEarth::Stringify() 59 << _prefix 60 << "N/A"); 59 61 } 60 62 _havePoint = false; -
geovis/trunk/Picker.cpp
r6245 r6253 204 204 TRACE("Hit feature ID: %lu (of %d) layer: %s", feature->getFID(), index->size(), layerName.c_str()); 205 205 206 _renderer->clearSelection(); 206 std::vector<unsigned long> fids; 207 fids.push_back(feature->getFID()); 208 _renderer->selectFeatures(fids, layerName.c_str(), true); 207 209 _renderer->addPlacard(_pickPoint, feature, layerName.c_str()); 208 210 -
geovis/trunk/Renderer.cpp
r6250 r6253 495 495 void Renderer::initControls() 496 496 { 497 if (!_debugBox.valid()) { 498 _debugBox = 499 new osgEarth::Util::Controls::HBox(osgEarth::Util::Controls::Control::ALIGN_RIGHT, 500 osgEarth::Util::Controls::Control::ALIGN_TOP, 501 osgEarth::Util::Controls::Gutter(0, 2, 2, 0), 2.0f); 502 _debugLabel = 503 new osgEarth::Util::Controls::LabelControl("Selection: None", 12.0f); 504 _debugLabel->setForeColor(osg::Vec4f(0, 0, 0, 1)); 505 //_debugLabel->setHaloColor(osg::Vec4f(1, 1, 1, 1)); 506 _debugBox->addControl(_debugLabel.get()); 507 _debugBox->setVertFill(true); 508 _debugBox->setForeColor(osg::Vec4f(0, 0, 0, 1)); 509 _debugBox->setBackColor(osg::Vec4f(1, 1, 1, 0.6)); 510 osgEarth::Util::Controls::ControlCanvas::getOrCreate(_viewer.get())->addControl(_debugBox.get()); 511 } 497 512 if (_copyrightScaleBox.valid()) 498 513 return; … … 606 621 _mouseCoordsTool = NULL; 607 622 } 608 if (_coordsCallback.valid() && _viewer.valid()) { 609 osgEarth::Util::Controls::LabelControl *readout = 610 _coordsCallback->getLabel(); 611 osgEarth::Util::Controls::ControlCanvas::getOrCreate(_viewer.get())->removeControl(readout); 623 if (_coordsCallback.valid()) { 612 624 _coordsCallback = NULL; 613 625 } 626 if (_coordsBox.valid() && _viewer.valid()) { 627 _coordsBox->clearControls(); 628 osgEarth::Util::Controls::ControlCanvas::getOrCreate(_viewer.get())->removeControl(_coordsBox.get()); 629 } 630 _coordsBox = NULL; 614 631 } else { 615 632 initMouseCoordsTool(type, precision); … … 653 670 _coordsCallback = NULL; 654 671 } else { 655 readout = new osgEarth::Util::Controls::LabelControl("", 12.0f); 656 osgEarth::Util::Controls::ControlCanvas::getOrCreate(_viewer.get())->addControl(readout); 657 readout->setForeColor(osg::Vec4f(1, 1, 1, 1)); 658 readout->setHaloColor(osg::Vec4f(0, 0, 0, 1)); 672 readout = new osgEarth::Util::Controls::LabelControl("Lat/Long: N/A", 12.0f); 673 readout->setForeColor(osg::Vec4f(0, 0, 0, 1)); 674 _coordsBox = 675 new osgEarth::Util::Controls::HBox(osgEarth::Util::Controls::Control::ALIGN_LEFT, 676 osgEarth::Util::Controls::Control::ALIGN_TOP, 677 osgEarth::Util::Controls::Gutter(0, 2, 2, 0), 2.0f); 678 _coordsBox->setVertFill(true); 679 _coordsBox->setForeColor(osg::Vec4f(0, 0, 0, 1)); 680 _coordsBox->setBackColor(osg::Vec4f(1, 1, 1, 0.6)); 681 _coordsBox->addControl(readout); 682 osgEarth::Util::Controls::ControlCanvas::getOrCreate(_viewer.get())->addControl(_coordsBox.get()); 659 683 } 660 684 … … 1579 1603 void Renderer::deselectFeatures(std::vector<unsigned long>& featureIDs, const char *layerName) 1580 1604 { 1605 // TODO: Take down placard? 1581 1606 TRACE("Deselect features layer '%s', num features: %u", layerName, featureIDs.size()); 1582 1607 for (unsigned int i = 0; i < featureIDs.size(); i++) { … … 1592 1617 TRACE("No selection"); 1593 1618 } 1619 updateDebugLabel(); 1594 1620 } 1595 1621 … … 1657 1683 _needsRedraw = true; 1658 1684 } 1685 updateDebugLabel(); 1686 } 1687 1688 void Renderer::updateDebugLabel() 1689 { 1690 if (!_debugLabel.valid()) return; 1691 std::ostringstream oss; 1692 oss << "Selection:"; 1693 for (FeatureSelectionHashmap::iterator itr = _selectedFeatures.begin(); 1694 itr != _selectedFeatures.end(); ++itr) { 1695 bool found = false; 1696 oss << std::endl << itr->first << ":"; 1697 for (FeatureSelectionHashmap::mapped_type::iterator fitr = itr->second.begin(); 1698 fitr != itr->second.end(); ++fitr) { 1699 oss << " " << *fitr; 1700 found = true; 1701 } 1702 if (!found) { 1703 oss << " None"; 1704 } 1705 } 1706 _debugLabel->setText(oss.str()); 1659 1707 } 1660 1708 … … 1682 1730 clearSelectionAnnotationNodes(); 1683 1731 clearBoxSelection(); 1732 updateDebugLabel(); 1684 1733 _needsRedraw = true; 1685 1734 } -
geovis/trunk/Renderer.h
r6246 r6253 603 603 void initControls(); 604 604 605 void updateDebugLabel(); 606 605 607 void initEarthManipulator(); 606 608 … … 661 663 osg::ref_ptr<ScreenCaptureCallback> _captureCallback; 662 664 osg::ref_ptr<osgEarth::Util::AutoClipPlaneCullCallback> _clipPlaneCullCallback; 665 osg::ref_ptr<osgEarth::Util::Controls::HBox> _coordsBox; 663 666 osg::ref_ptr<MouseCoordsTool> _mouseCoordsTool; 664 667 osg::ref_ptr<MouseCoordsCallback> _coordsCallback; 668 osg::ref_ptr<osgEarth::Util::Controls::HBox> _debugBox; 669 osg::ref_ptr<osgEarth::Util::Controls::LabelControl> _debugLabel; 665 670 osg::ref_ptr<osgEarth::Util::Controls::HBox> _copyrightScaleBox; 666 671 osg::ref_ptr<osgEarth::Util::Controls::LabelControl> _copyrightLabel;
Note: See TracChangeset
for help on using the changeset viewer.