How to add user defined data?

Hi,
I want to add user defined data to OCC Shapes, i.e. TopoDS_Vertex, TopoDS_Edge, TopoDS_Face, TopoDS_Solid, et, al. But I don't known how to do it without change definition of corresponding classes. It sames OCC provided the mechanism for user defined datas. Could anyone give me some advice for how to do it.

Regard

白晓亮(Bai Xiaoliang)
2005.8.21

白晓亮(Bai Xiaolian's picture

Hi,
No answers! Is it impossible?

Regard

°×ÏþÁÁ(Bai Xiaoliang)

QbProg's picture

I think that you should derive your TopoDS_ classes, ... but I don't know how :)

Bearloga's picture

Hi,
Why don't you associate a data with shapes using some container, like data map?
I think it is the most feasible way.
Cordially

白晓亮(Bai Xiaolian's picture

Hi,
Thanks, It is a useful tip. But How?

Could instance of TopoDS_Vertex, TopoDS_Edge...... be treated as intelligent pointers, and be used as keys of a map. In other words, Is TopoDS_XXX only maintain an pointer of topo and geo data?

Regards

°×ÏþÁÁ(Bai Xiaoliang)

Bearloga's picture

See the package TopTools, it contains the typical instantiations of the generic class TCollection_DataMap. You can instantiate your own class from the template NCollection_DataMap. Two mandatory global functions must be accesible are HashCode and IsEqual, you can define them inline using the methods of TopoDS_Shape.

白晓亮(Bai Xiaolian's picture

Hi,
Thanks.

°×ÏþÁÁ(Bai Xiaoliang)