1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Compare commits

..

8 Commits

Author SHA1 Message Date
ichesnok
be6e4c39e4 // fix 2023-06-20 22:33:56 +01:00
dpasukhi
bc456bd3d2 // implemented start and end time code 2023-06-20 22:33:56 +01:00
dpasukhi
fe9a338c22 // fixed logic problems 2023-06-20 22:33:55 +01:00
dpasukhi
d5aa331d56 // fixed compilation problem 2023-06-20 22:33:55 +01:00
dpasukhi
0422f36fda // completed base animation XCAF getting/setting object
Going to test on CAD format import
2023-06-20 22:33:55 +01:00
dpasukhi
0421a6be39 // Continued expansion of Animation storage functionality
Updated Operation classes to smart pointer classes
First iteration of Animation getting and setting object
First version of XCAF tool to deal with Animation
Implemented new GUID for clear definition of Animation attributes
2023-06-20 22:33:55 +01:00
dpasukhi
6b6b04e2ce // implement conversion into/from array2
implement getting typeName
2023-06-20 22:33:55 +01:00
dpasukhi
20e7e98e18 0033397: Data Exchange - Implementing support for the Animation storage
Implement basis structure.
Filled basic animation structures.
2023-06-20 22:33:55 +01:00
11 changed files with 22 additions and 231 deletions

View File

@@ -308,15 +308,10 @@ Standard_Boolean BRepTools_GTrsfModification::NewTriangulation(const TopoDS_Face
// modify normals
if (theTriangulation->HasNormals())
{
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbNodes(); ++anInd)
for (Standard_Integer anInd = 1; anInd <= theTriangulation->NbTriangles(); ++anInd)
{
gp_Dir aNormal = theTriangulation->Normal(anInd);
gp_Mat aMat = aGTrsf.VectorialPart();
aMat.SetDiagonal(1., 1., 1.);
gp_Trsf aTrsf;
aTrsf.SetForm(gp_Rotation);
(gp_Mat&)aTrsf.HVectorialPart() = aMat;
aNormal.Transform(aTrsf);
aNormal.Transform(aGTrsf.Trsf());
theTriangulation->SetNormal(anInd, aNormal);
}
}

View File

@@ -538,6 +538,7 @@ Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath
{
theProvider = aNode->BuildProvider();
aNode->GlobalParameters = GlobalParameters;
theProvider->SetNode(aNode);
return Standard_True;
}
}

View File

@@ -125,7 +125,7 @@ Handle(DE_ConfigurationNode) DEXCAFCascade_ConfigurationNode::Copy() const
//=======================================================================
Handle(DE_Provider) DEXCAFCascade_ConfigurationNode::BuildProvider()
{
return new DEXCAFCascade_Provider (this);
return new DEXCAFCascade_Provider();
}
//=======================================================================

View File

@@ -179,10 +179,10 @@ public:
Standard_Integer NbColumns() const { return myUpperCol - myLowerCol + 1; }
//! Returns length of the row, i.e. number of columns
Standard_Integer RowLength() const { return NbColumns(); }
Standard_Integer RowLength() const { return NbRows(); }
//! Returns length of the column, i.e. number of rows
Standard_Integer ColLength() const { return NbRows(); }
Standard_Integer ColLength() const { return NbColumns(); }
//! LowerRow
Standard_Integer LowerRow (void) const

View File

@@ -370,16 +370,6 @@ Standard_Boolean RWMesh_CafReader::addShapeIntoDoc (CafDocumentTools& theTools,
return Standard_False;
}
if (toMakeAssembly)
{
TDF_Label aRefLabel;
theTools.ShapeTool->GetReferredShape(aNewLabel, aRefLabel);
if (!aRefLabel.IsNull())
{
theTools.OriginalShapeMap.Bind(theShape, aRefLabel);
}
}
// if new label is a reference get referred shape
TDF_Label aNewRefLabel = aNewLabel;
theTools.ShapeTool->GetReferredShape (aNewLabel, aNewRefLabel);

View File

