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

Compare commits

..

1 Commits

Author SHA1 Message Date
abv
1e63a61a4e 0031113: Foundation Classes - TCollection_ExtendedString constructor from CString is confusing
In constructor of TCollection_ExtendedString from Standard_CSTring (const char*), default value for the second argument (isMultiByte) is changed from False to True, for consistency with constructor from TCollection_AsciiString and adopted approach of using UTF-8 encoding for Unicode strings across OCCT.
2020-10-24 22:46:35 +03:00
44 changed files with 336 additions and 592 deletions

View File

@@ -77,8 +77,8 @@ for (aCfgIter, CONFIG) {
# Define the list of standard OCCT file extensions
aHxxRegex = ^.*\.(hxx|h|lxx|gxx)$
aPxxRegex = ^.*\.(pxx)$
aCxxRegex = ^.*\.(cxx|cpp|c)$
mac { aCxxRegex = ^.*\.(cxx|cpp|c|m|mm)$ }
aCxxRegex = ^.*\.(cxx|c)$
mac { aCxxRegex = ^.*\.(cxx|c|m|mm)$ }
# Auxiliary function for probing file extension
defineTest (occCheckExtension) {

View File

@@ -2149,10 +2149,3 @@ For an example, access to labels and attributes could be protected by mutex if t
Draw Harness hotkeys **W** (Wireframe) and **S** (Shaded) have been re-mapped to **Ctrl+W** and **Ctrl+S**.
Hotkey **A** has been remapped to **Backspace**.
Hotkeys WASD and Arrays are now mapped for walk-through navigation in 3D Viewer.
@subsection upgrade_750_msgfile_utf8 Utf-8 encoding for message files
Message files (with extension .msg) are now expected to be in UTF-8 encoding (unless they have UTF-16 BOM in which case UTF-16 is expected).
This allows using arbitrary Unicode symbols for localization of messages.
Existing message files containing 8-bit characters (previously interpreted as characters from Latin-1 code block) should be converted to UTF-8.

View File

@@ -71,7 +71,7 @@ enum ApplicationType
//! Main application window
class ApplicationCommonWindow: public QMainWindow
class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
{
Q_OBJECT

View File

@@ -35,7 +35,7 @@
class ApplicationCommonWindow;
//! Implements visualization of samples content
class DocumentCommon : public QObject
class COMMONSAMPLE_EXPORT DocumentCommon : public QObject
{
Q_OBJECT
public:

View File

@@ -438,9 +438,7 @@ void View::initViewActions()
aHlrActionGroup->addAction(aHlrOnAction);
myViewActions[ViewAction_HlrOn] = aHlrOnAction;
QAction* aTransparencyAction = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"));
connect(aTransparencyAction, SIGNAL(triggered()), this, SLOT(onTransparency()));
myViewActions[ViewAction_Transparency] = aTransparencyAction;
myViewActions[ViewAction_Transparency] = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"));
}
}

View File

@@ -208,7 +208,7 @@ static Standard_Integer DDataStd_SetComment (Draw_Interpretor& di,
if (!DDF::GetDF(arg[1],DF)) return 1;
TDF_Label L;
DDF::AddLabel(DF, arg[2], L);
TDataStd_Comment::Set(L,TCollection_ExtendedString(arg[3],Standard_True));
TDataStd_Comment::Set(L,arg[3]);
return 0;
}
di << "DDataStd_SetComment : Error\n";
@@ -1042,7 +1042,7 @@ static Standard_Integer DDataStd_SetRelation (Draw_Interpretor& di,
Standard_CString expr (arg[3]);
Handle(TDataStd_Relation) aR = TDataStd_Relation::Set(label);
aR->SetRelation(TCollection_ExtendedString (expr, Standard_True));
aR->SetRelation(expr);
Handle(TDataStd_Variable) aV;
for (Standard_Integer i = 4; i < nb; i++)
@@ -1222,8 +1222,7 @@ static Standard_Integer DDataStd_SetExtStringArray (Draw_Interpretor& di,
if ((!isGuid && nb > 6) || (isGuid && nb > 8)) {
j = j + 2;
for(Standard_Integer i = From; i<=To; ++i) {
TCollection_ExtendedString aVal (arg[j], Standard_True);
A->SetValue(i, aVal);
A->SetValue(i, arg[j] );
j++;
}
}
@@ -1257,8 +1256,7 @@ static Standard_Integer DDataStd_SetExtStringArrayValue (Draw_Interpretor&,
Handle(TDataStd_ExtStringArray) arr;
if (label.FindAttribute(TDataStd_ExtStringArray::GetID(), arr))
{
TCollection_ExtendedString aVal(arg[4], Standard_True);
arr->SetValue(index, aVal);
arr->SetValue(index, arg[4]);
return 0;
}
@@ -3446,14 +3444,13 @@ static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
TCollection_ExtendedString aKey(arg[3], Standard_True);
if(!anAtt->HasInteger(aKey)) {
if(!anAtt->HasInteger(arg[3])) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
return 1;
} else {
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(aKey)<<std::endl;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(arg[3])<<std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetInteger(aKey));
Draw::Set(arg[4], anAtt->GetInteger(arg[3]));
return 0;
}
}
@@ -3563,14 +3560,13 @@ static Standard_Integer DDataStd_GetNDReal (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
TCollection_ExtendedString aKey(arg[3], Standard_True);
if(!anAtt->HasReal(aKey)) {
if(!anAtt->HasReal(arg[3])) {
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
} else {
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(aKey)<<std::endl;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetReal(arg[3])<<std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetReal(aKey));
Draw::Set(arg[4], anAtt->GetReal(arg[3]));
return 0;
}
}
@@ -3697,15 +3693,14 @@ static Standard_Integer DDataStd_GetNDString (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
TCollection_ExtendedString aKey(arg[3], Standard_True);
if (!anAtt->HasString(aKey))
if (!anAtt->HasString(arg[3]))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
}
else
{
TCollection_AsciiString aValue (anAtt->GetString(aKey));
TCollection_AsciiString aValue (anAtt->GetString(arg[3]));
std::cout << "Key = " << arg[3] << " Value = " << aValue.ToCString() << std::endl;
if(nb == 5)
Draw::Set(arg[4], aValue.ToCString());
@@ -3820,17 +3815,16 @@ static Standard_Integer DDataStd_GetNDByte (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
TCollection_ExtendedString aKey(arg[3], Standard_True);
if (!anAtt->HasByte(aKey))
if (!anAtt->HasByte(arg[3]))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
}
else
{
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(aKey)<< std::endl;
std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetByte(arg[3])<< std::endl;
if(nb == 5)
Draw::Set(arg[4], anAtt->GetByte(aKey));
Draw::Set(arg[4], anAtt->GetByte(arg[3]));
return 0;
}
}
@@ -3954,8 +3948,7 @@ static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
TCollection_ExtendedString aKey(arg[3], Standard_True);
if (!anAtt->HasArrayOfIntegers(aKey))
if (!anAtt->HasArrayOfIntegers(arg[3]))
{
Message::SendFail() << "There is no data specified by Key = " << arg[3];
return 1;
@@ -3964,7 +3957,7 @@ static Standard_Integer DDataStd_GetNDIntArray (Draw_Interpretor& di,
{
std::cout << "Key = " << arg[3] <<std::endl;
Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(aKey);
Handle(TColStd_HArray1OfInteger) anArrValue = anAtt->GetArrayOfIntegers(arg[3]);
if(!anArrValue.IsNull()) {
Standard_Integer lower = anArrValue->Lower();
Standard_Integer upper = anArrValue->Upper();
@@ -4095,14 +4088,13 @@ static Standard_Integer DDataStd_GetNDRealArray (Draw_Interpretor& di,
std::cout <<std::endl;
std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
anAtt->LoadDeferredData();
TCollection_ExtendedString aKey(arg[3], Standard_True);
if(!anAtt->HasArrayOfReals(aKey)) {
if(!anAtt->HasArrayOfReals(arg[3])) {
std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
return 1;
} else {
std::cout << "Key = " << arg[3] <<std::endl;
Handle(TColStd_HArray1OfReal) anArrValue = anAtt->GetArrayOfReals(aKey);
Handle(TColStd_HArray1OfReal) anArrValue = anAtt->GetArrayOfReals(arg[3]);
if(!anArrValue.IsNull()) {
Standard_Integer lower = anArrValue->Lower();
Standard_Integer upper = anArrValue->Upper();

View File

@@ -64,7 +64,7 @@ static Standard_Integer DDataStd_SetName (Draw_Interpretor& di,
return 1;
}
Standard_GUID guid(arg[4]);
TDataStd_Name::Set(L, guid, TCollection_ExtendedString(arg[3],Standard_True));
TDataStd_Name::Set(L, guid, arg[3]);
}
return 0;
}

View File

@@ -127,7 +127,7 @@ static Standard_Integer DDocStd_Open (Draw_Interpretor& di,
const char** a)
{
if (nb >= 3) {
TCollection_ExtendedString path (a[1], Standard_True);
TCollection_ExtendedString path (a[1]);
Handle(TDocStd_Application) A = DDocStd::GetApplication();
Handle(TDocStd_Document) D;
Standard_Integer insession = A->IsInSession(path);
@@ -245,7 +245,7 @@ static Standard_Integer DDocStd_SaveAs (Draw_Interpretor& di,
if (nb >= 3) {
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(a[1],D)) return 1;
TCollection_ExtendedString path (a[2], Standard_True);
TCollection_ExtendedString path (a[2]);
Handle(TDocStd_Application) A = DDocStd::GetApplication();
PCDM_StoreStatus theStatus;
@@ -423,7 +423,7 @@ static Standard_Integer DDocStd_Path (Draw_Interpretor& di,
const char** a)
{
if (nb == 2) {
TDocStd_PathParser path (TCollection_ExtendedString (a[1], Standard_True));
TDocStd_PathParser path (a[1]);
di << "Trek : " << path.Trek() << "\n";
di << "Name : " << path.Name() << "\n";
di << "Extension : " << path.Extension() << "\n";
@@ -445,7 +445,7 @@ static Standard_Integer DDocStd_AddComment (Draw_Interpretor& di,
if (nb == 3) {
Handle(TDocStd_Document) D;
if (!DDocStd::GetDocument(a[1],D)) return 1;
TCollection_ExtendedString comment (a[2], Standard_True);
TCollection_ExtendedString comment (a[2]);
// Handle(TDocStd_Application) A = DDocStd::GetApplication();
// A->AddComment(D,comment);
D->AddComment(comment);

View File

@@ -109,7 +109,7 @@ static int mtmCommitTransaction (Draw_Interpretor& di, int n, const char** a)
return 1;
}
if(n > 1)
sMultiTransactionManager->CommitCommand(TCollection_ExtendedString (a[1], Standard_True));
sMultiTransactionManager->CommitCommand(a[1]);
else
sMultiTransactionManager->CommitCommand();
return 0;

View File

@@ -453,7 +453,7 @@ static Standard_Integer DNaming_ImportShape (Draw_Interpretor& di,
const TopoDS_Shape& aShape = DBRep::Get(a[3]);
if(aShape.IsNull()) return 1;
if(nb == 5) {
TDataStd_Name::Set(L, TCollection_ExtendedString (a[4], Standard_True));
TDataStd_Name::Set(L, a[4]);
}
DNaming::LoadImportedShape(L, aShape);

View File

@@ -105,7 +105,7 @@ static Standard_Integer DNaming_AddObject(Draw_Interpretor& di,
Handle(TDataStd_UAttribute) anObj = AddObject (aDoc);
if(!anObj.IsNull()) {
if(nb == 3)
TDataStd_Name::Set(anObj->Label(), TCollection_ExtendedString (a[2], Standard_True));
TDataStd_Name::Set(anObj->Label(), a[2]);
DDF::ReturnLabel(di, anObj->Label());
return 0;
}

View File

@@ -598,8 +598,7 @@ GeomFill_NSections::GeomFill_NSections(const TColGeom_SequenceOfCurve& NC,
new Geom_BSplineSurface(anApprox.SurfPoles(), anApprox.SurfWeights(),
anApprox.SurfUKnots(), anApprox.SurfVKnots(),
anApprox.SurfUMults(), anApprox.SurfVMults(),
anApprox.UDegree(), anApprox.VDegree(),
section.IsPeriodic());
anApprox.UDegree(), anApprox.VDegree());
}
else {

View File

@@ -104,10 +104,7 @@ public:
//! theXMin = theYMin = theZMin = RealFirst().
//! theXMax = theYMax = theZMax = RealLast().
//! By default, structure is created not infinite but empty.
void SetInfiniteState (const Standard_Boolean theToSet)
{
if (!myCStructure.IsNull()) { myCStructure->IsInfinite = theToSet ? 1 : 0; }
}
void SetInfiniteState (const Standard_Boolean theToSet) { myCStructure->IsInfinite = theToSet ? 1 : 0; }
//! Modifies the order of displaying the structure.
//! Values are between 0 and 10.
@@ -143,10 +140,7 @@ public:
//! Changes a sequence of clip planes slicing the structure on rendering.
//! @param thePlanes [in] the set of clip planes.
void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes)
{
if (!myCStructure.IsNull()) { myCStructure->SetClipPlanes (thePlanes); }
}
void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { myCStructure->SetClipPlanes (thePlanes); }
//! Get clip planes slicing the structure on rendering.
//! @return set of clip planes.
@@ -171,10 +165,7 @@ public:
Standard_EXPORT void SetZoomLimit (const Standard_Real LimitInf, const Standard_Real LimitSup);
//! Marks the structure <me> representing wired structure needed for highlight only so it won't be added to BVH tree.
void SetIsForHighlight (const Standard_Boolean isForHighlight)
{
if (!myCStructure.IsNull()) { myCStructure->IsForHighlight = isForHighlight; }
}
void SetIsForHighlight (const Standard_Boolean isForHighlight) { myCStructure->IsForHighlight = isForHighlight; }
//! Suppresses the highlight for the structure <me>
//! in all the views of the visualiser.
@@ -231,11 +222,7 @@ public:
Standard_Boolean IsDeleted() const { return myCStructure.IsNull(); }
//! Returns the display indicator for this structure.
virtual Standard_Boolean IsDisplayed() const
{
return !myCStructure.IsNull()
&& myCStructure->stick != 0;
}
virtual Standard_Boolean IsDisplayed() const { return myCStructure->stick != 0; }
//! Returns Standard_True if the structure <me> is empty.
//! Warning: A structure is empty if :
@@ -252,26 +239,17 @@ public:
}
//! Returns the highlight indicator for this structure.
virtual Standard_Boolean IsHighlighted() const
{
return !myCStructure.IsNull()
&& myCStructure->highlight != 0;
}
virtual Standard_Boolean IsHighlighted() const { return myCStructure->highlight != 0; }
//! Returns TRUE if the structure is transformed.
Standard_Boolean IsTransformed() const
{
return !myCStructure.IsNull()
&& !myCStructure->Transformation().IsNull()
&& myCStructure->Transformation()->Form() != gp_Identity;
return !myCStructure->Transformation().IsNull()
&& myCStructure->Transformation()->Form() != gp_Identity;
}
//! Returns the visibility indicator for this structure.
Standard_Boolean IsVisible() const
{
return !myCStructure.IsNull()
&& myCStructure->visible != 0;
}
Standard_Boolean IsVisible() const { return myCStructure->visible != 0; }
//! Returns the coordinates of the boundary box of the structure <me>.
//! If <theToIgnoreInfiniteFlag> is TRUE, the method returns actual graphical
@@ -356,10 +334,7 @@ public:
Standard_Address Owner() const { return myOwner; }
void SetHLRValidation (const Standard_Boolean theFlag)
{
if (!myCStructure.IsNull()) { myCStructure->HLRValidation = theFlag ? 1 : 0; }
}
void SetHLRValidation (const Standard_Boolean theFlag) { myCStructure->HLRValidation = theFlag ? 1 : 0; }
//! Hidden parts stored in this structure are valid if:
//! 1) the owner is defined.
@@ -386,39 +361,23 @@ public:
const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myCStructure->TransformPersistence(); }
//! Sets if the structure location has mutable nature (content or location will be changed regularly).
void SetMutable (const Standard_Boolean theIsMutable)
{
if (!myCStructure.IsNull()) { myCStructure->IsMutable = theIsMutable; }
}
void SetMutable (const Standard_Boolean theIsMutable) { myCStructure->IsMutable = theIsMutable; }
//! Returns true if structure has mutable nature (content or location are be changed regularly).
//! Mutable structure will be managed in different way than static onces.
Standard_Boolean IsMutable() const
{
return !myCStructure.IsNull()
&& myCStructure->IsMutable;
}
Standard_Boolean IsMutable() const { return myCStructure->IsMutable; }
Graphic3d_TypeOfStructure ComputeVisual() const { return myComputeVisual; }
//! Clears the structure <me>.
Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction);
void GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter)
{
if (!myCStructure.IsNull()) { myCStructure->Connect (*theDaughter->myCStructure); }
}
void GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter)
{
if (!myCStructure.IsNull()) { myCStructure->Disconnect (*theDaughter->myCStructure); }
}
void GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Connect (*theDaughter->myCStructure); }
void GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Disconnect (*theDaughter->myCStructure); }
//! Internal method which sets new transformation without calling graphic manager callbacks.
void GraphicTransform (const Handle(TopLoc_Datum3D)& theTrsf)
{
if (!myCStructure.IsNull()) { myCStructure->SetTransformation (theTrsf); }
}
void GraphicTransform (const Handle(TopLoc_Datum3D)& theTrsf) { myCStructure->SetTransformation (theTrsf); }
//! Returns the identification number of this structure.
Standard_Integer Identification() const { return myCStructure->Id; }

View File

@@ -723,14 +723,14 @@ Standard_Boolean IntTools_Context::IsPointInFace
const TopoDS_Face& aF,
const Standard_Real aTol)
{
Standard_Boolean bIn = Standard_False;
Standard_Boolean bIn;
Standard_Real aDist;
//
GeomAPI_ProjectPointOnSurf& aProjector=ProjPS(aF);
aProjector.Perform(aP);
//
Standard_Boolean bDone = aProjector.IsDone();
if (bDone) {
bIn = aProjector.IsDone();
if (bIn) {
aDist = aProjector.LowerDistance();
if (aDist < aTol) {
Standard_Real U, V;

View File

@@ -82,17 +82,13 @@ Standard_Boolean Message_MsgFile::Load (const Standard_CString theDirName,
//Called : from loadFile()
//=======================================================================
template <typename CharType> struct TCollection_String;
template <> struct TCollection_String <Standard_Character> { typedef TCollection_AsciiString type; };
template <> struct TCollection_String <Standard_ExtCharacter> { typedef TCollection_ExtendedString type; };
template <class CharType> static inline Standard_Boolean
getString (CharType *& thePtr,
template <class _Char> static inline Standard_Boolean
getString (_Char *& thePtr,
TCollection_ExtendedString& theString,
Standard_Integer& theLeftSpaces)
{
CharType * anEndPtr = thePtr;
CharType * aPtr;
_Char * anEndPtr = thePtr;
_Char * aPtr;
Standard_Integer aLeftSpaces;
do
@@ -102,7 +98,7 @@ getString (CharType *& thePtr,
aLeftSpaces = 0;
for (;;)
{
CharType aChar = * aPtr;
_Char aChar = * aPtr;
if (aChar == ' ') aLeftSpaces++;
else if (aChar == '\t') aLeftSpaces += 8;
else if (aChar == '\r' || * aPtr == '\n') aLeftSpaces = 0;
@@ -125,7 +121,7 @@ getString (CharType *& thePtr,
thePtr = anEndPtr;
if (*thePtr)
*thePtr++ = '\0';
theString = typename TCollection_String<CharType>::type (aPtr);
theString = TCollection_ExtendedString (aPtr);
theLeftSpaces = aLeftSpaces;
return Standard_True;
}

View File

@@ -24,7 +24,7 @@
#include <algorithm>
#include <vector>
//! Compute points of the Halton sequence with digit-permutations for different bases.
//! Compute points of the Halton sequence with with digit-permutations for different bases.
class OpenGl_HaltonSampler
{
public:
@@ -35,13 +35,19 @@ public:
public:
//! Init the permutation arrays using Faure-permutations.
OpenGl_HaltonSampler()
{
initFaure();
}
//! Alternatively, initRandom() can be called before the sampling functionality can be used.
void initFaure();
//! Init the permutation arrays using randomized permutations.
//! Alternatively, initFaure() can be called before the sampling functionality can be used.
//! The client needs to specify a random number generator function object that can be used to generate a random sequence of integers.
//! That is: if f is a random number generator and N is a positive integer,
//! then f(N) will return an integer less than N and greater than or equal to 0.
template <typename Random_number_generator>
void initRandom (Random_number_generator& theRand);
//! Return the Halton sample for the given dimension (component) and index.
//! The client must have called initFaure() at least once before.
//! The client must have called initRandom or initFaure() at least once before.
//! dimension must be smaller than the value returned by get_num_dimensions().
float sample (unsigned theDimension, unsigned theIndex) const
{
@@ -56,9 +62,6 @@ public:
private:
//! Init the permutation arrays using Faure-permutations.
void initFaure();
static unsigned short invert (unsigned short theBase, unsigned short theDigits,
unsigned short theIndex, const std::vector<unsigned short>& thePerm)
{
@@ -156,4 +159,30 @@ inline void OpenGl_HaltonSampler::initFaure()
initTables (aPerms);
}
template <typename Random_number_generator>
void OpenGl_HaltonSampler::initRandom (Random_number_generator& theRand)
{
const unsigned THE_MAX_BASE = 5u;
std::vector<std::vector<unsigned short> > aPerms(THE_MAX_BASE + 1);
for (unsigned k = 1; k <= 3; ++k) // Keep identity permutations for base 1, 2, 3.
{
aPerms[k].resize (k);
for (unsigned i = 0; i < k; ++i)
{
aPerms[k][i] = i;
}
}
for (unsigned aBase = 4; aBase <= THE_MAX_BASE; ++aBase)
{
aPerms[aBase].resize (aBase);
for (unsigned i = 0; i < aBase; ++i)
{
aPerms[aBase][i] = i;
}
std::random_shuffle (aPerms[aBase].begin(), aPerms[aBase].end(), theRand);
}
initTables (aPerms);
}
#endif // _OpenGl_HaltonSampler_H

View File

@@ -31,7 +31,7 @@ OpenGl_TileSampler::OpenGl_TileSampler()
myTileSize (0),
myViewSize (0, 0)
{
//
mySampler.initFaure();
}
//=======================================================================

View File

@@ -138,18 +138,9 @@ Handle(Graphic3d_ArrayOfTriangles) Prs3d_Arrow::DrawShaded (const gp_Ax1&
return Handle(Graphic3d_ArrayOfTriangles)();
}
Standard_Integer aMaxVertexs = 0;
if (aNbTrisTube > 0)
{
aMaxVertexs += Prs3d_ToolCylinder::VerticesNb (theNbFacettes, 1);
}
if (aNbTrisCone > 0)
{
// longer syntax to workaround msvc10 32-bit optimizer bug (#0031876)
aMaxVertexs += Prs3d_ToolDisk::VerticesNb (theNbFacettes, 1);
aMaxVertexs += Prs3d_ToolCylinder::VerticesNb (theNbFacettes, 1);
}
Standard_Integer aMaxVertexs = (aNbTrisTube > 0 ? Prs3d_ToolCylinder::VerticesNb (theNbFacettes, 1) : 0)
+ (aNbTrisCone > 0 ? Prs3d_ToolDisk ::VerticesNb (theNbFacettes, 1)
+ Prs3d_ToolCylinder::VerticesNb (theNbFacettes, 1) : 0);
Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (aMaxVertexs, aNbTris * 3, Graphic3d_ArrayFlags_VertexNormal);
if (aNbTrisTube != 0)
{

View File

@@ -51,10 +51,6 @@ enum Resource_FormatType
Resource_FormatType_iso8859_8, //!< ISO 8859-8 (Hebrew) encoding
Resource_FormatType_iso8859_9, //!< ISO 8859-9 (Turkish) encoding
// Addition code pages
Resource_FormatType_GBK, //!< GBK (UnifiedChinese) encoding
Resource_FormatType_Big5, //!< Big5 (TradChinese) encoding
// old aliases
Resource_FormatType_ANSI = Resource_FormatType_NoConversion,
Resource_SJIS = Resource_FormatType_SJIS,

View File

@@ -652,16 +652,6 @@ void Resource_Unicode::ConvertFormatToUnicode (const Resource_FormatType theForm
}
break;
}
case Resource_FormatType_Big5:
{
ConvertBig5ToUnicode(theFromStr, theToStr);
break;
}
case Resource_FormatType_GBK:
{
ConvertGBKToUnicode(theFromStr, theToStr);
break;
}
case Resource_FormatType_UTF8:
{
theToStr = TCollection_ExtendedString (theFromStr, Standard_True);
@@ -770,11 +760,6 @@ Standard_Boolean Resource_Unicode::ConvertUnicodeToFormat(const Resource_FormatT
const NCollection_Utf16String aString (theFromStr.ToExtString());
return aString.ToLocale (theToStr, theMaxSize);
}
case Resource_FormatType_GBK:
case Resource_FormatType_Big5:
{
throw Standard_NotImplemented("Resource_Unicode::ConvertUnicodeToFormat - convert from GBK and Big5 to Unocode is not implemented");
}
}
return Standard_False;
}

View File

@@ -384,7 +384,7 @@ TCollection_ExtendedString STEPCAFControl_Reader::convertName (const TCollection
// If source code page is not a NoConversion
// the string is treated as having UTF-8 coding,
// else each character is copied to ExtCharacter.
return TCollection_ExtendedString (theName, myReader.StepModel()->SourceCodePage() != Resource_FormatType_NoConversion);
return TCollection_ExtendedString (theName, SourceCodePage() != Resource_FormatType_NoConversion);
}
//=======================================================================
@@ -4783,6 +4783,26 @@ Standard_Boolean STEPCAFControl_Reader::GetNameMode() const
return myNameMode;
}
//=======================================================================
//function : SourceCodePage
//purpose :
//=======================================================================
Resource_FormatType STEPCAFControl_Reader::SourceCodePage() const
{
return myReader.StepModel()->SourceCodePage();
}
//=======================================================================
//function : SetSourceCodePage
//purpose :
//=======================================================================
void STEPCAFControl_Reader::SetSourceCodePage(Resource_FormatType theCode)
{
myReader.StepModel()->SetSourceCodePage(theCode);
}
//=======================================================================
//function : SetLayerMode
//purpose :

View File

@@ -141,6 +141,13 @@ public:
Standard_EXPORT Standard_Boolean GetNameMode() const;
//! Return the encoding of STEP file for converting names into UNICODE.
//! Initialized from "read.step.codepage" variable by constructor, which is Resource_UTF8 by default.
Standard_EXPORT Resource_FormatType SourceCodePage() const;
//! Return the encoding of STEP file for converting names into UNICODE.
Standard_EXPORT void SetSourceCodePage (Resource_FormatType theCode);
//! Set LayerMode for indicate read Layers or not.
Standard_EXPORT void SetLayerMode (const Standard_Boolean layermode);

View File

@@ -35,19 +35,19 @@
// Primary definitions
#define OCC_VERSION_MAJOR 7
#define OCC_VERSION_MINOR 5
#define OCC_VERSION_MAINTENANCE 1
#define OCC_VERSION_MAINTENANCE 0
//! This macro must be commented in official release, and set to non-empty
//! string in other situations, to identify specifics of the version, e.g.:
//! - "dev" for development version between releases
//! - "beta..." or "rc..." for beta releases or release candidates
//! - "project..." for version containing project-specific fixes
#define OCC_VERSION_DEVELOPMENT "dev"
#define OCC_VERSION_DEVELOPMENT "beta"
// Derived (manually): version as real and string (major.minor)
#define OCC_VERSION 7.5
#define OCC_VERSION_STRING "7.5"
#define OCC_VERSION_COMPLETE "7.5.1"
#define OCC_VERSION_COMPLETE "7.5.0"
//! Derived: extended version as string ("major.minor.maintenance.dev")
#ifdef OCC_VERSION_DEVELOPMENT

View File

@@ -40,7 +40,6 @@
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wenum-compare"
#pragma GCC diagnostic ignored "-Wreorder"
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#endif

View File

@@ -1,2 +1,3 @@
StepToGeom.cxx
StepToGeom.hxx
StepToGeom_MakeBSplineCurve.pxx

View File

@@ -622,179 +622,29 @@ Handle(Geom_BoundedSurface) StepToGeom::MakeBoundedSurface (const Handle(StepGeo
return 0;
}
//=============================================================================
// Template function for use in MakeBSplineCurve / MakeBSplineCurve2d
//=============================================================================
template
<
class TPntArray,
class TCartesianPoint,
class TGpPnt,
class TBSplineCurve
>
Handle(TBSplineCurve) MakeBSplineCurveCommon
(
const Handle(StepGeom_BSplineCurve)& theStepGeom_BSplineCurve,
TGpPnt(TCartesianPoint::* thePntGetterFunction)() const,
Handle(TCartesianPoint) (*thePointMakerFunction)(const Handle(StepGeom_CartesianPoint)&)
)
{
Handle(StepGeom_BSplineCurveWithKnots) aBSplineCurveWithKnots;
Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aBSplineCurveWithKnotsAndRationalBSplineCurve;
if (theStepGeom_BSplineCurve->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)))
{
aBSplineCurveWithKnotsAndRationalBSplineCurve =
Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(theStepGeom_BSplineCurve);
aBSplineCurveWithKnots = aBSplineCurveWithKnotsAndRationalBSplineCurve->BSplineCurveWithKnots();
}
else
aBSplineCurveWithKnots = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(theStepGeom_BSplineCurve);
const Standard_Integer aDegree = aBSplineCurveWithKnots->Degree();
const Standard_Integer NbPoles = aBSplineCurveWithKnots->NbControlPointsList();
const Standard_Integer NbKnots = aBSplineCurveWithKnots->NbKnotMultiplicities();
const Handle(TColStd_HArray1OfInteger)& aKnotMultiplicities = aBSplineCurveWithKnots->KnotMultiplicities();
const Handle(TColStd_HArray1OfReal)& aKnots = aBSplineCurveWithKnots->Knots();
// Count number of unique knots
Standard_Integer NbUniqueKnots = 0;
Standard_Real lastKnot = RealFirst();
for (Standard_Integer i = 1; i <= NbKnots; ++i)
{
if (aKnots->Value(i) - lastKnot > Epsilon(Abs(lastKnot)))
{
NbUniqueKnots++;
lastKnot = aKnots->Value(i);
}
}
if (NbUniqueKnots <= 1)
{
return 0;
}
TColStd_Array1OfReal aUniqueKnots(1, NbUniqueKnots);
TColStd_Array1OfInteger aUniqueKnotMultiplicities(1, NbUniqueKnots);
lastKnot = aKnots->Value(1);
aUniqueKnots.SetValue(1, aKnots->Value(1));
aUniqueKnotMultiplicities.SetValue(1, aKnotMultiplicities->Value(1));
Standard_Integer aKnotPosition = 1;
for (Standard_Integer i = 2; i <= NbKnots; i++)
{
if (aKnots->Value(i) - lastKnot > Epsilon(Abs(lastKnot)))
{
aKnotPosition++;
aUniqueKnots.SetValue(aKnotPosition, aKnots->Value(i));
aUniqueKnotMultiplicities.SetValue(aKnotPosition, aKnotMultiplicities->Value(i));
lastKnot = aKnots->Value(i);
}
else
{
// Knot not unique, increase multiplicity
Standard_Integer aCurrentMultiplicity = aUniqueKnotMultiplicities.Value(aKnotPosition);
aUniqueKnotMultiplicities.SetValue(aKnotPosition, aCurrentMultiplicity + aKnotMultiplicities->Value(i));
}
}
Standard_Integer aFirstMuultypisityDifference = 0;
Standard_Integer aLastMuultypisityDifference = 0;
for (Standard_Integer i = 1; i <= NbUniqueKnots; ++i)
{
Standard_Integer aCurrentVal = aUniqueKnotMultiplicities.Value(i);
if (aCurrentVal > aDegree + 1)
{
if (i == 1)
aFirstMuultypisityDifference = aCurrentVal - aDegree - 1;
if (i == NbUniqueKnots)
aLastMuultypisityDifference = aCurrentVal - aDegree - 1;
#ifdef OCCT_DEBUG
std::cout << "\nWrong multiplicity " << aCurrentVal << " on " << i
<< " knot!" << "\nChanged to " << aDegree + 1 << std::endl;
#endif
aCurrentVal = aDegree + 1;
}
aUniqueKnotMultiplicities.SetValue(i, aCurrentVal);
}
const Handle(StepGeom_HArray1OfCartesianPoint)& aControlPointsList = aBSplineCurveWithKnots->ControlPointsList();
Standard_Integer aSummaryMuultypisityDifference = aFirstMuultypisityDifference + aLastMuultypisityDifference;
Standard_Integer NbUniquePoles = NbPoles - aSummaryMuultypisityDifference;
if (NbUniquePoles <= 0)
{
return 0;
}
TPntArray Poles(1, NbPoles - aSummaryMuultypisityDifference);
for (Standard_Integer i = 1 + aFirstMuultypisityDifference; i <= NbPoles - aLastMuultypisityDifference; ++i)
{
Handle(TCartesianPoint) aPoint = (*thePointMakerFunction)(aControlPointsList->Value(i));
if (!aPoint.IsNull())
{
TCartesianPoint* pPoint = aPoint.get();
TGpPnt aGpPnt = (pPoint->*thePntGetterFunction)();
Poles.SetValue(i - aFirstMuultypisityDifference, aGpPnt);
}
else
{
return 0;
}
}
// --- Does the Curve descriptor LOOKS like a periodic descriptor ? ---
Standard_Integer aSummaryMuultypisity = 0;
for (Standard_Integer i = 1; i <= NbUniqueKnots; i++)
{
aSummaryMuultypisity += aUniqueKnotMultiplicities.Value(i);
}
Standard_Boolean shouldBePeriodic;
if (aSummaryMuultypisity == (NbPoles + aDegree + 1))
{
shouldBePeriodic = Standard_False;
}
else if ((aUniqueKnotMultiplicities.Value(1) == aUniqueKnotMultiplicities.Value(NbUniqueKnots)) &&
((aSummaryMuultypisity - aUniqueKnotMultiplicities.Value(1)) == NbPoles))
{
shouldBePeriodic = Standard_True;
}
else
{
// --- What is that ??? ---
shouldBePeriodic = Standard_False;
}
Handle(TBSplineCurve) aBSplineCurve;
if (theStepGeom_BSplineCurve->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)))
{
const Handle(TColStd_HArray1OfReal)& aWeights = aBSplineCurveWithKnotsAndRationalBSplineCurve->WeightsData();
TColStd_Array1OfReal aUniqueWeights(1, NbPoles - aSummaryMuultypisityDifference);
for (Standard_Integer i = 1 + aFirstMuultypisityDifference; i <= NbPoles - aLastMuultypisityDifference; ++i)
aUniqueWeights.SetValue(i - aFirstMuultypisityDifference, aWeights->Value(i));
aBSplineCurve = new TBSplineCurve(Poles, aUniqueWeights, aUniqueKnots, aUniqueKnotMultiplicities, aDegree, shouldBePeriodic);
}
else
{
aBSplineCurve = new TBSplineCurve(Poles, aUniqueKnots, aUniqueKnotMultiplicities, aDegree, shouldBePeriodic);
}
// abv 04.07.00 CAX-IF TRJ4: trj4_k1_top-md-203.stp #716 (face #581):
// force periodicity on closed curves
if (theStepGeom_BSplineCurve->ClosedCurve() && aBSplineCurve->Degree() > 1 && aBSplineCurve->IsClosed())
{
aBSplineCurve->SetPeriodic();
}
return aBSplineCurve;
}
//=============================================================================
// Creation d' une BSplineCurve de Geom a partir d' une BSplineCurve de Step
//=============================================================================
Handle(Geom_BSplineCurve) StepToGeom::MakeBSplineCurve (const Handle(StepGeom_BSplineCurve)& theStepGeom_BSplineCurve)
Handle(Geom_BSplineCurve) StepToGeom::MakeBSplineCurve (const Handle(StepGeom_BSplineCurve)& SC)
{
return MakeBSplineCurveCommon<TColgp_Array1OfPnt, Geom_CartesianPoint, gp_Pnt, Geom_BSplineCurve>
(theStepGeom_BSplineCurve, &Geom_CartesianPoint::Pnt, &MakeCartesianPoint);
#define Array1OfPnt_gen TColgp_Array1OfPnt
#define Pnt_gen gp_Pnt
#define Pnt_fonc Pnt
#define CartesianPoint_gen Handle(Geom_CartesianPoint)
#define MakeCartesianPoint_gen MakeCartesianPoint
#define BSplineCurve_gen Geom_BSplineCurve
#define BSplineCurve_retour Handle(Geom_BSplineCurve)
#define MakeBSplineCurve_gen MakeBSplineCurve
#include "StepToGeom_MakeBSplineCurve.pxx"
#undef Array1OfPnt_gen
#undef Pnt_gen
#undef Pnt_fonc
#undef CartesianPoint_gen
#undef MakeCartesianPoint_gen
#undef BSplineCurve_gen
#undef MakeBSplineCurve_gen
#undef BSplineCurve_retour
}
//=============================================================================
@@ -802,10 +652,25 @@ Handle(Geom_BSplineCurve) StepToGeom::MakeBSplineCurve (const Handle(StepGeom_BS
// BSplineCurveWithKnotsAndRationalBSplineCurve de Step
//=============================================================================
Handle(Geom2d_BSplineCurve) StepToGeom::MakeBSplineCurve2d (const Handle(StepGeom_BSplineCurve)& theStepGeom_BSplineCurve)
Handle(Geom2d_BSplineCurve) StepToGeom::MakeBSplineCurve2d (const Handle(StepGeom_BSplineCurve)& SC)
{
return MakeBSplineCurveCommon<TColgp_Array1OfPnt2d, Geom2d_CartesianPoint, gp_Pnt2d, Geom2d_BSplineCurve>
(theStepGeom_BSplineCurve, &Geom2d_CartesianPoint::Pnt2d, &MakeCartesianPoint2d);
#define Array1OfPnt_gen TColgp_Array1OfPnt2d
#define Pnt_gen gp_Pnt2d
#define CartesianPoint_gen Handle(Geom2d_CartesianPoint)
#define MakeCartesianPoint_gen MakeCartesianPoint2d
#define Pnt_fonc Pnt2d
#define BSplineCurve_gen Geom2d_BSplineCurve
#define BSplineCurve_retour Handle(Geom2d_BSplineCurve)
#define MakeBSplineCurve_gen MakeBSplineCurve2d
#include "StepToGeom_MakeBSplineCurve.pxx"
#undef Array1OfPnt_gen
#undef Pnt_gen
#undef CartesianPoint_gen
#undef MakeCartesianPoint_gen
#undef Pnt_fonc
#undef BSplineCurve_gen
#undef MakeBSplineCurve_gen
#undef BSplineCurve_retour
}
//=============================================================================

View File

@@ -0,0 +1,142 @@
// Created on: 1993-07-02
// Created by: Martine LANGLOIS
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
Handle(StepGeom_BSplineCurveWithKnots) BSCW;
Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) BSCWR;
if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) {
BSCWR = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(SC);
BSCW = BSCWR->BSplineCurveWithKnots();
}
else
BSCW = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(SC);
const Standard_Integer Deg = BSCW->Degree();
const Standard_Integer NbPoles = BSCW->NbControlPointsList();
const Standard_Integer NbKnots = BSCW->NbKnotMultiplicities();
//aKnotMultiplicities = new TColStd_HArray1OfInteger(1,NbKnots);
const Handle(TColStd_HArray1OfInteger)& aKnotMultiplicities = BSCW->KnotMultiplicities();
//aKnots = new TColStd_HArray1OfReal(1,NbKnots);
const Handle(TColStd_HArray1OfReal)& aKnots = BSCW->Knots();
// Count number of unique knots
Standard_Integer i;
Standard_Integer NbUniqueKnots = 0;
Standard_Real lastKnot = RealFirst();
for (i=1; i<=NbKnots; ++i) {
if (aKnots->Value(i) - lastKnot > Epsilon (Abs(lastKnot))) {
NbUniqueKnots++;
lastKnot = aKnots->Value(i);
}
}
if(NbUniqueKnots <= 1)
{
return 0;
}
TColStd_Array1OfReal Kn(1,NbUniqueKnots);
TColStd_Array1OfInteger Mult(1,NbUniqueKnots);
lastKnot = aKnots->Value(1);
Kn.SetValue(1, aKnots->Value(1));
Mult.SetValue(1, aKnotMultiplicities->Value(1));
Standard_Integer pos = 1;
for (i=2; i<=NbKnots; i++) {
if (aKnots->Value(i) - lastKnot > Epsilon (Abs(lastKnot))) {
pos++;
Kn.SetValue(pos, aKnots->Value(i));
Mult.SetValue(pos, aKnotMultiplicities->Value(i));
lastKnot = aKnots->Value(i);
}
else {
// Knot not unique, increase multiplicity
Standard_Integer curMult = Mult.Value(pos);
Mult.SetValue(pos, curMult + aKnotMultiplicities->Value(i));
}
}
Standard_Integer aFMulDiff = 0,aLMulDiff = 0;
for (i=1; i<=NbUniqueKnots; ++i) {
Standard_Integer aCurrentVal = Mult.Value(i);
if (aCurrentVal > Deg + 1)
{
if (i == 1) aFMulDiff = aCurrentVal - Deg - 1;
if (i == NbUniqueKnots) aLMulDiff = aCurrentVal - Deg - 1;
#ifdef OCCT_DEBUG
std::cout << "\nWrong multiplicity " << aCurrentVal << " on " << i
<< " knot!" << "\nChanged to " << Deg + 1 << std::endl;
#endif
aCurrentVal = Deg + 1;
}
Mult.SetValue(i,aCurrentVal);
}
//aControlPointsList = new StepGeom_HArray1OfCartesianPoint(1,NbPoles);
const Handle(StepGeom_HArray1OfCartesianPoint)& aControlPointsList = BSCW->ControlPointsList();
Standard_Integer aSumMulDiff = aFMulDiff + aLMulDiff;
Standard_Integer nbP = NbPoles - aSumMulDiff;
if( nbP <= 0)
{
return 0;
}
Array1OfPnt_gen Poles(1,NbPoles - aSumMulDiff);
for (i = 1 + aFMulDiff; i<= NbPoles - aLMulDiff; ++i)
{
CartesianPoint_gen P = MakeCartesianPoint_gen (aControlPointsList->Value(i));
if (! P.IsNull())
Poles.SetValue(i - aFMulDiff,P->Pnt_fonc());
else
return 0;
}
// --- Does the Curve descriptor LOOKS like a periodic descriptor ? ---
Standard_Integer SumMult = 0;
for (i=1; i<=NbUniqueKnots; i++) {
SumMult += Mult.Value(i);
}
Standard_Boolean shouldBePeriodic;
if (SumMult == (NbPoles + Deg + 1)) {
shouldBePeriodic = Standard_False;
}
else if ((Mult.Value(1) ==
Mult.Value(NbUniqueKnots)) &&
((SumMult - Mult.Value(1)) == NbPoles)) {
shouldBePeriodic = Standard_True;
}
else { // --- What is that ??? ---
shouldBePeriodic = Standard_False;
//cout << "Strange BSpline Curve Descriptor" << endl;
}
BSplineCurve_retour CC;
if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) {
const Handle(TColStd_HArray1OfReal)& aWeight = BSCWR->WeightsData();
TColStd_Array1OfReal W(1,NbPoles);
for (i=1; i<=NbPoles; i++)
W.SetValue(i,aWeight->Value(i));
CC = new BSplineCurve_gen(Poles, W, Kn, Mult, Deg, shouldBePeriodic);
}
else
CC = new BSplineCurve_gen(Poles, Kn, Mult, Deg, shouldBePeriodic);
// abv 04.07.00 CAX-IF TRJ4: trj4_k1_top-md-203.stp #716 (face #581):
// force periodicity on closed curves
if ( SC->ClosedCurve() && CC->Degree() >1 && CC->IsClosed() ) {
CC->SetPeriodic();
}
return CC;

View File

@@ -63,13 +63,14 @@ public:
//! Initializes a ExtendedString to an empty ExtendedString.
Standard_EXPORT TCollection_ExtendedString();
//! Creation by converting a CString to an extended
//! string. If <isMultiByte> is true then the string is
//! treated as having UTF-8 coding. If it is not a UTF-8
//! then <isMultiByte> is ignored and each character is
//! copied to ExtCharacter.
Standard_EXPORT TCollection_ExtendedString(const Standard_CString astring, const Standard_Boolean isMultiByte = Standard_False);
//! Creation by converting a plain C string to an extended string.
//! If @p isMultiByte is true then @p theString is treated as having UTF-8 encoding.
//! If @p isMultiByte is true but @p theString is not a valid UTF-8 string,
//! or if @p isMultiByte is false, then each character of @p theString is
//! copied to ExtCharacter (as if @p theString was in ISO 8859-1 code page).
Standard_EXPORT TCollection_ExtendedString(const Standard_CString theString,
const Standard_Boolean isMultiByte = Standard_True);
//! Creation by converting an ExtString to an extended string.
Standard_EXPORT TCollection_ExtendedString(const Standard_ExtString astring);

View File

@@ -76,7 +76,7 @@ Standard_Integer& TObj_Assistant::getVersion()
Handle(TObj_Model) TObj_Assistant::FindModel
(const Standard_CString theName)
{
TCollection_ExtendedString aName(theName, Standard_True);
TCollection_ExtendedString aName( theName );
Standard_Integer i = getModels().Length();
Handle(TObj_Model) aModel;
for(; i > 0; i --)

View File

@@ -194,7 +194,7 @@ static Standard_Integer saveModel (Draw_Interpretor& di, Standard_Integer argc,
if ( aModel.IsNull() ) return 1;
Standard_Boolean isSaved = Standard_False;
if (argc > 2 )
isSaved = aModel->SaveAs( TCollection_ExtendedString (argv[2], Standard_True) );
isSaved = aModel->SaveAs( argv[2] );
else
isSaved = aModel->Save();
@@ -215,12 +215,11 @@ static Standard_Integer loadModel (Draw_Interpretor& di, Standard_Integer argc,
Standard_Boolean isLoaded = Standard_False;
Handle(TObj_Model) aModel = getModelByName(argv[1]);
TCollection_ExtendedString aPath(argv[2], Standard_True);
if ( aModel.IsNull() )
{
// create new
aModel = new TObjDRAW_Model();
isLoaded = aModel->Load(aPath);
isLoaded = aModel->Load( argv[2] );
if ( isLoaded )
{
Handle(TDocStd_Document) D = aModel->GetDocument();
@@ -231,9 +230,7 @@ static Standard_Integer loadModel (Draw_Interpretor& di, Standard_Integer argc,
}
}
else
{
isLoaded = aModel->Load(aPath);
}
isLoaded = aModel->Load( argv[2] );
if (!isLoaded) {

View File

@@ -180,8 +180,6 @@ void TopoDSToStep_MakeStepFace::Init(const TopoDS_Face& aFace,
return;
}
try
{
// -----------------
// Translate Surface
// -----------------
@@ -467,13 +465,6 @@ void TopoDSToStep_MakeStepFace::Init(const TopoDS_Face& aFace,
myError = TopoDSToStep_NoWireMapped;
done = Standard_False;
}
}
catch (Standard_Failure const& theFailure)
{
FP->AddFail(errShape, theFailure.GetMessageString());
myError = TopoDSToStep_FaceOther;
done = Standard_False;
}
}

View File

@@ -1337,12 +1337,6 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
? TypeOfDispOperation_UnsetDispMode
: TypeOfDispOperation_SetDispMode;
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
Message::SendFail ("Error: no active viewer");
return 1;
}
if (aType == TypeOfDispOperation_UnsetDispMode)
{
if (argc == 1)
@@ -1408,11 +1402,6 @@ static int VSubInt(Draw_Interpretor& di, Standard_Integer argc, const char** arg
if(argc==1) return 1;
Standard_Integer On = Draw::Atoi(argv[1]);
const Handle(AIS_InteractiveContext)& Ctx = ViewerTest::GetAISContext();
if (Ctx.IsNull())
{
Message::SendFail ("Error: no active viewer");
return 1;
}
if(argc==2)
{
@@ -5645,12 +5634,6 @@ Standard_Boolean ViewerTest::PickShapes (const TopAbs_ShapeEnum theShapeType,
// step 1: prepare the data
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
Message::SendFail ("Error: no active viewer");
return Standard_False;
}
aCtx->RemoveFilters();
AIS_ListOfInteractive aDispObjects;
aCtx->DisplayedObjects (aDispObjects);

View File

@@ -701,12 +701,6 @@ static int VTrihedron (Draw_Interpretor& ,
static int VSize (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
{
if (TheAISContext().IsNull())
{
Message::SendFail ("Error: no active viewer");
return 1;
}
// Declaration de booleens
Standard_Boolean ThereIsName;
Standard_Boolean ThereIsCurrent;
@@ -860,12 +854,6 @@ static int VPlaneTrihedron (Draw_Interpretor& di, Standard_Integer argc, const c
// Verification des arguments
if ( argc!=2) {di<<argv[0]<<" error\n"; return 1;}
if (TheAISContext().IsNull())
{
Message::SendFail ("Error: no active viewer");
return 1;
}
if (TheAISContext()->NbSelected() != 1)
{
Message::SendFail ("Error: Wrong number of selected shapes.");

View File

@@ -4690,7 +4690,7 @@ static int VColorScale (Draw_Interpretor& theDI,
return 1;
}
TCollection_ExtendedString aText (theArgVec[anArgIter + 2], Standard_True);
TCollection_ExtendedString aText (theArgVec[anArgIter + 2]);
aColorScale->SetLabel (aText, anIndex);
aColorScale->SetLabelType (Aspect_TOCSD_USER);
anArgIter += 2;
@@ -4797,7 +4797,7 @@ static int VColorScale (Draw_Interpretor& theDI,
TColStd_SequenceOfExtendedString aSeq;
for (Standard_Integer aLabelIter = 0; aLabelIter < aNbLabels; ++aLabelIter)
{
aSeq.Append (TCollection_ExtendedString (theArgVec[++anArgIter], Standard_True));
aSeq.Append (TCollection_ExtendedString (theArgVec[++anArgIter]));
}
aColorScale->SetLabels (aSeq);
aColorScale->SetLabelType (Aspect_TOCSD_USER);
@@ -4839,8 +4839,7 @@ static int VColorScale (Draw_Interpretor& theDI,
Standard_ENABLE_DEPRECATION_WARNINGS
}
TCollection_ExtendedString aTitle(theArgVec[anArgIter + 1], Standard_True);
aColorScale->SetTitle (aTitle);
aColorScale->SetTitle (theArgVec[anArgIter + 1]);
if (isTwoArgs)
{
anArgIter += 1;

View File

@@ -212,7 +212,7 @@ static Standard_Integer openDoc (Draw_Interpretor& di, Standard_Integer argc, co
return 1;
}
TCollection_AsciiString Filename = argv[1];
Standard_CString Filename = argv[1];
Standard_CString DocName = argv[2];
if ( DDocStd::GetDocument(DocName, D, Standard_False) )

View File

@@ -215,7 +215,7 @@ noteCreateBalloon(Draw_Interpretor& di, Standard_Integer argc, const char** argv
di << "Error: user name is expected.\n" << myCommand;
return 1;
}
aUsername = TCollection_ExtendedString (argv[iarg], Standard_True);
aUsername = argv[iarg];
}
else if (opt == "--time")
{
@@ -224,7 +224,7 @@ noteCreateBalloon(Draw_Interpretor& di, Standard_Integer argc, const char** argv
di << "Error: timestamp is expected.\n" << myCommand;
return 1;
}
aTimestamp = TCollection_ExtendedString (argv[iarg], Standard_True);
aTimestamp = argv[iarg];
}
}
@@ -280,7 +280,7 @@ noteCreateComment(Draw_Interpretor& di, Standard_Integer argc, const char** argv
di << "Error: user name is expected.\n" << myCommand;
return 1;
}
aUsername = TCollection_ExtendedString (argv[iarg], Standard_True);
aUsername = argv[iarg];
}
else if (opt == "--time")
{
@@ -289,7 +289,7 @@ noteCreateComment(Draw_Interpretor& di, Standard_Integer argc, const char** argv
di << "Error: timestamp is expected.\n" << myCommand;
return 1;
}
aTimestamp = TCollection_ExtendedString (argv[iarg], Standard_True);
aTimestamp = argv[iarg];
}
}
@@ -355,7 +355,7 @@ noteCreateBinData(Draw_Interpretor& di, Standard_Integer argc, const char** argv
di << "Error: file path is expected.\n" << myCommand;
return 1;
}
aFilename = TCollection_ExtendedString (argv[iarg], Standard_True);
aFilename = argv[iarg];
aFromFile = Standard_True;
}
else if (opt == "--data")
@@ -396,7 +396,7 @@ noteCreateBinData(Draw_Interpretor& di, Standard_Integer argc, const char** argv
di << "Error: user name is expected.\n" << myCommand;
return 1;
}
aUsername = TCollection_ExtendedString (argv[iarg], Standard_True);
aUsername = argv[iarg];
}
else if (opt == "--time")
{
@@ -405,7 +405,7 @@ noteCreateBinData(Draw_Interpretor& di, Standard_Integer argc, const char** argv
di << "Error: timestamp is expected.\n" << myCommand;
return 1;
}
aTimestamp = TCollection_ExtendedString (argv[iarg], Standard_True);
aTimestamp = argv[iarg];
}
}

View File

@@ -1,12 +0,0 @@
puts "# ============================================================"
puts "# 0014673: Provide true support for Unicode symbols"
puts "# ============================================================"
puts ""
puts "# Use non-Ascii names for color scale"
pload VISUALIZATION
vinit
vcolorscale languages -title "Языки Восточной Азии" -range 1 3 3 -colors red green blue \
-labelAtBorder off -labels "Japanese 日本語" "Korean 한국어" "Chinese 中文"
vdump ${imagedir}/${casename}.png

View File

@@ -1,44 +0,0 @@
puts "# ============================================================"
puts "# 0014673: Provide true support for Unicode symbols"
puts "# ============================================================"
puts ""
puts "# Check that different file open / save commands can deal with Unicode"
pload ALL
# Name means "Japanese"
set filePrefix "$imagedir/${casename}_日本語"
proc checkFile {filepath} {
if { [file exists $filepath] } {
puts "File $filepath is ceated, OK"
} else {
puts "Error: Could not find file $filepath"
}
}
puts "# OCAF documents"
NewDocument Xml XmlOcaf
SaveAs Xml ${filePrefix}.xml
checkFile ${filePrefix}.xml
Close Xml
Open ${filePrefix}.xml Xml
NewDocument Bin BinOcaf
SaveAs Bin ${filePrefix}.cbf
checkFile ${filePrefix}.cbf
Close Bin
Open ${filePrefix}.cbf Bin
puts "# STEP and IGES"
box b 10 10 10
NewDocument XDE BinOcaf
XAddShape XDE b
WriteStep XDE ${filePrefix}.stp
checkFile ${filePrefix}.stp
ReadStep Step ${filePrefix}.stp
WriteIges XDE ${filePrefix}.igs
checkFile ${filePrefix}.igs
ReadIges Iges ${filePrefix}.igs

View File

@@ -1,22 +0,0 @@
puts "# ============================================================"
puts "# 0014673: Provide true support for Unicode symbols"
puts "# ============================================================"
puts ""
puts "# Check that resource file with messages saved in file with UTF-8"
puts "# encoding is correctly loaded and processed"
puts "# Prepare resource file to be used instead of standard XSTEP.us,"
puts "# with Russian translation of one message"
dsetenv CSF_LANGUAGE ru
dsetenv CSF_XSMessage $imagedir
set message "Б-сплайн поверхность не является гладкой"
set fd [open $imagedir/XSTEP.ru w]
fconfigure $fd -encoding utf-8
puts $fd ".XSTEP_1\nMessage used to check file load\n.IGES_1250\n$message"
close $fd
puts "# Load IGES file which is known to generate the message, and check it"
puts "REQUIRED 14673 ALL: $message"
pload XSDRAW
igesbrep [locate_data_file hammer.iges] a *
tpstat c

View File

@@ -1,28 +0,0 @@
puts "# ============================================================"
puts "# 0014673: Provide true support for Unicode symbols"
puts "# ============================================================"
puts ""
puts "# Check that non-Ascii text strings can be saved and restored in OCAF"
puts "# Prepare OCAF document with text strings in different languages"
set strings [list "test" "l'épreuve" "опыт" "테스트" "größten 市"]
pload OCAF
NewDocument D XmlOcaf
set i 0
foreach str $strings {
SetName D 0:[incr i] $str
}
puts "# Save it and load back, then check the strings"
SaveAs D $imagedir/${casename}.xml
Close D
Open $imagedir/${casename}.xml D
set i 0
foreach str $strings {
set res [GetName D 0:[incr i]]
if { $res != $str } {
puts "Error: string $str was restored as $res"
}
}

View File

@@ -1,11 +0,0 @@
puts "# ======================================================================"
puts "# 0031877: DRAW - some Visualization commands are not protected against uninitialized viewer"
puts "# ======================================================================"
puts "REQUIRED 31877 ALL: Error: no active viewer"
pload VISUALIZATION
catch {vsetdispmode 1}
catch {vpickshapes}
catch {vsize}
catch {vplanetri a}

View File

@@ -1,15 +0,0 @@
puts "=========="
puts "0029108: Data Exchange - Crash writing STEP file"
puts "=========="
puts ""
restore [locate_data_file bug29108.brep] part
stepwrite a part $imagedir/bug229108_temp.stp
dall
stepread ${imagedir}/bug229108_temp.stp a *
tpcompound result
checkprops result -s 11833
checkshape result
checknbshapes result -vertex 251 -edge 380 -wire 155 -face 141 -shell 3 -solid 2 -compsolid 0 -compound 4 -shape 936

View File

@@ -1,31 +0,0 @@
puts "========"
puts "OCC30921"
puts "========"
puts ""
##########################################################################
# STEPCAFControl_Reader incorrectly reads the specified stp file
##########################################################################
stepread [locate_data_file bug30921.stp] a *
tpcompound result
checkprops result -s 288180
puts "REQUIRED All: Faulty shapes in variables faulty_1 to faulty_39"
checkshape result
set nbshapes_expected "
Number of shapes in shape
VERTEX : 2858
EDGE : 4331
WIRE : 1758
FACE : 1514
SHELL : 21
SOLID : 21
COMPSOLID : 0
COMPOUND : 1
SHAPE : 10504
"
checknbshapes result -ref ${nbshapes_expected} -t -m "Shape"
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -1,24 +0,0 @@
puts "============"
puts "0030003: Modeling Algorithms - Construction of pipe by two circular sections and spine curve leads to crash"
puts "============"
puts ""
beziercurve path 3 0 0 0 100 0 0 100 100 0
clear path
circle c1 0 0 0 1 0 0 10
circle c2 0 0 0 1 0 0 20
convert c1 c1 po
convert c2 c2 po
clear c1
clear c2
tuyau res path c1 c2
clpoles res
clknots res
nbiso res 10 10
smallview
fit
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
puts "TEST COMPLETED"