1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0028714: Dimension of TDataStd_Real is not serialized to document

Added a comments and Standard_DEPRECATED macros to obsolete methods that these methods will be removed and that the corresponding field myDimension is not stored in the document.
This commit is contained in:
mpv 2017-05-30 11:49:26 +03:00 committed by bugmaster
parent fa6fc587b9
commit 58e5d30edc
7 changed files with 46 additions and 9 deletions

View File

@ -68,10 +68,12 @@ void DDataStd::DumpConstraint (const Handle(TDataXtd_Constraint)& CTR, Standard_
anOS << " V (";
TDF_Tool::Entry(CTR->GetValue()->Label(),S);
anOS << S << ") ";
TDataStd_RealEnum t = CTR->GetValue()->GetDimension();
Standard_DISABLE_DEPRECATION_WARNINGS
TDataStd_RealEnum t = CTR->GetValue()->GetDimension();
TDataStd::Print(t,anOS);
Standard_Real val = CTR->GetValue()->Get();
if (t == TDataStd_ANGULAR) val = (180.*val)/M_PI;
Standard_ENABLE_DEPRECATION_WARNINGS
anOS << " ";
anOS << val;
}

View File

@ -339,7 +339,9 @@ Handle(Draw_Drawable3D) DDataStd_DrawDriver::DrawableConstraint (const Handle(TD
if (!D.IsNull()) {
if (!A->GetValue().IsNull()) {
Standard_Real val = A->GetValue()->Get();
if (A->GetValue()->GetDimension() == TDataStd_ANGULAR) val = (180.*val)/M_PI;
Standard_DISABLE_DEPRECATION_WARNINGS
if (A->GetValue()->GetDimension() == TDataStd_ANGULAR) val = (180. * val) / M_PI;
Standard_ENABLE_DEPRECATION_WARNINGS
D->SetValue(val);
}
// unverified constraints are red (default is white)

View File

@ -37,9 +37,11 @@ public:
//! Import transient attribuite from the persistent data.
void Import (const Handle(TDataStd_Real)& theAttribute) const
{
theAttribute->Set (myValue);
theAttribute->Set (myValue);
Standard_DISABLE_DEPRECATION_WARNINGS
theAttribute->SetDimension (static_cast<TDataStd_RealEnum> (myDimension));
theAttribute->SetID(TDataStd_Real::GetID());
Standard_ENABLE_DEPRECATION_WARNINGS
theAttribute->SetID (TDataStd_Real::GetID());
}
private:

View File

@ -204,7 +204,9 @@ void TDataStd_Real::Restore(const Handle(TDF_Attribute)& With)
{
Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (With);
myValue = R->Get();
Standard_DISABLE_DEPRECATION_WARNINGS
myDimension = R->GetDimension();
Standard_ENABLE_DEPRECATION_WARNINGS
myID = R->ID();
}
@ -220,7 +222,9 @@ void TDataStd_Real::Paste (const Handle(TDF_Attribute)& Into,
{
Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (Into);
R->Set(myValue);
Standard_DISABLE_DEPRECATION_WARNINGS
R->SetDimension(myDimension);
Standard_ENABLE_DEPRECATION_WARNINGS
R->SetID(myID);
}
@ -232,7 +236,9 @@ void TDataStd_Real::Paste (const Handle(TDF_Attribute)& Into,
Standard_OStream& TDataStd_Real::Dump (Standard_OStream& anOS) const
{
anOS << "Real ";
TDataStd::Print(GetDimension(),anOS);
Standard_DISABLE_DEPRECATION_WARNINGS
TDataStd::Print(GetDimension(), anOS);
Standard_ENABLE_DEPRECATION_WARNINGS
anOS << myValue;
Standard_Character sguid[Standard_GUID_SIZE_ALLOC];
myID.ToCString(sguid);

View File

@ -63,8 +63,14 @@ public:
Standard_EXPORT TDataStd_Real();
//! Obsolete method that will be removed in next versions.
//! This field is not supported in the persistence mechanism.
Standard_DEPRECATED("TDataStd_Real::SetDimension() is deprecated. Please avoid usage of this method.")
Standard_EXPORT void SetDimension (const TDataStd_RealEnum DIM);
//! Obsolete method that will be removed in next versions.
//! This field is not supported in the persistence mechanism.
Standard_DEPRECATED("TDataStd_Real::GetDimension() is deprecated. Please avoid usage of this method.")
Standard_EXPORT TDataStd_RealEnum GetDimension() const;
@ -107,6 +113,7 @@ private:
Standard_Real myValue;
//! An obsolete field that will be removed in next versions.
TDataStd_RealEnum myDimension;
Standard_GUID myID;

View File

@ -114,6 +114,18 @@ Handle(TDataStd_Real) TDataStd_Variable::Real() const
return R;
}
//=======================================================================
//function : Set
//purpose :
//=======================================================================
void TDataStd_Variable::Set (const Standard_Real value) const
{
Handle(TDataStd_Real) R = TDataStd_Real::Set(Label(), value);
}
//=======================================================================
//function : Set
//purpose :
@ -123,7 +135,9 @@ void TDataStd_Variable::Set (const Standard_Real value, const TDataStd_RealEnum
{
if (!IsValued()) {
Handle(TDataStd_Real) R = TDataStd_Real::Set(Label(),value);
Standard_DISABLE_DEPRECATION_WARNINGS
R->SetDimension (dimension);
Standard_ENABLE_DEPRECATION_WARNINGS
}
else {
Handle(TDataStd_Real) R = TDataStd_Real::Set(Label(),value);

View File

@ -76,12 +76,16 @@ public:
//! returns string stored in the associated Name
//! attribute.
Standard_EXPORT const TCollection_ExtendedString& Name() const;
//! retrieve or create the associated real attribute and
//! set the value <value>. if creation, dimension is
//! written.
Standard_EXPORT void Set (const Standard_Real value, const TDataStd_RealEnum dimension = TDataStd_SCALAR) const;
//! set the value <value>.
Standard_EXPORT void Set (const Standard_Real value) const;
//! Obsolete method that will be removed in next versions.
//! The dimension argument is not supported in the persistence mechanism.
Standard_DEPRECATED("TDataStd_Variable::Set(value, dimension) is deprecated. Please use TDataStd_Variable::Set(value) instead.")
Standard_EXPORT void Set (const Standard_Real value, const TDataStd_RealEnum dimension) const;
//! returns True if a Real attribute is associated.
Standard_EXPORT Standard_Boolean IsValued() const;