void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
{
+ ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
+ if (myIsDragging)
+ aWorkshop->viewer()->enableDrawMode(myPreviousDrawModeEnabled);
+
bool aWasDragging = myIsDragging;
myIsDragging = false;
if (!myIsMouseOverViewProcessed) {
return;
}
- ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
ModuleBase_IViewer* aViewer = aWorkshop->viewer();
//if (!aViewer->canDragByMouse())
// return;
- ModuleBase_OperationFeature* aOp = dynamic_cast<ModuleBase_OperationFeature*>(getCurrentOperation());
+ ModuleBase_OperationFeature* aOp =
+ dynamic_cast<ModuleBase_OperationFeature*>(getCurrentOperation());
if (aOp) {
bool aStartNoDragOperation = !aViewer->canDragByMouse() && aOp->isEditOperation();
if (aStartNoDragOperation || myNoDragMoving) {
}
}
- aWorkshop->viewer()->enableDrawMode(myPreviousDrawModeEnabled);
ModuleBase_ModelWidget* anActiveWidget = getActiveWidget();
PartSet_MouseProcessor* aProcessor = dynamic_cast<PartSet_MouseProcessor*>(anActiveWidget);
if (isSketchOperation(aCurrentOperation))
return; // No edit operation activated
+#ifdef DRAGGING_DEBUG
+ QTime t;
+ t.start();
+#endif
+
Handle(V3d_View) aView = theWnd->v3dView();
gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
Point aMousePnt;
aDisplayer->enableUpdateViewer(isEnableUpdateViewer);
aDisplayer->updateViewer();
+#ifdef DRAGGING_DEBUG
+ cout << "Mouse move processing " << t.elapsed() << endl;
+#endif
+
myDragDone = true;
myCurrentPoint = aMousePnt;
}
if (!aFOperation)
return;
+ SketcherPrs_Tools::setPixelRatio(ModuleBase_Tools::currentPixelRatio());
+
myModule->onViewTransformed();
// Display all sketcher sub-Objects
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();
}
}
-bool PartSet_SketcherMgr::sketchSelectionFilter(const XGUI_SelectionFilterType theFilterType)
+bool PartSet_SketcherMgr::sketchSelectionFilter(const ModuleBase_SelectionFilterType theFilterType)
{
return mySelectionFilterTypes.find(theFilterType) != mySelectionFilterTypes.end();
}
-void PartSet_SketcherMgr::registerSelectionFilter(const XGUI_SelectionFilterType theFilterType,
- const Handle(SelectMgr_Filter)& theFilter)
+void PartSet_SketcherMgr::registerSelectionFilter(
+ const ModuleBase_SelectionFilterType theFilterType, const Handle(SelectMgr_Filter)& theFilter)
{
mySelectionFilterTypes.insert(theFilterType);
myModule->registerSelectionFilter(theFilterType, theFilter);
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);
+}