EgtExch3dm :

- sistemazione conversione wstring in string
- anche per debug compilazione 32bit senza più limiti per Windows XP.
This commit is contained in:
Dario Sassi
2025-01-15 15:23:33 +01:00
parent abfec33be1
commit 8be2ffeb7b
2 changed files with 9 additions and 14 deletions
+8 -13
View File
@@ -29,6 +29,7 @@
#include "/EgtDev/Include/EGkExtText.h"
#include "/EgtDev/Include/EGkExtDimension.h"
#include "/EgtDev/Include/EGnStringUtils.h"
#include "/EgtDev/Include/EgtStringConverter.h"
#include "/EgtDev/Include/EgtKeyCodes.h"
using namespace std ;
@@ -107,24 +108,22 @@ Import3dm::Import( const string& sFile, IGeomDB* pGDB, int nIdGroup,
ON_UUID uuidParent = onLayer->ParentId() ;
// cerco se il parent è un layer già aggiunto
auto it = std::find_if(m_mLayer.begin(), m_mLayer.end(),
auto it = std::find_if( m_mLayer.begin(), m_mLayer.end(),
[uuidParent](pair< int, tuple<const ON_Layer*, ON_UUID, int, int, int>> x){ return !ON_UuidCompare( get<1>(get<1>(x)), uuidParent) ;}); // ON_UuidCompare restituisce 0 se coincidono
int nParentL1 = -1 ;
// risalgo la gerarchia dei layer finché arrivo al primo layer e aggiungo tutti i nomi al nome del sottolayer
wstring ws = wstring(onLayer->Name()) ;
string sName(ws.begin(), ws.end()) ;
string sName = wstringtoA( wstring( onLayer->Name())) ;
while ( ON_UuidCompare( uuidParent, ON_nil_uuid) ) {// ON_UuidCompare restituisce 0 se coincidono
const ON_Layer* onParentLayer = get<0>(it->second) ;
wstring wsParent = wstring( onParentLayer->Name()) ;
string sParentName( wsParent.begin(), wsParent.end()) ;
string sParentName = wstringtoA( wstring( onParentLayer->Name())) ;
// se sono ad una profondità maggiore di 1 aggiungo il nome del parent
if ( get<3>(it->second) > 1)
sName = sParentName + "_" + sName ;
uuidParent = onParentLayer->ParentId() ;
// salvo l'id del parent che è al livello 1 ( che è un Part)
if ( get<3>(it->second) == 1)
if ( get<3>( it->second) == 1)
nParentL1 = it->first ;
it = std::find_if(m_mLayer.begin(), m_mLayer.end(),
it = std::find_if( m_mLayer.begin(), m_mLayer.end(),
[uuidParent](pair< int, tuple<const ON_Layer*, ON_UUID, int, int, int>> x){ return !ON_UuidCompare( get<1>(get<1>(x)), uuidParent) ;});
}
@@ -1328,9 +1327,7 @@ Import3dm::ConvertAnnotation( const ON_Annotation* onAnnot, const ON_DimStyle* o
switch( onAnnType) {
case ON::AnnotationType::Text : {
const ON_Text* onText = ON_Text::Cast( onAnnot) ;
ON_wString wsText = onText->PlainText() ;
std::wstring ws( wsText) ;
std::string str( ws.begin(), ws.end()) ;
string str = wstringtoA( wstring( onText->PlainText())) ;
ON_Plane onPlane = onText->Plane() ;
Point3d ptOrig = ConvertPoint( onPlane.origin) ;
Vector3d vtN = ConvertVector( onPlane.Normal()) ;
@@ -1348,9 +1345,7 @@ Import3dm::ConvertAnnotation( const ON_Annotation* onAnnot, const ON_DimStyle* o
}
case ON::AnnotationType::Leader : {
const ON_Leader* onLeader = ON_Leader::Cast( onAnnot) ;
ON_wString wsText = onLeader->PlainText() ;
std::wstring ws( wsText) ;
std::string str( ws.begin(), ws.end()) ;
string str = wstringtoA( wstring( onLeader->PlainText())) ;
ON_Plane onPlane = onAnnot->Plane() ;
Point3d ptOrig = ConvertPoint( onPlane.origin) ;
Vector3d vtX = ConvertVector( onPlane.xaxis) ;