[286] | 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(Slash::UI::IUI&); |
---|
| 6 | // void callback_with_arguments(Slash::UI::IUI&, |
---|
| 7 | // const std::vector<std::string>&); |
---|
| 8 | // } |
---|
| 9 | // |
---|
| 10 | |
---|
| 11 | // |
---|
| 12 | // HEPVis and Inventor related callbacks. |
---|
| 13 | // |
---|
| 14 | |
---|
| 15 | #include <OnX/Helpers/OnX.h> |
---|
| 16 | #include <OnX/Helpers/Inventor.h> |
---|
| 17 | |
---|
| 18 | #include <Lib/mmanip.h> |
---|
| 19 | |
---|
| 20 | #include <Inventor/nodes/SoOrthographicCamera.h> |
---|
| 21 | |
---|
| 22 | // HEPVis : |
---|
| 23 | #include <HEPVis/SbMath.h> |
---|
| 24 | #include <HEPVis/nodekits/SoPage.h> |
---|
| 25 | #include <HEPVis/nodekits/SoDisplayRegion.h> |
---|
| 26 | |
---|
| 27 | extern "C" { |
---|
| 28 | |
---|
| 29 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 30 | void ELYSE_eventEnd( |
---|
| 31 | Slash::UI::IUI& aUI |
---|
| 32 | ) |
---|
| 33 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 34 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 35 | { |
---|
| 36 | Slash::Core::ISession& session = aUI.session(); |
---|
| 37 | |
---|
| 38 | std::string event_scan; |
---|
| 39 | session.parameterValue("event.scan",event_scan); |
---|
| 40 | if(event_scan=="no") return; |
---|
| 41 | |
---|
| 42 | SoPage* soPage = ui_SoPage(aUI); |
---|
| 43 | if(!soPage) return; |
---|
| 44 | |
---|
| 45 | SoRegion* soRegion = soPage->currentRegion(); |
---|
| 46 | if(!soRegion) return; |
---|
| 47 | |
---|
| 48 | soRegion->clear("dynamicScene"); |
---|
| 49 | |
---|
| 50 | session.setParameter("modeling.trajectories","pickable"); |
---|
| 51 | //session.setParameter("modeling.trajectories","immediate_all"); |
---|
| 52 | |
---|
| 53 | //JEC 16/1/06 if too much tarjectory: |
---|
| 54 | // FATAL if data_collect commented don't forget to comment data_visualize |
---|
| 55 | |
---|
| 56 | data_collect(session,"Trajectory"); |
---|
| 57 | data_visualize(session); |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | //Enter secondary interactive loop to |
---|
| 61 | // play with the event : |
---|
| 62 | aUI.echo("Play with the event..."); |
---|
| 63 | aUI.steer(); |
---|
| 64 | |
---|
| 65 | } |
---|
| 66 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 67 | void ELYSE_Layout_default( |
---|
| 68 | Slash::UI::IUI& aUI |
---|
| 69 | ) |
---|
| 70 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 71 | // Used in scripts/OnX/Pages.onx |
---|
| 72 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 73 | { |
---|
| 74 | SoPage* soPage = ui_SoPage(aUI); |
---|
| 75 | if(!soPage) return; |
---|
| 76 | |
---|
| 77 | soPage->deleteRegions(); |
---|
| 78 | soPage->titleVisible.setValue(FALSE); |
---|
| 79 | soPage->createRegions("SoDisplayRegion",1,1,0); |
---|
| 80 | |
---|
| 81 | // First region ; side view : |
---|
| 82 | SoRegion* soRegion = soPage->currentRegion(); |
---|
| 83 | if(!soRegion) return; |
---|
| 84 | soRegion->color.setValue(SbColor(0,0,0)); |
---|
| 85 | |
---|
| 86 | // 1 * m : |
---|
| 87 | float size = 300; |
---|
| 88 | |
---|
| 89 | SoCamera* soCamera = soRegion->getCamera(); |
---|
| 90 | if(soCamera->isOfType(SoOrthographicCamera::getClassTypeId())) |
---|
| 91 | ((SoOrthographicCamera*)soCamera)->height.setValue(size); |
---|
| 92 | soCamera->nearDistance.setValue(1); |
---|
| 93 | soCamera->focalDistance.setValue(size); |
---|
| 94 | soCamera->farDistance.setValue(100*size); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | } // extern "C" |
---|