MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoCSO/SoView2DCSOEditor/SoView2DCSOExtensibleEditor/extensions/SoCSOCrossSectionRenderer/SoCSOCrossSectionRenderer.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00009 //----------------------------------------------------------------------------------
00010 
00011 
00012 #ifndef __SoCSOCrossSectionRenderer_H
00013 #define __SoCSOCrossSectionRenderer_H
00014 
00015 
00016 #include <SoView2DCSOEditor/SoView2DCSOExtensibleEditor/SoCSOGeneralRendererEditorExtension.h>
00017 
00018 
00020 
00022 class SOCSO_EXPORT SoCSOCrossSectionRenderer : public SoCSOGeneralRendererEditorExtension
00023 {
00024   SO_NODE_HEADER(SoCSOCrossSectionRenderer);
00025 
00026 public:
00027 
00029   SoCSOCrossSectionRenderer();
00030 
00032   virtual void draw(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos, const CSODrawSliceInformation& drawSliceInfo, SoView2DCSOExtensibleEditor* editor);
00033   virtual void draw(const CSODrawCSOInfos& , const CSODrawView2DInfos& , SoView2DCSOExtensibleEditor* ){}
00034 
00036   static void initClass();
00037 
00038   virtual void createStartPressAt(const SoPointerPosition& ) {}
00039   virtual void createDragMoveTo(const SoPointerPosition& ) {}
00040   virtual bool createEndPress(int ) { return false; }
00041 
00042   virtual void selectAndMoveStartPressAt(const SoPointerPosition& ) {}
00043   virtual void selectAndMoveDragMoveTo(const SoPointerPosition& ) {}
00044   virtual SoPointingAction* selectAndMoveEndPress(int ) { return NULL; }
00045 
00046   virtual int cursorShape() const { return SoViewerProxy::DEFAULT_CURSOR; }
00047 
00048   virtual bool shouldRenderGeneral(ml::CSO*) const { return true; }
00049 
00050   SoSFBool useHoleCorrection;
00051   SoSFBool useHoleCorrectionForGroupsOnly;
00052   SoSFEnum fillingFromSideLineWidthMode;
00053   SoSFFloat fillingFromSideManualLineWidth;
00054   
00055   struct CrossingPoint 
00056   {
00057     CrossingPoint()
00058     {
00059       x = y = -1;
00060     }
00061     double x,y;
00062   };
00063 
00064 protected:  
00065 
00066 private:
00067 
00068   struct CSOCrossings 
00069   {
00070     CSOCrossings() 
00071     {
00072       cso = NULL;
00073       sorted = false;
00074       needsFilling = false;
00075     }
00076     std::vector < CrossingPoint > crossingPoints;
00077     ml::CSO* cso;
00078     bool sorted;
00079     bool needsFilling;
00080   };
00081 
00082   std::vector<CSOCrossings> crossings;
00083 
00084   bool intersectionSegmentPlane(const ml::Vector3& segmentPoint1, const ml::Vector3& segmentPoint2, 
00085                                 const ml::Vector3& planePoint,    const ml::Vector3& planeNormal,
00086                                 SbVec3f& intersectionPoint);
00087 
00088   void glDrawRect(float startX, float startY, float endX, float endY, float lineWidth);
00089 };
00090 
00092 
00093 #endif // __SoCSOCrossSectionRenderer_H