EgtExchange 2.7k1 :

- adattamenti e ricompilazione per passaggio a C++ 20
This commit is contained in:
Dario Sassi
2025-11-01 17:34:12 +01:00
parent e16657f560
commit df864c93a8
10 changed files with 41 additions and 36 deletions
+4 -4
View File
@@ -1074,8 +1074,8 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
// concateno le linee senza invertirle
const double TOLER = 10 * EPS_SMALL ;
ChainCurves chainC ;
chainC.Init( false, TOLER, int( vCrvP.size())) ;
for ( size_t i = 0 ; i < vCrvP.size() ; ++ i) {
chainC.Init( false, TOLER, ssize( vCrvP)) ;
for ( int i = 0 ; i < ssize( vCrvP) ; ++ i) {
Point3d ptStart, ptEnd ;
Vector3d vtStart, vtEnd ;
if ( ! vCrvP[i]->GetStartPoint( ptStart) || ! vCrvP[i]->GetStartDir( vtStart) ||
@@ -1092,7 +1092,7 @@ BtlGeom::AdjustOneOutlineFace( int nSide, ICURVEPOVECTOR& vCrvP)
if ( IsNull( pCrvCompo))
return false ;
// recupero le curve semplici e le inserisco nella curva composita
for ( size_t i = 0 ; i < vId2s.size() ; ++ i) {
for ( int i = 0 ; i < ssize( vId2s) ; ++ i) {
// indice della curva
int j = vId2s[i] - 1 ;
// la aggiungo alla curva composta
@@ -1401,7 +1401,7 @@ BtlGeom::AddShapeBTLX( const INTMATRIX& vFacesVertices, const PNTVECTOR& vPoints
// creo il contorno della faccia
PtrOwner<ICurveComposite> pCurveCompo( CreateCurveComposite()) ;
pCurveCompo->AddPoint( vPoints[vVertices[0]]) ;
for ( size_t i = 1 ; i != vVertices.size() ; i++)
for ( int i = 1 ; i < ssize( vVertices) ; i++)
pCurveCompo->AddLine( vPoints[vVertices[i]]) ;
pCurveCompo->AddLine( vPoints[vVertices[0]]) ;
// creo la faccia e recupero i suoi triangoli
+4 -4
View File
@@ -5071,7 +5071,7 @@ BtlGeom::AddText( int nGroup, int nProc, int nSide, const string& sDes, int nPro
Point3d ptP( vdPar[0], vdPar[1], 0) ; // P01, P02
Vector3d vtD = FromPolar( 1, vdPar[2]) ; // P06
double dH = vdPar[7] ; // P13
int nInsPos ;
int nInsPos = ETXT_IPMC ;
switch ( lround( vdPar[3])) { // P09
case 0 :
switch ( lround( vdPar[4])) { // P10
@@ -5105,8 +5105,8 @@ BtlGeom::AddText( int nGroup, int nProc, int nSide, const string& sDes, int nPro
// ruoto la direzione di riferimento
vtD.Rotate( Z_AX, 90) ;
// inserisco un a capo dopo ogni carattere, tranne l'ultimo
size_t nChar = sPar.size() ;
for ( size_t i = 0 ; i < nChar - 1 ; ++ i)
int nChar = ssize( sPar) ;
for ( int i = 0 ; i < nChar - 1 ; ++ i)
sText += sPar[i] + ETXT_LINEBREAK ;
sText += sPar[nChar-1] ;
// sistemo il tipo di inserimento
@@ -8704,7 +8704,7 @@ BtlGeom::CurveFromFces( const FCEDEQUE& dqFce, int nStartInd)
return nullptr ;
// recupero le entità free contour
int nEnt = -1 ;
for ( size_t i = nStartInd + 1 ; i < dqFce.size() ; ++ i) {
for ( int i = nStartInd + 1 ; i < ssize( dqFce) ; ++ i) {
// se retta
if ( dqFce[i].nType == FreeContourEnt::LINE) {
// se punti non coincidenti
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -104,7 +104,7 @@
<OpenMPSupport>false</OpenMPSupport>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -128,7 +128,7 @@ copy $(TargetPath) \EgtProg\DllD32</Command>
<PreprocessorDefinitions>WIN32;I_AM_EEX;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<OpenMPSupport>true</OpenMPSupport>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>
</AdditionalOptions>
</ClCompile>
@@ -163,7 +163,7 @@ copy $(TargetPath) \EgtProg\DllD64</Command>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
@@ -197,7 +197,7 @@ copy $(TargetPath) \EgtProg\Dll32</Command>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>-Wno-tautological-undefined-compare</AdditionalOptions>
</ClCompile>
<Link>
+2 -1
View File
@@ -21,6 +21,7 @@
#include "/EgtDev/Include/EGkStringUtils3d.h"
#include "/EgtDev/Include/EGnFileUtils.h"
#include "/EgtDev/Include/EgtStringEncoder.h"
#include "/EgtDev/Include/EgtNumUtils.h"
using namespace std ;
@@ -306,7 +307,7 @@ ImportBtl::ReadGeneral( bool& bEnd)
Trim( sVal, " \t\r\n\"") ;
int nUnit ;
if ( FromString( sVal, nUnit)) {
m_dScale = pow( 10, - nUnit) ;
m_dScale = Pow( 10, -nUnit) ;
++ nRead ;
}
m_BtlGeom.SetUserAttribute( UATD_INFO, sKey, sVal) ;
+5 -4
View File
@@ -824,7 +824,7 @@ ImportBtlx::CheckGuid( const string& s)
vector<char> range = {'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} ;
if ( s[0] != '{' || s[37] != '}')
return false ;
for ( size_t i = 1 ; i < 37 ; i++) {
for ( int i = 1 ; i < 37 ; i++) {
if ( i == 9 || i == 14 || i == 19 || i == 24) {
if ( s[i] != '-')
return false ;
@@ -1509,10 +1509,11 @@ ImportBtlx::ReadShape( pugi::xml_node node)
DBLVECTOR vAux2 ; // vettore per salvare le coordinate di un punto
if ( sCoordPoints.back() != ' ')
sCoordPoints += " " ;
while( ( str_end = sCoordPoints.find( " ", str_start)) != string::npos) {
double val = stod( sCoordPoints.substr( str_start, str_end - str_start)) ;
while ( ( str_end = sCoordPoints.find( " ", str_start)) != string::npos) {
double dVal = 0 ;
FromString( sCoordPoints.substr( str_start, str_end - str_start), dVal) ;
str_start = str_end + 1 ;
vAux2.push_back( val) ;
vAux2.push_back( dVal) ;
if ( vAux2.size() == 3) { // hai letto 3 coordinate quindi hai un punto
vPoints.push_back( Point3d( vAux2[0], vAux2[1], vAux2[2])) ;
vAux2.clear() ;
+17 -14
View File
@@ -30,12 +30,12 @@ using namespace std ;
// ------------------------- Prototipi locali funzioni ausiliarie ---------------------------------
static int GetGroup12( const pugi::xml_node& process) ;
static int GetGroup34( const pugi::xml_node& process) ;
static double ReadProcessChild( const pugi::xml_node& process, const string& sChild, const double& dVal) ;
static double ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, const double& dVal) ;
static double ReadProcessChild( const pugi::xml_node& process, const string& sChild, double dVal) ;
static double ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, double dVal) ;
static int ReadProcessChildBool( const pugi::xml_node& process, const string& sChild, const int& nDefaultVal, bool bInverted = false) ;
static string ReadProcessChildYesNo( const pugi::xml_node& process, const string& sChild, const string& sVal) ;
static double ReadProcessChildYesNoToDouble( const pugi::xml_node& process, const string& sChild1, const string& sDefaultOpt, const string& sChild2,
const double& nDefaultVal) ;
double nDefaultVal) ;
static int ComputeP04( const STRVECTOR& values) ;
static int ComputeP04( const pugi::xml_node& MachiningLimits) ;
@@ -605,9 +605,9 @@ ImportBtlx::ReadChamferParams( pugi::xml_node process, int& nGroup, int& nProc,
string sCamferEdge41 = ReadProcessChildYesNo( process, "ChamferEdge41", "yes") ;
STRVECTOR values = { sCamferEdge12, sCamferEdge23, sCamferEdge34, sCamferEdge41} ;
vdPar[1] = 0.0 ;
for ( size_t i = 0 ; i < values.size() ; i++) {
for ( int i = 0 ; i < ssize( values) ; i++) {
if ( values[i] == "yes")
vdPar[1] += pow( 2, i) ;
vdPar[1] += Pow( 2, i) ;
else if ( values[i] != "no") {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: ChamferEdge value is not valid") ;
return false ;
@@ -1829,7 +1829,7 @@ ImportBtlx::ReadTyroleanDovetailParams( pugi::xml_node process, int& nGroup, int
vdPar[4] = -1 ;
else if ( sLapExit == "rebate") {
if ( process.child( "RebateLength") != nullptr)
vdPar[4] = std::stod( process.child( "RebateLength").text().get()) ;
FromString( process.child( "RebateLength").text().get(), vdPar[4]) ;
else
vdPar[4] = 10.0 ; // valore di default
}
@@ -1936,7 +1936,7 @@ ImportBtlx::ReadDovetailParams( pugi::xml_node process, int& nGroup, int& nProc,
vdPar[4] = -1 ;
else if ( sLapExit == "rebate") {
if ( process.child( "RebateLength") != nullptr)
vdPar[4] = std::stod( process.child( "RebateLength").text().get()) ;
FromString( process.child( "RebateLength").text().get(), vdPar[4]) ;
else
vdPar[4] = 10.0 ; // valore di default
}
@@ -2218,17 +2218,20 @@ GetGroup34( const pugi::xml_node& process)
//---------------------------------------------------------------------------------------------------------------------------
double
ReadProcessChild( const pugi::xml_node& process, const string& sChild, const double& dVal)
ReadProcessChild( const pugi::xml_node& process, const string& sChild, double dVal)
{
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).text().get() != '\0')
return std::stod( process.child( sChild.c_str()).text().get()) ;
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).text().get() != nullptr) {
double dRes = dVal ;
FromString( process.child( sChild.c_str()).text().get(), dRes) ;
return dRes ;
}
else
return dVal ;
}
//---------------------------------------------------------------------------------------------------------------------------
double
ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, const double& dVal)
ReadProcessChildAttribute( const pugi::xml_node& process, const string& sChild, const string& sAttribute, double dVal)
{
if ( process.child( sChild.c_str()) != nullptr && process.child( sChild.c_str()).attribute( sAttribute.c_str()) != nullptr)
return process.child( sChild.c_str()).attribute( sAttribute.c_str()).as_double() ;
@@ -2271,7 +2274,7 @@ ReadProcessChildYesNo( const pugi::xml_node& process, const string& sChild, cons
//---------------------------------------------------------------------------------------------------------------------------
double
ReadProcessChildYesNoToDouble( const pugi::xml_node& process, const string& sChild1, const string& sDefaultOpt, const string& sChild2,
const double& nDefaultVal)
double nDefaultVal)
{
string sValue = process.child( sChild1.c_str()).text().get() ;
if ( sValue == sDefaultOpt || sValue.empty() || ( sValue != "no" && sValue != "yes"))
@@ -2290,9 +2293,9 @@ ComputeP04( const STRVECTOR& values)
}
int result = 0 ;
for ( size_t i = 0 ; i < values.size() ; i ++) {
for ( int i = 0 ; i < ssize( values) ; i ++) {
if ( values[i] == "no")
result += static_cast<int>( pow( 2, i)) ;
result += int( Pow( 2, i)) ;
else if ( values[i] != "yes") {
LOG_ERROR( GetEExLogger(), " Error reading Part Processing: MachiningLimit value is not valid") ;
return -2 ;
+1 -1
View File
@@ -212,7 +212,7 @@ ImportCnc::ProcessLine( const string& sLine)
TokenizePlus( sMyLine, "NGXYZIJKPQRUVWABCFTMHhDEL", vsTokens) ;
// analizzo ogni singola parte
for ( size_t i = 0 ; i < vsTokens.size() ; ++ i) {
for ( int i = 0 ; i < ssize( vsTokens) ; ++ i) {
// analizzo per categorie determinate dal primo carattere del token
switch ( vsTokens[i][0]) {
case 'G' :
+1 -1
View File
@@ -597,7 +597,7 @@ ImportCsf::ProcessExtendedText( const CsfEnt& csfEnt)
}
// salvataggio testo con un punto di inserimento per ogni carattere
else if ( etData.sText.size() == etData.vPnt.size()) {
for ( size_t i = 0 ; i < etData.sText.size() ; ++ i) {
for ( int i = 0 ; i < ssize( etData.sText) ; ++ i) {
// creo il testo
PtrOwner<IExtText> pTxt( CreateExtText()) ;
if ( IsNull( pTxt))
+3 -3
View File
@@ -2695,16 +2695,16 @@ ImportDxf::AdjustMText( string& sText, double dTextMaxWidth, double dW)
// coefficiente empirico che in generale migliora l'adattamento
const double COEFF_LARGH = 1.2 ;
// gestione max lunghezza riga di testo
size_t nLastSp = - 1 ;
int nLastSp = -1 ;
double dCurrWidth = 0 ;
for ( size_t i = 0 ; i < sText.size() ; ++ i) {
for ( int i = 0 ; i < ssize( sText) ; ++ i) {
// posso dividere solo sugli spazi
if ( sText[i] == ' ')
nLastSp = i ;
// se c'è già un a capo
if ( sText[i] == '\n') {
dCurrWidth = 0 ;
nLastSp = - 1 ;
nLastSp = -1 ;
}
// se supera il limite
else if ( dCurrWidth > COEFF_LARGH * dTextMaxWidth) {