mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
Compare commits
3 Commits
CR33658
...
IR-2024-04
Author | SHA1 | Date | |
---|---|---|---|
|
b78ccf1f9b | ||
|
2956d432e2 | ||
|
d3e00bfaa6 |
@@ -808,8 +808,11 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
|
||||
const Standard_Integer aNbp = lastP - firstP + 1;
|
||||
|
||||
|
||||
// The first parameter should always be zero according to all the logic below,
|
||||
// so division by any value will give zero anyway, so it should never be scaled
|
||||
// to avoid case when there is only one parameter in the array thus division by zero happens.
|
||||
TheParameters(firstP) = 0.0;
|
||||
if (aNbp == 2) {
|
||||
TheParameters(firstP) = 0.0;
|
||||
TheParameters(lastP) = 1.0;
|
||||
}
|
||||
else if (Par == Approx_ChordLength || Par == Approx_Centripetal)
|
||||
@@ -820,7 +823,6 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
|
||||
if (nbP3d == 0) mynbP3d = 1;
|
||||
if (nbP2d == 0) mynbP2d = 1;
|
||||
|
||||
TheParameters(firstP) = 0.0;
|
||||
dist = 0.0;
|
||||
TColgp_Array1OfPnt tabP(1, mynbP3d);
|
||||
TColgp_Array1OfPnt tabPP(1, mynbP3d);
|
||||
@@ -861,10 +863,10 @@ void Approx_BSplComputeLine::Parameters(const MultiLine& Line,
|
||||
TheParameters(i) = TheParameters(i - 1) + Sqrt(dist);
|
||||
}
|
||||
}
|
||||
for (i = firstP; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
|
||||
for (i = firstP + 1; i <= lastP; i++) TheParameters(i) /= TheParameters(lastP);
|
||||
}
|
||||
else {
|
||||
for (i = firstP; i <= lastP; i++) {
|
||||
for (i = firstP + 1; i <= lastP; i++) {
|
||||
TheParameters(i) = (Standard_Real(i) - firstP) /
|
||||
(Standard_Real(lastP - Standard_Real(firstP)));
|
||||
}
|
||||
|
@@ -515,8 +515,13 @@ BSplCLib::EvalBsplineBasis
|
||||
//
|
||||
// this should be always invertible if ii is correctly computed
|
||||
//
|
||||
Factor = (Parameter - FlatKnots(ii - qq + pp + 1))
|
||||
/ (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1)) ;
|
||||
const Standard_Real aScale = (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1));
|
||||
if (Abs (aScale) < gp::Resolution())
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
Factor = (Parameter - FlatKnots(ii - qq + pp + 1)) / aScale;
|
||||
Saved = Factor * BsplineBasis(1,pp) ;
|
||||
BsplineBasis(1,pp) *= (1.0e0 - Factor) ;
|
||||
BsplineBasis(1,pp) += BsplineBasis(1,qq) ;
|
||||
@@ -536,7 +541,13 @@ BSplCLib::EvalBsplineBasis
|
||||
}
|
||||
|
||||
for (pp = 1 ; pp <= qq - 1 ; pp++) {
|
||||
Inverse = 1.0e0 / (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1)) ;
|
||||
const Standard_Real aScale = (FlatKnots(ii + pp) - FlatKnots(ii - qq + pp + 1));
|
||||
if (Abs (aScale) < gp::Resolution())
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
Inverse = 1.0e0 / aScale;
|
||||
Factor = (Parameter - FlatKnots(ii - qq + pp + 1)) * Inverse ;
|
||||
Saved = Factor * BsplineBasis(1,pp) ;
|
||||
BsplineBasis(1,pp) *= (1.0e0 - Factor) ;
|
||||
|
@@ -33,6 +33,7 @@
|
||||
#include <Storage_Schema.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <TDataStd_TreeNode.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
#include <TDF_Data.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
@@ -324,7 +325,16 @@ void BinLDrivers_DocumentRetrievalDriver::Read (Standard_IStream&
|
||||
// read sub-tree of the root label
|
||||
if (!theFilter.IsNull())
|
||||
theFilter->StartIteration();
|
||||
Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root(), theFilter, aQuickPart, aPS.Next());
|
||||
const auto aStreamStartPosition = theIStream.tellg();
|
||||
Standard_Integer nbRead = ReadSubTree (theIStream, aData->Root(), theFilter, aQuickPart, Standard_False, aPS.Next());
|
||||
if (!myUnresolvedLinks.IsEmpty())
|
||||
{
|
||||
// In case we have skipped some linked TreeNodes before getting to
|
||||
// their children.
|
||||
theFilter->StartIteration();
|
||||
theIStream.seekg(aStreamStartPosition, std::ios_base::beg);
|
||||
nbRead += ReadSubTree(theIStream, aData->Root(), theFilter, aQuickPart, Standard_True, aPS.Next());
|
||||
}
|
||||
if (!aPS.More())
|
||||
{
|
||||
myReaderStatus = PCDM_RS_UserBreak;
|
||||
@@ -373,6 +383,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
const TDF_Label& theLabel,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter,
|
||||
const Standard_Boolean& theQuickPart,
|
||||
const Standard_Boolean theReadMissing,
|
||||
const Message_ProgressRange& theRange)
|
||||
{
|
||||
Standard_Integer nbRead = 0;
|
||||
@@ -393,7 +404,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
aLabelSize = InverseUint64(aLabelSize);
|
||||
#endif
|
||||
// no one sub-label is needed, so, skip everything
|
||||
if (aSkipAttrs && !theFilter->IsSubPassed())
|
||||
if (aSkipAttrs && !theFilter->IsSubPassed() && myUnresolvedLinks.IsEmpty())
|
||||
{
|
||||
aLabelSize -= sizeof (uint64_t);
|
||||
theIS.seekg (aLabelSize, std::ios_base::cur);
|
||||
@@ -403,6 +414,11 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
}
|
||||
}
|
||||
|
||||
if (theReadMissing)
|
||||
{
|
||||
aSkipAttrs = Standard_True;
|
||||
}
|
||||
const auto anAttStartPosition = theIS.tellg();
|
||||
// Read attributes:
|
||||
for (theIS >> myPAtt;
|
||||
theIS && myPAtt.TypeId() > 0 && // not an end marker ?
|
||||
@@ -415,6 +431,12 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
myReaderStatus = PCDM_RS_UserBreak;
|
||||
return -1;
|
||||
}
|
||||
if (myUnresolvedLinks.Remove(myPAtt.Id()) && aSkipAttrs)
|
||||
{
|
||||
aSkipAttrs = Standard_False;
|
||||
theIS.seekg(anAttStartPosition, std::ios_base::beg);
|
||||
continue;
|
||||
}
|
||||
if (aSkipAttrs)
|
||||
{
|
||||
if (myPAtt.IsDirect()) // skip direct written stream
|
||||
@@ -487,7 +509,17 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
aDriver->TypeName(), Message_Warning);
|
||||
}
|
||||
else if (!isBound)
|
||||
{
|
||||
myRelocTable.Bind(anID, tAtt);
|
||||
Handle(TDataStd_TreeNode) aNode = Handle(TDataStd_TreeNode)::DownCast(tAtt);
|
||||
if (!theFilter.IsNull() && !aNode.IsNull() && !aNode->Father().IsNull() && aNode->Father()->IsNew())
|
||||
{
|
||||
Standard_Integer anUnresolvedLink;
|
||||
myPAtt.SetPosition(BP_HEADSIZE);
|
||||
myPAtt >> anUnresolvedLink;
|
||||
myUnresolvedLinks.Add(anUnresolvedLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!myMapUnsupported.Contains(myPAtt.TypeId()))
|
||||
myMsgDriver->Send(aMethStr + "warning: type ID not registered in header: "
|
||||
@@ -522,7 +554,7 @@ Standard_Integer BinLDrivers_DocumentRetrievalDriver::ReadSubTree
|
||||
// read sub-tree
|
||||
if (!theFilter.IsNull())
|
||||
theFilter->Down (aTag);
|
||||
Standard_Integer nbSubRead = ReadSubTree (theIS, aLab, theFilter, theQuickPart, aPS.Next());
|
||||
Standard_Integer nbSubRead = ReadSubTree (theIS, aLab, theFilter, theQuickPart, theReadMissing, aPS.Next());
|
||||
// check for error
|
||||
if (nbSubRead == -1)
|
||||
return -1;
|
||||
|
@@ -80,6 +80,7 @@ protected:
|
||||
const TDF_Label& theData,
|
||||
const Handle(PCDM_ReaderFilter)& theFilter,
|
||||
const Standard_Boolean& theQuickPart,
|
||||
const Standard_Boolean theReadMissing,
|
||||
const Message_ProgressRange& theRanges = Message_ProgressRange());
|
||||
|
||||
|
||||
@@ -125,6 +126,7 @@ private:
|
||||
BinObjMgt_Persistent myPAtt;
|
||||
TColStd_MapOfInteger myMapUnsupported;
|
||||
BinLDrivers_VectorOfDocumentSection mySections;
|
||||
NCollection_Map<Standard_Integer> myUnresolvedLinks;
|
||||
|
||||
|
||||
};
|
||||
|
@@ -2134,11 +2134,12 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
return Standard_False;
|
||||
}
|
||||
Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
|
||||
Handle(StepVisual_AnnotationOccurrence) anAO;
|
||||
Handle(StepVisual_StyledItem) anAO;
|
||||
NCollection_Vector<Handle(StepVisual_StyledItem)> anAnnotations;
|
||||
if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)))
|
||||
if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)) ||
|
||||
thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_TessellatedAnnotationOccurrence)))
|
||||
{
|
||||
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(thePresentEntity);
|
||||
anAO = Handle(StepVisual_StyledItem)::DownCast(thePresentEntity);
|
||||
if (!anAO.IsNull())
|
||||
{
|
||||
thePresentName = anAO->Name();
|
||||
@@ -4368,7 +4369,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
}
|
||||
}
|
||||
else if (anEnt->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout)) ||
|
||||
anEnt->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)))
|
||||
anEnt->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)) ||
|
||||
anEnt->IsKind(STANDARD_TYPE(StepVisual_TessellatedAnnotationOccurrence)))
|
||||
{
|
||||
// Protection against import presentation twice
|
||||
Handle(StepVisual_DraughtingCallout) aDC;
|
||||
|
11
tests/bugs/xde/bug33616
Normal file
11
tests/bugs/xde/bug33616
Normal file
@@ -0,0 +1,11 @@
|
||||
puts "========"
|
||||
puts "0033616: Data Exchange - Using filter while reading XBF may result in unresolved links"
|
||||
puts "========"
|
||||
|
||||
pload ALL
|
||||
|
||||
XOpen [locate_data_file bug28905_as1-oc-214.xbf] D -read0:1:1:2:1
|
||||
XGetShape sh D 0:1:1:2:1
|
||||
checknbshapes sh -solid 1
|
||||
|
||||
Close D
|
@@ -3,12 +3,12 @@ set filename bug29362_MMT200.stp
|
||||
|
||||
set ref_data {
|
||||
|
||||
NbOfDimensions : 2
|
||||
NbOfDimensions : 4
|
||||
NbOfDimensionalSize : 1
|
||||
NbOfDimensionalLocation: 1
|
||||
NbOfAngular : 0
|
||||
NbOfWithPath : 0
|
||||
NbOfCommonLabels : 0
|
||||
NbOfCommonLabels : 1
|
||||
NbOfTolerances : 0
|
||||
NbOfGTWithModifiers : 0
|
||||
NbOfGTWithMaxTolerance : 0
|
||||
|
92
tests/gdt/import/A6
Normal file
92
tests/gdt/import/A6
Normal file
@@ -0,0 +1,92 @@
|
||||
# !!!! This file is generated automatically, do not edit manually! See end script
|
||||
set filename bug33661_nist_ftc_08_asme1_ap242-e1-tg.stp
|
||||
|
||||
set ref_data {
|
||||
|
||||
NbOfDimensions : 60
|
||||
NbOfTolerances : 0
|
||||
NbOfDatumFeature : 0
|
||||
NbOfAttachedDatum : 0
|
||||
NbOfDatumTarget : 0
|
||||
|
||||
0:1:1:2:1 Shape.4
|
||||
0:1:4:32 Dimension.4.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:2 Shape.5
|
||||
0:1:4:4 Dimension.5.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:5 Dimension.5.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:4 Shape.7
|
||||
0:1:4:14 Dimension.7.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:18 Dimension.7.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:20 Dimension.7.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:14 Shape.17
|
||||
0:1:4:27 Dimension.17.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:62 Shape.65
|
||||
0:1:4:35 Dimension.65.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:65 Shape.68
|
||||
0:1:4:36 Dimension.68.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:72 Shape.75
|
||||
0:1:4:53 Dimension.75.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:84 Shape.87
|
||||
0:1:4:54 Dimension.87.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:90 Shape.93
|
||||
0:1:4:31 Dimension.93.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:33 Dimension.93.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:34 Dimension.93.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:94 Shape.97
|
||||
0:1:4:39 Dimension.97.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:40 Dimension.97.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:51 Dimension.97.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:52 Dimension.97.4 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:55 Dimension.97.5 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:96 Shape.99
|
||||
0:1:4:43 Dimension.99.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:44 Dimension.99.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:45 Dimension.99.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:46 Dimension.99.4 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:57 Dimension.99.5 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:98 Shape.101
|
||||
0:1:4:47 Dimension.101.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:48 Dimension.101.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:49 Dimension.101.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:50 Dimension.101.4 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:56 Dimension.101.5 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:100 Shape.103
|
||||
0:1:4:37 Dimension.103.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:38 Dimension.103.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:41 Dimension.103.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:42 Dimension.103.4 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:58 Dimension.103.5 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:102 Shape.105
|
||||
0:1:4:25 Dimension.105.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:26 Dimension.105.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:116 Shape.119
|
||||
0:1:4:24 Dimension.119.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:120 Shape.123
|
||||
0:1:4:23 Dimension.123.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:161 Shape.164
|
||||
0:1:4:15 Dimension.164.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:179 Shape.182
|
||||
0:1:4:1 Dimension.182.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:2 Dimension.182.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:3 Dimension.182.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:237 Shape.240
|
||||
0:1:4:17 Dimension.240.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:19 Dimension.240.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:246 Shape.249
|
||||
0:1:4:6 Dimension.249.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:8 Dimension.249.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:9 Dimension.249.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:248 Shape.251
|
||||
0:1:4:7 Dimension.251.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:10 Dimension.251.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:11 Dimension.251.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:250 Shape.253
|
||||
0:1:4:12 Dimension.253.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:13 Dimension.253.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:2:256 Shape.259
|
||||
0:1:4:28 Dimension.259.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:29 Dimension.259.2 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:4:30 Dimension.259.3 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
0:1:1:3:1 Shape.276
|
||||
0:1:4:16 Dimension.276.1 ( N "DGT:Dimension" T 31, V 0, P 0 )
|
||||
}
|
@@ -2,7 +2,13 @@
|
||||
set filename bug29362_MMT200.stp
|
||||
|
||||
set ref_data {
|
||||
Centre of mass: 0 0 0
|
||||
Mass: 0
|
||||
Centre of mass: 13.412719368151439 6.1818909424750705 -13.415402720911091
|
||||
Mass: 252.25931515680639
|
||||
|
||||
}
|
||||
|
||||
set ref_data_write {
|
||||
Centre of mass: 13.412719368151233 6.1818909424748316 -13.415402720907935
|
||||
Mass: 252.25931515678892
|
||||
|
||||
}
|
||||
|
16
tests/gdt/presentation/C3
Normal file
16
tests/gdt/presentation/C3
Normal file
@@ -0,0 +1,16 @@
|
||||
# !!!! This file is generated automatically, do not edit manually! See end script
|
||||
puts "TODO CR11111 ALL: Error on writing file"
|
||||
|
||||
set filename bug33661_nist_ftc_08_asme1_ap242-e1-tg.stp
|
||||
|
||||
set ref_data {
|
||||
Centre of mass: -62.99891835601813 78.203476181663817 20.269103705327481
|
||||
Mass: 47784.542040997127
|
||||
|
||||
}
|
||||
|
||||
set ref_data_write {
|
||||
Centre of mass: -261.12759307366923 196.9986700086933 -13.86055926862322
|
||||
Mass: 17568.06377585962
|
||||
|
||||
}
|
Reference in New Issue
Block a user