1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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:
aba
2013-10-31 16:49:38 +04:00
committed by bugmaster
parent 7c633a3eab
commit a6eb515f9d
137 changed files with 7591 additions and 6616 deletions

View File

@@ -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;

View File

@@ -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();

View File

@@ -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

View 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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}

View 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

View File

@@ -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

File diff suppressed because it is too large Load Diff

317
src/AIS/AIS_Dimension.hxx Normal file
View 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

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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();}

View File

@@ -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)

View File

@@ -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 --

View File

@@ -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();

View File

@@ -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

View 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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View 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

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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());
}

View File

@@ -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,

View File

@@ -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

View File

@@ -538,7 +538,8 @@ is
enumeration TypeOfDisplayText is TODT_NORMAL,
TODT_SUBTITLE,
TODT_DEKALE,
TODT_BLEND
TODT_BLEND,
TODT_DIMENSION
end TypeOfDisplayText;
---Purpose: Define the display type of the text.
--
@@ -546,6 +547,7 @@ is
-- TODT_SUBTITLE There is a subtitle under the text.
-- TODT_DEKALE The text is displayed with a 3D style.
-- TODT_BLEND The text is displayed in XOR.
-- TODT_DIMENSION Dimension line under text will be invisible.
---Category: Enumerations
enumeration TypeOfMarker is TOM_POINT,

View File

