bool
ArTrackOrientation::_readXML(ArRef<XmlNode> node)
{
if (node->getName()!="TrackOrientation")
  return(ArKeyFrameTrack::_readXML(node));
  
double duration;
int degree;
node->getPropertyReal("duration",duration);
node->getPropertyInteger("degree",degree);
_track->setDuration(duration);
_track->setDegree(degree);

int dim;
if (!node->getPropertyInteger("dimension",dim))
  {
  cerr << "Missing dimensions specification" << endl;
  return(false);
  }
if (dim!=4)
  {
  cerr << "Bad track dimension " << dim << "!=4" << endl;
  return(false);
  }
  
_track->clearKeyFrames();
    
ArRef<XmlNode> keyFrame=node->getFirstChild();   
while(keyFrame)
  {
  if (keyFrame->getName()=="KeyFrameOrientation")
    {
    int frame;
    if (!keyFrame->getPropertyInteger("frame",frame))
      {
      cerr << "Invalid keyFrame misssing frame info"<< endl;
      return(false);
      }
      
    
    double angle;
    double xx,yy,zz;
    bool ok=true;
    if(!keyFrame->getPropertyReal("vx",xx))
      ok = false;
    if(!keyFrame->getPropertyReal("vy",yy))
      ok = false;
    if(!keyFrame->getPropertyReal("vz",zz))
      ok = false;
    if(!keyFrame->getPropertyReal("angle",angle))
      ok = false;
    
    if(!ok)
    {
        cerr << "Error reading orientation infos (vx,vy,vz,angle)" << endl;
        return(false);
    }
    
    Vector3d axis(xx,yy,zz);
    
/*    if (!keyFrame->getPropertyReal("vx",axis.accessVector()[0]) ||
        !keyFrame->getPropertyReal("vy",axis.accessVector()[1]) ||
        !keyFrame->getPropertyReal("vz",axis.accessVector()[2]) ||
        !keyFrame->getPropertyReal("angle",angle))
               
       {
        cerr << "Error reading orientation infos (vx,vy,vz,angle)" << endl;
        return(false);
       }*/
    
    setKeyFrame(frame,axis,angle);
    //cerr << "kf=" << frame << "   axis=" << axis << "   angme=" << angle << endl;
    }
  keyFrame=keyFrame->getNext();
  }
return(true);
}