how to draw tracks of moving placenode on 2D projected Map?

classic Classic list List threaded Threaded
6 messages Options
chuyanjun chuyanjun
Reply | Threaded
Open this post in threaded view
|

how to draw tracks of moving placenode on 2D projected Map?

In my application these are some placenodes moving on 2D projected map, and I want to draw the tracks of moving placenode.  The position of the placenodes is provided by another application and sent to my application by UDP or TCP.

Any suggestions. Thanks in advance.
2LR 2LR
Reply | Threaded
Open this post in threaded view
|

Re: how to draw tracks of moving placenode on 2D projected Map?

Can you elaborate on what you mean by "draw the tracks"? Are you referring to a trail of some sort?
chuyanjun chuyanjun
Reply | Threaded
Open this post in threaded view
|

Re: how to draw tracks of moving placenode on 2D projected Map?

What I mean is to mark the position that placenode passed by and link the positions with line-strips.
Thanks for your reply.
2LR 2LR
Reply | Threaded
Open this post in threaded view
|

Re: how to draw tracks of moving placenode on 2D projected Map?

Okay. That would be a trail giving a history of positions each time the model moves. Those positions are represented by LineDrawable or equivalent.

If you can find it, I'd suggest looking at "Drawing a ribbon following a model" in the "OpenSceneGraph 3 Cookbook" by Rui Wang and Xuelei Qian. They outline how to draw a trail behind a model as it updates position.

You would just need to use osgEarth's LineDrawable or FeatureNode class to render the trail information.

The idea is that every time you get a position update from the network, you would just push the position vertex into the Line object. If you want to control the length of the trail, you will need to trim positions off the back of the Line object as new positions are pushed.

HTH

-S

chuyanjun chuyanjun
Reply | Threaded
Open this post in threaded view
|

Re: how to draw tracks of moving placenode on 2D projected Map?

Thanks for your reply.

I have used to osg geometry with dynamically change vertex array to do this in 3D scene, And the coordinate of vertex has been converted to geocentric (or world coordinate). In 2D projected map, how can I converter the 2D coordinate to geocentric´╝łor world coordinate). I am using placenode->setPosition(geopoint), and placenode->setLocalOffset(vec3d) to update the placenode position.
2LR 2LR
Reply | Threaded
Open this post in threaded view
|

Re: how to draw tracks of moving placenode on 2D projected Map?

If you already have the GeoPoint location (Lat/Lon/Alt), you can do the following to get geocentric location:

GeoPoint point;
osg::Vec3d world;
point.toWorld(world);

Then world.x(), world.y(), world.z() is the ECEF(geocentric) location.

-S