From d4229cf0e4819ef684866a59e18a82e57f0092b0 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 3 Nov 2016 16:45:24 +0300 Subject: [PATCH] Issue #1834: Fix length of lines --- src/PartSet/PartSet_CustomPrs.cpp | 11 ++- src/PartSet/PartSet_ExternalObjectsMgr.cpp | 3 +- src/PartSet/PartSet_FilterInfinite.cpp | 12 ++- src/PartSet/PartSet_FilterInfinite.h | 3 +- src/PartSet/PartSet_Filters.cpp | 10 ++- src/PartSet/PartSet_IconFactory.cpp | 3 +- src/PartSet/PartSet_MenuMgr.cpp | 9 ++- src/PartSet/PartSet_Module.cpp | 57 +++++++------ src/PartSet/PartSet_Module.h | 6 +- src/PartSet/PartSet_MouseProcessor.h | 12 ++- src/PartSet/PartSet_OperationPrs.cpp | 35 +++++--- src/PartSet/PartSet_OperationPrs.h | 7 +- .../PartSet_OverconstraintListener.cpp | 18 +++-- src/PartSet/PartSet_ResultSketchPrs.cpp | 13 +-- src/PartSet/PartSet_ResultSketchPrs.h | 6 +- src/PartSet/PartSet_SketcherMgr.h | 12 ++- src/PartSet/PartSet_SketcherReetntrantMgr.cpp | 21 +++-- src/PartSet/PartSet_SketcherReetntrantMgr.h | 9 ++- src/PartSet/PartSet_Tools.cpp | 42 ++++++---- src/PartSet/PartSet_Tools.h | 9 ++- src/PartSet/PartSet_Validators.cpp | 79 ++++++++++++------- src/PartSet/PartSet_Validators.h | 42 ++++++---- src/PartSet/PartSet_WidgetFileSelector.cpp | 3 +- src/PartSet/PartSet_WidgetMultiSelector.cpp | 3 +- src/PartSet/PartSet_WidgetPoint2d.h | 6 +- src/PartSet/PartSet_WidgetPoint2dDistance.cpp | 11 ++- src/PartSet/PartSet_WidgetPoint2dDistance.h | 3 +- src/PartSet/PartSet_WidgetSketchCreator.cpp | 26 +++--- src/PartSet/PartSet_WidgetSketchCreator.h | 3 +- src/PartSet/PartSet_WidgetSketchLabel.cpp | 8 +- .../PartSet_WidgetSubShapeSelector.cpp | 3 +- 31 files changed, 313 insertions(+), 172 deletions(-) diff --git a/src/PartSet/PartSet_CustomPrs.cpp b/src/PartSet/PartSet_CustomPrs.cpp index 604e593c2..c313ef059 100755 --- a/src/PartSet/PartSet_CustomPrs.cpp +++ b/src/PartSet/PartSet_CustomPrs.cpp @@ -149,8 +149,9 @@ bool PartSet_CustomPrs::displayPresentation( return isModified; } -bool PartSet_CustomPrs::erasePresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, - const bool theUpdateViewer) +bool PartSet_CustomPrs::erasePresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag, + const bool theUpdateViewer) { bool isErased = false; XGUI_Workshop* aWorkshop = workshop(); @@ -159,7 +160,8 @@ bool PartSet_CustomPrs::erasePresentation(const ModuleBase_IModule::ModuleBase_C return isErased; } -void PartSet_CustomPrs::clearPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) +void PartSet_CustomPrs::clearPresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) { AISObjectPtr aPresentation = getPresentation(theFlag, false); if (aPresentation.get()) { @@ -218,7 +220,8 @@ void PartSet_CustomPrs::processEvent(const std::shared_ptr& theM myPresentationIsEmpty = true; /// store state to analize it after display/erase is finished } -void PartSet_CustomPrs::initPresentation(const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) +void PartSet_CustomPrs::initPresentation( + const ModuleBase_IModule::ModuleBase_CustomizeFlag& theFlag) { AISObjectPtr anOperationPrs = AISObjectPtr(new GeomAPI_AISObject()); Handle(PartSet_OperationPrs) anAISPrs = new PartSet_OperationPrs(myWorkshop); diff --git a/src/PartSet/PartSet_ExternalObjectsMgr.cpp b/src/PartSet/PartSet_ExternalObjectsMgr.cpp index 3128285f1..17ecdeda6 100755 --- a/src/PartSet/PartSet_ExternalObjectsMgr.cpp +++ b/src/PartSet/PartSet_ExternalObjectsMgr.cpp @@ -96,7 +96,8 @@ void PartSet_ExternalObjectsMgr::removeExternalObject(const ObjectPtr& theObject if (aFeature.get() != NULL) { QObjectPtrList anObjects; anObjects.append(aFeature); - // the external feature should be removed with all references, composite sketch feature will be ignored + // the external feature should be removed with all references, + // composite sketch feature will be ignored workshop(theWorkshop)->deleteFeatures(anObjects); } } diff --git a/src/PartSet/PartSet_FilterInfinite.cpp b/src/PartSet/PartSet_FilterInfinite.cpp index df38f4ceb..33e6cfd2f 100755 --- a/src/PartSet/PartSet_FilterInfinite.cpp +++ b/src/PartSet/PartSet_FilterInfinite.cpp @@ -34,7 +34,8 @@ Standard_Boolean PartSet_FilterInfinite::IsOk(const Handle(SelectMgr_EntityOwner ResultPtr aResult = myWorkshop->selection()->getResult(aPrs); // to filter infinite construction results if (aResult.get() && aResult->groupName() == ModelAPI_ResultConstruction::group()) { - ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aResult); + ResultConstructionPtr aConstruction = + std::dynamic_pointer_cast(aResult); if (aConstruction.get() && aConstruction->isInfinite()) { Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner); if (!aBRepOwner.IsNull() && aBRepOwner->HasShape()) { @@ -47,9 +48,12 @@ Standard_Boolean PartSet_FilterInfinite::IsOk(const Handle(SelectMgr_EntityOwner TopoDS_Shape aResultTopoShape = aResultShape->impl(); aResultShapeType = aResultTopoShape.ShapeType(); } - // for infinite object, the selection is possible only for shapes of owners, which are coincide - // to the shape of corresponded AIS object. In other words, for axis, only edge can be selected - // (vertices are not selectable), for planes, only faces can be selected (not edges or vertices) + // for infinite object, the selection is possible only + // for shapes of owners, which are coincide + // to the shape of corresponded AIS object. + // In other words, for axis, only edge can be selected + // (vertices are not selectable), for planes, + // only faces can be selected (not edges or vertices) aValid = anOwnerShapeType == aResultShapeType; } } diff --git a/src/PartSet/PartSet_FilterInfinite.h b/src/PartSet/PartSet_FilterInfinite.h index f6caa6666..2e14b81ba 100755 --- a/src/PartSet/PartSet_FilterInfinite.h +++ b/src/PartSet/PartSet_FilterInfinite.h @@ -28,7 +28,8 @@ public: /// Returns True if selected presentation can be selected /// \param theOwner an owner of the persentation - Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; + Standard_EXPORT virtual Standard_Boolean + IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const; DEFINE_STANDARD_RTTI(PartSet_FilterInfinite) diff --git a/src/PartSet/PartSet_Filters.cpp b/src/PartSet/PartSet_Filters.cpp index f2c82f246..6c4e5e1b2 100644 --- a/src/PartSet/PartSet_Filters.cpp +++ b/src/PartSet/PartSet_Filters.cpp @@ -42,8 +42,8 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj); if (aObj) { ResultPtr aResult = std::dynamic_pointer_cast(aObj); - // result of parts belongs to PartSet document and can be selected only when PartSet is active - // in order to do not select the result of the active part. + // result of parts belongs to PartSet document and can be selected only when PartSet + // is active in order to do not select the result of the active part. if (aResult.get() && aResult->groupName() == ModelAPI_ResultPart::group()) { SessionPtr aMgr = ModelAPI_Session::get(); aValid = aMgr->activeDocument() == aMgr->moduleDocument(); @@ -69,7 +69,8 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& IMPLEMENT_STANDARD_HANDLE(PartSet_CirclePointFilter, SelectMgr_Filter); IMPLEMENT_STANDARD_RTTIEXT(PartSet_CirclePointFilter, SelectMgr_Filter); -Standard_Boolean PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const +Standard_Boolean + PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const { ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation(); if(!anOperation) { @@ -90,7 +91,8 @@ Standard_Boolean PartSet_CirclePointFilter::IsOk(const Handle(SelectMgr_EntityOw return Standard_True; } - Handle(ModuleBase_ResultPrs) aResultPrs = Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable()); + Handle(ModuleBase_ResultPrs) aResultPrs = + Handle(ModuleBase_ResultPrs)::DownCast(theOwner->Selectable()); if(aResultPrs.IsNull()) { return Standard_True; } diff --git a/src/PartSet/PartSet_IconFactory.cpp b/src/PartSet/PartSet_IconFactory.cpp index 1636a6ca2..bf3fcebb3 100644 --- a/src/PartSet/PartSet_IconFactory.cpp +++ b/src/PartSet/PartSet_IconFactory.cpp @@ -100,7 +100,8 @@ QIcon PartSet_IconFactory::getIcon(ObjectPtr theObj) void PartSet_IconFactory::processEvent(const std::shared_ptr& theMessage) { - if (theMessage->eventID() == Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) { + if (theMessage->eventID() == + Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) { std::shared_ptr aFeatureMsg = std::dynamic_pointer_cast(theMessage); if (!aFeatureMsg->isInternal()) { diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 46bba0307..640c1b897 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -374,7 +374,8 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); std::shared_ptr anAuxiliaryAttr = - std::dynamic_pointer_cast(aSketchFeature->data()->attribute(anAttribute)); + std::dynamic_pointer_cast( + aSketchFeature->data()->attribute(anAttribute)); if (anAuxiliaryAttr) anAuxiliaryAttr->setValue(isChecked); } @@ -402,7 +403,8 @@ bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const // 1. change auxiliary type of a created feature if (myModule->sketchMgr()->isNestedCreateOperation(anOperation, aSketch) && PartSet_SketcherMgr::isEntity(anOperation->id().toStdString()) ) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast(anOperation); + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(anOperation); if (aFOperation) anObjects.append(aFOperation->feature()); } @@ -429,7 +431,8 @@ bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const std::string anAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID(); std::shared_ptr anAuxiliaryAttr = - std::dynamic_pointer_cast(aSketchFeature->data()->attribute(anAttribute)); + std::dynamic_pointer_cast( + aSketchFeature->data()->attribute(anAttribute)); if (anAuxiliaryAttr) isNotAuxiliaryFound = !anAuxiliaryAttr->value(); } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index b35aaf442..04c57f58a 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -164,9 +164,6 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) Config_PropManager::registerProp("Visualization", "operation_highlight_color", "Multi selector item color in operation", Config_Prop::Color, PartSet_CustomPrs::OPERATION_HIGHLIGHT_COLOR()); - - //Config_PropManager::registerProp(SKETCH_TAB_NAME, "disable_input_fields", "Disable input fields", - // Config_Prop::Boolean, "true"); } PartSet_Module::~PartSet_Module() @@ -247,11 +244,12 @@ void PartSet_Module::registerProperties() PLANE_SIZE); Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_thickness", "Thickness", Config_Prop::Integer, SKETCH_WIDTH); - Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane", "Rotate to plane when selected", - Config_Prop::Boolean, "false"); + Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane", + "Rotate to plane when selected", Config_Prop::Boolean, "false"); } -void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, const bool isToConnect) +void PartSet_Module::connectToPropertyPanel(ModuleBase_ModelWidget* theWidget, + const bool isToConnect) { mySketchMgr->connectToPropertyPanel(theWidget, isToConnect); } @@ -265,7 +263,8 @@ void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) /// Restart sketcher operations automatically if (!mySketchReentrantMgr->operationCommitted(theOperation)) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(theOperation); if (aFOperation && !aFOperation->isEditOperation()) { // the selection is cleared after commit the create operation // in order to do not use the same selected objects in the restarted operation @@ -306,15 +305,17 @@ void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation) bool isOperationCommitted = false; if (!aFOperation->isEditOperation()) { std::string aGreedAttributeId = ModuleBase_Tools::findGreedAttribute(workshop(), aFeature); - // if there is a greed attribute, automatic commit by preselection for this feature is prohibited + // if there is a greed attribute, automatic commit by preselection + // for this feature is prohibited aFilledWidget = aFOperation->activateByPreselection(aGreedAttributeId); if (currentOperation() != aFOperation) isOperationCommitted = true; else { if (aGreedAttributeId.empty()) { // a signal should be emitted before the next widget activation - // because, the activation of the next widget will give a focus to the widget. As a result - // the value of the widget is initialized. And commit may happens until the value is entered. + // because, the activation of the next widget will give a focus to the widget. + // As a result the value of the widget is initialized. + // And commit may happens until the value is entered. if (aFilledWidget) { if (mySketchReentrantMgr->canBeCommittedByPreselection()) isOperationCommitted = mySketchMgr->operationActivatedByPreselection(); @@ -375,7 +376,8 @@ void PartSet_Module::updateSketcherOnStart(ModuleBase_Operation* theOperation) void PartSet_Module::updatePresentationsOnStart(ModuleBase_Operation* theOperation) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(theOperation); if (aFOperation) { myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true); myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true); @@ -386,7 +388,8 @@ void PartSet_Module::operationResumed(ModuleBase_Operation* theOperation) { ModuleBase_IModule::operationResumed(theOperation); - ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(theOperation); if (aFOperation) { myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeArguments, true); myCustomPrs->activate(aFOperation->feature(), ModuleBase_IModule::CustomizeResults, true); @@ -412,8 +415,8 @@ void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation) aDisplayer->updateViewer(); } - QMap::const_iterator anIt = myHasConstraintShown.begin(), - aLast = myHasConstraintShown.end(); + QMap::const_iterator + anIt = myHasConstraintShown.begin(), aLast = myHasConstraintShown.end(); for (; anIt != aLast; anIt++) { mySketchMgr->updateBySketchParameters(anIt.key(), anIt.value()); } @@ -492,7 +495,8 @@ bool PartSet_Module::canActivateSelection(const ObjectPtr& theObject) const if (isSketchOp || isNestedOp) { // in active sketch operation it is possible to activate operation object in selection // in the edit operation, e.g. points of the line can be moved when the line is edited - ModuleBase_OperationFeature* aFOperation = dynamic_cast(anOperation); + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(anOperation); aCanActivate = aCanActivate || (aFOperation && aFOperation->isEditOperation()); } return aCanActivate; @@ -586,7 +590,8 @@ void PartSet_Module::clearViewer() void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation) { - ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(theOperation); if (!aFOperation) return; @@ -601,7 +606,8 @@ bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation, { bool aProcessed = false; - ModuleBase_OperationFeature* aFOperation = dynamic_cast(theOperation); + ModuleBase_OperationFeature* aFOperation = + dynamic_cast(theOperation); XGUI_Workshop* aWorkshop = getWorkshop(); XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel(); if (mySketchMgr->activeSketch().get() && aFOperation && aPropertyPanel) { @@ -615,11 +621,12 @@ bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation, FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); FeaturePtr anOpFeature = aFOperation->feature(); GeomShapePtr aShape = aSelectedPrs->shape(); - // click on the digit of dimension constrain comes here with an empty shape, so we need the check + // click on the digit of dimension constrain comes here + // with an empty shape, so we need the check if (aFeature == anOpFeature && aShape.get() && !aShape->isNull()) { const TopoDS_Shape& aTDShape = aShape->impl(); AttributePtr anAttribute = PartSet_Tools::findAttributeBy2dPoint(anObject, aTDShape, - mySketchMgr->activeSketch()); + mySketchMgr->activeSketch()); if (anAttribute.get()) { QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation(); ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), workshop()); @@ -813,8 +820,10 @@ bool PartSet_Module::deleteObjects() anOpMgr->startOperation(anOpAction); // WORKAROUND, should be done to avoid viewer highlight update after deletetion of objects - // the problem is in AIS Dimensions recompute if a line and the dim are removed, line is the first - // it causes the AIS recompute, where the base line is null, the result is empty AIS in the viewer + // the problem is in AIS Dimensions recompute + // if a line and the dim are removed, line is the first + // it causes the AIS recompute, where the base line is null, + // the result is empty AIS in the viewer XGUI_Tools::workshop(myWorkshop)->selector()->clearSelection(); // 4. delete features @@ -978,7 +987,8 @@ bool PartSet_Module::isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFla return myCustomPrs->isActive(theFlag); } -void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature, const ModuleBase_CustomizeFlag& theFlag, +void PartSet_Module::activateCustomPrs(const FeaturePtr& theFeature, + const ModuleBase_CustomizeFlag& theFlag, const bool theUpdateViewer) { myCustomPrs->activate(theFeature, theFlag, theUpdateViewer); @@ -1292,7 +1302,8 @@ void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*) if (aOperation) { ModuleBase_ModelWidget* anActiveWidget = activeWidget(); if (anActiveWidget) { - ModuleBase_WidgetSelector* aWSelector = dynamic_cast(anActiveWidget); + ModuleBase_WidgetSelector* aWSelector = + dynamic_cast(anActiveWidget); if (aWSelector) aWSelector->activateSelectionAndFilters(true); } diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 64ae1c099..6687e7aa6 100755 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -51,7 +51,8 @@ Q_OBJECT enum RestartingMode { RM_None, /// the operation should not be restarted RM_Forbided, /// the operation should not be restarted after there is no active widget - RM_LastFeatureUsed, /// the operation is restarted and use the previous feature for own initialization + RM_LastFeatureUsed, /// the operation is restarted and use the previous feature + /// for own initialization RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature }; @@ -84,7 +85,8 @@ public: /// Call back forlast tuning of property panel before operation performance virtual void propertyPanelDefined(ModuleBase_Operation* theOperation); - /// If there is found selected attribute, widgets are created and contains only a widget for the attribute + /// If there is found selected attribute, widgets are created and contains + /// only a widget for the attribute /// It is important for Property Panel filling by sketch point attribute /// \param theOperation a started operation /// \param theWidgets a list of created widgets diff --git a/src/PartSet/PartSet_MouseProcessor.h b/src/PartSet/PartSet_MouseProcessor.h index 08f9eedce..0ef59ef8d 100755 --- a/src/PartSet/PartSet_MouseProcessor.h +++ b/src/PartSet/PartSet_MouseProcessor.h @@ -22,19 +22,23 @@ public: /// Processing the mouse move event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, + QMouseEvent* theEvent) {} /// Processing the mouse press event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mousePressed(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void mousePressed(ModuleBase_IViewWindow* theWindow, + QMouseEvent* theEvent) {} /// Processing the mouse release event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void mouseReleased(ModuleBase_IViewWindow* theWindow, + QMouseEvent* theEvent) {} /// Processing the mouse double click event in the viewer /// \param theWindow a view window /// \param theEvent a mouse event - PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent) {} + PARTSET_EXPORT virtual void mouseDoubleClick(ModuleBase_IViewWindow* theWindow, + QMouseEvent* theEvent) {} }; #endif diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 529f0371d..3204fa097 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -89,9 +89,10 @@ void PartSet_OperationPrs::useAISWidth() myUseAISWidth = true; } -void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) +void PartSet_OperationPrs::Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode) { #ifdef DEBUG_OPERATION_PRS qDebug("PartSet_OperationPrs::Compute -- begin"); @@ -107,8 +108,8 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t BRep_Builder aBuilder; TopoDS_Compound aComp; aBuilder.MakeCompound(aComp); - for(NCollection_DataMap::Iterator anIter(myShapeToPrsMap); - anIter.More(); anIter.Next()) { + for(NCollection_DataMap::Iterator + anIter(myShapeToPrsMap); anIter.More(); anIter.Next()) { const TopoDS_Shape& aShape = anIter.Key(); aBuilder.Add(aComp, aShape); // change deviation coefficient to provide more precise circle @@ -170,7 +171,8 @@ void PartSet_OperationPrs::addValue(const ObjectPtr& theObject, const GeomShapeP if (theObject.get()) { ResultPtr aResult = std::dynamic_pointer_cast(theObject); if (aResult.get()) { - ResultCompSolidPtr aCompsolidResult = std::dynamic_pointer_cast(theObject); + ResultCompSolidPtr aCompsolidResult = + std::dynamic_pointer_cast(theObject); if (aCompsolidResult.get()) { if (aCompsolidResult->numberOfSubs() > 0) { for(int i = 0; i < aCompsolidResult->numberOfSubs(); i++) { @@ -187,7 +189,8 @@ void PartSet_OperationPrs::addValue(const ObjectPtr& theObject, const GeomShapeP else { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); if (aFeature.get()) { - AttributeBooleanPtr aCopyAttr = aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); + AttributeBooleanPtr aCopyAttr = + aFeature->data()->boolean(SketchPlugin_SketchEntity::COPY_ID()); if (aCopyAttr.get()) { bool isCopy = aCopyAttr->value(); if (isCopy) @@ -291,7 +294,8 @@ void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, ObjectPtr anObject; GeomShapePtr aShape; if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { - AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(anAttribute); + AttributeRefAttrPtr anAttr = + std::dynamic_pointer_cast(anAttribute); if (anAttr->isObject()) { anObject = anAttr->object(); } @@ -306,12 +310,14 @@ void PartSet_OperationPrs::getFeatureShapes(const FeaturePtr& theFeature, } } if (anAttrType == ModelAPI_AttributeSelection::typeId()) { - AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(anAttribute); + AttributeSelectionPtr anAttr = + std::dynamic_pointer_cast(anAttribute); anObject = anAttr->context(); aShape = anAttr->value(); } if (anAttrType == ModelAPI_AttributeReference::typeId()) { - AttributeReferencePtr anAttr = std::dynamic_pointer_cast(anAttribute); + AttributeReferencePtr anAttr = + std::dynamic_pointer_cast(anAttribute); anObject = anAttr->value(); } addValue(anObject, aShape, theFeature, theWorkshop, theObjectShapes); @@ -344,7 +350,8 @@ void PartSet_OperationPrs::getResultShapes(const FeaturePtr& theFeature, } void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop, - QMap >& theObjectShapes) + QMap >& theObjectShapes) { theObjectShapes.clear(); @@ -383,9 +390,11 @@ bool PartSet_OperationPrs::isSelectionAttribute(const AttributePtr& theAttribute anAttrType == ModelAPI_AttributeReference::typeId(); } -void PartSet_OperationPrs::fillShapeList(const QMap >& theFeatureShapes, +void PartSet_OperationPrs::fillShapeList( + const QMap >& theFeatureShapes, ModuleBase_IWorkshop* theWorkshop, - NCollection_DataMap& theShapeToPrsMap) + NCollection_DataMap& theShapeToPrsMap) { theShapeToPrsMap.Clear(); diff --git a/src/PartSet/PartSet_OperationPrs.h b/src/PartSet/PartSet_OperationPrs.h index cc1416451..4577d7b77 100755 --- a/src/PartSet/PartSet_OperationPrs.h +++ b/src/PartSet/PartSet_OperationPrs.h @@ -139,11 +139,14 @@ private: NCollection_DataMap& theShapeToPrsMap); private: - NCollection_DataMap myShapeToPrsMap; /// list of visualized shapes + /// list of visualized shapes + NCollection_DataMap myShapeToPrsMap; ModuleBase_IWorkshop* myWorkshop; /// current workshop Quantity_Color myShapeColor; /// color of feature depended shapes - bool myUseAISWidth; /// flag if the width of a shape object should be used for the shape visualization + + /// flag if the width of a shape object should be used for the shape visualization + bool myUseAISWidth; friend class PartSet_CustomPrs; }; diff --git a/src/PartSet/PartSet_OverconstraintListener.cpp b/src/PartSet/PartSet_OverconstraintListener.cpp index 52d84913e..769c54bca 100755 --- a/src/PartSet/PartSet_OverconstraintListener.cpp +++ b/src/PartSet/PartSet_OverconstraintListener.cpp @@ -63,9 +63,11 @@ void PartSet_OverconstraintListener::processEvent( QString aCurrentInfoStr = getObjectsInfo(myConflictingObjects); - qDebug(QString("PartSet_OverconstraintListener::processEvent: %1,\nobjects count = %2:%3\ncurrent objects count = %4:%5") - .arg(isRepaired ? "REPAIRED" : "FAILED") - .arg(aCount).arg(anInfoStr).arg(myConflictingObjects.size()).arg(aCurrentInfoStr).toStdString().c_str()); + QString aMsg("PartSet_OverconstraintListener::processEvent: %1,\nobjects \ + count = %2:%3\ncurrent objects count = %4:%5"); + qDebug(aMsg.arg(isRepaired ? "REPAIRED" : "FAILED") + .arg(aCount).arg(anInfoStr).arg(myConflictingObjects.size()) + .arg(aCurrentInfoStr).toStdString().c_str()); #endif if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SOLVER_FAILED)) { @@ -102,14 +104,15 @@ void PartSet_OverconstraintListener::processEvent( } bool PartSet_OverconstraintListener::appendConflictingObjects( - const std::set& theConflictingObjects) + const std::set& theConflictingObjects) { std::set aModifiedObjects; std::vector aColor; getConflictingColor(aColor); // set error state for new objects and append them in the internal map of objects - std::set::const_iterator anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end(); + std::set::const_iterator + anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end(); for (; anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; if (myConflictingObjects.find(anObject) == myConflictingObjects.end()) { // it is not found @@ -125,12 +128,13 @@ bool PartSet_OverconstraintListener::appendConflictingObjects( } bool PartSet_OverconstraintListener::repairConflictingObjects( - const std::set& theConflictingObjects) + const std::set& theConflictingObjects) { std::set aModifiedObjects; // erase error state of absent current objects in the parameter list std::set::const_iterator anIt, aLast; - for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end() ; anIt != aLast; anIt++) { + for (anIt = theConflictingObjects.begin(), aLast = theConflictingObjects.end(); + anIt != aLast; anIt++) { ObjectPtr anObject = *anIt; if (theConflictingObjects.find(anObject) != theConflictingObjects.end()) { // it is found myConflictingObjects.erase(anObject); diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 3c0fbf920..e0d6010c5 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -66,9 +66,10 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) ModuleBase_Tools::setPointBallHighlighting(this); } -void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode) +void PartSet_ResultSketchPrs::Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + const Handle(Prs3d_Presentation)& thePresentation, + const Standard_Integer theMode) { thePresentation->Clear(); @@ -102,7 +103,8 @@ void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d) } if (!aReadyToDisplay) { - Events_InfoMessage("PartSet_ResultSketchPrs", "An empty AIS presentation: PartSet_ResultSketchPrs").send(); + Events_InfoMessage("PartSet_ResultSketchPrs", + "An empty AIS presentation: PartSet_ResultSketchPrs").send(); static const Events_ID anEvent = Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION); ModelAPI_EventCreator::get()->sendUpdated(myResult, anEvent); } @@ -114,7 +116,8 @@ void debugInfo(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType) TopTools_IndexedMapOfShape aSubShapes; TopExp::MapShapes (theShape, theType, aSubShapes); - Standard_Boolean isComesFromDecomposition = !((aSubShapes.Extent() == 1) && (theShape == aSubShapes (1))); + Standard_Boolean + isComesFromDecomposition = !((aSubShapes.Extent() == 1) && (theShape == aSubShapes (1))); int anExtent = aSubShapes.Extent(); for (Standard_Integer aShIndex = 1; aShIndex <= aSubShapes.Extent(); ++aShIndex) { diff --git a/src/PartSet/PartSet_ResultSketchPrs.h b/src/PartSet/PartSet_ResultSketchPrs.h index f303adec9..bb816a81b 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.h +++ b/src/PartSet/PartSet_ResultSketchPrs.h @@ -32,7 +32,8 @@ public: DEFINE_STANDARD_RTTI(PartSet_ResultSketchPrs) protected: /// Redefinition of virtual function - Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, + Standard_EXPORT virtual void Compute( + const Handle(PrsMgr_PresentationManager3d)& thePresentationManager, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0); /// Redefinition of virtual function @@ -45,7 +46,8 @@ private: /// \param theShape a shape /// \param theTypeOfSelection type of selection: VERTEX, EDGE, WIRE void appendShapeSelection(const Handle(SelectMgr_Selection)& theSelection, - const TopoDS_Shape& theShape, const TopAbs_ShapeEnum& theTypeOfSelection); + const TopoDS_Shape& theShape, + const TopAbs_ShapeEnum& theTypeOfSelection); /// Sets color/line style/width of the presentation depending on the parameter state /// \param isAuxiliary a boolean value if the properties are for auxiliary objects diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 47ea8850a..06b553b57 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -213,7 +213,8 @@ public: bool isObjectOfSketch(const ObjectPtr& theObject) const; /// Saves the current selection in the viewer into an internal container - /// It obtains the selected attributes. The highlighted objects can be processes as the selected ones + /// It obtains the selected attributes. + /// The highlighted objects can be processes as the selected ones /// \param theHighlightedOnly a boolean flag void storeSelection(const bool theHighlightedOnly = false); @@ -284,7 +285,8 @@ private slots: void onLeaveViewPort(); /// Listens to the value changed signal and display the current operation feature void onBeforeValuesChangedInPropertyPanel(); - /// Listens to the signal about the modification of the values have been done in the property panel + /// Listens to the signal about the modification of the values + /// have been done in the property panel void onAfterValuesChangedInPropertyPanel(); void onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*); @@ -347,7 +349,8 @@ private: /// Erase or display the feature of the current operation. If the mouse over the active view or /// a current value is changed by property panel, the feature is displayed otherwise it is hidden - /// \param theOperation an operation which feature is to be displayed, it is nested create operation + /// \param theOperation an operation which feature is to be displayed, + /// it is nested create operation /// \param isToDisplay a flag about the display or erase the feature void visualizeFeature(const FeaturePtr& theFeature, const bool isEditOperation, const bool isToDisplay, const bool isFlushRedisplay = true); @@ -369,7 +372,8 @@ private: bool myIsDragging; bool myDragDone; bool myIsMouseOverWindow; /// the state that the mouse over the view - bool myIsMouseOverViewProcessed; /// the state whether the over view state is processed by mouseMove method + /// the state whether the over view state is processed by mouseMove method + bool myIsMouseOverViewProcessed; bool myIsPopupMenuActive; /// the state of the popup menu is shown Point myCurrentPoint; //Point myClickedPoint; diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp index 5bc007456..cb2bc68cc 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.cpp @@ -218,10 +218,13 @@ bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* myPreviousFeature = aFOperation->feature(); /// selection should be obtained from workshop before ask if the operation can be started as - /// the canStartOperation method performs commit/abort of previous operation. Sometimes commit/abort - /// may cause selection clear(Sketch operation) as a result it will be lost and is not used for preselection. + /// the canStartOperation method performs commit/abort of previous operation. + /// Sometimes commit/abort + /// may cause selection clear(Sketch operation) as a result + /// it will be lost and is not used for preselection. ModuleBase_ISelection* aSelection = myWorkshop->selection(); - QList aPreSelected = aSelection->getSelected(ModuleBase_ISelection::AllControls); + QList aPreSelected = + aSelection->getSelected(ModuleBase_ISelection::AllControls); restartOperation(); myPreviousFeature = FeaturePtr(); @@ -230,7 +233,8 @@ bool PartSet_SketcherReetntrantMgr::processMouseReleased(ModuleBase_IViewWindow* // fill the first widget by the mouse event point // if the active widget is not the first, it means that the restarted operation is filled by // the current preselection. - PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast(module()->activeWidget()); + PartSet_WidgetPoint2D* aPoint2DWdg = + dynamic_cast(module()->activeWidget()); ModuleBase_ModelWidget* aFirstWidget = aPanel->findFirstAcceptingValueWidget(); if (aPoint2DWdg && aPoint2DWdg == aFirstWidget) { if (!aPreSelected.empty()) @@ -440,9 +444,11 @@ bool PartSet_SketcherReetntrantMgr::startInternalEdit(const std::string& thePrev if (aPreviousAttributeWidget == aPanel->activeWidget()) { aPanel->activateWidget(NULL, false); } - // if there is no the next widget to be automatically activated, the Ok button in property + // if there is no the next widget to be automatically activated, + // the Ok button in property // panel should accept the focus(example is parallel constraint on sketch lines) - QToolButton* anOkBtn = dynamic_cast(aPanel)->findButton(PROP_PANEL_OK); + QToolButton* anOkBtn = + dynamic_cast(aPanel)->findButton(PROP_PANEL_OK); if (anOkBtn) anOkBtn->setFocus(Qt::TabFocusReason); } @@ -537,7 +543,8 @@ void PartSet_SketcherReetntrantMgr::createInternalFeature() void PartSet_SketcherReetntrantMgr::deleteInternalFeature() { if (myInternalActiveWidget) { - ModuleBase_WidgetSelector* aWSelector = dynamic_cast(myInternalActiveWidget); + ModuleBase_WidgetSelector* aWSelector = + dynamic_cast(myInternalActiveWidget); if (aWSelector) aWSelector->activateSelectionAndFilters(false); myInternalActiveWidget = 0; diff --git a/src/PartSet/PartSet_SketcherReetntrantMgr.h b/src/PartSet/PartSet_SketcherReetntrantMgr.h index a18db6bcd..647d214ee 100755 --- a/src/PartSet/PartSet_SketcherReetntrantMgr.h +++ b/src/PartSet/PartSet_SketcherReetntrantMgr.h @@ -29,7 +29,8 @@ class PartSet_Module; /// ('internal' edit operation), with the ability to simultaneously create the next entity /// of same type (re-entrance of the operation). /// OK valids the current edition and exits from the operation (no re-entrance). -/// Cancel removes (undo) the entity currently edited and exits from the operation (no re-entrance). +/// Cancel removes (undo) the entity currently edited and +/// exits from the operation (no re-entrance). class PARTSET_EXPORT PartSet_SketcherReetntrantMgr : public QObject { Q_OBJECT @@ -38,7 +39,8 @@ Q_OBJECT enum RestartingMode { RM_None, /// the operation should not be restarted RM_Forbided, /// the operation should not be restarted after there is no active widget - RM_LastFeatureUsed, /// the operation is restarted and use the previous feature for own initialization + RM_LastFeatureUsed, /// the operation is restarted and use + /// the previous feature for own initialization RM_EmptyFeatureUsed /// the operation is restarted and does not use the previous feature }; @@ -164,7 +166,8 @@ private: bool isTangentArc(ModuleBase_Operation* theOperation, const std::shared_ptr& /*theSketch*/) const; - /// Accept All action is enabled if an internal edit is started. It updates the state of the button + /// Accept All action is enabled if an internal edit is started. + /// It updates the state of the button void updateAcceptAllAction(); /// Returns the workshop diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index 7a420b781..425e1b5b5 100755 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -175,7 +175,8 @@ std::shared_ptr PartSet_Tools::convertTo2D(FeaturePtr theSketch, } -std::shared_ptr PartSet_Tools::convertTo3D(const double theX, const double theY, FeaturePtr theSketch) +std::shared_ptr PartSet_Tools::convertTo3D(const double theX, const double theY, + FeaturePtr theSketch) { std::shared_ptr aData = theSketch->data(); @@ -326,8 +327,9 @@ std::shared_ptr PartSet_Tools::findFirstEqualPointInArgumen return aFeaturePoint; } -std::shared_ptr PartSet_Tools::findFirstEqualPoint(const FeaturePtr& theFeature, - const std::shared_ptr& thePoint) +std::shared_ptr PartSet_Tools::findFirstEqualPoint( + const FeaturePtr& theFeature, + const std::shared_ptr& thePoint) { std::shared_ptr aFPoint; @@ -475,9 +477,11 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap std::shared_ptr aData = aMyFeature->data(); std::shared_ptr aPoint1 = - std::dynamic_pointer_cast(aData->attribute(SketchPlugin_Line::START_ID())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::START_ID())); std::shared_ptr aPoint2 = - std::dynamic_pointer_cast(aData->attribute(SketchPlugin_Line::END_ID())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Line::END_ID())); aPoint1->setValue(aPnt2d1); aPoint2->setValue(aPnt2d2); @@ -518,7 +522,8 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap ResultPtr aRes = std::dynamic_pointer_cast(theObject); // selection shape has no result owner => the trihedron axis - // TODO: make reference to the real axes when they are implemented in the initialization plugin + // TODO: make reference to the real axes when + // they are implemented in the initialization plugin if (!aRes.get()) { ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName( ModelAPI_ResultConstruction::group(), "Origin"); @@ -558,7 +563,8 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID())); ResultPtr aRes = std::dynamic_pointer_cast(theObject); - // if there is no object, it means that this is the origin point: search it in the module document + // if there is no object, + // it means that this is the origin point: search it in the module document if (!aRes.get()) { ObjectPtr aPointObj = ModelAPI_Session::get()->moduleDocument()->objectByName( ModelAPI_ResultConstruction::group(), "Origin"); @@ -579,7 +585,8 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap std::shared_ptr aPnt2d = convertTo2D(theSketch, aPnt); std::shared_ptr aPoint = - std::dynamic_pointer_cast(aData->attribute(SketchPlugin_Point::COORD_ID())); + std::dynamic_pointer_cast( + aData->attribute(SketchPlugin_Point::COORD_ID())); aPoint->setValue(aPnt2d); if ((aPnt->x() < Precision::Confusion()) && (aPnt->y() < Precision::Confusion()) && @@ -621,7 +628,8 @@ bool PartSet_Tools::isContainPresentation(const QList& return false; } -ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch, std::shared_ptr theEdge) +ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch, + std::shared_ptr theEdge) { for (int i = 0; i < theSketch->numberOfSubs(); i++) { FeaturePtr aFeature = theSketch->subFeature(i); @@ -650,7 +658,8 @@ ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch, std::sh } -ResultPtr PartSet_Tools::findExternalVertex(CompositeFeaturePtr theSketch, std::shared_ptr theVert) +ResultPtr PartSet_Tools::findExternalVertex(CompositeFeaturePtr theSketch, + std::shared_ptr theVert) { for (int i = 0; i < theSketch->numberOfSubs(); i++) { FeaturePtr aFeature = theSketch->subFeature(i); @@ -746,8 +755,9 @@ GeomShapePtr PartSet_Tools::findShapeBy2DPoint(const AttributePtr& theAttribute, return aShape; } -std::shared_ptr PartSet_Tools::getPoint(std::shared_ptr& theFeature, - const std::string& theAttribute) +std::shared_ptr PartSet_Tools::getPoint( + std::shared_ptr& theFeature, + const std::string& theAttribute) { std::shared_ptr aPointAttr = ModelGeomAlgo_Point2D::getPointOfRefAttr( theFeature.get(), theAttribute, SketchPlugin_Point::ID(), @@ -757,7 +767,8 @@ std::shared_ptr PartSet_Tools::getPoint(std::shared_ptr(); } -FeaturePtr findFirstCoincidenceByData(const DataPtr& theData, std::shared_ptr thePoint) +FeaturePtr findFirstCoincidenceByData(const DataPtr& theData, + std::shared_ptr thePoint) { FeaturePtr aCoincident; @@ -895,7 +906,7 @@ void PartSet_Tools::findCoincidences(FeaturePtr theStartCoin, QList& std::shared_ptr PartSet_Tools::getCoincedencePoint(FeaturePtr theStartCoin) { std::shared_ptr aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), - SketchPlugin_Constraint::ENTITY_A()); + SketchPlugin_Constraint::ENTITY_A()); if (aPnt.get() == NULL) aPnt = SketcherPrs_Tools::getPoint(theStartCoin.get(), SketchPlugin_Constraint::ENTITY_B()); return aPnt; @@ -927,7 +938,8 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj, if (!aCurPoint->isInitialized()) continue; - std::shared_ptr aPnt = convertTo3D(aCurPoint->x(), aCurPoint->y(), theSketch); + std::shared_ptr aPnt = + convertTo3D(aCurPoint->x(), aCurPoint->y(), theSketch); if (aPnt && (aPnt->distance(aValue) < Precision::Confusion())) { anAttribute = aCurPoint; break; diff --git a/src/PartSet/PartSet_Tools.h b/src/PartSet/PartSet_Tools.h index 3bbebc781..7e92c4d24 100755 --- a/src/PartSet/PartSet_Tools.h +++ b/src/PartSet/PartSet_Tools.h @@ -78,13 +78,15 @@ public: /// \param theSketch the sketch feature /// \param thePnt the 3D point in the viewer /// \returns the converted point object - static std::shared_ptr convertTo2D(FeaturePtr theSketch, const std::shared_ptr& thePnt); + static std::shared_ptr convertTo2D(FeaturePtr theSketch, + const std::shared_ptr& thePnt); /// \brief Converts the 2D projected coodinates on the sketch plane to the 3D point. /// \param theX the X coordinate /// \param theY the Y coordinate /// \param theSketch the sketch feature - static std::shared_ptr convertTo3D(const double theX, const double theY, FeaturePtr theSketch); + static std::shared_ptr convertTo3D(const double theX, const double theY, + FeaturePtr theSketch); /// Returns pointer to the root document. static std::shared_ptr document(); @@ -205,7 +207,8 @@ public: /// \param theView a 3D view /// \param theX the output horizontal coordinate of the point /// \param theY the output vertical coordinate of the point - static bool hasVertexShape(const std::shared_ptr& thePrs, FeaturePtr theSketch, + static bool hasVertexShape(const std::shared_ptr& thePrs, + FeaturePtr theSketch, Handle_V3d_View theView, double& theX, double& theY); diff --git a/src/PartSet/PartSet_Validators.cpp b/src/PartSet/PartSet_Validators.cpp index 831f9d914..6cd04eb54 100755 --- a/src/PartSet/PartSet_Validators.cpp +++ b/src/PartSet/PartSet_Validators.cpp @@ -82,7 +82,8 @@ std::shared_ptr sketcherPlane(ModuleBase_Operation* theOperation) { std::shared_ptr aEmptyPln; if (theOperation) { - ModuleBase_OperationFeature* aFeatureOp = dynamic_cast(theOperation); + ModuleBase_OperationFeature* aFeatureOp = + dynamic_cast(theOperation); if (aFeatureOp) { CompositeFeaturePtr aFeature = std::dynamic_pointer_cast(aFeatureOp->feature()); @@ -96,7 +97,8 @@ std::shared_ptr sketcherPlane(ModuleBase_Operation* theOperation) bool isEmptySelectionValid(ModuleBase_Operation* theOperation) { - ModuleBase_OperationFeature* aFeatureOp = dynamic_cast(theOperation); + ModuleBase_OperationFeature* aFeatureOp = + dynamic_cast(theOperation); // during the create operation empty selection is always valid if (!aFeatureOp->isEditOperation()) { return true; @@ -109,12 +111,14 @@ bool isEmptySelectionValid(ModuleBase_Operation* theOperation) else return false; } - else// in edit operation an empty selection is always valid, performed for re-entrant operrations + else + // in edit operation an empty selection is always valid, performed for re-entrant operrations return true; } } -bool PartSet_DistanceSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_DistanceSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -124,7 +128,8 @@ bool PartSet_DistanceSelection::isValid(const ModuleBase_ISelection* theSelectio } } -bool PartSet_LengthSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_LengthSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -134,7 +139,8 @@ bool PartSet_LengthSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_PerpendicularSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_PerpendicularSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -144,7 +150,8 @@ bool PartSet_PerpendicularSelection::isValid(const ModuleBase_ISelection* theSel } } -bool PartSet_ParallelSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_ParallelSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -154,12 +161,14 @@ bool PartSet_ParallelSelection::isValid(const ModuleBase_ISelection* theSelectio } } -bool PartSet_RadiusSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_RadiusSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { - QList aList = theSelection->getSelected(ModuleBase_ISelection::Viewer); + QList aList = + theSelection->getSelected(ModuleBase_ISelection::Viewer); int aCount = 0; foreach (ModuleBase_ViewerPrsPtr aPrs, aList) { const GeomShapePtr& aShape = aPrs->shape(); @@ -179,18 +188,21 @@ bool PartSet_RadiusSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { - QList aList = theSelection->getSelected(ModuleBase_ISelection::Viewer); + QList aList = + theSelection->getSelected(ModuleBase_ISelection::Viewer); return (aList.count() == 1); } } -bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -202,7 +214,8 @@ bool PartSet_CoincidentSelection::isValid(const ModuleBase_ISelection* theSelect } } -bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -212,7 +225,8 @@ bool PartSet_HVDirSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -222,7 +236,8 @@ bool PartSet_FilletSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -259,7 +274,8 @@ bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection } } -bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -269,12 +285,14 @@ bool PartSet_AngleSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); } else { - QList aList = theSelection->getSelected(ModuleBase_ISelection::Viewer); + QList aList = + theSelection->getSelected(ModuleBase_ISelection::Viewer); int aCount = 0; int aType = 0; foreach (ModuleBase_ViewerPrsPtr aPrs, aList) { @@ -305,7 +323,8 @@ bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection, } } -bool PartSet_CollinearSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_CollinearSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) { return isEmptySelectionValid(theOperation); @@ -315,7 +334,8 @@ bool PartSet_CollinearSelection::isValid(const ModuleBase_ISelection* theSelecti } } -bool PartSet_MiddlePointSelection::isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const +bool PartSet_MiddlePointSelection::isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const { if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) return isEmptySelectionValid(theOperation); @@ -360,13 +380,15 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute { FeaturePtr aFeature = std::dynamic_pointer_cast(theAttribute->owner()); - // the type of validated attributes should be equal, attributes with different types are not validated + // the type of validated attributes should be equal, attributes with + // different types are not validated // Check RefAttr attributes std::string anAttrType = theAttribute->attributeType(); std::list > anAttrs; if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) { - AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast(theAttribute); + AttributeRefAttrPtr anAttr = + std::dynamic_pointer_cast(theAttribute); bool isObject = anAttr->isObject(); ObjectPtr anObject = anAttr->object(); @@ -376,7 +398,7 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute for(; anAttrIter != anAttrs.end(); anAttrIter++) { if ((*anAttrIter).get() && (*anAttrIter)->id() != theAttribute->id()) { std::shared_ptr aRef = - std::dynamic_pointer_cast(*anAttrIter); + std::dynamic_pointer_cast(*anAttrIter); if (aRef->isObject() != isObject) continue; if (isObject) { @@ -400,7 +422,8 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute } } else if (anAttrType == ModelAPI_AttributeSelection::typeId()) { - AttributeSelectionPtr anAttr = std::dynamic_pointer_cast(theAttribute); + AttributeSelectionPtr anAttr = + std::dynamic_pointer_cast(theAttribute); ResultPtr aContext = anAttr->context(); GeomShapePtr aShape = anAttr->value(); @@ -411,7 +434,7 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute for(; anAttr != anAttrs.end(); anAttr++) { if ((*anAttr).get() && (*anAttr)->id() != theAttribute->id()) { std::shared_ptr aRef = - std::dynamic_pointer_cast(*anAttr); + std::dynamic_pointer_cast(*anAttr); // check the object is already presented if (aRef->context() == aContext) { bool aHasShape = aShape.get() != NULL; @@ -425,7 +448,8 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute } } else if (anAttrType == ModelAPI_AttributeReference::typeId()) { - AttributeReferencePtr anAttr = std::dynamic_pointer_cast(theAttribute); + AttributeReferencePtr anAttr = + std::dynamic_pointer_cast(theAttribute); ObjectPtr anObject = anAttr->value(); // Check selection attributes anAttrs = aFeature->data()->attributes(ModelAPI_AttributeReference::typeId()); @@ -467,7 +491,8 @@ bool PartSet_DifferentObjectsValidator::isValid(const AttributePtr& theAttribute for(int j = 0; j < aRefSelList->size(); j++) { std::shared_ptr aRefSel = aRefSelList->value(j); ResultPtr aRefSelContext = aRefSel->context(); - ResultCompSolidPtr aRefSelCompSolidPtr = ModelAPI_Tools::compSolidOwner(aRefSelContext); + ResultCompSolidPtr aRefSelCompSolidPtr = + ModelAPI_Tools::compSolidOwner(aRefSelContext); std::shared_ptr aRefSelCompSolid; if(aRefSelCompSolidPtr.get()) { aRefSelCompSolid = aRefSelCompSolidPtr->shape(); diff --git a/src/PartSet/PartSet_Validators.h b/src/PartSet/PartSet_Validators.h index 0b25943aa..aa2a5d7e6 100644 --- a/src/PartSet/PartSet_Validators.h +++ b/src/PartSet/PartSet_Validators.h @@ -23,7 +23,8 @@ class PartSet_DistanceSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -31,7 +32,8 @@ public: class PartSet_LengthSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -39,7 +41,8 @@ public: class PartSet_PerpendicularSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -47,7 +50,8 @@ public: class PartSet_ParallelSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -55,7 +59,8 @@ public: class PartSet_RadiusSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -63,7 +68,8 @@ public: class PartSet_RigidSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; @@ -72,7 +78,8 @@ public: class PartSet_CoincidentSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -80,7 +87,8 @@ public: class PartSet_HVDirSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -88,7 +96,8 @@ public: class PartSet_TangentSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -96,7 +105,8 @@ public: class PartSet_FilletSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -104,7 +114,8 @@ public: class PartSet_AngleSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -112,7 +123,8 @@ public: class PartSet_EqualSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -120,7 +132,8 @@ public: class PartSet_CollinearSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; //! \ingroup Validators @@ -128,7 +141,8 @@ public: class PartSet_MiddlePointSelection : public ModuleBase_SelectionValidator { public: - PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, ModuleBase_Operation* theOperation) const; + PARTSET_EXPORT virtual bool isValid(const ModuleBase_ISelection* theSelection, + ModuleBase_Operation* theOperation) const; }; ////////////// Attribute validators //////////////// diff --git a/src/PartSet/PartSet_WidgetFileSelector.cpp b/src/PartSet/PartSet_WidgetFileSelector.cpp index f8c46f408..c1bf231f2 100644 --- a/src/PartSet/PartSet_WidgetFileSelector.cpp +++ b/src/PartSet/PartSet_WidgetFileSelector.cpp @@ -29,7 +29,8 @@ bool PartSet_WidgetFileSelector::restoreValueCustom() DataPtr aData = myFeature->data(); AttributeStringPtr aStringAttr = aData->string(ExchangePlugin_ExportFeature::FILE_PATH_ID()); - mySelectedFilter = formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value()))); + mySelectedFilter = + formatToFilter(shortFormatToFullFormat(QString::fromStdString(aStringAttr->value()))); return ModuleBase_WidgetFileSelector::restoreValueCustom(); } diff --git a/src/PartSet/PartSet_WidgetMultiSelector.cpp b/src/PartSet/PartSet_WidgetMultiSelector.cpp index 1cdac35fa..60fffb15d 100755 --- a/src/PartSet/PartSet_WidgetMultiSelector.cpp +++ b/src/PartSet/PartSet_WidgetMultiSelector.cpp @@ -87,7 +87,8 @@ void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr aShape = aResult->shape(); } if (aShape.get() != NULL && !aShape->isNull()) - anExternalObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate); + anExternalObject = + myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate); } else { anExternalObject = theObject; diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index dcb39aa4e..3c9fc33a4 100755 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -200,8 +200,10 @@ private: ModuleBase_ParamSpinBox* myXSpin; ///< the spin box for the X coordinate ModuleBase_ParamSpinBox* myYSpin; ///< the spin box for the Y coordinate - std::shared_ptr myPreSelected; ///< value used as selection in mouse release method - ///< it is important during restart operation + /// value used as selection in mouse release method + std::shared_ptr myPreSelected; + + /// it is important during restart operation CompositeFeaturePtr mySketch; bool myValueIsCashed; /// boolean state if the value is cashed during value state change diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp index 2c7daebde..79d1217bc 100644 --- a/src/PartSet/PartSet_WidgetPoint2dDistance.cpp +++ b/src/PartSet/PartSet_WidgetPoint2dDistance.cpp @@ -85,13 +85,15 @@ void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature, } } -double PartSet_WidgetPoint2dDistance::computeValue(const std::shared_ptr& theFirstPnt, - const std::shared_ptr& theCurrentPnt) +double PartSet_WidgetPoint2dDistance::computeValue( + const std::shared_ptr& theFirstPnt, + const std::shared_ptr& theCurrentPnt) { return theCurrentPnt->distance(theFirstPnt); } -void PartSet_WidgetPoint2dDistance::mouseReleased(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) +void PartSet_WidgetPoint2dDistance::mouseReleased(ModuleBase_IViewWindow* theWnd, + QMouseEvent* theEvent) { // the contex menu release by the right button should not be processed by this widget if (theEvent->button() != Qt::LeftButton) @@ -113,7 +115,8 @@ void PartSet_WidgetPoint2dDistance::mouseReleased(ModuleBase_IViewWindow* theWnd emit focusOutWidget(this); } -void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) +void PartSet_WidgetPoint2dDistance::mouseMoved(ModuleBase_IViewWindow* theWnd, + QMouseEvent* theEvent) { if (isEditingMode()) return; diff --git a/src/PartSet/PartSet_WidgetPoint2dDistance.h b/src/PartSet/PartSet_WidgetPoint2dDistance.h index 0836b20b1..63fe24778 100644 --- a/src/PartSet/PartSet_WidgetPoint2dDistance.h +++ b/src/PartSet/PartSet_WidgetPoint2dDistance.h @@ -86,7 +86,8 @@ protected: /// \return true if the widget current value is reset virtual bool resetCustom(); - /// Set the second point which defines a value in the widget as a distance with a first point defined by feature + /// Set the second point which defines a value in the widget as + /// a distance with a first point defined by feature void setPoint(FeaturePtr theFeature, const std::shared_ptr& thePnt); /// Compute the distance between points diff --git a/src/PartSet/PartSet_WidgetSketchCreator.cpp b/src/PartSet/PartSet_WidgetSketchCreator.cpp index 394756ca5..9e0325818 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.cpp +++ b/src/PartSet/PartSet_WidgetSketchCreator.cpp @@ -265,7 +265,8 @@ bool PartSet_WidgetSketchCreator::setSelection(QList& t bool aDone = false; if (!startSketchOperation(theValues)) { myIsCustomAttribute = true; - QList::const_iterator anIt = theValues.begin(), aLast = theValues.end(); + QList::const_iterator + anIt = theValues.begin(), aLast = theValues.end(); bool aProcessed = false; for (; anIt != aLast; anIt++) { ModuleBase_ViewerPrsPtr aValue = *anIt; @@ -278,7 +279,8 @@ bool PartSet_WidgetSketchCreator::setSelection(QList& t emit valuesChanged(); updateObject(myFeature); setVisibleSelectionControl(false); - // manually deactivation because the widget was not activated as has no focus acceptin controls + // manually deactivation because the widget was + // not activated as has no focus acceptin controls deactivate(); emit focusOutWidget(this); } @@ -298,7 +300,8 @@ void PartSet_WidgetSketchCreator::updateOnSelectionChanged(const bool theDone) { } -bool PartSet_WidgetSketchCreator::startSketchOperation(const QList& theValues) +bool PartSet_WidgetSketchCreator::startSketchOperation( + const QList& theValues) { bool aSketchStarted = false; @@ -313,7 +316,8 @@ bool PartSet_WidgetSketchCreator::startSketchOperation(const QListshape().get() && aResult->shape()->isEqual(aValue->shape())) { - ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aResult); + ResultConstructionPtr aConstruction = + std::dynamic_pointer_cast(aResult); if (!aConstruction.get() || !aConstruction->isInfinite()) return aSketchStarted; } @@ -350,7 +354,8 @@ bool PartSet_WidgetSketchCreator::focusTo() return true; } else - connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)), SLOT(onResumed(ModuleBase_Operation*))); + connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)), + SLOT(onResumed(ModuleBase_Operation*))); return true; } @@ -489,14 +494,16 @@ bool PartSet_WidgetSketchCreator::validateSelectionList() const XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop()); // TODO(spo): translate QMessageBox::question(aWorkshop->desktop(), tr("Apply current feature"), - tr("Sketch is invalid and will be deleted.\nError: %1").arg(anError.messageString().c_str()), + tr("Sketch is invalid and will be deleted.\nError: %1") + .arg(anError.messageString().c_str()), QMessageBox::Ok); } return isValidPComposite; } -void PartSet_WidgetSketchCreator::setSketchObjectToList(const CompositeFeaturePtr& theCompositeFeature, - const AttributePtr& theAttribute) +void PartSet_WidgetSketchCreator::setSketchObjectToList( + const CompositeFeaturePtr& theCompositeFeature, + const AttributePtr& theAttribute) { if (!theCompositeFeature.get() || theCompositeFeature->numberOfSubs() != 1) return; @@ -513,7 +520,8 @@ void PartSet_WidgetSketchCreator::setSketchObjectToList(const CompositeFeaturePt } ResultPtr aSketchRes = aSketchFeature->results().front(); - ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aSketchRes); + ResultConstructionPtr aConstruction = + std::dynamic_pointer_cast(aSketchRes); if(!aConstruction.get()) { return; } diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index 60a3cf30e..5e8ed26e6 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -42,7 +42,8 @@ public: /// \return a control list virtual QList getControls() const; - /// Set focus to the first control of the current widget. The focus policy of the control is checked. + /// Set focus to the first control of the current widget. + /// The focus policy of the control is checked. /// If the widget has the NonFocus focus policy, it is skipped. /// \return the state whether the widget can accept the focus virtual bool focusTo(); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index a19b96a37..33872cf95 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -97,7 +97,8 @@ PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent, myViewInverted = new QCheckBox(tr("Reversed"), aViewBox); aViewLayout->addWidget(myViewInverted); - QPushButton* aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox); + QPushButton* aSetViewBtn = + new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox); connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView())); aViewLayout->addWidget(aSetViewBtn); @@ -209,8 +210,9 @@ void PartSet_WidgetSketchLabel::blockAttribute(const AttributePtr& theAttribute, } } -bool PartSet_WidgetSketchLabel::setSelectionInternal(const QList& theValues, - const bool theToValidate) +bool PartSet_WidgetSketchLabel::setSelectionInternal( + const QList& theValues, + const bool theToValidate) { bool aDone = false; if (theValues.empty()) { diff --git a/src/PartSet/PartSet_WidgetSubShapeSelector.cpp b/src/PartSet/PartSet_WidgetSubShapeSelector.cpp index 50f81218d..d2beed18e 100755 --- a/src/PartSet/PartSet_WidgetSubShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetSubShapeSelector.cpp @@ -183,7 +183,8 @@ bool PartSet_WidgetSubShapeSelector::setSelection( /// find the points in coincident features PntToAttributesMap aRefAttributes = myCashedReferences[aBaseObject]; - PntToAttributesMap::const_iterator aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end(); + PntToAttributesMap::const_iterator + aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end(); for (; aRIt != aRLast; aRIt++) { std::shared_ptr anAttribute = aRIt->first; std::shared_ptr aPoint = aRIt->second; -- 2.39.2