@@ -86,15 +86,7 @@ AS_FIRSTAR_LASTPT,AS_FIRSTPT_LASTAR;
imported DatumPrs;
ComputeSymbol(aPresentation: Presentation from Prs3d;
anAspect: AngleAspect from Prs3d;
pt1,pt2:Pnt from gp;
dir1,dir2: Dir from gp;
ArrowSide: ArrowSide from DsgPrs);
---Purpose: draws symbols ((one or two) arrows,(one or two)points
-- at thebeginning and at the end of the dimension
ComputeSymbol(aPresentation: Presentation from Prs3d;
anAspect: LengthAspect from Prs3d;
anAspect: DimensionAspect from Prs3d;
pt1,pt2:Pnt from gp;
dir1,dir2: Dir from gp;
ArrowSide: ArrowSide from DsgPrs;

View File

@@ -47,14 +47,14 @@
#include <gce_MakeLin.hxx>
void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_AngleAspect)& LA,
const Handle(Prs3d_DimensionAspect)& LA,
const gp_Pnt& pt1,
const gp_Pnt& pt2,
const gp_Dir& dir1,
const gp_Dir& dir2,
const DsgPrs_ArrowSide ArrowSide)
const DsgPrs_ArrowSide ArrowSide,
const Standard_Boolean drawFromCenter)
{
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
@@ -64,6 +64,7 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
LA->LineAspect()->Aspect()->Values (aColor, aType, aWidth);
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
switch(ArrowSide) {
case DsgPrs_AS_NONE:
@@ -109,9 +110,12 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_FIRSTPT:
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
break;
}
@@ -126,12 +130,18 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_BOTHPT:
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1);
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2);
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1);
}
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2);
}
break;
}
@@ -153,10 +163,12 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
case DsgPrs_AS_FIRSTPT_LASTAR:
{
// a Round
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
if(drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
// an Arrow
Prs3d_Arrow::Draw(aPresentation,
pt2,
@@ -168,134 +180,6 @@ void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
}
}
void DsgPrs::ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_LengthAspect)& LA,
const gp_Pnt& pt1,
const gp_Pnt& pt2,
const gp_Dir& dir1,
const gp_Dir& dir2,
const DsgPrs_ArrowSide ArrowSide,
const Standard_Boolean drawFromCenter)
{
Quantity_Color aColor;
Aspect_TypeOfLine aType;
Standard_Real aWidth;
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
LA->LineAspect()->Aspect()->Values(aColor, aType, aWidth);
Handle(Graphic3d_AspectMarker3d) aMarkerAsp = new Graphic3d_AspectMarker3d (Aspect_TOM_O, aColor, 1.0);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect (aMarkerAsp);
switch(ArrowSide) {
case DsgPrs_AS_NONE:
{
break;
}
case DsgPrs_AS_FIRSTAR:
{
Prs3d_Arrow::Draw(aPresentation,
pt1,
dir1,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
case DsgPrs_AS_LASTAR:
{
Prs3d_Arrow::Draw(aPresentation,
pt2,
dir2,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
case DsgPrs_AS_BOTHAR:
{
Prs3d_Arrow::Draw(aPresentation,
pt1,
dir1,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,
pt2,
dir2,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
case DsgPrs_AS_FIRSTPT:
{
if (drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
break;
}
case DsgPrs_AS_LASTPT:
{
// On dessine un rond
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
break;
}
case DsgPrs_AS_BOTHPT:
{
if (drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints1 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints1->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints1);
}
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints2 = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints2->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints2);
break;
}
case DsgPrs_AS_FIRSTAR_LASTPT:
{
// an Arrow
Prs3d_Arrow::Draw (aPresentation,
pt1,
dir1,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
// a Round
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt2.X(), pt2.Y(), pt2.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
break;
}
case DsgPrs_AS_FIRSTPT_LASTAR:
{
// a Round
if (drawFromCenter)
{
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (pt1.X(), pt1.Y(), pt1.Z());
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray (anArrayOfPoints);
}
// an Arrow
Prs3d_Arrow::Draw (aPresentation,
pt2,
dir2,
LA->Arrow1Aspect()->Angle(),
LA->Arrow1Aspect()->Length());
break;
}
}
}
//=======================================================================
//function : ComputePlanarFacesLengthPresentation

View File

@@ -24,11 +24,10 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_Text.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
@@ -87,14 +86,13 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Circ& VmaxCircle,
const Standard_Real aArrowSize)
{
Handle(Prs3d_AngleAspect) anAngleAspect = aDrawer->AngleAspect();
Handle(Prs3d_LengthAspect) aLengthAspect = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) aDimensionAspect = aDrawer->DimensionAspect();
TCollection_ExtendedString txt(aText);
const Standard_Real myArrowSize = ( aArrowSize == 0.0 )? (0.1 * aCircle.Radius()) : aArrowSize;
anAngleAspect->ArrowAspect()->SetLength(myArrowSize);
aDimensionAspect->ArrowAspect()->SetLength(myArrowSize);
aDrawer->ArrowAspect()->SetLength(myArrowSize);
Standard_Boolean IsConeTrimmed = Standard_False;
@@ -175,15 +173,15 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims->AddVertex(ElCLib::Value(param + angle/11 * i, aCircle2));
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
DsgPrs::ComputeSymbol(aPresentation, anAngleAspect, AttachmentPnt,
DsgPrs::ComputeSymbol(aPresentation, aDimensionAspect, AttachmentPnt,
AttachmentPnt, aDir, aDir, DsgPrs_AS_LASTAR);
DsgPrs::ComputeSymbol(aPresentation, anAngleAspect, OppositePnt,
DsgPrs::ComputeSymbol(aPresentation, aDimensionAspect, OppositePnt,
OppositePnt, aDir2, aDir2, DsgPrs_AS_LASTAR);
param = ElCLib::Parameter(aCircle2, tmpPnt);
tmpPnt = ElCLib::Value(param, aCircle2);
tmpPnt = tmpPnt.Translated(gp_Vec(0, 0, -2));
Prs3d_Text::Draw(aPresentation, aLengthAspect->TextAspect(), txt, tmpPnt); //add the TCollection_ExtendedString
Prs3d_Text::Draw(aPresentation, aDimensionAspect->TextAspect(), txt, tmpPnt); //add the TCollection_ExtendedString
angle = 2. * M_PI - param ;
if( param > OppParam )
@@ -241,7 +239,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax(CenterPoint,axisdir,dir1);
@@ -353,7 +351,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle( Prs3d_AngleAspect ) LA = aDrawer->AngleAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
gp_Circ AngleCirc, AttachCirc;
@@ -467,7 +465,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm;
@@ -586,7 +584,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
char valcar[80];
sprintf(valcar,"%5.2f",theval);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm = dir1.Crossed(dir2);
@@ -702,7 +700,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
TCollection_AsciiString valas(valcar);
TCollection_ExtendedString aText(valas);
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir Norm = dir1.Crossed(dir2);
@@ -801,7 +799,7 @@ void DsgPrs_AnglePresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Ax1& theAxe,
const DsgPrs_ArrowSide ArrowSide)
{
Handle(Prs3d_AngleAspect) LA = aDrawer->AngleAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir dir1(gp_Vec(CenterPoint, AttachmentPoint1));

View File

@@ -27,7 +27,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
#include <gp_Dir.hxx>
@@ -42,7 +42,7 @@ void DsgPrs_Chamf2dPresentation::Add(
const gp_Pnt& aPntEnd,
const TCollection_ExtendedString& aText)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
@@ -52,7 +52,7 @@ void DsgPrs_Chamf2dPresentation::Add(
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
gp_Dir ArrowDir(aPntAttach.XYZ()-aPntEnd.XYZ());
Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,aPntAttach,ArrowDir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,aPntEnd);
}
@@ -71,7 +71,7 @@ void DsgPrs_Chamf2dPresentation::Add(
const TCollection_ExtendedString& aText,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());

View File

@@ -24,7 +24,7 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
@@ -43,7 +43,7 @@ void DsgPrs_ConcentricPresentation::Add(
const gp_Dir& aNorm,
const gp_Pnt& aPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
//Creation et discretisation du plus gros cercle
gp_Circ Circ(gp_Ax2(aCenter,aNorm), aRadius);

View File

@@ -25,7 +25,7 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_ArrowAspect.hxx>
@@ -60,7 +60,7 @@ void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
const DsgPrs_ArrowSide ArrowPrs,
const Standard_Boolean IsDiamSymbol )
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real parat = ElCLib::Parameter(aCircle, AttachmentPoint);
@@ -156,7 +156,7 @@ void DsgPrs_DiameterPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
lpara -= 2.*M_PI;
}
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real parEndOfArrow = ElCLib::Parameter(aCircle,AttachmentPoint);
gp_Pnt EndOfArrow;

View File

@@ -27,7 +27,7 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
@@ -66,7 +66,7 @@ void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aP
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
const Standard_Real dist = aCenter.Distance( aPosition );
@@ -108,7 +108,7 @@ void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aP
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if(!IsInDomain)
@@ -150,7 +150,7 @@ void DsgPrs_EllipseRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aP
const Standard_Boolean IsMaxRadius,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if(!IsInDomain)

View File

@@ -22,7 +22,7 @@
#include <DsgPrs.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
@@ -48,7 +48,7 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
const gp_Pnt& Point4,
const Handle( Geom_Plane )& Plane )
{
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
// Line between two middles
@@ -132,7 +132,7 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
gp_Pnt& aProj1,
gp_Pnt& aProj2)
{
const Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
const Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (aPoint1,aDirection);
@@ -170,7 +170,7 @@ void DsgPrs_EqualDistancePresentation::Add( const Handle( Prs3d_Presentation )&
const gp_Pnt& aPoint4,
const DsgPrs_ArrowSide anArrowSide)
{
const Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
const Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real aPar11, aPar12, aPar21, aPar22;

View File

@@ -22,7 +22,7 @@
#include <DsgPrs.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Root.hxx>
@@ -42,7 +42,7 @@ void DsgPrs_EqualRadiusPresentation::Add( const Handle( Prs3d_Presentation )& aP
const gp_Pnt& SecondPoint,
const Handle( Geom_Plane )& Plane )
{
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);

View File

@@ -26,7 +26,7 @@
#include <Graphic3d_Group.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
@@ -84,10 +84,10 @@ void DsgPrs_FilletRadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPr
gp_Dir DirOfArrow;
gp_Circ FilletCirc;
// gp_Pnt NewPosition, EndOfArrow;
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
Standard_Real ArrowLength = LA->Arrow1Aspect()->Length();
Standard_Real ArrowLength = LA->ArrowAspect()->Length();
DsgPrs::ComputeFilletRadiusPresentation( ArrowLength,
theval,
aPosition,

View File

@@ -27,7 +27,7 @@
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
@@ -56,7 +56,7 @@ void DsgPrs_FixPresentation::Add(
const gp_Dir& aNormPln,
const Standard_Real symbsize)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(10);

View File

@@ -30,7 +30,7 @@
#include <Graphic3d_ArrayOfPoints.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
#include <TCollection_AsciiString.hxx>
@@ -49,7 +49,7 @@ void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresent
const gp_Pnt& aPntAttach,
const gp_Pnt& aPntOffset)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
@@ -82,7 +82,7 @@ void DsgPrs_IdenticPresentation::Add( const Handle(Prs3d_Presentation)& aPresent
const gp_Pnt& aSAttach,
const gp_Pnt& aPntOffset)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(4);
@@ -120,7 +120,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& aSAttach,
const gp_Pnt& aPntOffset)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax = theAxe;
@@ -169,7 +169,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& aPntOffset,
const gp_Pnt& aPntOnCirc)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Ax2 ax = theAxe;
@@ -218,7 +218,7 @@ void DsgPrs_IdenticPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& aPntOffset,
const gp_Pnt& aPntOnElli)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real pFAttach = ElCLib::Parameter(anEllipse, aFAttach);

View File

@@ -28,7 +28,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Text.hxx>
@@ -52,7 +52,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const gp_Dir& aDirection,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@@ -88,7 +88,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
aPrims->AddVertex(PointMin);
aPrims->AddVertex(PointMax);
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
@@ -96,13 +96,13 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
arrdir.Reverse();
// arrow 1 : 2nd group
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir, LA->Arrow1Aspect()->Angle(), LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir, LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// arrow 2 : 3rd group
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(), LA->Arrow2Aspect()->Angle(), LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(), LA->ArrowAspect()->Angle(), LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
@@ -137,14 +137,14 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs )
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt EndOfArrow1, EndOfArrow2;
gp_Dir DirOfArrow1;
DsgPrs::ComputePlanarFacesLengthPresentation( LA->Arrow1Aspect()->Length(),
LA->Arrow2Aspect()->Length(),
DsgPrs::ComputePlanarFacesLengthPresentation( LA->ArrowAspect()->Length(),
LA->ArrowAspect()->Length(),
AttachmentPoint1,
AttachmentPoint2,
aDirection,
@@ -208,7 +208,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@@ -245,7 +245,7 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
aPrims->AddVertex(PointMin);
aPrims->AddVertex(PointMax);
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
@@ -285,7 +285,7 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs )
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt EndOfArrow2;
@@ -293,8 +293,8 @@ void DsgPrs_LengthPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
Handle( Geom_Curve ) VCurve, UCurve;
Standard_Real FirstU, deltaU = 0.0e0, FirstV, deltaV = 0.0e0;
DsgPrs::ComputeCurvilinearFacesLengthPresentation( LA->Arrow1Aspect()->Length(),
LA->Arrow2Aspect()->Length(),
DsgPrs::ComputeCurvilinearFacesLengthPresentation( LA->ArrowAspect()->Length(),
LA->ArrowAspect()->Length(),
SecondSurf,
AttachmentPoint1,
AttachmentPoint2,
@@ -381,22 +381,22 @@ void DsgPrs_LengthPresentation::Add (const Handle(Prs3d_Presentation)& aPrs,
{
case DsgPrs_AS_LASTAR:
Prs3d_Arrow::Draw(aPrs,Pt2,gp_Dir(gp_Vec(Pt1,Pt2)),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
break;
case DsgPrs_AS_FIRSTAR:
Prs3d_Arrow::Draw(aPrs,Pt1,gp_Dir(gp_Vec(Pt2,Pt1)),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
break;
case DsgPrs_AS_BOTHAR:
V = gp_Vec(Pt1,Pt2);
Prs3d_Arrow::Draw(aPrs,Pt2,gp_Dir(V),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
Prs3d_Arrow::Draw(aPrs,Pt1,gp_Dir(V.Reversed()),
aDrawer->LengthAspect()->Arrow1Aspect()->Angle(),
aDrawer->LengthAspect()->Arrow1Aspect()->Length());
aDrawer->DimensionAspect()->ArrowAspect()->Angle(),
aDrawer->DimensionAspect()->ArrowAspect()->Length());
break;
default:
break;

View File

@@ -40,7 +40,7 @@
#include <Prs3d_Root.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
//===================================================================
@@ -57,7 +57,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
{
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Ax2 ax = theAxe;
ax.SetLocation(MidPoint);
@@ -123,7 +123,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Ax2 ax = theAxe;
ax.SetLocation(MidPoint);
@@ -189,7 +189,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Ax2 ax = aCircle.Position();
ax.SetLocation(MidPoint);
@@ -263,7 +263,7 @@ void DsgPrs_MidPointPresentation::Add (const Handle(Prs3d_Presentation)& aPresen
Standard_Real rad = AttachPoint.Distance(MidPoint)/20.0;
if ( rad <= Precision::Confusion() ) rad = Point1.Distance(Point2)/20.0;
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
gp_Pnt Ptmp,ptcur;

View File

@@ -34,7 +34,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
@@ -61,7 +61,7 @@ void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const gp_Dir& aDirection2,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@@ -114,19 +114,19 @@ void DsgPrs_OffsetPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
if (DimNulle)
{
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction().Reversed(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Arrow::Draw(aPresentation,offp,L4.Direction().Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
}
else
{
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside)
arrdir.Reverse();
// fleche 1 : 2eme groupe
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
@@ -177,7 +177,7 @@ void DsgPrs_OffsetPresentation::AddAxes (const Handle(Prs3d_Presentation)& aPres
gp_Lin L2 (AttachmentPoint2,aDirection);
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L2,OffsetPoint),L2);
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Quantity_Color acolor;
Aspect_TypeOfLine atype;
Standard_Real awidth;

View File

@@ -28,7 +28,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_Text.hxx>
@@ -42,7 +42,7 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Dir& aDirection,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
gp_Lin L2 (AttachmentPoint2,aDirection);
@@ -80,20 +80,20 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside)
arrdir.Reverse();
// arrow 1 : 2nd group
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
// arrow 2 : 3rd group
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,Proj2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
Prs3d_Root::NewGroup(aPresentation);
@@ -127,7 +127,7 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
const gp_Pnt& OffsetPoint,
const DsgPrs_ArrowSide ArrowPrs)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Lin L1 (AttachmentPoint1,aDirection);
@@ -163,7 +163,7 @@ void DsgPrs_ParalPresentation::Add (const Handle(Prs3d_Presentation)& aPresentat
aPrims->AddVertex(PointMin);
aPrims->AddVertex(PointMax);
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length()))
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length()))
outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside)

View File

@@ -35,7 +35,7 @@
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
@@ -53,7 +53,7 @@ void DsgPrs_PerpenPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
const Standard_Boolean intOut1,
const Standard_Boolean intOut2)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID); // ou DOT ou DOTDASH
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());

View File

@@ -31,7 +31,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_Text.hxx>
#include <Graphic3d_Vertex.hxx>
@@ -79,7 +79,7 @@ void DsgPrs_RadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
fpara -= 2.*M_PI;
lpara -= 2.*M_PI;
}
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Standard_Real parat = ElCLib::Parameter(aCircle,AttachmentPoint);
@@ -131,7 +131,7 @@ void DsgPrs_RadiusPresentation::Add (const Handle(Prs3d_Presentation)& aPresenta
arrdir.Reverse();
// fleche
Prs3d_Arrow::Draw(aPresentation,ptoncirc,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,ptoncirc,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// texte
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,attpoint);
@@ -153,7 +153,7 @@ void DsgPrs_RadiusPresentation::Add( const Handle(Prs3d_Presentation)& aPresenta
const Standard_Boolean drawFromCenter,
const Standard_Boolean reverseArrow)
{
Handle( Prs3d_LengthAspect ) LA = aDrawer->LengthAspect();
Handle( Prs3d_DimensionAspect ) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup( aPresentation )->SetPrimitivesAspect( LA->LineAspect()->Aspect() );
gp_Pnt LineOrigin, LineEnd;

View File

@@ -23,7 +23,7 @@
#include <DsgPrs_SymbPresentation.ixx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Geom_CartesianPoint.hxx>
@@ -37,7 +37,7 @@ void DsgPrs_SymbPresentation::Add (const Handle(Prs3d_Presentation)& aPresentati
const TCollection_ExtendedString& aText,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Handle(Prs3d_TextAspect) TA = LA->TextAspect();
TA->SetColor(Quantity_NOC_GREEN);
Prs3d_Text::Draw(aPresentation,TA,aText, OffsetPoint);

View File

@@ -50,7 +50,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <TCollection_AsciiString.hxx>
@@ -73,7 +73,7 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
const gp_Lin& aAxis,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt ProjOffsetPoint = ElCLib::Value(ElCLib::Parameter(aAxis,OffsetPoint),aAxis);
@@ -344,14 +344,14 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) outside = Standard_True;
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length())) outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// arrow 2 ----
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
//-------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
@@ -456,7 +456,7 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
const gp_Lin& aAxis,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Pnt OffsetPnt(OffsetPoint.X(),OffsetPoint.Y(),OffsetPoint.Z());
@@ -591,14 +591,14 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) outside = Standard_True;
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length())) outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// arrow 2 ----
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
//-------------------------------------------------------------------------------------
//| SYMBOL OF SYMMETRY |
@@ -694,7 +694,7 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
const gp_Lin& aAxis,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
if (AttachmentPoint1.IsEqual(AttachmentPoint2,Precision::Confusion()))
@@ -810,14 +810,14 @@ void DsgPrs_SymmetricPresentation::Add (const Handle(Prs3d_Presentation)& aPrese
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
//==== ARROWS ================
if (dist < (LA->Arrow1Aspect()->Length()+LA->Arrow2Aspect()->Length())) outside = Standard_True;
if (dist < (LA->ArrowAspect()->Length()+LA->ArrowAspect()->Length())) outside = Standard_True;
gp_Dir arrdir = L3.Direction().Reversed();
if (outside) arrdir.Reverse();
// arrow 1 ----
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P1,arrdir,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// arrow 2 ----
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,P2,arrdir.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
//==== POINTS ================
//Marker of localization of attachment points:

View File

@@ -25,7 +25,7 @@
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <Prs3d_DimensionAspect.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Geom_CartesianPoint.hxx>
@@ -46,10 +46,10 @@ void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresent
gp_Pnt p2 = OffsetPoint.Translated(vec2);
// Aspect
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Handle(Prs3d_DimensionAspect) LA = aDrawer->DimensionAspect();
LA->LineAspect()->SetTypeOfLine(Aspect_TOL_SOLID);
Handle(Prs3d_ArrowAspect) ARR1 = LA->Arrow1Aspect();
Handle(Prs3d_ArrowAspect) ARR2 = LA->Arrow2Aspect();
Handle(Prs3d_ArrowAspect) ARR1 = LA->ArrowAspect();
Handle(Prs3d_ArrowAspect) ARR2 = LA->ArrowAspect();
ARR1->SetLength(length/5);
ARR2->SetLength(length/5);
@@ -64,10 +64,10 @@ void DsgPrs_TangentPresentation::Add (const Handle(Prs3d_Presentation)& aPresent
// fleche 1 :
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Prs3d_Arrow::Draw(aPresentation,p1,aDirection,LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,p1,aDirection,LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
// fleche 2
Prs3d_Root::NewGroup(aPresentation);
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
Prs3d_Arrow::Draw(aPresentation,p2,aDirection.Reversed(),LA->ArrowAspect()->Angle(),LA->ArrowAspect()->Length());
}

View File

@@ -138,6 +138,7 @@ is
-- TODT_SUBTITLE There is a subtitle under the text.
-- TODT_DEKALE The text is displayed with a 3D style.
-- TODT_BLEND The text is displayed in XOR.
-- TODT_DIMENSION Dimension line under text will be invisible.
---Category: Methods to modify the class definition
SetColorSubTitle ( me : mutable;

View File

@@ -451,6 +451,12 @@ is
is deferred;
---Purpose:
SetStencilTestOptions ( me : mutable;
theCGroup : CGroup from Graphic3d;
theIsEnabled: Boolean from Standard)
is deferred;
---Purpose: sets the stencil test to theIsEnabled state;
----------------------------------------
-- Category: Methods to create Text
-- for Purpose : see Graphic3d_Group.cdl

View File

@@ -369,6 +369,10 @@ class Group from Graphic3d inherits TShared
-- Warning: Raises GroupDefinitionError if ...
raises GroupDefinitionError from Graphic3d is static;
SetStencilTestOptions (me : mutable;
theIsEnabled: Boolean from Standard);
---Purpose: sets the stencil test to theIsEnabled state;
----------------------------
-- Category: Inquire methods
----------------------------

View File

@@ -82,3 +82,8 @@ void Graphic3d_Group :: UserDraw ( const Standard_Address AnObject,
Update ();
}
void Graphic3d_Group::SetStencilTestOptions (const Standard_Boolean theIsEnabled)
{
MyGraphicDriver->SetStencilTestOptions (MyCGroup, theIsEnabled);
}

View File

@@ -122,6 +122,8 @@ OpenGl_CappingPlaneResource.hxx
OpenGl_CappingPlaneResource.cxx
OpenGl_Clipping.hxx
OpenGl_Clipping.cxx
OpenGl_StencilTest.hxx
OpenGl_StencilTest.cxx
OpenGl_ShaderObject.hxx
OpenGl_ShaderObject.cxx
OpenGl_ShaderProgram.hxx
@@ -140,4 +142,4 @@ OpenGl_SceneGeometry.hxx
OpenGl_SceneGeometry.cxx
OpenGl_RaytraceTypes.hxx
OpenGl_RaytraceSource.cxx
OpenGl_Workspace_Raytrace.cxx
OpenGl_Workspace_Raytrace.cxx

View File

@@ -29,6 +29,7 @@
#include <OpenGl_Group.hxx>
#include <OpenGl_CView.hxx>
#include <OpenGl_View.hxx>
#include <OpenGl_StencilTest.hxx>
#include <OpenGl_Text.hxx>
#include <OpenGl_Trihedron.hxx>
#include <OpenGl_Workspace.hxx>
@@ -330,6 +331,14 @@ Standard_Boolean OpenGl_GraphicDriver::Print (const Graphic3d_CView& theCView,
return isPrinted;
}
void OpenGl_GraphicDriver::SetStencilTestOptions (const Graphic3d_CGroup& theCGroup,
const Standard_Boolean theIsEnabled)
{
OpenGl_StencilTest* aStencilTest = new OpenGl_StencilTest();
aStencilTest->SetOptions (theIsEnabled);
((OpenGl_Group* )theCGroup.ptrGroup)->AddElement (TelNil, aStencilTest);
}
// =======================================================================
// function : Text
// purpose :

View File

@@ -158,6 +158,7 @@ public:
Standard_EXPORT void ViewMapping (const Graphic3d_CView& ACView, const Standard_Boolean AWait);
Standard_EXPORT void ViewOrientation (const Graphic3d_CView& ACView,const Standard_Boolean AWait);
Standard_EXPORT void Environment (const Graphic3d_CView& ACView);
Standard_EXPORT void SetStencilTestOptions (const Graphic3d_CGroup& theCGroup, const Standard_Boolean theIsEnabled);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
Standard_EXPORT void Text (const Graphic3d_CGroup& ACGroup, const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Quantity_PlaneAngle AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);

View File

@@ -0,0 +1,70 @@
// Created on: 2013-09-26
// Created by: Dmitry BOBYLEV
// Copyright (c) 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.
#include <OpenGl_GlCore11.hxx>
#include <OpenGl_StencilTest.hxx>
OpenGl_StencilTest::OpenGl_StencilTest()
{
//
}
// =======================================================================
// function : Render
// purpose :
// =======================================================================
void OpenGl_StencilTest::Render (const Handle(OpenGl_Workspace)&) const
{
if (myIsEnabled)
{
glEnable (GL_STENCIL_TEST);
glStencilFunc (GL_NOTEQUAL, 1, 0xFF);
}
else
{
glDisable (GL_STENCIL_TEST);
}
}
// =======================================================================
// function : Release
// purpose :
// =======================================================================
void OpenGl_StencilTest::Release (const Handle(OpenGl_Context)&)
{
//
}
// =======================================================================
// function : SetStencilTestState
// purpose :
// =======================================================================
void OpenGl_StencilTest::SetOptions (const Standard_Boolean theIsEnabled)
{
myIsEnabled = theIsEnabled;
}
// =======================================================================
// function : ~OpenGl_StencilTest
// purpose :
// =======================================================================
OpenGl_StencilTest::~OpenGl_StencilTest()
{
//
}

View File

@@ -1,7 +1,6 @@
// Created on: 1997-03-03
// Created by: Jean-Pierre COMBE
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2012 OPEN CASCADE SAS
// Created on: 2013-09-26
// Created by: Dmitry BOBYLEV
// Copyright (c) 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
@@ -18,21 +17,36 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#ifndef OpenGl_StencilTest_Header
#define OpenGl_StencilTest_Header
//=======================================================================
//function : SetShape
//purpose :
//=======================================================================
inline void AIS_DimensionOwner::SetShape(const TopoDS_Shape& aShape)
#include <OpenGl_Element.hxx>
class OpenGl_StencilTest : public OpenGl_Element
{
myFixedShape = aShape;
}
//=======================================================================
//function : FixedShape
//purpose :
//=======================================================================
inline const TopoDS_Shape& AIS_DimensionOwner::FixedShape() const
{
return myFixedShape;
}
public:
//! Default constructor
OpenGl_StencilTest ();
//! Render primitives to the window
virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
virtual void Release (const Handle(OpenGl_Context)& theContext);
void SetOptions (const Standard_Boolean theIsEnabled);
protected:
//! Destructor
virtual ~OpenGl_StencilTest();
private:
Standard_Boolean myIsEnabled;
public:
DEFINE_STANDARD_ALLOC
};
#endif //OpenGl_StencilOptions_Header

View File

@@ -783,6 +783,35 @@ void OpenGl_Text::render (const Handle(OpenGl_PrinterContext)& thePrintCtx,
drawText (thePrintCtx, theCtx, theTextAspect);
break;
}
case Aspect_TODT_DIMENSION:
{
setupMatrix (thePrintCtx, theCtx, theTextAspect, OpenGl_Vec3 (0.0f, 0.0f, 0.00001f));
glDisable (GL_DEPTH_TEST);
glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glClear (GL_STENCIL_BUFFER_BIT);
glEnable (GL_STENCIL_TEST);
glStencilFunc (GL_ALWAYS, 1, 0x00);
glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
glBegin (GL_QUADS);
glVertex2f (myBndBox.Left, myBndBox.Top);
glVertex2f (myBndBox.Right, myBndBox.Top);
glVertex2f (myBndBox.Right, myBndBox.Bottom);
glVertex2f (myBndBox.Left, myBndBox.Bottom);
glEnd();
glStencilFunc (GL_ALWAYS, 0, 0xFF);
glDisable (GL_STENCIL_TEST);
if (!myIs2d)
{
glEnable (GL_DEPTH_TEST);
}
glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
break;
}
case Aspect_TODT_NORMAL:
{
break;

View File

@@ -416,7 +416,7 @@ OpenGl_Window::OpenGl_Window (const Handle(OpenGl_Display)& theDisplay,
if (glXGetConfig (aDisp, aVis, GLX_STENCIL_SIZE, &aStencilSize) != 0)
aStencilSize = 0;
if (!isGl || !aDepthSize || !isRGBA || (isDoubleBuffer ? 1 : 0) != (myDisplay->DBuffer()? 1 : 0))
if (!isGl || !aDepthSize || !aStencilSize || !isRGBA || (isDoubleBuffer ? 1 : 0) != (myDisplay->DBuffer()? 1 : 0))
{
XFree (aVis);
aVis = NULL;

View File

@@ -74,6 +74,19 @@ is
-- TOH_NotSet is used by AIS_Drawer class, it means that the drawer should return the global value.
-- For more details see AIS_Drawer class, AIS_Shape::Compute() method and
-- HLRAlgo package from TKHLR toolkit.
enumeration HorizontalTextAlignment is HTA_Left, HTA_Right, HTA_Center;
---Purpose: To declare horisontal alignment for dimension text.
enumeration VerticalTextAlignment is VTA_Top, VTA_Bottom, VTA_Center;
---Purpose: To declare vertical alignment for dimension text label.
enumeration DimensionArrowOrientation is DAO_Internal, DAO_External;
---Purpose: To declare arrow orientation for dimenation.
-- External orientation means that dimension has extension parts outside the measured area.
--Internal orientation means the dimension arrows are in the measured area, and no extension parts are needed.
class Presentation;
---Purpose: defines the presentation object. This object can be
@@ -92,13 +105,10 @@ is
class LineAspect;
class ShadingAspect;
class TextAspect;
deferred class CompositeAspect;
class IsoAspect;
class ArrowAspect;
class PlaneAspect;
class ArrowAspect;
class LengthAspect;
class AngleAspect;
class RadiusAspect;
class DimensionAspect;
class DatumAspect;
class Drawer;
@@ -123,10 +133,6 @@ is
---Category: Basis construction elements.
class LengthPresentation;
class AnglePresentation;
class Text;
---Category: Class signatures.

View File

@@ -1,74 +0,0 @@
-- Created on: 1993-06-03
-- Created by: Jean-Louis FRENKEL
-- Copyright (c) 1993-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 AngleAspect from Prs3d inherits CompositeAspect from Prs3d
---Purpose: A framework for defining how an angle will be
-- displayed in a presentation. Aspects of angle display include:
-- - display of the arrow pointing to the angle
-- - display of the line making up the shaft of the arrow
-- - display of the text referring to the angle.
-- The definition set by this class is then passed to the
-- attribute manager Prs3d_Drawer.
-- Any object which requires a value for angle aspect as
-- an argument may then be given the attribute manager
-- as a substitute argument in the form of a field such as
-- myDrawer for example.
uses
LineAspect from Prs3d,
TextAspect from Prs3d,
ArrowAspect from Prs3d
is
--
-- Attributes for the lines.
--
Create returns mutable AngleAspect from Prs3d;
LineAspect(me) returns mutable LineAspect from Prs3d;
--- Purpose: Returns the setting determining how the line making
-- up the shaft of the arrow will be displayed.
SetLineAspect(me: mutable; anAspect: LineAspect from Prs3d);
---Purpose: Sets how the line making up the shaft of an arrow will be displayed.
TextAspect(me) returns mutable TextAspect from Prs3d is static;
--- Purpose: Returns the setting determining how text in the
-- presentation of an angle will be displayed.
SetTextAspect(me:mutable; anAspect: TextAspect from Prs3d) is static;
---Purpose: Sets how text in the presentation of an angle will be displayed.
ArrowAspect(me) returns mutable ArrowAspect from Prs3d is static;
---Purpose: Returns the setting determining how an arrow head
-- which points to an angle will be displayed.
SetArrowAspect(me: mutable; anAspect: ArrowAspect from Prs3d) is static;
---Purpose: Sets how an arrow head which points to an angle will be displayed.
fields
myLineAspect: LineAspect from Prs3d;
myArrowAspect: ArrowAspect from Prs3d;
myTextAspect: TextAspect from Prs3d;
end AngleAspect from Prs3d;

View File

@@ -1,48 +0,0 @@
// 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.
#include <Prs3d_AngleAspect.ixx>
Prs3d_AngleAspect::Prs3d_AngleAspect() {
myLineAspect = new Prs3d_LineAspect
(Quantity_NOC_LAWNGREEN,Aspect_TOL_SOLID,1.);
myArrowAspect = new Prs3d_ArrowAspect;
myTextAspect = new Prs3d_TextAspect;
}
Handle (Prs3d_LineAspect) Prs3d_AngleAspect::LineAspect () const {
return myLineAspect;}
void Prs3d_AngleAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& anAspect) {
myLineAspect = anAspect;}
Handle(Prs3d_ArrowAspect) Prs3d_AngleAspect::ArrowAspect () const {
return myArrowAspect;}
void Prs3d_AngleAspect::SetArrowAspect (
const Handle(Prs3d_ArrowAspect)& anAspect) {
myArrowAspect = anAspect;
}
Handle(Prs3d_TextAspect) Prs3d_AngleAspect::TextAspect () const {
return myTextAspect;}
void Prs3d_AngleAspect::SetTextAspect (
const Handle(Prs3d_TextAspect)& anAspect) {
myTextAspect = anAspect;
}

View File

@@ -1,48 +0,0 @@
-- Created on: 1994-02-22
-- Created by: Jean Louis FRENKEL
-- Copyright (c) 1994-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 AnglePresentation from Prs3d inherits Root from Prs3d
---Purpose: A framework to define the display of angles.
uses
Presentation from Prs3d,
Pnt from gp,
Drawer from Prs3d,
ExtendedString from TCollection
is
Draw( myclass; aPresentation: Presentation from Prs3d;
aDrawer: Drawer from Prs3d;
aText: ExtendedString from TCollection;
AttachmentPoint1: Pnt from gp;
AttachmentPoint2: Pnt from gp;
AttachmentPoint3: Pnt from gp;
OffsetPoint: Pnt from gp);
---Purpose: Defines the representation of the angle between the
-- line defined by the points AttachmentPoint1 and
-- AttachmentPoint2 and the line defined by the points
-- AttachmentPoint1 and AttachmentPoint3.
-- The text aText is displayed at the point OffsetPoint,
-- and the drawer aDrawer specifies the display
-- attributes which angles will have.
-- The presentation object aPresentation stores the
-- information defined in this framework.
end AnglePresentation from Prs3d;

View File

@@ -1,80 +0,0 @@
// 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.
#include <Prs3d_AnglePresentation.ixx>
#include <gp_Lin.hxx>
#include <gp_Dir.hxx>
#include <ElCLib.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_AngleAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Text.hxx>
void Prs3d_AnglePresentation::Draw (
const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_Drawer)& aDrawer,
const TCollection_ExtendedString& aText,
const gp_Pnt& AttachmentPoint1,
const gp_Pnt& AttachmentPoint2,
const gp_Pnt& AttachmentPoint3,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_AngleAspect) AA = aDrawer->AngleAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(AA->LineAspect()->Aspect());
gp_Vec V1 (AttachmentPoint1,AttachmentPoint2);
gp_Vec V2 (AttachmentPoint1,AttachmentPoint3);
const Standard_Real alpha = V1.Angle(V2);
const Standard_Real ray = AttachmentPoint1.Distance(OffsetPoint);
gp_Dir I (V1);
gp_Dir K = I.Crossed(gp_Dir(V2));
gp_Dir J = K.Crossed(I);
const Standard_Integer nbp = Max (4 , Standard_Integer (50. * alpha / M_PI));
const Standard_Real dteta = alpha/(nbp-1);
gp_Vec u;
gp_Pnt p1, p2;
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(nbp+2);
aPrims->AddVertex(AttachmentPoint2);
for (Standard_Integer i = 1; i<=nbp; i++)
{
u = (gp_Vec(I) * Cos ( (i-1) * dteta)
+ gp_Vec(J) * Sin ( (i-1) * dteta)) * ray ;
p2 = AttachmentPoint1.Translated(u);
aPrims->AddVertex(p2);
if( i == nbp ) {
gp_Dir dir( gp_Vec(p1,p2) );
Prs3d_Arrow::Draw(aPresentation,p2,dir,AA->ArrowAspect()->Angle(),AA->ArrowAspect()->Length());
}
p1 = p2;
}
aPrims->AddVertex(AttachmentPoint3);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
u = (gp_Vec(I) * Cos (0.5*alpha)
+ gp_Vec(J) * Sin (0.5*alpha)) * ray ;
Prs3d_Text::Draw(aPresentation,AA->TextAspect(),aText,AttachmentPoint1.Translated(u));
}

View File

@@ -21,7 +21,7 @@
-- Modified GG : GER61351 01/02/00 Add SetColor() & Aspect() methods
class ArrowAspect from Prs3d inherits CompositeAspect from Prs3d
class ArrowAspect from Prs3d inherits BasicAspect from Prs3d
---Purpose: A framework for displaying arrows in representations
-- of dimensions and relations.
uses

View File

@@ -1,28 +0,0 @@
-- Created on: 2000-02-15
-- Created by: Gerard GRAS
-- Copyright (c) 2000-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.
---Purpose All composite Prs3d_xxxAspect must inherits from this class
deferred class CompositeAspect from Prs3d inherits TShared from MMgt
is
end CompositeAspect from Prs3d;

View File

@@ -1,18 +0,0 @@
// 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 <Prs3d_CompositeAspect.ixx>

View File

@@ -20,7 +20,7 @@
class DatumAspect from Prs3d inherits CompositeAspect from Prs3d
class DatumAspect from Prs3d inherits BasicAspect from Prs3d
---Purpose: A framework to define the display of datums.
uses

View File

@@ -0,0 +1,118 @@
-- Copyright (c) 1993-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 DimensionAspect from Prs3d inherits BasicAspect from Prs3d
---Purpose: defines the attributes when drawing a Length Presentation.
uses
HorizontalTextAlignment from Prs3d,
VerticalTextAlignment from Prs3d,
DimensionArrowOrientation from Prs3d,
AspectLine3d from Graphic3d,
ArrowAspect from Prs3d,
LineAspect from Prs3d,
TextAspect from Prs3d,
NameOfColor from Quantity,
Color from Quantity,
TypeOfLine from Aspect,
PlaneAngle from Quantity,
TypeOfLine from Aspect
is
Create returns mutable DimensionAspect from Prs3d;
--- Purpose: Constructs an empty framework to define the display of dimensions.
LineAspect(me) returns mutable LineAspect from Prs3d;
---Purpose: Returns the settings for the display of lines used in presentation of dimensions.
SetLineAspect(me: mutable; theAspect: LineAspect from Prs3d);
---Purpose: Sets the display attributes of lines used in presentation of dimensions.
TextAspect(me) returns mutable TextAspect from Prs3d is static;
--- Purpose: Returns the settings for the display of text used in presentation of dimensions.
SetTextAspect(me:mutable; theAspect: TextAspect from Prs3d) is static;
---Purpose: Sets the display attributes of text used in presentation of dimensions.
IsText3d(me) returns Boolean from Standard;
--- Purpose: Check if text for dimension label is 3d.
MakeText3d (me:mutable; isText3d: Boolean from Standard);
---Purpose: Sets type of text.
IsTextShaded (me) returns Boolean from Standard;
--- Purpose: Check if 3d text for dimension label is shaded.
MakeTextShaded (me: mutable; isTextShaded: Boolean from Standard);
--- Purpose: Turns on/off text shading for 3d text.
IsArrows3d(me) returns Boolean from Standard;
--- Purpose: Gets type of arrows.
MakeArrows3d (me:mutable; isArrows3d: Boolean from Standard);
---Purpose: Sets type of arrows.
SetArrowOrientation(me: mutable; theArrowOrient: DimensionArrowOrientation from Prs3d);
--- Purpose: Sets orientation of arrows (external or internal).
-- By default orientation is chosen automatically according to situation and text label size.
GetArrowOrientation (me) returns DimensionArrowOrientation from Prs3d;
--- Purpose: Gets orientation of arrows (external or internal).
SetVerticalTextAlignment(me: mutable; theVertTextAlignment: VerticalTextAlignment from Prs3d);
--- Purpose: Sets vertical text alignment for text label.
VerticalTextAlignment (me) returns VerticalTextAlignment from Prs3d;
--- Purpose: Gets vertical text alignment for text label.
SetHorizontalTextAlignment (me: mutable; theHorTextAlignment: HorizontalTextAlignment from Prs3d);
--- Purpose: Sets horizontal text alignment for text label.
HorizontalTextAlignment (me) returns HorizontalTextAlignment from Prs3d;
--- Purpose: Gets horizontal text alignment for text label.
ArrowAspect(me) returns mutable ArrowAspect from Prs3d is static;
--- Purpose: Returns the settings for displaying arrows.
SetArrowAspect(me: mutable; theAspect: ArrowAspect from Prs3d) is static;
---Purpose: Sets the display attributes of arrows used in presentation of dimensions.
SetCommonColor(me:mutable; theColor: Color from Quantity) is static;
---Purpose: Sets the same color for all parts of dimension: lines, arrows and text.
fields
myLineAspect: LineAspect from Prs3d;
---Purpose: Text style. The size for 3d (or 2d) text is also inside here.
myTextAspect: TextAspect from Prs3d;
myArrowAspect : ArrowAspect from Prs3d;
myIsText3d : Boolean from Standard;
myIsTextShaded : Boolean from Standard;
myIsArrows3d: Boolean from Standard;
myArrowOrientation : DimensionArrowOrientation from Prs3d;
---Purpose: Dimension arrow orientation
-- By default, it is computed automatically. Its value depends on the text
-- bouning rectangle size and distance between two flyouts.
-- By default, it is internal one.
myHorTextAlignment: HorizontalTextAlignment from Prs3d;
---Purpose:Horizontal text alignment (Prs3d_HTA_Left/Prs3d_HTA_Right/Prs3d_HTA_Center).
-- Defines horizontal position of text value label, by default it is center.
myVerTextAlignment: VerticalTextAlignment from Prs3d;
---Purpose: Vertical text alignment (Prs3d_VTA_Top, Prs3d_VTA_Bottom/Prs3d_VTA_Center)
-- Defines vertical position of text value lable, by default it is center.
end DimensionAspect from Prs3d;

View File

@@ -0,0 +1,242 @@
// 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.
#include <Prs3d_DimensionAspect.hxx>
#include <Aspect_TypeOfLine.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_TextAspect.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Quantity_Color.hxx>
IMPLEMENT_STANDARD_HANDLE (Prs3d_DimensionAspect, Prs3d_BasicAspect)
IMPLEMENT_STANDARD_RTTIEXT (Prs3d_DimensionAspect, Prs3d_BasicAspect)
//=======================================================================
//function : Constructor
//purpose :
//=======================================================================
Prs3d_DimensionAspect::Prs3d_DimensionAspect ()
{
// Text alignment
myHorTextAlignment = Prs3d_HTA_Center;
myVerTextAlignment = Prs3d_VTA_Center;
// Arrow orientation, will be computed on further steps, by default it is internal.
myArrowOrientation = Prs3d_DAO_Internal;
myLineAspect = new Prs3d_LineAspect (Quantity_NOC_LAWNGREEN,Aspect_TOL_SOLID,1.);
myTextAspect = new Prs3d_TextAspect;
myTextAspect->Aspect()->SetTextZoomable (Standard_False);
myTextAspect->SetColor (Quantity_NOC_LAWNGREEN);
myTextAspect->SetHorizontalJustification (Graphic3d_HTA_CENTER);
myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER);
myArrowAspect = new Prs3d_ArrowAspect;
myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
myArrowAspect->SetLength (6.);
}
//=======================================================================
//function : SetCommonColor
//purpose : Sets the same color for all parts of dimension:
// lines, arrows and text.
//=======================================================================
void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
{
myLineAspect->SetColor (theColor);
myTextAspect->SetColor (theColor);
myArrowAspect->SetColor (theColor);
}
//=======================================================================
//function : LineAspect
//purpose :
//=======================================================================
Handle(Prs3d_LineAspect) Prs3d_DimensionAspect::LineAspect () const
{
return myLineAspect;
}
//=======================================================================
//function : SetLineAspect
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& theAspect)
{
myLineAspect = theAspect;
}
//=======================================================================
//function : TextAspect
//purpose :
//=======================================================================
Handle(Prs3d_TextAspect) Prs3d_DimensionAspect::TextAspect () const
{
return myTextAspect;
}
//=======================================================================
//function : SetTextAspect
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
{
myTextAspect = theAspect;
}
//=======================================================================
//function : MakeArrows3D
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::MakeArrows3d (const Standard_Boolean isArrows3d)
{
myIsArrows3d = isArrows3d;
}
//=======================================================================
//function : IsArrows3D
//purpose :
//=======================================================================
Standard_Boolean Prs3d_DimensionAspect::IsArrows3d () const
{
return myIsArrows3d;
}
//=======================================================================
//function : MakeText3D
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::MakeText3d (const Standard_Boolean isText3d)
{
myIsText3d = isText3d;
}
//=======================================================================
//function : IsText3D
//purpose :
//=======================================================================
Standard_Boolean Prs3d_DimensionAspect::IsText3d () const
{
return myIsText3d;
}
//=======================================================================
//function : IsTextShaded
//purpose :
//=======================================================================
Standard_Boolean Prs3d_DimensionAspect::IsTextShaded () const
{
return myIsTextShaded;
}
//=======================================================================
//function : MakeTextShaded
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::MakeTextShaded (const Standard_Boolean isTextShaded)
{
myIsTextShaded = isTextShaded;
}
//=======================================================================
//function : SetArrowOrientation
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrientation theArrowOrient)
{
myArrowOrientation = theArrowOrient;
}
//=======================================================================
//function : GetArrowOrientation
//purpose :
//=======================================================================
Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::GetArrowOrientation () const
{
return myArrowOrientation;
}
//=======================================================================
//function : VerticalTextAlignment
//purpose :
//=======================================================================
Prs3d_VerticalTextAlignment Prs3d_DimensionAspect::VerticalTextAlignment () const
{
return myVerTextAlignment;
}
//=======================================================================
//function : SetVerticalTextAlignment
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetVerticalTextAlignment (const Prs3d_VerticalTextAlignment theVertTextAlignment)
{
myVerTextAlignment = theVertTextAlignment;
}
//=======================================================================
//function : HorizontalTextAlignment
//purpose :
//=======================================================================
Prs3d_HorizontalTextAlignment Prs3d_DimensionAspect::HorizontalTextAlignment () const
{
return myHorTextAlignment;
}
//=======================================================================
//function : SetHorizontalTextAlignment
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetHorizontalTextAlignment (const Prs3d_HorizontalTextAlignment theHorTextAlignment)
{
myHorTextAlignment = theHorTextAlignment;
}
//=======================================================================
//function : ArrowAspect
//purpose :
//=======================================================================
Handle(Prs3d_ArrowAspect) Prs3d_DimensionAspect::ArrowAspect () const
{
return myArrowAspect;
}
//=======================================================================
//function : SetArrowAspect
//purpose :
//=======================================================================
void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
{
myArrowAspect = theAspect;
}

