1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0031049: OCAF - Error message during Ascii file (std) opening.

This commit is contained in:
szy 2019-11-11 18:18:48 +03:00 committed by bugmaster
parent 1bf23e5bb6
commit 5980a9fb23
4 changed files with 57 additions and 10 deletions

View File

@ -34,6 +34,7 @@
#include <NCollection_Array1.hxx>
#include <NCollection_Handle.hxx>
#include <TDocStd_Document.hxx>
#include <Storage_Schema.hxx>
IMPLEMENT_STANDARD_RTTIEXT (StdLDrivers_DocumentRetrievalDriver, PCDM_RetrievalDriver)
@ -142,6 +143,14 @@ Handle(StdObjMgt_Persistent) StdLDrivers_DocumentRetrievalDriver::read (
aCurTypeName = aTypeData.Type (i);
aCurTypeNum = aTypeData.Type (aCurTypeName);
TCollection_AsciiString newName;
if (Storage_Schema::CheckTypeMigration(aCurTypeName, newName)) {
#ifdef OCCT_DEBUG
std::cout << "CheckTypeMigration:OldType = " << aCurTypeName << " Len = " << aCurTypeNum << std::endl;
std::cout << "CheckTypeMigration:NewType = " << newName << " Len = " << newName.Length() << std::endl;
#endif
aCurTypeName = newName;
}
StdObjMgt_Persistent::Instantiator anInstantiator;
if (aMapOfInst.Find(aCurTypeName, anInstantiator))
anInstantiators (aCurTypeNum) = anInstantiator;

View File

@ -8,5 +8,14 @@ TDataStd_Position TDataXtd_Position
TDataStd_Placement TDataXtd_Placement
TDataStd_PatternStd TDataXtd_PatternStd
TPrsStd_AISPresentation TDataXtd_Presentation
PDataStd_Shape PDataXtd_Shape
PDataStd_Constraint PDataXtd_Constraint
PDataStd_Geometry PDataXtd_Geometry
PDataStd_Axis PDataXtd_Axis
PDataStd_Point PDataXtd_Point
PDataStd_Plane PDataXtd_Plane
PDataStd_Position PDataXtd_Position
PDataStd_Placement PDataXtd_Placement
PDataStd_PatternStd PDataXtd_PatternStd

View File

@ -773,17 +773,26 @@ Standard_Boolean Storage_Schema::CheckTypeMigration(
}
else
{
// hard-code migration table for known types
aDMap.Bind("TDataStd_Shape", "TDataXtd_Shape");
aDMap.Bind("TDataStd_Constraint", "TDataXtd_Constraint");
// hard-code migration table for known types
aDMap.Bind("TDataStd_Shape", "TDataXtd_Shape");
aDMap.Bind("TDataStd_Constraint", "TDataXtd_Constraint");
aDMap.Bind("TDataStd_Geometry", "TDataXtd_Geometry");
aDMap.Bind("TDataStd_Axis", "TDataXtd_Axis");
aDMap.Bind("TDataStd_Point", "TDataXtd_Point");
aDMap.Bind("TDataStd_Plane", "TDataXtd_Plane");
aDMap.Bind("TDataStd_Position", "TDataXtd_Position");
aDMap.Bind("TDataStd_Placement", "TDataXtd_Placement");
aDMap.Bind("TDataStd_PatternStd", "TDataXtd_PatternStd");
aDMap.Bind("TPrsStd_AISPresentation", "TDataXtd_Presentation");
aDMap.Bind("TDataStd_Axis", "TDataXtd_Axis");
aDMap.Bind("TDataStd_Point", "TDataXtd_Point");
aDMap.Bind("TDataStd_Plane", "TDataXtd_Plane");
aDMap.Bind("TDataStd_Position", "TDataXtd_Position");
aDMap.Bind("TDataStd_Placement", "TDataXtd_Placement");
aDMap.Bind("TDataStd_PatternStd", "TDataXtd_PatternStd");
aDMap.Bind("TPrsStd_AISPresentation", "TDataXtd_Presentation");
aDMap.Bind("PDataStd_Shape", "PDataXtd_Shape");
aDMap.Bind("PDataStd_Constraint", "PDataXtd_Constraint");
aDMap.Bind("PDataStd_Geometry", "PDataXtd_Geometry");
aDMap.Bind("PDataStd_Axis", "PDataXtd_Axis");
aDMap.Bind("PDataStd_Point", "PDataXtd_Point");
aDMap.Bind("PDataStd_Plane", "PDataXtd_Plane");
aDMap.Bind("PDataStd_Position", "PDataXtd_Position");
aDMap.Bind("PDataStd_Placement", "PDataXtd_Placement");
aDMap.Bind("PDataStd_PatternStd", "PDataXtd_PatternStd");
}
#ifdef OCCT_DEBUG
std::cout << "Storage_Sheme:: aDataMap.Size = " << aDMap.Extent() << std::endl;

20
tests/bugs/caf/bug31049 Normal file
View File

@ -0,0 +1,20 @@
puts "=================================================================================="
puts "0031049: OCAF document can't be opened, Type not found or Unrecognized File Format"
puts "=================================================================================="
puts ""
Open [locate_data_file bug31049_Npr.std] D
GetPoint D 0:1:2:1:18:1:1:1:1:1:1:1:1:1:1:1:2:5 p1
set info [dump p1]
##*********** Dump of p1 *************
##Point : 2.136843869657140e+03, -3.636437663372889e+02, 9.822340087890625e+02
GetPoint D 0:1:2:1:18:1:1:1:1:1:1:1:1:1:1:3:2:5 p3
set info3 [dump p3]
##*********** Dump of p3 *************
##Point : 2.136843869657140e+03, -3.606482046100116e+02, 9.822340087890625e+02
if {[regexp "Point" $info] != 1 } {puts "Error : There is no Point attribute at the specified label 0:1:2:1:18:1:1:1:1:1:1:1:1:1:1:1:2:5"
} elseif { [regexp "Point" $info3] != 1 } {puts "Error : There is no Point attribute at the specified label 0:1:2:1:18:1:1:1:1:1:1:1:1:1:1:3:2:5"
} else {puts "Bug31049 : OK"; Close D}