Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:41

0001 // Created on: 1997-02-27
0002 // Created by: Odile Olivier
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 _PrsDim_Relation_HeaderFile
0018 #define _PrsDim_Relation_HeaderFile
0019 
0020 #include <AIS_InteractiveObject.hxx>
0021 #include <Aspect_TypeOfLine.hxx>
0022 #include <Aspect_TypeOfMarker.hxx>
0023 #include <Bnd_Box.hxx>
0024 #include <DsgPrs_ArrowSide.hxx>
0025 #include <gp_Pln.hxx>
0026 #include <gp_Pnt.hxx>
0027 #include <PrsDim_KindOfDimension.hxx>
0028 #include <PrsDim_KindOfSurface.hxx>
0029 #include <TCollection_ExtendedString.hxx>
0030 #include <TopoDS_Shape.hxx>
0031 
0032 class Geom_Curve;
0033 class Geom_Plane;
0034 class Geom_Surface;
0035 class TopoDS_Edge;
0036 class TopoDS_Vertex;
0037 
0038 //! One of the four types of interactive object in
0039 //! AIS,comprising dimensions and constraints. Serves
0040 //! as the abstract class for the seven relation classes as
0041 //! well as the seven dimension classes.
0042 //! The statuses available for relations between shapes are as follows:
0043 //! -   0 - there is no connection to a shape;
0044 //! -   1 - there is a connection to the first shape;
0045 //! -   2 - there is a connection to the second shape.
0046 //! The connection takes the form of an edge between the two shapes.
0047 class PrsDim_Relation : public AIS_InteractiveObject
0048 {
0049   DEFINE_STANDARD_RTTIEXT(PrsDim_Relation, AIS_InteractiveObject)
0050 public:
0051 
0052   //! Allows you to provide settings for the color theColor
0053   //! of the lines representing the relation between the two shapes.
0054   Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
0055 
0056   //! Allows you to remove settings for the color of the
0057   //! lines representing the relation between the two shapes.
0058   Standard_EXPORT void UnsetColor() Standard_OVERRIDE;
0059 
0060   virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Relation; }
0061 
0062   //! Indicates that the type of dimension is unknown.
0063   virtual PrsDim_KindOfDimension KindOfDimension() const { return PrsDim_KOD_NONE; }
0064 
0065   //! Returns true if the interactive object is movable.
0066   virtual Standard_Boolean IsMovable() const { return Standard_False; }
0067 
0068   const TopoDS_Shape& FirstShape() const { return myFShape; }
0069 
0070   virtual void SetFirstShape (const TopoDS_Shape& aFShape) { myFShape = aFShape; }
0071 
0072   //! Returns the second shape.
0073   const TopoDS_Shape& SecondShape() const { return mySShape; }
0074 
0075   //! Allows you to identify the second shape aSShape
0076   //! relative to the first.
0077   virtual void SetSecondShape (const TopoDS_Shape& aSShape) { mySShape = aSShape; }
0078 
0079   void SetBndBox (const Standard_Real theXmin, const Standard_Real theYmin, const Standard_Real theZmin,
0080                   const Standard_Real theXmax, const Standard_Real theYmax, const Standard_Real theZmax)
0081   {
0082     myBndBox.Update (theXmin, theYmin, theZmin, theXmax, theYmax, theZmax);
0083     myIsSetBndBox = Standard_True;
0084   }
0085 
0086   void UnsetBndBox() { myIsSetBndBox = Standard_False; }
0087 
0088   //! Returns the plane.
0089   const Handle(Geom_Plane)& Plane() const { return myPlane; }
0090 
0091   //! Allows you to set the plane thePlane. This is used to
0092   //! define relations and dimensions in several daughter classes.
0093   void SetPlane (const Handle(Geom_Plane)& thePlane) { myPlane = thePlane; }
0094 
0095   //! Returns the value of each object in the relation.
0096   Standard_Real Value() const { return myVal; }
0097 
0098   //! Allows you to provide settings for the value theVal for each object in the relation.
0099   void SetValue (const Standard_Real theVal) { myVal = theVal; }
0100 
0101   //! Returns the position set using SetPosition.
0102   const gp_Pnt& Position() const { return myPosition; }
0103 
0104   //! Allows you to provide the objects in the relation with
0105   //! settings for a non-default position.
0106   void SetPosition (const gp_Pnt& thePosition)
0107   {
0108     myPosition = thePosition;
0109     myAutomaticPosition = Standard_False;
0110   }
0111 
0112   //! Returns settings for text aspect.
0113   const TCollection_ExtendedString& Text() const { return myText; }
0114 
0115   //! Allows you to provide the settings theText for text aspect.
0116   void SetText (const TCollection_ExtendedString& theText) { myText = theText; }
0117 
0118   //! Returns the value for the size of the arrow identifying
0119   //! the relation between the two shapes.
0120   Standard_Real ArrowSize() const { return myArrowSize; }
0121 
0122   //! Allows you to provide settings for the size of the
0123   //! arrow theArrowSize identifying the relation between the two shapes.
0124   void SetArrowSize (const Standard_Real theArrowSize)
0125   {
0126     myArrowSize = theArrowSize;
0127     myArrowSizeIsDefined = Standard_True;
0128   }
0129 
0130   //! Returns the value of the symbol presentation. This will be one of:
0131   //! -   AS_NONE - none
0132   //! -   AS_FIRSTAR - first arrow
0133   //! -   AS_LASTAR - last arrow
0134   //! -   AS_BOTHAR - both arrows
0135   //! -   AS_FIRSTPT - first point
0136   //! -   AS_LASTPT - last point
0137   //! -   AS_BOTHPT - both points
0138   //! -   AS_FIRSTAR_LASTPT - first arrow, last point
0139   //! -   AS_FIRSTPT_LASTAR - first point, last arrow
0140   DsgPrs_ArrowSide SymbolPrs() const { return mySymbolPrs; }
0141 
0142   //! Allows you to provide settings for the symbol presentation.
0143   void SetSymbolPrs (const DsgPrs_ArrowSide theSymbolPrs) { mySymbolPrs = theSymbolPrs; }
0144 
0145   //! Allows you to set the status of the extension shape by
0146   //! the index aIndex.
0147   //! The status will be one of the following:
0148   //! -   0 - there is no connection to a shape;
0149   //! -   1 - there is a connection to the first shape;
0150   //! -   2 - there is a connection to the second shape.
0151   void SetExtShape (const Standard_Integer theIndex) { myExtShape = theIndex; }
0152 
0153   //! Returns the status index of the extension shape.
0154   Standard_Integer ExtShape() const { return myExtShape; }
0155 
0156   //! Returns true if the display mode aMode is accepted
0157   //! for the Interactive Objects in the relation.
0158   //! ComputeProjPresentation(me;
0159   //! aPres    : Presentation from Prs3d;
0160   //! Curve1   : Curve                from Geom;
0161   //! Curve2   : Curve                from Geom;
0162   //! FirstP1  : Pnt                  from gp;
0163   //! LastP1   : Pnt                  from gp;
0164   //! FirstP2  : Pnt                  from gp;
0165   //! LastP2   : Pnt                  from gp;
0166   //! aColor   : NameOfColor          from Quantity = Quantity_NOC_PURPLE;
0167   //! aWidth   : Real                 from Standard = 2;
0168   //! aProjTOL : TypeOfLine           from Aspect   = Aspect_TOL_DASH;
0169   //! aCallTOL : TypeOfLine           from Aspect   = Aspect_TOL_DOT)
0170   virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
0171 
0172   void SetAutomaticPosition (const Standard_Boolean theStatus) { myAutomaticPosition = theStatus; }
0173 
0174   Standard_Boolean AutomaticPosition() const { return myAutomaticPosition; }
0175 
0176 protected:
0177 
0178   Standard_EXPORT PrsDim_Relation (const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView);
0179 
0180   //! Calculates the presentation aPres of the edge
0181   //! anEdge and the curve it defines, ProjCurve. The later
0182   //! is also specified by the first point FirstP and the last point LastP.
0183   //! The presentation includes settings for color aColor,
0184   //! type - aProjTOL and aCallTOL -   and width of line, aWidth.
0185   Standard_EXPORT void ComputeProjEdgePresentation (const Handle(Prs3d_Presentation)& aPres, const TopoDS_Edge& anEdge, const Handle(Geom_Curve)& ProjCurve, const gp_Pnt& FirstP, const gp_Pnt& LastP, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfLine aProjTOL = Aspect_TOL_DASH, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT) const;
0186 
0187   //! Calculates the presentation aPres of the vertex
0188   //! aVertex and the point it defines, ProjPoint.
0189   //! The presentation includes settings for color aColor,
0190   //! type - aProjTOM and aCallTOL -   and width of line, aWidth.
0191   Standard_EXPORT void ComputeProjVertexPresentation (const Handle(Prs3d_Presentation)& aPres, const TopoDS_Vertex& aVertex, const gp_Pnt& ProjPoint, const Quantity_NameOfColor aColor = Quantity_NOC_PURPLE, const Standard_Real aWidth = 2, const Aspect_TypeOfMarker aProjTOM = Aspect_TOM_PLUS, const Aspect_TypeOfLine aCallTOL = Aspect_TOL_DOT) const;
0192 
0193 protected:
0194 
0195   TopoDS_Shape myFShape;
0196   TopoDS_Shape mySShape;
0197   Handle(Geom_Plane) myPlane;
0198   Standard_Real myVal;
0199   gp_Pnt myPosition;
0200   TCollection_ExtendedString myText;
0201   Standard_Real myArrowSize;
0202   Standard_Boolean myAutomaticPosition;
0203   DsgPrs_ArrowSide mySymbolPrs;
0204   Standard_Integer myExtShape;
0205   gp_Pln myFirstPlane;
0206   gp_Pln mySecondPlane;
0207   Handle(Geom_Surface) myFirstBasisSurf;
0208   Handle(Geom_Surface) mySecondBasisSurf;
0209   PrsDim_KindOfSurface myFirstSurfType;
0210   PrsDim_KindOfSurface mySecondSurfType;
0211   Standard_Real myFirstOffset;
0212   Standard_Real mySecondOffset;
0213   Bnd_Box myBndBox;
0214   Standard_Boolean myIsSetBndBox;
0215   Standard_Boolean myArrowSizeIsDefined;
0216 
0217 };
0218 
0219 DEFINE_STANDARD_HANDLE(PrsDim_Relation, AIS_InteractiveObject)
0220 
0221 #endif // _AIS_Relation_HeaderFile