mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0024133: Development of improvement of dimensions implementation; new length, radius,diameter and angle dimensions.
Some corrections; test cases were added; coding standards in MFC samples & presentations Request stencil buffer for Linux. correct test cases; correct compilation errors compilation warnings (gcc/Linux)
This commit is contained in:
@@ -275,7 +275,7 @@ is
|
||||
-- for example, are only created for the selection
|
||||
-- process. By means of these enumerations, they can
|
||||
-- be cleared from local context.
|
||||
|
||||
|
||||
enumeration KindOfUnit is
|
||||
TOU_LENGTH,
|
||||
TOU_SURFACE,
|
||||
@@ -285,19 +285,19 @@ is
|
||||
TOU_MASS,
|
||||
TOU_FORCE,
|
||||
TOU_TIME;
|
||||
---Purpose: Declares the type of Interactive Object unit.
|
||||
|
||||
---Purpose: Declares the type of Interactive Object unit.
|
||||
|
||||
enumeration TypeOfAxis is TOAX_Unknown,TOAX_XAxis,TOAX_YAxis,TOAX_ZAxis;
|
||||
---Purpose: Declares the type of axis.
|
||||
|
||||
---Purpose: Declares the type of axis.
|
||||
|
||||
enumeration TypeOfPlane is TOPL_Unknown,TOPL_XYPlane,TOPL_XZPlane,TOPL_YZPlane;
|
||||
---Purpose: Declares the type of plane.
|
||||
---Purpose: Declares the type of plane.
|
||||
enumeration TypeOfDist is TOD_Unknown,TOD_Horizontal,TOD_Vertical;
|
||||
---Purpose: To declare the type of distance.
|
||||
|
||||
---Purpose: To declare the type of distance.
|
||||
|
||||
enumeration TypeOfAttribute is
|
||||
TOA_Line,
|
||||
TOA_Angle,
|
||||
TOA_Dimension,
|
||||
TOA_Wire,
|
||||
TOA_Plane,
|
||||
TOA_Vector,
|
||||
@@ -311,16 +311,21 @@ is
|
||||
TOA_FirstAxis,
|
||||
TOA_SecondAxis,
|
||||
TOA_ThirdAxis;
|
||||
|
||||
enumeration StandardDatum is SD_None,SD_Point,SD_Axis,SD_Trihedron,SD_PlaneTrihedron,SD_Line,SD_Circle,SD_Plane;
|
||||
--- Purpose: Declares the type of standard datum of an Interactive Object.
|
||||
|
||||
-- New ------------------------------------------------
|
||||
enumeration StandardDatum is SD_None,SD_Point,SD_Axis,SD_Trihedron,SD_PlaneTrihedron,SD_Line,SD_Circle,SD_Plane;
|
||||
--- Purpose: Declares the type of standard datum of an Interactive Object.
|
||||
|
||||
enumeration KindOfSurface is KOS_Plane, KOS_Cylinder, KOS_Cone, KOS_Sphere, KOS_Torus,
|
||||
KOS_Revolution, KOS_Extrusion, KOS_OtherSurface;
|
||||
-------------------------------------------------------
|
||||
|
||||
KOS_Revolution, KOS_Extrusion, KOS_OtherSurface;
|
||||
|
||||
-- Enumerations for dimensions management --
|
||||
|
||||
enumeration DisplaySpecialSymbol is DSS_No, DSS_Before, DSS_After;
|
||||
---Purpose: Specifies dimension special symbol display options
|
||||
|
||||
enumeration DimensionDisplayMode is DDM_All, DDM_Line, DDM_Text;
|
||||
---Purpose: Specifies dimension display modes for advanced highlighting and selection.
|
||||
|
||||
class Triangulation;
|
||||
|
||||
class TexturedShape;
|
||||
@@ -374,10 +379,10 @@ is
|
||||
deferred class EllipseRadiusDimension;
|
||||
class MaxRadiusDimension;
|
||||
class MinRadiusDimension;
|
||||
class LengthDimension;
|
||||
class AngleDimension;
|
||||
class RadiusDimension;
|
||||
class DiameterDimension;
|
||||
imported LengthDimension;
|
||||
imported AngleDimension;
|
||||
imported RadiusDimension;
|
||||
imported DiameterDimension;
|
||||
class Chamf2dDimension;
|
||||
class Chamf3dDimension;
|
||||
class OffsetDimension;
|
||||
|
@@ -384,10 +384,10 @@ Standard_Boolean AIS::ComputeGeometry(const TopoDS_Edge& anEdge1,
|
||||
//=======================================================================
|
||||
//function : ComputeGeometry
|
||||
//purpose : Computes the geometry of the 2 edges in the current wp
|
||||
// and the 'rigth' geometry of the edges if one doesn't
|
||||
// belong to the currentworkingplane.
|
||||
// and the 'right' geometry of the edges if one doesn't
|
||||
// belong to the current working plane.
|
||||
// There may be only one curve that can't belong to the
|
||||
// current workingplane ( attachement constraint)
|
||||
// current working plane ( attachement constraint)
|
||||
// if the 2 edges belong to the current WP, <WhatProj> = 0
|
||||
//
|
||||
// indexExt = 0 2 edges are in the current wp
|
||||
@@ -397,19 +397,19 @@ Standard_Boolean AIS::ComputeGeometry(const TopoDS_Edge& anEdge1,
|
||||
// it returns Standard_False
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS::ComputeGeometry(const TopoDS_Edge& anEdge1,
|
||||
const TopoDS_Edge& anEdge2,
|
||||
Standard_Integer& indexExt,
|
||||
Handle(Geom_Curve)& aCurve1,
|
||||
Handle(Geom_Curve)& aCurve2,
|
||||
gp_Pnt& FirstPnt1,
|
||||
gp_Pnt& LastPnt1,
|
||||
gp_Pnt& FirstPnt2,
|
||||
gp_Pnt& LastPnt2,
|
||||
Handle(Geom_Curve)& extCurve,
|
||||
Standard_Boolean& isInfinite1,
|
||||
Standard_Boolean& isInfinite2,
|
||||
const Handle(Geom_Plane)& aPlane)
|
||||
Standard_Boolean AIS::ComputeGeometry (const TopoDS_Edge& anEdge1,
|
||||
const TopoDS_Edge& anEdge2,
|
||||
Standard_Integer& indexExt,
|
||||
Handle(Geom_Curve)& aCurve1,
|
||||
Handle(Geom_Curve)& aCurve2,
|
||||
gp_Pnt& FirstPnt1,
|
||||
gp_Pnt& LastPnt1,
|
||||
gp_Pnt& FirstPnt2,
|
||||
gp_Pnt& LastPnt2,
|
||||
Handle(Geom_Curve)& extCurve,
|
||||
Standard_Boolean& isInfinite1,
|
||||
Standard_Boolean& isInfinite2,
|
||||
const Handle(Geom_Plane)& aPlane)
|
||||
{
|
||||
if (aPlane.IsNull()) return Standard_False;
|
||||
extCurve.Nullify();
|
||||
|
@@ -1,287 +0,0 @@
|
||||
-- Created on: 1996-12-03
|
||||
-- Created by: Arnaud BOUZY/Odile Olivier
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 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.
|
||||
|
||||
|
||||
|
||||
class AngleDimension from AIS inherits Relation from AIS
|
||||
|
||||
|
||||
---Purpose: 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.
|
||||
|
||||
uses Shape from TopoDS,
|
||||
Presentation from Prs3d,
|
||||
PresentationManager3d from PrsMgr,
|
||||
Selection from SelectMgr,
|
||||
Pnt from gp,
|
||||
Dir from gp,
|
||||
Circ from gp,
|
||||
Line from Geom,
|
||||
Ax1 from gp,
|
||||
Projector from Prs3d,
|
||||
Transformation from Geom,
|
||||
Plane from Geom,
|
||||
Surface from Geom,
|
||||
ExtendedString from TCollection,
|
||||
ArrowSide from DsgPrs,
|
||||
KindOfDimension from AIS,
|
||||
Edge from TopoDS,
|
||||
Face from TopoDS
|
||||
is
|
||||
|
||||
Create (aFirstEdge : Edge from TopoDS;
|
||||
aSecondEdge : Edge from TopoDS;
|
||||
aPlane : Plane from Geom;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: Constructs the angle display object defined by the
|
||||
-- shapes aFShape, aSShape, the plane aPlane, the
|
||||
-- value aVal and the text aText.
|
||||
-- aFShape and aSShape are edges.
|
||||
returns mutable AngleDimension from AIS;
|
||||
|
||||
|
||||
Create (aFirstEdge : Edge from TopoDS;
|
||||
aSecondEdge : Edge from TopoDS;
|
||||
aPlane : Plane from Geom;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
anArrowSize : Real from Standard = 0.0)
|
||||
---Purpose: Constructs the angle display object defined by the
|
||||
-- shapes aFShape, aSShape, the plane aPlane, the
|
||||
-- value aVal, the text aText, the point aPosition, the
|
||||
-- type of arrow aSymbolPrs, and the arrow length anArrowSize.
|
||||
-- aFShape and aSShape are edges.
|
||||
returns mutable AngleDimension from AIS;
|
||||
|
||||
Create (aCone : Face from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: Angle of cone
|
||||
returns mutable AngleDimension from AIS;
|
||||
|
||||
|
||||
Create (aCone : Face from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
anArrowSize : Real from Standard = 0.01 )
|
||||
---Purpose: Angle of cone
|
||||
returns mutable AngleDimension from AIS;
|
||||
--===================================================================
|
||||
|
||||
Create (aFirstFace : Face from TopoDS;
|
||||
aSecondFace : Face from TopoDS;
|
||||
anAxis : Ax1 from gp;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: TwoPlanarFaceAngle dimension
|
||||
returns mutable AngleDimension from AIS;
|
||||
|
||||
Create (aFirstFace : Face from TopoDS;
|
||||
aSecondFace : Face from TopoDS;
|
||||
anAxis : Ax1 from gp;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
anArrowSize : Real from Standard = 0.0)
|
||||
---Purpose: TwoPlanarFacesAngle dimension with position
|
||||
-- and text Face can be Plane or Extrusion of line
|
||||
-- or Offset of those
|
||||
returns mutable AngleDimension from AIS;
|
||||
|
||||
|
||||
Create (aFFace : Face from TopoDS;
|
||||
aSFace : Face from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: Angle dimension between two curvilinear faces
|
||||
-- Warning:
|
||||
-- Requaired 0 <= aVal < PI,
|
||||
-- aVal must be defined exactly.
|
||||
returns mutable AngleDimension from AIS;
|
||||
|
||||
Create (aFFace : Face from TopoDS;
|
||||
aSFace : Face from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
anArrowSize : Real from Standard = 0.001)
|
||||
---Purpose: Angle dimension between two curvilinear faces
|
||||
-- with position and text. Face can be Cone, Cylinder
|
||||
-- Offset of Cone, Offset of Cylinder
|
||||
returns mutable AngleDimension from AIS;
|
||||
|
||||
|
||||
Axis (me)
|
||||
---Purpose:
|
||||
-- Returns the axis set by the SetAxis method, which
|
||||
-- serves to locate the angle between two faces.
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
returns Ax1 from gp
|
||||
is static;
|
||||
|
||||
SetAxis(me: mutable;anAxis : Ax1 from gp)
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the axis, anAxis, which serves to locate the
|
||||
-- angle between two faces.
|
||||
is static;
|
||||
|
||||
SetConeFace( me: mutable; aConeFace : Face from TopoDS )
|
||||
is static;
|
||||
|
||||
SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
|
||||
is redefined static;
|
||||
|
||||
SetSecondShape( me: mutable; aSShape : Shape from TopoDS )
|
||||
is redefined static;
|
||||
|
||||
|
||||
KindOfDimension(me)
|
||||
---Purpose: Returns PLANEANGLE as the kind of dimension.
|
||||
---C++: inline
|
||||
returns KindOfDimension from AIS
|
||||
is redefined;
|
||||
|
||||
IsMovable(me) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: Returns true if the angle dimension is movable.
|
||||
|
||||
is redefined;
|
||||
|
||||
-- Methods from PresentableObject
|
||||
|
||||
Compute(me : mutable;
|
||||
aPresentationManager: PresentationManager3d from PrsMgr;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aMode : Integer from Standard= 0)
|
||||
is redefined static private;
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector: Projector from Prs3d;
|
||||
aPresentation: mutable Presentation from Prs3d)
|
||||
is redefined static private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is redefined;
|
||||
---Purpose: Computes the presentation according to a point of view
|
||||
-- given by <aProjector>.
|
||||
-- This method should be used when the associated degenerated Presentations
|
||||
-- have been transformed by <aTrsf> which is not a Pure
|
||||
-- Translation. The HLR Prs can't be deducted automatically
|
||||
-- WARNING :<aTrsf> must be applied
|
||||
-- to the object to display before computation !!!
|
||||
|
||||
-- Methods from SelectableObject
|
||||
|
||||
ComputeSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr;
|
||||
aMode : Integer from Standard)
|
||||
is redefined private;
|
||||
|
||||
|
||||
--
|
||||
-- Computation private methods
|
||||
--
|
||||
|
||||
ComputeConeAngle(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeTwoFacesAngle(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeTwoPlanarFacesAngle(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeTwoCurvilinearFacesAngle(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeTwoEdgesAngle(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
ComputeTwoEdgesNullAngle(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
l1 : Line from Geom;
|
||||
l2 : Line from Geom;
|
||||
ptat11 : Pnt from gp;
|
||||
ptat12 : Pnt from gp;
|
||||
ptat21 : Pnt from gp;
|
||||
ptat22 : Pnt from gp;
|
||||
isInf1 : Boolean from Standard;
|
||||
isInf2 : Boolean from Standard )
|
||||
is private;
|
||||
|
||||
ComputeTwoEdgesNotNullAngle(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
l1 : Line from Geom;
|
||||
l2 : Line from Geom;
|
||||
ptat11 : Pnt from gp;
|
||||
ptat12 : Pnt from gp;
|
||||
ptat21 : Pnt from gp;
|
||||
ptat22 : Pnt from gp;
|
||||
isInf1 : Boolean from Standard;
|
||||
isInf2 : Boolean from Standard )
|
||||
is private;
|
||||
|
||||
Compute3DSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr)
|
||||
is private;
|
||||
|
||||
Compute2DSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr)
|
||||
is private;
|
||||
ComputeNull2DSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr;
|
||||
distFS : Real from Standard)
|
||||
is private;
|
||||
|
||||
ComputeConeAngleSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr)
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
myNbShape : Integer from Standard;
|
||||
myCenter : Pnt from gp;
|
||||
myFAttach : Pnt from gp;
|
||||
mySAttach : Pnt from gp;
|
||||
myFDir : Dir from gp;
|
||||
mySDir : Dir from gp;
|
||||
myAxis : Ax1 from gp;
|
||||
myCone : Face from TopoDS;
|
||||
|
||||
end AngleDimension;
|
File diff suppressed because it is too large
Load Diff
177
src/AIS/AIS_AngleDimension.hxx
Normal file
177
src/AIS/AIS_AngleDimension.hxx
Normal file
@@ -0,0 +1,177 @@
|
||||
// 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. <br>
|
||||
//! These displays are particularly useful in viewing draft prisms. <br>
|
||||
//! The angle displayed may define an intersection <br>
|
||||
//! can be between two edges or two faces of a shape <br>
|
||||
//! or a plane. The display consists of arrows and text. <br>
|
||||
|
||||
#ifndef _AIS_AngleDimension_HeaderFile
|
||||
#define _AIS_AngleDimension_HeaderFile
|
||||
|
||||
#include <AIS_Dimension.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Transformation.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
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 <br>
|
||||
//! 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 <ResetWorkingPlane ()> 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 <br>
|
||||
//! 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 <theC> center is above of <theCMin> center;
|
||||
//! 0 if <theC> center is between <theCMin> and <theCMax> centers;
|
||||
//! -1 if <theC> center is below <theCMax> 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 <myFlyout> value.
|
||||
//! The direction vector is counting using the working plane.
|
||||
//! <myFlyout> value defined the size of flyout (radius of angle).
|
||||
Standard_Real myFlyout;
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,55 +0,0 @@
|
||||
// Created on: 1997-02-28
|
||||
// Created by: Jean-Pierre COMBE
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 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.
|
||||
|
||||
//=======================================================================
|
||||
//function : KindOfDimension
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline AIS_KindOfDimension AIS_AngleDimension::KindOfDimension() const
|
||||
{
|
||||
return AIS_KOD_PLANEANGLE;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsMovable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean AIS_AngleDimension::IsMovable() const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Axis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const gp_Ax1& AIS_AngleDimension::Axis() const
|
||||
{
|
||||
return myAxis;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAxis
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void AIS_AngleDimension::SetAxis(const gp_Ax1& anAxis)
|
||||
{
|
||||
myAxis = anAxis;
|
||||
}
|
@@ -29,7 +29,7 @@
|
||||
#include <DsgPrs_Chamf2dPresentation.hxx>
|
||||
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
@@ -194,8 +194,8 @@ void AIS_Chamf2dDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
myPosition = curpos;
|
||||
}
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
|
||||
//-------------------------------------------------
|
||||
//Calcul de la boite englobante du component pour
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include <DsgPrs_Chamf2dPresentation.hxx>
|
||||
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
@@ -170,8 +170,8 @@ void AIS_Chamf3dDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
myPosition = curpos;
|
||||
}
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
|
||||
//-------------------------------------------------
|
||||
//Calcul de la boite englobante du component pour
|
||||
|
@@ -1,192 +0,0 @@
|
||||
-- Created on: 1996-12-05
|
||||
-- Created by: Jacques MINOT/Odile Olivier/Serguei ZARITCHNY
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 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.
|
||||
|
||||
-- Modified Mon 12-january-98
|
||||
-- <odl@sacadox.paris1.matra-dtv.fr>,
|
||||
|
||||
|
||||
class DiameterDimension from AIS inherits Relation from AIS
|
||||
|
||||
|
||||
---Purpose: A framework to display diameter dimensions.
|
||||
-- A diameter is displayed with arrows and text. The
|
||||
-- text gives the length of the diameter.
|
||||
-- The algorithm takes a length along a face and
|
||||
-- analyzes it as an arc. It then reconstructs the circle
|
||||
-- corresponding to the arc and calculates the
|
||||
-- diameter of this circle. This diameter serves as a
|
||||
-- relational reference in 3d presentations of the surface.
|
||||
|
||||
uses
|
||||
|
||||
Shape from TopoDS,
|
||||
Circ from gp,
|
||||
Pnt from gp,
|
||||
Pln from gp,
|
||||
Plane from Geom,
|
||||
Surface from Geom,
|
||||
Presentation from Prs3d,
|
||||
PresentationManager3d from PrsMgr,
|
||||
Selection from SelectMgr,
|
||||
Projector from Prs3d,
|
||||
Transformation from Geom,
|
||||
ExtendedString from TCollection,
|
||||
ArrowSide from DsgPrs,
|
||||
KindOfSurface from AIS,
|
||||
KindOfDimension from AIS
|
||||
|
||||
raises ConstructionError from Standard
|
||||
|
||||
is
|
||||
Create (aShape : Shape from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: Constructs a diameter display object defined by the
|
||||
-- shape aFShape, the dimension aVal and the text aText.
|
||||
returns mutable DiameterDimension from AIS;
|
||||
|
||||
Create (aShape : Shape from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
aDiamSymbol : Boolean from Standard;
|
||||
anArrowSize : Real from Standard = 0.0)
|
||||
---Purpose: Constructs a diameter display object defined by the
|
||||
-- shape aFShape, the dimension aVal and the text
|
||||
-- aText, the point of origin of the diameter aPosition,
|
||||
-- and the type of arrow aSymbolPrs with the size anArrowSize.
|
||||
-- If the Boolean aDiamSymbol is true.
|
||||
returns mutable DiameterDimension from AIS;
|
||||
|
||||
KindOfDimension(me) returns KindOfDimension from AIS
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Indicates that we are concerned with a length.
|
||||
is redefined;
|
||||
|
||||
IsMovable(me) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Returns true if the diameter dimension is movable
|
||||
is redefined;
|
||||
|
||||
DiamSymbol(me: mutable) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Returns the symbol for diameter dimension. This will
|
||||
-- be either arrow, text, or a combination of both.
|
||||
is static;
|
||||
|
||||
SetDiamSymbol(me: mutable;aDiamSymbol: Boolean from Standard)
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the symbol for diameter dimension aDiamSymbol.
|
||||
-- This can be an arrow, a text or both.
|
||||
is static;
|
||||
|
||||
-- SetPlane(me: mutable; aPlane : Plane from Geom)
|
||||
-- is static;
|
||||
-- ---C++: inline
|
||||
|
||||
-- Plane(me) returns any Plane from Geom
|
||||
-- is static;
|
||||
-- ---C++: inline
|
||||
-- ---C++: return const &
|
||||
|
||||
|
||||
-- Methods from PresentableObject
|
||||
|
||||
Compute(me : mutable;
|
||||
aPresentationManager: PresentationManager3d from PrsMgr;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aMode : Integer from Standard= 0)
|
||||
is redefined private;
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector: Projector from Prs3d;
|
||||
aPresentation: mutable Presentation from Prs3d)
|
||||
is redefined static private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is redefined;
|
||||
---Purpose: computes the presentation according to a point of view
|
||||
-- given by <aProjector>.
|
||||
-- To be Used when the associated degenerated Presentations
|
||||
-- have been transformed by <aTrsf> which is not a Pure
|
||||
-- Translation. The HLR Prs can't be deducted automatically
|
||||
-- WARNING :<aTrsf> must be applied
|
||||
-- to the object to display before computation !!!
|
||||
|
||||
-- Methods from SelectableObject
|
||||
|
||||
ComputeSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr;
|
||||
aMode : Integer from Standard)
|
||||
is redefined private;
|
||||
|
||||
--
|
||||
-- Computation private methods
|
||||
--
|
||||
|
||||
ComputeOneFaceDiameter(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeOneCylFaceDiameter(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aSurfType : KindOfSurface from AIS;
|
||||
aSurf : Surface from Geom )
|
||||
is private;
|
||||
|
||||
ComputeOnePlanarFaceDiameter(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d )
|
||||
is private;
|
||||
|
||||
ComputeOneEdgeDiameter(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeCircleDiameter(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeArcDiameter(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
ptFirst : Pnt from gp;
|
||||
ptend : Pnt from gp)
|
||||
is private;
|
||||
|
||||
ComputeArcSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr)
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
myCircle : Circ from gp;
|
||||
myIsAnArc : Boolean from Standard;
|
||||
myDiamSymbol : Boolean from Standard;
|
||||
myFirstPar : Real from Standard;
|
||||
myLastPar : Real from Standard;
|
||||
|
||||
end DiameterDimension;
|
@@ -24,78 +24,63 @@
|
||||
|
||||
#define BUC60915 //GG 05/06/01 Enable to compute the requested arrow size
|
||||
// if any in all dimensions.
|
||||
#include <AIS_DiameterDimension.hxx>
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#include <AIS_DiameterDimension.ixx>
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <AIS_DimensionOwner.hxx>
|
||||
#include <DsgPrs_DiameterPresentation.hxx>
|
||||
#include <DsgPrs_RadiusPresentation.hxx>
|
||||
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <GC_MakeCircle.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
|
||||
#include <GC_MakeCircle.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
IMPLEMENT_STANDARD_HANDLE(AIS_DiameterDimension, AIS_Dimension)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_DiameterDimension, AIS_Dimension)
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
|
||||
const Standard_Real aVal,
|
||||
const TCollection_ExtendedString& aText)
|
||||
:AIS_Relation(),
|
||||
myDiamSymbol(Standard_True)
|
||||
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle)
|
||||
: AIS_Dimension(),
|
||||
myFlyout (0.0),
|
||||
myCircle (theCircle)
|
||||
{
|
||||
myPosition = gp_Pnt(0.,0.,0.);
|
||||
myFShape = aShape;
|
||||
myVal = aVal;
|
||||
myText = aText;
|
||||
mySymbolPrs = DsgPrs_AS_LASTAR;
|
||||
myAutomaticPosition = Standard_True;
|
||||
myArrowSize = myVal / 100.;
|
||||
SetKindOfDimension(AIS_KOD_DIAMETER);
|
||||
myIsInitialized = Standard_True;
|
||||
SetSpecialSymbol (0x00D8);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
// Count attach points
|
||||
myFirstPoint = ElCLib::Value (0, myCircle);
|
||||
mySecondPoint = myFirstPoint.Translated (gp_Vec(myFirstPoint, theCircle.Location())*2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -103,27 +88,61 @@ AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
|
||||
const Standard_Real aVal,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPosition,
|
||||
const DsgPrs_ArrowSide aSymbolPrs,
|
||||
const Standard_Boolean aDiamSymbol,
|
||||
const Standard_Real anArrowSize)
|
||||
:AIS_Relation(),
|
||||
myDiamSymbol(aDiamSymbol)
|
||||
AIS_DiameterDimension::AIS_DiameterDimension(const gp_Circ& theCircle, const gp_Pnt& theAttachPoint)
|
||||
: AIS_Dimension(),
|
||||
myFlyout (0.0),
|
||||
myCircle (theCircle)
|
||||
{
|
||||
myFShape = aShape;
|
||||
myVal = aVal;
|
||||
myText = aText;
|
||||
mySymbolPrs = aSymbolPrs;
|
||||
myPosition = aPosition;
|
||||
myAutomaticPosition = Standard_False;
|
||||
#ifdef BUC60915
|
||||
SetArrowSize( anArrowSize );
|
||||
#else
|
||||
myArrowSize = anArrowSize;
|
||||
#endif
|
||||
SetKindOfDimension(AIS_KOD_DIAMETER);
|
||||
SetSpecialSymbol (0x00D8);
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
myFirstPoint = theAttachPoint;
|
||||
// Count the second point
|
||||
if (Abs(myFirstPoint.Distance (theCircle.Location()) - theCircle.Radius()) < Precision::Confusion())
|
||||
{
|
||||
mySecondPoint = myFirstPoint.Translated(gp_Vec(myFirstPoint, theCircle.Location())*2);
|
||||
}
|
||||
else
|
||||
{
|
||||
myFirstPoint = ElCLib::Value(0, myCircle);
|
||||
mySecondPoint = myFirstPoint.Translated(gp_Vec(myFirstPoint, theCircle.Location())*2);
|
||||
}
|
||||
myIsInitialized = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const Handle(Prs3d_DimensionAspect)& theDimensionStyle,
|
||||
const Standard_Real theExtensionSize /*= 1.0*/)
|
||||
: AIS_Dimension (theExtensionSize),
|
||||
myFlyout (0.0),
|
||||
myCircle (theCircle)
|
||||
{
|
||||
SetKindOfDimension(AIS_KOD_DIAMETER);
|
||||
SetSpecialSymbol (0x00D8);
|
||||
SetDisplaySpecialSymbol(AIS_DSS_Before);
|
||||
myDrawer->SetDimensionAspect(theDimensionStyle);
|
||||
myIsInitialized = Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose : Universal constructor for diameter dimension of shape
|
||||
//=======================================================================
|
||||
|
||||
AIS_DiameterDimension::AIS_DiameterDimension (const TopoDS_Shape& theShape)
|
||||
: AIS_Dimension (),
|
||||
myFlyout (0.)
|
||||
{
|
||||
SetKindOfDimension(AIS_KOD_DIAMETER);
|
||||
SetSpecialSymbol (0x00D8);
|
||||
SetDisplaySpecialSymbol(AIS_DSS_Before);
|
||||
myFirstShape = theShape;
|
||||
myIsInitialized = Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -131,590 +150,100 @@ AIS_DiameterDimension::AIS_DiameterDimension(const TopoDS_Shape& aShape,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::Compute(
|
||||
const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
void AIS_DiameterDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
aPresentation->Clear();
|
||||
thePresentation->Clear();
|
||||
|
||||
switch (myFShape.ShapeType()) {
|
||||
case TopAbs_FACE :
|
||||
{
|
||||
// compute one face case
|
||||
ComputeOneFaceDiameter (aPresentation);
|
||||
break;
|
||||
}
|
||||
case TopAbs_EDGE:
|
||||
{
|
||||
ComputeOneEdgeDiameter (aPresentation);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose : to avoid warning
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_DiameterDimension::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
|
||||
}
|
||||
|
||||
void AIS_DiameterDimension::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_DiameterDimension::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeSelection(
|
||||
const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
Handle(AIS_DimensionOwner) own = new AIS_DimensionOwner(this,7);
|
||||
own->SetShape(myFShape);
|
||||
|
||||
if (!myIsAnArc) {
|
||||
gp_Pnt AttachmentPoint = myPosition;
|
||||
Standard_Real parat = ElCLib::Parameter(myCircle,AttachmentPoint);
|
||||
gp_Pnt ptoncirc = ElCLib::Value (parat,myCircle);
|
||||
|
||||
// ligne de cote
|
||||
|
||||
gp_Pnt center = myCircle.Location();
|
||||
gp_Vec vecrap (ptoncirc,center);
|
||||
|
||||
Standard_Real dist = center.Distance(AttachmentPoint);
|
||||
Standard_Real aRadius = myCircle.Radius();
|
||||
Standard_Real inside = Standard_False;
|
||||
|
||||
gp_Pnt pt1 = AttachmentPoint;
|
||||
if (dist < aRadius) {
|
||||
pt1 = ptoncirc;
|
||||
dist = aRadius;
|
||||
inside = Standard_True;
|
||||
}
|
||||
vecrap.Normalize();
|
||||
vecrap *= (dist+aRadius);
|
||||
gp_Pnt OppositePoint = pt1.Translated(vecrap);
|
||||
|
||||
if ( pt1.Distance(OppositePoint)>=Precision::Confusion()) {
|
||||
Handle(Select3D_SensitiveSegment)
|
||||
seg = new Select3D_SensitiveSegment(own,pt1 ,OppositePoint);
|
||||
aSelection->Add(seg);
|
||||
}
|
||||
}
|
||||
else
|
||||
ComputeArcSelection(aSelection);
|
||||
|
||||
// Text
|
||||
Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
|
||||
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox( own,
|
||||
myPosition.X(),
|
||||
myPosition.Y(),
|
||||
myPosition.Z(),
|
||||
myPosition.X() + size,
|
||||
myPosition.Y() + size,
|
||||
myPosition.Z() + size);
|
||||
aSelection->Add(box);
|
||||
}
|
||||
//==========================================================================
|
||||
// function : ComputeArcSelection
|
||||
// purpose :
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeArcSelection(const Handle(SelectMgr_Selection)& aSelection)
|
||||
{
|
||||
|
||||
Standard_Real fpara;
|
||||
Standard_Real lpara;
|
||||
fpara = myFirstPar;
|
||||
lpara = myLastPar;
|
||||
|
||||
Handle(SelectMgr_EntityOwner) own = new SelectMgr_EntityOwner(this,7);
|
||||
gp_Pnt theCenter = myCircle.Location();
|
||||
while (lpara > 2*M_PI) {
|
||||
fpara -= 2*M_PI;
|
||||
lpara -= 2*M_PI;
|
||||
}
|
||||
Standard_Real parat = ElCLib::Parameter(myCircle,myPosition);
|
||||
Standard_Boolean otherside(Standard_False);
|
||||
gp_Pnt attpoint = myPosition;
|
||||
|
||||
if (!AIS::InDomain(fpara,lpara,parat)) {
|
||||
Standard_Real otherpar = parat + M_PI;
|
||||
if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
|
||||
if (AIS::InDomain(fpara,lpara,otherpar)) {
|
||||
parat = otherpar;
|
||||
otherside = Standard_True;
|
||||
}
|
||||
else {
|
||||
Standard_Real ecartpar = Min(Abs(fpara-parat),
|
||||
Abs(lpara-parat));
|
||||
Standard_Real ecartoth = Min(Abs(fpara-otherpar),
|
||||
Abs(lpara-otherpar));
|
||||
if (ecartpar <= ecartoth) {
|
||||
if (parat < fpara) parat = fpara;
|
||||
else parat = lpara;
|
||||
}
|
||||
else {
|
||||
otherside = Standard_True;
|
||||
if (otherpar < fpara) parat = fpara;
|
||||
else parat = lpara;
|
||||
}
|
||||
gp_Pnt ptdir = ElCLib::Value(parat,myCircle);
|
||||
gp_Lin lsup(theCenter,
|
||||
gp_Dir(ptdir.XYZ()-theCenter.XYZ()));
|
||||
Standard_Real parpos = ElCLib::Parameter(lsup,myPosition);
|
||||
attpoint = ElCLib::Value(parpos,lsup);
|
||||
}
|
||||
}
|
||||
gp_Pnt ptoncirc = ElCLib::Value(parat,myCircle);
|
||||
gp_Lin L (theCenter,gp_Dir(attpoint.XYZ()-theCenter.XYZ()));
|
||||
gp_Pnt firstpoint = attpoint;
|
||||
gp_Pnt drawtopoint = ptoncirc;
|
||||
|
||||
if (!otherside) {
|
||||
Standard_Real uatt = ElCLib::Parameter(L,attpoint);
|
||||
Standard_Real uptc = ElCLib::Parameter(L,ptoncirc);
|
||||
if (Abs(uatt) > Abs(uptc)) {
|
||||
drawtopoint = theCenter;
|
||||
}
|
||||
else {
|
||||
firstpoint = theCenter;
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Select3D_SensitiveSegment) seg = new Select3D_SensitiveSegment(own,firstpoint,drawtopoint);
|
||||
aSelection->Add(seg);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeOneFaceDiameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeOneFaceDiameter(
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
//cout<<"AIS_DiameterDimension::ComputeOneFaceDiameter"<<endl;
|
||||
|
||||
gp_Pln aPln;
|
||||
Handle( Geom_Surface ) aBasisSurf;
|
||||
AIS_KindOfSurface aSurfType = AIS_KOS_OtherSurface;
|
||||
Standard_Real Offset;
|
||||
if( myAutomaticPosition )
|
||||
AIS::GetPlaneFromFace( TopoDS::Face( myFShape),
|
||||
aPln,
|
||||
aBasisSurf,
|
||||
aSurfType,
|
||||
Offset ) ;
|
||||
|
||||
if ( aSurfType == AIS_KOS_Plane )
|
||||
ComputeOnePlanarFaceDiameter( aPresentation );
|
||||
else
|
||||
ComputeOneCylFaceDiameter( aPresentation, aSurfType, aBasisSurf );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeOneCylFaceDiameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeOneCylFaceDiameter
|
||||
(const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const AIS_KindOfSurface aSurfType,
|
||||
const Handle( Geom_Surface )& aBasisSurf )
|
||||
{
|
||||
gp_Pnt curPos;
|
||||
if( myAutomaticPosition )
|
||||
{
|
||||
BRepAdaptor_Surface surf1(TopoDS::Face(myFShape));
|
||||
Standard_Real uFirst, uLast, vFirst, vLast;
|
||||
uFirst = surf1.FirstUParameter();
|
||||
uLast = surf1.LastUParameter();
|
||||
vFirst = surf1.FirstVParameter();
|
||||
vLast = surf1.LastVParameter();
|
||||
Standard_Real uMid = (uFirst + uLast)*0.5;
|
||||
Standard_Real vMid = (vFirst + vLast)*0.5;
|
||||
surf1.D0(uMid, vMid, curPos);
|
||||
Handle( Adaptor3d_HCurve ) BasisCurve;
|
||||
//Standard_Real Param;
|
||||
Standard_Boolean ExpectedType = Standard_False;
|
||||
if (aSurfType == AIS_KOS_Cylinder)
|
||||
{
|
||||
ExpectedType = Standard_True;
|
||||
}
|
||||
else
|
||||
if (aSurfType == AIS_KOS_Revolution)
|
||||
{
|
||||
BasisCurve = surf1.BasisCurve();
|
||||
if (BasisCurve->GetType() == GeomAbs_Line)
|
||||
ExpectedType = Standard_True;
|
||||
}
|
||||
else if (aSurfType == AIS_KOS_Extrusion)
|
||||
{
|
||||
BasisCurve = surf1.BasisCurve();
|
||||
if ( BasisCurve->GetType() == GeomAbs_Circle )
|
||||
ExpectedType = Standard_True;
|
||||
}
|
||||
if(!ExpectedType) {
|
||||
Standard_ConstructionError::Raise("AIS:: Not expected type of surface") ;
|
||||
return;
|
||||
}
|
||||
//
|
||||
Handle(Geom_Curve) aCurve;
|
||||
aCurve = aBasisSurf->VIso(vMid);
|
||||
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
|
||||
{
|
||||
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();//gp_Circ
|
||||
}
|
||||
else if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
Handle(Geom_TrimmedCurve) tCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve);
|
||||
aCurve = tCurve->BasisCurve();
|
||||
uFirst = tCurve->FirstParameter();
|
||||
uLast = tCurve->LastParameter();
|
||||
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
|
||||
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();//gp_Circ
|
||||
}
|
||||
else {
|
||||
// compute a circle from 3 points on "aCurve"
|
||||
gp_Pnt P1, P2;
|
||||
surf1.D0(uFirst, vMid, P1);
|
||||
surf1.D0(uLast, vMid, P2);
|
||||
GC_MakeCircle mkCirc(P1, curPos, P2);
|
||||
myCircle = mkCirc.Value()->Circ();
|
||||
}
|
||||
myCircle.SetRadius(myVal/2.);
|
||||
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
|
||||
gp_Vec v1(myCircle.Location(), curPos);
|
||||
v1.Normalize();
|
||||
v1 = v1 * myVal*1.2;
|
||||
myPosition = myCircle.Location().Translated(v1);
|
||||
// IsArc ?
|
||||
gp_Pnt p1, p2;
|
||||
p1 = ElCLib::Value (uFirst, myCircle);
|
||||
p2 = ElCLib::Value (uLast, myCircle);
|
||||
if ( p1.IsEqual(p2, Precision::Confusion()) )
|
||||
myIsAnArc = Standard_False;
|
||||
else myIsAnArc = Standard_True;
|
||||
myFirstPar = uFirst;
|
||||
myLastPar = uLast;
|
||||
// myPosition = curPos;
|
||||
myAutomaticPosition = Standard_True;
|
||||
if ( myIsSetBndBox )
|
||||
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
|
||||
myPosition ) ), myBndBox );
|
||||
}
|
||||
else { // !AutomaticPosition
|
||||
curPos = myPosition;
|
||||
curPos = AIS::ProjectPointOnPlane( curPos, myPlane->Pln() );
|
||||
myPosition = curPos;
|
||||
}
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
|
||||
// size
|
||||
#ifdef BUC60915
|
||||
if( !myArrowSizeIsDefined ) {
|
||||
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
|
||||
}
|
||||
arr->SetLength(myArrowSize);
|
||||
#else
|
||||
if (myCircle.Radius()/5. > myArrowSize) {
|
||||
arr->SetLength(myArrowSize);
|
||||
}
|
||||
else {
|
||||
arr->SetLength(myCircle.Radius()/5.);
|
||||
}
|
||||
#endif
|
||||
|
||||
//cout<<"AIS_DiameterDimension:: add Prs"<<endl;
|
||||
if( myIsAnArc )
|
||||
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
|
||||
myCircle, myFirstPar, myLastPar, mySymbolPrs, myDiamSymbol);
|
||||
else
|
||||
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
|
||||
myCircle, DsgPrs_AS_BOTHAR, myDiamSymbol);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeCircleDiameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeCircleDiameter(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
gp_Pnt center = myCircle.Location();
|
||||
Standard_Real rad = myCircle.Radius();
|
||||
gp_Pnt curpos;
|
||||
|
||||
if (myAutomaticPosition) {
|
||||
// we compute 1 point on the circle
|
||||
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
|
||||
gp_Dir xdir = myCircle.XAxis().Direction();
|
||||
Standard_Real deport = rad *1.2;
|
||||
curpos = center.Translated( gp_Vec(xdir)*deport );
|
||||
SetPosition (curpos);// myPosition = curpos
|
||||
myAutomaticPosition = Standard_True;
|
||||
if (myIsSetBndBox)
|
||||
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
|
||||
myPosition ) ), myBndBox );
|
||||
}
|
||||
else {
|
||||
curpos = myPosition;
|
||||
// VRO (2007-05-17) inserted this IF.
|
||||
if (myPlane.IsNull())
|
||||
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));
|
||||
myPosition = AIS::ProjectPointOnPlane( curpos, myPlane->Pln() );
|
||||
}
|
||||
|
||||
// size
|
||||
Handle(Prs3d_LengthAspect) LA = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = LA->Arrow1Aspect();
|
||||
|
||||
#ifdef BUC60915
|
||||
if( !myArrowSizeIsDefined ) {
|
||||
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
|
||||
}
|
||||
arr->SetLength(myArrowSize);
|
||||
#else
|
||||
if (myCircle.Radius()/5. > myArrowSize) {
|
||||
arr->SetLength(myArrowSize);
|
||||
}
|
||||
else {
|
||||
arr->SetLength(myCircle.Radius()/5.);
|
||||
}
|
||||
#endif
|
||||
|
||||
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition, myCircle,
|
||||
DsgPrs_AS_BOTHAR, myDiamSymbol );
|
||||
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
// function : ComputeArcDiameter
|
||||
// purpose :
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeArcDiameter(
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const gp_Pnt& pfirst,
|
||||
const gp_Pnt& pend)
|
||||
{
|
||||
|
||||
gp_Pnt center = myCircle.Location();
|
||||
Standard_Real rad = myCircle.Radius();
|
||||
|
||||
gp_Pnt curpos;
|
||||
Standard_Real parfirst, parend;
|
||||
|
||||
parfirst = ElCLib::Parameter(myCircle, pfirst);
|
||||
parend = ElCLib::Parameter(myCircle, pend);
|
||||
myFirstPar = parfirst;
|
||||
myLastPar = parend;
|
||||
if ( parfirst > parend) {
|
||||
parfirst -= 2*M_PI;
|
||||
}
|
||||
if (myAutomaticPosition) {
|
||||
Standard_Real pcurpos = (parfirst + parend)/2.;
|
||||
curpos = ElCLib::Value(pcurpos, myCircle);
|
||||
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
|
||||
gp_Dir vdir(gp_Vec(myCircle.Location(),curpos));
|
||||
Standard_Real deport = rad * 1.2;
|
||||
curpos = center.Translated( gp_Vec(vdir)*deport );
|
||||
|
||||
SetPosition (curpos);
|
||||
myAutomaticPosition = Standard_True;
|
||||
|
||||
if ( myIsSetBndBox )
|
||||
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
|
||||
myPosition ) ), myBndBox );
|
||||
|
||||
}
|
||||
else {
|
||||
curpos = myPosition;
|
||||
myPosition = AIS::ProjectPointOnPlane( curpos, myPlane->Pln() );
|
||||
}
|
||||
|
||||
// size
|
||||
|
||||
Handle(Prs3d_LengthAspect) LA = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = LA->Arrow1Aspect();
|
||||
|
||||
#ifdef BUC60915
|
||||
if( !myArrowSizeIsDefined ) {
|
||||
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
|
||||
}
|
||||
arr->SetLength(myArrowSize);
|
||||
#else
|
||||
if (myCircle.Radius()/5. > myArrowSize) {
|
||||
arr->SetLength(myArrowSize);
|
||||
}
|
||||
else {
|
||||
arr->SetLength(myCircle.Radius()/5.);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Display
|
||||
DsgPrs_DiameterPresentation::Add (aPresentation, myDrawer, myText, myPosition, myCircle,
|
||||
parfirst, parend, mySymbolPrs, myDiamSymbol);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
// function : ComputeOneEdgeDiameter
|
||||
// purpose :
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeOneEdgeDiameter(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
gp_Pnt ptfirst,ptend;
|
||||
Handle(Geom_Curve) curv;
|
||||
if (!AIS::ComputeGeometry(TopoDS::Edge(myFShape),curv,ptfirst,ptend)) return;
|
||||
|
||||
Handle(Geom_Circle) circ = Handle(Geom_Circle)::DownCast(curv);
|
||||
if ( circ.IsNull()) return;
|
||||
|
||||
myCircle = circ->Circ();
|
||||
myCircle.SetRadius(myVal/2.);
|
||||
if ( ptfirst.IsEqual(ptend, Precision::Confusion()) ) {
|
||||
myIsAnArc = Standard_False;
|
||||
ComputeCircleDiameter(aPresentation);
|
||||
}
|
||||
else {
|
||||
myIsAnArc = Standard_True;
|
||||
ComputeArcDiameter(aPresentation,ptfirst,ptend );
|
||||
}
|
||||
}
|
||||
|
||||
//===================================================================
|
||||
//function : CircleFromPlanarFace
|
||||
//purpose : if possible computes circle from planar face
|
||||
//=======================================================================
|
||||
static Standard_Boolean CircleFromPlanarFace(const TopoDS_Face& aFace,
|
||||
Handle(Geom_Curve)& aCurve,
|
||||
gp_Pnt & ptfirst, gp_Pnt & ptend)
|
||||
{
|
||||
TopExp_Explorer ExploEd( aFace, TopAbs_EDGE );
|
||||
for ( ; ExploEd.More(); ExploEd.Next())
|
||||
{
|
||||
TopoDS_Edge curedge = TopoDS::Edge( ExploEd.Current() );
|
||||
if (AIS::ComputeGeometry(curedge, aCurve, ptfirst, ptend))
|
||||
if(aCurve->IsInstance(STANDARD_TYPE(Geom_Circle)) &&
|
||||
!Handle(Geom_Circle)::DownCast(aCurve).IsNull())
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeOnePlanarFaceDiameter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::ComputeOnePlanarFaceDiameter(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
gp_Pnt curPos ;
|
||||
Standard_Real parfirst =0., parend =0.;
|
||||
if (myAutomaticPosition) {
|
||||
Handle(Geom_Curve) curv;
|
||||
gp_Pnt ptfirst,ptend;
|
||||
|
||||
if( !CircleFromPlanarFace( TopoDS::Face( myFShape ), curv, ptfirst, ptend) ) {
|
||||
Standard_ConstructionError::Raise("AIS:: Curve is not a circle or is Null") ;
|
||||
return;
|
||||
}
|
||||
|
||||
myCircle = Handle(Geom_Circle)::DownCast(curv)->Circ();
|
||||
if ( ptfirst.IsEqual(ptend, Precision::Confusion()) )
|
||||
myIsAnArc = Standard_False;
|
||||
if (!myIsInitialized)
|
||||
{
|
||||
if (!initCircularDimension (myFirstShape, myCircle,
|
||||
myFirstPoint, mySecondPoint))
|
||||
return;
|
||||
else
|
||||
myIsAnArc = Standard_True;
|
||||
myCircle.SetRadius(myVal/2.);//
|
||||
BRepAdaptor_Surface surfAlgo (TopoDS::Face(myFShape));
|
||||
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));//gp_Circ
|
||||
gp_Pnt center = myCircle.Location();
|
||||
Standard_Real rad = myCircle.Radius();
|
||||
Standard_Real deport = rad * 1.2;
|
||||
if(! myIsAnArc ) { // Circle
|
||||
gp_Dir xdir = myCircle.XAxis().Direction();
|
||||
curPos = center.Translated( gp_Vec(xdir)*deport );
|
||||
}
|
||||
else { // Arc
|
||||
parfirst = ElCLib::Parameter(myCircle, ptfirst);
|
||||
parend = ElCLib::Parameter(myCircle, ptend);
|
||||
if ( parfirst > parend) {
|
||||
parfirst -= 2*M_PI;
|
||||
}
|
||||
Standard_Real parcurPos = (parfirst + parend) * 0.5;
|
||||
curPos = ElCLib::Value(parcurPos, myCircle);
|
||||
gp_Vec v1( center, curPos );
|
||||
v1.Normalize();
|
||||
curPos = center.Translated( v1 * deport );
|
||||
}
|
||||
myFirstPar = parfirst;
|
||||
myLastPar = parend;
|
||||
myPosition = curPos;
|
||||
myAutomaticPosition = Standard_True;
|
||||
if ( myIsSetBndBox )
|
||||
myPosition = AIS::TranslatePointToBound( myPosition, gp_Dir( gp_Vec( myCircle.Location(),
|
||||
myPosition ) ), myBndBox );
|
||||
} else
|
||||
{
|
||||
// !myAutomaticPosition
|
||||
// Project point on the plane of face
|
||||
curPos = myPosition;
|
||||
curPos = AIS::ProjectPointOnPlane( curPos, myPlane->Pln() );
|
||||
myPosition = curPos;
|
||||
}
|
||||
myIsInitialized = Standard_True;
|
||||
}
|
||||
if (!myIsWorkingPlaneCustom)
|
||||
countDefaultPlane();
|
||||
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
//Count flyout direction
|
||||
gp_Ax1 aWorkingPlaneNormal = GetWorkingPlane().Axis();
|
||||
gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
|
||||
// Count a flyout direction vector.
|
||||
gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
|
||||
gp_Ax3 aLocalSystem (myFirstPoint, aTargetPointsVector, aFlyoutVector);
|
||||
|
||||
// size
|
||||
#ifdef BUC60915
|
||||
if( !myArrowSizeIsDefined ) {
|
||||
myArrowSize = Min(myArrowSize,myCircle.Radius()/5.);
|
||||
// Create lines for layouts
|
||||
gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
|
||||
gp_Lin aLine2 (mySecondPoint, aFlyoutVector);
|
||||
|
||||
// Get flyout end points
|
||||
gp_Pnt aFlyoutEnd1 = ElCLib::Value (ElCLib::Parameter (aLine1, myFirstPoint) + GetFlyout(), aLine1);
|
||||
gp_Pnt aFlyoutEnd2 = ElCLib::Value (ElCLib::Parameter (aLine2, mySecondPoint) + GetFlyout(), aLine2);
|
||||
|
||||
// Add layout lines to graphic group
|
||||
// Common to all type of dimension placement.
|
||||
if (theMode == 0)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments(4);
|
||||
aPrimSegments->AddVertex (myFirstPoint);
|
||||
aPrimSegments->AddVertex (aFlyoutEnd1);
|
||||
|
||||
aPrimSegments->AddVertex (mySecondPoint);
|
||||
aPrimSegments->AddVertex (aFlyoutEnd2);
|
||||
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
}
|
||||
arr->SetLength(myArrowSize);
|
||||
#else
|
||||
if (myCircle.Radius()/5. > myArrowSize) {
|
||||
arr->SetLength(myArrowSize);
|
||||
}
|
||||
else {
|
||||
arr->SetLength(myCircle.Radius()/5.);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(! myIsAnArc )
|
||||
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
|
||||
myCircle, DsgPrs_AS_BOTHAR, myDiamSymbol);
|
||||
else
|
||||
DsgPrs_DiameterPresentation::Add(aPresentation, myDrawer, myText, myPosition,
|
||||
myCircle, myFirstPar, myLastPar, mySymbolPrs, myDiamSymbol );
|
||||
|
||||
drawLinearDimension (thePresentation, aFlyoutEnd1, aFlyoutEnd2, (AIS_DimensionDisplayMode)theMode);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : computeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::computeValue ()
|
||||
{
|
||||
myValue = myFirstPoint.Distance (mySecondPoint);
|
||||
AIS_Dimension::computeValue();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : countDefaultPlane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::countDefaultPlane ()
|
||||
{
|
||||
// Compute normal of the default plane.
|
||||
//gp_Vec aVec1(mySecondPoint, myFirstPoint),
|
||||
// aVec2(mySecondPoint, ElCLib::Value(M_PI_2, myCircle));
|
||||
myDefaultPlane = gp_Pln(gp_Ax3(myCircle.Position()));
|
||||
// Set computed value to <myWorkingPlane>
|
||||
ResetWorkingPlane ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetFlyout
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DiameterDimension::SetFlyout (const Standard_Real theFlyout)
|
||||
{
|
||||
myFlyout = theFlyout;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFlyout
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real AIS_DiameterDimension::GetFlyout () const
|
||||
{
|
||||
return myFlyout;
|
||||
}
|
||||
|
85
src/AIS/AIS_DiameterDimension.hxx
Normal file
85
src/AIS/AIS_DiameterDimension.hxx
Normal file
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 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.
|
||||
#ifndef _AIS_DiameterDimension_HeaderFile
|
||||
#define _AIS_DiameterDimension_HeaderFile
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Dimension.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_DiameterDimension,AIS_Dimension)
|
||||
|
||||
//! A framework to display diameter dimensions. <br>
|
||||
//! A diameter is displayed with arrows and text. The <br>
|
||||
//! text gives the length of the diameter. <br>
|
||||
//! The algorithm takes a length along a face and <br>
|
||||
//! analyzes it as an arc. It then reconstructs the circle <br>
|
||||
//! corresponding to the arc and calculates the <br>
|
||||
//! diameter of this circle. This diameter serves as a <br>
|
||||
//! relational reference in 3d presentations of the surface. <br>
|
||||
class AIS_DiameterDimension : public AIS_Dimension
|
||||
{
|
||||
public:
|
||||
//! Constructs a diameter display object defined by the <br>
|
||||
//! circle <theCircle>
|
||||
Standard_EXPORT AIS_DiameterDimension(const gp_Circ& theCircle);
|
||||
//! Consctructor that allows to set a attach point <br>
|
||||
//! on the circle <theCircle> where to attach dimension
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint);
|
||||
|
||||
Standard_EXPORT AIS_DiameterDimension (const gp_Circ& theCircle,
|
||||
const Handle(Prs3d_DimensionAspect)& theDimensionStyle,
|
||||
const Standard_Real theExtensionSize = 1.0);
|
||||
|
||||
Standard_EXPORT AIS_DiameterDimension (const TopoDS_Shape& theShape);
|
||||
|
||||
|
||||
Standard_EXPORT void SetFlyout(const Standard_Real theFlyout);
|
||||
|
||||
Standard_EXPORT Standard_Real GetFlyout () const;
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_DiameterDimension)
|
||||
|
||||
protected:
|
||||
|
||||
Standard_EXPORT virtual void computeValue ();
|
||||
//! Fills default plane object if it is possible to count plane automatically.
|
||||
Standard_EXPORT virtual void countDefaultPlane ();
|
||||
|
||||
private:
|
||||
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
// Fields
|
||||
|
||||
//! 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 <myFlyout> value.
|
||||
//! The direction vector is counting using the working plane.
|
||||
//! <myFlyout> value defined the size of flyout.
|
||||
Standard_Real myFlyout;
|
||||
gp_Circ myCircle;
|
||||
};
|
||||
#endif
|
@@ -1,61 +0,0 @@
|
||||
// Created on: 1997-02-28
|
||||
// Created by: Jean-Pierre COMBE, Serguei ZARITCHNY
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 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.
|
||||
|
||||
// Modified Mon 12-january-98
|
||||
// <jpr> <szy>
|
||||
|
||||
//=======================================================================
|
||||
//function : KindOfDimension
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline AIS_KindOfDimension AIS_DiameterDimension::KindOfDimension() const
|
||||
{
|
||||
return AIS_KOD_DIAMETER;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsMovable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean AIS_DiameterDimension::IsMovable() const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DiamSymbol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean AIS_DiameterDimension::DiamSymbol()
|
||||
{
|
||||
return myDiamSymbol;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDiamSymbol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void AIS_DiameterDimension::SetDiamSymbol(const Standard_Boolean aDiamSymbol)
|
||||
{
|
||||
myDiamSymbol = aDiamSymbol;
|
||||
}
|
1344
src/AIS/AIS_Dimension.cxx
Normal file
1344
src/AIS/AIS_Dimension.cxx
Normal file
File diff suppressed because it is too large
Load Diff
317
src/AIS/AIS_Dimension.hxx
Normal file
317
src/AIS/AIS_Dimension.hxx
Normal file
@@ -0,0 +1,317 @@
|
||||
// Copyright (c) 1998-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.
|
||||
|
||||
#ifndef _AIS_Dimension_Headerfile
|
||||
#define _AIS_Dimension_Headerfile
|
||||
|
||||
#include <AIS_DimensionDisplayMode.hxx>
|
||||
#include <AIS_DisplaySpecialSymbol.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <AIS_KindOfSurface.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <Prs3d_VerticalTextAlignment.hxx>
|
||||
#include <Select3D_ListOfSensitive.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_Dimension, AIS_InteractiveObject)
|
||||
|
||||
class AIS_Dimension : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
//! Constructor with default parameters values
|
||||
Standard_EXPORT AIS_Dimension (const Standard_Real theExtensionSize = 1.0);
|
||||
//! Constructor to set aspect of dimension
|
||||
Standard_EXPORT AIS_Dimension (const Handle(Prs3d_DimensionAspect)& theAspect,
|
||||
const Standard_Real theExtensionSize = 1.0);
|
||||
//! Gets dimension value
|
||||
Standard_EXPORT Standard_Real GetValue () const;
|
||||
|
||||
//! Sets dimension value
|
||||
//! Attention! This method is used ONLY to set custom value.
|
||||
//! To set value internally, use <myValue>.
|
||||
Standard_EXPORT void SetCustomValue (const Standard_Real theValue);
|
||||
|
||||
//! Gets working plane.
|
||||
Standard_EXPORT const gp_Pln& GetWorkingPlane() const;
|
||||
|
||||
//! Sets working plane.
|
||||
Standard_EXPORT void SetWorkingPlane (const gp_Pln& thePlane);
|
||||
|
||||
//! Sets extension size.
|
||||
Standard_EXPORT void SetExtensionSize (const Standard_Real theExtensionSize);
|
||||
|
||||
//! Gets extension size.
|
||||
Standard_EXPORT Standard_Real GetExtensionSize() const;
|
||||
|
||||
Standard_EXPORT void SetFirstPoint (const gp_Pnt& thePoint);
|
||||
|
||||
Standard_EXPORT void SetSecondPoint (const gp_Pnt& thePoint);
|
||||
|
||||
Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theFirstShape);
|
||||
|
||||
Standard_EXPORT void SetSecondShape (const TopoDS_Shape& theSecondShape);
|
||||
|
||||
//! Gets the dimension aspect from AIS object drawer.
|
||||
//! Dimension aspect contains aspects of line, text and arrows for dimension presentation.
|
||||
Standard_EXPORT Handle(Prs3d_DimensionAspect) DimensionAspect() const;
|
||||
|
||||
//! Sets new length aspect in the interactive object drawer.
|
||||
Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theDimensionAspect);
|
||||
|
||||
//! Returns the kind of dimension
|
||||
Standard_EXPORT AIS_KindOfDimension KindOfDimension() const;
|
||||
|
||||
//! Returns the kind of interactive
|
||||
Standard_EXPORT virtual AIS_KindOfInteractive Type() const;
|
||||
|
||||
//! Sets the kind of dimension
|
||||
Standard_EXPORT virtual void SetKindOfDimension (const AIS_KindOfDimension theKindOfDimension);
|
||||
|
||||
//! Returns true if the class of objects accepts the display mode theMode.
|
||||
//! The interactive context can have a default mode of
|
||||
//! representation for the set of Interactive Objects. This
|
||||
//! mode may not be accepted by object
|
||||
Standard_EXPORT virtual Standard_Boolean AcceptDisplayMode(const Standard_Integer theMode) const;
|
||||
// Selection computing if it is needed here
|
||||
Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
|
||||
const Standard_Integer theMode);
|
||||
//! Reset working plane to default.
|
||||
Standard_EXPORT void ResetWorkingPlane();
|
||||
//! specifies dimension special symbol display options
|
||||
Standard_EXPORT void SetDisplaySpecialSymbol (const AIS_DisplaySpecialSymbol theDisplaySpecSymbol);
|
||||
//! shows dimension special symbol display options
|
||||
Standard_EXPORT AIS_DisplaySpecialSymbol DisplaySpecialSymbol() const;
|
||||
//! specifies special symbol
|
||||
Standard_EXPORT void SetSpecialSymbol (const Standard_ExtCharacter theSpecialSymbol);
|
||||
//! returns special symbol
|
||||
Standard_EXPORT Standard_ExtCharacter SpecialSymbol() const;
|
||||
//! shows if Units are to be displayed along with dimension value
|
||||
Standard_EXPORT Standard_Boolean IsUnitsDisplayed() const;
|
||||
//! sets to display units along with the dimansion value or no
|
||||
Standard_EXPORT void MakeUnitsDisplayed (const Standard_Boolean toDisplayUnits);
|
||||
//! returns the current type of units
|
||||
Standard_EXPORT TCollection_AsciiString UnitsQuantity() const;
|
||||
//! sets the current type of units
|
||||
Standard_EXPORT void SetUnitsQuantity (const TCollection_AsciiString& theUnitsQuantity);
|
||||
//! returns the current model units
|
||||
Standard_EXPORT TCollection_AsciiString ModelUnits() const;
|
||||
//! sets the current model units
|
||||
Standard_EXPORT void SetModelUnits (const TCollection_AsciiString& theUnits);
|
||||
//! returns the current display units
|
||||
Standard_EXPORT TCollection_AsciiString DisplayUnits() const;
|
||||
//! sets the current display units
|
||||
Standard_EXPORT void SetDisplayUnits (const TCollection_AsciiString& theUnits);
|
||||
//! sets the text offset: distance from attach point to the text on the extension
|
||||
//! in case if text isn't in center of the dimension line
|
||||
Standard_EXPORT void SetTextOffset (const Standard_Real theOffset);
|
||||
//! returns the text offset: distance from attach point to the text on the extension
|
||||
//! in case if text isn't in center of the dimension line
|
||||
Standard_EXPORT Standard_Real TextOffset() const;
|
||||
//! Important! Only for 3d text </br>
|
||||
//! 3d text is oriented relative to the attachment points order </br>
|
||||
//! By default, text direction vector is oriented from the first attachment point </br>
|
||||
//! to the second one. This method checks if text direction is to be default or </br>
|
||||
//! should be reversed.
|
||||
Standard_EXPORT Standard_Boolean IsTextReversed() const;
|
||||
//! Important! Only for 3d text
|
||||
//! 3d text is oriented relative to the attachment points order </br>
|
||||
//! By default, text direction vector is oriented from the first attachment point </br>
|
||||
//! to the second one. This method sets value that shows if text direction </br>
|
||||
//! should be reversed or not.
|
||||
Standard_EXPORT void MakeTextReversed (const Standard_Boolean isTextReversed);
|
||||
//! Sets selection tolerance for text2d:
|
||||
//! For 2d text selection detection sensitive point with tolerance is used
|
||||
//! to change this tolerance use this method
|
||||
//! Important! Only for 2d text
|
||||
Standard_EXPORT void SetSelToleranceForText2d (const Standard_Real theTol);
|
||||
//! Returns selection tolerance for text2d:
|
||||
//! For 2d text selection detection sensitive point with tolerance is used
|
||||
//! Important! Only for 2d text
|
||||
Standard_EXPORT Standard_Real SelToleranceForText2d() const;
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_Dimension)
|
||||
|
||||
protected:
|
||||
Standard_EXPORT void getTextWidthAndString (Quantity_Length& theWidth,
|
||||
TCollection_ExtendedString& theString) const;
|
||||
|
||||
Standard_EXPORT Standard_Real valueToDisplayUnits();
|
||||
|
||||
//! Reset working plane to default.
|
||||
Standard_EXPORT void resetWorkingPlane (const gp_Pln& theNewDefaultPlane);
|
||||
|
||||
//! Count default plane
|
||||
Standard_EXPORT virtual void countDefaultPlane();
|
||||
|
||||
//! Computes dimension value in display units
|
||||
Standard_EXPORT virtual void computeValue();
|
||||
|
||||
//! Performs drawing of 2d or 3d arrows on the working plane
|
||||
Standard_EXPORT void drawArrow (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theLocation,
|
||||
const gp_Dir& theDirection);
|
||||
|
||||
//! Performs drawing of 2d or 3d text on the working plane
|
||||
//! @return text width relative to the dimension working plane. For 2d text this value will be zero.
|
||||
Standard_EXPORT Standard_Real drawText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Dir& theTextDir,
|
||||
const TCollection_ExtendedString theText,
|
||||
const AIS_DimensionDisplayMode theMode);
|
||||
|
||||
//! Performs computing of dimension linear extension with text
|
||||
Standard_EXPORT virtual void drawExtensionWithText (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theStartPoint,
|
||||
const gp_Lin& theDimensionLine,
|
||||
const TCollection_ExtendedString& theValueString,
|
||||
const AIS_DimensionDisplayMode theMode);
|
||||
|
||||
//! Performs computing of linear dimension (for length, diameter, radius and so on)
|
||||
Standard_EXPORT void drawLinearDimension (const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const gp_Pnt& theFirstAttach,
|
||||
const gp_Pnt& theSecondAttach,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const Standard_Boolean isOneSideDimension = Standard_False);
|
||||
|
||||
//! If it's possible computes circle from planar face
|
||||
Standard_EXPORT Standard_Boolean circleFromPlanarFace (const TopoDS_Face& theFace,
|
||||
Handle(Geom_Curve)& theCurve,
|
||||
gp_Pnt & theFirstPoint,
|
||||
gp_Pnt & theLastPoint);
|
||||
|
||||
//! Performs initialization of circle and points from given shape
|
||||
//! (for radius, diameter and so on)
|
||||
Standard_EXPORT Standard_Boolean initCircularDimension (const TopoDS_Shape& theShape,
|
||||
gp_Circ& theCircle,
|
||||
gp_Pnt& theMiddleArcPoint,
|
||||
gp_Pnt& theOppositeDiameterPoint);
|
||||
Standard_EXPORT Standard_Boolean isComputed() const;
|
||||
|
||||
Standard_EXPORT void setComputed (Standard_Boolean isComputed);
|
||||
|
||||
Standard_EXPORT gp_Pnt textPosition() const;
|
||||
|
||||
Standard_EXPORT void setTextPosition (const gp_Pnt thePosition);
|
||||
|
||||
Standard_EXPORT void resetGeom();
|
||||
|
||||
// Fields
|
||||
protected:
|
||||
|
||||
/// WORKING PLANE PROPERTIES
|
||||
|
||||
//! Dimension default plane
|
||||
gp_Pln myDefaultPlane;
|
||||
//! Shows if working plane is set custom
|
||||
Standard_Boolean myIsWorkingPlaneCustom;
|
||||
|
||||
/// VALUE PROPERTIES
|
||||
|
||||
//! Dimension value which is displayed with dimension lines
|
||||
Standard_Real myValue;
|
||||
//! Shows if the value is set by user and is no need to count it automatically
|
||||
Standard_Boolean myIsValueCustom;
|
||||
|
||||
/// UNITS PROPERTIES
|
||||
|
||||
//! The quantity of units for the value computation
|
||||
TCollection_AsciiString myUnitsQuantity;
|
||||
//! Units of the model
|
||||
TCollection_AsciiString myModelUnits;
|
||||
//! Units in which the displayed value will be converted
|
||||
TCollection_AsciiString myDisplayUnits;
|
||||
//! Determines if units is to be displayed along with the value
|
||||
Standard_Boolean myToDisplayUnits;
|
||||
//! Special symbol for some kind of dimensions (for diameter, radius and so on)
|
||||
Standard_ExtCharacter mySpecialSymbol;
|
||||
//! Special symbol display options
|
||||
AIS_DisplaySpecialSymbol myDisplaySpecialSymbol;
|
||||
|
||||
/// GEOMETRY PROPERTIES
|
||||
|
||||
//! Geometry of dimensions, needs for advanced selection
|
||||
//! Geometry is computed in Compute() method and is used
|
||||
//! in ComputeSelection() method.
|
||||
//! If it is computed successfully, myIsComputed = Standard_True.
|
||||
//! to check computing result use IsComputed() method
|
||||
struct DimensionGeom
|
||||
{
|
||||
//! Text position
|
||||
gp_Pnt myTextPosition;
|
||||
//! Text bounding box, stored for advanced selection
|
||||
Bnd_Box myTextBndBox;
|
||||
//! Sensitive point tolerance for 2d text selection
|
||||
Standard_Real mySelToleranceForText2d;
|
||||
//! For advanced dimension line selection
|
||||
Select3D_ListOfSensitive mySensitiveSegments;
|
||||
//! Shows if attachment points were computed
|
||||
Standard_Boolean myIsComputed;
|
||||
public:
|
||||
DimensionGeom ()
|
||||
: myIsComputed (Standard_False)
|
||||
{ }
|
||||
};
|
||||
|
||||
//! Shows if text is inverted
|
||||
Standard_Boolean myIsTextReversed;
|
||||
//! Determines distance from attach point to the text on the extension
|
||||
//! in case if text isn't in center of the dimension line
|
||||
Standard_Real myTextOffset;
|
||||
//! Points that are base for dimension.
|
||||
//! My first point of dimension attach (belongs to shape for which dimension is computed)
|
||||
gp_Pnt myFirstPoint;
|
||||
//! My second point of dimension attach (belongs to shape for which dimension is computed)
|
||||
gp_Pnt mySecondPoint;
|
||||
//! Shows if attach points are initialized correctly
|
||||
Standard_Boolean myIsInitialized;
|
||||
//! First shape (can be vertex, edge or face)
|
||||
TopoDS_Shape myFirstShape;
|
||||
//! Second shape (can be vertex, edge or face)
|
||||
TopoDS_Shape mySecondShape;
|
||||
//! Number of shapes
|
||||
Standard_Integer myShapesNumber;
|
||||
//! Geometry of dimensions, needs for advanced selection
|
||||
//! Geometry is computed in Compute() method and is used
|
||||
//! in ComputeSelection() method.
|
||||
//! If it is computed successfully, myIsComputed = Standard_True.
|
||||
//! to check computing result use IsComputed() method
|
||||
DimensionGeom myGeom;
|
||||
private:
|
||||
//! Type of dimension
|
||||
AIS_KindOfDimension myKindOfDimension;
|
||||
//! Dimension working plane, is equal to <myDefaultPlane> if it can be computed automatically.
|
||||
gp_Pln myWorkingPlane;
|
||||
//! Extension size in model measure units.
|
||||
//! No inclined or curved extension line is now supported.
|
||||
Standard_Real myExtensionSize;
|
||||
};
|
||||
#endif
|
@@ -21,49 +21,64 @@
|
||||
|
||||
class DimensionOwner from AIS inherits EntityOwner from SelectMgr
|
||||
|
||||
---Purpose: The owner is the entity which makes it possible to link
|
||||
-- the sensitive primitives and the reference shapes that
|
||||
-- you want to detect. It stocks the various pieces of
|
||||
-- information which make it possible to find objects. An
|
||||
-- owner has a priority which you can modulate, so as to
|
||||
-- make one entity more selectable than another. You
|
||||
-- might want to make edges more selectable than
|
||||
-- faces, for example. In that case, you could attribute sa
|
||||
-- higher priority to the one compared to the other. An
|
||||
-- edge, could have priority 5, for example, and a face,
|
||||
-- priority 4. The default priority is 5.
|
||||
---Purpose: The owner is the entity which makes it possible to link
|
||||
-- the sensitive primitives and the reference shapes that
|
||||
-- you want to detect. It stocks the various pieces of
|
||||
-- information which make it possible to find objects. An
|
||||
-- owner has a priority which you can modulate, so as to
|
||||
-- make one entity more selectable than another. You
|
||||
-- might want to make edges more selectable than
|
||||
-- faces, for example. In that case, you could attribute sa
|
||||
-- higher priority to the one compared to the other. An
|
||||
-- edge, could have priority 5, for example, and a face,
|
||||
-- priority 4. The default priority is 5.
|
||||
|
||||
uses
|
||||
|
||||
SelectableObject from SelectMgr,
|
||||
Shape from TopoDS
|
||||
SelectableObject from SelectMgr,
|
||||
PresentationManager from PrsMgr,
|
||||
PresentationManager3d from PrsMgr,
|
||||
NameOfColor from Quantity,
|
||||
DimensionDisplayMode from AIS
|
||||
|
||||
is
|
||||
|
||||
Create ( aSO : SelectableObject;
|
||||
aPriority : Integer from Standard =0)
|
||||
Create (theSelObject : SelectableObject;
|
||||
theDisplayMode : DimensionDisplayMode from AIS;
|
||||
thePriority : Integer from Standard = 0)
|
||||
returns mutable DimensionOwner from AIS;
|
||||
---Purpose:
|
||||
-- Initializes the dimension owner, aSO, and attributes it
|
||||
-- the priority, aPriority.
|
||||
|
||||
SetShape(me : mutable; aShape : Shape from TopoDS);
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Constructs the reference shape owner aShape for
|
||||
-- presentation primitives.
|
||||
|
||||
FixedShape(me)
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Returns the owner shape whose primitives we are concerned with.
|
||||
returns Shape from TopoDS;
|
||||
|
||||
---Purpose:
|
||||
-- Initializes the dimension owner, theSO, and attributes it
|
||||
-- the priority, thePriority.
|
||||
|
||||
SetDisplayMode (me : mutable; theMode : DimensionDisplayMode from AIS);
|
||||
|
||||
DisplayMode (me)
|
||||
returns DimensionDisplayMode from AIS;
|
||||
|
||||
HilightWithColor (me : mutable;
|
||||
thePM : PresentationManager3d from PrsMgr;
|
||||
theColor : NameOfColor from Quantity;
|
||||
theMode : Integer from Standard = 0)
|
||||
is redefined virtual;
|
||||
|
||||
IsHilighted (me;
|
||||
thePM : PresentationManager from PrsMgr;
|
||||
theMode : Integer from Standard =0)
|
||||
returns Boolean from Standard is redefined virtual;
|
||||
---Purpose: Returns true if an object with the selection mode
|
||||
-- aMode is highlighted in the presentation manager aPM.
|
||||
|
||||
Hilight(me : mutable;
|
||||
thePM : PresentationManager from PrsMgr;
|
||||
theMode : Integer from Standard =0) is redefined virtual;
|
||||
|
||||
Unhilight(me : mutable;
|
||||
thePM : PresentationManager from PrsMgr;
|
||||
theMode : Integer from Standard =0) is redefined virtual;
|
||||
---Purpose: Removes highlighting from the selected part of dimension.
|
||||
fields
|
||||
|
||||
myFixedShape : Shape from TopoDS;
|
||||
myDisplayMode : DimensionDisplayMode from AIS;
|
||||
|
||||
end DimensionOwner;
|
||||
|
||||
|
@@ -21,15 +21,105 @@
|
||||
|
||||
|
||||
#include <AIS_DimensionOwner.ixx>
|
||||
#include <AIS_DimensionDisplayMode.hxx>
|
||||
#include <StdSelect_Shape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// function : create
|
||||
// purpose :
|
||||
//-----------------------------------------------------------------------
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DimensionOwner::AIS_DimensionOwner(const Handle(SelectMgr_SelectableObject)& aSO,
|
||||
const Standard_Integer aPriority)
|
||||
:SelectMgr_EntityOwner(aSO,aPriority)
|
||||
AIS_DimensionOwner::AIS_DimensionOwner (const Handle(SelectMgr_SelectableObject)& theSelObject,
|
||||
const AIS_DimensionDisplayMode theMode,
|
||||
const Standard_Integer thePriority)
|
||||
: SelectMgr_EntityOwner(theSelObject, thePriority),
|
||||
myDisplayMode (theMode)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDisplayMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::SetDisplayMode (const AIS_DimensionDisplayMode theMode)
|
||||
{
|
||||
myDisplayMode = theMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DisplayMode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_DimensionDisplayMode AIS_DimensionOwner::DisplayMode () const
|
||||
{
|
||||
return myDisplayMode;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsHilighted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean AIS_DimensionOwner::IsHilighted (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode) const
|
||||
{
|
||||
if (HasSelectable())
|
||||
{
|
||||
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
|
||||
return thePM->IsHighlighted(Selectable (), aMode);
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Hilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::Hilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (HasSelectable())
|
||||
{
|
||||
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
|
||||
thePM->Highlight (Selectable(),aMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unhilight
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePM,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (HasSelectable())
|
||||
{
|
||||
Standard_Integer aMode = myDisplayMode != 0 ? myDisplayMode : theMode;
|
||||
thePM->Unhighlight(Selectable(),aMode);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HilightWithColor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_DimensionOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
|
||||
const Quantity_NameOfColor theColor,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
// Highlight selectable part of dimension with color
|
||||
if (myDisplayMode != 0)
|
||||
{
|
||||
thePM->Color (Selectable(), theColor, myDisplayMode);
|
||||
}
|
||||
else
|
||||
thePM->Color (Selectable(), theColor, theMode);
|
||||
}
|
||||
|
@@ -1,38 +0,0 @@
|
||||
// Created on: 1997-03-03
|
||||
// Created by: Jean-Pierre COMBE
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 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.
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void AIS_DimensionOwner::SetShape(const TopoDS_Shape& aShape)
|
||||
{
|
||||
myFixedShape = aShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FixedShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const TopoDS_Shape& AIS_DimensionOwner::FixedShape() const
|
||||
{
|
||||
return myFixedShape;
|
||||
}
|
@@ -57,10 +57,8 @@ uses
|
||||
PointAspect from Prs3d,
|
||||
ShadingAspect from Prs3d,
|
||||
IsoAspect from Prs3d,
|
||||
LengthAspect from Prs3d,
|
||||
AngleAspect from Prs3d,
|
||||
DimensionAspect from Prs3d,
|
||||
PlaneAspect from Prs3d,
|
||||
RadiusAspect from Prs3d,
|
||||
ArrowAspect from Prs3d,
|
||||
TypeOfDeflection from Aspect,
|
||||
NameOfColor from Quantity,
|
||||
@@ -541,43 +539,19 @@ is
|
||||
is redefined static;
|
||||
|
||||
--
|
||||
-- Attributes for the presentation of a Length.
|
||||
-- Attributes for the presentation of a dimensions.
|
||||
--
|
||||
|
||||
LengthAspect(me:mutable) returns mutable LengthAspect from Prs3d
|
||||
---Purpose: Returns a link with Prs3d_Drawer_LengthAspect,
|
||||
-- which provides settings for the appearance of lengths.
|
||||
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
|
||||
---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect,
|
||||
-- which provides settings for the appearance of dimensions.
|
||||
is redefined static;
|
||||
|
||||
HasLengthAspect (me) returns Boolean from Standard
|
||||
HasDimensionAspect (me) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: Returns true if the Drawer has a length aspect setting active.
|
||||
---Purpose: Returns true if the Drawer has a dimension aspect setting active.
|
||||
is static;
|
||||
|
||||
--
|
||||
-- Attributes for the presentation of a Angle.
|
||||
--
|
||||
|
||||
AngleAspect(me:mutable) returns mutable AngleAspect from Prs3d
|
||||
---Purpose: Returns a link with Prs3d_Drawer_AngleAspect,
|
||||
-- which provides settings for lines used to display angles.
|
||||
is redefined static;
|
||||
|
||||
HasAngleAspect (me) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: Returns true if the Drawer has an angle aspect
|
||||
-- setting active.
|
||||
is static;
|
||||
|
||||
--
|
||||
-- Attributes for the presentation of a Radius.
|
||||
--
|
||||
|
||||
RadiusAspect(me) returns mutable RadiusAspect from Prs3d
|
||||
---Purpose: Returns a link with Prs3d_Drawer_RadiusAspect,
|
||||
-- which provides settings for lines which serve to display radii.
|
||||
is redefined static;
|
||||
|
||||
-- Attributes for the sections
|
||||
|
||||
SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
|
||||
|
@@ -216,17 +216,8 @@ Handle (Prs3d_DatumAspect) AIS_Drawer::DatumAspect ()
|
||||
Handle (Prs3d_PlaneAspect) AIS_Drawer::PlaneAspect ()
|
||||
{return myPlaneAspect.IsNull() ? myLink->PlaneAspect (): myPlaneAspect;}
|
||||
|
||||
Handle (Prs3d_LengthAspect) AIS_Drawer::LengthAspect ()
|
||||
{return myLengthAspect.IsNull()? myLink->LengthAspect () : myLengthAspect ;}
|
||||
|
||||
|
||||
Handle (Prs3d_AngleAspect) AIS_Drawer::AngleAspect ()
|
||||
{return myAngleAspect.IsNull()? myLink->AngleAspect () :myAngleAspect ;}
|
||||
|
||||
|
||||
Handle (Prs3d_RadiusAspect) AIS_Drawer::RadiusAspect () const
|
||||
{return myRadiusAspect.IsNull()? myLink->RadiusAspect():myRadiusAspect; }
|
||||
|
||||
Handle (Prs3d_DimensionAspect) AIS_Drawer::DimensionAspect ()
|
||||
{return myDimensionAspect.IsNull()? myLink->DimensionAspect () : myDimensionAspect ;}
|
||||
|
||||
Handle (Prs3d_LineAspect) AIS_Drawer::SectionAspect ()
|
||||
{return mySectionAspect.IsNull()? myLink->SectionAspect (): mySectionAspect;}
|
||||
@@ -258,9 +249,7 @@ void AIS_Drawer::ClearLocalAttributes()
|
||||
if(!mySeenLineAspect.IsNull()) mySeenLineAspect.Nullify();
|
||||
if(!myVectorAspect.IsNull()) myVectorAspect .Nullify();
|
||||
if(!myDatumAspect.IsNull()) myDatumAspect.Nullify();
|
||||
if(!myLengthAspect.IsNull()) myLengthAspect.Nullify();
|
||||
if(!myAngleAspect.IsNull()) myAngleAspect.Nullify();
|
||||
if(!myRadiusAspect.IsNull()) myRadiusAspect.Nullify();
|
||||
if(!myDimensionAspect.IsNull()) myDimensionAspect.Nullify();
|
||||
if(!mySectionAspect.IsNull()) mySectionAspect.Nullify();
|
||||
if( myhasOwnHLRDeviationCoefficient ) myhasOwnHLRDeviationCoefficient = Standard_False;
|
||||
if(myhasOwnHLRDeviationAngle ) myhasOwnHLRDeviationAngle = Standard_False;
|
||||
|
@@ -82,18 +82,12 @@ inline Standard_Boolean AIS_Drawer::HasShadingAspect () const
|
||||
inline Standard_Boolean AIS_Drawer::HasPointAspect () const
|
||||
{ return !myPointAspect.IsNull();}
|
||||
|
||||
inline Standard_Boolean AIS_Drawer::HasAngleAspect () const
|
||||
{ return !myAngleAspect.IsNull();}
|
||||
|
||||
inline Standard_Boolean AIS_Drawer::HasDatumAspect () const
|
||||
{ return !myDatumAspect.IsNull();}
|
||||
|
||||
inline Standard_Boolean AIS_Drawer::HasPlaneAspect () const
|
||||
{ return !myPlaneAspect.IsNull();}
|
||||
|
||||
inline Standard_Boolean AIS_Drawer::HasLengthAspect () const
|
||||
{ return !myLengthAspect.IsNull();}
|
||||
|
||||
inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryDraw () const
|
||||
{ return myHasOwnFaceBoundaryDraw; }
|
||||
|
||||
@@ -109,3 +103,6 @@ inline Prs3d_TypeOfHLR AIS_Drawer::TypeOfHLR ( ) const
|
||||
{
|
||||
return (myTypeOfHLR == Prs3d_TOH_NotSet) ? myLink->TypeOfHLR() : myTypeOfHLR;
|
||||
}
|
||||
|
||||
inline Standard_Boolean AIS_Drawer::HasDimensionAspect () const
|
||||
{ return !myDimensionAspect.IsNull();}
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
@@ -84,8 +84,8 @@ void AIS_EqualDistanceRelation::Compute( const Handle( PrsMgr_PresentationManage
|
||||
|
||||
gp_Pnt Position12 = myPosition, Position34 = myPosition;
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
// -- ota -- begin
|
||||
if (!myAutomaticPosition ){
|
||||
@@ -477,10 +477,10 @@ void AIS_EqualDistanceRelation::ComputeTwoEdgesLength( const Handle( Prs3d_Prese
|
||||
if (arrsize < confusion) arrsize = Val*0.1;
|
||||
if (Abs(Val) <= confusion) {arrsize = 0.;}
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = aDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = aDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(arrsize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(arrsize);
|
||||
|
||||
if (AutomaticPos && IsSetBndBox)
|
||||
@@ -659,10 +659,10 @@ void AIS_EqualDistanceRelation::ComputeTwoVerticesLength( const Handle( Prs3d_Pr
|
||||
}
|
||||
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = aDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = aDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(ArrowSize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(ArrowSize);
|
||||
|
||||
if (AutomaticPos && IsSetBndBox)
|
||||
@@ -768,10 +768,10 @@ void AIS_EqualDistanceRelation::ComputeOneEdgeOneVertexLength( const Handle( Prs
|
||||
SecondAttach = ElCLib::Value(ElCLib::Parameter(l,Position),l);
|
||||
}
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = aDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = aDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(arrsize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(arrsize);
|
||||
|
||||
if (AutomaticPos && IsSetBndBox)
|
||||
|
@@ -38,7 +38,7 @@
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <GeomAPI_ProjectPointOnSurf.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
|
||||
@@ -142,8 +142,8 @@ void AIS_EqualRadiusRelation::Compute( const Handle( PrsMgr_PresentationManager3
|
||||
myArrowSize = (Min(myFirstCenter.Distance(myFirstPoint),
|
||||
mySecondCenter.Distance(mySecondPoint)))*0.05;
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
|
||||
//ota -- end --
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Aspect_AspectLine.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Prs3d_AngleAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_PlaneAspect.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
@@ -46,8 +46,8 @@ static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
|
||||
case AIS_TOA_Line:
|
||||
return Dr->LineAspect();
|
||||
break;
|
||||
case AIS_TOA_Angle:
|
||||
return Dr->AngleAspect()->LineAspect();
|
||||
case AIS_TOA_Dimension:
|
||||
return Dr->DimensionAspect()->LineAspect();
|
||||
break;
|
||||
case AIS_TOA_Wire:
|
||||
return Dr->WireAspect();
|
||||
|
@@ -1,274 +0,0 @@
|
||||
-- Created on: 1996-12-03
|
||||
-- Created by: Arnaud BOUZY/Odile Olivier
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 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.
|
||||
|
||||
|
||||
class LengthDimension from AIS inherits Relation from AIS
|
||||
|
||||
---Purpose: A framework to display lengths.
|
||||
-- These can be lengths along a face or edge, or
|
||||
-- between two faces or two edges.
|
||||
-- The value of the length is given in a text figuring in this display.
|
||||
|
||||
uses Shape from TopoDS,
|
||||
Face from TopoDS,
|
||||
Presentation from Prs3d,
|
||||
PresentationManager3d from PrsMgr,
|
||||
Selection from SelectMgr,
|
||||
Dir from gp,
|
||||
Pnt from gp,
|
||||
Projector from Prs3d,
|
||||
Transformation from Geom,
|
||||
ExtendedString from TCollection,
|
||||
Plane from Geom,
|
||||
TypeOfDist from AIS,
|
||||
ArrowSide from DsgPrs,
|
||||
KindOfDimension from AIS,
|
||||
Drawer from Prs3d,
|
||||
Edge from TopoDS,
|
||||
Box from Bnd,
|
||||
Drawer from AIS,
|
||||
Vertex from TopoDS
|
||||
is
|
||||
|
||||
|
||||
|
||||
Create (aFirstFace : Face from TopoDS;
|
||||
aSecondFace : Face from TopoDS;
|
||||
aVal : Real from Standard; -- is defined while first compute, may be any Real
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: Constructs a length display object defined by the first
|
||||
-- face aFShape, the second face aSShape, the dimension aVal, and the text aText.
|
||||
|
||||
returns mutable LengthDimension from AIS;
|
||||
|
||||
Create (aFirstFace : Face from TopoDS;
|
||||
aSecondFace : Face from TopoDS;
|
||||
aVal : Real from Standard; -- is defined while first compute, may be any Real
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
anArrowSize : Real from Standard = 0.0)
|
||||
---Purpose: Constructs a length display object defined by the first
|
||||
-- face aFShape, the second face aSShape, the
|
||||
-- dimension aVal, the position aPosition, the arrow
|
||||
-- aSymbolPrs with the size anArrowSize and the text aText.
|
||||
returns mutable LengthDimension from AIS;
|
||||
|
||||
Create (Face : Face from TopoDS;
|
||||
Edge : Edge from TopoDS;
|
||||
Val : Real from Standard;
|
||||
Text : ExtendedString from TCollection)
|
||||
---Purpose: Constructs a length display object defined by the first
|
||||
-- edge or vertex aFShape, the second edge or vertex
|
||||
-- aSShape, the dimension aVal,and the plane aPlane.
|
||||
returns mutable LengthDimension from AIS;
|
||||
|
||||
Create (aFShape : Shape from TopoDS;
|
||||
aSShape : Shape from TopoDS;
|
||||
aPlane : Plane from Geom;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: -- Constructs a length display object defined by the first
|
||||
-- edge or vertex aFShape, the second edge or vertex
|
||||
-- aSShape, the dimension aVal,and the plane aPlane.
|
||||
returns mutable LengthDimension from AIS;
|
||||
|
||||
Create (aFShape : Shape from TopoDS;
|
||||
aSShape : Shape from TopoDS;
|
||||
aPlane : Plane from Geom;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
aTypeDist : TypeOfDist from AIS;
|
||||
anArrowSize : Real from Standard = 0.0)
|
||||
---Purpose: Constructs a length display object defined by the first
|
||||
-- edge or vertex aFShape, the second edge or vertex
|
||||
-- aSShape, the dimension aVal, the position aPosition,
|
||||
-- the type of distance aTypeDist, the type of arrow
|
||||
-- aSymbolPrs with the size anArrowSize, and the plane aPlane.
|
||||
returns mutable LengthDimension from AIS;
|
||||
|
||||
SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
|
||||
is redefined static;
|
||||
|
||||
SetSecondShape( me: mutable; aSShape : Shape from TopoDS )
|
||||
is redefined static;
|
||||
|
||||
KindOfDimension(me)
|
||||
returns KindOfDimension from AIS
|
||||
is redefined;
|
||||
---Purpose: Indicates that we are concerned with a length.
|
||||
|
||||
IsMovable(me) returns Boolean from Standard
|
||||
is redefined;
|
||||
---Purpose: Returns true if the length dimension is movable.
|
||||
|
||||
TypeOfDist (me)
|
||||
---C++: inline
|
||||
--- Purpose:
|
||||
-- Returns the type of distance of the length primitive.
|
||||
returns TypeOfDist from AIS
|
||||
is static;
|
||||
|
||||
SetTypeOfDist(me: mutable;aTypeDist: TypeOfDist from AIS)
|
||||
---C++: inline
|
||||
--- Purpose:
|
||||
-- Returns true if the length dimension is movable.
|
||||
is static;
|
||||
|
||||
|
||||
-- Methods from PresentableObject
|
||||
|
||||
Compute(me : mutable;
|
||||
aPresentationManager : PresentationManager3d from PrsMgr;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aMode : Integer from Standard= 0)
|
||||
is redefined private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is redefined static private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is redefined;
|
||||
---Purpose: computes the presentation according to a point of view
|
||||
-- given by <aProjector>.
|
||||
-- To be Used when the associated degenerated Presentations
|
||||
-- have been transformed by <aTrsf> which is not a Pure
|
||||
-- Translation. The HLR Prs can't be deducted automatically
|
||||
-- WARNING :<aTrsf> must be applied
|
||||
-- to the object to display before computation !!!
|
||||
|
||||
|
||||
-- Methods from SelectableObject
|
||||
|
||||
ComputeSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr;
|
||||
aMode : Integer from Standard)
|
||||
is redefined private;
|
||||
|
||||
|
||||
|
||||
-- Computation private methods
|
||||
|
||||
ComputeOneFaceLength(me : mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeOneEdgeLength(me : mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
ComputeTwoFacesLength(me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
|
||||
ComputeEdgeFaceLength (me: mutable;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is private;
|
||||
|
||||
|
||||
ComputeTwoEdgesLength (myclass;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aDrawer : Drawer from AIS;
|
||||
aText : ExtendedString from TCollection;
|
||||
ArrowSize : Real from Standard;
|
||||
FirstEdge : Edge from TopoDS;
|
||||
SecondEdge : Edge from TopoDS;
|
||||
Plane : Plane from Geom;
|
||||
AutomaticPos : Boolean from Standard;
|
||||
IsSetBndBox : Boolean from Standard;
|
||||
BndBox : Box from Bnd;
|
||||
ExtShape : out Integer from Standard;
|
||||
Val : out Real from Standard;
|
||||
DirAttach : out Dir from gp;
|
||||
Position : out Pnt from gp;
|
||||
FirstAttach : out Pnt from gp;
|
||||
SecondAttach : out Pnt from gp;
|
||||
SymbolPrs : out ArrowSide from DsgPrs );
|
||||
|
||||
ComputeOneEdgeOneVertexLength(myclass;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aDrawer : Drawer from AIS;
|
||||
aText : ExtendedString from TCollection;
|
||||
ArrowSize : Real from Standard;
|
||||
FirstShape : Shape from TopoDS;
|
||||
SecondShape : Shape from TopoDS;
|
||||
Plane : Plane from Geom;
|
||||
AutomaticPos : Boolean from Standard;
|
||||
IsSetBndBox : Boolean from Standard;
|
||||
BndBox : Box from Bnd;
|
||||
ExtShape : out Integer from Standard;
|
||||
Val : out Real from Standard;
|
||||
DirAttach : out Dir from gp;
|
||||
Position : out Pnt from gp;
|
||||
FirstAttach : out Pnt from gp;
|
||||
SecondAttach : out Pnt from gp;
|
||||
SymbolPrs : out ArrowSide from DsgPrs );
|
||||
|
||||
ComputeTwoVerticesLength(myclass;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aDrawer : Drawer from AIS;
|
||||
aText : ExtendedString from TCollection;
|
||||
ArrowSize : Real from Standard;
|
||||
FirstVertex : Vertex from TopoDS;
|
||||
SecondVertex : Vertex from TopoDS;
|
||||
Plane : Plane from Geom;
|
||||
AutomaticPos : Boolean from Standard;
|
||||
IsSetBndBox : Boolean from Standard;
|
||||
BndBox : Box from Bnd;
|
||||
TypeDist : TypeOfDist from AIS;
|
||||
ExtShape : out Integer from Standard;
|
||||
Val : out Real from Standard;
|
||||
DirAttach : out Dir from gp;
|
||||
Position : out Pnt from gp;
|
||||
FirstAttach : out Pnt from gp;
|
||||
SecondAttach : out Pnt from gp;
|
||||
SymbolPrs : out ArrowSide from DsgPrs );
|
||||
|
||||
|
||||
--
|
||||
-- Computation Selection private methods
|
||||
--
|
||||
|
||||
ComputeFaceSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr)
|
||||
is private;
|
||||
|
||||
ComputeEdgeVertexSelection( me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr)
|
||||
is private;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myNbShape : Integer from Standard;
|
||||
myFAttach : Pnt from gp;
|
||||
mySAttach : Pnt from gp;
|
||||
myDirAttach: Dir from gp;
|
||||
myTypeDist : TypeOfDist from AIS;
|
||||
|
||||
end LengthDimension;
|
File diff suppressed because it is too large
Load Diff
139
src/AIS/AIS_LengthDimension.hxx
Normal file
139
src/AIS/AIS_LengthDimension.hxx
Normal file
@@ -0,0 +1,139 @@
|
||||
// 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.
|
||||
|
||||
#ifndef _AIS_LengthDimension_HeaderFile
|
||||
#define _AIS_LengthDimension_HeaderFile
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Dimension.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Transformation.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_Projector.hxx>
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
class TopoDS_Face;
|
||||
class TCollection_ExtendedString;
|
||||
class gp_Pnt;
|
||||
class TopoDS_Edge;
|
||||
class TopoDS_Shape;
|
||||
class Geom_Plane;
|
||||
class PrsMgr_PresentationManager3d;
|
||||
class Prs3d_Presentation;
|
||||
class Prs3d_Projector;
|
||||
class Geom_Transformation;
|
||||
class SelectMgr_Selection;
|
||||
class AIS_Drawer;
|
||||
class Bnd_Box;
|
||||
class gp_Dir;
|
||||
class TopoDS_Vertex;
|
||||
class Standard_Transient;
|
||||
class Handle(Standard_Type);
|
||||
class Handle(AIS_Relation);
|
||||
class AIS_LengthDimension;
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_LengthDimension,AIS_Dimension)
|
||||
|
||||
//! A dimention to display lengths. <br>
|
||||
//! These can be lengths along a face or edge, or <br>
|
||||
//! between two faces or two edges.
|
||||
class AIS_LengthDimension : public AIS_Dimension
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor with full parameter list.
|
||||
//! Construct dimension between two vertices.
|
||||
//! Style of line, arrow and text can be set by default.
|
||||
Standard_EXPORT AIS_LengthDimension (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pln& theDimensionPlane,
|
||||
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
|
||||
const Standard_Real theExtensionSize = 1.0);
|
||||
|
||||
Standard_EXPORT AIS_LengthDimension (const gp_Pnt& theFirstPoint,
|
||||
const gp_Pnt& theSecondPoint,
|
||||
const gp_Pln& theDimensionPlane);
|
||||
|
||||
//! Constructs a length dimension between two shapes(vertices, edges, shapes) with custom working plane
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape,
|
||||
const gp_Pln& theWorkingPlane);
|
||||
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Edge& theEdge,
|
||||
const gp_Pln& theWorkingPlane);
|
||||
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFirstFace,
|
||||
const TopoDS_Face& theSecondFace);
|
||||
|
||||
Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFace,
|
||||
const TopoDS_Edge& theEdge);
|
||||
|
||||
Standard_EXPORT void SetFlyout (const Standard_Real theFlyout);
|
||||
|
||||
Standard_EXPORT Standard_Real GetFlyout () const;
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_LengthDimension)
|
||||
private:
|
||||
Standard_Boolean initTwoEdgesLength (const TopoDS_Edge & theFirstEdge,
|
||||
const TopoDS_Edge& theSecondEdge,
|
||||
gp_Dir& theDirAttach);
|
||||
//! Auxiliary method for <InitTwoShapesPoints()>
|
||||
//! in case of the distance between edge and vertex
|
||||
Standard_Boolean initEdgeVertexLength (const TopoDS_Edge & theEdge,
|
||||
const TopoDS_Vertex & theVertex,
|
||||
gp_Dir & theDirAttach,
|
||||
Standard_Boolean isInfinite);
|
||||
//! Auxiliary method for <InitTwoShapesPoints()>
|
||||
//! in case of the distance between face and edge
|
||||
Standard_Boolean initEdgeFaceLength (const TopoDS_Edge& theEdge,
|
||||
const TopoDS_Face& theFace,
|
||||
gp_Dir& theDirAttach);
|
||||
//! Initialization of two attach points in case of two owner shapes
|
||||
Standard_Boolean initTwoShapesPoints (const TopoDS_Shape& theFirstShape,
|
||||
const TopoDS_Shape& theSecondShape);
|
||||
//! Initialization of two attach points in case of one owner shape
|
||||
Standard_Boolean initOneShapePoints (const TopoDS_Shape& theShape);
|
||||
|
||||
//! Compute length in display units.
|
||||
virtual void computeValue ();
|
||||
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0) ;
|
||||
// Fields
|
||||
|
||||
//! 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 <myFlyout> value.
|
||||
//! The direction vector is counting using the working plane.
|
||||
//! <myFlyout> value defined the size of flyout.
|
||||
Standard_Real myFlyout;
|
||||
};
|
||||
|
||||
#endif
|
@@ -1,43 +0,0 @@
|
||||
// Created on: 1997-02-28
|
||||
// Created by: Jean-Pierre COMBE
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 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.
|
||||
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TypeOfDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline AIS_TypeOfDist AIS_LengthDimension::TypeOfDist() const
|
||||
{
|
||||
return myTypeDist;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTypeOfDist
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void AIS_LengthDimension::SetTypeOfDist(const AIS_TypeOfDist aTypeDist)
|
||||
{
|
||||
myTypeDist = aTypeDist;
|
||||
}
|
@@ -28,7 +28,7 @@
|
||||
#include <AIS_EllipseRadiusDimension.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
@@ -168,8 +168,8 @@ void AIS_MaxRadiusDimension::Compute(const Handle_Prs3d_Projector& aProjector,
|
||||
void AIS_MaxRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
|
||||
// size
|
||||
#ifdef BUC60915
|
||||
@@ -226,8 +226,8 @@ void AIS_MaxRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aP
|
||||
void AIS_MaxRadiusDimension::ComputeArcOfEllipse(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
|
||||
// size
|
||||
#ifdef BUC60915
|
||||
|
@@ -55,7 +55,7 @@
|
||||
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
|
||||
#include <DsgPrs_MidPointPresentation.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include <AIS_EllipseRadiusDimension.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
@@ -169,8 +169,8 @@ void AIS_MinRadiusDimension::Compute(const Handle_Prs3d_Projector& aProjector,
|
||||
void AIS_MinRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
|
||||
// size
|
||||
#ifdef BUC60915
|
||||
@@ -228,8 +228,8 @@ void AIS_MinRadiusDimension::ComputeEllipse(const Handle(Prs3d_Presentation)& aP
|
||||
void AIS_MinRadiusDimension::ComputeArcOfEllipse(const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
|
||||
// size
|
||||
#ifdef BUC60915
|
||||
|
@@ -37,7 +37,7 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
@@ -327,11 +327,11 @@ void AIS_OffsetDimension::ComputeTwoAxesOffset(const Handle(Prs3d_Presentation)&
|
||||
mySAttach = P2LastProj;
|
||||
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
//cout<<"AIS_OffsetDimension::AIS_OffsetDimension " << myArrowSize << " myArrowSize"<<endl;
|
||||
arr->SetLength(myArrowSize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
|
||||
gp_Pnt myTFAttach = myFAttach.Transformed (aTrsf);
|
||||
@@ -433,11 +433,11 @@ void AIS_OffsetDimension::ComputeTwoFacesOffset(const Handle(Prs3d_Presentation)
|
||||
myDirAttach2.SetCoord (avec.X(),avec.Y(),avec.Z());
|
||||
}
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
//cout<<"AIS_OffsetDimension::AIS_OffsetDimension " << myArrowSize << " myArrowSize"<<endl;
|
||||
arr->SetLength(myArrowSize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
|
||||
gp_Pnt myTFAttach = myFAttach.Transformed (aTrsf);
|
||||
|
@@ -36,7 +36,7 @@
|
||||
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
@@ -379,10 +379,10 @@ void AIS_ParallelRelation::ComputeTwoEdgesParallel(const Handle(Prs3d_Presentati
|
||||
{
|
||||
myArrowSize = 0.;
|
||||
}
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
if ( myExtShape == 1)
|
||||
mySymbolPrs = DsgPrs_AS_FIRSTPT_LASTAR;
|
||||
|
@@ -1,158 +0,0 @@
|
||||
-- Created on: 1996-12-03
|
||||
-- Created by: Jean-Pierre COMBE/Odile Olivier
|
||||
-- Copyright (c) 1996-1999 Matra Datavision
|
||||
-- Copyright (c) 1999-2012 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.
|
||||
|
||||
-- modified by <SZY> feb-20-98
|
||||
|
||||
|
||||
class RadiusDimension from AIS inherits Relation from AIS
|
||||
|
||||
---Purpose: A framework to define display of radii.
|
||||
-- These displays serve as relational references in 3D
|
||||
-- presentations of surfaces, and are particularly useful
|
||||
-- in viewing fillets. The display consists of arrows and
|
||||
-- text giving the length of a radius. This display is
|
||||
-- recalculated if the applicative owner shape changes
|
||||
-- in dimension, and the text gives the modified length.
|
||||
-- The algorithm analyzes a length along a face as an
|
||||
-- arc. It then reconstructs the circle corresponding to
|
||||
-- the arc and calculates the radius of this circle.
|
||||
|
||||
uses Shape from TopoDS,
|
||||
Presentation from Prs3d,
|
||||
PresentationManager3d from PrsMgr,
|
||||
Selection from SelectMgr,
|
||||
Pnt from gp,
|
||||
Lin from gp,
|
||||
Circ from gp,
|
||||
Projector from Prs3d,
|
||||
Transformation from Geom,
|
||||
ExtendedString from TCollection,
|
||||
ArrowSide from DsgPrs,
|
||||
KindOfDimension from AIS
|
||||
|
||||
is
|
||||
Create (aShape : Shape from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection)
|
||||
---Purpose: Constructs the radius display object defined by the
|
||||
-- shape aShape, the dimension aVal, and the text aText.
|
||||
|
||||
returns mutable RadiusDimension from AIS;
|
||||
|
||||
Create (aShape : Shape from TopoDS;
|
||||
aVal : Real from Standard;
|
||||
aText : ExtendedString from TCollection;
|
||||
aPosition : Pnt from gp;
|
||||
aSymbolPrs : ArrowSide from DsgPrs;
|
||||
anArrowSize : Real from Standard = 0.0)
|
||||
---Purpose: Constructs radius display object defined by the shape
|
||||
-- aShape, the dimension aVal, the position aPosition,
|
||||
-- the type of arrow aSymbolPrs, the arrow length
|
||||
-- anArrowSize and the text aText.
|
||||
returns mutable RadiusDimension from AIS;
|
||||
|
||||
SetFirstShape( me: mutable; aFShape : Shape from TopoDS )
|
||||
is redefined static;
|
||||
|
||||
KindOfDimension(me)
|
||||
---Purpose: Indicates that the dimension selected is a radius.
|
||||
---C++: inline
|
||||
returns KindOfDimension from AIS
|
||||
is redefined;
|
||||
|
||||
IsMovable(me) returns Boolean from Standard
|
||||
---C++: inline
|
||||
---Purpose: Returns true if the radius selected is movable.
|
||||
is redefined;
|
||||
|
||||
DrawFromCenter(me) returns Boolean from Standard
|
||||
---Purpose:
|
||||
-- Draws an arrowhead pointing towards the center of
|
||||
-- the shape aShape defined at construction time if
|
||||
-- false, and away from the center if true.
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
SetDrawFromCenter(me: mutable;
|
||||
drawfromcenter : Boolean from Standard)
|
||||
---C++: inline
|
||||
---Purpose:
|
||||
-- Sets the Boolean drawfromcenter to true or false.
|
||||
-- If drawfromcenter is false, the arrowhead will point
|
||||
-- towards the center of the shape aShape defined at
|
||||
-- construction time.
|
||||
is static;
|
||||
|
||||
-- Methods from PresentableObject
|
||||
|
||||
Compute(me : mutable;
|
||||
aPresentationManager: PresentationManager3d from PrsMgr;
|
||||
aPresentation : mutable Presentation from Prs3d;
|
||||
aMode : Integer from Standard= 0)
|
||||
is redefined private;
|
||||
|
||||
Compute(me:mutable;
|
||||
aProjector: Projector from Prs3d;
|
||||
aPresentation: mutable Presentation from Prs3d)
|
||||
is redefined static private;
|
||||
|
||||
Compute(me : mutable;
|
||||
aProjector : Projector from Prs3d;
|
||||
aTrsf : Transformation from Geom;
|
||||
aPresentation : mutable Presentation from Prs3d)
|
||||
is redefined;
|
||||
---Purpose: computes the presentation according to a point of view
|
||||
-- given by <aProjector>.
|
||||
-- To be Used when the associated degenerated Presentations
|
||||
-- have been transformed by <aTrsf> which is not a Pure
|
||||
-- Translation. The HLR Prs can't be deducted automatically
|
||||
-- WARNING :<aTrsf> must be applied
|
||||
-- to the object to display before computation !!!
|
||||
|
||||
-- Methods from SelectableObject
|
||||
|
||||
ComputeSelection(me : mutable;
|
||||
aSelection : mutable Selection from SelectMgr;
|
||||
aMode : Integer from Standard)
|
||||
is redefined private;
|
||||
|
||||
|
||||
--
|
||||
-- Computation private methods
|
||||
--
|
||||
|
||||
ComputeRadius( me: mutable; aPresentation : mutable Presentation from Prs3d )
|
||||
is private;
|
||||
|
||||
InitFirstShape( me: mutable)
|
||||
is static private;
|
||||
|
||||
fields
|
||||
|
||||
myCircle : Circ from gp;
|
||||
myFirstPar : Real from Standard;
|
||||
myLastPar : Real from Standard;
|
||||
myCenter : Pnt from gp;
|
||||
myEndOfArrow : Pnt from gp;
|
||||
myFirstLine : Lin from gp;
|
||||
myLastLine : Lin from gp;
|
||||
mydrawFromCenter : Boolean from Standard;
|
||||
|
||||
end RadiusDimension;
|
@@ -18,20 +18,23 @@
|
||||
// purpose or non-infringement. Please see the License for the specific terms
|
||||
// and conditions governing the rights and limitations under the License.
|
||||
|
||||
// modified <SZY> 20-feb-98
|
||||
// <VBU> myFShape could be a wire.
|
||||
|
||||
#define BUC60915 //GG 05/06/01 Enable to compute the requested arrow size
|
||||
// if any in all dimensions.
|
||||
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
|
||||
#include <AIS_RadiusDimension.ixx>
|
||||
#include <AIS_RadiusDimension.hxx>
|
||||
|
||||
#include <AIS_DimensionOwner.hxx>
|
||||
#include <DsgPrs_RadiusPresentation.hxx>
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <AIS_KindOfDimension.hxx>
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <DsgPrs.hxx>
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
#include <GC_MakeCircle.hxx>
|
||||
#include <gce_MakeCirc.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
#include <gce_MakeLin.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
@@ -40,381 +43,222 @@
|
||||
#include <Geom_ToroidalSurface.hxx>
|
||||
#include <Geom_CylindricalSurface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <GC_MakeCircle.hxx>
|
||||
#include <gce_MakeLin.hxx>
|
||||
#include <gce_MakeCirc.hxx>
|
||||
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <PrsMgr_PresentationManager3d.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <Adaptor3d_HCurve.hxx>
|
||||
|
||||
#include <Prs3d_AngleAspect.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
IMPLEMENT_STANDARD_HANDLE(AIS_RadiusDimension, AIS_Dimension)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_RadiusDimension, AIS_Dimension)
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <gce_MakeDir.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
|
||||
|
||||
|
||||
//======================================================================
|
||||
//function : CircleFromPlanarFace
|
||||
//purpose : if possible gets circle from planar face
|
||||
//=======================================================================
|
||||
static Standard_Boolean CircleFromPlanarFace (const TopoDS_Shape& aFace,
|
||||
Handle(Geom_Curve)& aCurve,
|
||||
gp_Pnt & ptfirst,
|
||||
gp_Pnt & ptend)
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle)
|
||||
: AIS_Dimension(),
|
||||
myFlyout (0.0),
|
||||
myCircle (theCircle)
|
||||
{
|
||||
TopExp_Explorer ExploEd (aFace, TopAbs_EDGE);
|
||||
for ( ; ExploEd.More(); ExploEd.Next())
|
||||
myFirstPoint = ElCLib::Value(0, myCircle);
|
||||
mySecondPoint = theCircle.Location();
|
||||
myIsInitialized = Standard_True;
|
||||
SetSpecialSymbol ('R');
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension(AIS_KOD_RADIUS);
|
||||
}
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint)
|
||||
: AIS_Dimension(),
|
||||
myFlyout (0.0),
|
||||
myCircle (theCircle)
|
||||
{
|
||||
myFirstPoint = theAttachPoint;
|
||||
mySecondPoint = theCircle.Location();
|
||||
myIsInitialized = Standard_True;
|
||||
SetSpecialSymbol ('R');
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension (AIS_KOD_RADIUS);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const TopoDS_Shape& theShape)
|
||||
: AIS_Dimension (),
|
||||
myFlyout (0.0)
|
||||
{
|
||||
myFirstShape = theShape;
|
||||
myIsInitialized = Standard_False;
|
||||
SetSpecialSymbol ('R');
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension (AIS_KOD_RADIUS);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
|
||||
const Standard_Real theExtensionSize/* = 1.0*/)
|
||||
|
||||
: AIS_Dimension (theDimensionAspect,theExtensionSize),
|
||||
myFlyout (0.0),
|
||||
myCircle (theCircle)
|
||||
{
|
||||
myFirstPoint = ElCLib::Value(0, myCircle);
|
||||
mySecondPoint = theCircle.Location();
|
||||
SetSpecialSymbol ('R');
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension (AIS_KOD_RADIUS);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
AIS_RadiusDimension::AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint,
|
||||
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
|
||||
const Standard_Real theExtensionSize/* = 1.0*/)
|
||||
: AIS_Dimension (theDimensionAspect,theExtensionSize),
|
||||
myFlyout (0.0),
|
||||
myCircle (theCircle)
|
||||
{
|
||||
myFirstPoint = theAttachPoint;
|
||||
mySecondPoint = theCircle.Location();
|
||||
SetSpecialSymbol ('R');
|
||||
SetDisplaySpecialSymbol (AIS_DSS_Before);
|
||||
SetKindOfDimension (AIS_KOD_RADIUS);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_RadiusDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& /*thePM*/,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
thePresentation->Clear();
|
||||
|
||||
Handle(Prs3d_DimensionAspect) aDimensionAspect = myDrawer->DimensionAspect();
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->SetPrimitivesAspect (aDimensionAspect->LineAspect()->Aspect());
|
||||
|
||||
if (!myIsInitialized)
|
||||
{
|
||||
gp_Pnt aLastPoint;
|
||||
if (!initCircularDimension (myFirstShape, myCircle,
|
||||
myFirstPoint, aLastPoint))
|
||||
return;
|
||||
else
|
||||
{
|
||||
TopoDS_Edge curedge = TopoDS::Edge (ExploEd.Current());
|
||||
if (AIS::ComputeGeometry (curedge, aCurve, ptfirst, ptend))
|
||||
if (aCurve->IsInstance (STANDARD_TYPE(Geom_Circle)) &&
|
||||
!Handle(Geom_Circle)::DownCast(aCurve).IsNull())
|
||||
return Standard_True;
|
||||
mySecondPoint = myCircle.Location();
|
||||
myIsInitialized = Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
if (!myIsWorkingPlaneCustom)
|
||||
countDefaultPlane();
|
||||
|
||||
//Count flyout direction
|
||||
gp_Ax1 aWorkingPlaneNormal = GetWorkingPlane().Axis();
|
||||
gp_Dir aTargetPointsVector = gce_MakeDir (myFirstPoint, mySecondPoint);
|
||||
// Count a flyout direction vector.
|
||||
gp_Dir aFlyoutVector = aWorkingPlaneNormal.Direction()^aTargetPointsVector;
|
||||
gp_Ax3 aLocalSystem (myFirstPoint, aTargetPointsVector, aFlyoutVector);
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
AIS_RadiusDimension::AIS_RadiusDimension(const TopoDS_Shape& aShape,
|
||||
const Standard_Real aVal,
|
||||
const TCollection_ExtendedString& aText)
|
||||
:mydrawFromCenter(Standard_True)
|
||||
{
|
||||
myFShape = aShape;
|
||||
myVal = aVal;
|
||||
myText = aText;
|
||||
mySymbolPrs = DsgPrs_AS_FIRSTPT_LASTAR;
|
||||
myAutomaticPosition = Standard_True;
|
||||
// Create lines for layouts
|
||||
gp_Lin aLine1 (myFirstPoint, aFlyoutVector);
|
||||
gp_Lin aLine2 (mySecondPoint, aFlyoutVector);
|
||||
|
||||
myArrowSize = myVal / 100.;
|
||||
InitFirstShape();
|
||||
// Get flyout end points
|
||||
gp_Pnt aFlyoutEnd1 = ElCLib::Value (ElCLib::Parameter (aLine1, myFirstPoint) + GetFlyout(), aLine1);
|
||||
gp_Pnt aFlyoutEnd2 = ElCLib::Value (ElCLib::Parameter (aLine2, mySecondPoint) + GetFlyout(), aLine2);
|
||||
|
||||
// Add layout lines to graphic group
|
||||
// Common to all type of dimension placement.
|
||||
if (theMode == 0)
|
||||
{
|
||||
Handle(Graphic3d_ArrayOfSegments) aPrimSegments = new Graphic3d_ArrayOfSegments(4);
|
||||
aPrimSegments->AddVertex (myFirstPoint);
|
||||
aPrimSegments->AddVertex (aFlyoutEnd1);
|
||||
|
||||
aPrimSegments->AddVertex (mySecondPoint);
|
||||
aPrimSegments->AddVertex (aFlyoutEnd2);
|
||||
|
||||
Prs3d_Root::CurrentGroup (thePresentation)->AddPrimitiveArray (aPrimSegments);
|
||||
}
|
||||
|
||||
drawLinearDimension (thePresentation, aFlyoutEnd1, aFlyoutEnd2, (AIS_DimensionDisplayMode)theMode, Standard_True);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :(avec position et texte)
|
||||
//=======================================================================
|
||||
AIS_RadiusDimension::AIS_RadiusDimension( const TopoDS_Shape& aShape,
|
||||
const Standard_Real aVal,
|
||||
const TCollection_ExtendedString& aText,
|
||||
const gp_Pnt& aPosition,
|
||||
const DsgPrs_ArrowSide aSymbolPrs,
|
||||
const Standard_Real anArrowSize )
|
||||
:mydrawFromCenter(Standard_True)
|
||||
{
|
||||
myFShape = aShape;
|
||||
myVal = aVal;
|
||||
myText = aText;
|
||||
myPosition = aPosition;
|
||||
mySymbolPrs = aSymbolPrs;
|
||||
#ifdef BUC60915
|
||||
SetArrowSize( anArrowSize );
|
||||
#else
|
||||
myArrowSize = anArrowSize;
|
||||
#endif
|
||||
myAutomaticPosition = Standard_False;
|
||||
InitFirstShape();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InitFirstShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::InitFirstShape()
|
||||
{
|
||||
if (myFShape.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
BRepAdaptor_Surface surfAlgo( TopoDS::Face( myFShape ) );
|
||||
Standard_Real uFirst, uLast, vFirst, vLast;
|
||||
uFirst = surfAlgo.FirstUParameter();
|
||||
uLast = surfAlgo.LastUParameter();
|
||||
vFirst = surfAlgo.FirstVParameter();
|
||||
vLast = surfAlgo.LastVParameter();
|
||||
Standard_Real uMoy = (uFirst + uLast)/2;
|
||||
Standard_Real vMoy = (vFirst + vLast)/2;
|
||||
Handle( Geom_Surface ) surf = surfAlgo.Surface().Surface();
|
||||
surf = Handle( Geom_Surface )::DownCast( surf->Transformed( surfAlgo.Trsf() ) );
|
||||
Handle( Geom_Curve ) aCurve;
|
||||
|
||||
if (surf->DynamicType() == STANDARD_TYPE(Geom_ToroidalSurface))
|
||||
{
|
||||
aCurve = surf->UIso( uMoy );
|
||||
uFirst = vFirst;
|
||||
uLast = vLast;
|
||||
}
|
||||
else if (surf->DynamicType() == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
|
||||
{
|
||||
Handle( Adaptor3d_HCurve ) BasisCurve = surfAlgo.BasisCurve();
|
||||
if ( BasisCurve->GetType() == GeomAbs_Circle )
|
||||
aCurve = surf->VIso( vMoy );
|
||||
else return;
|
||||
}
|
||||
else if (surf->DynamicType() == STANDARD_TYPE(Geom_Plane))
|
||||
{
|
||||
gp_Pnt FirstPnt, LastPnt;
|
||||
if (CircleFromPlanarFace (TopoDS::Face(myFShape), aCurve, FirstPnt, LastPnt))
|
||||
// if (CircleFromPlanarFace (myFShape, aCurve, FirstPnt, LastPnt))
|
||||
{
|
||||
uFirst = ElCLib::Parameter ((Handle(Geom_Circle)::DownCast( aCurve ))->Circ(), FirstPnt);
|
||||
uLast = ElCLib::Parameter ((Handle(Geom_Circle)::DownCast( aCurve ))->Circ(), LastPnt);
|
||||
}
|
||||
else return;
|
||||
}
|
||||
else
|
||||
aCurve = surf->VIso( vMoy );
|
||||
|
||||
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
|
||||
myCircle = (Handle( Geom_Circle )::DownCast( aCurve ))->Circ();
|
||||
else if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) {
|
||||
Handle(Geom_TrimmedCurve) tCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve);
|
||||
aCurve = tCurve->BasisCurve();
|
||||
uFirst = tCurve->FirstParameter();
|
||||
uLast = tCurve->LastParameter();
|
||||
if (aCurve->DynamicType() == STANDARD_TYPE(Geom_Circle))
|
||||
myCircle = Handle(Geom_Circle)::DownCast(aCurve)->Circ();//gp_Circ
|
||||
else return;
|
||||
}
|
||||
else if (aCurve->DynamicType() == STANDARD_TYPE(Geom_BSplineCurve)) {
|
||||
gp_Pnt P1,P2,P3;
|
||||
aCurve->D0(uFirst,P1);
|
||||
aCurve->D0((uFirst+uLast)/2,P2);
|
||||
aCurve->D0(uLast,P3);
|
||||
gce_MakeCirc MakeCirc = gce_MakeCirc(P1,P2,P3);
|
||||
myCircle = MakeCirc.Value();
|
||||
uFirst = ElCLib::Parameter(myCircle,P1);
|
||||
uLast = ElCLib::Parameter(myCircle,P2);
|
||||
}
|
||||
|
||||
myFirstPar = uFirst;
|
||||
myLastPar = uLast;
|
||||
} // TopAbs_FACE
|
||||
|
||||
else // it is edge or a wire
|
||||
{
|
||||
TopoDS_Edge anEdge;
|
||||
if (myFShape.ShapeType() == TopAbs_WIRE) {
|
||||
TopExp_Explorer exp (myFShape,TopAbs_EDGE);
|
||||
if (exp.More()) anEdge = TopoDS::Edge (exp.Current());
|
||||
}
|
||||
else {
|
||||
if ( myFShape.ShapeType() == TopAbs_EDGE) {
|
||||
anEdge = TopoDS::Edge (myFShape);
|
||||
BRepAdaptor_Curve AdaptedCurve (anEdge);
|
||||
if (!AdaptedCurve.GetType() == GeomAbs_Circle) return;
|
||||
|
||||
myCircle = AdaptedCurve.Circle();
|
||||
myFirstPar = AdaptedCurve.FirstParameter();
|
||||
myLastPar = AdaptedCurve.LastParameter();
|
||||
}
|
||||
#ifdef DEB
|
||||
else {
|
||||
cout << "AIS_RadiusDimension::InitFirstShape ==> myFShape.ShapeType() == " << myFShape.ShapeType() << endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
myCenter = myCircle.Location();
|
||||
myCircle.SetRadius(myVal);
|
||||
while (myFirstPar > 2*M_PI) myFirstPar -= 2*M_PI;
|
||||
while (myFirstPar < 0.0 ) myFirstPar += 2*M_PI;
|
||||
while (myLastPar > 2*M_PI) myLastPar -= 2*M_PI;
|
||||
while (myLastPar < 0.0 ) myLastPar += 2*M_PI;
|
||||
myPlane = new Geom_Plane(gp_Pln(gp_Ax3(myCircle.Position())));
|
||||
myFirstLine = gce_MakeLin( myCenter, ElCLib::Value( myFirstPar, myCircle ) );
|
||||
myLastLine = gce_MakeLin( myCenter, ElCLib::Value( myLastPar, myCircle ) );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetFirstShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::SetFirstShape( const TopoDS_Shape& aFShape )
|
||||
{
|
||||
myFShape = aFShape;
|
||||
InitFirstShape();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
|
||||
const Handle(Prs3d_Presentation)& aPresentation,
|
||||
const Standard_Integer /*aMode*/)
|
||||
{
|
||||
aPresentation->Clear();
|
||||
|
||||
ComputeRadius( aPresentation );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//purpose : to avoid warning
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::Compute(const Handle(Prs3d_Projector)& aProjector,
|
||||
const Handle(Prs3d_Presentation)& aPresentation)
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_RadiusDimension::Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Compute
|
||||
//function : computeValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_RadiusDimension::Compute(const Handle_Prs3d_Projector& aProjector,
|
||||
const Handle_Geom_Transformation& aTransformation,
|
||||
const Handle_Prs3d_Presentation& aPresentation)
|
||||
void AIS_RadiusDimension::computeValue ()
|
||||
{
|
||||
// Standard_NotImplemented::Raise("AIS_RadiusDimension::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
|
||||
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
|
||||
myValue = myFirstPoint.Distance (mySecondPoint);
|
||||
AIS_Dimension::computeValue ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeSelection
|
||||
//function : countDefaultPlane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void AIS_RadiusDimension::ComputeSelection( const Handle(SelectMgr_Selection)& aSelection,
|
||||
const Standard_Integer )
|
||||
{
|
||||
gp_Pnt LineOrigin, LineEnd;
|
||||
DsgPrs::ComputeRadiusLine( myCenter, myEndOfArrow, myPosition, mydrawFromCenter,
|
||||
LineOrigin,LineEnd);
|
||||
Handle(AIS_DimensionOwner) own = new AIS_DimensionOwner(this,7);
|
||||
own->SetShape(myFShape);
|
||||
Handle( Select3D_SensitiveSegment ) seg = new Select3D_SensitiveSegment( own, LineOrigin, LineEnd );
|
||||
aSelection->Add( seg );
|
||||
|
||||
// Text
|
||||
Standard_Real size(Min(myVal/100.+1.e-6,myArrowSize+1.e-6));
|
||||
Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox( own,
|
||||
myPosition.X(),
|
||||
myPosition.Y(),
|
||||
myPosition.Z(),
|
||||
myPosition.X() + size,
|
||||
myPosition.Y() + size,
|
||||
myPosition.Z() + size );
|
||||
aSelection->Add(box);
|
||||
void AIS_RadiusDimension::countDefaultPlane ()
|
||||
{
|
||||
// Compute normal of the default plane.
|
||||
gp_Vec aVec1(mySecondPoint, myFirstPoint),
|
||||
aVec2(mySecondPoint, ElCLib::Value(M_PI_2, myCircle));
|
||||
myDefaultPlane = gp_Pln(myCircle.Location(), aVec1^aVec2);
|
||||
// Set computed value to <myWorkingPlane>
|
||||
ResetWorkingPlane ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeRadius
|
||||
//function : SetFlyout
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void AIS_RadiusDimension::ComputeRadius( const Handle( Prs3d_Presentation )& aPresentation )
|
||||
void AIS_RadiusDimension::SetFlyout (const Standard_Real theFlyout)
|
||||
{
|
||||
if (myAutomaticPosition)
|
||||
{
|
||||
InitFirstShape();
|
||||
myEndOfArrow = ElCLib::Value( (myFirstPar + myLastPar)/2, myCircle );
|
||||
if(mydrawFromCenter) {
|
||||
myPosition = myCenter;
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Vec v1(myCenter, myEndOfArrow);
|
||||
myPosition = myCenter.Translated(v1 * 1.2);
|
||||
}
|
||||
myAutomaticPosition = Standard_True;
|
||||
|
||||
if (myIsSetBndBox)
|
||||
myPosition = AIS::TranslatePointToBound(myPosition, gce_MakeDir( myCenter, myEndOfArrow ),
|
||||
myBndBox );
|
||||
}
|
||||
else
|
||||
{
|
||||
//!Automaticposition
|
||||
myPosition = AIS::ProjectPointOnPlane( myPosition, myPlane->Pln() );
|
||||
Standard_Real PosPar = ElCLib::Parameter( myCircle, myPosition );
|
||||
if (!AIS::InDomain(myFirstPar, myLastPar, PosPar))
|
||||
{ // not in domain
|
||||
Standard_Real otherpar = PosPar + M_PI;
|
||||
if (otherpar > 2*M_PI) otherpar -= 2*M_PI;
|
||||
if (AIS::InDomain(myFirstPar, myLastPar, otherpar)){
|
||||
PosPar = otherpar;// parameter on circle
|
||||
myEndOfArrow = ElCLib::Value( PosPar, myCircle );
|
||||
}
|
||||
else {
|
||||
Standard_Real Teta1 = Abs( PosPar - myFirstPar ), Teta2 = Abs( PosPar - myLastPar );
|
||||
if (Teta1 > M_PI)
|
||||
Teta1 = 2.0*M_PI - Teta1;
|
||||
if (Teta2 > M_PI)
|
||||
Teta2 = 2.0*M_PI - Teta2;
|
||||
if (Teta1 < Teta2)
|
||||
{
|
||||
if(myFirstLine.Contains(myPosition,Precision::Confusion()))
|
||||
PosPar = myFirstPar;
|
||||
else
|
||||
PosPar = myLastPar;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(myLastLine.Contains(myPosition,Precision::Confusion()))
|
||||
PosPar = myLastPar;
|
||||
else
|
||||
PosPar = myFirstPar;
|
||||
}
|
||||
myEndOfArrow = ElCLib::Value( PosPar, myCircle );
|
||||
gp_Lin RadiusLine = gce_MakeLin( myCenter, myEndOfArrow );
|
||||
// project on radius line
|
||||
myPosition = ElCLib::Value( ElCLib::Parameter( RadiusLine, myPosition ), RadiusLine );
|
||||
}
|
||||
}
|
||||
else
|
||||
myEndOfArrow = ElCLib::Value( PosPar, myCircle );
|
||||
}
|
||||
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
// size
|
||||
#ifdef BUC60915
|
||||
if( !myArrowSizeIsDefined ) {
|
||||
myArrowSize = Min(myArrowSize,myVal/5.);
|
||||
}
|
||||
arr->SetLength(myArrowSize);
|
||||
#else
|
||||
if (myVal/5. > myArrowSize)
|
||||
arr->SetLength(myArrowSize);
|
||||
else
|
||||
arr->SetLength(myVal/5.);
|
||||
#endif
|
||||
|
||||
DsgPrs_RadiusPresentation::Add( aPresentation, myDrawer, myText, myPosition,
|
||||
myCenter, myEndOfArrow, mySymbolPrs, mydrawFromCenter );
|
||||
}
|
||||
myFlyout = theFlyout;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFlyout
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real AIS_RadiusDimension::GetFlyout () const
|
||||
{
|
||||
return myFlyout;
|
||||
}
|
||||
|
91
src/AIS/AIS_RadiusDimension.hxx
Normal file
91
src/AIS/AIS_RadiusDimension.hxx
Normal file
@@ -0,0 +1,91 @@
|
||||
// Copyright (c) 1995-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 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 radii. <br>
|
||||
//! These displays serve as relational references in 3D <br>
|
||||
//! presentations of surfaces, and are particularly useful <br>
|
||||
//! in viewing fillets. The display consists of arrows and <br>
|
||||
//! text giving the length of a radius. This display is <br>
|
||||
//! recalculated if the applicative owner shape changes <br>
|
||||
//! in dimension, and the text gives the modified length. <br>
|
||||
//! The algorithm analyzes a length along a face as an <br>
|
||||
//! arc. It then reconstructs the circle corresponding to <br>
|
||||
//! the arc and calculates the radius of this circle. <br>
|
||||
|
||||
#ifndef _AIS_RadiusDimension_HeaderFile
|
||||
#define _AIS_RadiusDimension_HeaderFile
|
||||
|
||||
#include <AIS.hxx>
|
||||
#include <AIS_Dimension.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_RadiusDimension,AIS_Dimension)
|
||||
|
||||
class AIS_RadiusDimension : public AIS_Dimension
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle);
|
||||
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint);
|
||||
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
|
||||
const Standard_Real theExtensionSize = 1.0);
|
||||
|
||||
Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
|
||||
const gp_Pnt& theAttachPoint,
|
||||
const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
|
||||
const Standard_Real theExtensionSize = 1.0);
|
||||
//! Constructs the radius display object defined by the <br>
|
||||
//! shape aShape, the dimension aVal, and the text aText.
|
||||
Standard_EXPORT AIS_RadiusDimension (const TopoDS_Shape& aShape);
|
||||
|
||||
Standard_EXPORT void SetFlyout (const Standard_Real theFlyoutSize);
|
||||
|
||||
Standard_EXPORT Standard_Real GetFlyout () const;
|
||||
|
||||
DEFINE_STANDARD_RTTI(AIS_RadiusDimension)
|
||||
|
||||
protected:
|
||||
//! Computes dimension value in display units
|
||||
Standard_EXPORT virtual void computeValue ();
|
||||
//! Fills default plane object if it is possible to count plane automatically.
|
||||
Standard_EXPORT virtual void countDefaultPlane ();
|
||||
|
||||
private:
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
|
||||
const Handle(Prs3d_Presentation)& thePresentation,
|
||||
const Standard_Integer theMode = 0);
|
||||
|
||||
// Fields
|
||||
|
||||
//! 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 <myFlyout> value.
|
||||
//! The direction vector is counting using the working plane.
|
||||
//! <myFlyout> value defined the size of flyout.
|
||||
Standard_Real myFlyout;
|
||||
gp_Circ myCircle;
|
||||
};
|
||||
#endif
|
@@ -1,52 +0,0 @@
|
||||
// Created on: 1997-02-28
|
||||
// Created by: Jean-Pierre COMBE
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2012 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.
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : KindOfDimension
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline AIS_KindOfDimension AIS_RadiusDimension::KindOfDimension() const
|
||||
{
|
||||
return AIS_KOD_RADIUS;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsMovable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean AIS_RadiusDimension::IsMovable() const
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DrawFromCenter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean AIS_RadiusDimension::DrawFromCenter() const
|
||||
{
|
||||
return mydrawFromCenter;
|
||||
}
|
||||
|
||||
inline void AIS_RadiusDimension::SetDrawFromCenter(const Standard_Boolean drawfromcenter)
|
||||
{
|
||||
mydrawFromCenter = drawfromcenter;
|
||||
}
|
@@ -48,7 +48,7 @@ uses
|
||||
Presentation from Prs3d,
|
||||
Curve from Geom,
|
||||
NameOfColor from Quantity,
|
||||
Color from Quantity,
|
||||
Color from Quantity,
|
||||
TypeOfLine from Aspect,
|
||||
TypeOfMarker from Aspect,
|
||||
KindOfInteractive from AIS,
|
||||
|
@@ -38,9 +38,8 @@
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_AngleAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
|
||||
#include <StdPrs_WFDeflectionShape.hxx>
|
||||
@@ -237,22 +236,17 @@ void AIS_Relation::SetColor(const Quantity_Color &aCol)
|
||||
if (!myDrawer->HasLineAspect()) {
|
||||
myDrawer->SetLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
|
||||
}
|
||||
if (!myDrawer->HasLengthAspect()) {
|
||||
myDrawer->SetLengthAspect(new Prs3d_LengthAspect);
|
||||
}
|
||||
if (!myDrawer->HasAngleAspect()) {
|
||||
myDrawer->SetAngleAspect(new Prs3d_AngleAspect);
|
||||
if (!myDrawer->HasDimensionAspect()) {
|
||||
myDrawer->SetDimensionAspect(new Prs3d_DimensionAspect);
|
||||
}
|
||||
|
||||
myDrawer->LineAspect()->SetColor(aCol);
|
||||
const Handle(Prs3d_LengthAspect)& LENGTH = myDrawer->LengthAspect();
|
||||
const Handle(Prs3d_AngleAspect)& ANGLE = myDrawer->AngleAspect();
|
||||
const Handle(Prs3d_DimensionAspect)& DIMENSION = myDrawer->DimensionAspect();
|
||||
const Handle(Prs3d_LineAspect)& LINE = myDrawer->LineAspect();
|
||||
const Handle(Prs3d_TextAspect)& TEXT = myDrawer->TextAspect();
|
||||
|
||||
LENGTH->SetLineAspect(LINE);
|
||||
LENGTH->SetTextAspect(TEXT);
|
||||
ANGLE->SetLineAspect(LINE);
|
||||
ANGLE->SetTextAspect(TEXT);
|
||||
DIMENSION->SetLineAspect(LINE);
|
||||
DIMENSION->SetTextAspect(TEXT);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -267,8 +261,7 @@ void AIS_Relation::UnsetColor()
|
||||
Quantity_Color CC;
|
||||
AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
|
||||
LA->SetColor(CC);
|
||||
myDrawer->AngleAspect()->SetLineAspect(LA);
|
||||
myDrawer->LengthAspect()->SetLineAspect(LA);
|
||||
myDrawer->DimensionAspect()->SetLineAspect(LA);
|
||||
myDrawer->SetTextAspect(myDrawer->Link()->TextAspect());
|
||||
}
|
||||
|
||||
|
@@ -54,7 +54,7 @@
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
#include <Prs3d_LengthAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
|
||||
#include <DsgPrs_SymmetricPresentation.hxx>
|
||||
|
||||
@@ -541,10 +541,10 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta
|
||||
gp_Pnt Pj1 = ElCLib::Value(ElCLib::Parameter(laxis,myFAttach),laxis);
|
||||
gp_Pnt Pj2 = ElCLib::Value(ElCLib::Parameter(laxis,mySAttach),laxis);
|
||||
if ((myFAttach.SquareDistance(Pj1)+mySAttach.SquareDistance(Pj2)) <= Precision::Confusion()) myArrowSize = 0.;
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
if(cu1.GetType() == GeomAbs_Line)
|
||||
DsgPrs_SymmetricPresentation::Add(aprs,
|
||||
@@ -632,10 +632,10 @@ void AIS_SymmetricRelation::ComputeTwoVerticesSymmetric(const Handle(Prs3d_Prese
|
||||
myPosition = curpos;
|
||||
}
|
||||
if (2*(myFAttach.Distance(mySAttach)) <= Precision::Confusion()) myArrowSize = 0.;
|
||||
Handle(Prs3d_LengthAspect) la = myDrawer->LengthAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->Arrow1Aspect();
|
||||
Handle(Prs3d_DimensionAspect) la = myDrawer->DimensionAspect();
|
||||
Handle(Prs3d_ArrowAspect) arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
arr = la->Arrow2Aspect();
|
||||
arr = la->ArrowAspect();
|
||||
arr->SetLength(myArrowSize);
|
||||
DsgPrs_SymmetricPresentation::Add(aprs,
|
||||
myDrawer,
|
||||
|
@@ -7,3 +7,13 @@ AIS_NListIteratorOfListTransient.hxx
|
||||
AIS_NDataMapOfTransientIteratorOfListTransient.hxx
|
||||
AIS_Triangulation.cdl
|
||||
AIS_Triangulation.cxx
|
||||
AIS_Dimension.hxx
|
||||
AIS_Dimension.cxx
|
||||
AIS_LengthDimension.hxx
|
||||
AIS_LengthDimension.cxx
|
||||
AIS_AngleDimension.hxx
|
||||
AIS_AngleDimension.cxx
|
||||
AIS_DiameterDimension.hxx
|
||||
AIS_DiameterDimension.cxx
|
||||
AIS_RadiusDimension.hxx
|
||||
AIS_RadiusDimension.cxx
|
||||
|
Reference in New Issue
Block a user