mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-05 18:16:23 +03:00
0031168: JT Import - cannot see properties attached to objects
Draw command GetNDStrings was improved to sort the properties by the keys and skip conversions of the strings to type TCollection_AsciiString. Certain Draw commands were corrected to use the Draw interpreter instead of "std::cout". A Tcl procedure was created to compare two multi-line strings.
This commit is contained in:
parent
1c2ddf5612
commit
8bfae263c1
@ -100,6 +100,10 @@
|
|||||||
#include <TDataStd_ReferenceList.hxx>
|
#include <TDataStd_ReferenceList.hxx>
|
||||||
#include <TDF_ListIteratorOfLabelList.hxx>
|
#include <TDF_ListIteratorOfLabelList.hxx>
|
||||||
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
|
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define MAXLENGTH 10
|
#define MAXLENGTH 10
|
||||||
//#define DEB_DDataStd
|
//#define DEB_DDataStd
|
||||||
|
|
||||||
@ -3407,7 +3411,7 @@ static Standard_Integer DDataStd_GetNDIntegers (Draw_Interpretor& di,
|
|||||||
TCollection_ExtendedString aKey(itr.Key());
|
TCollection_ExtendedString aKey(itr.Key());
|
||||||
TCollection_AsciiString aStr(aKey,'?');
|
TCollection_AsciiString aStr(aKey,'?');
|
||||||
Standard_Integer aValue = itr.Value();
|
Standard_Integer aValue = itr.Value();
|
||||||
std::cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<std::endl;
|
di << "Key = " << aStr.ToCString() << " Value = " << aValue << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -3519,7 +3523,7 @@ static Standard_Integer DDataStd_GetNDReals (Draw_Interpretor& di,
|
|||||||
TCollection_ExtendedString aKey(itr.Key());
|
TCollection_ExtendedString aKey(itr.Key());
|
||||||
TCollection_AsciiString aStr(aKey,'?');
|
TCollection_AsciiString aStr(aKey,'?');
|
||||||
Standard_Real aValue = itr.Value();
|
Standard_Real aValue = itr.Value();
|
||||||
std::cout << "Key = " << aStr.ToCString() << " Value = " <<aValue<<std::endl;
|
di << "Key = " << aStr.ToCString() << " Value = " << aValue << "\n";
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3605,6 +3609,19 @@ static Standard_Integer DDataStd_SetNDataStrings (Draw_Interpretor& di,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetNDStrings(DF, entry )
|
//function : GetNDStrings(DF, entry )
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
typedef std::pair<TCollection_ExtendedString, TCollection_ExtendedString>
|
||||||
|
DDataStd_GetNDStrings_Property;
|
||||||
|
|
||||||
|
bool isLess(
|
||||||
|
const DDataStd_GetNDStrings_Property& theProperty1,
|
||||||
|
const DDataStd_GetNDStrings_Property& theProperty2)
|
||||||
|
{
|
||||||
|
return theProperty1.first.IsLess(theProperty2.first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Standard_Integer DDataStd_GetNDStrings (Draw_Interpretor& di,
|
static Standard_Integer DDataStd_GetNDStrings (Draw_Interpretor& di,
|
||||||
Standard_Integer nb,
|
Standard_Integer nb,
|
||||||
const char** arg)
|
const char** arg)
|
||||||
@ -3625,15 +3642,20 @@ static Standard_Integer DDataStd_GetNDStrings (Draw_Interpretor& di,
|
|||||||
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
|
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
|
||||||
anAtt->LoadDeferredData();
|
anAtt->LoadDeferredData();
|
||||||
const TDataStd_DataMapOfStringString& aMap = anAtt->GetStringsContainer();
|
const TDataStd_DataMapOfStringString& aMap = anAtt->GetStringsContainer();
|
||||||
TDataStd_DataMapIteratorOfDataMapOfStringString itr(aMap);
|
|
||||||
for (; itr.More(); itr.Next()){
|
std::vector<DDataStd_GetNDStrings_Property> aProperties;
|
||||||
TCollection_ExtendedString aKey(itr.Key());
|
for (TDataStd_DataMapIteratorOfDataMapOfStringString aIt (aMap); aIt.More(); aIt.Next())
|
||||||
TCollection_AsciiString aStr(aKey,'?');
|
{
|
||||||
TCollection_ExtendedString aVal(itr.Value());
|
aProperties.push_back(DDataStd_GetNDStrings_Property (aIt.Key(), aIt.Value()));
|
||||||
TCollection_AsciiString aStrValue(aVal,'?');
|
}
|
||||||
std::cout << "Key = " << aStr.ToCString() << " Value = " <<aStrValue.ToCString()<< std::endl;
|
std::sort (aProperties.begin(), aProperties.end(), isLess);
|
||||||
}
|
|
||||||
return 0;
|
for (std::vector<DDataStd_GetNDStrings_Property>::size_type aI = 0; aI < aProperties.size(); ++aI)
|
||||||
|
{
|
||||||
|
di << "Key = " << aProperties[aI].first << " Value = " << aProperties[aI].second << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
di << "DDataStd_GetNDStrings : Error\n";
|
di << "DDataStd_GetNDStrings : Error\n";
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1133,4 +1133,32 @@ proc checkgravitycenter {shape prop_type x y z tol} {
|
|||||||
} else {
|
} else {
|
||||||
puts "Error: center of gravity ($comp_x, $comp_y, $comp_z) is not equal to expected ($x, $y, $z)"
|
puts "Error: center of gravity ($comp_x, $comp_y, $comp_z) is not equal to expected ($x, $y, $z)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
help checkMultilineStrings {
|
||||||
|
Compares two strings.
|
||||||
|
Logically splits the strings to lines by the new line characters.
|
||||||
|
Outputs the first different lines.
|
||||||
|
|
||||||
|
Use: checkMultilineStrings <string_1> <string_2>
|
||||||
|
}
|
||||||
|
proc checkMultilineStrings {tS1 tS2} {
|
||||||
|
set aL1 [split $tS1 \n]
|
||||||
|
set aL2 [split $tS2 \n]
|
||||||
|
|
||||||
|
set aC1 [llength $aL1]
|
||||||
|
set aC2 [llength $aL2]
|
||||||
|
set aC [expr {min($aC1, $aC2)}]
|
||||||
|
|
||||||
|
for {set aI 0} {$aI < $aC} {incr aI} {
|
||||||
|
if {[lindex $aL1 $aI] != [lindex $aL2 $aI]} {
|
||||||
|
puts "Error. $aI-th lines are different:"
|
||||||
|
puts "[lindex $aL1 $aI]"
|
||||||
|
puts "[lindex $aL2 $aI]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$aC1 != $aC2} {
|
||||||
|
puts "Error. Line counts are different: $aC1 != $aC2."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user