@@ -56,7 +56,6 @@ public:
Handle(XCAFDoc_ColorTool) ColorTool;
Handle(XCAFDoc_VisMaterialTool) VisMaterialTool;
NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> ComponentMap;
NCollection_DataMap<TopoDS_Shape, TDF_Label, TopTools_ShapeMapHasher> OriginalShapeMap;
};
public:

View File

@@ -347,7 +347,7 @@ Handle(XCAFAnimObjects_AnimObject) XCAFDoc_Animation::GetObject() const
{
continue;
}
NCollection_Array2<double> aValuesArr(1, aDimAtrArr->Value(2), 1, aDimAtrArr->Value(1));
NCollection_Array2<double> aValuesArr(1, aDimAtrArr->Value(1), 1, aDimAtrArr->Value(2));
int aValuesInd = 1;
for (NCollection_Array2<double>::Iterator aOperValIter(aValuesArr);
aOperValIter.More(); aOperValIter.Next(), aValuesInd++)

View File

@@ -14,7 +14,6 @@
#include <XCAFDoc_AnimationTool.hxx>
#include <Standard_GUID.hxx>
#include <TDataStd_AsciiString.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_Real.hxx>
#include <TDataStd_TreeNode.hxx>
@@ -57,26 +56,6 @@ namespace
static Standard_GUID aEndTimeCodeGUID("EF5305A3-961D-48AE-9A78-AC744A110A26");
return aEndTimeCodeGUID;
}
//=======================================================================
//function : GetFileLengthUnitGUID
//purpose :
//=======================================================================
const Standard_GUID& GetFileLengthUnitGUID()
{
static Standard_GUID aFileLengthUnitGUID("492f5372-9a28-4611-a663-d8394f98df00");
return aFileLengthUnitGUID;
}
//=======================================================================
//function : GetFileLengthUnitGUID
//purpose :
//=======================================================================
const Standard_GUID& GetUpAxisGUID()
{
static Standard_GUID anUpAxisGUID("05d55dd9-7175-44a7-97aa-43909ad6f9c7");
return anUpAxisGUID;
}
}
//=======================================================================
@@ -248,66 +227,6 @@ void XCAFDoc_AnimationTool::SetEndTimeCode(const double theCode) const
TDataStd_Real::Set(BaseLabel(), GetEndTimeCodeGUID(), theCode);
}
//=======================================================================
//function : GetFileLengthUnit
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetFileLengthUnit(double& theLengthUnit) const
{
Handle(TDataStd_Real) aLengthUnitAttr;
if (BaseLabel().FindAttribute(GetFileLengthUnitGUID(), aLengthUnitAttr))
{
theLengthUnit = aLengthUnitAttr->Get();
return true;
}
return false;
}
//=======================================================================
//function : SetFileLengthUnit
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetFileLengthUnit(const double theLengthUnit) const
{
Handle(TDataStd_Real) aLengthUnitAttr;
if (BaseLabel().FindAttribute(GetFileLengthUnitGUID(), aLengthUnitAttr))
{
aLengthUnitAttr->Set(theLengthUnit);
return;
}
TDataStd_Real::Set(BaseLabel(), GetFileLengthUnitGUID(), theLengthUnit);
}
//=======================================================================
//function : GetUpAxis
//purpose :
//=======================================================================
bool XCAFDoc_AnimationTool::GetUpAxis(TCollection_AsciiString& theAxis) const
{
Handle(TDataStd_AsciiString) anAxisAttr;
if (BaseLabel().FindAttribute(GetUpAxisGUID(), anAxisAttr))
{
theAxis = anAxisAttr->Get();
return true;
}
return false;
}
//=======================================================================
//function : SetUpAxis
//purpose :
//=======================================================================
void XCAFDoc_AnimationTool::SetUpAxis(const TCollection_AsciiString theAxis) const
{
Handle(TDataStd_AsciiString) anAxisAttr;
if (BaseLabel().FindAttribute(GetUpAxisGUID(), anAxisAttr))
{
anAxisAttr->Set(theAxis);
return;
}
TDataStd_AsciiString::Set(BaseLabel(), GetUpAxisGUID(), theAxis);
}
//=======================================================================
//function : GetAnimationLabels
//purpose :

