Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-07 08:35:12

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   //! initializes the plane aComponent. If
0035   //! the mode aCurrentMode equals true, the drawing
0036   //! tool, "Drawer" is not initialized.
0037   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent,
0038                             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,
0046                             const gp_Pnt&             aCenter,
0047                             const Standard_Boolean    aCurrentMode = Standard_False);
0048 
0049   //! initializes the plane aComponent, the
0050   //! point aCenter, and the minimum and maximum
0051   //! points, aPmin and aPmax. If the mode
0052   //! aCurrentMode equals true, the drawing tool, "Drawer" is not initialized.
0053   Standard_EXPORT AIS_Plane(const Handle(Geom_Plane)& aComponent,
0054                             const gp_Pnt&             aCenter,
0055                             const gp_Pnt&             aPmin,
0056                             const gp_Pnt&             aPmax,
0057                             const Standard_Boolean    aCurrentMode = Standard_False);
0058 
0059   Standard_EXPORT AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent,
0060                             const AIS_TypeOfPlane              aPlaneType,
0061                             const Standard_Boolean             aCurrentMode = Standard_False);
0062 
0063   //! Same value for x and y directions
0064   Standard_EXPORT void SetSize(const Standard_Real aValue);
0065 
0066   //! Sets the size defined by the length along the X axis
0067   //! XVal and the length along the Y axis YVal.
0068   Standard_EXPORT void SetSize(const Standard_Real Xval, const Standard_Real YVal);
0069 
0070   Standard_EXPORT void UnsetSize();
0071 
0072   Standard_EXPORT Standard_Boolean Size(Standard_Real& X, Standard_Real& Y) const;
0073 
0074   Standard_Boolean HasOwnSize() const { return myHasOwnSize; }
0075 
0076   //! Sets transform persistence for zoom with value of minimum size
0077   Standard_EXPORT void SetMinimumSize(const Standard_Real theValue);
0078 
0079   //! Unsets transform persistence zoom
0080   Standard_EXPORT void UnsetMinimumSize();
0081 
0082   //! Returns true if transform persistence for zoom is set
0083   Standard_EXPORT Standard_Boolean HasMinimumSize() const;
0084 
0085   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 7; }
0086 
0087   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
0088   {
0089     return AIS_KindOfInteractive_Datum;
0090   }
0091 
0092   //! Returns the component specified in SetComponent.
0093   const Handle(Geom_Plane)& Component() { return myComponent; }
0094 
0095   //! Creates an instance of the plane aComponent.
0096   Standard_EXPORT void SetComponent(const Handle(Geom_Plane)& aComponent);
0097 
0098   //! Returns the settings for the selected plane
0099   //! aComponent, provided in SetPlaneAttributes.
0100   //! These include the points aCenter, aPmin, and aPmax
0101   Standard_EXPORT Standard_Boolean PlaneAttributes(Handle(Geom_Plane)& aComponent,
0102                                                    gp_Pnt&             aCenter,
0103                                                    gp_Pnt&             aPmin,
0104                                                    gp_Pnt&             aPmax);
0105 
0106   //! Allows you to provide settings other than default ones
0107   //! for the selected plane. These include: center point
0108   //! aCenter, maximum aPmax and minimum aPmin.
0109   Standard_EXPORT void SetPlaneAttributes(const Handle(Geom_Plane)& aComponent,
0110                                           const gp_Pnt&             aCenter,
0111                                           const gp_Pnt&             aPmin,
0112                                           const gp_Pnt&             aPmax);
0113 
0114   //! Returns the coordinates of the center point.
0115   const gp_Pnt& Center() const { return myCenter; }
0116 
0117   //! Provides settings for the center theCenter other than (0, 0, 0).
0118   void SetCenter(const gp_Pnt& theCenter) { myCenter = theCenter; }
0119 
0120   //! Allows you to provide settings for the position and
0121   //! direction of one of the plane's axes, aComponent, in
0122   //! 3D space. The coordinate system used is
0123   //! right-handed, and the type of plane aPlaneType is one of:
0124   //! -   AIS_ TOPL_Unknown
0125   //! -   AIS_ TOPL_XYPlane
0126   //! -   AIS_ TOPL_XZPlane
0127   //! -   AIS_ TOPL_YZPlane}.
0128   Standard_EXPORT void SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent,
0129                                          const AIS_TypeOfPlane              aPlaneType);
0130 
0131   //! Returns the position of the plane's axis2 system
0132   //! identifying the x, y, or z axis and giving the plane a
0133   //! direction in 3D space. An axis2 system is a right-handed coordinate system.
0134   Standard_EXPORT Handle(Geom_Axis2Placement) Axis2Placement();
0135 
0136   //! Returns the type of plane - xy, yz, xz or unknown.
0137   AIS_TypeOfPlane TypeOfPlane() { return myTypeOfPlane; }
0138 
0139   //! Returns the type of plane - xy, yz, or xz.
0140   Standard_Boolean IsXYZPlane() { return myIsXYZPlane; }
0141 
0142   //! Returns the non-default current display mode set by SetCurrentMode.
0143   Standard_Boolean CurrentMode() { return myCurrentMode; }
0144 
0145   //! Allows you to provide settings for a non-default
0146   //! current display mode.
0147   void SetCurrentMode(const Standard_Boolean theCurrentMode) { myCurrentMode = theCurrentMode; }
0148 
0149   //! Returns true if the display mode selected, aMode, is valid for planes.
0150   Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer aMode) const
0151     Standard_OVERRIDE;
0152 
0153   //! connection to <aCtx> default drawer implies a recomputation of Frame values.
0154   Standard_EXPORT virtual void SetContext(const Handle(AIS_InteractiveContext)& aCtx)
0155     Standard_OVERRIDE;
0156 
0157   //! Returns the type of sensitivity for the plane;
0158   Select3D_TypeOfSensitivity TypeOfSensitivity() const { return myTypeOfSensitivity; }
0159 
0160   //! Sets the type of sensitivity for the plane.
0161   void SetTypeOfSensitivity(Select3D_TypeOfSensitivity theTypeOfSensitivity)
0162   {
0163     myTypeOfSensitivity = theTypeOfSensitivity;
0164   }
0165 
0166   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
0167                                                 const Standard_Integer theMode) Standard_OVERRIDE;
0168 
0169   Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE;
0170 
0171   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
0172 
0173 private:
0174   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0175                                        const Handle(Prs3d_Presentation)&         thePrs,
0176                                        const Standard_Integer theMode) Standard_OVERRIDE;
0177 
0178   Standard_EXPORT void ComputeFrame();
0179 
0180   Standard_EXPORT void ComputeFields();
0181 
0182   Standard_EXPORT void InitDrawerAttributes();
0183 
0184 private:
0185   Handle(Geom_Plane)          myComponent;
0186   Handle(Geom_Axis2Placement) myAx2;
0187   gp_Pnt                      myCenter;
0188   gp_Pnt                      myPmin;
0189   gp_Pnt                      myPmax;
0190   Standard_Boolean            myCurrentMode;
0191   Standard_Boolean            myAutomaticPosition;
0192   AIS_TypeOfPlane             myTypeOfPlane;
0193   Standard_Boolean            myIsXYZPlane;
0194   Standard_Boolean            myHasOwnSize;
0195   Select3D_TypeOfSensitivity  myTypeOfSensitivity;
0196 };
0197 
0198 DEFINE_STANDARD_HANDLE(AIS_Plane, AIS_InteractiveObject)
0199 
0200 #endif // _AIS_Plane_HeaderFile