Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styles converter transparency fix and code modernisation #93

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions IfcPlusPlus/src/ifcpp/geometry/Carve/GeometryConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,14 @@ class GeometryConverter : public StatusCallback
continue;
}

shared_ptr<IfcComplexProperty> complex_property = dynamic_pointer_cast<IfcComplexProperty>(ifc_property);
auto const complex_property = dynamic_pointer_cast<IfcComplexProperty>(ifc_property);
if( complex_property )
{
if( !complex_property->m_UsageName ) continue;
if( complex_property->m_UsageName->m_value.compare( L"Color" ) == 0 )
{
vec4 vec_color;
m_representation_converter->getStylesConverter()->convertIfcComplexPropertyColor( complex_property, vec_color );
shared_ptr<AppearanceData> appearance_data( new AppearanceData( -1 ) );
auto const vec_color = m_representation_converter->getStylesConverter()->convertIfcComplexPropertyColor( complex_property );
auto appearance_data = std::make_shared<AppearanceData>( -1 );
if( !appearance_data )
{
throw OutOfMemoryException( __FUNC__ );
Expand Down
2 changes: 1 addition & 1 deletion IfcPlusPlus/src/ifcpp/geometry/Carve/GeometryInputData.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class RepresentationData
std::copy( other->m_vec_representation_appearances.begin(), other->m_vec_representation_appearances.end(), std::back_inserter( m_vec_representation_appearances ) );
}

void addAppearance( shared_ptr<AppearanceData>& appearance )
void addAppearance( shared_ptr<AppearanceData> const& appearance )
{
if( !appearance )
{
Expand Down
31 changes: 15 additions & 16 deletions IfcPlusPlus/src/ifcpp/geometry/Carve/RepresentationConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,17 @@ class RepresentationConverter : public StatusCallback
m_face_converter->m_unit_converter = unit_converter;
}

void convertRepresentationStyle( const shared_ptr<IfcRepresentationItem>& representation_item, std::vector<shared_ptr<AppearanceData> >& vec_appearance_data )
std::vector<shared_ptr<AppearanceData> > convertRepresentationStyle( const shared_ptr<IfcRepresentationItem>& representation_item )
{
std::vector<weak_ptr<IfcStyledItem> >& vec_StyledByItem_inverse = representation_item->m_StyledByItem_inverse;
std::vector<shared_ptr<AppearanceData> > vec_appearance_data;
for( size_t i = 0; i < vec_StyledByItem_inverse.size(); ++i )
{
weak_ptr<IfcStyledItem> styled_item_weak = vec_StyledByItem_inverse[i];
shared_ptr<IfcStyledItem> styled_item = shared_ptr<IfcStyledItem>( styled_item_weak );
m_styles_converter->convertIfcStyledItem( styled_item, vec_appearance_data );
}
return vec_appearance_data;
}

void convertIfcRepresentation( const shared_ptr<IfcRepresentation>& ifc_representation, shared_ptr<RepresentationData>& representation_data )
Expand Down Expand Up @@ -205,7 +207,7 @@ class RepresentationConverter : public StatusCallback
{
shared_ptr<IfcRepresentationItem> representation_item = ifc_representation->m_Items[i_representation_items];

//ENTITY IfcRepresentationItem ABSTRACT SUPERTYPE OF(ONEOF(IfcGeometricRepresentationItem, IfcMappedItem, IfcStyledItem, IfcTopologicalRepresentationItem));
//ENTITY IfcRepresentationItem ABSTRACT SUPERTYPE OF(ONEOF(IfcGeometricRepresentationItem, IfcMappedItem, IfcStyledItem, IfcTopologicalRepresentationItem));
shared_ptr<IfcGeometricRepresentationItem> geom_item = dynamic_pointer_cast<IfcGeometricRepresentationItem>( representation_item );
if( geom_item )
{
Expand Down Expand Up @@ -300,8 +302,7 @@ class RepresentationConverter : public StatusCallback

if( m_geom_settings->handleStyledItems() )
{
std::vector<shared_ptr<AppearanceData> > vec_appearance_data;
convertRepresentationStyle( representation_item, vec_appearance_data );
auto const vec_appearance_data = convertRepresentationStyle( representation_item );

if( vec_appearance_data.size() > 0 )
{
Expand All @@ -313,7 +314,7 @@ class RepresentationConverter : public StatusCallback

for( size_t jj_appearance = 0; jj_appearance < vec_appearance_data.size(); ++jj_appearance )
{
shared_ptr<AppearanceData>& data = vec_appearance_data[jj_appearance];
auto const& data = vec_appearance_data[jj_appearance];
if( data )
{
mapped_item_data->m_vec_item_appearances.push_back( data );
Expand Down Expand Up @@ -386,8 +387,7 @@ class RepresentationConverter : public StatusCallback
shared_ptr<IfcPresentationStyle>& presentation_style = vec_presentation_styles[ii_style];
if( presentation_style )
{
shared_ptr<AppearanceData> appearance_data;
m_styles_converter->convertIfcPresentationStyle( presentation_style, appearance_data );
auto const appearance_data = m_styles_converter->convertIfcPresentationStyle( presentation_style );
if( appearance_data )
{
representation_data->addAppearance( appearance_data );
Expand All @@ -409,8 +409,7 @@ class RepresentationConverter : public StatusCallback
//IfcSolidModel, IfcSurface, IfcTessellatedItem, IfcTextLiteral, IfcVector))
if( m_geom_settings->handleStyledItems() )
{
std::vector<shared_ptr<AppearanceData> > vec_appearance_data;
convertRepresentationStyle( geom_item, vec_appearance_data );
auto const vec_appearance_data = convertRepresentationStyle( geom_item );
std::copy( vec_appearance_data.begin(), vec_appearance_data.end(), std::back_inserter( item_data->m_vec_item_appearances ) );
}

Expand Down Expand Up @@ -609,9 +608,9 @@ class RepresentationConverter : public StatusCallback
shared_ptr<IfcTextLiteral> text_literal = dynamic_pointer_cast<IfcTextLiteral>( geom_item );
if( text_literal )
{
// Literal : IfcPresentableText;
// Placement : IfcAxis2Placement;
// Path : IfcTextPath;
// Literal : IfcPresentableText;
// Placement : IfcAxis2Placement;
// Path : IfcTextPath;
if( m_geom_settings->isShowTextLiterals() )
{
shared_ptr<IfcPresentableText>& ifc_literal = text_literal->m_Literal;
Expand Down Expand Up @@ -715,7 +714,7 @@ class RepresentationConverter : public StatusCallback

void convertTopologicalRepresentationItem( const shared_ptr<IfcTopologicalRepresentationItem>& topological_item, shared_ptr<ItemShapeData> topo_item_data )
{
//IfcTopologicalRepresentationItem ABSTRACT SUPERTYPE OF(ONEOF(IfcConnectedFaceSet, IfcEdge, IfcFace, IfcFaceBound, IfcLoop, IfcPath, IfcVertex))
//IfcTopologicalRepresentationItem ABSTRACT SUPERTYPE OF(ONEOF(IfcConnectedFaceSet, IfcEdge, IfcFace, IfcFaceBound, IfcLoop, IfcPath, IfcVertex))
const shared_ptr<IfcConnectedFaceSet> topo_connected_face_set = dynamic_pointer_cast<IfcConnectedFaceSet>( topological_item );
if( topo_connected_face_set )
{
Expand Down Expand Up @@ -761,9 +760,9 @@ class RepresentationConverter : public StatusCallback
//shared_ptr<IfcFaceSurface> topo_face_surface = dynamic_pointer_cast<IfcFaceSurface>( topo_face );
//if( topo_face_surface )
//{
// // std::vector<shared_ptr<IfcFaceBound> > m_Bounds;
// // shared_ptr<IfcSurface> m_FaceSurface;
// // bool m_SameSense;
// // std::vector<shared_ptr<IfcFaceBound> > m_Bounds;
// // shared_ptr<IfcSurface> m_FaceSurface;
// // bool m_SameSense;

// const shared_ptr<IfcSurface>& face_surface = topo_face_surface->m_FaceSurface;
// if( face_surface )
Expand Down
Loading