#include "MeasureGUI_DimensionCreateTool.h"
#include <GEOMBase.h>
#include <SalomeApp_Application.h>
#include <OCCViewer_ViewModel.h>
#include <OCCViewer_ViewManager.h>
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
#include <ElCLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Circ.hxx>
#include <gp_Sphere.hxx>
#include <gp_Cone.hxx>
#include <gp_Torus.hxx>
#include <gce_MakeDir.hxx>
#include <gce_MakePln.hxx>
#include <gce_MakeCirc.hxx>
#include <GC_MakePlane.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Plane.hxx>
#include <Geom_ElementarySurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <GeomLib.hxx>
#include <GeomLib_Tool.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TColgp_SequenceOfDir.hxx>
#include <V3d_View.hxx>
Classes | |
struct | PlaneAndSegment |
Typedefs | |
typedef NCollection_Sequence < PlaneAndSegment > | SeqOfPlnsAndSegments |
Functions | |
if (!GEOMBase::GetShape(theMeasuredObj.operator->(), aMeasuredShape)) | |
if (!GEOMBase::GetShape(GetMainShape(theMeasuredObj).get(), aMainShape)) | |
if (aPnt1.Distance(aPnt2)<=Precision::Confusion()) | |
gp_Vec | aFaceN1 (gp::Origin(), gp::Origin()) |
gp_Vec | aFaceN2 (gp::Origin(), gp::Origin()) |
gp_Vec | aFaceS1 (gp::Origin(), gp::Origin()) |
gp_Vec | aFaceS2 (gp::Origin(), gp::Origin()) |
TopTools_ListIteratorOfListOfShape | aFaceIt (aRelatedFaces) |
if (aFaceIt.More()) | |
PositionLength (aBnd, aFaceN1, aFaceN2, aFaceS1, aFaceS2, aPnt1, aPnt2, aPln) | |
Handle (AIS_LengthDimension) aDimension | |
aDimension | SetFlyout (Settings.DefaultFlyout) |
if (!aDimension->IsValid()) | |
if (!GEOMBase::GetShape(theMeasuredObj1.operator->(), aMeasuredShape1)) | |
if (!GEOMBase::GetShape(theMeasuredObj2.operator->(), aMeasuredShape2)) | |
if (!GEOMBase::GetShape(GetMainShape(theMeasuredObj1).get(), aMainShape)) | |
TopExp_Explorer | anEdgeExp (aMainShape, TopAbs_EDGE, TopAbs_EDGE) |
for (;anEdgeExp.More();anEdgeExp.Next()) | |
if (anEdgeExp.More()) | |
Handle(AIS_LengthDimension) MeasureGUI_DimensionCreateTool | if (!GEOMBase::GetShape(theEdge1.operator->(), aFirstSh)) |
if (!GEOMBase::GetShape(theEdge2.operator->(), aSecondSh)) | |
if (aFirstSh==aSecondSh) return NULL | |
BRepAdaptor_Curve | aCurve1 (aFirstEdge) |
BRepAdaptor_Curve | aCurve2 (aSecondEdge) |
GC_MakePlane | aMkPlane (aPnt1, aPnt2, aPnt3) |
Handle (Geom_Plane) aPlane | |
Handle (Geom_Circle) aCircle | |
gp_Vec | aFaceN (gp_Pnt(0.0, 0.0, 0.0), gp_Pnt(0.0, 0.0, 0.0)) |
switch (aMeasuredShape.ShapeType()) | |
if (aCircle.IsNull()) | |
if (Abs((aPmax-aPmin)-M_PI *2)<=Precision::PConfusion()) | |
else | if (Abs(aPmax-aPmin) > M_PI) |
PositionDiameter (aBnd, aFaceN, aCircle->Circ(), anAnchor, aPln) | |
Handle (AIS_DiameterDimension) aDimension | |
aDimension | SetFlyout (aFlyout) |
if (!GEOMBase::GetShape(theEdge1.get(), aShapeEdge1)) | |
if (!GEOMBase::GetShape(GetMainShape(theEdge1).get(), aShapeMain1)) | |
if (!GEOMBase::GetShape(theEdge2.get(), aShapeEdge2)) | |
if (!GEOMBase::GetShape(GetMainShape(theEdge2).get(), aShapeMain2)) | |
Handle (AIS_AngleDimension) aDimension | |
gp_Vec | aVec1 (aCenterPoint, aFirstPoint) |
gp_Vec | aVec2 (aCenterPoint, aSecondPoint) |
if (anAngle< 0.0) | |
Handle(AIS_AngleDimension) MeasureGUI_DimensionCreateTool | if (!GEOMBase::GetShape(thePoint1.operator->(), aFirstSh)) |
if (!GEOMBase::GetShape(thePoint2.operator->(), aSecondSh)) | |
if (!GEOMBase::GetShape(thePoint3.operator->(), aThirdSh)) | |
Variables | |
Handle(AIS_LengthDimension) MeasureGUI_DimensionCreateTool TopoDS_Shape | aMainShape |
TopoDS_Edge | anEdge = TopoDS::Edge( aMeasuredShape ) |
TopoDS_Vertex | aVertex1 = TopoDS::Vertex( aMeasuredShape1 ) |
TopoDS_Vertex | aVertex2 = TopoDS::Vertex( aMeasuredShape2 ) |
gp_Pnt | aPnt1 = BRep_Tool::Pnt( aVertex1 ) |
gp_Pnt | aPnt2 = BRep_Tool::Pnt( aVertex2 ) |
Bnd_Box | aBnd |
TopTools_IndexedDataMapOfShapeListOfShape | aRelationMap |
const TopTools_ListOfShape & | aRelatedFaces = aRelationMap.FindFromKey( anEdge ) |
gp_Pnt | aMiddlePnt = gp_Pnt( ( aPnt1.XYZ() + aPnt2.XYZ() ) * 0.5 ) |
gp_Pln | aPln |
return | aDimension |
Handle(AIS_LengthDimension) MeasureGUI_DimensionCreateTool TopoDS_Shape | aMeasuredShape2 |
TopoDS_Shape | aSecondSh |
TopoDS_Edge | aFirstEdge = TopoDS::Edge( aFirstSh ) |
TopoDS_Edge | aSecondEdge = TopoDS::Edge( aSecondSh ) |
gp_Pnt | aPnt3 = aCurve2.Value( 0.5 ) |
Standard_Real | aPmin = 0 |
Standard_Real | aPmax = 2 * M_PI |
else Standard_Real | anAnchor = aPmin + ( aPmax - aPmin ) * 0.5 |
gp_Pnt | aCircP = aCircle->Circ().Location() |
gp_Dir | aCircN = aCircle->Circ().Axis().Direction() |
gp_Dir | aCircX = gce_MakeDir( aPnt1, aPnt2 ) |
Standard_Real | aCircR = aCircle->Circ().Radius() |
Standard_Boolean | isReversed = ( ( aPln.Axis().Direction() ^ aCircX ) * aCircN ) < 0.0 |
gp_Circ | aRuledCirc = gce_MakeCirc( gp_Ax2( aCircP, isReversed ? -aCircN : aCircN, aCircX ), aCircR ) |
Standard_Real | aFlyout = aCircN.IsParallel( aPln.Axis().Direction(), Precision::Angular() ) ? 0.0 : Settings.DefaultFlyout |
Handle(AIS_AngleDimension) MeasureGUI_DimensionCreateTool TopoDS_Shape | aShapeMain1 |
TopoDS_Shape | aShapeEdge2 |
TopoDS_Shape | aShapeMain2 |
const gp_Pnt & | aFirstPoint = aDimension->FirstPoint() |
const gp_Pnt & | aSecondPoint = aDimension->SecondPoint() |
const gp_Pnt & | aCenterPoint = aDimension->CenterPoint() |
Standard_Real | anAngle = aVec2.AngleWithRef( aVec1, aDimension->GetPlane().Axis().Direction() ) |
TopoDS_Shape | aThirdSh |
TopoDS_Vertex | aFirstVertex = TopoDS::Vertex( aFirstSh ) |
TopoDS_Vertex | aSecondVertex = TopoDS::Vertex( aSecondSh ) |
TopoDS_Vertex | aThirdVertex = TopoDS::Vertex( aThirdSh ) |
typedef NCollection_Sequence<PlaneAndSegment> SeqOfPlnsAndSegments |
BRepAdaptor_Curve aCurve1 | ( | aFirstEdge | ) |
BRepAdaptor_Curve aCurve2 | ( | aSecondEdge | ) |
TopTools_ListIteratorOfListOfShape aFaceIt | ( | aRelatedFaces | ) |
gp_Vec aFaceN | ( | gp_Pnt(0.0, 0.0, 0.0) | , |
gp_Pnt(0.0, 0.0, 0.0) | |||
) |
gp_Vec aFaceN1 | ( | gp:: | Origin(), |
gp:: | Origin() | ||
) |
gp_Vec aFaceN2 | ( | gp:: | Origin(), |
gp:: | Origin() | ||
) |
gp_Vec aFaceS1 | ( | gp:: | Origin(), |
gp:: | Origin() | ||
) |
gp_Vec aFaceS2 | ( | gp:: | Origin(), |
gp:: | Origin() | ||
) |
TopExp_Explorer anEdgeExp | ( | aMainShape | , |
TopAbs_EDGE | , | ||
TopAbs_EDGE | |||
) |
gp_Vec aVec1 | ( | aCenterPoint | , |
aFirstPoint | |||
) |
gp_Vec aVec2 | ( | aCenterPoint | , |
aSecondPoint | |||
) |
for | ( | ;anEdgeExp. | More);anEdgeExp.Next( | ) |
References anEdgeExp(), and GEOM::Vertices.
Handle | ( | Geom_Plane | ) |
Handle | ( | Geom_Circle | ) |
Handle | ( | AIS_DiameterDimension | ) |
Handle | ( | AIS_AngleDimension | ) |
if | ( | !GEOMBase:: | GetShapetheMeasuredObj.operator->(), aMeasuredShape | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapeGetMainShape(theMeasuredObj).get(), aMainShape | ) |
References NULL.
if | ( | aPnt1. | DistanceaPnt2)<=Precision::Confusion( | ) |
References NULL.
if | ( | !aDimension-> | IsValid() | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapetheMeasuredObj1.operator->(), aMeasuredShape1 | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapetheMeasuredObj2.operator->(), aMeasuredShape2 | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapeGetMainShape(theMeasuredObj1).get(), aMainShape | ) |
References NULL.
if | ( | anEdgeExp. | More() | ) |
References aFaceIt(), aFaceN1(), aFaceN2(), aFaceS1(), aFaceS2(), anEdgeExp(), aRelationMap, and Handle().
Handle (AIS_LengthDimension) MeasureGUI_DimensionCreateTool if | ( | !GEOMBase:: | GetShapetheEdge1.operator->(), aFirstSh | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapetheEdge2.operator->(), aSecondSh | ) |
References NULL.
if | ( | aFirstSh | = =aSecondSh | ) |
if | ( | aCircle. | IsNull() | ) |
References NULL.
References aFaceN(), aPln, aPnt1, aPnt2, and PositionDiameter().
if | ( | !GEOMBase:: | GetShapetheEdge1.get(), aShapeEdge1 | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapeGetMainShape(theEdge1).get(), aShapeMain1 | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapetheEdge2.get(), aShapeEdge2 | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapeGetMainShape(theEdge2).get(), aShapeMain2 | ) |
References NULL.
if | ( | ) |
References aDimension.
Handle (AIS_AngleDimension) MeasureGUI_DimensionCreateTool if | ( | !GEOMBase:: | GetShapethePoint1.operator->(), aFirstSh | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapethePoint2.operator->(), aSecondSh | ) |
References NULL.
if | ( | !GEOMBase:: | GetShapethePoint3.operator->(), aThirdSh | ) |
References NULL.
aDimension SetFlyout | ( | Settings. | DefaultFlyout | ) |
aDimension SetFlyout | ( | aFlyout | ) |
Bnd_Box aBnd |
const gp_Pnt& aCenterPoint = aDimension->CenterPoint() |
gp_Dir aCircN = aCircle->Circ().Axis().Direction() |
gp_Pnt aCircP = aCircle->Circ().Location() |
Standard_Real aCircR = aCircle->Circ().Radius() |
return aDimension |
TopoDS_Edge aFirstEdge = TopoDS::Edge( aFirstSh ) |
const gp_Pnt& aFirstPoint = aDimension->FirstPoint() |
TopoDS_Vertex aFirstVertex = TopoDS::Vertex( aFirstSh ) |
Standard_Real aFlyout = aCircN.IsParallel( aPln.Axis().Direction(), Precision::Angular() ) ? 0.0 : Settings.DefaultFlyout |
TopoDS_Shape aMainShape |
Handle (AIS_LengthDimension) MeasureGUI_DimensionCreateTool TopoDS_Shape aMeasuredShape2 |
gp_Pnt aMiddlePnt = gp_Pnt( ( aPnt1.XYZ() + aPnt2.XYZ() ) * 0.5 ) |
Standard_Real anAngle = aVec2.AngleWithRef( aVec1, aDimension->GetPlane().Axis().Direction() ) |
TopoDS_Edge anEdge = TopoDS::Edge( aMeasuredShape ) |
gp_Pln aPln |
Standard_Real aPmax = 2 * M_PI |
Standard_Real aPmin = 0 |
gp_Pnt aPnt1 = BRep_Tool::Pnt( aVertex1 ) |
gp_Pnt aPnt2 = BRep_Tool::Pnt( aVertex2 ) |
gp_Pnt aPnt3 = aCurve2.Value( 0.5 ) |
const TopTools_ListOfShape& aRelatedFaces = aRelationMap.FindFromKey( anEdge ) |
TopTools_IndexedDataMapOfShapeListOfShape aRelationMap |
gp_Circ aRuledCirc = gce_MakeCirc( gp_Ax2( aCircP, isReversed ? -aCircN : aCircN, aCircX ), aCircR ) |
TopoDS_Edge aSecondEdge = TopoDS::Edge( aSecondSh ) |
const gp_Pnt& aSecondPoint = aDimension->SecondPoint() |
TopoDS_Shape aSecondSh |
TopoDS_Vertex aSecondVertex = TopoDS::Vertex( aSecondSh ) |
TopoDS_Shape aShapeEdge2 |
Handle (AIS_AngleDimension) MeasureGUI_DimensionCreateTool TopoDS_Shape aShapeMain1 |
TopoDS_Shape aShapeMain2 |
TopoDS_Shape aThirdSh |
TopoDS_Vertex aThirdVertex = TopoDS::Vertex( aThirdSh ) |
TopoDS_Vertex aVertex1 = TopoDS::Vertex( aMeasuredShape1 ) |
TopoDS_Vertex aVertex2 = TopoDS::Vertex( aMeasuredShape2 ) |