Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0042   //! Initializes the line aComponent
0043   Standard_EXPORT AIS_Axis(const Handle(Geom_Line)& aComponent);
0044 
0045   //! initializes the axis2 position
0046   //! aComponent. The coordinate system used is right-handed.
0047   Standard_EXPORT AIS_Axis(const Handle(Geom_Axis2Placement)& aComponent, 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, const AIS_TypeOfAxis anAxisType);
0073   
0074   //! Constructs a new line to serve as the axis anAxis in 3D space.
0075   Standard_EXPORT void SetAxis1Placement (const Handle(Geom_Axis1Placement)& anAxis);
0076   
0077   //! Returns the type of axis.
0078   AIS_TypeOfAxis TypeOfAxis() const { return myTypeOfAxis; }
0079 
0080   //! Constructs the entity theTypeAxis to stock information
0081   //! concerning type of axis.
0082   void SetTypeOfAxis (const AIS_TypeOfAxis theTypeAxis) { myTypeOfAxis = theTypeAxis; }
0083 
0084   //! Returns a signature of 2 for axis datums. When you
0085   //! activate mode 2 by a signature, you pick AIS objects
0086   //! of type AIS_Axis.
0087   Standard_Boolean IsXYZAxis() const { return myIsXYZAxis; }
0088 
0089   //! Returns true if the interactive object accepts the display mode aMode.
0090   Standard_EXPORT Standard_Boolean AcceptDisplayMode (const Standard_Integer aMode) const Standard_OVERRIDE;
0091 
0092   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 2; }
0093 
0094   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
0095 
0096   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
0097 
0098   Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
0099 
0100   //! Set required visualization parameters.
0101   Standard_EXPORT void SetDisplayAspect (const Handle(Prs3d_LineAspect)& theNewDatumAspect);
0102 
0103   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
0104 
0105   Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
0106 
0107 private:
0108 
0109   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0110                                         const Handle(Prs3d_Presentation)& thePrs,
0111                                         const Standard_Integer theMode) Standard_OVERRIDE;
0112 
0113   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
0114                                                  const Standard_Integer theMode) Standard_OVERRIDE;
0115 
0116   Standard_EXPORT void ComputeFields();
0117 
0118 private:
0119 
0120   Handle(Geom_Line) myComponent;
0121   Handle(Geom_Axis2Placement) myAx2;
0122   gp_Pnt myPfirst;
0123   gp_Pnt myPlast;
0124   AIS_TypeOfAxis myTypeOfAxis;
0125   Standard_Boolean myIsXYZAxis;
0126   gp_Dir myDir;
0127   Standard_Real myVal;
0128   Standard_CString myText;
0129   Handle(Prs3d_LineAspect) myLineAspect;
0130 
0131 };
0132 
0133 DEFINE_STANDARD_HANDLE(AIS_Axis, AIS_InteractiveObject)
0134 
0135 #endif // _AIS_Axis_HeaderFile