#include <cadex/Base_String.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_Instance.hxx>
#include <cadex/ModelData_Model.hxx>
#include <cadex/ModelData_Transformation.hxx>
#include <cadex/ModelData_Vector.hxx>
#include <iostream>
#include <stack>
#include "../../cadex_license.cxx"
{
public:
InstancesTransformationsVisitor()
{
myTransformationMatrix.push (anIdentity);
}
protected:
{
}
myTransformationMatrix.push (aCumulativeTrsf);
PrintTransformation (theInstance.
Name());
return true;
}
{
myTransformationMatrix.pop();
}
private:
{
theName = "noName";
}
cout << "Instance " << theName << " has transformations: " << endl;
double v00, v01, v02, v10, v11, v12, v20, v21, v22;
myTransformationMatrix.top().RotationPart (v00, v01, v02, v10, v11, v12, v20, v21, v22);
cout << "| " << v00 << " " << v01 << " " << v02 << " " << aTranslation.X() << " |" << endl <<
"| " << v10 << " " << v11 << " " << v12 << " " << aTranslation.Y() << " |" << endl <<
"| " << v20 << " " << v21 << " " << v22 << " " << aTranslation.Z() << " |" << endl;
}
stack<ModelData_Transformation> myTransformationMatrix;
};
int main (int argc, char *argv[])
{
auto aKey = LicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate CAD Exchanger license." << endl;
return 1;
}
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <input_file>, where:" << endl;
cerr << " <input_file> is a name of the XML file to be read" << endl;
return 1;
}
const char* aSource = argv[1];
if (!aModel.
Open (aSource)) {
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
InstancesTransformationsVisitor aVisitor;
return 0;
}