Sorry, but I could not see the error.

On the other hand, maybe you're not setting the capabilities to all the
nodes involved. Why are you checking only SharedGroups ?

You should do something like:

void setCap(Node node)
{
        if (node instanceof Group)
      {
                Enumeration en = ((Group)node).getAllChildren();
                while (en.hasMoreElements())
            {
                setCap((Node)en.nextElement());
            }
      }
        else if (node instanceof Link)
        {
                setCap(((Link)node).getSharedGroup());
        }
        else if (node instanceof Shape3D)
      {
                // do the stuff with the geometries
        } else // ignore the rest because you don't know what it can be,
behaviours, lights, or else...
}

and traverse the entire scene graph that is involved in your app.

Cheers,

Florin

-----Urspr�ngliche Nachricht-----
Von: Philip J Colbert [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 9. Januar 2003 12:26
An: [EMAIL PROTECTED]
Betreff: Re: [JAVA3D] AW: [JAVA3D] VRML setting Capabilities


Thanks that helped

The problem I now have is that I still get the runtime error (below) that I
thought I was solving by setting the capabilities of the individual nodes in
the VRML scene.

using code that basically does the same for each node as I have done for the
geometry e.g.

I walk the tree finding out what nodes I encounter something like this
"value"
 is the 'value' field from an Hashtable of nodes returned from the
Vrml97Loader.

if(value instanceof SharedGroup)
{
    SharedGroup sg = (SharedGroup)value;
    int SG_children = sg.numChildren();
    int LoopSG = 0;
    while(LoopSG < SG_children)
    {
        //Check what type of Node and handle setting capabilities etc
    }// end loop
}



/*This is how I am setting the capabilities*/
Enumeration en = shape2.getAllGeometries();
while (en.hasMoreElements())
{
    Geometry geometry = (Geometry)en.nextElement();
    if (geometry instanceof TriangleArray)
    {
        //doSomethingWithTriangleArrays((TriangleArray)geometry);
        System.out.println("TriangleArray Found"+geometry);
        TriangleArray TA = (TriangleArray)geometry;
        TA.setCapability(GeometryArray.ALLOW_FORMAT_READ);
        TA.setCapability(GeometryArray.ALLOW_COORDINATE_READ);
TA.setCapability(Geo
metryArray.ALLOW_COUNT_READ);
TA.setCapability(GeometryArray.ALLOW_INTERSECT
);                      TA.setCapability(GeometryArray.ALLOW_FORMAT_READ);
        TA.setCapability(GeometryArray.ALLOW_NORMAL_READ);
    }
    else //doSomethingWithGeometry(geometry);
    {
        System.out.println("Something else found "+geometry);
    }
}// end loop

Any Suggestions or comments as what I should be doing?

Yours Phil :)




>===== Original Message From Discussion list for Java 3D API
<[EMAIL PROTECTED]> =====
>The Enumeration you get is an enumeration of Geometry objects. Just use:
>
>Enumeration en = shape.getAllGeometries();
>while (en.hasMoreElements())
>{
>    Geometry geometry = (Geometry)en.nextElement();
>    if (geometry instanceof TriangleArray)
>    {
>        doSomethingWithTriangleArrays((TriangleArray)geometry);
>    }
>    else doSomethingWithGeometry(geometry);
>}
>
>Cheers,
>
>Florin
>
>-----Urspr�ngliche Nachricht-----
>Von: Philip J Colbert [mailto:[EMAIL PROTECTED]]
>Gesendet: Donnerstag, 9. Januar 2003 11:35
>An: [EMAIL PROTECTED]
>Betreff: [JAVA3D] VRML setting Capabilities
>
>
>Hi Everyone
>
>I have a small request.  I am using the XJ3D loader Vrml97Loader to load
>VRML
>shapes into  Java3D.  I ultimatly want to be able to use the PickTool to
>querry the shapes local coordinates and VRWorld coordinates.  To do this I
>need to set the shapes Geometries to ALLOW_COUNT_READ amounst others.  I
>have
>"walked the Tree" down to the Geometries and use the
>shape.getAllGeometries()
>method to return the Geomtry as an Enumeration.  The problem I am having or
>just can't think of how to solve is:- How do I change an Enumeration to a
>GeometryArray (Or TriangleArray in this case)?
>
>I have heard that the VrmlL97Loader has a method that allows the setting of
>Geometries at the loading stage but I have not found any examples of how
>this
>may be done so if there are any examples out there plese point my at them.
>
>Thanks for the help
>
>C YA Phil Colbert :)
>
>Philip J Colbert
>Software Engineer
>RCID, Bruce Building
>University of Newcastle Upon Tyne
>NE1 7RU
>Phone 0191-2225306
>Fax 0191-2225833
>This e-mail, including any attached files, may contain confidential and
>privileged information for the sole use of the intended recipient(s). If
you
>are not the intended recipient, please note that any circulation or copying
>of this e-mail is strictly prohibited. If you have received this e-mail in
>error please contact the sender by reply e-mail and delete all copies of
>this message.
>
>The RCID makes every effort to ensure that this e-mail and any attachments
>are sent virus free. However it is the responsibility of the recipient to
>perform any checks they deem necessary.
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".

Philip J Colbert
Software Engineer
RCID, Bruce Building
University of Newcastle Upon Tyne
NE1 7RU
Phone 0191-2225306
Fax 0191-2225833
This e-mail, including any attached files, may contain confidential and
privileged information for the sole use of the intended recipient(s). If you
are not the intended recipient, please note that any circulation or copying
of this e-mail is strictly prohibited. If you have received this e-mail in
error please contact the sender by reply e-mail and delete all copies of
this message.

The RCID makes every effort to ensure that this e-mail and any attachments
are sent virus free. However it is the responsibility of the recipient to
perform any checks they deem necessary.

==========================================================================To
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

==========================================================================To 
unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to