From efd4b232bf6786c2f75cb6f84dfe61ca19135a3e Mon Sep 17 00:00:00 2001 From: szy Date: Fri, 14 Sep 2012 17:18:59 +0400 Subject: [PATCH] 0023119: TNaming_Selector::Solve() fails (changes from single face to compound of multiple faces) Patch for Naming improvement. 1). Added persistence. 2). Removed not supported evolution - Replace. Fix of QADraw commands. Modified test case: caf named_shape F6 1). Redesigned DNaming commands: SelectShape & SolveSelection 2). Added 2 new scripts: F8 & F9 Adding test cases caf/named_shape/F8 F9 --- src/DNaming/DNaming_SelectionCommands.cxx | 87 +++++++++++++++++---- src/TNaming/TNaming_Name.cxx | 4 +- src/TNaming/TNaming_Naming.cxx | 11 ++- tests/caf/named_shape/E1 | 23 +++++- tests/caf/named_shape/E2 | 27 +++++-- tests/caf/named_shape/E3 | 21 ++++- tests/caf/named_shape/E4 | 21 ++++- tests/caf/named_shape/E5 | 21 ++++- tests/caf/named_shape/E6 | 24 +++++- tests/caf/named_shape/E7 | 53 +++++++------ tests/caf/named_shape/E8 | 38 +++++---- tests/caf/named_shape/E9 | 24 +++++- tests/caf/named_shape/F1 | 60 +++++++-------- tests/caf/named_shape/F2 | 24 +++++- tests/caf/named_shape/F3 | 36 +++++++-- tests/caf/named_shape/F4 | 25 +++++- tests/caf/named_shape/F5 | 39 ++++++---- tests/caf/named_shape/F6 | 53 ++++++++----- tests/caf/named_shape/F7 | 54 ++++++++----- tests/caf/named_shape/F8 | 94 +++++++++++++++++++++++ tests/caf/named_shape/F9 | 93 ++++++++++++++++++++++ 21 files changed, 655 insertions(+), 177 deletions(-) create mode 100755 tests/caf/named_shape/F8 create mode 100755 tests/caf/named_shape/F9 diff --git a/src/DNaming/DNaming_SelectionCommands.cxx b/src/DNaming/DNaming_SelectionCommands.cxx index b21d52f69c..8a2039dadb 100755 --- a/src/DNaming/DNaming_SelectionCommands.cxx +++ b/src/DNaming/DNaming_SelectionCommands.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,7 @@ #include #include #include +#include #include #include @@ -115,7 +117,7 @@ static void DumpNaming (const Handle(TNaming_Naming)& naming, Draw_Interpretor& static Standard_Integer DNaming_Select (Draw_Interpretor& di, Standard_Integer n, const char** a) { if (n > 3) { - Standard_Boolean geometry = (strcmp(a[0],"SelectGeometry")); + Standard_Boolean geometry = !(strcmp(a[0],"SelectGeometry")); Handle(TDF_Data) DF; if(!DDF::GetDF(a[1], DF)) return 1; TDF_Label L; @@ -137,7 +139,51 @@ static Standard_Integer DNaming_Select (Draw_Interpretor& di, Standard_Integer n di << "DNaming_Select : Error" << "\n"; return 1; } +// #define DEB_SELN 1 +//======================================================================= +//function : FillValidMap +//purpose : +//======================================================================= +Standard_Boolean FillValidMap(const TDF_Label& theLabel, TDF_LabelMap& theValidMap) +{ + Standard_Boolean extRefFound = Standard_False; + TDF_AttributeMap anExtMap; +#ifdef DEB_SELN + TCollection_AsciiString entr1; + TDF_Tool::Entry(theLabel, entr1); + cout<<"\tNaming Attribute at = "<< entr1 <Solve(); - //Handle(TNaming_NamedShape) NS; - //if (!L.FindAttribute(TNaming_NamedShape::GetID(),NS)) { - // cout <<"DNaming_DumpSelection : not done" << endl; - // return 1; - //} + DDF::AddLabel(DF,a[2],L); + + Handle(TNaming_Naming) naming; + if (!L.FindAttribute(TNaming_Naming::GetID(),naming)) { + cout <<"DNaming__SolveSelection : not a selection" << endl; + return 1; + } + TDF_LabelMap aValidMap; + if(!FillValidMap(L,aValidMap)) + di << "Valid map is empty" << "\n"; +#ifdef DEB_SELN + cout<<"== Valid Label map =="<Label()); + cout <<"AppendNS = " ; + Print_Entry(NS->Label()); #endif //--------------------- // Naming des voisins. @@ -856,8 +859,14 @@ static Standard_Boolean Filter (const TDF_Label& F, const TopoDS_Shape& aS2 = aNS->Get(); if(!aS.IsNull()) cout << "Shape arg type = " << aS.ShapeType() <<" TSH = " << aS.TShape()->This()<