hello,
i have a heirarchical set of data which is created from the following simplified class defintion:
class Extent
{
vector<Surface*>m_pSurfaces;
vector<Extent*>m_pExtents;
};
CMyAppDoc.cpp:
Extent *globalExtent=new Extent();
...
as can be seen: extents can have surfaces, and other extents.
the best way to represent this data is to use a CTreeCtrl class. this appears in a dialog with add surface, add extent, remove item buttons. i have never programmed such a complex data structure with a tree-view before and am having difficulty acquiring pointers to my data objects when they are selected in the tree view. every item in the tree view corresponds to an item in the globalExtent data heirarchy.
one way to get the pointer i thought would be to associate a HTREEITEM to each surface and extent - that way, when a CTreeCtrl item was selected i could use GetSelectedItem to get the selected HTREEITEM and search my globalExtent heirarchy for a match. This would not be a good idea though due to the search required - a large globalExtent heirarchy will require a time-consuming search.
I wondered if anyone had come across a similar situation and if so how they solved the problem.
Any help is grately appreciated.
Thanks,
Paul.
i have a heirarchical set of data which is created from the following simplified class defintion:
class Extent
{
vector<Surface*>m_pSurfaces;
vector<Extent*>m_pExtents;
};
CMyAppDoc.cpp:
Extent *globalExtent=new Extent();
...
as can be seen: extents can have surfaces, and other extents.
the best way to represent this data is to use a CTreeCtrl class. this appears in a dialog with add surface, add extent, remove item buttons. i have never programmed such a complex data structure with a tree-view before and am having difficulty acquiring pointers to my data objects when they are selected in the tree view. every item in the tree view corresponds to an item in the globalExtent data heirarchy.
one way to get the pointer i thought would be to associate a HTREEITEM to each surface and extent - that way, when a CTreeCtrl item was selected i could use GetSelectedItem to get the selected HTREEITEM and search my globalExtent heirarchy for a match. This would not be a good idea though due to the search required - a large globalExtent heirarchy will require a time-consuming search.
I wondered if anyone had come across a similar situation and if so how they solved the problem.
Any help is grately appreciated.
Thanks,
Paul.