-// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
+#include <Standard_Version.hxx>
+
+#if OCC_VERSION_HEX > 0x070400
+#include <PrsDim_TypeOfAngleArrowVisibility.hxx>
+#endif
+
/// Update variable aspect parameters (depending on viewer scale)
/// \param theDimAspect an aspect to be changed
/// \param theDimValue an arrow value
// #define COMPILATION_CORRECTION
//#endif
-IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension);
+IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, PrsDim_AngleDimension);
SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint,
- SketchPlugin_Sketch* theSketcher)
-: AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), myConstraint(theConstraint),
+ SketchPlugin_Sketch* theSketcher)
+: PrsDim_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)),
+ myConstraint(theConstraint),
mySketcher(theSketcher),
- myFirstPoint(gp_Pnt(0,0,0)), myCenterPoint(gp_Pnt(1,0,0)), mySecondPoint(gp_Pnt(0,1,0)),
- myValue(90., false, ""), myFlyOutPoint(0, 0.5, 0)
+ myFirstPoint(gp_Pnt(0,0,0)),
+ mySecondPoint(gp_Pnt(0,1,0)),
+ myCenterPoint(gp_Pnt(1, 0, 0)),
+ myFlyOutPoint(0, 0.5, 0),
+ myValue(90., false, "")
{
myAspect = new Prs3d_DimensionAspect();
myAspect->MakeArrows3d(false);
gp_Pnt2d aCenterPoint = anAng->center()->impl<gp_Pnt2d>();
gp_Pnt2d aFirstPoint, aSecondPoint;
- if (anAng->angleRadian() > 0.0) {
- aFirstPoint = anAng->firstPoint()->impl<gp_Pnt2d>();
- aSecondPoint = anAng->secondPoint()->impl<gp_Pnt2d>();
+ try {
+ if (anAng->angleRadian() > 0.0) {
+ aFirstPoint = anAng->firstPoint()->impl<gp_Pnt2d>();
+ aSecondPoint = anAng->secondPoint()->impl<gp_Pnt2d>();
+ }
+ else {
+ aFirstPoint = anAng->secondPoint()->impl<gp_Pnt2d>();
+ aSecondPoint = anAng->firstPoint()->impl<gp_Pnt2d>();
+ }
}
- else {
- aFirstPoint = anAng->secondPoint()->impl<gp_Pnt2d>();
- aSecondPoint = anAng->firstPoint()->impl<gp_Pnt2d>();
+ catch (...) {
+ // one of angle lines is degenerated, the presentation cannot be shown
+ return false;
}
if (aData->integer(SketchPlugin_ConstraintAngle::TYPE_ID())->value() ==
double aDist = -1;
#ifndef COMPILATION_CORRECTION
+#if OCC_VERSION_HEX > 0x070400
+ SetArrowsVisibility(PrsDim_TypeOfAngleArrowVisibility_Both);
+#else
SetArrowsVisibility(AIS_TOAV_Both);
+#endif
#endif
SetMeasuredGeometry(myFirstPoint, myCenterPoint, mySecondPoint);
#ifndef COMPILATION_CORRECTION
bool isReversedPlanes = isAnglePlaneReversedToSketchPlane();
+#if OCC_VERSION_HEX > 0x070400
+ SetType(!isReversedPlanes ? PrsDim_TypeOfAngle_Exterior : PrsDim_TypeOfAngle_Interior);
+#else
SetType(!isReversedPlanes ? AIS_TOA_Exterior : AIS_TOA_Interior);
+#endif
#endif
if (aDist < 0) /// it was not calculated yet
aDist = calculateDistanceToFlyoutPoint();
updateArrows(myAspect, anAngleCircleLength, aTextSize, aLocationType);
- AIS_AngleDimension::Compute(thePresentationManager, thePresentation, theMode);
+ PrsDim_AngleDimension::Compute(thePresentationManager, thePresentation, theMode);
if (!aReadyToDisplay)
SketcherPrs_Tools::sendEmptyPresentationError(myConstraint,
}
}
SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize()/5.);
- AIS_AngleDimension::ComputeSelection(aSelection, aMode);
+ PrsDim_AngleDimension::ComputeSelection(aSelection, aMode);
}
bool SketcherPrs_Angle::isAnglePlaneReversedToSketchPlane()