Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:55

0001 // Created on: 1995-08-02
0002 // Created by: Arnaud BOUZY/Odile Olivier
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _AIS_Plane_HeaderFile
0018 #define _AIS_Plane_HeaderFile
0019 
0020 #include <AIS_InteractiveObject.hxx>
0021 #include <AIS_TypeOfPlane.hxx>
0022 #include <gp_Pnt.hxx>
0023 #include <Select3D_TypeOfSensitivity.hxx>
0024 
0025 class Geom_Plane;
0026 class Geom_Axis2Placement;
0027 
0028 //! Constructs plane datums to be used in construction of
0029 //! composite shapes.
0030 class AIS_Plane : public AIS_InteractiveObject
0031 {
0032   DEFINE_STANDARD_RTTIEXT(AIS_Plane, AIS_InteractiveObject)
0033 public:
0034 
0035   //! initializes the plane aComponent. If
0036   //! the mode aCurrentMode equals true, the drawing
0037   //! tool, "Drawer" is not initialized.
0038   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const Standard_Boolean aCurrentMode = Standard_False);
0039   
0040   //! initializes the plane aComponent and
0041   //! the point aCenter. If the mode aCurrentMode
0042   //! equals true, the drawing tool, "Drawer" is not
0043   //! initialized. aCurrentMode equals true, the drawing
0044   //! tool, "Drawer" is not initialized.
0045   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const Standard_Boolean aCurrentMode = Standard_False);
0046   
0047   //! initializes the plane aComponent, the
0048   //! point aCenter, and the minimum and maximum
0049   //! points, aPmin and aPmax. If the mode
0050   //! aCurrentMode equals true, the drawing tool, "Drawer" is not initialized.
0051   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const gp_Pnt& aPmin, const gp_Pnt& aPmax, const Standard_Boolean aCurrentMode = Standard_False);
0052   
0053   Standard_EXPORT AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfPlane aPlaneType, const Standard_Boolean aCurrentMode = Standard_False);
0054   
0055   //! Same value for x and y directions
0056   Standard_EXPORT void SetSize (const Standard_Real aValue);
0057   
0058   //! Sets the size defined by the length along the X axis
0059   //! XVal and the length along the Y axis YVal.
0060   Standard_EXPORT void SetSize (const Standard_Real Xval, const Standard_Real YVal);
0061   
0062   Standard_EXPORT void UnsetSize();
0063   
0064   Standard_EXPORT Standard_Boolean Size (Standard_Real& X, Standard_Real& Y) const;
0065 
0066   Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
0067 
0068   //! Sets transform persistence for zoom with value of minimum size
0069   Standard_EXPORT void SetMinimumSize (const Standard_Real theValue);
0070 
0071   //! Unsets transform persistence zoom
0072   Standard_EXPORT void UnsetMinimumSize();
0073 
0074   //! Returns true if transform persistence for zoom is set
0075   Standard_EXPORT Standard_Boolean HasMinimumSize() const;
0076 
0077   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 7; }
0078 
0079   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
0080   
0081   //! Returns the component specified in SetComponent.
0082   const Handle(Geom_Plane)& Component() { return myComponent; }
0083 
0084   //! Creates an instance of the plane aComponent.
0085   Standard_EXPORT void SetComponent (const Handle(Geom_Plane)& aComponent);
0086   
0087   //! Returns the settings for the selected plane
0088   //! aComponent, provided in SetPlaneAttributes.
0089   //! These include the points aCenter, aPmin, and aPmax
0090   Standard_EXPORT Standard_Boolean PlaneAttributes (Handle(Geom_Plane)& aComponent, gp_Pnt& aCenter, gp_Pnt& aPmin, gp_Pnt& aPmax);
0091   
0092   //! Allows you to provide settings other than default ones
0093   //! for the selected plane. These include: center point
0094   //! aCenter, maximum aPmax and minimum aPmin.
0095   Standard_EXPORT void SetPlaneAttributes (const Handle(Geom_Plane)& aComponent, const gp_Pnt& aCenter, const gp_Pnt& aPmin, const gp_Pnt& aPmax);
0096 
0097   //! Returns the coordinates of the center point.
0098   const gp_Pnt& Center() const { return myCenter; }
0099 
0100   //! Provides settings for the center theCenter other than (0, 0, 0).
0101   void SetCenter (const gp_Pnt& theCenter) { myCenter = theCenter; }
0102 
0103   //! Allows you to provide settings for the position and
0104   //! direction of one of the plane's axes, aComponent, in
0105   //! 3D space. The coordinate system used is
0106   //! right-handed, and the type of plane aPlaneType is one of:
0107   //! -   AIS_ TOPL_Unknown
0108   //! -   AIS_ TOPL_XYPlane
0109   //! -   AIS_ TOPL_XZPlane
0110   //! -   AIS_ TOPL_YZPlane}.
0111   Standard_EXPORT void SetAxis2Placement (const Handle(Geom_Axis2Placement)& aComponent, const AIS_TypeOfPlane aPlaneType);
0112   
0113   //! Returns the position of the plane's axis2 system
0114   //! identifying the x, y, or z axis and giving the plane a
0115   //! direction in 3D space. An axis2 system is a right-handed coordinate system.
0116   Standard_EXPORT Handle(Geom_Axis2Placement) Axis2Placement();
0117   
0118   //! Returns the type of plane - xy, yz, xz or unknown.
0119   AIS_TypeOfPlane TypeOfPlane() { return myTypeOfPlane; }
0120 
0121   //! Returns the type of plane - xy, yz, or xz.
0122   Standard_Boolean IsXYZPlane() { return myIsXYZPlane; }
0123 
0124   //! Returns the non-default current display mode set by SetCurrentMode.
0125   Standard_Boolean CurrentMode() { return myCurrentMode; }
0126 
0127   //! Allows you to provide settings for a non-default
0128   //! current display mode.
0129   void SetCurrentMode (const Standard_Boolean theCurrentMode) { myCurrentMode = theCurrentMode; }
0130 
0131   //! Returns true if the display mode selected, aMode, is valid for planes.
0132   Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
0133   
0134   //! connection to <aCtx> default drawer implies a recomputation of Frame values.
0135   Standard_EXPORT virtual void SetContext (const Handle(AIS_InteractiveContext)& aCtx) Standard_OVERRIDE;
0136 
0137   //! Returns the type of sensitivity for the plane;
0138   Select3D_TypeOfSensitivity TypeOfSensitivity() const { return myTypeOfSensitivity; }
0139 
0140   //! Sets the type of sensitivity for the plane.
0141   void SetTypeOfSensitivity (Select3D_TypeOfSensitivity theTypeOfSensitivity) { myTypeOfSensitivity = theTypeOfSensitivity; }
0142 
0143   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode) Standard_OVERRIDE;
0144 
0145   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
0146 
0147   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
0148 
0149 private:
0150 
0151   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0152                                         const Handle(Prs3d_Presentation)& thePrs,
0153                                         const Standard_Integer theMode) Standard_OVERRIDE;
0154 
0155   Standard_EXPORT void ComputeFrame();
0156 
0157   Standard_EXPORT void ComputeFields();
0158 
0159   Standard_EXPORT void InitDrawerAttributes();
0160 
0161 private:
0162 
0163   Handle(Geom_Plane) myComponent;
0164   Handle(Geom_Axis2Placement) myAx2;
0165   gp_Pnt myCenter;
0166   gp_Pnt myPmin;
0167   gp_Pnt myPmax;
0168   Standard_Boolean myCurrentMode;
0169   Standard_Boolean myAutomaticPosition;
0170   AIS_TypeOfPlane myTypeOfPlane;
0171   Standard_Boolean myIsXYZPlane;
0172   Standard_Boolean myHasOwnSize;
0173   Select3D_TypeOfSensitivity myTypeOfSensitivity;
0174 
0175 };
0176 
0177 DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject)
0178 
0179 #endif // _AIS_Plane_HeaderFile