For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

TDocStd_Document

Shawn Chang's picture
Forums: 

Hi:
According to the online document, it mentions about the main function that can get the main label entry 0:1 in TDocStd_Document. How about 0:2? Does it exists? Thanks a lot.

Best regards,
Shawn

fhchina's picture

Hi,

Simply you should always use TDocStd_Document::Main(), i.e. 0:1 as your root label. OCAF perhaps use 0:2 or other label to do their own task.

regards,
fhchina

Shawn Chang's picture

Hi:
I think I can create the entry 0:2 using TDF_Data(I guess). But, I don't have any ideal to think
TPrsStd_AISViewer::New(myOcafDoc->Main(),myViewer);
The myOcafDoc->Main() always is FindChild(1) that is fixed. If I want to have both 0:1 and 0:2 in myViewer. How?? Thanks a lot.

Best regards,
Shawn

fhchina's picture

Hi,

Of course you can allocate 0:2. I mean since OCAF designer let us use Main(), they may want to perserve(maybe) 0:2 for OCAF internal usage.

You can assocaited multi AISViewer attribute to a same DF, but I think to allocate 0:1:1 as you second Viewer is a good practice.

In one word, you should allocate your any TDF_Label under Main() as possible, it may not conflict with any (future) OCAF implementation.

regards,
fhchina

Shawn Chang's picture

Hi:
I have done something as following. It seems so far so good.

TPrsStd_AISViewer::New(myOcafDoc->GetData(),myViewer);

The function GetData() is retrieved back the root 0.

Then,
Handle(AIS_InteractiveContext) CTX;
TPrsStd_AISViewer::Find(myStarsDoc->Main(), CTX);

TPrsStd_AISViewer::Find(myStarsDoc->GetData().FindChild(2,Standard_True), CTX);

CTX->SetDisplayMode(AIS_WireFrame);
myAISContext=CTX;

// Set the maximum number of available "undo" actions
myStarsDoc->SetUndoLimit(10);

TDataStd_TreeNode::Set(myStarsDoc->Main());
TDataStd_TreeNode::Set(myStarsDoc->GetData().FindChild(2,Standard_True));
//Create the name attribute defined by the name "Main".
TDataStd_Name::Set(myStarsDoc->Main(), TCollection_ExtendedString("Main"));
TDataStd_Name::Set(myStarsDoc->GetData().FindChild(2,Standard_True)), TCollection_ExtendedString("Second"));

I haven't tested to save or saveas "TDocStd_Document"(myStarsDoc). But, I don't think that is a problem. I can success to create 0:2 treenode to show on the CTreeCtrl. Thanks for all.

Best regards,
Shawn

Rajendra's picture

hi everyone,
On the concern with the CTreeCtrl display and OCC TDataStd_TreeNode mapping, I would like to know your experience.
How to map between these two trees? through map or there is better solution.

Serge's picture

Before you put TPrsStd_AISViewer on any label except root 0: consider the next point:
TPrsStd_AISPresentation won't work correctly if the AISViewer is not located on the root label. Both methods AISViewer::New put the attribute on the root label of a data structure referenced by a label
given as a first argument of the method New.
All mention above concerns also methods Find.

Regards,
Serge

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.