Try using the isOfType() method for the SoNode(SoBase).
if (tmp_sep->isOfType(oCube::getClassTypeId()) {
// do something...
}
-----Original Message-----
From: Jarek Rzepecki [mailto:jarekr@xxxxxxxx]
Sent: Monday, September 17, 2001 3:13 PM
To: info-inventor@xxxxxxxxxxx
Subject: getClassTypeId problem...
Hi!
I have a problem with getClassTypeId. Below is a piece of code. It
compiles well but it doesn't work well...
void create_trace(SoSeparator* OIVparent){
SoNode* tmp_sep;
int num_child = OIVparent->getNumChildren();
for (int i = 0; i<num_child; i++){
tmp_sep = OIVparent->getChild(i);
if (tmp_sep->getClassTypeId() == SoCube::getClassTypeId()){
//do something...
}
}
}
num_child is ok, but the tmp_sep = OIVparent->getChild(i) act strange (i
think...) looking in debug tmp_sep is always "incomplate type" , what is
more the compareation in "if" line is always false.
What am i doeing wrong?
In general i would like to extract information about all children (are
thay separator, shape , transformation etc...) i need it to build another
geometry tree.
Thank you.
- jarek
Jaroslaw Rzepecki
Fermilab
23 Neuqua
P O Box 500
Batavia, IL 60510
USA
BD/Beam Physics Dept.
630-840-4309 (office)
630-840-4239 (home)
e-mail: jarekr@xxxxxxxx
or : jarekr@xxxxxxxxxxxxxxxxx
|