1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
occt/src/Poly/Poly_CoherentNode.cxx
abv 91322f44fd 0022898: IGES import fails in german environment
Added DRAW command dlocale to set and query current locale of the C subsystem
Equivalents of C functions working with conversions of strings to/from reals added in Standard_CString, providing locale-independent behavior (using always "C" locale)
In DRAW packages, calls to atof() and atoi() are replaced by direct calls to Draw::Atof() and Draw::Atoi(), respectively, instead of substituting by #define
Use of atof(), strtod(), and *scanf() involving floating point conversions in OCCT code replaced by locale-independent Atof() and Strtod()
Calls to sprintf() involving floating point in OCCT code are replaced by call to locale-independent Sprintf(), except a few places where converted strings are used immediately for display in the 3d viewer
Changes of global locale are eliminated throughout OCCT code
Proposed correction for GNU libC where v*printf_l functions are absent
Added test case (bugs xde bug22898) for data exchange operations with non-standard locale
Use xlocale on Mac OS X and within glibc
Corrected strtod_l wrapper
Generate error rather than warning
Introduce Standard_CLocaleSentry replacement for removed OSD_Localizer
Standard_CLocaleSentry - copy locale string
Standard_CLocaleSentry - use _configthreadlocale on Windows
Standard_CLocaleSentry::GetCLocale() - return locale_t rather than void*
Corrected misprint in ~Standard_CLocaleSentry()
Use French locale in bug22898 test case
Mark test case as skipped if locale is unavailable on tested system.
Use fr_FR locale for tests on Mac OS X
2013-02-01 18:41:16 +04:00

120 lines
4.3 KiB
C++
Executable File

// Created on: 2007-12-14
// Created by: Alexander GRIGORIEV
// Copyright (c) 2007-2012 OPEN CASCADE SAS
//
// The content of this file is subject to the Open CASCADE Technology Public
// License Version 6.5 (the "License"). You may not use the content of this file
// except in compliance with the License. Please obtain a copy of the License
// at http://www.opencascade.org and read it completely before using this file.
//
// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
//
// The Original Code and all software distributed under the License is
// distributed on an "AS IS" basis, without warranty of any kind, and the
// Initial Developer hereby disclaims all such warranties, including without
// limitation, any warranties of merchantability, fitness for a particular
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <Poly_CoherentNode.hxx>
#include <Poly_CoherentTriangle.hxx>
#ifdef WNT
#pragma warning(disable:4996)
#endif
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void Poly_CoherentNode::Clear (const Handle_NCollection_BaseAllocator& theAlloc)
{
Poly_CoherentTriPtr::RemoveList (myTriangles, theAlloc);
myUV[0] = Precision::Infinite();
myUV[1] = Precision::Infinite();
myNormal[0] = 0.f;
myNormal[1] = 0.f;
myNormal[2] = 0.f;
SetCoord(0., 0., 0.);
}
//=======================================================================
//function : SetNormal
//purpose : Define the normal vector in the Node.
//=======================================================================
void Poly_CoherentNode::SetNormal (const gp_XYZ& theVector)
{
myNormal[0] = static_cast<Standard_ShortReal>(theVector.X());
myNormal[1] = static_cast<Standard_ShortReal>(theVector.Y());
myNormal[2] = static_cast<Standard_ShortReal>(theVector.Z());
}
//=======================================================================
//function : AddTriangle
//purpose :
//=======================================================================
void Poly_CoherentNode::AddTriangle
(const Poly_CoherentTriangle& theTri,
const Handle_NCollection_BaseAllocator& theAlloc)
{
if (myTriangles == NULL)
myTriangles = new (theAlloc) Poly_CoherentTriPtr(theTri);
else
myTriangles->Prepend(&theTri, theAlloc);
}
//=======================================================================
//function : RemoveTriangle
//purpose :
//=======================================================================
Standard_Boolean Poly_CoherentNode::RemoveTriangle
(const Poly_CoherentTriangle& theTri,
const Handle_NCollection_BaseAllocator& theAlloc)
{
Standard_Boolean aResult(Standard_False);
if (&myTriangles->GetTriangle() == &theTri) {
Poly_CoherentTriPtr * aLostPtr = myTriangles;
if (myTriangles == &myTriangles->Next())
myTriangles = 0L;
else
myTriangles = &myTriangles->Next();
Poly_CoherentTriPtr::Remove(aLostPtr, theAlloc);
aResult = Standard_True;
} else {
Poly_CoherentTriPtr::Iterator anIter(* myTriangles);
for (anIter.Next(); anIter.More(); anIter.Next())
if (&anIter.Value() == &theTri) {
Poly_CoherentTriPtr::Remove
(const_cast<Poly_CoherentTriPtr *>(&anIter.PtrValue()), theAlloc);
aResult = Standard_True;
break;
}
}
return aResult;
}
//=======================================================================
//function : Dump
//purpose :
//=======================================================================
void Poly_CoherentNode::Dump(Standard_OStream& theStream) const
{
char buf[256];
Sprintf (buf, " X =%9.4f; Y =%9.4f; Z =%9.4f", X(), Y(), Z());
theStream << buf << endl;
Poly_CoherentTriPtr::Iterator anIter(* myTriangles);
for (; anIter.More(); anIter.Next()) {
const Poly_CoherentTriangle& aTri = anIter.Value();
Sprintf (buf, " %5d %5d %5d", aTri.Node(0),aTri.Node(1),aTri.Node(2));
theStream << buf << endl;
}
}