mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0023787: Eliminate trivial type conversion warnings in MSVC
Explicit type cast added in conversions from double to float in PrsMgr, Select3D, StdPrs, Visual3d, and Voxel. Minor corrections in ShapeProcess and TCollection. In Visual3d_ViewManager::ConvertCoord...(), output is initialized by zeros instead of RealLast() in case of failure. In XmlMXCAFDoc, material density is correctly converted to string when writing to Xml.
This commit is contained in:
parent
5788f5438f
commit
7f4c47564c
@ -293,9 +293,9 @@ void PrsMgr_PresentableObject::SetTransformPersistence( const Graphic3d_TransMo
|
||||
const gp_Pnt& ThePoint )
|
||||
{
|
||||
myTransformPersistence.Flag = TheFlag;
|
||||
myTransformPersistence.Point.x = ThePoint.X();
|
||||
myTransformPersistence.Point.y = ThePoint.Y();
|
||||
myTransformPersistence.Point.z = ThePoint.Z();
|
||||
myTransformPersistence.Point.x = (Standard_ShortReal)ThePoint.X();
|
||||
myTransformPersistence.Point.y = (Standard_ShortReal)ThePoint.Y();
|
||||
myTransformPersistence.Point.z = (Standard_ShortReal)ThePoint.Z();
|
||||
|
||||
Handle(Graphic3d_Structure) aStruct;
|
||||
for( Standard_Integer i = 1, n = myPresentations.Length(); i <= n; i++ )
|
||||
|
@ -221,12 +221,14 @@ Standard_Boolean Select3D_SensitiveGroup::Matches(const Standard_Real X,
|
||||
Standard_Real& DMin)
|
||||
{
|
||||
myLastRank = 0;
|
||||
myLastTol = aTol;
|
||||
myLastTol = (Standard_ShortReal)aTol;
|
||||
for(Select3D_ListIteratorOfListOfSensitive It(myList);It.More();It.Next()){
|
||||
myLastRank++;
|
||||
if (It.Value()->Matches (X, Y, aTol, DMin))
|
||||
{
|
||||
myX = X; myY = Y; myLastTol = aTol;
|
||||
myX = (Standard_ShortReal)X;
|
||||
myY = (Standard_ShortReal)Y;
|
||||
myLastTol = (Standard_ShortReal)aTol;
|
||||
// compute and validate the depth (will call ::ComputeDepth())
|
||||
return Select3D_SensitiveEntity::Matches (X, Y, aTol, DMin);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ Handle(Resource_Manager) ShapeProcess_Context::LoadResourceManager (const Standa
|
||||
// Optimisation of loading resource file: file is load only once
|
||||
// and reloaded only if file date has changed
|
||||
static Handle(Resource_Manager) sRC;
|
||||
static long mtime;
|
||||
static Standard_Time mtime;
|
||||
static TCollection_AsciiString name;
|
||||
if ( ! sRC.IsNull() && ! name.IsEqual ( file ) ) sRC.Nullify();
|
||||
if ( ! sRC.IsNull() ) {
|
||||
|
@ -137,9 +137,9 @@ void StdPrs_ToolShadedShape::Normal(const TopoDS_Face& aFace,
|
||||
}
|
||||
|
||||
Standard_Integer j = (i - UVNodes.Lower()) * 3;
|
||||
Normals->SetValue(j + 1, Nor(i).X());
|
||||
Normals->SetValue(j + 2, Nor(i).Y());
|
||||
Normals->SetValue(j + 3, Nor(i).Z());
|
||||
Normals->SetValue(j + 1, (Standard_ShortReal)Nor(i).X());
|
||||
Normals->SetValue(j + 2, (Standard_ShortReal)Nor(i).Y());
|
||||
Normals->SetValue(j + 3, (Standard_ShortReal)Nor(i).Z());
|
||||
|
||||
if (aFace.Orientation() == TopAbs_REVERSED) (Nor(i)).Reverse();
|
||||
|
||||
@ -179,9 +179,9 @@ void StdPrs_ToolShadedShape::Normal(const TopoDS_Face& aFace,
|
||||
Nor(i) = gp_Dir(eqPlan);
|
||||
|
||||
Standard_Integer j = (i - Nodes.Lower()) * 3;
|
||||
Normals->SetValue(j + 1, Nor(i).X());
|
||||
Normals->SetValue(j + 2, Nor(i).Y());
|
||||
Normals->SetValue(j + 3, Nor(i).Z());
|
||||
Normals->SetValue(j + 1, (Standard_ShortReal)Nor(i).X());
|
||||
Normals->SetValue(j + 2, (Standard_ShortReal)Nor(i).Y());
|
||||
Normals->SetValue(j + 3, (Standard_ShortReal)Nor(i).Z());
|
||||
|
||||
if (aFace.Orientation() == TopAbs_REVERSED) (Nor(i)).Reverse();
|
||||
|
||||
|
@ -166,10 +166,11 @@ TCollection_ExtendedString::TCollection_ExtendedString
|
||||
mylength = nbSymbols(astring);
|
||||
mystring = Allocate(ROUNDMEM((mylength+1)*2));
|
||||
if(!ConvertToUnicode (astring))
|
||||
{
|
||||
#ifdef DEB
|
||||
cout <<"UTF8 decoding failure..." <<endl;
|
||||
#endif
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -321,7 +321,7 @@ void Visual3d_Layer::TextSize (const Standard_CString AText, const Standard_Rea
|
||||
Visual3d_LayerDefinitionError::Raise
|
||||
("One primitive is already open !");
|
||||
|
||||
MyGraphicDriver->TextSize (AText, AHeight, aWidth, anAscent, aDescent);
|
||||
MyGraphicDriver->TextSize (AText, (Standard_ShortReal)AHeight, aWidth, anAscent, aDescent);
|
||||
AWidth = aWidth;
|
||||
AnAscent = anAscent;
|
||||
ADescent = aDescent;
|
||||
|
@ -359,7 +359,8 @@ Standard_Real Sx, Sy, Sz;
|
||||
MyCView.Orientation.IsCustomMatrix = 1;
|
||||
for ( i = 0; i < 4; i++)
|
||||
for ( j = 0; j < 4; j++)
|
||||
MyCView.Orientation.ModelViewMatrix[i][j] = MyViewOrientation.MyModelViewMatrix->Value(i,j);
|
||||
MyCView.Orientation.ModelViewMatrix[i][j] =
|
||||
(Standard_ShortReal)MyViewOrientation.MyModelViewMatrix->Value(i,j);
|
||||
}
|
||||
else {
|
||||
MyCView.Orientation.IsCustomMatrix = 0;
|
||||
@ -395,7 +396,8 @@ Standard_Real um, vm, uM, vM;
|
||||
MyCView.Mapping.IsCustomMatrix = 1;
|
||||
for ( i = 0; i < 4; i++)
|
||||
for ( j = 0; j < 4; j++)
|
||||
MyCView.Mapping.ProjectionMatrix[i][j] = MyViewMapping.MyProjectionMatrix->Value(i,j);
|
||||
MyCView.Mapping.ProjectionMatrix[i][j] =
|
||||
(Standard_ShortReal)MyViewMapping.MyProjectionMatrix->Value(i,j);
|
||||
}
|
||||
else {
|
||||
MyCView.Mapping.IsCustomMatrix = 0;
|
||||
@ -1340,7 +1342,7 @@ Standard_Real um, vm, uM, vM;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
MyCView.Mapping.ProjectionMatrix[i][j] =
|
||||
MyViewMapping.MyProjectionMatrix->Value(i,j);
|
||||
(Standard_ShortReal)MyViewMapping.MyProjectionMatrix->Value(i,j);
|
||||
}
|
||||
|
||||
MyMatOfMapIsEvaluated = Standard_False;
|
||||
@ -1408,7 +1410,7 @@ Standard_Real um, vm, uM, vM;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
MyCView.Mapping.ProjectionMatrix[i][j] =
|
||||
MyViewMapping.MyProjectionMatrix->Value(i,j);
|
||||
(Standard_ShortReal)MyViewMapping.MyProjectionMatrix->Value(i,j);
|
||||
}
|
||||
|
||||
MyMatOfMapIsEvaluated = Standard_False;
|
||||
|
@ -634,9 +634,8 @@ Graphic3d_Vertex Visual3d_ViewManager::ConvertCoord (const Handle(Aspect_Window)
|
||||
Graphic3d_CView TheCView;
|
||||
Graphic3d_Vertex Point;
|
||||
|
||||
if (! ViewExists (AWindow, TheCView))
|
||||
Point.SetCoord (RealLast (), RealLast (), RealLast ());
|
||||
else {
|
||||
if (ViewExists (AWindow, TheCView))
|
||||
{
|
||||
Standard_Integer Width, Height;
|
||||
Standard_ShortReal x, y, z;
|
||||
Standard_Boolean Result;
|
||||
@ -753,8 +752,6 @@ Standard_Boolean BResult;
|
||||
|
||||
if (WCT != 0.)
|
||||
Point.SetCoord (WCX/WCT, WCY/WCT, WCZ/WCT);
|
||||
else
|
||||
Point.SetCoord (RealLast (), RealLast (), RealLast ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -768,7 +765,7 @@ void Visual3d_ViewManager::ConvertCoordWithProj (const Handle(Aspect_Window)& AW
|
||||
Graphic3d_CView TheCView;
|
||||
|
||||
if (! ViewExists (AWindow, TheCView)) {
|
||||
Point.SetCoord (RealLast (), RealLast (), RealLast ());
|
||||
Point.SetCoord (0., 0., 0.);
|
||||
Proj.SetCoord (0., 0., 0.);
|
||||
}
|
||||
else {
|
||||
@ -893,7 +890,7 @@ Standard_Boolean BResult;
|
||||
if (WCT != 0.)
|
||||
Point.SetCoord (WCX/WCT, WCY/WCT, WCZ/WCT);
|
||||
else
|
||||
Point.SetCoord (RealLast (), RealLast (), RealLast ());
|
||||
Point.SetCoord (0., 0., 0.);
|
||||
|
||||
// Define projection ray
|
||||
NPCZ = 10.0;
|
||||
|
@ -359,7 +359,7 @@ Standard_Boolean Voxel_Reader::ReadFloatAsciiVoxels(const TCollection_ExtendedSt
|
||||
return Standard_False;
|
||||
}
|
||||
}
|
||||
value = Atof(line);
|
||||
value = (Standard_ShortReal)Atof(line);
|
||||
|
||||
// Set value
|
||||
if (!((Standard_ShortReal**)((Voxel_DS*)myFloatVoxels)->myData)[i1])
|
||||
|
@ -467,9 +467,9 @@ Handle_VrmlData_Geometry VrmlData_ShapeConvert::triToIndexedFaceSet
|
||||
arrVec[i] = aNormal.XYZ();
|
||||
|
||||
Standard_Integer j = i * 3;
|
||||
Normals->SetValue(j + 1, aNormal.X());
|
||||
Normals->SetValue(j + 2, aNormal.Y());
|
||||
Normals->SetValue(j + 3, aNormal.Z());
|
||||
Normals->SetValue(j + 1, (Standard_ShortReal)aNormal.X());
|
||||
Normals->SetValue(j + 2, (Standard_ShortReal)aNormal.Y());
|
||||
Normals->SetValue(j + 3, (Standard_ShortReal)aNormal.Z());
|
||||
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,8 @@ void XmlMXCAFDoc_MaterialDriver::Paste (const Handle(TDF_Attribute)& theSource,
|
||||
if ( !anAtt->GetDensValType().IsNull() )
|
||||
aDensTypeStr = anAtt->GetDensValType()->String().ToCString();
|
||||
|
||||
XmlObjMgt::SetStringValue (theTarget, anAtt->GetDensity());
|
||||
TCollection_AsciiString aDensityStr (anAtt->GetDensity());
|
||||
XmlObjMgt::SetStringValue (theTarget, aDensityStr.ToCString());
|
||||
theTarget.Element().setAttribute(::NameIndexString(), aNameString);
|
||||
theTarget.Element().setAttribute(::DescrIndexString(),aDescrString);
|
||||
theTarget.Element().setAttribute(::DensNameIndexString(),aDensNameStr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user