-// File: VrmlData_Geometry.cxx
-// Created: 25.05.06 17:07:37
-// Author: Alexander GRIGORIEV
-// Copyright: Open Cascade 2006
+// Created on: 2006-05-25
+// Created by: Alexander GRIGORIEV
+// Copyright (c) 2006-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 <VrmlData_Scene.hxx>
//purpose :
//=======================================================================
-const gp_XYZ& VrmlData_ArrayVec3d::Value (const Standard_Integer i) const
+const gp_XYZ& VrmlData_ArrayVec3d::Value (const Standard_Size i) const
{
- size_t anIndex = (size_t)i;
- if (anIndex < 0 || anIndex >= myLength) {
- static gp_XYZ anOrigin (0., 0., 0.);
- return anOrigin;
- }
- return myArray[i];
+ static gp_XYZ anOrigin (0., 0., 0.);
+ return i < myLength ? myArray[i] : anOrigin;
}
//=======================================================================
if (OK (aStatus, Scene().WriteLine (thePrefix, header, GlobalIndent())))
{
char buf[128];
- sprintf (buf, "size %.12g %.12g %.12g", mySize.X(), mySize.Y(), mySize.Z());
+ Sprintf (buf, "size %.12g %.12g %.12g", mySize.X(), mySize.Y(), mySize.Z());
Scene().WriteLine (buf);
aStatus = WriteClosing();
}
{
char buf[128];
if ((myBottomRadius - 1.)*(myBottomRadius - 1.) > Precision::Confusion()) {
- sprintf (buf, "bottomRadius %.12g", myBottomRadius);
+ Sprintf (buf, "bottomRadius %.12g", myBottomRadius);
aStatus = Scene().WriteLine (buf);
}
if (OK(aStatus) &&
(myHeight - 2.)*(myHeight - 2.) > Precision::Confusion()) {
- sprintf (buf, "height %.12g", myHeight);
+ Sprintf (buf, "height %.12g", myHeight);
aStatus = Scene().WriteLine (buf);
}
if (OK(aStatus) && myHasBottom == Standard_False)
{
char buf[128];
if ((myRadius - 1.)*(myRadius - 1.) > Precision::Confusion()) {
- sprintf (buf, "radius %.12g", myRadius);
+ Sprintf (buf, "radius %.12g", myRadius);
aStatus = Scene().WriteLine (buf);
}
if (OK(aStatus) &&
(myHeight - 2.)*(myHeight - 2.) > Precision::Confusion()) {
- sprintf (buf, "height %.12g", myHeight);
+ Sprintf (buf, "height %.12g", myHeight);
aStatus = Scene().WriteLine (buf);
}
if (OK(aStatus) && myHasBottom == Standard_False)
if (OK (aStatus, Scene().WriteLine (thePrefix, header, GlobalIndent())))
{
char buf[128];
- sprintf (buf, "radius %.12g", myRadius);
+ Sprintf (buf, "radius %.12g", myRadius);
Scene().WriteLine (buf);
aStatus = WriteClosing();
}
// Match the name with the current word in the stream
if (VRMLDATA_LCOMPARE (theBuffer.LinePtr, "point"))
// Read the body of the data node (comma-separated list of duplets)
- if (OK(aStatus, VrmlData_Scene::ReadLine(theBuffer)))
+ if (OK(aStatus, VrmlData_Scene::ReadLine(theBuffer))) {
if (theBuffer.LinePtr[0] != '[') // opening bracket
aStatus = VrmlData_VrmlFormatError;
else {
theBuffer.LinePtr++;
- while (~0) {
+ for(;;) {
gp_XY anXY;
if (!OK(aStatus, VrmlData_Scene::ReadLine(theBuffer)))
break;
break;
if (theBuffer.LinePtr[0] == ',') {
theBuffer.LinePtr++;
- continue;
- } else if (theBuffer.LinePtr[0] == ']') // closing bracket
+ } else if (theBuffer.LinePtr[0] == ']') { // closing bracket
theBuffer.LinePtr++;
- else
- aStatus = VrmlData_VrmlFormatError;
- break;
+ break;
+ }
}
}
+ }
if (OK(aStatus) && OK(aStatus, readBrace (theBuffer))) {
myLength = vecValues.Length();
if (myLength > 0) {
if (OK(aStatus, VrmlData_Scene::ReadLine(theBuffer))) {
// Match the name with the current word in the stream
if (theName) {
- const Standard_Integer aNameLen = strlen(theName);
+ const Standard_Size aNameLen = strlen(theName);
if (strncmp (theBuffer.LinePtr, theName, aNameLen))
aStatus = VrmlData_VrmlFormatError;
else
theBuffer.LinePtr++;
}
// Read the body of the data node (list of triplets)
- if (OK(aStatus) && OK(aStatus, VrmlData_Scene::ReadLine(theBuffer)))
+ if (OK(aStatus) && OK(aStatus, VrmlData_Scene::ReadLine(theBuffer))) {
if (theBuffer.LinePtr[0] != '[') // opening bracket
aStatus = VrmlData_VrmlFormatError;
else {
theBuffer.LinePtr++;
- while (~0) {
+ for(;;) {
gp_XYZ anXYZ;
if (!OK(aStatus, VrmlData_Scene::ReadLine(theBuffer)))
break;
}
}
}
+ }
if (OK(aStatus) && OK(aStatus, readBrace (theBuffer))) {
myLength = vecValues.Length();
if (myLength > 0) {