Esempio n. 1
0
void IfcPPModel::setMapIfcEntities( const map_t<int, shared_ptr<IfcPPEntity> >& map )
{
	clearIfcModel();
	m_map_entities.clear();
	m_map_entities = map;
	updateCache();
	// todo: check model consistency
}
Esempio n. 2
0
void IfcPPModel::initCopyIfcModel( const shared_ptr<IfcPPModel>& other )
{
	clearIfcModel();

	shared_ptr<IfcProject> project = other->getIfcProject();
	std::map<IfcPPEntity*, shared_ptr<IfcPPEntity> > map_entities_copy;
	map_entities_copy[project.get()] = project;
	
	shared_ptr<IfcPPEntity> project_as_entity( project );
	collectDependentEntities( project_as_entity, map_entities_copy );

	for( auto it = map_entities_copy.begin(); it != map_entities_copy.end(); ++it )
	{
		shared_ptr<IfcPPEntity> entity = it->second;
		insertEntity( entity );
	}

	updateCache();
}
Esempio n. 3
0
void IfcPPModel::initIfcModel()
{
	clearIfcModel();

	auto project = std::make_shared<IfcProject>( 1 );
	insertEntity(project);

	auto person = std::make_shared<IfcPerson>();
	person->m_FamilyName = std::make_shared<IfcLabel>( L"FamilyName" );
	person->m_GivenName = std::make_shared<IfcLabel>( L"GivenName" );
	insertEntity(person);
	
	auto org = std::make_shared<IfcOrganization>();
	org->m_Name = std::make_shared<IfcLabel>( L"OrganizationName" );
	insertEntity(org);

	auto person_org = std::make_shared<IfcPersonAndOrganization>( );
	person_org->m_ThePerson = person;
	person_org->m_TheOrganization = org;
	insertEntity(person_org);

	auto app = std::make_shared<IfcApplication>();
	app->m_ApplicationDeveloper = org;
	app->m_Version = std::make_shared<IfcLabel>( L"1.0" );
	app->m_ApplicationFullName = std::make_shared<IfcLabel>( L"IfcPlusPlus" );
	app->m_ApplicationIdentifier = std::make_shared<IfcIdentifier>( L"IfcPlusPlus" );
	insertEntity(app);

	auto point = std::make_shared<IfcCartesianPoint>();
	point->m_Coordinates.push_back( std::make_shared<IfcLengthMeasure>(0.0) );
	point->m_Coordinates.push_back( std::make_shared<IfcLengthMeasure>(0.0) );
	point->m_Coordinates.push_back( std::make_shared<IfcLengthMeasure>(0.0) );
	insertEntity(point);

	auto axis_placement = std::make_shared<IfcAxis2Placement3D>();
	axis_placement->m_Location = point;
	insertEntity(axis_placement);

	auto owner_history = std::make_shared<IfcOwnerHistory>();
	owner_history->m_OwningUser = person_org;
	owner_history->m_OwningApplication = app;
	owner_history->m_ChangeAction = std::make_shared<IfcChangeActionEnum>( IfcChangeActionEnum::ENUM_ADDED );
	insertEntity(owner_history);

	auto dim_exp = std::make_shared<IfcDimensionalExponents>();
	dim_exp->m_LengthExponent = 0;
	dim_exp->m_MassExponent = 0;
	dim_exp->m_TimeExponent = 0;
	dim_exp->m_ElectricCurrentExponent = 0;
	dim_exp->m_ThermodynamicTemperatureExponent = 0;
	dim_exp->m_AmountOfSubstanceExponent = 0;
	dim_exp->m_LuminousIntensityExponent = 0;
	insertEntity(dim_exp);

	// length unit [m]
	auto si_unit = std::make_shared<IfcSIUnit>();
	si_unit->m_UnitType = std::make_shared<IfcUnitEnum>( IfcUnitEnum::ENUM_LENGTHUNIT );
	si_unit->m_Name = std::make_shared<IfcSIUnitName>( IfcSIUnitName::ENUM_METRE );
	insertEntity(si_unit);

	// plane unit [rad]
	auto plane_angle_unit = std::make_shared<IfcSIUnit>();
	plane_angle_unit->m_UnitType = std::make_shared<IfcUnitEnum>( IfcUnitEnum::ENUM_PLANEANGLEUNIT );
	plane_angle_unit->m_Name = std::make_shared<IfcSIUnitName>( IfcSIUnitName::ENUM_RADIAN );
	insertEntity(plane_angle_unit);

	// assign units
	auto unit_assignment = std::make_shared<IfcUnitAssignment>();
	unit_assignment->m_Units.push_back( si_unit );
	unit_assignment->m_Units.push_back( plane_angle_unit );
	insertEntity(unit_assignment);

	project->m_GlobalId = std::make_shared<IfcGloballyUniqueId>( createGUID32_wstr() );
	project->m_OwnerHistory = owner_history;
	project->m_Name = std::make_shared<IfcLabel>( L"IfcPlusPlus project" );
	project->m_UnitsInContext = unit_assignment;

	// create default IfcSite
	auto site = std::make_shared<IfcSite>();
	site->m_GlobalId = std::make_shared<IfcGloballyUniqueId>( createGUID32_wstr() );
	site->m_OwnerHistory = owner_history;
	site->m_Name = std::make_shared<IfcLabel>( L"Site" );
	insertEntity(site);

	auto rel_aggregates_site = std::make_shared<IfcRelAggregates>();
	rel_aggregates_site->m_RelatingObject = project;
	insertEntity(rel_aggregates_site);

	// create default Building
	auto building = std::make_shared<IfcBuilding>();
	building->m_GlobalId = std::make_shared<IfcGloballyUniqueId>( createGUID32_wstr() );
	building->m_OwnerHistory = owner_history;
	building->m_Name = std::make_shared<IfcLabel>( L"Building" );
	insertEntity( building );
	
	// set up world coordinate system
	auto axis = std::make_shared<IfcDirection>();
	insertEntity(axis);
	axis->m_DirectionRatios.push_back( std::make_shared<IfcReal>( 0.0 ) );
	axis->m_DirectionRatios.push_back( std::make_shared<IfcReal>( 0.0 ) );
	axis->m_DirectionRatios.push_back( std::make_shared<IfcReal>( 0.0 ) );

	auto ref_direction = std::make_shared<IfcDirection>();
	insertEntity(ref_direction);
	ref_direction->m_DirectionRatios.push_back( std::make_shared<IfcReal>( 0.0 ) );
	ref_direction->m_DirectionRatios.push_back( std::make_shared<IfcReal>( 0.0 ) );
	ref_direction->m_DirectionRatios.push_back( std::make_shared<IfcReal>( 0.0 ) );

	auto location = std::make_shared<IfcCartesianPoint>();
	insertEntity(location);
	location->m_Coordinates.push_back( std::make_shared<IfcLengthMeasure>( 0.0 ) );
	location->m_Coordinates.push_back( std::make_shared<IfcLengthMeasure>( 0.0 ) );
	location->m_Coordinates.push_back( std::make_shared<IfcLengthMeasure>( 0.0 ) );

	auto world_coordinate_system = std::make_shared<IfcAxis2Placement3D>();
	insertEntity(world_coordinate_system);
	world_coordinate_system->m_Location = location;
	world_coordinate_system->m_Axis = axis;
	world_coordinate_system->m_RefDirection = ref_direction;

	// 3d representation context
	auto geom_context = std::make_shared<IfcGeometricRepresentationContext>();
	insertEntity(geom_context);
	geom_context->m_CoordinateSpaceDimension = std::make_shared<IfcDimensionCount>( 3 );
	geom_context->m_WorldCoordinateSystem = world_coordinate_system;

	updateCache();
}
Esempio n. 4
0
void IfcPPModel::resetIfcModel()
{
	clearIfcModel();
	initIfcModel();
	updateCache();
}
		void IfcAlignmentModel::initIfcModel()
		{
			clearIfcModel();

			shared_ptr<IfcProject> project( new IfcProject( 1 ) );
			insertEntity(project);

			shared_ptr<IfcPerson> person( new IfcPerson() );
			person->m_FamilyName = shared_ptr<IfcLabel>( new IfcLabel( "FamilyName" ) );
			person->m_GivenName = shared_ptr<IfcLabel>( new IfcLabel( "GivenName" ) );
			insertEntity(person);

			shared_ptr<IfcOrganization> org( new IfcOrganization() );
			org->m_Name = shared_ptr<IfcLabel>(new IfcLabel( "OrganizationName" ));
			insertEntity(org);

			shared_ptr<IfcPersonAndOrganization> person_org( new IfcPersonAndOrganization() );
			person_org->m_ThePerson = person;
			person_org->m_TheOrganization = org;
			insertEntity(person_org);

			shared_ptr<IfcApplication> app( new IfcApplication() );
			app->m_ApplicationDeveloper = org;
			app->m_Version = shared_ptr<IfcLabel>( new IfcLabel( "1.0" ) );
			app->m_ApplicationFullName = shared_ptr<IfcLabel>( new IfcLabel( "IfcAlignment" ) );
			app->m_ApplicationIdentifier = shared_ptr<IfcIdentifier>( new IfcIdentifier( "IfcAlignment" ) );
			insertEntity(app);


			shared_ptr<IfcCartesianPoint> point( new IfcCartesianPoint() );
			point->m_Coordinates.push_back( shared_ptr<IfcLengthMeasure>( new IfcLengthMeasure( 0.0 ) ) );
			point->m_Coordinates.push_back( shared_ptr<IfcLengthMeasure>( new IfcLengthMeasure( 0.0 ) ) );
			point->m_Coordinates.push_back( shared_ptr<IfcLengthMeasure>( new IfcLengthMeasure( 0.0 ) ) );
			insertEntity(point);

			shared_ptr<IfcAxis2Placement3D> axis_placement( new IfcAxis2Placement3D() );
			axis_placement->m_Location = point;
			insertEntity(axis_placement);

			shared_ptr<IfcOwnerHistory> owner_history ( new IfcOwnerHistory() );
			owner_history->m_OwningUser = person_org;
			owner_history->m_OwningApplication = app;
			owner_history->m_ChangeAction = shared_ptr<IfcChangeActionEnum>( new IfcChangeActionEnum( IfcChangeActionEnum::ENUM_ADDED ) );
			insertEntity(owner_history);

			shared_ptr<IfcDimensionalExponents> dim_exp( new IfcDimensionalExponents() );
			dim_exp->m_LengthExponent = 0;
			dim_exp->m_MassExponent = 0;
			dim_exp->m_TimeExponent = 0;
			dim_exp->m_ElectricCurrentExponent = 0;
			dim_exp->m_ThermodynamicTemperatureExponent = 0;
			dim_exp->m_AmountOfSubstanceExponent = 0;
			dim_exp->m_LuminousIntensityExponent = 0;
			insertEntity(dim_exp);

			// length unit [m]
			shared_ptr<IfcSIUnit> si_unit( new IfcSIUnit() );
			si_unit->m_UnitType = shared_ptr<IfcUnitEnum>( new IfcUnitEnum( IfcUnitEnum::ENUM_LENGTHUNIT ) );
			si_unit->m_Name = shared_ptr<IfcSIUnitName>( new IfcSIUnitName( IfcSIUnitName::ENUM_METRE ) );
			insertEntity(si_unit);

			// plane unit [rad]
			shared_ptr<IfcSIUnit> plane_angle_unit( new IfcSIUnit() );
			plane_angle_unit->m_UnitType = shared_ptr<IfcUnitEnum>( new IfcUnitEnum( IfcUnitEnum::ENUM_PLANEANGLEUNIT ) );
			plane_angle_unit->m_Name = shared_ptr<IfcSIUnitName>( new IfcSIUnitName( IfcSIUnitName::ENUM_RADIAN ) );
			insertEntity(plane_angle_unit);

			// assign units
			shared_ptr<IfcUnitAssignment> unit_assignment( new IfcUnitAssignment() );
			unit_assignment->m_Units.push_back( si_unit );
			unit_assignment->m_Units.push_back( plane_angle_unit );
			insertEntity(unit_assignment);


			project->m_GlobalId = shared_ptr<IfcGloballyUniqueId>(new IfcGloballyUniqueId( CreateCompressedGuidString22() ) );
			project->m_OwnerHistory = owner_history;
			project->m_Name = shared_ptr<IfcLabel>(new IfcLabel( "IfcAlignment project" ) );
			project->m_UnitsInContext = unit_assignment;

			// set up world coordinate system
			shared_ptr<IfcDirection> axis( new IfcDirection() );
			insertEntity(axis);
//             axis->m_DirectionRatios.push_back( 0.0 );
//             axis->m_DirectionRatios.push_back( 0.0 );
//             axis->m_DirectionRatios.push_back( 1.0 );
		
			shared_ptr<IfcDirection> ref_direction( new IfcDirection() );
			insertEntity(ref_direction);
//             ref_direction->m_DirectionRatios.push_back( 0.0 );
//             ref_direction->m_DirectionRatios.push_back( 0.0 );
//             ref_direction->m_DirectionRatios.push_back( 1.0 );

			shared_ptr<IfcCartesianPoint> location( new IfcCartesianPoint() );
			insertEntity(location);
			location->m_Coordinates.push_back( shared_ptr<IfcLengthMeasure>(new IfcLengthMeasure(0.0) ) );
			location->m_Coordinates.push_back( shared_ptr<IfcLengthMeasure>(new IfcLengthMeasure(0.0) ) );
			location->m_Coordinates.push_back( shared_ptr<IfcLengthMeasure>(new IfcLengthMeasure(0.0) ) );

			shared_ptr<IfcAxis2Placement3D> world_coordinate_system( new IfcAxis2Placement3D() );
			insertEntity(world_coordinate_system);
			world_coordinate_system->m_Location = location;
			world_coordinate_system->m_Axis = axis;
			world_coordinate_system->m_RefDirection = ref_direction;

			// 3d representation context
			shared_ptr<IfcGeometricRepresentationContext> geom_context( new IfcGeometricRepresentationContext() );
			insertEntity(geom_context);
			geom_context->m_CoordinateSpaceDimension = shared_ptr<IfcDimensionCount>(new IfcDimensionCount( 3 ) );
			geom_context->m_WorldCoordinateSystem = world_coordinate_system;

			updateCache();
		}
		void IfcAlignmentModel::resetIfcModel()
		{
			clearIfcModel();
			initIfcModel();
			updateCache();
		}