View File

@@ -39,10 +39,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,
@@ -474,30 +472,13 @@ is
is virtual;
---Purpose: Sets the modality anAspect for the display of datums.
LengthAspect(me:mutable) returns mutable LengthAspect from Prs3d
---Purpose: Returns settings for the appearance of lengths.
DimensionAspect(me:mutable) returns mutable DimensionAspect from Prs3d
---Purpose: Returns settings for the appearance of dimensions.
is virtual;
SetLengthAspect(me:mutable; anAspect: LengthAspect from Prs3d)
SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d)
is virtual;
---Purpose: Sets the modality anAspect for display of lengths.
AngleAspect(me:mutable) returns mutable AngleAspect from Prs3d
---Purpose: Returns settings for lines used to display angles.
is virtual;
SetAngleAspect(me:mutable; anAspect: AngleAspect from Prs3d)
is virtual;
---Purpose: Sets the modality anAspect for the display of angles.
RadiusAspect(me) returns mutable RadiusAspect from Prs3d
---Purpose: Returns settings for lines which serve to display radii.
is virtual;
SetRadiusAspect(me:mutable; anAspect: RadiusAspect from Prs3d)
is virtual;
--- Purpose: Sets the parameter anAspect for display attributes of radii.
---Purpose: Sets the modality anAspect for display of dimensions.
SectionAspect (me:mutable) returns mutable LineAspect from Prs3d
---Purpose: The LineAspect for the wire can be edited.
@@ -568,9 +549,7 @@ fields
myVectorAspect: LineAspect from Prs3d is protected;
myDatumAspect: DatumAspect from Prs3d is protected;
myDatumScale: Real from Standard is protected;
myLengthAspect: LengthAspect from Prs3d is protected;
myAngleAspect: AngleAspect from Prs3d is protected;
myRadiusAspect: RadiusAspect from Prs3d is protected;
myDimensionAspect: DimensionAspect from Prs3d is protected;
mySectionAspect: LineAspect from Prs3d is protected;
myFaceBoundaryDraw : Boolean from Standard is protected;
myFaceBoundaryAspect : LineAspect from Prs3d is protected;

