From ac8f17746bb5fba82b0ee49e0611982996709fdb Mon Sep 17 00:00:00 2001 From: kgv Date: Mon, 11 Mar 2019 23:35:14 +0300 Subject: [PATCH] 0030554: Coding - ChFiDS_CommonPoint uninitialized member traarc Added missing initialization to ChFiDS_CommonPoint constructor. --- src/ChFiDS/ChFiDS_CommonPoint.cxx | 13 +-- src/ChFiDS/ChFiDS_CommonPoint.hxx | 69 ++++++++------- src/ChFiDS/ChFiDS_CommonPoint.lxx | 140 ------------------------------ src/ChFiDS/FILES | 1 - 4 files changed, 44 insertions(+), 179 deletions(-) delete mode 100644 src/ChFiDS/ChFiDS_CommonPoint.lxx diff --git a/src/ChFiDS/ChFiDS_CommonPoint.cxx b/src/ChFiDS/ChFiDS_CommonPoint.cxx index 528e0f325c..754fb26a46 100644 --- a/src/ChFiDS/ChFiDS_CommonPoint.cxx +++ b/src/ChFiDS/ChFiDS_CommonPoint.cxx @@ -27,11 +27,14 @@ //function : ChFiDS_CommonPoint //purpose : //======================================================================= -ChFiDS_CommonPoint::ChFiDS_CommonPoint() : -tol(0.), -isonarc(Standard_False), -isvtx(Standard_False), -hasvector(Standard_False) +ChFiDS_CommonPoint::ChFiDS_CommonPoint() +: tol (0.0), + prmarc (0.0), + prmtg (0.0), + traarc (TopAbs_FORWARD), + isonarc(Standard_False), + isvtx (Standard_False), + hasvector (Standard_False) { } diff --git a/src/ChFiDS/ChFiDS_CommonPoint.hxx b/src/ChFiDS/ChFiDS_CommonPoint.hxx index eff7f1e77d..e96aa3df6e 100644 --- a/src/ChFiDS/ChFiDS_CommonPoint.hxx +++ b/src/ChFiDS/ChFiDS_CommonPoint.hxx @@ -55,8 +55,12 @@ public: //! Sets the values of a point which is a vertex on //! the initial facet of restriction of one //! of the surface. - void SetVertex (const TopoDS_Vertex& V); - + void SetVertex (const TopoDS_Vertex& theVertex) + { + isvtx = Standard_True; + vtx = theVertex; + } + //! Sets the values of a point which is on the arc //! A, at parameter Param. Standard_EXPORT void SetArc (const Standard_Real Tol, const TopoDS_Edge& A, const Standard_Real Param, const TopAbs_Orientation TArc); @@ -66,30 +70,44 @@ public: //! Set the 3d point for a commonpoint that is not //! a vertex or on an arc. - void SetPoint (const gp_Pnt& Point); + void SetPoint (const gp_Pnt& thePoint) { point = thePoint; } //! Set the output 3d vector - void SetVector (const gp_Vec& Vector); + void SetVector (const gp_Vec& theVector) + { + hasvector = Standard_True; + vector = theVector; + } //! This method set the fuzziness on the point. - void SetTolerance (const Standard_Real Tol); + void SetTolerance (const Standard_Real Tol) + { + if (Tol > tol) + { + tol = Tol; + } + } //! This method returns the fuzziness on the point. - Standard_Real Tolerance() const; + Standard_Real Tolerance() const { return tol; } //! Returns TRUE if the point is a vertex on the initial //! restriction facet of the surface. - Standard_Boolean IsVertex() const; + Standard_Boolean IsVertex() const { return isvtx; } //! Returns the information about the point when it is //! on the domain of the first patch, i-e when the function //! IsVertex returns True. //! Otherwise, an exception is raised. - const TopoDS_Vertex& Vertex() const; - + const TopoDS_Vertex& Vertex() const + { + if (!isvtx) { throw Standard_DomainError(); } + return vtx; + } + //! Returns TRUE if the point is a on an edge of the initial //! restriction facet of the surface. - Standard_Boolean IsOnArc() const; + Standard_Boolean IsOnArc() const { return isonarc; } //! Returns the arc of restriction containing the //! vertex. @@ -107,27 +125,20 @@ public: Standard_EXPORT Standard_Real Parameter() const; //! Returns the 3d point - const gp_Pnt& Point() const; + const gp_Pnt& Point() const { return point; } //! Returns TRUE if the output vector is stored. - Standard_Boolean HasVector() const; + Standard_Boolean HasVector() const { return hasvector; } //! Returns the output 3d vector - const gp_Vec& Vector() const; - - - - -protected: - - - - + const gp_Vec& Vector() const + { + if (!hasvector) { throw Standard_DomainError ("ChFiDS_CommonPoint::Vector"); } + return vector; + } private: - - TopoDS_Edge arc; TopoDS_Vertex vtx; gp_Pnt point; @@ -135,19 +146,11 @@ private: Standard_Real tol; Standard_Real prmarc; Standard_Real prmtg; - Standard_Boolean isonarc; TopAbs_Orientation traarc; + Standard_Boolean isonarc; Standard_Boolean isvtx; Standard_Boolean hasvector; - }; - -#include - - - - - #endif // _ChFiDS_CommonPoint_HeaderFile diff --git a/src/ChFiDS/ChFiDS_CommonPoint.lxx b/src/ChFiDS/ChFiDS_CommonPoint.lxx deleted file mode 100644 index 30249bda89..0000000000 --- a/src/ChFiDS/ChFiDS_CommonPoint.lxx +++ /dev/null @@ -1,140 +0,0 @@ -// Created on: 1993-11-30 -// Created by: Isabelle GRIGNON -// 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. - -//======================================================================= -//function : SetVertex -//purpose : -//======================================================================= - -inline void ChFiDS_CommonPoint::SetVertex(const TopoDS_Vertex& V) -{ - isvtx = Standard_True; - vtx = V; -} - - -//======================================================================= -//function : SetPoint -//purpose : -//======================================================================= - - inline void ChFiDS_CommonPoint::SetPoint(const gp_Pnt& Point) -{ - point = Point; -} - -//======================================================================= -//function : SetVector -//purpose : -//======================================================================= - - inline void ChFiDS_CommonPoint::SetVector(const gp_Vec& Vector) -{ - hasvector = Standard_True; - vector = Vector; -} - -//======================================================================= -//function : SetTolerance -//purpose : -// PMN : 30/09/1997 : On se contente d'updater la tolerance. -//======================================================================= - - inline void ChFiDS_CommonPoint::SetTolerance(const Standard_Real Tol) -{ - if (Tol>tol) tol = Tol; -} - - -//======================================================================= -//function : Tolerance -//purpose : -//======================================================================= - - inline Standard_Real ChFiDS_CommonPoint::Tolerance()const -{ - return tol; -} - - -//======================================================================= -//function : IsVertex -//purpose : -//======================================================================= - - inline Standard_Boolean ChFiDS_CommonPoint::IsVertex()const -{ - return isvtx; -} - - -//======================================================================= -//function : Vertex -//purpose : -//======================================================================= - - inline const TopoDS_Vertex& ChFiDS_CommonPoint::Vertex()const -{ - if (!isvtx) {throw Standard_DomainError();} - return vtx; -} - -//======================================================================= -//function : Point -//purpose : -//======================================================================= - - inline const gp_Pnt& ChFiDS_CommonPoint::Point()const -{ - return point; -} - -//======================================================================= -//function : HasVector -//purpose : -//======================================================================= - - inline Standard_Boolean ChFiDS_CommonPoint::HasVector()const -{ - return hasvector; -} - -//======================================================================= -//function : Vector -//purpose : -//======================================================================= - - inline const gp_Vec& ChFiDS_CommonPoint::Vector()const -{ - if (!hasvector) { - throw Standard_DomainError("ChFiDS_CommonPoint::Vector"); - } - return vector; -} - -//======================================================================= -//function : IsOnArc -//purpose : -//======================================================================= - - inline Standard_Boolean ChFiDS_CommonPoint::IsOnArc()const -{ - return isonarc; -} - - - - diff --git a/src/ChFiDS/FILES b/src/ChFiDS/FILES index 3093415ae4..a5cbc1b5ed 100644 --- a/src/ChFiDS/FILES +++ b/src/ChFiDS/FILES @@ -6,7 +6,6 @@ ChFiDS_CircSection.cxx ChFiDS_CircSection.hxx ChFiDS_CommonPoint.cxx ChFiDS_CommonPoint.hxx -ChFiDS_CommonPoint.lxx ChFiDS_ElSpine.cxx ChFiDS_ElSpine.hxx ChFiDS_ErrorStatus.hxx -- 2.20.1