MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoCSO/CSOProcessor/CSOPrimitiveProcessor/CSOPrimitiveProcessor.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00005 
00010 //----------------------------------------------------------------------------------
00011 
00012 #ifndef __CSOPrimitiveProcessor_H
00013 #define __CSOPrimitiveProcessor_H
00014 
00015 
00016 #include "SoCSOSystem.h"
00017 #include "CSOProcessor/CSOProcessor.h"
00018 
00019 
00020 ML_START_NAMESPACE
00021 
00023 
00025 enum PRIMITIVE_TYPE {
00026   PRIMITIVE_RECT    = 0, 
00027   PRIMITIVE_ELLIPSE = 1  
00028 };
00029 
00031 
00032 static const char* PrimitiveTypes[2] = {"Rectangle", "Ellipse"}; 
00033 
00035 
00036 static const char* SUB_TYPE_RECT    = "SUB_TYPE_RECT";    
00037 static const char* SUB_TYPE_ELLIPSE = "SUB_TYPE_ELLIPSE"; 
00038 
00040 
00043 class SOCSO_EXPORT CSOPrimitiveProcessor : public CSOProcessor
00044 {
00045 
00046 public:
00047 
00049   CSOPrimitiveProcessor();
00050 
00053   virtual bool process(CSOEvalEventView2DInfos view2DInfos, CSOEvalEventCSOInfos csoInfos);
00054 
00057   virtual bool needsMemoryImage();
00059   virtual void setMemoryImage(float* imageData, int sizex, int sizey, int voxelPosZ,  
00060                               float* voxelToWorldMatrix, float* worldToVoxelMatrix, 
00061                               View2DSliceList* slicelist);
00062 
00064   bool isCurrentlyGenerating();
00066   bool isCurrentlyEditing();
00068   virtual void resetInteractionState();
00070   virtual void triggerSetMouseCursor(SoView2D* view2d, bool shouldSetMouseCursor);
00071 
00072 protected:
00073 
00075   virtual ~CSOPrimitiveProcessor();
00076 
00077 private:
00078 
00079   /* FIELDS */
00080 
00082   EnumField* _primitiveTypeFld;
00083 
00085   BoolField* _createIsotropicPrimitiveFld;
00087   BoolField* _createFromCenterFld;
00088 
00089 
00090   /* STATE VARIABLES */    
00091 
00093   CSOList* _csoList;
00095   Vector3 _moveStartPosition;
00097   Vector3 _lastCurrentPosition;
00099   CSO* _currentlyActiveCSO;
00101   CSOSeedPoint* _currentlyActiveSeedPoint;
00103   CSOSeedPoint* _cornerSeedPoint[4];
00104 
00106   bool _isMovingSeedPoint;
00108   bool _isGeneratingCSO;
00110   bool _hasJustBegunMovingSeedPoint;
00113   bool _notMovingInSlice;
00114 
00116   SbVec3f _sliceNormal0;
00118   SbVec3f _sliceNormal1;
00120   SbVec3f _sliceNormal2;
00121 
00122 
00123   /* METHODS */
00124 
00127   void _interpolate();
00130   void _computeDifferenceVectors(const Vector3& dif, Vector3& difX, Vector3& difY, bool shouldCreateIsotropic);
00131 
00132   ML_MODULE_CLASS_HEADER(CSOPrimitiveProcessor);
00133 };
00134 
00136 
00137 
00138 ML_END_NAMESPACE
00139 
00140 #endif // __CSOPrimitiveProcessor_H