View File

@@ -397,38 +397,20 @@ void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) {
myPlaneAspect = anAspect;
}
Handle (Prs3d_LengthAspect) Prs3d_Drawer::LengthAspect () {
if (myLengthAspect.IsNull())
myLengthAspect = new Prs3d_LengthAspect;
Handle (Prs3d_DimensionAspect) Prs3d_Drawer::DimensionAspect ()
{
if (myDimensionAspect.IsNull())
myDimensionAspect = new Prs3d_DimensionAspect;
return myLengthAspect;
return myDimensionAspect;
}
void Prs3d_Drawer::SetLengthAspect ( const Handle(Prs3d_LengthAspect)& anAspect) {
myLengthAspect = anAspect;
void Prs3d_Drawer::SetDimensionAspect ( const Handle(Prs3d_DimensionAspect)& theAspect)
{
myDimensionAspect = theAspect;
}
Handle (Prs3d_AngleAspect) Prs3d_Drawer::AngleAspect () {
if (myAngleAspect.IsNull())
myAngleAspect = new Prs3d_AngleAspect;
return myAngleAspect;
}
void Prs3d_Drawer::SetAngleAspect ( const Handle(Prs3d_AngleAspect)& anAspect) {
myAngleAspect = anAspect;
}
Handle (Prs3d_RadiusAspect) Prs3d_Drawer::RadiusAspect () const {
return myRadiusAspect;
}
void Prs3d_Drawer::SetRadiusAspect ( const Handle(Prs3d_RadiusAspect)& anAspect) {
myRadiusAspect = anAspect;
}
Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect () {
if (mySectionAspect.IsNull())
mySectionAspect = new Prs3d_LineAspect

View File

@@ -1,87 +0,0 @@
-- Created on: 1993-06-03
-- Created by: Jean-Louis FRENKEL
-- Copyright (c) 1993-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 LengthAspect from Prs3d inherits CompositeAspect from Prs3d
---Purpose: defines the attributes when drawing a Length Presentation.
uses
AspectLine3d from Graphic3d,
ArrowAspect from Prs3d,
LineAspect from Prs3d,
TextAspect from Prs3d,
NameOfColor from Quantity,
TypeOfLine from Aspect,
PlaneAngle from Quantity
is
--
-- Attributes for the lines.
--
Create returns mutable LengthAspect from Prs3d;
--- Purpose: Constructs an empty framework to define the display of lengths.
LineAspect(me) returns mutable LineAspect from Prs3d;
---Purpose: Returns the settings for the display of lines used in presentation of lengths.
SetLineAspect(me: mutable; anAspect: LineAspect from Prs3d);
---Purpose: Sets the display attributes of lines used in presentation of lengths.
Arrow1Aspect(me) returns mutable ArrowAspect from Prs3d is static;
--- Purpose: Returns the settings for displaying a right-pointing arrow.
SetArrow1Aspect(me: mutable; anAspect: ArrowAspect from Prs3d) is static;
---Purpose: Sets the display attributes of the first arrow used in presentation of lengths.
Arrow2Aspect(me) returns mutable ArrowAspect from Prs3d is static;
--- Purpose: Returns the settings for displaying a left-pointing arrow.
SetArrow2Aspect(me: mutable ; anAspect: ArrowAspect from Prs3d) is static;
---Purpose: Sets the display attributes of the second arrow used in presentation of lengths.
TextAspect(me) returns mutable TextAspect from Prs3d is static;
--- Purpose: Returns the settings for the display of text used in presentation of lengths.
SetTextAspect(me:mutable; anAspect: TextAspect from Prs3d) is static;
---Purpose: Sets the display attributes of text used in presentation of lengths.
SetDrawFirstArrow(me: mutable; draw: Boolean from Standard) is static;
--- Purpose: Sets the DrawFirstArrow attributes to active.
DrawFirstArrow(me) returns Boolean from Standard is static;
---Purpose: Returns true if the first arrow can be drawn.
SetDrawSecondArrow(me: mutable; draw: Boolean from Standard) is static;
---Purpose: Sets the DrawSecondArrow attributes to active.
DrawSecondArrow(me) returns Boolean from Standard is static;
---Purpose: Returns true if the second arrow can be drawn.
fields
myLineAspect: LineAspect from Prs3d;
myArrow1Aspect: ArrowAspect from Prs3d;
myArrow2Aspect: ArrowAspect from Prs3d;
myTextAspect: TextAspect from Prs3d;
myDrawFirstArrow: Boolean from Standard;
myDrawSecondArrow: Boolean from Standard;
end LengthAspect from Prs3d;

View File

@@ -1,71 +0,0 @@
// 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.
#include <Prs3d_LengthAspect.ixx>
Prs3d_LengthAspect::Prs3d_LengthAspect() {
myLineAspect = new Prs3d_LineAspect
(Quantity_NOC_LAWNGREEN,Aspect_TOL_SOLID,1.);
myArrow1Aspect = new Prs3d_ArrowAspect;
myArrow2Aspect = new Prs3d_ArrowAspect;
myTextAspect = new Prs3d_TextAspect;
myDrawFirstArrow = Standard_True;
myDrawSecondArrow = Standard_True;
}
Handle (Prs3d_LineAspect) Prs3d_LengthAspect::LineAspect () const {
return myLineAspect;}
void Prs3d_LengthAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& anAspect) {
myLineAspect = anAspect;}
Handle(Prs3d_ArrowAspect) Prs3d_LengthAspect::Arrow1Aspect () const {
return myArrow1Aspect;}
void Prs3d_LengthAspect::SetArrow1Aspect (
const Handle(Prs3d_ArrowAspect)& anAspect) {
myArrow1Aspect = anAspect;
}
Handle(Prs3d_ArrowAspect) Prs3d_LengthAspect::Arrow2Aspect () const {
return myArrow2Aspect;}
void Prs3d_LengthAspect::SetArrow2Aspect (
const Handle(Prs3d_ArrowAspect)& anAspect) {
myArrow2Aspect = anAspect;
}
Handle(Prs3d_TextAspect) Prs3d_LengthAspect::TextAspect () const {
return myTextAspect;}
void Prs3d_LengthAspect::SetTextAspect (
const Handle(Prs3d_TextAspect)& anAspect) {
myTextAspect = anAspect;
}
void Prs3d_LengthAspect::SetDrawFirstArrow (const Standard_Boolean draw) {
myDrawFirstArrow = draw;
}
Standard_Boolean Prs3d_LengthAspect::DrawFirstArrow () const {
return myDrawFirstArrow;
}
void Prs3d_LengthAspect::SetDrawSecondArrow (const Standard_Boolean draw) {
myDrawSecondArrow = draw;
}
Standard_Boolean Prs3d_LengthAspect::DrawSecondArrow () const {
return myDrawSecondArrow;
}

View File

@@ -1,46 +0,0 @@
-- Created on: 1993-06-03
-- Created by: Jean-Louis FRENKEL
-- Copyright (c) 1993-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 LengthPresentation from Prs3d inherits Root from Prs3d
---Purpose: A framework to define the display of lengths.
uses
Presentation from Prs3d,
Pnt from gp,
Drawer from Prs3d,
ExtendedString from TCollection
is
Draw( myclass; aPresentation: Presentation from Prs3d;
aDrawer: Drawer from Prs3d;
aText: ExtendedString from TCollection;
AttachmentPoint1: Pnt from gp;
AttachmentPoint2: Pnt from gp;
OffsetPoint: Pnt from gp);
---Purpose: Defines the display of the length between the points
-- AttachmentPoint1 and AttachmentPoint2.
-- The text aText is displayed at the point OffsetPoint,
-- and the drawer aDrawer specifies the display
-- attributes which lengths will have.
-- The presentation object aPresentation stores the
-- information defined in this framework.
end LengthPresentation from Prs3d;

View File

@@ -1,69 +0,0 @@
// 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.
#include <Prs3d_LengthPresentation.ixx>
#include <gp_Lin.hxx>
#include <gp_Dir.hxx>
#include <ElCLib.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Arrow.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
#include <TCollection_AsciiString.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Prs3d_Text.hxx>
void Prs3d_LengthPresentation::Draw (
const Handle(Prs3d_Presentation)& aPresentation,
const Handle(Prs3d_Drawer)& aDrawer,
const TCollection_ExtendedString& aText,
const gp_Pnt& AttachmentPoint1,
const gp_Pnt& AttachmentPoint2,
const gp_Pnt& OffsetPoint)
{
Handle(Prs3d_LengthAspect) LA = aDrawer->LengthAspect();
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(LA->LineAspect()->Aspect());
gp_Dir D (gp_Vec(AttachmentPoint1,AttachmentPoint2));
gp_Lin L (OffsetPoint,D);
gp_Pnt Proj1 = ElCLib::Value(ElCLib::Parameter(L,AttachmentPoint1),L);
gp_Pnt Proj2 = ElCLib::Value(ElCLib::Parameter(L,AttachmentPoint2),L);
Handle(Graphic3d_ArrayOfPolylines) aPrims = new Graphic3d_ArrayOfPolylines(4);
aPrims->AddVertex(AttachmentPoint1);
aPrims->AddVertex(Proj1);
aPrims->AddVertex(Proj2);
aPrims->AddVertex(AttachmentPoint2);
Prs3d_Root::CurrentGroup(aPresentation)->AddPrimitiveArray(aPrims);
Quantity_Length X,Y,Z;
Proj1.Coord(X,Y,Z);
if (LA->DrawFirstArrow())
Prs3d_Arrow::Draw(aPresentation,Proj1,D.Reversed(),LA->Arrow1Aspect()->Angle(),LA->Arrow1Aspect()->Length());
Quantity_Length X2,Y2,Z2;
Proj2.Coord(X2,Y2,Z2);
if (LA->DrawSecondArrow())
Prs3d_Arrow::Draw(aPresentation,Proj2,D,LA->Arrow2Aspect()->Angle(),LA->Arrow2Aspect()->Length());
gp_Pnt p( .5*(X+X2), .5*(Y+Y2), .5*(Z+Z2) );
Prs3d_Text::Draw(aPresentation,LA->TextAspect(),aText,p);
}

View File

@@ -19,7 +19,7 @@
-- and conditions governing the rights and limitations under the License.
class PlaneAspect from Prs3d inherits CompositeAspect from Prs3d
class PlaneAspect from Prs3d inherits BasicAspect from Prs3d
---Purpose: A framework to define the display of planes.
uses

View File

@@ -1,47 +0,0 @@
-- Created on: 1993-06-03
-- Created by: Jean-Louis FRENKEL
-- Copyright (c) 1993-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 RadiusAspect from Prs3d inherits CompositeAspect from Prs3d
---Purpose: defines the attributes when drawing a Radius Presentation.
uses
AspectLine3d from Graphic3d,
NameOfColor from Quantity,
TypeOfLine from Aspect
is
--
-- Attributes for the lines.
--
Create (aColor: NameOfColor from Quantity;
aType: TypeOfLine from Aspect;
aWidth: Real from Standard)
returns mutable RadiusAspect from Prs3d;
---Purpose: Constructs the framework to define the display of radii.
-- This consists of the attributes:
-- - the color aColor
-- - the type of line aType and
-- - the width aWidth of the line.
end RadiusAspect from Prs3d;

View File

@@ -1,24 +0,0 @@
// 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.
#include <Prs3d_RadiusAspect.ixx>
Prs3d_RadiusAspect::Prs3d_RadiusAspect(const Quantity_NameOfColor /*aColor*/,
const Aspect_TypeOfLine /*aType*/,
const Standard_Real /*aWidth*/) {
}

View File

@@ -254,7 +254,7 @@ static Standard_Integer BUC60972 (Draw_Interpretor& di, Standard_Integer argc, c
//di << ExtString_aText << " " << Draw::Atof(argv[4]) << "\n";
di << argv[5] << " " << Draw::Atof(argv[4]) << "\n";
Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane, Draw::Atof(argv[4]), aText);
Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane->Pln());
aContext->Display(aDim);
return 0;
@@ -683,15 +683,13 @@ static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, con
di << "use 'vinit' command before " << argv[0] << "\n";
return 1;
}
if ( argc != 5 ) {
di << "Usage : " << argv[0] << " X Y Z ArrowSize" << "\n";
if ( argc != 3 ) {
di << "Usage : " << argv[0] << " ArcRadius ArrowSize" << "\n";
return 1;
}
Standard_Real X = Draw::Atof(argv[1]);
Standard_Real Y = Draw::Atof(argv[2]);
Standard_Real Z = Draw::Atof(argv[3]);
Standard_Real ArrowSize = Draw::Atof(argv[4]);
Standard_Real aRadius = Draw::Atof(argv[1]);
Standard_Real anArrowSize = Draw::Atof(argv[2]);
gp_Pnt p1 = gp_Pnt(10.,10.,0.);
gp_Pnt p2 = gp_Pnt(50.,10.,0.);
@@ -707,12 +705,17 @@ static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, con
gp_Dir plndir(0, 0, 1);
Handle(Geom_Plane) pln = new Geom_Plane(plnpt,plndir);
Handle(AIS_AngleDimension) AngleDimension = new AIS_AngleDimension(E2, E1, pln, -3.14/2., "Angle");
Handle(AIS_AngleDimension) anAngleDimension = new AIS_AngleDimension (p1.Mirrored (p2), p2, p3);
AngleDimension->SetPosition(gp_Pnt(X, Y, Z));
AngleDimension->SetArrowSize(ArrowSize);
context->Display(AngleDimension);
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect;
anAspect->MakeArrows3d (Standard_True);
anAspect->ArrowAspect()->SetLength (anArrowSize);
anAspect->SetHorizontalTextAlignment (Prs3d_HTA_Right);
anAspect->TextAspect ()->SetColor (Quantity_NOC_YELLOW);
anAngleDimension->SetDimensionAspect (anAspect);
// Another position of dimension
anAngleDimension->SetFlyout (aRadius);
context->Display (anAngleDimension, 0);
return 0;
}
@@ -864,7 +867,7 @@ void QABugs::Commands_16(Draw_Interpretor& theCommands) {
theCommands.Add ("OCC307", "OCC307 result part tool [AllowCutting=0/1]", __FILE__, OCC307, group);
theCommands.Add ("OCC395", "OCC395 edge_result edge1 edge2", __FILE__, OCC395, group);
theCommands.Add ("OCC394", "OCC394 edge_result edge [tol [mode [tolang]]]", __FILE__, OCC394, group);
theCommands.Add ("OCC301", "OCC301 X Y Z ArrowSize", __FILE__, OCC301, group);
theCommands.Add ("OCC301", "OCC301 ArcRadius ArrowSize", __FILE__, OCC301, group);
theCommands.Add ("OCC294", "OCC294 shape_result shape edge", __FILE__, OCC294, group);
theCommands.Add ("OCC60", "OCC60 xmin ymin xmax ymax; selection window", __FILE__, OCC60, group);
theCommands.Add ("OCC70", "OCC70 x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection", __FILE__, OCC70, group);

View File

@@ -328,49 +328,38 @@ static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc,
/***************************************/
//dimension "L 502.51"
/***************************************/
Handle(AIS_LengthDimension) len = new AIS_LengthDimension(V2, V3, pln, 502.51, "502.51");
len->SetPosition(gp_Pnt(350, 250, 0));
len->SetTypeOfDist(AIS_TOD_Horizontal);
len->SetArrowSize(30.0);
Handle(AIS_LengthDimension) len = new AIS_LengthDimension(V2, V3, pln->Pln());
context->Display(len);
/***************************************/
//dimension "L 90"
/***************************************/
Handle(AIS_LengthDimension) len1 = new AIS_LengthDimension(V4, V7, pln, 90, "90");
len1->SetPosition(gp_Pnt(70, 120, 0));
len1->SetTypeOfDist(AIS_TOD_Vertical);
len1->SetArrowSize(100.0);
Handle(AIS_LengthDimension) len1 = new AIS_LengthDimension(V4, V7, pln->Pln());
context->Display(len1);
/***************************************/
//dimension "L 150"
/***************************************/
Handle(AIS_LengthDimension) len2 = new AIS_LengthDimension(V1, V2, pln, 150, "150",gp_Pnt(650, 120, 0),DsgPrs_AS_BOTHAR,
AIS_TOD_Vertical, 100.0 );
//len2->SetPosition(gp_Pnt(650, 120, 0));
//len2->SetTypeOfDist(AIS_TOD_Vertical);
//len1->SetArrowSize(100.0);
Handle(AIS_LengthDimension) len2 = new AIS_LengthDimension(V1, V2, pln->Pln());
context->Display(len2);
/***************************************/
//dimension "R 88.58"
/***************************************/
gp_Circ cir = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 88.58);
TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(cir,gp_Pnt(191.09,0,0.),gp_Pnt(191.09,-177.16,0.) );
Handle(AIS_RadiusDimension) dim1 = new AIS_RadiusDimension(E1,88.58, "R 88.58",gp_Pnt(-30.0, -80.0, 0.0),DsgPrs_AS_BOTHAR,
100.0 );
Handle(AIS_RadiusDimension) dim1 = new AIS_RadiusDimension(E1);
context->Display(dim1);
/***************************************/
//dimension "R 43.80"
/***************************************/
gp_Circ cir1 = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 43.80);
TopoDS_Edge E_cir1 = BRepBuilderAPI_MakeEdge(cir1);
dim1 = new AIS_RadiusDimension(E_cir1,43.80, "R 43.80",gp_Pnt(0.0, -50.0, 0.0),DsgPrs_AS_LASTAR, 60.0 );
dim1 = new AIS_RadiusDimension(E_cir1);
context->Display(dim1);
/***************************************/
//dimension "R 17.86"
/***************************************/
gp_Circ cir2 = gp_Circ(gp_Ax2(gp_Pnt(566.11, -88.58, 0), gp_Dir(0, 0, -1)), 17.86);
TopoDS_Edge E_cir2 = BRepBuilderAPI_MakeEdge(cir2);
dim1 = new AIS_RadiusDimension(E_cir2,17.86, "R 17.86",gp_Pnt(600.0, -50.0, 0.0),DsgPrs_AS_LASTAR, 40.0 );
dim1 = new AIS_RadiusDimension(E_cir2);
context->Display(dim1);
return 0;

