#define ModuleBase_IViewer_H
#include "ModuleBase.h"
+
#include <QObject>
#include <QMap>
#include <AIS_InteractiveContext.hxx>
myExternalPointsMgr = new PartSet_ExternalPointsMgr(myModule->workshop(), myCurrentSketch);
workshop()->viewer()->set2dMode(true);
+
+ PartSet_Fitter* aFitter = new PartSet_Fitter(myCurrentSketch);
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ aWorkshop->viewer()->setFitter(aFitter);
}
void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation)
{
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ PartSet_Fitter* aFitter = (PartSet_Fitter*)aWorkshop->viewer()->currentFitter();
+ aWorkshop->viewer()->unsetFitter();
+ delete aFitter;
+
myIsMouseOverWindow = false;
myIsConstraintsShown[PartSet_Tools::Geometrical] = true;
myIsConstraintsShown[PartSet_Tools::Dimensional] = true;
}
onShowPoints(false);
- XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myModule->workshop());
-
DataPtr aData = myCurrentSketch->data();
if (!aData->isValid()) {
XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
if (aToUpdate)
aViewer->update();
}
+
+
+void PartSet_Fitter::fitScene(Handle(V3d_View) theView)
+{
+ Bnd_Box aBndBox;
+ int aNumberOfSubs = mySketch->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
+ FeaturePtr aFeature = mySketch->subFeature(i);
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ ResultPtr aRes;
+ double aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
+ aRes = (*aIt);
+ if (aRes->isDisplayed()) {
+ GeomShapePtr aShape = aRes->shape();
+ aShape->computeSize(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ Bnd_Box aBox;
+ aBox.Update(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ aBndBox.Add(aBox);
+ }
+ }
+ }
+ theView->FitAll(aBndBox, 0.01);
+}
#include <GeomAPI_Pln.h>
+#ifdef HAVE_SALOME
+ #include <OCCViewer_ViewModel.h>
+#else
+ #include <AppElements_Viewer.h>
+#endif
+
+
#include <SelectMgr_IndexedMapOfOwner.hxx>
#include <SelectMgr_ListOfFilter.hxx>
class ModuleBase_Operation;
class XGUI_OperationMgr;
class XGUI_Workshop;
+class XGUI_Displayer;
class PartSet_ExternalPointsMgr;
class AIS_InteractiveObject;
class QMouseEvent;
+
+#ifdef HAVE_SALOME
+class PartSet_Fitter : public OCCViewer_Fitter
+#else
+class PartSet_Fitter : public AppElements_Fitter
+#endif
+{
+public:
+ PartSet_Fitter(CompositeFeaturePtr theCurrentSketch):
+ mySketch(theCurrentSketch) {}
+
+ /// A method which has top be reimplemented to provide alterantive implementation FitAll command
+ /// \param theView - a view which has to be fit
+ virtual void fitScene(Handle(V3d_View) theView);
+
+private:
+ CompositeFeaturePtr mySketch;
+};
+
+
+
/**
* \ingroup Modules
* A class for management of sketch operations
// aView3d->DepthFitAll();
// }
//#endif
-//}
\ No newline at end of file
+//}
+
+
+#ifdef HAVE_SALOME
+void XGUI_ViewerProxy::setFitter(OCCViewer_Fitter* theFitter)
+{
+ myWorkshop->salomeConnector()->viewer()->setFitter(theFitter);
+}
+
+OCCViewer_Fitter* XGUI_ViewerProxy::currentFitter() const
+{
+ return myWorkshop->salomeConnector()->viewer()->currentFitter();
+}
+#else
+void XGUI_ViewerProxy::setFitter(AppElements_Fitter* theFitter)
+{
+ myWorkshop->mainWindow()->viewer()->setFitter(theFitter);
+}
+
+AppElements_Fitter* XGUI_ViewerProxy::currentFitter() const
+{
+ return myWorkshop->mainWindow()->viewer()->currentFitter();
+}
+#endif
+
+void XGUI_ViewerProxy::unsetFitter()
+{
+#ifdef HAVE_SALOME
+ myWorkshop->salomeConnector()->viewer()->unsetFitter();
+#else
+ myWorkshop->mainWindow()->viewer()->unsetFitter();
+#endif
+}
#include <AIS_Trihedron.hxx>
#include <AIS_ListOfInteractive.hxx>
-#ifndef HAVE_SALOME
+#ifdef HAVE_SALOME
+#include <OCCViewer_ViewModel.h>
+#else
+ #include <AppElements_Viewer.h>
#include <AppElements_ViewWindow.h>
#endif
+
+
class XGUI_Workshop;
/**
* \ingroup GUI
// Fit all along Z (perpendicular to display)
//virtual void Zfitall();
+#ifdef HAVE_SALOME
+ void setFitter(OCCViewer_Fitter* theFitter);
+ OCCViewer_Fitter* currentFitter() const;
+#else
+ void setFitter(AppElements_Fitter* theFitter);
+ AppElements_Fitter* currentFitter() const;
+#endif
+
+ void unsetFitter();
+
signals:
/// Emits by mouse entering the view port
void enterViewPort();