@@ -102,7 +102,8 @@ void ReaderWriterIFC::resetModel()
102
102
m_messages.str (std::string ());
103
103
104
104
deleteInputCache ();
105
- // m_processed_products.clear();
105
+ m_map_visited.clear ();
106
+ m_map_outside_spatial_structure.clear ();
106
107
AppearanceManagerOSG::clearAppearanceCache ();
107
108
108
109
m_group_result->removeChildren ( 0 , m_group_result->getNumChildren () );
@@ -275,6 +276,7 @@ void ReaderWriterIFC::createGeometry()
275
276
}
276
277
277
278
m_shape_input_data.clear ();
279
+ m_map_outside_spatial_structure.clear ();
278
280
m_representation_converter->getProfileCache ()->clearProfileCache ();
279
281
280
282
std::vector<shared_ptr<IfcProduct> > vec_products;
@@ -419,6 +421,7 @@ void ReaderWriterIFC::createGeometry()
419
421
group_outside_spatial_structure->addChild ( product_switch );
420
422
}
421
423
product_shape->added_to_storey = true ;
424
+ m_map_outside_spatial_structure.insert ( std::make_pair ( ifc_product->getId (), ifc_product ) );
422
425
}
423
426
}
424
427
}
@@ -579,6 +582,7 @@ void ReaderWriterIFC::convertIfcProduct( const shared_ptr<IfcProduct>& product,
579
582
const int product_id = product->getId ();
580
583
std::stringstream strs_err;
581
584
osg::ref_ptr<osg::Switch> product_switch = new osg::Switch ();
585
+ osg::ref_ptr<osg::Switch> product_switch_curves = new osg::Switch ();
582
586
std::stringstream group_name;
583
587
group_name << " #" << product_id << " =IfcProduct group" ;
584
588
product_switch->setName ( group_name.str ().c_str () );
@@ -626,6 +630,7 @@ void ReaderWriterIFC::convertIfcProduct( const shared_ptr<IfcProduct>& product,
626
630
{
627
631
shared_ptr<ItemData> item_data = product_items[i_item];
628
632
osg::Group* item_group = new osg::Group ();
633
+ osg::Group* item_group_curves = new osg::Group ();
629
634
630
635
// create shape for open shells
631
636
for ( int i=0 ; i<item_data->open_polyhedrons .size (); ++i )
@@ -679,7 +684,7 @@ void ReaderWriterIFC::convertIfcProduct( const shared_ptr<IfcProduct>& product,
679
684
shared_ptr<carve::input::PolylineSetData>& polyline_data = item_data->polylines [polyline_i];
680
685
osg::ref_ptr<osg::Geode> geode = new osg::Geode ();
681
686
ConverterOSG::drawPolyline ( polyline_data.get (), geode );
682
- item_group ->addChild (geode);
687
+ item_group_curves ->addChild (geode);
683
688
}
684
689
685
690
if ( m_geom_settings->m_show_text_literals )
@@ -717,23 +722,46 @@ void ReaderWriterIFC::convertIfcProduct( const shared_ptr<IfcProduct>& product,
717
722
for ( int i_appearance=0 ; i_appearance<item_data->vec_item_appearances .size (); ++i_appearance )
718
723
{
719
724
shared_ptr<AppearanceData>& appearance = item_data->vec_item_appearances [i_appearance];
720
-
721
- osg::StateSet* item_stateset = AppearanceManagerOSG::convertToStateSet ( appearance );
722
- if ( item_stateset != nullptr )
725
+ if ( appearance->apply_to_geometry_type == AppearanceData::SURFACE )
723
726
{
724
- item_group->setStateSet ( item_stateset );
727
+ osg::StateSet* item_stateset = AppearanceManagerOSG::convertToStateSet ( appearance );
728
+ if ( item_stateset != nullptr )
729
+ {
730
+ item_group->setStateSet ( item_stateset );
725
731
726
- osg::StateSet* existing_item_stateset = item_group->getStateSet ();
732
+ osg::StateSet* existing_item_stateset = item_group->getStateSet ();
727
733
728
- if ( existing_item_stateset )
729
- {
730
- osg::StateSet* merged_product_stateset = new osg::StateSet ( *existing_item_stateset );
731
- merged_product_stateset->merge ( *item_stateset );
732
- item_group->setStateSet ( merged_product_stateset );
734
+ if ( existing_item_stateset )
735
+ {
736
+ osg::StateSet* merged_product_stateset = new osg::StateSet ( *existing_item_stateset );
737
+ merged_product_stateset->merge ( *item_stateset );
738
+ item_group->setStateSet ( merged_product_stateset );
739
+ }
740
+ else
741
+ {
742
+ item_group->setStateSet ( item_stateset );
743
+ }
733
744
}
734
- else
745
+ else if ( appearance-> apply_to_geometry_type == AppearanceData::CURVE )
735
746
{
736
- item_group->setStateSet ( item_stateset );
747
+ osg::StateSet* item_stateset = AppearanceManagerOSG::convertToStateSet ( appearance );
748
+ if ( item_stateset != nullptr )
749
+ {
750
+ item_group->setStateSet ( item_stateset );
751
+
752
+ osg::StateSet* existing_item_stateset = item_group->getStateSet ();
753
+
754
+ if ( existing_item_stateset )
755
+ {
756
+ osg::StateSet* merged_product_stateset = new osg::StateSet ( *existing_item_stateset );
757
+ merged_product_stateset->merge ( *item_stateset );
758
+ item_group->setStateSet ( merged_product_stateset );
759
+ }
760
+ else
761
+ {
762
+ item_group_curves->setStateSet ( item_stateset );
763
+ }
764
+ }
737
765
}
738
766
}
739
767
}
@@ -812,9 +840,9 @@ void ReaderWriterIFC::convertIfcProduct( const shared_ptr<IfcProduct>& product,
812
840
// }
813
841
// }
814
842
815
- for ( int i=0 ; i<product_shape->vec_appearances .size (); ++i )
843
+ for ( int i=0 ; i<product_shape->getAppearances () .size (); ++i )
816
844
{
817
- shared_ptr<AppearanceData>& appearance = product_shape->vec_appearances [i];
845
+ const shared_ptr<AppearanceData>& appearance = product_shape->getAppearances () [i];
818
846
if ( !appearance )
819
847
{
820
848
continue ;
@@ -861,6 +889,11 @@ void ReaderWriterIFC::convertIfcProduct( const shared_ptr<IfcProduct>& product,
861
889
product_shape->product_switch = product_switch;
862
890
}
863
891
892
+ if ( product_switch_curves->getNumChildren () > 0 )
893
+ {
894
+ product_shape->product_switch_curves = product_switch_curves;
895
+ }
896
+
864
897
if ( strs_err.tellp () > 0 )
865
898
{
866
899
throw IfcPPException ( strs_err.str ().c_str (), __func__ );
0 commit comments