View File

@@ -580,13 +580,22 @@ static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, c
Handle(AIS_Shape) Ve1 = new AIS_Shape(V1);
Handle(AIS_Shape) Ve2 = new AIS_Shape(V2);
myAIScontext->Display(Ve1);
myAIScontext->Display(Ve2);
myAIScontext->Display(Ve1);
myAIScontext->Display(Ve2);
Handle(Geom_Plane) Plane1 = new Geom_Plane(gp_Pnt(0,0,0),gp_Dir(0,0,1));
TCollection_ExtendedString Ext1("Dim1");
Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,Draw::Atof(a[2]),Ext1);
Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1->Pln());
Dim1->SetCustomValue (Draw::Atof(a[2]));
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
anAspect->MakeArrows3d (Standard_False);
anAspect->MakeText3d (Standard_True);
anAspect->MakeTextShaded (Standard_True);
anAspect->TextAspect()->SetHeight (2.5);
anAspect->ArrowAspect()->SetLength (1.0);
Dim1->SetDimensionAspect (anAspect);
myAIScontext->SetDisplayMode(Dim1, Draw::Atoi(a[1]));
myAIScontext->Display(Dim1);
return 0;

View File

@@ -12,3 +12,4 @@ TKHLR
CSF_user32
CSF_gdi32
CSF_OpenGlLibs
CSF_FREETYPE

