Skip to content

unable to select a label #2565

Jun 26, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You do need to tag your annotation to make it clickable. (You commented this out.)
Here's a simple code snippet that works:

auto anno = new PlaceNode();
anno->setText("Hello, World!");
anno->setPosition(GeoPoint(mapnode->getMapSRS(), -122.5, 45.5));
Registry::objectIndex()->tagNode(anno, anno);
mapnode->addChild(anno);

auto picker = new ObjectIDPicker();
picker->setView(&viewer);
picker->setGraph(mapnode);
mapnode->addChild(picker);

picker->onClick([&](const ObjectID& id)
    {
        if (id != OSGEARTH_OBJECTID_EMPTY)
        {
            auto place = Registry::objectIndex()->get<AnnotationNode>(id);
            if (place)
            {
                std::cout << "Clicked on \"" <<…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AhmedAredah
Comment options

Answer selected by AhmedAredah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants