- Timestamp:
- Feb 11, 2016 11:57:17 PM (8 years ago)
- Location:
- geovis/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/Picker.cpp
r6003 r6005 202 202 203 203 _renderer->clearSelection(); 204 205 const osgEarth::Features::AttributeTable &attrs = feature->getAttrs(); 206 Placard placard = _renderer->getPlacardConfig(layerName); 207 if (placard.getNumEntries() == 0) { 208 placard.addAllAttributes(attrs); 209 } 210 PlacardNode *label = 211 new PlacardNode(_renderer->getMapNode(), _pickPoint, placard, attrs); 212 label->getOrCreateStateSet()->setRenderBinDetails(INT_MAX, "RenderBin"); 213 _renderer->getAnnotations()->addChild(label); 204 _renderer->addPlacard(_pickPoint, feature, layerName.c_str()); 214 205 215 206 char mesg[256]; -
geovis/trunk/Renderer.cpp
r6004 r6005 1566 1566 #if OSGEARTH_MIN_VERSION_REQUIRED(3, 0, 0) 1567 1567 osgEarth::ObjectID id = index->getObjectID(fid); 1568 #if 0 1569 osgEarth::Features::Feature *feature = index->getFeature(id); 1570 if (feature) { 1571 // Find feature centroid 1572 osgEarth::GeoPoint location; 1573 if (feature->getGeometry()) { 1574 osg::BoundingSphered bound; 1575 feature->getWorldBound(getMapSRS(), bound); 1576 location.set(getMapSRS(), bound.center(), 1577 osgEarth::ALTMODE_ABSOLUTE); 1578 } 1579 addPlacard(location, feature, layerName); 1580 } 1581 #endif 1568 1582 setHighlightByObjectID(id); 1569 1583 TRACE("FID %lu = OID %d", fid, id); … … 1572 1586 _needsRedraw = true; 1573 1587 } 1588 } 1589 1590 void Renderer::addPlacard(const osgEarth::GeoPoint& location, 1591 osgEarth::Features::Feature *feature, 1592 const char *layerName) 1593 { 1594 if (feature == NULL) return; 1595 1596 const osgEarth::Features::AttributeTable &attrs = feature->getAttrs(); 1597 Placard placard = getPlacardConfig(layerName); 1598 if (placard.getNumEntries() == 0) { 1599 placard.addAllAttributes(attrs); 1600 } 1601 PlacardNode *label = 1602 new PlacardNode(_mapNode.get(), location, placard, attrs); 1603 label->getOrCreateStateSet()->setRenderBinDetails(INT_MAX, "RenderBin"); 1604 getAnnotations()->addChild(label); 1574 1605 } 1575 1606 -
geovis/trunk/Renderer.h
r6002 r6005 519 519 void selectFeatures(std::vector<unsigned long>& featureIDs, const char *layerName); 520 520 521 void addPlacard(const osgEarth::GeoPoint& location, 522 osgEarth::Features::Feature *feature, 523 const char *layerName); 524 521 525 void clearSelection(); 522 526 … … 555 559 return _placeNodes.get(); 556 560 } 557 Placard getPlacardConfig(const std::string&layerName)561 Placard getPlacardConfig(const char *layerName) 558 562 { 559 563 Placard ret;
Note: See TracChangeset
for help on using the changeset viewer.