Fix some compilation warnings

This commit is contained in:
eap 2017-01-25 14:30:21 +03:00
parent 45a00be884
commit 04056cdd32
11 changed files with 95 additions and 90 deletions

View File

@ -124,7 +124,7 @@ void VolumeSection::CenterOfGravity()
Standard_Real VolumeSection::CalculateVolume(Standard_Real Elevation) Standard_Real VolumeSection::CalculateVolume(Standard_Real Elevation)
{ {
Standard_Integer i,noeud[3],flag[3]; Standard_Integer i,noeud[3],flag[3];
Standard_Integer nbNodes; //Standard_Integer nbNodes;
TopExp_Explorer ex; TopExp_Explorer ex;
TopLoc_Location L; TopLoc_Location L;
Standard_Real z[3]; Standard_Real z[3];
@ -144,7 +144,7 @@ Standard_Real VolumeSection::CalculateVolume(Standard_Real Elevation)
MESSAGE("Error, null layer" ) MESSAGE("Error, null layer" )
const Poly_Array1OfTriangle& triangles = Tr->Triangles(); const Poly_Array1OfTriangle& triangles = Tr->Triangles();
Standard_Integer nbTriangles = Tr->NbTriangles(); Standard_Integer nbTriangles = Tr->NbTriangles();
nbNodes = Tr->NbNodes(); //nbNodes = Tr->NbNodes();
const TColgp_Array1OfPnt& Nodes = Tr->Nodes(); const TColgp_Array1OfPnt& Nodes = Tr->Nodes();
// Calcul des volumes de chaque triangle, de chaque face // Calcul des volumes de chaque triangle, de chaque face

View File

@ -258,8 +258,8 @@ TopoDS_Shape GEOM_Client::GetShape( GEOM::GEOM_Gen_ptr geom, GEOM::GEOM_Object_p
BRep_Builder B; BRep_Builder B;
TopoDS_Compound aCompound; TopoDS_Compound aCompound;
B.MakeCompound(aCompound); B.MakeCompound(aCompound);
for (int i = 0; i < list->length(); i++) { for (size_t i = 0; i < list->length(); i++) {
if (0 < list[i] && list[i] <= _mySubShapes[mainIOR].size()) { if (0 < list[i] && list[i] <= (CORBA::Long)_mySubShapes[mainIOR].size()) {
TopoDS_Shape aSubShape = _mySubShapes[mainIOR][list[i]-1]; TopoDS_Shape aSubShape = _mySubShapes[mainIOR][list[i]-1];
B.Add(aCompound, aSubShape); B.Add(aCompound, aSubShape);
} }

View File

@ -262,7 +262,7 @@ namespace
levelsListStr.push_back( substr ); levelsListStr.push_back( substr );
} }
GEOMUtils::LevelsList levelsListData; GEOMUtils::LevelsList levelsListData;
for( int level = 0; level < levelsListStr.size(); level++ ) { for( size_t level = 0; level < levelsListStr.size(); level++ ) {
std::vector<std::string> namesListStr; std::vector<std::string> namesListStr;
std::stringstream ss1( levelsListStr[level] ); std::stringstream ss1( levelsListStr[level] );
while ( std::getline( ss1, substr, ',' ) ) { while ( std::getline( ss1, substr, ',' ) ) {
@ -270,7 +270,7 @@ namespace
namesListStr.push_back( substr ); namesListStr.push_back( substr );
} }
GEOMUtils::LevelInfo levelInfoData; GEOMUtils::LevelInfo levelInfoData;
for( int node = 0; node < namesListStr.size(); node++ ) { for( size_t node = 0; node < namesListStr.size(); node++ ) {
std::vector<std::string> linksListStr; std::vector<std::string> linksListStr;
std::stringstream ss2( namesListStr[node] ); std::stringstream ss2( namesListStr[node] );
while ( std::getline( ss2, substr, '_' ) ) { while ( std::getline( ss2, substr, '_' ) ) {
@ -280,7 +280,7 @@ namespace
std::string nodeItem = linksListStr[0]; std::string nodeItem = linksListStr[0];
if( !nodeItem.empty() ) { if( !nodeItem.empty() ) {
GEOMUtils::NodeLinks linksListData; GEOMUtils::NodeLinks linksListData;
for( int link = 1; link < linksListStr.size(); link++ ) { for( size_t link = 1; link < linksListStr.size(); link++ ) {
std::string linkItem = linksListStr[link]; std::string linkItem = linksListStr[link];
linksListData.push_back( linkItem ); linksListData.push_back( linkItem );
}// Links }// Links
@ -1083,7 +1083,7 @@ void GEOMUtils::ConvertStringToTree( const std::string& dependencyStr,
cursor = objectIndex; cursor = objectIndex;
std::size_t upwardIndexBegin = dependencyStr.find("{",cursor) + 1; std::size_t upwardIndexBegin = dependencyStr.find("{",cursor) + 1;
std::size_t upwardIndexFinish = dependencyStr.find("}",upwardIndexBegin); //std::size_t upwardIndexFinish = dependencyStr.find("}",upwardIndexBegin);
LevelsList upwardList = parseWard( dependencyStr, cursor ); LevelsList upwardList = parseWard( dependencyStr, cursor );
LevelsList downwardList = parseWard( dependencyStr, cursor ); LevelsList downwardList = parseWard( dependencyStr, cursor );

View File

@ -35,8 +35,8 @@ namespace GEOMUtils
// purpose : gets measures of the given type for list of shapes in the range // purpose : gets measures of the given type for list of shapes in the range
//================================================================================= //=================================================================================
std::map<int,double> ComputeMeasures( std::list<TopoDS_Shape> shapes, std::map<int,double> ComputeMeasures( std::list<TopoDS_Shape> shapes,
TopAbs_ShapeEnum entity, TopAbs_ShapeEnum entity,
Range &range) Range &range)
{ {
bool hasRange = (range.min != -1.0); // -1.0 means that range must not be used bool hasRange = (range.min != -1.0); // -1.0 means that range must not be used
if ( !hasRange ) if ( !hasRange )
@ -60,23 +60,23 @@ namespace GEOMUtils
//Get the measure: length, area or volume //Get the measure: length, area or volume
GProp_GProps LProps, SProps, VProps; GProp_GProps LProps, SProps, VProps;
if ( entity == TopAbs_EDGE ) { if ( entity == TopAbs_EDGE ) {
BRepGProp::LinearProperties( aSubShape, LProps ); BRepGProp::LinearProperties( aSubShape, LProps );
aMeasure = LProps.Mass(); aMeasure = LProps.Mass();
} else if ( entity == TopAbs_FACE ) { } else if ( entity == TopAbs_FACE ) {
BRepGProp::SurfaceProperties( aSubShape, SProps ); BRepGProp::SurfaceProperties( aSubShape, SProps );
aMeasure = SProps.Mass(); aMeasure = SProps.Mass();
} else if ( entity == TopAbs_SOLID ) { } else if ( entity == TopAbs_SOLID ) {
BRepGProp::VolumeProperties( aSubShape, VProps ); BRepGProp::VolumeProperties( aSubShape, VProps );
aMeasure = VProps.Mass(); aMeasure = VProps.Mass();
} }
// Don't pass sub-shapes with out of range measure, if range is used // Don't pass sub-shapes with out of range measure, if range is used
if ( hasRange ) { if ( hasRange ) {
if ( aMeasure < range.min || aMeasure > range.max ) if ( aMeasure < range.min || aMeasure > range.max )
continue; continue;
} else { } else {
// get range min and max // get range min and max
if ( aMeasure < range.min ) range.min = aMeasure; if ( aMeasure < range.min ) range.min = aMeasure;
if ( aMeasure > range.max ) range.max = aMeasure; if ( aMeasure > range.max ) range.max = aMeasure;
} }
// get global index of sub-shape // get global index of sub-shape
index = aSubShapesMap.FindIndex( aSubShape ); index = aSubShapesMap.FindIndex( aSubShape );
@ -93,9 +93,9 @@ namespace GEOMUtils
// purpose : gets distribution data for single shape // purpose : gets distribution data for single shape
//================================================================================= //=================================================================================
Distribution ComputeDistribution( TopoDS_Shape shape, Distribution ComputeDistribution( TopoDS_Shape shape,
TopAbs_ShapeEnum entity, TopAbs_ShapeEnum entity,
int intervals, int intervals,
Range range) Range range)
{ {
std::list<TopoDS_Shape> aShapes; std::list<TopoDS_Shape> aShapes;
aShapes.push_back( shape ); aShapes.push_back( shape );
@ -107,9 +107,9 @@ Distribution ComputeDistribution( TopoDS_Shape shape,
// purpose : gets distribution data for list of shapes // purpose : gets distribution data for list of shapes
//================================================================================= //=================================================================================
Distribution ComputeDistribution( std::list<TopoDS_Shape> shapes, Distribution ComputeDistribution( std::list<TopoDS_Shape> shapes,
TopAbs_ShapeEnum entity, TopAbs_ShapeEnum entity,
int nbIntervals, int nbIntervals,
Range range) Range range)
{ {
// get list of measures and compute range (if it was not specified) // get list of measures and compute range (if it was not specified)
std::map<int,double> measures = ComputeMeasures( shapes, entity, range ); std::map<int,double> measures = ComputeMeasures( shapes, entity, range );
@ -129,15 +129,15 @@ Distribution ComputeDistribution( std::list<TopoDS_Shape> shapes,
std::vector<int> indicesToErase; std::vector<int> indicesToErase;
for ( dit = measures.begin(); dit != measures.end(); dit++ ) { for ( dit = measures.begin(); dit != measures.end(); dit++ ) {
if ( ( dit->second >= localRange.min && dit->second < localRange.max ) || if ( ( dit->second >= localRange.min && dit->second < localRange.max ) ||
( i == nbIntervals-1 && dit->second == localRange.max ) ) { ( i == nbIntervals-1 && dit->second == localRange.max ) ) {
localRange.count++; localRange.count++;
localRange.indices.push_back( dit->first ); localRange.indices.push_back( dit->first );
// measure is in interval, so remove it from map of search // measure is in interval, so remove it from map of search
indicesToErase.push_back( dit->first ); indicesToErase.push_back( dit->first );
} }
} }
aDistr.push_back( localRange ); aDistr.push_back( localRange );
for( int j=0; j < indicesToErase.size(); j++ ) for( size_t j=0; j < indicesToErase.size(); j++ )
measures.erase( indicesToErase[j] ); measures.erase( indicesToErase[j] );
} }

View File

@ -137,6 +137,7 @@ namespace
return xmlPaths; return xmlPaths;
} }
#ifdef MYDEBUG
void dumpinfo(const GEOMUtils::PluginInfo& info) void dumpinfo(const GEOMUtils::PluginInfo& info)
{ {
printf("DUMPING PLUGIN INFO\n"); printf("DUMPING PLUGIN INFO\n");
@ -160,6 +161,7 @@ namespace
printf("-----\n"); printf("-----\n");
} }
} }
#endif
} }
namespace GEOMUtils namespace GEOMUtils

View File

@ -3919,8 +3919,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
# #
# @return New GEOM.GEOM_Object, containing the created pipe if # @return New GEOM.GEOM_Object, containing the created pipe if
# \a IsGenerateGroups is not set. Otherwise it returns new # \a IsGenerateGroups is not set. Otherwise it returns a
# GEOM.ListOfGO. Its first element is the created pipe, the # list of GEOM.GEOM_Object. Its first element is the created pipe, the
# remaining ones are created groups. # remaining ones are created groups.
# #
# @ref tui_creation_pipe "Example" # @ref tui_creation_pipe "Example"
@ -3959,8 +3959,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
Returns: Returns:
New GEOM.GEOM_Object, containing the created pipe if New GEOM.GEOM_Object, containing the created pipe if
IsGenerateGroups is not set. Otherwise it returns new IsGenerateGroups is not set. Otherwise it returns a
GEOM.ListOfGO. Its first element is the created pipe, the list of GEOM.GEOM_Object. Its first element is the created pipe, the
remaining ones are created groups. remaining ones are created groups.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py

View File

@ -707,10 +707,14 @@ Standard_Boolean GEOM_AISShape::computeMassCenter( const TopoDS_Shape& theShape,
C += ( uv1.XY() + uv2.XY() + uv3.XY() ) / 3. * a; C += ( uv1.XY() + uv2.XY() + uv3.XY() ) / 3. * a;
A += a; A += a;
} }
C /= A; if ( A > std::numeric_limits<double>::min() )
theCenter = surface.Value( C.X(), C.Y() ); {
C /= A;
theCenter = surface.Value( C.X(), C.Y() );
aNbPoints = 1;
}
} }
else if ( aNbPoints == 0 )
{ {
theCenter = surface.Value( 0.5 * ( surface.FirstUParameter() + surface.LastUParameter() ), theCenter = surface.Value( 0.5 * ( surface.FirstUParameter() + surface.LastUParameter() ),
0.5 * ( surface.FirstVParameter() + surface.LastVParameter() )); 0.5 * ( surface.FirstVParameter() + surface.LastVParameter() ));

View File

@ -369,7 +369,7 @@ private:
\brief Constructor \brief Constructor
\internal \internal
*/ */
Sketcher_Profile::Functor::Functor() : myError( 0 ), myNumberOfCommand( 0 ), myOk( true ) Sketcher_Profile::Functor::Functor() : myNumberOfCommand( 0 ), myError( 0 ), myOk( true )
{ {
} }

View File

@ -279,47 +279,47 @@ Handle(Geom_Surface) ShHealOper_FillHoles::buildSurface(const TopoDS_Wire& theWi
{ {
Handle(Geom_BSplineSurface) aSurf; Handle(Geom_BSplineSurface) aSurf;
try { try {
GeomPlate_BuildPlateSurface aBuilder(myDegree, myNbPtsOnCur, myNbIter, GeomPlate_BuildPlateSurface aBuilder(myDegree, myNbPtsOnCur, myNbIter,
myTol2d, myTol3d, myTolAng, myTolCrv); myTol2d, myTol3d, myTolAng, myTolCrv);
TopoDS_Iterator aIter; TopoDS_Iterator aIter;
for(aIter.Initialize (theWire); aIter.More(); aIter.Next()) { for(aIter.Initialize (theWire); aIter.More(); aIter.Next()) {
TopoDS_Edge ae = TopoDS::Edge(aIter.Value()); TopoDS_Edge ae = TopoDS::Edge(aIter.Value());
BRepAdaptor_Curve adC(ae); BRepAdaptor_Curve adC(ae);
Handle(BRepAdaptor_HCurve) aHAD= new BRepAdaptor_HCurve(adC); Handle(BRepAdaptor_HCurve) aHAD= new BRepAdaptor_HCurve(adC);
Handle(BRepFill_CurveConstraint) aConst = // Handle(BRepFill_CurveConstraint) aConst =
new BRepFill_CurveConstraint (Handle(Adaptor3d_HCurve)::DownCast(aHAD), (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d); // new BRepFill_CurveConstraint (Handle(Adaptor3d_HCurve)::DownCast(aHAD), (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d);
//Handle(GeomPlate_CurveConstraint) aConst = Handle(GeomPlate_CurveConstraint) aConst =
// new GeomPlate_CurveConstraint(aHAD, (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d); new GeomPlate_CurveConstraint(aHAD, (Standard_Integer) GeomAbs_C0, myNbPtsOnCur, myTol3d);
aBuilder.Add (Handle(GeomPlate_CurveConstraint)::DownCast(aConst)); aBuilder.Add (aConst);
}
aBuilder.Perform();
if(!aBuilder.IsDone())
return aSurf;
Handle(GeomPlate_Surface) aPlSurf = aBuilder.Surface();
//for filling holes without initial specified surface
//the initial surface should be build by GeomPlate itself
//following code was taken from BRepFill_Filling::Build
Standard_Real aDist = aBuilder.G0Error();
TColgp_SequenceOfXY S2d;
TColgp_SequenceOfXYZ S3d;
S2d.Clear();
S3d.Clear();
aBuilder.Disc2dContour(4,S2d);
aBuilder.Disc3dContour(4,0,S3d);
Standard_Real amaxTol = Max( myTol3d, 10* aDist);
GeomPlate_PlateG0Criterion Criterion( S2d, S3d, amaxTol );
GeomPlate_MakeApprox Approx( aPlSurf, Criterion, myTol3d, myMaxSeg, myMaxDeg );
aSurf = Approx.Surface();
if(aSurf.IsNull())
return aSurf;
theCurves2d = aBuilder.Curves2d();
theOrders = aBuilder.Order();
theSenses = aBuilder.Sense();
} }
aBuilder.Perform();
if(!aBuilder.IsDone())
return aSurf;
Handle(GeomPlate_Surface) aPlSurf = aBuilder.Surface();
//for filling holes without initial specified surface
//the initial surface should be build by GeomPlate itself
//following code was taken from BRepFill_Filling::Build
Standard_Real aDist = aBuilder.G0Error();
TColgp_SequenceOfXY S2d;
TColgp_SequenceOfXYZ S3d;
S2d.Clear();
S3d.Clear();
aBuilder.Disc2dContour(4,S2d);
aBuilder.Disc3dContour(4,0,S3d);
Standard_Real amaxTol = Max( myTol3d, 10* aDist);
GeomPlate_PlateG0Criterion Criterion( S2d, S3d, amaxTol );
GeomPlate_MakeApprox Approx( aPlSurf, Criterion, myTol3d, myMaxSeg, myMaxDeg );
aSurf = Approx.Surface();
if(aSurf.IsNull())
return aSurf;
theCurves2d = aBuilder.Curves2d();
theOrders = aBuilder.Order();
theSenses = aBuilder.Sense();
}
catch (Standard_Failure) { catch (Standard_Failure) {
aSurf.Nullify(); aSurf.Nullify();

View File

@ -34,18 +34,17 @@ using namespace XAO;
// ------------------------------------------------------- // -------------------------------------------------------
Field::Field(const XAO::Dimension& dimension, Field::Field(const XAO::Dimension& dimension,
const int& nbElements, const int& nbComponents, const std::string& name) const int& nbElements, const int& nbComponents, const std::string& name)
: m_name(name), m_dimension(dimension), m_nbElements(nbElements), m_nbComponents(nbComponents) : m_name(name), m_dimension(dimension),
m_nbComponents(nbComponents), m_components(nbComponents, ""),
m_nbElements(nbElements)
{ {
m_components.reserve(nbComponents);
for (int i = 0; i < nbComponents; ++i)
m_components.push_back("");
} }
Field::~Field() Field::~Field()
{ {
for (unsigned int i = 0; i < m_steps.size(); ++i) for (unsigned int i = 0; i < m_steps.size(); ++i)
delete m_steps[i]; delete m_steps[i];
} }
Field* Field::createField(const XAO::Type& type, const XAO::Dimension& dimension, Field* Field::createField(const XAO::Type& type, const XAO::Dimension& dimension,
@ -83,7 +82,7 @@ throw (XAO_Exception)
{ {
for (unsigned int i = 0; i < names.size(); ++i) for (unsigned int i = 0; i < names.size(); ++i)
{ {
if (i < m_nbComponents) if ((int)i < m_nbComponents)
m_components[i] = names[i]; m_components[i] = names[i];
} }
} }
@ -130,7 +129,7 @@ throw (XAO_Exception)
void Field::checkStepIndex(const int& step) void Field::checkStepIndex(const int& step)
throw (XAO_Exception) throw (XAO_Exception)
{ {
if (step < m_steps.size() && step >= 0) if (step < (int)m_steps.size() && step >= 0)
return; return;
throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, " throw XAO_Exception(MsgBuilder() << "Step index is out of range [0, "

View File

@ -43,7 +43,7 @@ Group::~Group()
void Group::checkIndex(const int& element) void Group::checkIndex(const int& element)
throw (XAO_Exception) throw (XAO_Exception)
{ {
if (element < m_elements.size() && element >= 0) if (element < (int)m_elements.size() && element >= 0)
return; return;
throw XAO_Exception(MsgBuilder() << "Index of element is out of range [0, " throw XAO_Exception(MsgBuilder() << "Index of element is out of range [0, "