Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-16 09:16:17

0001 // Created on: 1997-01-21
0002 // Created by: Prestataire Christiane ARMAND
0003 // Copyright (c) 1997-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_Line_HeaderFile
0018 #define _AIS_Line_HeaderFile
0019 
0020 #include <AIS_InteractiveObject.hxx>
0021 #include <AIS_KindOfInteractive.hxx>
0022 
0023 class Geom_Line;
0024 class Geom_Point;
0025 
0026 //! Constructs line datums to be used in construction of
0027 //! composite shapes.
0028 class AIS_Line : public AIS_InteractiveObject
0029 {
0030   DEFINE_STANDARD_RTTIEXT(AIS_Line, AIS_InteractiveObject)
0031 public:
0032   //! Initializes the line aLine.
0033   Standard_EXPORT AIS_Line(const occ::handle<Geom_Line>& aLine);
0034 
0035   //! Initializes a starting point aStartPoint
0036   //! and a finishing point aEndPoint for the line.
0037   Standard_EXPORT AIS_Line(const occ::handle<Geom_Point>& aStartPoint,
0038                            const occ::handle<Geom_Point>& aEndPoint);
0039 
0040   //! Returns the signature 5.
0041   int Signature() const override { return 5; }
0042 
0043   //! Returns the type Datum.
0044   AIS_KindOfInteractive Type() const override { return AIS_KindOfInteractive_Datum; }
0045 
0046   //! Constructs an infinite line.
0047   const occ::handle<Geom_Line>& Line() const { return myComponent; }
0048 
0049   //! Returns the starting point of the line set by SetPoints.
0050   //! @return handle to the start point
0051   const occ::handle<Geom_Point>& StartPoint() const { return myStartPoint; }
0052 
0053   //! Returns the end point of the line set by SetPoints.
0054   //! @return handle to the end point
0055   const occ::handle<Geom_Point>& EndPoint() const { return myEndPoint; }
0056 
0057   //! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints.
0058   //! @deprecated Use StartPoint() and EndPoint() instead.
0059   Standard_DEPRECATED("Use StartPoint() and EndPoint() instead")
0060   void Points(occ::handle<Geom_Point>& thePStart, occ::handle<Geom_Point>& thePEnd) const
0061   {
0062     thePStart = StartPoint();
0063     thePEnd   = EndPoint();
0064   }
0065 
0066   //! Sets the infinite line.
0067   //! @param[in] theLine the geometric line
0068   void SetLine(const occ::handle<Geom_Line>& theLine)
0069   {
0070     myComponent     = theLine;
0071     myLineIsSegment = false;
0072   }
0073 
0074   //! Sets the starting point and ending point of the
0075   //! infinite line to create a finite line segment.
0076   //! @param[in] thePStart the starting point
0077   //! @param[in] thePEnd the ending point
0078   void SetPoints(const occ::handle<Geom_Point>& thePStart, const occ::handle<Geom_Point>& thePEnd)
0079   {
0080     myStartPoint    = thePStart;
0081     myEndPoint      = thePEnd;
0082     myLineIsSegment = true;
0083   }
0084 
0085   //! Provides a new color setting aColor for the line in the drawing tool, or "Drawer".
0086   Standard_EXPORT void SetColor(const Quantity_Color& aColor) override;
0087 
0088   //! Provides the new width setting aValue for the line in
0089   //! the drawing tool, or "Drawer".
0090   Standard_EXPORT void SetWidth(const double aValue) override;
0091 
0092   //! Removes the color setting and returns the original color.
0093   Standard_EXPORT void UnsetColor() override;
0094 
0095   //! Removes the width setting and returns the original width.
0096   Standard_EXPORT void UnsetWidth() override;
0097 
0098 private:
0099   Standard_EXPORT void Compute(const occ::handle<PrsMgr_PresentationManager>& thePrsMgr,
0100                                const occ::handle<Prs3d_Presentation>&         thePrs,
0101                                const int                                      theMode) override;
0102 
0103   Standard_EXPORT void ComputeSelection(const occ::handle<SelectMgr_Selection>& theSel,
0104                                         const int                               theMode) override;
0105 
0106   Standard_EXPORT void ComputeInfiniteLine(const occ::handle<Prs3d_Presentation>& aPresentation);
0107 
0108   Standard_EXPORT void ComputeSegmentLine(const occ::handle<Prs3d_Presentation>& aPresentation);
0109 
0110   Standard_EXPORT void ComputeInfiniteLineSelection(
0111     const occ::handle<SelectMgr_Selection>& aSelection);
0112 
0113   Standard_EXPORT void ComputeSegmentLineSelection(
0114     const occ::handle<SelectMgr_Selection>& aSelection);
0115   //! Replace aspects of already computed groups with the new value.
0116   void replaceWithNewLineAspect(const occ::handle<Prs3d_LineAspect>& theAspect);
0117 
0118 private:
0119   occ::handle<Geom_Line>  myComponent;
0120   occ::handle<Geom_Point> myStartPoint;
0121   occ::handle<Geom_Point> myEndPoint;
0122   bool                    myLineIsSegment;
0123 };
0124 
0125 #endif // _AIS_Line_HeaderFile