From 4adaeb56991dd63bbfec723aafb0bc31ca9fc463 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 3 Nov 2016 13:20:15 +0300 Subject: [PATCH] Issue #1834: Fix length of lines --- src/PartSet/PartSet_Filters.h | 6 +++-- src/PartSet/PartSet_PreviewPlanes.cpp | 3 ++- src/PartSet/PartSet_WidgetPoint2d.cpp | 27 +++++++++++-------- src/PartSet/PartSet_WidgetShapeSelector.cpp | 6 +++-- src/PartSetAPI/PartSetAPI_Part.cpp | 1 + src/PartSetAPI/PartSetAPI_Part.h | 1 + src/PartSetPlugin/PartSetPlugin_Remove.cpp | 4 +-- src/PrimitivesAPI/PrimitivesAPI_Box.h | 15 +++++++---- src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp | 21 ++++++++++----- .../SamplePanelPlugin_ModelWidgetCreator.cpp | 3 ++- .../SamplePanelPlugin_Plugin.cpp | 3 ++- 11 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src/PartSet/PartSet_Filters.h b/src/PartSet/PartSet_Filters.h index c4e727035..71d60fe4c 100644 --- a/src/PartSet/PartSet_Filters.h +++ b/src/PartSet/PartSet_Filters.h @@ -26,7 +26,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_GlobalFilter) }; @@ -49,7 +50,8 @@ public: /// Returns True if the given owner is acceptable for selection /// \param theOwner the selected owner - 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_CirclePointFilter) diff --git a/src/PartSet/PartSet_PreviewPlanes.cpp b/src/PartSet/PartSet_PreviewPlanes.cpp index 4e362145d..71ddfdb3a 100755 --- a/src/PartSet/PartSet_PreviewPlanes.cpp +++ b/src/PartSet/PartSet_PreviewPlanes.cpp @@ -124,7 +124,8 @@ AISObjectPtr PartSet_PreviewPlanes::createPreviewPlane(std::shared_ptr aFace = GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize); + std::shared_ptr aFace = + GeomAlgoAPI_FaceBuilder::squareFace(theOrigin, theNorm, aSize); AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject()); aAIS->createShape(aFace); aAIS->setWidth(Config_PropManager::integer(SKETCH_TAB_NAME, "planes_thickness", SKETCH_WIDTH)); diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 110ae2648..e83e75751 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -449,7 +449,8 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo Handle(V3d_View) aView = theWindow->v3dView(); QList aList = aSelection->getSelected(ModuleBase_ISelection::Viewer); - ModuleBase_ViewerPrsPtr aFirstValue = aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr(); + ModuleBase_ViewerPrsPtr aFirstValue = + aList.size() > 0 ? aList.first() : ModuleBase_ViewerPrsPtr(); if (!aFirstValue.get() && myPreSelected.get()) { aFirstValue = myPreSelected; } @@ -485,7 +486,8 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo bool anOrphanPoint = aShape.ShapeType() == TopAbs_VERTEX || isOrphanPoint(aSelectedFeature, mySketch, aX, aY); if (anExternal) { - anOrphanPoint = true; // we should not stop reentrant operation on external objects because + // we should not stop reentrant operation on external objects because + anOrphanPoint = true; // they are not participate in the contour creation excepting external vertices if (aShape.ShapeType() == TopAbs_VERTEX) { FeaturePtr aFixedFeature = ModelAPI_Feature::feature(aFixedObject); @@ -494,10 +496,12 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo } } else { - // point is taken from mouse event and set in attribute. It should be done before setting - // coinident constraint to the external line. If a point is created, it should be in the mouse - // clicked point - gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); + // point is taken from mouse event and set in attribute. + // It should be done before setting + // coinident constraint to the external line. If a point is created, it should be + // in the mouse clicked point + gp_Pnt aPoint = + PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); double aX, anY; PartSet_Tools::convertTo2D(aPoint, mySketch, aView, aX, anY); setPoint(aX, anY); @@ -505,8 +509,8 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo } if (aFixedObject.get()) setConstraintWith(aFixedObject); - // fignal updated should be flushed in order to visualize possible created external objects - // e.g. selection of trihedron axis when input end arc point + // fignal updated should be flushed in order to visualize possible created + // external objects e.g. selection of trihedron axis when input end arc point updateObject(feature()); if (!anOrphanPoint) @@ -536,8 +540,8 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo } else if (aShape.ShapeType() == TopAbs_EDGE) { // point is taken from mouse event and set in attribute. It should be done before setting - // coinident constraint to the external line. If a point is created, it should be in the mouse - // clicked point + // coinident constraint to the external line. If a point is created, it should be in + // the mouse clicked point gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView()); PartSet_Tools::convertTo2D(aPoint, mySketch, aView, aX, aY); setPoint(aX, aY); @@ -588,7 +592,8 @@ void PartSet_WidgetPoint2D::mouseReleased(ModuleBase_IViewWindow* theWindow, QMo } } -void PartSet_WidgetPoint2D::setPreSelection(const std::shared_ptr& thePreSelected) +void PartSet_WidgetPoint2D::setPreSelection( + const std::shared_ptr& thePreSelected) { myPreSelected = thePreSelected; } diff --git a/src/PartSet/PartSet_WidgetShapeSelector.cpp b/src/PartSet/PartSet_WidgetShapeSelector.cpp index 22dc4225d..42d4fb9b7 100755 --- a/src/PartSet/PartSet_WidgetShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetShapeSelector.cpp @@ -77,7 +77,8 @@ void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr FeaturePtr aSelectedFeature = ModelAPI_Feature::feature(theObject); std::shared_ptr aSPFeature = std::dynamic_pointer_cast(aSelectedFeature); - // there is no a sketch feature is selected, but the shape exists, try to create an exernal object + // there is no a sketch feature is selected, but the shape exists, + // try to create an exernal object // TODO: unite with the same functionality in PartSet_WidgetShapeSelector if (aSPFeature.get() == NULL) { ObjectPtr anExternalObject = ObjectPtr(); @@ -91,7 +92,8 @@ void PartSet_WidgetShapeSelector::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 { /// use objects of found selection anExternalObject = theObject; diff --git a/src/PartSetAPI/PartSetAPI_Part.cpp b/src/PartSetAPI/PartSetAPI_Part.cpp index 9460819c6..349651cf3 100644 --- a/src/PartSetAPI/PartSetAPI_Part.cpp +++ b/src/PartSetAPI/PartSetAPI_Part.cpp @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : PartSetAPI_Part.cpp // Purpose: // diff --git a/src/PartSetAPI/PartSetAPI_Part.h b/src/PartSetAPI/PartSetAPI_Part.h index 46b1dd558..4913e8195 100644 --- a/src/PartSetAPI/PartSetAPI_Part.h +++ b/src/PartSetAPI/PartSetAPI_Part.h @@ -1,3 +1,4 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : PartSetAPI_Part.h // Purpose: // diff --git a/src/PartSetPlugin/PartSetPlugin_Remove.cpp b/src/PartSetPlugin/PartSetPlugin_Remove.cpp index a1c7bcfda..19ca7ae08 100644 --- a/src/PartSetPlugin/PartSetPlugin_Remove.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Remove.cpp @@ -33,8 +33,8 @@ void PartSetPlugin_Remove::execute() aRoot->refsToFeature(aFeature, aRefFeatures); if (aRefFeatures.empty()) { aRoot->removeFeature(aFeature); - // the redisplay signal should be flushed in order to erase the feature presentation in the viewer - // after removeFeature from the document + // the redisplay signal should be flushed in order to erase the feature presentation + // in the viewer after removeFeature from the document Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)); } } diff --git a/src/PrimitivesAPI/PrimitivesAPI_Box.h b/src/PrimitivesAPI/PrimitivesAPI_Box.h index acf8bdffb..a753ee92c 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Box.h +++ b/src/PrimitivesAPI/PrimitivesAPI_Box.h @@ -47,11 +47,16 @@ public: INTERFACE_6(PrimitivesPlugin_Box::ID(), creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */, - dx, PrimitivesPlugin_Box::DX_ID(), ModelAPI_AttributeDouble, /** Dimension in X */, - dy, PrimitivesPlugin_Box::DY_ID(), ModelAPI_AttributeDouble, /** Dimension in Y */, - dz, PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble, /** Dimension in Z */, - firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(), ModelAPI_AttributeSelection, /** First point */, - secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(), ModelAPI_AttributeSelection, /** Second point */) + dx, PrimitivesPlugin_Box::DX_ID(), + ModelAPI_AttributeDouble, /** Dimension in X */, + dy, PrimitivesPlugin_Box::DY_ID(), + ModelAPI_AttributeDouble, /** Dimension in Y */, + dz, PrimitivesPlugin_Box::DZ_ID(), + ModelAPI_AttributeDouble, /** Dimension in Z */, + firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(), + ModelAPI_AttributeSelection, /** First point */, + secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(), + ModelAPI_AttributeSelection, /** Second point */) /// Set dimensions PRIMITIVESAPI_EXPORT diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp index 8f150802e..35541e240 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp @@ -30,8 +30,10 @@ void PrimitivesPlugin_Box::initAttributes() data()->addAttribute(PrimitivesPlugin_Box::DY_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::POINT_SECOND_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST_ID(), + ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::POINT_SECOND_ID(), + ModelAPI_AttributeSelection::typeId()); } //================================================================================================= @@ -56,7 +58,8 @@ void PrimitivesPlugin_Box::createBoxByDimensions() std::shared_ptr aBoxAlgo(new GeomAlgoAPI_Box(aDx,aDy,aDz)); - // These checks should be made to the GUI for the feature but the corresponding validator does not exist yet. + // These checks should be made to the GUI for the feature but + // the corresponding validator does not exist yet. if (!aBoxAlgo->check()) { // The error is not displayed in a popup window. It must be in the status bar. setError(aBoxAlgo->getError(), false); @@ -100,11 +103,13 @@ void PrimitivesPlugin_Box::createBoxByTwoPoints() if (aShape1 && aShape2){ std::shared_ptr aFirstPoint = GeomAlgoAPI_PointBuilder::point(aShape1); std::shared_ptr aSecondPoint = GeomAlgoAPI_PointBuilder::point(aShape2); - aBoxAlgo = std::shared_ptr(new GeomAlgoAPI_BoxPoints(aFirstPoint,aSecondPoint)); + aBoxAlgo = std::shared_ptr( + new GeomAlgoAPI_BoxPoints(aFirstPoint,aSecondPoint)); } } - // These checks should be made to the GUI for the feature but the corresponding validator does not exist yet. + // These checks should be made to the GUI for the feature but + // the corresponding validator does not exist yet. if (!aBoxAlgo->check()) { // The error is not displayed in a popup window. It must be in the message console. setError(aBoxAlgo->getError(), false); @@ -144,8 +149,10 @@ void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr theBoxA // Insert to faces int num = 1; - std::map< std::string, std::shared_ptr > listOfFaces = theBoxAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { + std::map< std::string, std::shared_ptr > listOfFaces = + theBoxAlgo->getCreatedFaces(); + for (std::map< std::string, std::shared_ptr >::iterator + it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { std::shared_ptr aFace = (*it).second; theResultBox->generated(aFace, (*it).first, num++); } diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp index e2509d1a8..e1dab9ee8 100755 --- a/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_ModelWidgetCreator.cpp @@ -20,7 +20,8 @@ void SamplePanelPlugin_ModelWidgetCreator::widgetTypes(std::set& th theTypes = myModelWidgetTypes; } -ModuleBase_ModelWidget* SamplePanelPlugin_ModelWidgetCreator::createWidgetByType(const std::string& theType, +ModuleBase_ModelWidget* SamplePanelPlugin_ModelWidgetCreator::createWidgetByType( + const std::string& theType, QWidget* theParent, Config_WidgetAPI* theWidgetApi, ModuleBase_IWorkshop* /*theWorkshop*/) diff --git a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp index 88a9221b9..644c72c49 100755 --- a/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp +++ b/src/SamplePanelPlugin/SamplePanelPlugin_Plugin.cpp @@ -25,7 +25,8 @@ SamplePanelPlugin_Plugin::SamplePanelPlugin_Plugin() aWidgetCreatorFactory->registerCreator( std::shared_ptr(new SamplePanelPlugin_WidgetCreator())); aWidgetCreatorFactory->registerCreator( - std::shared_ptr(new SamplePanelPlugin_ModelWidgetCreator())); + std::shared_ptr( + new SamplePanelPlugin_ModelWidgetCreator())); // register this plugin ModelAPI_Session::get()->registerPlugin(this); -- 2.39.2