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

0027304: Implemetation of descriptions for Dimensions

- Add poles with array of descriptions and description names to DimensionObject,
- Modify Import/Export STEP,
- Add Draw commands for descriptions,
- Create test,
- Reorganize end script for test/gdt/dimensions.
This commit is contained in:
ika
2016-04-05 14:53:17 +03:00
committed by bugmaster
parent 6d4bf6d9b1
commit 7644c7f4a1
9 changed files with 316 additions and 75 deletions

View File

@@ -16,7 +16,6 @@
#include <Precision.hxx>
#include <TColgp_HArray1OfPnt.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XCAFDimTolObjects_DimensionObject,Standard_Transient)
//=======================================================================
@@ -443,3 +442,25 @@ void XCAFDimTolObjects_DimensionObject::SetPoints (const Handle(TColgp_HArray1Of
{
myPnts = thePnts;
}
//=======================================================================
//function : RemoveDescription
//purpose :
//=======================================================================
void XCAFDimTolObjects_DimensionObject::RemoveDescription(const Standard_Integer theNumber)
{
if (theNumber < myDescriptions.Lower() || theNumber > myDescriptions.Upper())
return;
NCollection_Vector<Handle(TCollection_HAsciiString)> aDescriptions;
NCollection_Vector<Handle(TCollection_HAsciiString)> aDescriptionNames;
for (Standard_Integer i = aDescriptions.Lower(); i < theNumber; i++) {
aDescriptions.Append(myDescriptions.Value(i));
aDescriptionNames.Append(myDescriptionNames.Value(i));
}
for (Standard_Integer i = theNumber + 1; i <= aDescriptions.Upper(); i++) {
aDescriptions.Append(myDescriptions.Value(i));
aDescriptionNames.Append(myDescriptionNames.Value(i));
}
myDescriptions = aDescriptions;
myDescriptionNames = aDescriptionNames;
}

View File

@@ -38,6 +38,8 @@
#include <Standard_Real.hxx>
#include <XCAFDimTolObjects_DimensionModif.hxx>
#include <TCollection_HAsciiString.hxx>
#include <NCollection_Vector.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
class XCAFDimTolObjects_DimensionObject;
DEFINE_STANDARD_HANDLE(XCAFDimTolObjects_DimensionObject, Standard_Transient)
@@ -143,8 +145,6 @@ public:
Standard_EXPORT Standard_Boolean HasPoints() const { return (!myPnts.IsNull() && myPnts->Length() > 0); }
//! Set graphical presentation for object
Standard_EXPORT void SetPresentation(const TopoDS_Shape& thePresentation,
const Handle(TCollection_HAsciiString)& thePresentationName)
@@ -165,6 +165,44 @@ public:
return myPresentationName;
}
//! Returns true, if the object has descriptions
Standard_EXPORT Standard_Boolean HasDescriptions() const
{
return (myDescriptions.Length() > 0);
}
//! Returns number of descriptions
Standard_EXPORT Standard_Integer NbDescriptions() const
{
return myDescriptions.Length();
}
//! Returns description with the given number
Standard_EXPORT Handle(TCollection_HAsciiString) GetDescription(const Standard_Integer theNumber) const
{
if (theNumber < myDescriptions.Lower() || theNumber > myDescriptions.Upper())
return new TCollection_HAsciiString();
return myDescriptions.Value(theNumber);
}
//! Returns name of description with the given number
Standard_EXPORT Handle(TCollection_HAsciiString) GetDescriptionName(const Standard_Integer theNumber) const
{
if (theNumber < myDescriptions.Lower() || theNumber > myDescriptions.Upper())
return new TCollection_HAsciiString();
return myDescriptionNames.Value(theNumber);
}
//! Remove description with the given number
Standard_EXPORT void RemoveDescription(const Standard_Integer theNumber);
//! Add new description
Standard_EXPORT void AddDescription(const Handle(TCollection_HAsciiString) theDescription, const Handle(TCollection_HAsciiString) theName)
{
myDescriptions.Append(theDescription);
myDescriptionNames.Append(theName);
}
DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DimensionObject,Standard_Transient)
private:
@@ -187,6 +225,8 @@ private:
gp_Pnt myPntText;
TopoDS_Shape myPresentation;
Handle(TCollection_HAsciiString) myPresentationName;
NCollection_Vector<Handle(TCollection_HAsciiString)> myDescriptions;
NCollection_Vector<Handle(TCollection_HAsciiString)> myDescriptionNames;
};