source: head/source/InventorCallbacks.cxx @ 1

Last change on this file since 1 was 1, checked in by barrand, 17 years ago
File size: 2.4 KB
Line 
1//
2//  All functions here should be OnX callbacks, that is to say
3// functions with signature :
4//   extern "C" {
5//     void callback_without_arguments(IUI&);
6//     void callback_with_arguments(IUI&,const std::vector<std::string>&);
7//   }
8//
9
10//
11// HEPVis and Inventor related callbacks.
12//
13
14#include <OnX/Helpers/OnX.h>
15#include <OnX/Helpers/Inventor.h>
16
17#include <Lib/mmanip.h>
18
19#include <Inventor/nodes/SoOrthographicCamera.h>
20
21// HEPVis :
22#include <HEPVis/nodekits/SoPage.h>
23#include <HEPVis/nodekits/SoDisplayRegion.h>
24
25extern "C" {
26
27//////////////////////////////////////////////////////////////////////////////
28void snovis_eventEnd(
29 Slash::UI::IUI& aUI
30) 
31//////////////////////////////////////////////////////////////////////////////
32//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
33{
34  Slash::Core::ISession& session = aUI.session();
35
36  SoPage* soPage = ui_SoPage(aUI);
37  if(!soPage) return;
38
39  SoRegion* soRegion = soPage->currentRegion();
40  if(!soRegion) return;
41
42  soRegion->clear("dynamicScene");
43
44  //data_collect(session,"Trajectory","particle==\"gamma\"");
45  //data_collect(session,"Trajectory","particle==\"e-\"");
46  //data_collect(session,"Trajectory","particle==\"e+\"");
47
48  data_collect(session,"Trajectory");
49  data_visualize(session);
50
51  std::string svalue;
52  if(!session.parameterValue("modeling.trajectories",svalue)) return;
53
54  if( (svalue=="immediate_all") || 
55      (svalue=="immediate_time") ||
56      (svalue=="pickable") ) {
57    std::string event_scan;
58    session.parameterValue("event.scan",event_scan);
59    if(event_scan=="yes") {
60      //Enter secondary interactive loop to
61      // play with the event :
62      aUI.echo("Play with the event...");
63      aUI.steer();
64    } else {
65      aUI.synchronize();
66    }
67  }
68}
69//////////////////////////////////////////////////////////////////////////////
70void snovis_Page_create(
71 Slash::UI::IUI& aUI
72) 
73//////////////////////////////////////////////////////////////////////////////
74//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
75{
76  SoPage* soPage = ui_SoPage(aUI);
77  if(!soPage) return;
78
79  soPage->deleteRegions();
80  soPage->titleVisible.setValue(FALSE);
81  soPage->title.setValue("snovis");
82  soPage->createRegions("SoDisplayRegion",1,1,0);
83
84  SoRegion* soRegion = soPage->currentRegion();
85  if(!soRegion) return;
86
87  soRegion->color.setValue(SbColor(0,0,0));
88}
89
90
91} // extern "C"
Note: See TracBrowser for help on using the repository browser.