Hi there,
My program must show a set of points,
and every point must have a discriptive string.
The coordinates for the points are in a
SoVertexProperty-Node.
I tried to use the same coordinates for the
SoText2, but the result is not like I
have expected.
I would be very happy, if someone
can help me to isolate my error,
or show me a different way to reach
my goal.
By the way I have to use
Coin3D [Coin-1.0.2]
SoQt [SoQt-0.10.0]
Qt [non-commercial Qt version 2.3.0]
under Windows98Se.
here you can look at screenshots:
http://home.tu-clausthal.de/~ifrh/zoom_out.gif
http://home.tu-clausthal.de/~ifrh/zoom_in.gif
here is a code fragment:
void PointSetHandler::set2DText (std::string text, double x, double y,
double z)
{
// add the Text for the Point to the Scenegraph
const char * temp3= text.c_str();
SoText2 *PktText = new SoText2;
PktText->string= temp3;
mySeparator->addChild(PktText);
SoTranslation *PktTextTranslate = new SoTranslation;
PktTextTranslate->translation.setValue(x,y,z);
mySeparator->addChild(PktTextTranslate);
}
In the main program I create the points like:
Note that lsgPoints is an instance of the class PointSetHandler.
[...]
// copy all points into a VertexProperty node
SoVertexProperty* myLsgPoints = new SoVertexProperty();
myLsgPoints->vertex.setNum(Geo->getgeoLsgPunkte()->size());
for (int i=0; i<Geo->getgeoLsgPunkte()->size(); i++)
{
myLsgPoints->vertex.set1Value(i,
(*(Geo->getgeoLsgPunkte()))[i].getXY_Koord()->x,
(*(Geo->getgeoLsgPunkte()))[i].getXY_Koord()->y,
(*(Geo->getgeoLsgPunkte()))[i].getXY_Koord()->z);
}
// set the lsgPoints node
lsgPoints->setVertexProperty(myLsgPoints);
lsgPoints->setNum(Geo->getgeoLsgPunkte()->size());
lsgPoints->setColor(1.0,0.0,0.0);
lsgPoints->setPointWidth(6);
for (int i=0; i<Geo->getgeoLsgPunkte()->size(); i++)
{
float x, y, z;
myLsgPoints->vertex[i].getValue(x, y, z);
string AnzeigeText=
(*(*(AuswerterPtr->getDatensaetze()))[DSNr].getLoesungspunktPtr())[i].getName();
lsgPoints->set2DText(AnzeigeText, x, y, z);
}
[...]
Thanks for your help.
Greetings
Robert Hartmann


|