MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoCSO/SoView2DCSOEditor/SoView2DCSOExtensibleEditor/extensions/SoCSOSplineEditor/SoCSOSplineEditor.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00009 //----------------------------------------------------------------------------------
00010 
00011 
00012 #ifndef __SoCSOSplineEditor_H
00013 #define __SoCSOSplineEditor_H
00014 
00015 #include <SoView2DCSOEditor/SoView2DCSOExtensibleEditor/SoCSOLineCreatorEditorExtension.h>
00016 
00018 
00020 class SOCSO_EXPORT SoCSOSplineEditor : public SoCSOLineCreatorEditorExtension
00021 {
00022   SO_NODE_HEADER(SoCSOSplineEditor);
00023 
00024 public:
00025 
00027   SoCSOSplineEditor();
00028 
00030   static void initClass();
00031 
00033   SoSFBool useFreehandMode;
00035   SoSFEnum doubleClickMode;
00036 
00037   virtual void createStartPressAt(const SoPointerPosition& pos);
00038 
00039   void createNewCSO( const SoPointerPosition& pos );
00040   virtual void createDragMoveTo(const SoPointerPosition& pos);
00041   virtual bool createEndPress(int clickCount);
00042 
00043   virtual void pointerPosition(const SoPointerPosition& pos);
00044 
00045   virtual void selectAndMoveStartPressAt(const SoPointerPosition& pos);
00046   virtual void selectAndMoveDragMoveTo(const SoPointerPosition& pos);
00047   virtual SoPointingAction* selectAndMoveEndPress(int clickCount);
00048 
00049   virtual void insertSeedPointStartPressAt(const SoPointerPosition& pos);
00050   virtual void insertSeedPointDragMoveTo(const SoPointerPosition& pos);
00051   virtual SoPointingAction* insertSeedPointEndPress(int clickCount);
00052 
00053   virtual int cursorShape() const { return _cursorShape; }
00054 
00055   virtual bool deleteSeedPoint(ml::CSO* cso, ml::CSOSeedPoint* seedPoint);
00056 
00057   virtual void cancel();
00058 
00059 protected:
00060 
00061   ml::Vector3 getCurrentPositon(const SoPointerPosition& pos);
00062 
00063 private:
00064 
00065   enum CSO_REACT_ON_DOUBLE_CLICK
00066   {
00067     CSO_SPLINE_EDITOR_DOUBLE_CLICK_SET_SINGLE_SEED = 0, 
00068     CSO_SPLINE_EDITOR_DOUBLE_CLICK_SET_DOUBLE_SEEDS,    
00069     CSO_SPLINE_EDITOR_DOUBLE_CLICK_FINISH,              
00070     CSO_SPLINE_EDITOR_DOUBLE_CLICK_CLOSE                
00071   };
00072 
00073   void interpolateCSO(ml::CSO* cso);
00074   bool couldCloseCSO(const SoPointerPosition& pos, ml::CSO* cso);
00075   void checkCanCloseAndSetCursorShape(const SoPointerPosition& pos, ml::CSO* cso);
00076   float getFirstLastSeedPointDeviceDistance(const SoPointerPosition& pos, ml::CSO* cso) const;  
00077 
00078   SbVec3f     _startPosition;
00079   ml::Vector3 _currentPosition;
00080 
00081   int _cursorShape;
00082 
00083   bool _couldCloseCurrentCSO;
00084 };
00085 
00087 
00088 #endif // __SoCSOSplineEditor_H