Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0033   //! Initializes the line aLine.
0034   Standard_EXPORT AIS_Line(const Handle(Geom_Line)& aLine);
0035 
0036   //! Initializes a starting point aStartPoint
0037   //! and a finishing point aEndPoint for the line.
0038   Standard_EXPORT AIS_Line(const Handle(Geom_Point)& aStartPoint, const Handle(Geom_Point)& aEndPoint);
0039 
0040   //! Returns the signature 5.
0041   virtual Standard_Integer Signature() const Standard_OVERRIDE { return 5; }
0042 
0043   //! Returns the type Datum.
0044   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; }
0045 
0046   //! Constructs an infinite line.
0047   const Handle(Geom_Line)& Line() const { return myComponent; }
0048 
0049   //! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints.
0050   void Points (Handle(Geom_Point)& thePStart, Handle(Geom_Point)& thePEnd) const
0051   {
0052     thePStart = myStartPoint;
0053     thePEnd   = myEndPoint;
0054   }
0055 
0056   //! instantiates an infinite line.
0057   void SetLine (const Handle(Geom_Line)& theLine)
0058   {
0059     myComponent = theLine;
0060     myLineIsSegment = Standard_False;
0061   }
0062 
0063   //! Sets the starting point thePStart and ending point thePEnd of the
0064   //! infinite line to create a finite line segment.
0065   void SetPoints (const Handle(Geom_Point)& thePStart, const Handle(Geom_Point)& thePEnd)
0066   {
0067     myStartPoint    = thePStart;
0068     myEndPoint      = thePEnd;
0069     myLineIsSegment = Standard_True;
0070   }
0071 
0072   //! Provides a new color setting aColor for the line in the drawing tool, or "Drawer".
0073   Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE;
0074 
0075   //! Provides the new width setting aValue for the line in
0076   //! the drawing tool, or "Drawer".
0077   Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE;
0078 
0079   //! Removes the color setting and returns the original color.
0080   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
0081 
0082   //! Removes the width setting and returns the original width.
0083   Standard_EXPORT void UnsetWidth() Standard_OVERRIDE;
0084 
0085 private:
0086 
0087   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
0088                                         const Handle(Prs3d_Presentation)& thePrs,
0089                                         const Standard_Integer theMode) Standard_OVERRIDE;
0090 
0091   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
0092                                                  const Standard_Integer theMode) Standard_OVERRIDE;
0093 
0094   Standard_EXPORT void ComputeInfiniteLine (const Handle(Prs3d_Presentation)& aPresentation);
0095 
0096   Standard_EXPORT void ComputeSegmentLine (const Handle(Prs3d_Presentation)& aPresentation);
0097 
0098   Standard_EXPORT void ComputeInfiniteLineSelection (const Handle(SelectMgr_Selection)& aSelection);
0099 
0100   Standard_EXPORT void ComputeSegmentLineSelection (const Handle(SelectMgr_Selection)& aSelection);
0101   //! Replace aspects of already computed groups with the new value.
0102   void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect);
0103 
0104 private:
0105 
0106   Handle(Geom_Line) myComponent;
0107   Handle(Geom_Point) myStartPoint;
0108   Handle(Geom_Point) myEndPoint;
0109   Standard_Boolean myLineIsSegment;
0110 
0111 };
0112 
0113 DEFINE_STANDARD_HANDLE(AIS_Line, AIS_InteractiveObject)
0114 
0115 #endif // _AIS_Line_HeaderFile