-// Copyright (C) 2014-2017 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
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <GeomAPI_AISObject.h>
#include <AIS_InteractiveObject.hxx>
#include <AIS_InteractiveContext.hxx>
-#include <AIS_LengthDimension.hxx>
-#include <AIS_ParallelRelation.hxx>
-#include <AIS_PerpendicularRelation.hxx>
-#include <AIS_RadiusDimension.hxx>
#include <AIS_Shape.hxx>
-#include <AIS_FixRelation.hxx>
#include <Prs3d_PointAspect.hxx>
+#include <PrsDim_Dimension.hxx>
+#include <PrsDim_LengthDimension.hxx>
+#include <PrsDim_ParallelRelation.hxx>
+#include <PrsDim_PerpendicularRelation.hxx>
+#include <PrsDim_RadiusDimension.hxx>
+#include <PrsDim_FixRelation.hxx>
#include <Graphic3d_AspectLine3d.hxx>
aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
else
aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
+ aDrawer->SetIsoOnPlane(false);
setImpl(new Handle(AIS_InteractiveObject)(aShape));
}
}
if (!anAIS.IsNull()) {
Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
if (aShapeAIS) {
- std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
+ aResult.reset(new GeomAPI_Shape);
aResult->setImpl(new TopoDS_Shape(aShapeAIS->Shape()));
- return aResult;
}
}
- return std::shared_ptr<GeomAPI_Shape>();
+ return aResult;
}
void GeomAPI_AISObject::createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
if (anAIS.IsNull()) {
- Handle(AIS_LengthDimension) aDimAIS = new AIS_LengthDimension(theStartPoint->impl<gp_Pnt>(),
- theEndPoint->impl<gp_Pnt>(),
- thePlane->impl<gp_Pln>());
+ Handle(PrsDim_LengthDimension) aDimAIS =
+ new PrsDim_LengthDimension(theStartPoint->impl<gp_Pnt>(),
+ theEndPoint->impl<gp_Pnt>(),
+ thePlane->impl<gp_Pln>());
aDimAIS->SetCustomValue(theDistance);
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
setImpl(new Handle(AIS_InteractiveObject)(aDimAIS));
} else {
// update presentation
- Handle(AIS_LengthDimension) aDimAIS = Handle(AIS_LengthDimension)::DownCast(anAIS);
+ Handle(PrsDim_LengthDimension) aDimAIS = Handle(PrsDim_LengthDimension)::DownCast(anAIS);
if (!aDimAIS.IsNull()) {
aDimAIS->SetMeasuredGeometry(theStartPoint->impl<gp_Pnt>(), theEndPoint->impl<gp_Pnt>(),
thePlane->impl<gp_Pln>());
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull()) {
- Handle(AIS_LengthDimension) aDimAIS = Handle(AIS_LengthDimension)::DownCast(anAIS);
+ Handle(PrsDim_LengthDimension) aDimAIS = Handle(PrsDim_LengthDimension)::DownCast(anAIS);
if (!aDimAIS.IsNull()) {
anEmpty = !aDimAIS->IsValid();
}
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
if (anAIS.IsNull()) {
- Handle(AIS_RadiusDimension) aDimAIS = new AIS_RadiusDimension(theCircle->impl<gp_Circ>(),
- anAnchor->impl<gp_Pnt>());
+ Handle(PrsDim_RadiusDimension) aDimAIS = new PrsDim_RadiusDimension(theCircle->impl<gp_Circ>(),
+ anAnchor->impl<gp_Pnt>());
aDimAIS->SetCustomValue(theRadius);
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
setImpl(new Handle(AIS_InteractiveObject)(aDimAIS));
} else {
// update presentation
- Handle(AIS_RadiusDimension) aDimAIS = Handle(AIS_RadiusDimension)::DownCast(anAIS);
+ Handle(PrsDim_RadiusDimension) aDimAIS = Handle(PrsDim_RadiusDimension)::DownCast(anAIS);
if (!aDimAIS.IsNull()) {
aDimAIS->SetMeasuredGeometry(theCircle->impl<gp_Circ>(), anAnchor->impl<gp_Pnt>());
aDimAIS->SetCustomValue(theRadius);
Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
if (anAIS.IsNull()) {
- Handle(AIS_ParallelRelation) aParallel = new AIS_ParallelRelation(
+ Handle(PrsDim_ParallelRelation) aParallel = new PrsDim_ParallelRelation(
theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
if (theFlyoutPoint)
aParallel->SetPosition(theFlyoutPoint->impl<gp_Pnt>());
setImpl(new Handle(AIS_InteractiveObject)(aParallel));
} else {
- Handle(AIS_ParallelRelation) aParallel = Handle(AIS_ParallelRelation)::DownCast(anAIS);
+ Handle(PrsDim_ParallelRelation) aParallel = Handle(PrsDim_ParallelRelation)::DownCast(anAIS);
if (!aParallel.IsNull()) {
aParallel->SetFirstShape(theLine1->impl<TopoDS_Shape>());
aParallel->SetSecondShape(theLine2->impl<TopoDS_Shape>());
Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
if (anAIS.IsNull()) {
- Handle(AIS_PerpendicularRelation) aPerpendicular = new AIS_PerpendicularRelation(
+ Handle(PrsDim_PerpendicularRelation) aPerpendicular = new PrsDim_PerpendicularRelation(
theLine1->impl<TopoDS_Shape>(), theLine2->impl<TopoDS_Shape>(), aPlane);
setImpl(new Handle(AIS_InteractiveObject)(aPerpendicular));
} else {
- Handle(AIS_PerpendicularRelation) aPerpendicular = Handle(AIS_PerpendicularRelation)::DownCast(
- anAIS);
+ Handle(PrsDim_PerpendicularRelation) aPerpendicular =
+ Handle(PrsDim_PerpendicularRelation)::DownCast(anAIS);
if (!aPerpendicular.IsNull()) {
aPerpendicular->SetFirstShape(theLine1->impl<TopoDS_Shape>());
aPerpendicular->SetSecondShape(theLine2->impl<TopoDS_Shape>());
Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
- Handle(AIS_FixRelation) aFixPrs;
+ Handle(PrsDim_FixRelation) aFixPrs;
if (anAIS.IsNull()) {
- aFixPrs = new AIS_FixRelation(aShape, aPlane);
+ aFixPrs = new PrsDim_FixRelation(aShape, aPlane);
setImpl(new Handle(AIS_InteractiveObject)(aFixPrs));
} else {
- aFixPrs = Handle(AIS_FixRelation)::DownCast(anAIS);
+ aFixPrs = Handle(PrsDim_FixRelation)::DownCast(anAIS);
if (!aFixPrs.IsNull()) {
aFixPrs->SetFirstShape(aShape);
aFixPrs->SetPlane(aPlane);
if (anAIS.IsNull())
return;
Quantity_Color aColor((Quantity_NameOfColor) theColor);
- Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
+ Handle(PrsDim_Dimension) aDimAIS = Handle(PrsDim_Dimension)::DownCast(anAIS);
if (!aDimAIS.IsNull()) {
aDimAIS->DimensionAspect()->SetCommonColor(aColor);
}
if (aColor.IsEqual(aCurrentColor))
return false;
- Handle(AIS_Dimension) aDimAIS = Handle(AIS_Dimension)::DownCast(anAIS);
+ Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+ Handle(PrsDim_Dimension) aDimAIS = Handle(PrsDim_Dimension)::DownCast(anAIS);
if (!aDimAIS.IsNull()) {
aDimAIS->DimensionAspect()->SetCommonColor(aColor);
+ if (!aContext.IsNull())
+ aContext->Redisplay(aDimAIS, false);
+ }
+ else {
+ if (!aContext.IsNull())
+ aContext->SetColor(anAIS, aColor, false);
+ else
+ anAIS->SetColor(aColor);
}
- Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
- if (!aContext.IsNull())
- aContext->SetColor(anAIS, aColor, false);
- else
- anAIS->SetColor(aColor);
return true;
}
if (anAIS.IsNull())
return;
- Quantity_Color aColor = anAIS->Color();
+ Quantity_Color aColor;
+ anAIS->Color(aColor);
theR = (int)(aColor.Red()*255.);
theG = (int)(aColor.Green()*255.);
theB = (int)(aColor.Blue()*255.);
if (fabs(aCoefficient-theDeflection) > Precision::Confusion()) {
isModified = true;
anAISShape->SetOwnDeviationCoefficient(theDeflection);
+ Handle(Prs3d_Drawer) aDrawer = anAISShape->DynamicHilightAttributes();
+ if (!aDrawer.IsNull()) {
+ aDrawer->SetDeviationCoefficient(theDeflection);
+ }
// redisplay is necessary here to update presentation in all modes
// Standard True flag. Displayer uses Standard False flag. If it will be changed in
// displayer, redisplay here will not be necessary. But performance should be checked.