// Copyright (c) 1995-1999 Matra Datavision // Copyright (c) 1999-2013 OPEN CASCADE SAS // // The content of this file is subject to the Open CASCADE Technology Public // License Version 6.5 (the "License"). You may not use the content of this file // except in compliance with the License. Please obtain a copy of the License // at http://www.opencascade.org and read it completely before using this file. // // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // // The Original Code and all software distributed under the License is // distributed on an "AS IS" basis, without warranty of any kind, and the // Initial Developer hereby disclaims all such warranties, including without // limitation, any warranties of merchantability, fitness for a particular // purpose or non-infringement. Please see the License for the specific terms // and conditions governing the rights and limitations under the License. //! A framework to define display of angles.
//! These displays are particularly useful in viewing draft prisms.
//! The angle displayed may define an intersection
//! can be between two edges or two faces of a shape
//! or a plane. The display consists of arrows and text.
#ifndef _AIS_AngleDimension_HeaderFile #define _AIS_AngleDimension_HeaderFile #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include DEFINE_STANDARD_HANDLE (AIS_AngleDimension, AIS_Dimension) class AIS_AngleDimension : public AIS_Dimension { public: //! Constructs angle dimension between two edges //! with automatic working plane computing //! if it is possible. In case of PI angle please //! set custom working plane or use constructor with 3 parameters. Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge); //! Constructs the angle display object defined by the
//! two edges and custom working plane. //! ATTENTION :In case if the working plane is custom and one edge is out of the //! working plane it tries to project this edge line on the plane. //! To avoid this case you can reset the working plane //! using method. Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge, const gp_Pln& thePlane); //! Constructs the angle display object defined by the
//! two edges and custom working plane and dimension aspect. Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge, const gp_Pln& thePlane, const Handle(Prs3d_DimensionAspect)& theDimensionAspect, const Standard_Real theExtensionSize = 1.0); //! Constructs the angle display object defined by three points. Standard_EXPORT AIS_AngleDimension (const gp_Pnt& theFirstPoint, const gp_Pnt& theSecondPoint, const gp_Pnt& theThirdPoint); //! Constructs the angle display object defined by three points //! and dimension aspect that defines line, arrow and text aspect. Standard_EXPORT AIS_AngleDimension (const gp_Pnt& theFirstPoint, const gp_Pnt& theSecondPoint, const gp_Pnt& theThirdPoint, const Handle(Prs3d_DimensionAspect)& theDimensionAspect, const Standard_Real theExtensionSize = 1.0); //! Angle of cone Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theCone); //! TwoPlanarFaceAngle dimension Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theFirstFace, const TopoDS_Face& theSecondFace, const gp_Ax1& theAxis); //! Sets the flyout. Standard_EXPORT void SetFlyout (const Standard_Real theFlyout); //! Returns flyout value. If value > 0 the dimension is to be displayed inside the angle. //! Otherwise it is displayed outside one. Standard_EXPORT Standard_Real GetFlyout() const; //! Sets first shape Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theShape, const Standard_Boolean isSingleShape = Standard_False); DEFINE_STANDARD_RTTI(AIS_AngleDimension) protected: //! Computes dimension value in display units Standard_EXPORT virtual void computeValue(); Standard_EXPORT void init(); Standard_EXPORT gp_Pnt getCenterOnArc (const gp_Pnt& theFirstAttach, const gp_Pnt& theSecondAttach); Standard_EXPORT void drawArc (const Handle(Prs3d_Presentation)& thePresentation, const gp_Pnt& theFirstAttach, const gp_Pnt& theSecondAttach, const gp_Pnt& theCenter, const Standard_Real theRadius, const AIS_DimensionDisplayMode theMode); Standard_EXPORT void drawArcWithText (const Handle(Prs3d_Presentation)& thePresentation, const gp_Pnt& theFirstAttach, const gp_Pnt& theSecondAttach, const TCollection_ExtendedString& theText, const AIS_DimensionDisplayMode theMode); Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePM, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); Standard_EXPORT Standard_Boolean initConeAngle (const TopoDS_Face& theCone); Standard_EXPORT Standard_Boolean initTwoFacesAngle(); Standard_EXPORT Standard_Boolean initTwoEdgesAngle(); //! Auxiliary method to get position of the angle dimension //! if the cone is trimmed //! Returns 1 if center is above of center; //! 0 if center is between and centers; //! -1 if center is below center. Standard_EXPORT Standard_Integer aboveInBelowCone (const gp_Circ &theCMax, const gp_Circ &theCMin, const gp_Circ &theC); //! Auxiliary method to arrange text and arrows Standard_EXPORT Standard_Boolean canTextBeInCenter (const gp_Pnt& theFirstAttach, const gp_Pnt& theSecondAttach, const Quantity_Length& theTextLength, const Quantity_Length& theArrowLength); //! Fills default plane object if it is possible to count plane automatically. Standard_EXPORT virtual void countDefaultPlane (); protected: //! Shows if there is necessarily to draw extensions on angle dimension //! It is set to the true value if the attachment point are out of the edges. Standard_Boolean myIsFlyoutLines; //! The center of dimension arc gp_Pnt myCenter; //! Defines flyout lines and direction //! Flyout direction in the working plane (stored in the base AIS_Dimension). //! can be negative , or positive and is defined by the sign of value. //! The direction vector is counting using the working plane. //! value defined the size of flyout (radius of angle). Standard_Real myFlyout; }; #endif