+
+void GeomAPI_AISObject::createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Pln> thePlane)
+{
+ 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;
+ if (anAIS.IsNull()) {
+ aFixPrs = new AIS_FixRelation(aShape, aPlane);
+
+ setImpl(new Handle(AIS_InteractiveObject)(aFixPrs));
+ } else {
+ aFixPrs = Handle(AIS_FixRelation)::DownCast(anAIS);
+ if (!aFixPrs.IsNull()) {
+ aFixPrs->SetFirstShape(aShape);
+ aFixPrs->SetPlane(aPlane);
+ aFixPrs->Redisplay(Standard_True);
+ }
+ }
+ if (!aFixPrs.IsNull()) {
+ Bnd_Box aBox;
+ BRepBndLib::Add(aShape, aBox);
+ double aXmin, aXmax, aYmin, aYmax, aZmin, aZmax;
+ aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ gp_Pnt aXYZ1(aXmin, aXmax, aYmin);
+ gp_Pnt aXYZ2(aXmax, aYmax, aZmax);
+ double aDist = aXYZ1.Distance(aXYZ2);
+ if (aDist > Precision::Confusion()) {
+ aFixPrs->SetArrowSize(aDist/8.);
+ }
+ }
+}
+
+void GeomAPI_AISObject::redisplay()
+{
+ Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull()) {
+ Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+ aContext->Redisplay(anAIS, false);
+ }
+}
+
+