Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Inventor API > Adding SoText2 ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 418 of 500
Post > Topic >>

Adding SoText2 to positions of SoVertexProperty

by Robert Hartmann <Robert.Hartmann@[EMAIL PROTECTED] > Aug 25, 2005 at 09:00 PM

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
 




 2 Posts in Topic:
Adding SoText2 to positions of SoVertexProperty
Robert Hartmann <Rober  2005-08-25 21:00:05 
Re: Adding SoText2 to positions of SoVertexProperty
Robert Hartmann <Rober  2005-08-29 11:06:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 20 4:15:20 CDT 2008.