From: mpv Date: Wed, 25 Mar 2015 09:00:51 +0000 (+0300) Subject: Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0 X-Git-Tag: V_1.1.0~91 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9bea53a5d0fc5c6aec52f4732ec45a9dcbe7354d;p=modules%2Fshaper.git Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0 Conflicts: src/SketchPlugin/SketchPlugin_Sketch.cpp --- 9bea53a5d0fc5c6aec52f4732ec45a9dcbe7354d diff --cc src/GeomAPI/GeomAPI_AISObject.cpp index f4ae42049,f4ae42049..8f053f7cf --- a/src/GeomAPI/GeomAPI_AISObject.cpp +++ b/src/GeomAPI/GeomAPI_AISObject.cpp @@@ -311,9 -311,9 +311,9 @@@ void GeomAPI_AISObject::getColor(int& t return; Quantity_Color aColor = anAIS->Color(); -- theR = aColor.Red()*255.; -- theG = aColor.Green()*255.; -- theB = aColor.Blue()*255.; ++ theR = (int)(aColor.Red()*255.); ++ theG = (int)(aColor.Green()*255.); ++ theB = (int)(aColor.Blue()*255.); } bool GeomAPI_AISObject::empty() const diff --cc src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp index 3cc4f85ae,4b815e3a1..993345446 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp @@@ -40,15 -174,18 +174,20 @@@ void GeomAlgoAPI_Placement::build // Calculate transformation gp_Trsf aTrsf; - gp_Vec aSrcDir(aSourceDir->x(), aSourceDir->y(), aSourceDir->z()); - gp_Vec aDstDir(aDestDir->x(), aDestDir->y(), aDestDir->z()); + gp_Vec aSrcDir = aSrcDstNormals[0]; + gp_Vec aDstDir = aSrcDstNormals[1]; ++ gp_Vec aSrcDir = aSrcDstNormals[0]; ++ gp_Vec aDstDir = aSrcDstNormals[1]; + // Calculate rotation gp_Quaternion aRot(aSrcDir, aDstDir); aTrsf.SetRotation(aRot); - gp_Vec aSrcCenter(aSourceLoc->x(), aSourceLoc->y(), aSourceLoc->z()); - aSrcCenter.Transform(aTrsf); - gp_Vec aTrans(aDestLoc->x() - aSrcCenter.X(), - aDestLoc->y() - aSrcCenter.Y(), - aDestLoc->z() - aSrcCenter.Z()); + // Calculate translation + gp_Vec aSrcLoc(aSrcDstPoints[0].XYZ()); + gp_Vec aDstLoc(aSrcDstPoints[1].XYZ()); + if (!theIsCentering) + aDstLoc = aSrcLoc + gp_Vec(aDstDir) * (aDstLoc-aSrcLoc).Dot(aDstDir); + aSrcLoc.Transform(aTrsf); + gp_Vec aTrans = aDstLoc - aSrcLoc; aTrsf.SetTransformation(aRot, aTrans); // Transform the shape with copying it diff --cc src/Model/Model_AttributeRefList.cpp index effa56db2,effa56db2..c97228358 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@@ -16,6 -16,6 +16,12 @@@ void Model_AttributeRefList::append(Obj { std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); myRef->Append(aData->label().Father()); // store label of the object ++ // do it before the transaction finish to make just created/removed objects know dependencies ++ // and reference from composite feature is removed automatically ++ FeaturePtr anOwnerFeature = std::dynamic_pointer_cast(owner()); ++ if (anOwnerFeature.get()) { ++ aData->addBackReference(anOwnerFeature, id()); ++ } owner()->data()->sendAttributeUpdated(this); } diff --cc src/Model/Model_AttributeReference.cpp index 43bbabe65,43bbabe65..91de64eb5 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@@ -22,9 -22,9 +22,9 @@@ void Model_AttributeReference::setValue if(!theObject) return; if (!myIsInitialized || value() != theObject) { -- std::shared_ptr aData = std::dynamic_pointer_cast( -- theObject->data()); -- TDF_Label anObjLab = aData->label().Father(); // object label ++ std::shared_ptr aData = std::dynamic_pointer_cast( ++ theObject->data()); ++ TDF_Label anObjLab = aData->label().Father(); // object label if (owner()->document() == theObject->document()) { // same document, use reference attribute @@@ -41,6 -41,6 +41,12 @@@ TDF_Tool::Entry(anObjLab, anEntry); TDataStd_AsciiString::Set(myRef->Label(), anEntry); } ++ // do it before the transaction finish to make just created/removed objects know dependencies ++ // and reference from composite feature is removed automatically ++ FeaturePtr anOwnerFeature = std::dynamic_pointer_cast(owner()); ++ if (anOwnerFeature.get()) { ++ aData->addBackReference(anOwnerFeature, id()); ++ } owner()->data()->sendAttributeUpdated(this); } diff --cc src/SketchPlugin/SketchPlugin_Arc.cpp index f4bc7f93e,f4bc7f93e..0cb74987a --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@@ -190,7 -190,7 +190,7 @@@ double SketchPlugin_Arc::distanceToPoin } bool SketchPlugin_Arc::isFixed() { -- return data()->selection(EXTERNAL_ID())->context().get(); ++ return data()->selection(EXTERNAL_ID())->context().get() != NULL; } bool SketchPlugin_Arc::isFeatureValid() diff --cc src/SketchPlugin/SketchPlugin_Circle.cpp index 50b387414,50b387414..934f40a04 --- a/src/SketchPlugin/SketchPlugin_Circle.cpp +++ b/src/SketchPlugin/SketchPlugin_Circle.cpp @@@ -101,7 -101,7 +101,7 @@@ double SketchPlugin_Circle::distanceToP } bool SketchPlugin_Circle::isFixed() { -- return data()->selection(EXTERNAL_ID())->context().get(); ++ return data()->selection(EXTERNAL_ID())->context().get() != NULL; } void SketchPlugin_Circle::attributeChanged(const std::string& theID) { diff --cc src/SketchPlugin/SketchPlugin_Line.cpp index f0c76538a,f0c76538a..ea5d0a42b --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@@ -101,7 -101,7 +101,7 @@@ double SketchPlugin_Line::distanceToPoi } bool SketchPlugin_Line::isFixed() { -- return data()->selection(EXTERNAL_ID())->context().get(); ++ return data()->selection(EXTERNAL_ID())->context().get() != NULL; } void SketchPlugin_Line::attributeChanged(const std::string& theID) { diff --cc src/SketchPlugin/SketchPlugin_Point.cpp index 798140611,798140611..036fde19d --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@@ -73,7 -73,7 +73,7 @@@ double SketchPlugin_Point::distanceToPo } bool SketchPlugin_Point::isFixed() { -- return data()->selection(EXTERNAL_ID())->context().get(); ++ return data()->selection(EXTERNAL_ID())->context().get() != NULL; } void SketchPlugin_Point::attributeChanged(const std::string& theID) { diff --cc src/SketchPlugin/SketchPlugin_Sketch.cpp index 2736bd848,365db4ca6..b57c1e3ba --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@@ -117,7 -114,10 +114,7 @@@ void SketchPlugin_Sketch::execute( for (; aShapeIt != aFeaturesPreview.end(); ++aShapeIt) { aBigWire->addEdge(*aShapeIt); } - aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir()); + aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aNorm->dir()); - -// GeomAlgoAPI_SketchBuilder::createFaces(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir(), -// aFeaturesPreview, aLoops, aWires); std::shared_ptr aConstr = document()->createConstruction(data()); aConstr->setShape(aBigWire); setResult(aConstr);