-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide the polygon outlines #2700
Comments
Ok, I am a little confused here. Are you saying that LineDrawables are not getting an object id? Is all this stuff about LineGroups and nodes just your attempt at a workaround? I added some polygon outlines to feature_polygons.earth and they are tagged just fine according to the picker. |
I wrote a custom shader to hide a polygon using its ObjectID, and it works fine. But the polygon's outline is still visible. I tried to find the drawable for the outline, but it doesn’t have an ObjectID, so I couldn’t identify it. |
Object IDs are not stored in the scene graph, but rather in the std::set<ObjectID> object_ids;
ObjectIndex::getObjectIDs(drawable, object_ids); |
I used ObjectIndex to find the ID: auto group = findAllNodesByTypeosgEarth::LineGroup(lyrNode).at(0); But getObjectIDs function returns while attempting to cast drawable as geometry. bool ObjectIndex::getObjectIDs(const osg::Drawable* drawable, std::set& output) const
} The same issue occurs when ObjectIndex attempts to tag the drawable, the function returns after the asGeometry() call. |
…t to not work on non-Geometry Drawables (like LineDrawable), #2700
Hey, now we are getting somewhere! Thanks for tracking down this bug. I have pushed a fix for this - please test and report back. |
osgEarth Version (required): 3.7
Description of the problem: Not able to the polygon outlines
What you have tried: Added custom shader for hiding the polygon by objectid.
I am working with osgEarth’s C++ API and have loaded a shapefile as a FeatureModelLayer. I need to hide the polygons upon selection, which I have achieved using shaders (making the polygon transparent) and objectid. However, the polygon outlines are still visible because they are rendered by LineDrawable.
To hide the outlines, I attempted to find the corresponding geode using nodeIntersector to get the LineGroup containing the outlines. I then used the following code to identify the LineDrawable:
osgEarth::LineGroup group = findAllNodesByTypeosgEarth::LineGroup(lyrNode).at(0);
Despite enabling feature indexing for the FeatureSource, the LineDrawable objects are not tagged with objectid.
Upon debugging, I found that in the BuildGeometryFilter class, the processLines function uses this line for tagging:
if (context.featureIndex())
{
}
However, the tagDrawable function only tags geometry class objects and does not tag the node, which prevents me from hiding the outlines effectively.
Could you please help identify a solution to hide the polygon outlines?
The text was updated successfully, but these errors were encountered: