- }*/
- if (aGShape.get() != NULL) {
- // get plane parameters
- if (!aPlane.get()) {
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aGShape));
- aPlane = aFace->getPlane();
- }
- if (!aPlane.get())
- return;
- std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
- gp_XYZ aXYZ = aDir->impl<gp_Dir>().XYZ();
- double aTwist = 0.0;
-
- // orienting projection is not needed: it is done in GeomAlgoAPI_FaceBuilder::plane
- /*if (aGShape->impl<TopoDS_Shape>().Orientation() == TopAbs_REVERSED) {
- aXYZ.Reverse();
- }*/
-
- // Rotate view if the sketcher plane is selected only from preview planes
- // Preview planes are created only if there is no any shape
- bool aRotate = Config_PropManager::boolean(SKETCH_TAB_NAME, "rotate_to_plane");
- if (aRotate) {
- myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist);
- }
- QString aSizeOfViewStr = mySizeOfView->text();
- if (!aSizeOfViewStr.isEmpty()) {
- bool isOk;
- double aSizeOfView = aSizeOfViewStr.toDouble(&isOk);
- if (isOk && aSizeOfView > 0) {
- Handle(V3d_View) aView3d = myWorkshop->viewer()->activeView();
- if (!aView3d.IsNull()) {
- Bnd_Box aBndBox;
- double aHalfSize = aSizeOfView/2.0;
- aBndBox.Update(-aHalfSize, -aHalfSize, -aHalfSize, aHalfSize, aHalfSize, aHalfSize);
- aView3d->FitAll(aBndBox, 0.01, false);
- }
- }
- }
- PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
- if (aModule)
- aModule->onViewTransformed();