View File

@@ -370,16 +370,17 @@ void TPrsStd_ConstraintTools::ComputeDistance (const Handle(TDataXtd_Constraint)
gp_Pnt P2 = BRep_Tool::Pnt( TopoDS::Vertex(shape2) );
gp_Pnt P3(P1.Y()-1., P2.X()+1., 0.);
GC_MakePlane mkPlane(P1, P2, P3);
ais = new AIS_LengthDimension (shape1, shape2, mkPlane.Value(), val1,txt);
ais = new AIS_LengthDimension (P1, P2, mkPlane.Value()->Pln());
}
else if (isface) {
ais = new AIS_LengthDimension (GetFace(shape1),GetFace(shape2),val1,txt);
else if (isface)
{
ais = new AIS_LengthDimension (GetFace(shape1),GetFace(shape2),aplane->Pln());
}
else if (isedgeface) {
ais = new AIS_LengthDimension (GetFace(shape1),GetEdge(shape2),val1,txt);
ais = new AIS_LengthDimension (GetFace(shape1),GetEdge(shape2),aplane->Pln());
}
else {
ais = new AIS_LengthDimension (shape1,shape2,aplane,val1,txt);
ais = new AIS_LengthDimension (shape1,shape2,aplane->Pln());
}
if( SaveDrw ) ais->SetAttributes(aDrawer);
}
@@ -397,21 +398,15 @@ void TPrsStd_ConstraintTools::ComputeDistance (const Handle(TDataXtd_Constraint)
gp_Pnt P2 = BRep_Tool::Pnt( TopoDS::Vertex(shape2) );
gp_Pnt P3(P1.Y()-1., P2.X()+1., 0.);
GC_MakePlane mkPlane(P1, P2, P3);
ais->SetPlane( mkPlane.Value() );
ais->SetWorkingPlane( mkPlane.Value()->Pln() );
}
ais->SetValue (val1);
ais->SetText (txt);
ais->SetCustomValue (val1);
}
if (is_planar) {
Standard_Integer extShape (0);
#ifndef BUC60846
FindExternalShape (aConst,extShape);
#endif
ais->SetPlane (aplane);
ais->SetTypeOfDist (typedist);
ais->SetExtShape (extShape);
if (is_planar)
{
ais->SetWorkingPlane (aplane->Pln());
}
anAIS = ais;
}
@@ -774,23 +769,25 @@ void TPrsStd_ConstraintTools::ComputeAngleForOneFace (const Handle(TDataXtd_Cons
ais = Handle(AIS_AngleDimension)::DownCast(anAIS);
if(ais.IsNull()) {
face = TopoDS::Face( shape );
ais = new AIS_AngleDimension ( face, val1, txt);
ais = new AIS_AngleDimension (face);
}
else {
ais->SetConeFace(TopoDS::Face( shape ));
ais->SetValue(val1);
ais->SetText(txt);
ais->SetFirstShape(TopoDS::Face( shape ), Standard_True);
}
}
else {
face = TopoDS::Face( shape );
ais = new AIS_AngleDimension ( face, val1, txt);
face = TopoDS::Face (shape);
ais = new AIS_AngleDimension (face);
}
anAIS = ais;
}
//====================================================================
//=======================================================================
//function : CheckIsShapeCompound
//purpose :
//=======================================================================
static Standard_Boolean CheckIsShapeCompound(TopoDS_Shape& shape, TopoDS_Face& aFace)
{
if (shape.ShapeType() == TopAbs_COMPOUND) {
@@ -810,10 +807,12 @@ static Standard_Boolean CheckIsShapeCompound(TopoDS_Shape& shape, TopoDS_Face& a
#endif
return (Standard_False);
}
//=======================================================================
//function : ComputeAngle
//purpose :
//=======================================================================
void TPrsStd_ConstraintTools::ComputeAngle (const Handle(TDataXtd_Constraint)& aConst,
Handle(AIS_InteractiveObject)& anAIS)
{
@@ -1003,19 +1002,19 @@ void TPrsStd_ConstraintTools::ComputeAngle (const Handle(TDataXtd_Constraint)& a
GetGoodShape(shape2);
ais = new AIS_AngleDimension (TopoDS::Edge(shape1),
TopoDS::Edge(shape2),
(Handle(Geom_Plane)&) ageom3,val1,txt);
ais->SetExtShape(ExtShape);
((Handle(Geom_Plane)&) ageom3)->Pln());
}
}
else {
if (isCurvilinear) {
ais = new AIS_AngleDimension (TopoDS::Face(shape1),
TopoDS::Face(shape2),val1,txt);
ais = new AIS_AngleDimension (TopoDS::Face(shape1),
TopoDS::Face(shape2),
((Handle(Geom_Line)&) ageom3)->Position());
}
else if (isface) {
ais = new AIS_AngleDimension (TopoDS::Face(shape1),
TopoDS::Face(shape2),
((Handle(Geom_Line)&) ageom3)->Position(),val1,txt);
ais = new AIS_AngleDimension (TopoDS::Face(shape1),
TopoDS::Face(shape2),
((Handle(Geom_Line)&) ageom3)->Position());
}
}
}
@@ -1027,12 +1026,14 @@ void TPrsStd_ConstraintTools::ComputeAngle (const Handle(TDataXtd_Constraint)& a
}
ais->SetFirstShape(shape1);
ais->SetSecondShape(shape2);
ais->SetValue(val1);
ais->SetText(txt);
if (isplan)
ais->SetPlane ((Handle(Geom_Plane)&) ageom3);
ais->SetWorkingPlane (((Handle(Geom_Plane)&) ageom3)->Pln());
else if (!isCurvilinear)
ais->SetAxis (((Handle(Geom_Line)&) ageom3)->Position());
{
gp_Pln aPlane;
aPlane.SetAxis (((Handle(Geom_Line)&) ageom3)->Position());
ais->SetWorkingPlane (aPlane);
}
}
anAIS = ais;
}
@@ -1161,15 +1162,13 @@ void TPrsStd_ConstraintTools::ComputeRadius (const Handle(TDataXtd_Constraint)&
if (!anAIS.IsNull()) {
ais = Handle(AIS_RadiusDimension)::DownCast(anAIS);
if (ais.IsNull()) {
ais = new AIS_RadiusDimension (shape1,val1,txt);
ais = new AIS_RadiusDimension (shape1);
}
else {
ais->SetValue(val1);
ais->SetFirstShape(shape1);
ais->SetText(txt);
}
}
else ais = new AIS_RadiusDimension (shape1,val1,txt);
else ais = new AIS_RadiusDimension (shape1);
if (isplanar) {
Handle(Geom_Geometry) ageom2;
@@ -1182,8 +1181,7 @@ void TPrsStd_ConstraintTools::ComputeRadius (const Handle(TDataXtd_Constraint)&
NullifyAIS(anAIS);
return;
}
ais->SetPlane(aplane);
ais->SetDrawFromCenter(Standard_False);
ais->SetWorkingPlane(aplane->Pln());
}
anAIS = ais;
}
@@ -1625,15 +1623,13 @@ void TPrsStd_ConstraintTools::ComputeDiameter(const Handle(TDataXtd_Constraint)&
if (!anAIS.IsNull()) {
ais = Handle(AIS_DiameterDimension)::DownCast(anAIS);
if (ais.IsNull()) {
ais = new AIS_DiameterDimension (shape1,val1,txt);
ais = new AIS_DiameterDimension (shape1);
}
else {
ais->SetFirstShape(shape1);
ais->SetValue(val1);
ais->SetText(txt);
}
}
else ais = new AIS_DiameterDimension (shape1,val1,txt);
else ais = new AIS_DiameterDimension (shape1);
if (IsPlanar) {
Handle(Geom_Geometry) ageom2;
@@ -1646,7 +1642,7 @@ void TPrsStd_ConstraintTools::ComputeDiameter(const Handle(TDataXtd_Constraint)&
NullifyAIS(anAIS);
return;
}
ais->SetPlane(aplane);
//ais->SetWorkingPlane(aplane);
}
anAIS = ais;
}
@@ -1767,29 +1763,31 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
//Handle(AIS_Drawer) aDrawer;
Standard_Boolean NotNull = Standard_False;
if (nbgeom == 1) {
if (nbgeom == 1)
{
ComputeTextAndValue (aConst,val1,txt,Standard_False);
if (!anAIS.IsNull()) {
if (!anAIS.IsNull())
{
ais = Handle(AIS_LengthDimension)::DownCast(anAIS);
NotNull = Standard_True;
}
if (S1.ShapeType() == TopAbs_FACE && S2.ShapeType() == TopAbs_FACE) {
if (ais.IsNull()) {
ais = new AIS_LengthDimension (TopoDS::Face(S1),TopoDS::Face(S2),
val1,txt);
if (S1.ShapeType() == TopAbs_FACE && S2.ShapeType() == TopAbs_FACE)
{
if (ais.IsNull())
{
ais = new AIS_LengthDimension (TopoDS::Face(S1),TopoDS::Face(S2));
}
else {
ais->SetFirstShape(S1);
ais->SetSecondShape(S2);
ais->SetValue(val1);
ais->SetText(txt);
else
{
ais->SetFirstShape(S1);
ais->SetSecondShape(S2);
ais->SetCustomValue(val1);
}
if (is_planar) ais->SetPlane (aplane);
anAIS = ais;
if (is_planar)
ais->SetWorkingPlane (aplane->Pln());
anAIS = ais;
return;
}
else
@@ -1817,14 +1815,14 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
aplane = new Geom_Plane (NLin.Location(),NLin.Direction()^TDir);
if (ais.IsNull()) {
ais = new AIS_LengthDimension (S1,S2,aplane,val1,txt);
ais = new AIS_LengthDimension (S1,S2,aplane->Pln());
}
else {
ais->SetFirstShape(S1);
ais->SetSecondShape(S2);
ais->SetValue(val1);
ais->SetText(txt);
ais->SetPlane(aplane);
ais->SetCustomValue(val1);
ais->SetWorkingPlane (aplane->Pln());
}
anAIS = ais;
return;
@@ -1890,14 +1888,13 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)&
if( !anAIS.IsNull() ) NotNull = Standard_True;
ais = Handle(AIS_LengthDimension)::DownCast(anAIS);
if (ais.IsNull()) {
ais = new AIS_LengthDimension (S1,S2,aplane,val1,txt);
ais = new AIS_LengthDimension (S1,S2,aplane->Pln());
}
else {
ais->SetFirstShape (S1);
ais->SetSecondShape (S2);
ais->SetValue(val1);
ais->SetText(txt);
ais->SetPlane(aplane);
ais->SetCustomValue (val1);
ais->SetWorkingPlane (aplane->Pln ());
}
anAIS = ais;
return;
@@ -2146,16 +2143,14 @@ void TPrsStd_ConstraintTools::ComputeRound(const Handle(TDataXtd_Constraint)& aC
try {
OCC_CATCH_SIGNALS
if (anAIS.IsNull()) ais =
new AIS_RadiusDimension(shape1,val1,txt);
new AIS_RadiusDimension(shape1);
else {
ais = Handle(AIS_RadiusDimension)::DownCast(anAIS);
if (ais.IsNull()) {
ais = new AIS_RadiusDimension(shape1,val1,txt);
ais = new AIS_RadiusDimension(shape1);
}
else {
ais->SetValue(val1);
ais->SetText(txt);
ais->SetFirstShape(shape1);
ais->SetFirstShape(shape1);
}
}
}

View File

@@ -75,7 +75,6 @@
#include <AIS_InteractiveContext.hxx>
#include <Geom_Plane.hxx>
#include <gp_Pln.hxx>
#include <AIS_AngleDimension.hxx>
#include <TCollection_ExtendedString.hxx>
#include <GC_MakePlane.hxx>
#include <gp_Circ.hxx>

View File

@@ -25,77 +25,70 @@
# include <config.h>
#endif
#include <AIS_AngleDimension.hxx>
#include <AIS_Circle.hxx>
#include <AIS_DiameterDimension.hxx>
#include <AIS_DisplayMode.hxx>
#include <AIS_InteractiveContext.hxx>
#include <string.h>
#include <AIS_LengthDimension.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_MapOfInteractive.hxx>
#include <AIS_Point.hxx>
#include <AIS_RadiusDimension.hxx>
#include <AIS_Relation.hxx>
#include <AIS_Shape.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <Draw_Interpretor.hxx>
#include <Draw.hxx>
#include <Draw_Appli.hxx>
#include <Draw_Window.hxx>
#include <DBRep.hxx>
#include <ElSLib.hxx>
#include <GC_MakePlane.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Plane.hxx>
#include <gp_Circ.hxx>
#include <gp_Pln.hxx>
#include <IntAna_IntConicQuad.hxx>
#include <IntAna_Quadric.hxx>
#include <Precision.hxx>
#include <Select3D_Projector.hxx>
#include <StdSelect.hxx>
#include <string.h>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TopAbs.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
#include <V3d.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Point.hxx>
#include <AIS_DisplayMode.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <AIS_MapOfInteractive.hxx>
#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
#include <ViewerTest_EventManager.hxx>
#include <TopoDS_Solid.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <Draw_Window.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_DisplayMode.hxx>
#include <ElSLib.hxx>
#include <Geom_CartesianPoint.hxx>
#include <StdSelect.hxx>
extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
extern Handle(AIS_InteractiveContext)& TheAISContext ();
#include <Geom_Plane.hxx>
#include <gp_Pln.hxx>
#include <AIS_AngleDimension.hxx>
#include <TCollection_ExtendedString.hxx>
#include <GC_MakePlane.hxx>
#include <IntAna_IntConicQuad.hxx>
#include <Select3D_Projector.hxx>
#include <Precision.hxx>
#include <IntAna_Quadric.hxx>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#define VertexMask 0x01
#define EdgeMask 0x02
#define FaceMask 0x04
static Standard_Boolean ComputeIntersection(const gp_Lin& L,const gp_Pln& ThePl, gp_Pnt& TheInter)
{
static IntAna_Quadric TheQuad;
@@ -116,7 +109,9 @@ static Standard_Boolean ComputeIntersection(const gp_Lin& L,const gp_Pln& ThePl,
//purpose : calcul du point 3D correspondant a la position souris dans le plan de
// la vue...
//=======================================================================
static gp_Pnt Get3DPointAtMousePosition(){
static gp_Pnt Get3DPointAtMousePosition ()
{
Handle(V3d_View) aview = ViewerTest::CurrentView();
static Select3D_Projector prj;
prj.SetView(aview);
@@ -138,15 +133,14 @@ static gp_Pnt Get3DPointAtMousePosition(){
return P;
}
//=======================================================================
//function : ComputeNewPlaneForDim
//purpose :
//=======================================================================
static void ComputeNewPlaneForDim(const Handle(AIS_Relation)& R,
gp_Pln& ,
gp_Pnt& )
static void ComputeNewPlaneForDim (const Handle(AIS_Relation)& R,
gp_Pln& ,
gp_Pnt&)
{
// 0 COMPOUND,
// 1 COMPSOLID,
@@ -195,15 +189,244 @@ static void ComputeNewPlaneForDim(const Handle(AIS_Relation)& R,
*/
}
//=======================================================================
//function : VDimBuilder
//purpose : Command for updated dimenasions: angle, length, radius, diameter
//draw args : vdim -{angle|length|radius|diameter} -name={Dim_Name}
// shape1 [shape2 [shape3]] [-text={2d|3d} -plane={xoy|yoz|zox}]
//=======================================================================
static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, const char** theArgs)
{
if (theArgsNb < 2)
{
theDi << theArgs[0] << ": command argument is required. Type help for more information.\n";
return 1;
}
// Parse parameters
TCollection_AsciiString aDimType(theArgs[1]);
AIS_KindOfDimension aKindOfDimension;
if (aDimType == "-length")
{
aKindOfDimension = AIS_KOD_LENGTH;
}
else if (aDimType == "-angle")
{
aKindOfDimension = AIS_KOD_PLANEANGLE;
}
else if (aDimType == "-radius")
{
aKindOfDimension = AIS_KOD_RADIUS;
}
else if (aDimType == "-diameter" || aDimType == "-diam")
{
aKindOfDimension = AIS_KOD_DIAMETER;
}
else
{
theDi << theArgs[0] << ": wrong type of dimension. Type help for more information.\n";
return 1;
}
NCollection_List<Handle(AIS_InteractiveObject)> aShapes;
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect;
Standard_Boolean isPlaneCustom = Standard_False;
TCollection_AsciiString aName;
gp_Pln aWorkingPlane;
for (Standard_Integer anIt = 2; anIt < theArgsNb; ++anIt)
{
TCollection_AsciiString aParam (theArgs[anIt]);
if (aParam.Search("-text") == 1)
{
anAspect->MakeText3d(aParam.Search("3d") != -1 ? Standard_True : Standard_False);
}
else if (aParam.Search("-name") == 1)
{
Standard_Integer aParamNameEnd = aParam.FirstLocationInSet("=",1, aParam.Length());
if (aParamNameEnd == 0)
{
theDi << theArgs[0] << ": no name for dimension.\n";
return 1;
}
aName = aParam.Split(aParamNameEnd);
}
else if (aParam.Search("-plane") == 1)
{
isPlaneCustom = Standard_True;
if (aParam.Search("xoy") != -1)
aWorkingPlane = gp_Pln (gp_Ax3(gp::XOY()));
else if (aParam.Search("zox") != -1)
aWorkingPlane = gp_Pln (gp_Ax3(gp::ZOX()));
else if (aParam.Search("yoz") != -1)
aWorkingPlane = gp_Pln (gp_Ax3(gp::YOZ()));
else
{
theDi << theArgs[0] << ": wrong plane.\n";
return 1;
}
}
else if (aParam.Search("-") != 1) // Shape
{
if (!GetMapOfAIS().IsBound2 (aParam))
{
theDi << theArgs[0] << ": wrong name of shape. May be here is a wrong parameter.\n";
return 1;
}
Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (aParam));
if (aShape.IsNull())
return 1;
aShapes.Append (aShape);
}
}
// Build dimension
Handle(AIS_Dimension) aDim;
switch (aKindOfDimension)
{
case AIS_KOD_LENGTH:
{
if (!isPlaneCustom)
{
theDi << theArgs[0] << ": can build dimension without working plane.\n";
return 1;
}
if (aShapes.Extent() == 1)
{
if (aShapes.First()->Type() == AIS_KOI_Shape
&& (Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape().ShapeType() != TopAbs_EDGE)
{
theDi << theArgs[0] << ": wrong shape type.\n";
return 1;
}
aDim = new AIS_LengthDimension (TopoDS::Edge ((Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape()), aWorkingPlane);
}
else if (aShapes.Extent() == 2)
{
if (aShapes.First()->Type() == AIS_KOI_Shape && aShapes.Last()->Type() == AIS_KOI_Shape)
aDim = new AIS_LengthDimension ((Handle(AIS_Shape)::DownCast(aShapes.First ()))->Shape(),
(Handle(AIS_Shape)::DownCast(aShapes.Last ()))->Shape(),
aWorkingPlane);
else// AIS_Point
{
Handle(AIS_Point) aPoint1 = Handle(AIS_Point)::DownCast(aShapes.First ());
Handle(AIS_Point) aPoint2 = Handle(AIS_Point)::DownCast(aShapes.Last ());
aDim = new AIS_LengthDimension (aPoint1->Component()->Pnt(),
aPoint2->Component()->Pnt(),
aWorkingPlane);
}
}
else
{
theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n";
return 1;
}
}
break;
case AIS_KOD_PLANEANGLE:
{
if (aShapes.Extent() == 1 && aShapes.First()->Type()==AIS_KOI_Shape)
{
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(aShapes.First());
if (aShape->Shape().ShapeType() == TopAbs_FACE)
aDim = new AIS_AngleDimension (TopoDS::Face(aShape->Shape()));
}
if (aShapes.Extent() == 2)
{
Handle(AIS_Shape) aShape1 = Handle(AIS_Shape)::DownCast(aShapes.First());
Handle(AIS_Shape) aShape2 = Handle(AIS_Shape)::DownCast(aShapes.Last());
if (!aShape1.IsNull() && !aShape2.IsNull()
&& aShape1->Shape().ShapeType() == TopAbs_EDGE
&& aShape2->Shape().ShapeType() == TopAbs_EDGE)
aDim = new AIS_AngleDimension (TopoDS::Edge(aShape1->Shape()),TopoDS::Edge(aShape2->Shape()));
else
{
theDi << theArgs[0] << ": wrong shapes for angle dimension.\n";
return 1;
}
}
else if (aShapes.Extent() == 3)
{
gp_Pnt aP1, aP2, aP3;
Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast (aShapes.First());
if (aPoint.IsNull())
return 1;
aP1 = aPoint->Component()->Pnt();
aShapes.RemoveFirst();
aPoint = Handle(AIS_Point)::DownCast (aShapes.First());
if (aPoint.IsNull())
return 1;
aP2 = aPoint->Component()->Pnt();
aShapes.RemoveFirst();
aPoint = Handle(AIS_Point)::DownCast (aShapes.First());
if (aPoint.IsNull())
return 1;
aP3 = aPoint->Component()->Pnt();
aDim = new AIS_AngleDimension (aP1, aP2, aP3);
}
else
{
theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n";
return 1;
}
}
break;
case AIS_KOD_RADIUS: // radius of the circle
{
if (aShapes.Extent() == 1)
{
Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First());
gp_Circ aCircle = aShape->Circle()->Circ();
aDim = new AIS_RadiusDimension (aCircle);
}
else
{
theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n";
return 1;
}
}
break;
case AIS_KOD_DIAMETER:
{
if (aShapes.Extent() == 1)
{
Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First());
gp_Circ aCircle = aShape->Circle()->Circ();
aDim = new AIS_DiameterDimension (aCircle);
}
else
{
theDi << theArgs[0] << ": wrong number of shapes to build dimension.\n";
return 1;
}
}
break;
default:
{
theDi << theArgs[0] << ": wrong type of dimension. Type help for more information.\n";
return 1;
}
}
aDim->SetDimensionAspect (anAspect);
if (GetMapOfAIS().IsBound2(aName))
{
theDi << theArgs[0] << ": shape with name " << aName.ToCString ()<< " already exists. It will be replaced\n";
Handle(AIS_InteractiveObject) anObj =
Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(aName));
TheAISContext()->Remove(anObj, Standard_False);
GetMapOfAIS().UnBind2(aName);
}
GetMapOfAIS().Bind (aDim,aName);
return 0;
}
//=======================================================================
//function : VAngleDimBuilder
//purpose :
//=======================================================================
static int VAngleDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
Standard_Integer myCurrentIndex;
if (argc!=2) {di<<" vangledim error."<<"\n";return 1;}
TheAISContext()->CloseAllContexts();
TheAISContext()->OpenLocalContext();
@@ -258,7 +481,7 @@ static int VAngleDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const c
TheAISContext()->CloseLocalContext(myCurrentIndex);
// Construction de l'AIS dimension
Handle (AIS_AngleDimension) myAISDim= new AIS_AngleDimension (TopoDS::Edge(ShapeA) ,TopoDS::Edge(ShapeB) ,theGeomPlane ,M_PI/2.0 ,TheMessage_Str );
Handle (AIS_AngleDimension) myAISDim= new AIS_AngleDimension (TopoDS::Edge(ShapeA) ,TopoDS::Edge(ShapeB) ,theGeomPlane->Pln());
GetMapOfAIS().Bind (myAISDim,argv[1]);
TheAISContext()->Display(myAISDim );
@@ -276,11 +499,6 @@ else {
//purpose : Display the diameter dimension of a face or an edge.
//Draw arg : vdiameterdim Name
//==============================================================================
#include <AIS_DiameterDimension.hxx>
#include <TCollection_ExtendedString.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <gp_Circ.hxx>
static int VDiameterDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
@@ -326,7 +544,7 @@ static int VDiameterDimBuilder(Draw_Interpretor& di, Standard_Integer argc, cons
// Construction de L'AIS_AngleDimension.
TheAISContext()->CloseLocalContext(myCurrentIndex);
Handle (AIS_DiameterDimension) myDiamDim= new AIS_DiameterDimension(ShapeA ,theRadius ,TheMessage_Str );
Handle (AIS_DiameterDimension) myDiamDim= new AIS_DiameterDimension(ShapeA);
GetMapOfAIS().Bind (myDiamDim,argv[1]);
TheAISContext()->Display(myDiamDim );
@@ -977,7 +1195,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TheAISContext()->CloseLocalContext(myCurrentIndex);
// on construit l'AISLenghtDimension.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeA,EdgeB,theGeomPlane,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeA,EdgeB,theGeomPlane->Pln());
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
}
@@ -1003,7 +1221,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
TheAISContext()->CloseLocalContext(myCurrentIndex);
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeA,VertexB,theGeomPlane,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeA,VertexB,theGeomPlane->Pln());
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
@@ -1011,28 +1229,20 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
}
// Si ShapeB est une Face
else {
else
{
TopoDS_Face FaceB=TopoDS::Face(ShapeB);
BRepExtrema_ExtCF myDeltaEdgeFace (EdgeA,FaceB );
// On verifie que l'edge est bien parallele a la face.
if (!myDeltaEdgeFace.IsParallel() ) {di<<"vdistdim error: the edge isn't parallel to the face;can't compute the distance. "<<"\n";return 1; }
// On saisit la distance et on l'arrondit!
theDist=Round (sqrt (myDeltaEdgeFace.SquareDistance(1))*10. )/10.;
// Construction du texte.
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
// on construit l'AISLenghtDimension.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceB,EdgeA,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceB,EdgeA);
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
}
}
// ShapeA est un vertex
// ====================
if (ShapeA.ShapeType()==TopAbs_VERTEX ) {
@@ -1062,7 +1272,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
// on construit l'AISLenghtDimension.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeB,VertexA,theGeomPlane,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeB,VertexA,theGeomPlane->Pln());
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
@@ -1089,7 +1299,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
// on construit l'AISLenghtDimension.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexA,VertexB,theGeomPlane,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexA,VertexB,theGeomPlane->Pln());
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
@@ -1137,7 +1347,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
// on construit l'AISLenghtDimension.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexA,VertexAproj,theGeomPlane,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexA,VertexAproj,theGeomPlane->Pln());
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
@@ -1165,7 +1375,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
// on construit l'AISLenghtDimension.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceA,EdgeB,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceA,EdgeB);
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
@@ -1210,7 +1420,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
// on construit l'AISLenghtDimension mais en utilisant le constructeur Vertex Vertex.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexB,VertexBproj,theGeomPlane,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexB,VertexBproj,theGeomPlane->Pln());
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
@@ -1232,7 +1442,7 @@ static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const c
TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
// on construit l'AISLenghtDimension.
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceA,FaceB,theDist,TheMessage_Str );
Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceA,FaceB);
TheAISContext()->Display(myLenghtDim );
GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
@@ -1312,7 +1522,7 @@ static int VRadiusDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const
TheAISContext()->CloseLocalContext(myCurrentIndex);
// Construction de L'AIS_RadiusDimension.
Handle (AIS_RadiusDimension) myRadDim= new AIS_RadiusDimension(ShapeA ,theRadius ,TheMessage_Str );
Handle (AIS_RadiusDimension) myRadDim= new AIS_RadiusDimension(ShapeA);
GetMapOfAIS().Bind (myRadDim,argv[1]);
TheAISContext()->Display(myRadDim );
@@ -1345,8 +1555,7 @@ static int VRadiusDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const
TheAISContext()->CloseLocalContext(myCurrentIndex);
// Construction de L'AIS_RadiusDimension.
Handle (AIS_RadiusDimension) myRadDim= new AIS_RadiusDimension(ShapeA ,theRadius ,TheMessage_Str );
//Handle (AIS_MinRadiusDimension) myRadDim= new AIS_MinRadiusDimension(EdgeFromA ,theRadius ,TheMessage_Str );
Handle (AIS_RadiusDimension) myRadDim= new AIS_RadiusDimension(ShapeA);
GetMapOfAIS().Bind (myRadDim,argv[1]);
TheAISContext()->Display(myRadDim );
@@ -2154,6 +2363,7 @@ static int VMoveDim(Draw_Interpretor& di, Standard_Integer argc, const char** ar
return 0;
}
//=======================================================================
//function : RelationsCommands
//purpose :
@@ -2164,7 +2374,13 @@ void ViewerTest::RelationCommands(Draw_Interpretor& theCommands)
{
const char *group = "AISRelations";
theCommands.Add("vdim",
"vdim -{angle|length|radius|diameter} -name={Dim_Name}"
" shape1 [shape2 [shape3]] [-text={2d|3d} -plane={xoy|yoz|zox}]"
" -Build a angle, length, radius and diameter dimensions;"
" -Workis only with interactive objects",
__FILE__,VDimBuilder,group);
theCommands.Add("vangledim",
"vangledim Name:Selection in the viewer only ",
__FILE__,VAngleDimBuilder,group);

View File

@@ -3606,7 +3606,7 @@ static int VOverlayText (Draw_Interpretor& di, Standard_Integer argc, const char
di << " height - pixel height of the text (default=10.0)\n";
di << " font_name - name of font (default=courier)\n";
di << " text_color - R G B values of text color (default=255.0 255.0 255.0)\n";
di << " display_type = {normal/subtitle/decal/blend}, (default=normal)\n";
di << " display_type = {normal/subtitle/decal/blend/dimension}, (default=normal)\n";
di << " background_color- R G B values used for subtitle and decal text\n";
di << "(default=255.0 255.0 255.0)\n";
return 1;
@@ -3645,6 +3645,8 @@ static int VOverlayText (Draw_Interpretor& di, Standard_Integer argc, const char
aTextType = Aspect_TODT_DEKALE;
else if (aDispStr.IsEqual ("blend"))
aTextType = Aspect_TODT_BLEND;
else if (aDispStr.IsEqual ("dimension"))
aTextType = Aspect_TODT_DIMENSION;
// subtitle color
Quantity_Parameter aSubRed = 1.0;

Some files were not shown because too many files have changed in this diff Show More