Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-16 08:27:49

0001 // Created on: 1995-08-09
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_Axis_HeaderFile
0018 #define _AIS_Axis_HeaderFile
0019 
0020 #include <AIS_InteractiveObject.hxx>
0021 #include <AIS_TypeOfAxis.hxx>
0022 #include <gp_Dir.hxx>
0023 #include <gp_Pnt.hxx>
0024 #include <SelectMgr_Selection.hxx>
0025 
0026 class Geom_Line;
0027 class Geom_Axis1Placement;
0028 class Geom_Axis2Placement;
0029 class Prs3d_LineAspect;
0030 
0031 //! Locates the x, y and z axes in an Interactive Object.
0032 //! These are used to orient it correctly in presentations
0033 //! from different viewpoints, or to construct a revolved
0034 //! shape, for example, from one of the axes. Conversely,
0035 //! an axis can be created to build a revolved shape and
0036 //! then situated relative to one of the axes of the view.
0037 class AIS_Axis : public AIS_InteractiveObject
0038 {
0039   DEFINE_STANDARD_RTTIEXT(AIS_Axis, AIS_InteractiveObject)
0040 public:
0041   //! Initializes the line aComponent
0042   Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent);
0043 
0044   //! initializes the axis2 position
0045   //! aComponent. The coordinate system used is right-handed.
0046   Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent,
0047                            const AIS_TypeOfAxis               anAxisType);
0048 
0049   //! Initializes the axis1 position anAxis.
0050   Standard_EXPORT AIS_Axis(const Handle(Geom_Axis1Placement)& anAxis);
0051 
0052   //! Initializes the ray as axis with start point and direction
0053   //! @param[in] theAxis Start point and direction of the ray
0054   //! @param[in] theLength Optional length of the ray (ray is infinite by default).
0055   Standard_EXPORT AIS_Axis(const gp_Ax1& theAxis, const Standard_Real theLength = -1);
0056 
0057   //! Returns the axis entity aComponent and identifies it
0058   //! as a component of a shape.
0059   const Handle(Geom_Line)& Component() const { return myComponent; }
0060 
0061   //! Sets the coordinates of the lin aComponent.
0062   Standard_EXPORT void SetComponent(const Handle(Geom_Line)& aComponent);
0063 
0064   //! Returns the position of axis2 and   positions it by
0065   //! identifying it as the x, y, or z axis and giving its
0066   //! direction in 3D space. The coordinate system used is right-handed.
0067   const Handle(Geom_Axis2Placement)& Axis2Placement() const { return myAx2; }
0068 
0069   //! Allows you to provide settings for aComponent:the
0070   //! position and direction of an axis in 3D space. The
0071   //! coordinate system used is right-handed.
0072   Standard_EXPORT void SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent,
0073                                          const AIS_TypeOfAxis               anAxisType);
0074 
0075   //! Constructs a new line to serve as the axis anAxis in 3D space.
0076   Standard_EXPORT void SetAxis1Placement(const Handle(Geom_Axis1Placement)& anAxis);
0077 
0078   //! Returns the type of axis.
0079   AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; }
0080 
0081   //! Constructs the entity theTypeAxis to stock information
0082   //! concerning type of axis.
0083   void SetTypeOfAxis(const AIS_TypeOfAxis theTypeAxis) { myTypeOfAxis = theTypeAxis; }
0084 
0085   //! Returns a signature of 2 for axis datums. When you
0086   //! activate mode 2 by a signature, you pick AIS objects
0087   //! of type AIS_Axis.
0088   Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; }
0089 
0090   //! Returns true if the interactive object accepts the display mode aMode.
0091   Standard_EXPORT Standard_Boolean
0092     AcceptDisplayMode(const Standard_Integer aMode) const Standard_OVERRIDE;
0093 
0094   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; }
0095 
0096   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE
0097   {
0098     return AIS_KindOfInteractive_Datum;
0099   }
0100 
0101   Standard_EXPORT void SetColor(const Quantity_Color& aColor) Standard_OVERRIDE;
0102 
0103   Standard_EXPORT void SetWidth(const Standard_Real aValue) Standard_OVERRIDE;
0104 
0105   //! Set required visualization parameters.
0106   Standard_EXPORT void SetDisplayAspect(const Handle(Prs3d_LineAspect)& theNewDatumAspect);
0107 
0108   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
0109 
0110   Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
0111 
0112 private:
0113   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0114                                        const Handle(Prs3d_Presentation)&         thePrs,
0115                                        const Standard_Integer theMode) Standard_OVERRIDE;
0116 
0117   Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& theSel,
0118                                                 const Standard_Integer theMode) Standard_OVERRIDE;
0119 
0120   Standard_EXPORT void ComputeFields();
0121 
0122 private:
0123   Handle(Geom_Line)           myComponent;
0124   Handle(Geom_Axis2Placement) myAx2;
0125   gp_Pnt                      myPfirst;
0126   gp_Pnt                      myPlast;
0127   AIS_TypeOfAxis              myTypeOfAxis;
0128   Standard_Boolean            myIsXYZAxis;
0129   gp_Dir                      myDir;
0130   Standard_Real               myVal;
0131   Standard_CString            myText;
0132   Handle(Prs3d_LineAspect)    myLineAspect;
0133 };
0134 
0135 DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject)
0136 
0137 #endif // _AIS_Axis_HeaderFile