Skip to content

Commit f1b706d

Browse files
committed
changed ProductShapeData( int entity_id ) to ProductShapeData( std::wstring entity_guid )
1 parent e3b9e10 commit f1b706d

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

IfcPlusPlus/src/ifcpp/geometry/Carve/GeometryConverter.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,15 @@ class GeometryConverter : public StatusCallback
348348
shared_ptr<IfcObjectDefinition> object_def = vec_object_definitions[i];
349349
const int entity_id = object_def->m_entity_id;
350350
std::string guid;
351+
std::wstring guid_wstr;
351352
if (object_def->m_GlobalId)
352353
{
353354
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converterX;
354-
guid = converterX.to_bytes(object_def->m_GlobalId->m_value);
355+
guid_wstr = object_def->m_GlobalId->m_value;
356+
guid = converterX.to_bytes(guid_wstr);
355357
}
356358

357-
shared_ptr<ProductShapeData> product_geom_input_data( new ProductShapeData( entity_id ) );
359+
shared_ptr<ProductShapeData> product_geom_input_data( new ProductShapeData(guid_wstr) );
358360
product_geom_input_data->m_ifc_object_definition = object_def;
359361

360362
// TODO: check for equal product shapes: each representation and each item must be equal, also openings must be equal: m_HasOpenings_inverse

IfcPlusPlus/src/ifcpp/geometry/Carve/GeometryInputData.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ class RepresentationData
555555
class ProductShapeData
556556
{
557557
public:
558-
int m_entity_id = -1;
558+
std::wstring m_entity_guid;
559559
weak_ptr<IfcObjectDefinition> m_ifc_object_definition;
560560
weak_ptr<IfcObjectPlacement> m_object_placement;
561561
std::vector<shared_ptr<RepresentationData> > m_vec_representations;
@@ -569,12 +569,12 @@ class ProductShapeData
569569

570570
public:
571571
ProductShapeData() {}
572-
ProductShapeData( int entity_id ) : m_entity_id(entity_id) { }
572+
ProductShapeData( std::wstring entity_guid ) : m_entity_guid(entity_guid) { }
573573

574574
const std::vector<shared_ptr<ProductShapeData> >& getChildren() { return m_vec_children; }
575575
shared_ptr<ProductShapeData> getDeepCopy()
576576
{
577-
shared_ptr<ProductShapeData> copy_data( new ProductShapeData(m_entity_id) );
577+
shared_ptr<ProductShapeData> copy_data( new ProductShapeData(m_entity_guid) );
578578
for( size_t item_i = 0; item_i < m_vec_representations.size(); ++item_i )
579579
{
580580
shared_ptr<RepresentationData>& representation_data = m_vec_representations[item_i];
@@ -667,13 +667,13 @@ class ProductShapeData
667667
const shared_ptr<ProductShapeData>& existing_child = m_vec_children[ii];
668668
if( existing_child == add_child )
669669
{
670-
if( existing_child->m_entity_id == add_child->m_entity_id )
670+
if( existing_child->m_entity_guid.compare( add_child->m_entity_guid ) == 0 )
671671
{
672-
std::cout << __FUNCTION__ << ": child already added, entity_id: " << add_child->m_entity_id << std::endl;
672+
std::wcout << __FUNCTION__ << L": child already added, entity_id: " << add_child->m_entity_guid << std::endl;
673673
}
674674
else
675675
{
676-
std::cout << __FUNCTION__ << ": entity_id mismatch: " << add_child->m_entity_id << " != " << existing_child->m_entity_id << std::endl;
676+
std::wcout << __FUNCTION__ << L": entity_id mismatch: " << add_child->m_entity_guid << L" != " << existing_child->m_entity_guid << std::endl;
677677
}
678678
return;
679679
}

IfcPlusPlus/src/ifcpp/geometry/Carve/RepresentationConverter.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OU
3535
#include <ifcpp/IFC4/include/IfcGeometricCurveSet.h>
3636
#include <ifcpp/IFC4/include/IfcGeometricRepresentationItem.h>
3737
#include <ifcpp/IFC4/include/IfcGeometricSet.h>
38+
#include <ifcpp/IFC4/include/IfcGloballyUniqueId.h>
3839
#include <ifcpp/IFC4/include/IfcLabel.h>
3940
#include <ifcpp/IFC4/include/IfcMappedItem.h>
4041
#include <ifcpp/IFC4/include/IfcOpenShell.h>
@@ -119,6 +120,7 @@ class RepresentationConverter : public StatusCallback
119120
{
120121
m_profile_cache->clearProfileCache();
121122
m_styles_converter->clearStylesCache();
123+
m_unit_converter->resetUnitFactors();
122124
}
123125
shared_ptr<GeometrySettings>& getGeomSettings() { return m_geom_settings; }
124126
shared_ptr<UnitConverter>& getUnitConverter() { return m_unit_converter; }
@@ -947,7 +949,11 @@ class RepresentationConverter : public StatusCallback
947949

948950
// opening can have its own relative placement
949951
shared_ptr<IfcObjectPlacement> opening_placement = opening->m_ObjectPlacement;
950-
shared_ptr<ProductShapeData> product_shape_opening( new ProductShapeData( opening_placement->m_entity_id ) );
952+
shared_ptr<ProductShapeData> product_shape_opening( new ProductShapeData() );
953+
if (opening->m_GlobalId)
954+
{
955+
product_shape_opening->m_entity_guid = opening->m_GlobalId->m_value;
956+
}
951957
if( opening_placement )
952958
{
953959
std::unordered_set<IfcObjectPlacement*> opening_placements_applied;

IfcPlusPlus/src/ifcpp/model/BuildingModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class IFCQUERY_EXPORT BuildingModel : public StatusCallback
3535
~BuildingModel() override;
3636

3737
enum SchemaVersionEnum { IFC_VERSION_UNDEFINED, IFC_VERSION_UNKNOWN, IFC2X, IFC2X2, IFC2X3, IFC2X4, IFC4, IFC4X1, IFC4X3RC1, IFC4X3RC2, IFC4X3RC3 };
38-
const std::map<int, shared_ptr<BuildingEntity> >& getMapIfcEntities() const { return m_map_entities; }
38+
std::map<int, shared_ptr<BuildingEntity> >& getMapIfcEntities() { return m_map_entities; }
3939
void setMapIfcEntities( const std::map<int, shared_ptr<BuildingEntity> >& map );
4040
void insertEntity( shared_ptr<BuildingEntity> e, bool overwrite_existing = false, bool warn_on_existing_entities = true );
4141
void removeEntity( shared_ptr<BuildingEntity> e );

examples/SimpleViewerExampleQt/src/gui/TabReadWrite.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ void TabReadWrite::loadIfcFile( QString& path_in )
362362
}
363363
}
364364

365-
clock_t time_diff = clock() - millisecs;
365+
int time_diff = (clock() - millisecs)/(double)CLOCKS_PER_SEC;
366366
int num_entities = m_system->getIfcModel()->getMapIfcEntities().size();
367-
txtOut( tr("File loaded: ") + QString::number(num_entities) + " entities in " + QString::number( round(time_diff*0.1)*0.01 ) + " sec." );
367+
txtOut( tr("File loaded: ") + QString::number(num_entities) + " entities in " + QString::number( round(time_diff*10)*0.1 ) + " sec." );
368368

369369
m_system->notifyModelLoadingDone();
370370
progressValue( 1.0, "" );

0 commit comments

Comments
 (0)