How to make a PlaceNode autoscale?

classic Classic list List threaded Threaded
8 messages Options
tttlll tttlll
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to make a PlaceNode autoscale?

I try to add osg::AutoTransform to my root(osg::Group),and add PlaceNode to osg::Autotransform.But it doesn't work.Here is my code:
        _annoGroup = new osg::AutoTransform();
        _annoGroup->setScale(3);
        _annoGroup->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);
        _annoGroup->setAutoScaleToScreen(true);
        _annoGroup->setMinimumScale(3);
        _annoGroup->setMaximumScale(5);
        _annoGroup->setCullingActive(false);
        root->addChild(_annoGroup);
        osg::ref_ptr<PlaceNode> placenode = new PlaceNode(_mapNode, mapPoint,annoText, annoStyle);
                _manager->addAnnotation(placenode,_annoGroup);

Can anybody teach me how to make it work?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a PlaceNode autoscale?

tttlll,

Try the GeoPositionNodeAutoScaler callback instead of an AUtoTransform.

https://github.com/gwaldron/osgearth/blob/master/src/osgEarthAnnotation/GeoPositionNodeAutoScaler

(Also, please register for the forum when you get a chance. Thanks.)
Glenn Waldron / Pelican Mapping
tttlll tttlll
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a PlaceNode autoscale?

thanks a lot for your advice.I will try it
tttlll tttlll
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a PlaceNode autoscale?

In reply to this post by gwaldron
I've register for the forum.
I try with these codes,but it crashed.
osg::ref_ptr<PlaceNode> placenode = new PlaceNode(_mapNode, mapPoint,annoStyle._text, style);
GeoPositionNode* geopNode = dynamic_cast<GeoPositionNode *>(placenode.get());
geopNode->setCullCallback(new GeoPositionNodeAutoScaler());
_manager->addAnnotation(placenode,_annoRoot);


and I found the link cpp you give to me NOTE:
* Important: ONLY install this on a GeoPositionNode, or else you will
* get a crash -- it does NO type checking.



But when I try to use GeoPositionNode instead of AnnotationNode,the view draw nothing
osg::ref_ptr<GeoPositionNode>geopNode = new GeoPositionNode(_mapNode,mapPoint);
geopNode->applyStyle(style);
_manager->addAnnotation(geopNode,_annoRoot);
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a PlaceNode autoscale?

tttlll,

Sorry - I misread your original post. The GeoPositionNodeAutoScaler is useful for a ModeNode, but not for a PlaceNode. PlaceNodes are rendered in screen space already -- what are you trying to auto-scale?
Glenn Waldron / Pelican Mapping
tttlll tttlll
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a PlaceNode autoscale?

The iconsymbol I define with a osg::image drew in the same size in screen no matter how I zoom in or out.
My purpose is to auto-scale the iconsymbol ^_^ so it does not feel odd when the earth is far away from my view eye.looking foraward to your reply and sorry for my poor English.
examyes examyes
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a PlaceNode autoscale?

The PlaceNode use ScreenSpaceLayout, which make the IconSymbol and TextSymbol the same size no matter how you zoom in or out. So maybe you should not use the original PlaceNode.
tttlll tttlll
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to make a PlaceNode autoscale?

Then what else AnnotationNode can I use to replace PlaceNode?
Loading...