From 9168d8e4b881432e80b2a55bfbd4f846516a3bf0 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 9 Mar 2017 17:35:24 +0300 Subject: [PATCH] Issue #2027 Sketcher Trim Feature: split shapes by highlighted point is moved from GUI to Trim feature. Correction for Jenkins(row contains 100 characters long). --- src/PartSet/PartSet_Module.cpp | 2 +- src/SketchPlugin/SketchPlugin_Trim.cpp | 19 ++++++++++--------- src/SketchPlugin/SketchPlugin_Validators.cpp | 13 ++++--------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index d441445ca..18679ad14 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -747,7 +747,7 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th } else if (theType == "sketch_feature_point_selector") { PartSet_WidgetFeaturePointSelector* aPointSelectorWgt = - new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop, theWidgetApi); + new PartSet_WidgetFeaturePointSelector(theParent, aWorkshop, theWidgetApi); aPointSelectorWgt->setSketcher(mySketchMgr->activeSketch()); aWgt = aPointSelectorWgt; } diff --git a/src/SketchPlugin/SketchPlugin_Trim.cpp b/src/SketchPlugin/SketchPlugin_Trim.cpp index ac0630cfd..6c778e514 100644 --- a/src/SketchPlugin/SketchPlugin_Trim.cpp +++ b/src/SketchPlugin/SketchPlugin_Trim.cpp @@ -295,7 +295,8 @@ AISObjectPtr SketchPlugin_Trim::getAISObject(AISObjectPtr thePrevious) AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( data()->attribute(ENTITY_POINT())); std::shared_ptr anAttributePnt2d = aPoint->pnt(); - std::shared_ptr anAttributePnt = sketch()->to3D(anAttributePnt2d->x(), anAttributePnt2d->y()); + std::shared_ptr anAttributePnt = sketch()->to3D(anAttributePnt2d->x(), + anAttributePnt2d->y()); if (myCashedShapes.find(aBaseObject) == myCashedShapes.end()) fillObjectShapes(aBaseObject); @@ -404,7 +405,8 @@ void SketchPlugin_Trim::getConstraints(std::set& theFeaturesToDelete ModelAPI_Feature::feature(aResult2)); // get the point not lying on the splitting feature for (int i = 0; i < CONSTRAINT_ATTR_SIZE; ++i) { - AttributeRefAttrPtr aRefAttr = aCoincidenceFeature->refattr(SketchPlugin_Trim::BASE_OBJECT()); + AttributeRefAttrPtr aRefAttr = aCoincidenceFeature->refattr( + SketchPlugin_Trim::BASE_OBJECT()); if (!aRefAttr || aRefAttr->isObject()) continue; AttributePoint2DPtr aPoint = @@ -418,10 +420,7 @@ void SketchPlugin_Trim::getConstraints(std::set& theFeaturesToDelete } } if (aTangentPoint.get()) { - //FeaturePtr aFeature1 = ModelAPI_Feature::feature(aResult1); - //std::string anAttributeToBeModified = aFeature1 == aBaseFeature - // ? SketchPlugin_Constraint::ENTITY_A() : SketchPlugin_Constraint::ENTITY_B(); - //theTangentFeatures[aRefFeature] = std::make_pair(anAttributeToBeModified, aTangentPoint); + // collect tangent feaures } else /// there is not coincident point between tangent constraint theFeaturesToDelete.insert(aRefFeature); @@ -789,7 +788,8 @@ void SketchPlugin_Trim::fillPointAttribute(const AttributePtr& theModifiedAttrib aModifiedAttribute->setValue(thePoint); #ifdef DEBUG_TRIM - std::cout << " => Pnt2d - [" << thePoint->x() << ", " << thePoint->y() << "]" << std::endl; + std::cout << " => Pnt2d - [" << thePoint->x() << ", " + << thePoint->y() << "]" << std::endl; #endif } } @@ -819,7 +819,7 @@ void SketchPlugin_Trim::fillAttribute(const AttributePtr& theModifiedAttribute, } else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) { AttributeRefAttrPtr aRefAttributeToFill = std::dynamic_pointer_cast( - theModifiedAttribute); + theModifiedAttribute); AttributeRefAttrPtr aSourceRefAttr = std::dynamic_pointer_cast( theSourceAttribute); if (!aSourceRefAttr.get()) @@ -1056,7 +1056,8 @@ void SketchPlugin_Trim::attributeChanged(const std::string& theID) AttributePoint2DPtr aPoint = std::dynamic_pointer_cast( data()->attribute(ENTITY_POINT())); std::shared_ptr anAttributePnt2d = aPoint->pnt(); - std::shared_ptr anAttributePnt = sketch()->to3D(anAttributePnt2d->x(), anAttributePnt2d->y()); + std::shared_ptr anAttributePnt = sketch()->to3D(anAttributePnt2d->x(), + anAttributePnt2d->y()); if (myCashedShapes.find(aBaseObject) == myCashedShapes.end()) fillObjectShapes(aBaseObject); diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index 8e85e516b..641aaa0fd 100755 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -63,7 +63,8 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const AttributePtr& theAttribut SessionPtr aMgr = ModelAPI_Session::get(); ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast(theAttribute); + AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast + (theAttribute); bool isObject = aRefAttr->isObject(); if (!isObject) { // an attribute is a point. A point value is valid always for the distance @@ -884,15 +885,9 @@ bool SketchPlugin_SplitValidator::isValid(const AttributePtr& theAttribute, std::list > > > PointToRefsMap; PointToRefsMap aPointsInfo; - //std::list > aPoints; - //std::map, std::shared_ptr > - // aPointToAttributes; - //std::map, - // std::list< std::shared_ptr > > aPointToAttributes; ModelGeomAlgo_Point2D::getPointsInsideShape(anAttrShape, aRefAttributes, aC->pnt(), - aX->dir(), aDirY, aPointsInfo);//aPoints, aPointToAttributes); - - int aCoincidentToFeature = (int)aPointsInfo.size();//aPoints.size(); + aX->dir(), aDirY, aPointsInfo); + int aCoincidentToFeature = (int)aPointsInfo.size(); if (aKind == SketchPlugin_Circle::ID()) aValid = aCoincidentToFeature >= 2; else -- 2.39.2