cascade with Qt QDataStream

I am currently integrating OpenCASCADE into an existing Qt based application. The application currently stores its model files using QDataStream. For compatibility, I would like to continue to do this. Has anyone written a cascade FSD driver that uses a QDataStream? I was planning on creating a modified version of the FSD_BinaryFile, but would save a lot of time if someone else has already done it.

Thanks,
Rob

Francois Lauzon's picture

Hi,
we did something similar here, we based our file format on the Open Cascade BRep format for all TopoDS_Shape related information, so we have QDataStream operators for TopoDS_Shape. Unfortunatly we can't post the code but it's quite easy to rewrite it, look at how they do it for a brep file and build new version of BRepTools_ShapeSet, GeomTools_Curve2dSet, GeomTools_CurveSet, GeomTools_SurfaceSet, ...

It's working great for more than 2 years now.

Good Luck,
Francois.

Rajesh Kishore's picture

Sir
can u plz help me in letting me know how to integrate opencascade with QT.
My id - rajesh.kishore@honeywell.com
Thanking u
rajesh

Rob Bachrach's picture

Although I cannot post the code, I ended up doing as Francois suggested. Copy the following classes (cxx and hxx) from the OpenCASCADE source and modify them to use QDataStream (changing the class names, of course):
- BRepTools_ShapeSet
- GeomTools_Curve2dSet
- GeomTools_CurveSet
- GeomTools_SurfaceSet
- TopTools_LocationSet
- TopTools_ShapeSet

Although annoying, this is a relatively trivial task. You can then write one or more shapes to QDataStream stream with:

MyTopTools_ShapeSet shapeSet;
shapeSet.Add(shape);
shapeSet.Write(stream);
shapeSet.Write(shape, stream);

It's a lot of work, but not hard work. Good luck.
Rob