View File

@@ -76,18 +76,6 @@ public:
//!
Standard_EXPORT void SetEndTimeCode(const double theCode) const;
//!
Standard_EXPORT bool GetFileLengthUnit(double& theLengthUnit) const;
//!
Standard_EXPORT void SetFileLengthUnit(const double theLengthUnit) const;
//!
Standard_EXPORT bool GetUpAxis(TCollection_AsciiString& theAxis) const;
//!
Standard_EXPORT void SetUpAxis(const TCollection_AsciiString theAxis) const;
//! Returns a sequence of Animation labels currently stored
//! in the Animation table.
Standard_EXPORT void GetAnimationLabels(TDF_LabelSequence& theLabels) const;

View File

@@ -24,7 +24,6 @@
#include <TCollection_HAsciiString.hxx>
#include <TColStd_SequenceOfHAsciiString.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDataStd_TreeNode.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDF_Attribute.hxx>
@@ -52,21 +51,7 @@
IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE(XCAFDoc_ShapeTool,TDataStd_GenericEmpty,"xcaf","ShapeTool")
namespace
{
static Standard_Boolean THE_AUTO_NAMING_FLAG = Standard_True;
static Standard_Boolean THE_UNIFORM_SCALING_SUPPORT_FLAG = Standard_False;
//=======================================================================
//function : GetUniformScaleGUID
//purpose :
//=======================================================================
const Standard_GUID& GetUniformScaleGUID()
{
static Standard_GUID anUniformScaleID("D4DA66EA-EBAD-4775-ACEC-1A018C6A4501");
return anUniformScaleID;
}
}
static Standard_Boolean theAutoNaming = Standard_True;
// attribute methods //////////////////////////////////////////////////
@@ -427,7 +412,7 @@ void XCAFDoc_ShapeTool::MakeReference (const TDF_Label &L,
refNode->Remove(); // abv: fix against bug in TreeNode::Append()
mainNode->Append(refNode);
if (THE_AUTO_NAMING_FLAG)
if (theAutoNaming)
SetLabelNameByLink(L);
}
@@ -502,7 +487,7 @@ TDF_Label XCAFDoc_ShapeTool::addShape (const TopoDS_Shape& S, const Standard_Boo
// }
A->SetShape(S);
if (THE_AUTO_NAMING_FLAG)
if (theAutoNaming)
SetLabelNameByShape(ShapeLabel);
// if shape is Compound and flag is set, create assembly
@@ -510,7 +495,7 @@ TDF_Label XCAFDoc_ShapeTool::addShape (const TopoDS_Shape& S, const Standard_Boo
// mark assembly by assigning UAttribute
Handle(TDataStd_UAttribute) Uattr;
Uattr = TDataStd_UAttribute::Set ( ShapeLabel, XCAFDoc::AssemblyGUID() );
if (THE_AUTO_NAMING_FLAG)
if (theAutoNaming)
TDataStd_Name::Set(ShapeLabel, TCollection_ExtendedString("ASSEMBLY"));
// iterate on components
@@ -659,89 +644,31 @@ void XCAFDoc_ShapeTool::Init()
//=======================================================================
//function : SetAutoNaming
//purpose :
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::SetAutoNaming (const Standard_Boolean V)
{
THE_AUTO_NAMING_FLAG = V;
theAutoNaming = V;
}
//=======================================================================
//function : AutoNaming
//purpose :
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::AutoNaming()
{
return THE_AUTO_NAMING_FLAG;
return theAutoNaming;
}
//=======================================================================
//function : SetUniformScalingSupport
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::SetUniformScalingSupport(const Standard_Boolean theSupportFlag)
{
THE_UNIFORM_SCALING_SUPPORT_FLAG = theSupportFlag;
}
//=======================================================================
//function : UniformScalingSupport
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::UniformScalingSupport()
{
return THE_UNIFORM_SCALING_SUPPORT_FLAG;
}
//=======================================================================
//function : GetShapeUniformScale
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::GetShapeUniformScale(const TDF_Label& theShLabel,
double& theDX,
double& theDY,
double& theDZ)
{
if (theShLabel.IsNull())
{
return Standard_False;
}
Handle(TDataStd_RealArray) anArrAttr;
if (!theShLabel.FindAttribute(GetUniformScaleGUID(), anArrAttr) ||
anArrAttr->Length() != 3)
{
return Standard_False;
}
theDX = anArrAttr->Value(1);
theDY = anArrAttr->Value(2);
theDZ = anArrAttr->Value(3);
return true;
}
//=======================================================================
//function : SetShapeUniformScale
//purpose :
//=======================================================================
Standard_Boolean XCAFDoc_ShapeTool::SetShapeUniformScale(const TDF_Label& theShLabel,
const double theDX,
const double theDY,
const double theDZ)
{
if (!IsShape(theShLabel))
{
return Standard_False;
}
Handle(TDataStd_RealArray) anArray = TDataStd_RealArray::Set(theShLabel, GetUniformScaleGUID(), 1, 3);
anArray->SetValue(1, theDX);
anArray->SetValue(2, theDY);
anArray->SetValue(3, theDZ);
return true;
}
//=======================================================================
//function : ComputeShapes
//purpose :
//purpose :
//=======================================================================
void XCAFDoc_ShapeTool::ComputeShapes(const TDF_Label& L)
{
TDF_ChildIterator it(L);
@@ -1595,7 +1522,7 @@ Standard_Boolean XCAFDoc_ShapeTool::SetSHUO (const TDF_LabelSequence& labels,
TDF_TagSource aTag;
TDF_Label UpperSubL = aTag.NewChild( labels( 1 ) );
if (THE_AUTO_NAMING_FLAG) {
if (theAutoNaming) {
TCollection_ExtendedString Entry("SHUO");
TDataStd_Name::Set(UpperSubL, TCollection_ExtendedString( Entry ));
}
@@ -1606,7 +1533,7 @@ Standard_Boolean XCAFDoc_ShapeTool::SetSHUO (const TDF_LabelSequence& labels,
// add other next_usage occurrences.
for (i = 2; i <= labels.Length(); i++) {
TDF_Label NextSubL = aTag.NewChild( labels( i ) );
if (THE_AUTO_NAMING_FLAG) {
if (theAutoNaming) {
TCollection_ExtendedString EntrySub("SHUO-");
EntrySub += i;
TDataStd_Name::Set(NextSubL, TCollection_ExtendedString( EntrySub ));

View File

@@ -238,34 +238,6 @@ public:
//! Returns current auto-naming mode. See SetAutoNaming() for
//! description.
Standard_EXPORT static Standard_Boolean AutoNaming();
//! Sets uniform scaling support mode to <theSupportFlag>.
//! If True then some DataExchange components be able to keep
//! uniform scale information into special XCAF attribute.
//!
//! This setting is global; it cannot be made a member function
//! as it is used by static methods as well.
//! By default, uniform scaling support is disable.
//! See also UniformScalingSupport().
Standard_EXPORT static void SetUniformScalingSupport (const Standard_Boolean theSupportFlag);
//! Returns current niform scaling support mode.
//! See SetUniformScalingSupport() for description.
Standard_EXPORT static Standard_Boolean UniformScalingSupport();
//! Gets uniform scale values from the label.
//! @return true if scaling is support and attribute is exist
Standard_EXPORT static Standard_Boolean GetShapeUniformScale(const TDF_Label& theShLabel,
double& theDX,
double& theDY,
double& theDZ);
//! Sets uniform scale values on the label.
//! @return true if scaling is support and label contains shape
Standard_EXPORT static Standard_Boolean SetShapeUniformScale(const TDF_Label& theShLabel,
const double theDX,
const double theDY,
const double theDZ);
//! recursive
Standard_EXPORT void ComputeShapes (const TDF_Label& L);