Skip to content

Commit 02fa8c8

Browse files
[read carefully before decide merge] !!! normalize line endings of src files (IfcOpenShell#1268)
* all source: prepare to normalize line ending * all src: normalize line endings
1 parent 3202174 commit 02fa8c8

File tree

11 files changed

+53264
-53253
lines changed

11 files changed

+53264
-53253
lines changed
Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,45 @@
1919

2020

2121
# normalize the line endings of the following files
22-
# standard files
22+
*.cpp text
23+
*.css text
24+
*.csv text
2325
*.feature text
26+
*.gitattributes text
27+
*.gitignore text
28+
*.gitkeep
29+
*.h text
2430
*.html text
2531
*.ifc text
32+
*.json text
2633
*.md text
2734
*.po text
2835
*.pot text
2936
*.py text
37+
*.txt text
3038

3139

32-
# files which are human readable
33-
# but for which it is not sure if normalize is ok
34-
# svg
35-
36-
37-
# binary files
40+
# files not normalized ATM
41+
# bat
42+
# bnf
43+
# blend
44+
# i
3845
# ico
3946
# mo
47+
# mpass
48+
# png
49+
# pth
50+
# pyc
51+
# rst
52+
# svg
53+
# ttf
54+
# xsd
4055

4156

42-
# line endings of the directories commented will be normalized
43-
# bimtester/** -text
44-
# examples/** -text
45-
46-
47-
# line endings of the directories NOT commented will NOT be normalized
48-
# Be carefully changes here could affect a lot of files automatically!
49-
# none ATM
57+
# line endings of all directories will be normalized
58+
# to exclude a directory from being normalized add it here
59+
# example: to exclude dirctory ifcbimtester use the following line without #
60+
# ifcbimtester/** -text
5061

5162

5263
# use git to manually correct the file endings

src/examples/ifc_curve_rebar.cpp

Lines changed: 143 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,143 @@
1-
/********************************************************************************
2-
* *
3-
* This file is part of IfcOpenShell. *
4-
* *
5-
* IfcOpenShell is free software: you can redistribute it and/or modify *
6-
* it under the terms of the Lesser GNU General Public License as published by *
7-
* the Free Software Foundation, either version 3.0 of the License, or *
8-
* (at your option) any later version. *
9-
* *
10-
* IfcOpenShell is distributed in the hope that it will be useful, *
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13-
* Lesser GNU General Public License for more details. *
14-
* *
15-
* You should have received a copy of the Lesser GNU General Public License *
16-
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17-
* *
18-
********************************************************************************/
19-
20-
/********************************************************************************
21-
* *
22-
* Example of curve rebar. *
23-
* *
24-
********************************************************************************/
25-
26-
#include <iostream>
27-
#include <string>
28-
#include <fstream>
29-
30-
#include "ifcparse\Ifc2x3.h"
31-
#include "ifcparse\IfcUtil.h"
32-
#include "ifcparse\IfcHierarchyHelper.h"
33-
#include "ifcgeom\IfcGeom.h"
34-
35-
typedef std::string S;
36-
typedef IfcParse::IfcGlobalId guid;
37-
boost::none_t const null = boost::none;
38-
39-
void create_curve_rebar(IfcHierarchyHelper& file)
40-
{
41-
int dia = 24;
42-
int R = 3 * dia;
43-
int length = 12 * dia;
44-
45-
double crossSectionarea = M_PI * (dia / 2) * 2;
46-
IfcSchema::IfcReinforcingBar* rebar = new IfcSchema::IfcReinforcingBar(
47-
guid(), 0, S("test"), null,
48-
null, 0, 0,
49-
null, S("SR24"), //SteelGrade
50-
dia, //diameter
51-
crossSectionarea, //crossSectionarea = math.pi*(12.0/2)**2
52-
0,
53-
IfcSchema::IfcReinforcingBarRoleEnum::IfcReinforcingBarRoleEnum::IfcReinforcingBarRole_LIGATURE,
54-
IfcSchema::IfcReinforcingBarSurfaceEnum::IfcReinforcingBarSurfaceEnum::IfcReinforcingBarSurface_PLAIN //PLAIN or TEXTURED
55-
);
56-
57-
file.addBuildingProduct(rebar);
58-
rebar->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>());
59-
60-
IfcSchema::IfcCompositeCurveSegment::list::ptr segments(new IfcSchema::IfcCompositeCurveSegment::list());
61-
62-
IfcSchema::IfcCartesianPoint* p1 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, 0, 1000.);
63-
IfcSchema::IfcCartesianPoint* p2 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, 0, 0);
64-
IfcSchema::IfcCartesianPoint* p3 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, R, 0);
65-
IfcSchema::IfcCartesianPoint* p4 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, R, -R);
66-
IfcSchema::IfcCartesianPoint* p5 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, R + length, -R);
67-
68-
/*first segment - line */
69-
IfcSchema::IfcCartesianPoint::list::ptr points1(new IfcSchema::IfcCartesianPoint::list());
70-
points1->push(p1);
71-
points1->push(p2);
72-
file.addEntities(points1->generalize());
73-
IfcSchema::IfcPolyline* poly1 = new IfcSchema::IfcPolyline(points1);
74-
file.addEntity(poly1);
75-
76-
IfcSchema::IfcCompositeCurveSegment* segment1 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly1);
77-
file.addEntity(segment1);
78-
segments->push(segment1);
79-
80-
/*second segment - arc */
81-
IfcSchema::IfcAxis2Placement3D* axis1 = new IfcSchema::IfcAxis2Placement3D(p3, file.addTriplet<IfcSchema::IfcDirection>(1, 0, 0), file.addTriplet<IfcSchema::IfcDirection>(0, 1, 0));
82-
file.addEntity(axis1);
83-
IfcSchema::IfcCircle* circle = new IfcSchema::IfcCircle(axis1, R);
84-
file.addEntity(circle);
85-
86-
IfcEntityList::ptr trim1(new IfcEntityList);
87-
IfcEntityList::ptr trim2(new IfcEntityList);
88-
89-
trim1->push(new IfcSchema::IfcParameterValue(180));
90-
trim1->push(p2);
91-
92-
trim2->push(new IfcSchema::IfcParameterValue(270));
93-
trim2->push(p4);
94-
IfcSchema::IfcTrimmedCurve* trimmed_curve = new IfcSchema::IfcTrimmedCurve(circle, trim1, trim2, false, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
95-
file.addEntity(trimmed_curve);
96-
97-
IfcSchema::IfcCompositeCurveSegment* segment2 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT, false, trimmed_curve);
98-
file.addEntity(segment2);
99-
segments->push(segment2);
100-
101-
/*third segment - line */
102-
IfcSchema::IfcCartesianPoint::list::ptr points2(new IfcSchema::IfcCartesianPoint::list());
103-
points2->push(p4);
104-
points2->push(p5);
105-
file.addEntities(points2->generalize());
106-
IfcSchema::IfcPolyline* poly2 = new IfcSchema::IfcPolyline(points2);
107-
file.addEntity(poly2);
108-
109-
IfcSchema::IfcCompositeCurveSegment* segment3 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly2);
110-
file.addEntity(segment3);
111-
segments->push(segment3);
112-
113-
IfcSchema::IfcCompositeCurve* curve = new IfcSchema::IfcCompositeCurve(segments, false);
114-
file.addEntity(curve);
115-
116-
IfcSchema::IfcSweptDiskSolid* solid = new IfcSchema::IfcSweptDiskSolid(curve, dia / 2, null, 0, 1);
117-
118-
IfcSchema::IfcRepresentation::list::ptr reps(new IfcSchema::IfcRepresentation::list());
119-
IfcSchema::IfcRepresentationItem::list::ptr items(new IfcSchema::IfcRepresentationItem::list());
120-
items->push(solid);
121-
IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation(
122-
file.getSingle<IfcSchema::IfcRepresentationContext>(), S("Body"), S("AdvancedSweptSolid"), items);
123-
reps->push(rep);
124-
125-
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps);
126-
file.addEntity(shape);
127-
128-
rebar->setRepresentation(shape);
129-
130-
IfcSchema::IfcObjectPlacement* storey_placement = file.getSingle<IfcSchema::IfcBuildingStorey>()->ObjectPlacement();
131-
rebar->setObjectPlacement(file.addLocalPlacement(storey_placement, 0, 0, 0));
132-
}
133-
134-
int main()
135-
{
136-
IfcHierarchyHelper file;
137-
file.header().file_name().name("ifc_curve_rebar.ifc");
138-
create_curve_rebar(file);
139-
std::ofstream f("ifc_curve_rebar.ifc");
140-
f << file;
141-
142-
return 0;
143-
}
1+
/********************************************************************************
2+
* *
3+
* This file is part of IfcOpenShell. *
4+
* *
5+
* IfcOpenShell is free software: you can redistribute it and/or modify *
6+
* it under the terms of the Lesser GNU General Public License as published by *
7+
* the Free Software Foundation, either version 3.0 of the License, or *
8+
* (at your option) any later version. *
9+
* *
10+
* IfcOpenShell is distributed in the hope that it will be useful, *
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13+
* Lesser GNU General Public License for more details. *
14+
* *
15+
* You should have received a copy of the Lesser GNU General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
* *
18+
********************************************************************************/
19+
20+
/********************************************************************************
21+
* *
22+
* Example of curve rebar. *
23+
* *
24+
********************************************************************************/
25+
26+
#include <iostream>
27+
#include <string>
28+
#include <fstream>
29+
30+
#include "ifcparse\Ifc2x3.h"
31+
#include "ifcparse\IfcUtil.h"
32+
#include "ifcparse\IfcHierarchyHelper.h"
33+
#include "ifcgeom\IfcGeom.h"
34+
35+
typedef std::string S;
36+
typedef IfcParse::IfcGlobalId guid;
37+
boost::none_t const null = boost::none;
38+
39+
void create_curve_rebar(IfcHierarchyHelper& file)
40+
{
41+
int dia = 24;
42+
int R = 3 * dia;
43+
int length = 12 * dia;
44+
45+
double crossSectionarea = M_PI * (dia / 2) * 2;
46+
IfcSchema::IfcReinforcingBar* rebar = new IfcSchema::IfcReinforcingBar(
47+
guid(), 0, S("test"), null,
48+
null, 0, 0,
49+
null, S("SR24"), //SteelGrade
50+
dia, //diameter
51+
crossSectionarea, //crossSectionarea = math.pi*(12.0/2)**2
52+
0,
53+
IfcSchema::IfcReinforcingBarRoleEnum::IfcReinforcingBarRoleEnum::IfcReinforcingBarRole_LIGATURE,
54+
IfcSchema::IfcReinforcingBarSurfaceEnum::IfcReinforcingBarSurfaceEnum::IfcReinforcingBarSurface_PLAIN //PLAIN or TEXTURED
55+
);
56+
57+
file.addBuildingProduct(rebar);
58+
rebar->setOwnerHistory(file.getSingle<IfcSchema::IfcOwnerHistory>());
59+
60+
IfcSchema::IfcCompositeCurveSegment::list::ptr segments(new IfcSchema::IfcCompositeCurveSegment::list());
61+
62+
IfcSchema::IfcCartesianPoint* p1 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, 0, 1000.);
63+
IfcSchema::IfcCartesianPoint* p2 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, 0, 0);
64+
IfcSchema::IfcCartesianPoint* p3 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, R, 0);
65+
IfcSchema::IfcCartesianPoint* p4 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, R, -R);
66+
IfcSchema::IfcCartesianPoint* p5 = file.addTriplet<IfcSchema::IfcCartesianPoint>(0, R + length, -R);
67+
68+
/*first segment - line */
69+
IfcSchema::IfcCartesianPoint::list::ptr points1(new IfcSchema::IfcCartesianPoint::list());
70+
points1->push(p1);
71+
points1->push(p2);
72+
file.addEntities(points1->generalize());
73+
IfcSchema::IfcPolyline* poly1 = new IfcSchema::IfcPolyline(points1);
74+
file.addEntity(poly1);
75+
76+
IfcSchema::IfcCompositeCurveSegment* segment1 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly1);
77+
file.addEntity(segment1);
78+
segments->push(segment1);
79+
80+
/*second segment - arc */
81+
IfcSchema::IfcAxis2Placement3D* axis1 = new IfcSchema::IfcAxis2Placement3D(p3, file.addTriplet<IfcSchema::IfcDirection>(1, 0, 0), file.addTriplet<IfcSchema::IfcDirection>(0, 1, 0));
82+
file.addEntity(axis1);
83+
IfcSchema::IfcCircle* circle = new IfcSchema::IfcCircle(axis1, R);
84+
file.addEntity(circle);
85+
86+
IfcEntityList::ptr trim1(new IfcEntityList);
87+
IfcEntityList::ptr trim2(new IfcEntityList);
88+
89+
trim1->push(new IfcSchema::IfcParameterValue(180));
90+
trim1->push(p2);
91+
92+
trim2->push(new IfcSchema::IfcParameterValue(270));
93+
trim2->push(p4);
94+
IfcSchema::IfcTrimmedCurve* trimmed_curve = new IfcSchema::IfcTrimmedCurve(circle, trim1, trim2, false, IfcSchema::IfcTrimmingPreference::IfcTrimmingPreference_PARAMETER);
95+
file.addEntity(trimmed_curve);
96+
97+
IfcSchema::IfcCompositeCurveSegment* segment2 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTSAMEGRADIENT, false, trimmed_curve);
98+
file.addEntity(segment2);
99+
segments->push(segment2);
100+
101+
/*third segment - line */
102+
IfcSchema::IfcCartesianPoint::list::ptr points2(new IfcSchema::IfcCartesianPoint::list());
103+
points2->push(p4);
104+
points2->push(p5);
105+
file.addEntities(points2->generalize());
106+
IfcSchema::IfcPolyline* poly2 = new IfcSchema::IfcPolyline(points2);
107+
file.addEntity(poly2);
108+
109+
IfcSchema::IfcCompositeCurveSegment* segment3 = new IfcSchema::IfcCompositeCurveSegment(IfcSchema::IfcTransitionCode::IfcTransitionCode_CONTINUOUS, true, poly2);
110+
file.addEntity(segment3);
111+
segments->push(segment3);
112+
113+
IfcSchema::IfcCompositeCurve* curve = new IfcSchema::IfcCompositeCurve(segments, false);
114+
file.addEntity(curve);
115+
116+
IfcSchema::IfcSweptDiskSolid* solid = new IfcSchema::IfcSweptDiskSolid(curve, dia / 2, null, 0, 1);
117+
118+
IfcSchema::IfcRepresentation::list::ptr reps(new IfcSchema::IfcRepresentation::list());
119+
IfcSchema::IfcRepresentationItem::list::ptr items(new IfcSchema::IfcRepresentationItem::list());
120+
items->push(solid);
121+
IfcSchema::IfcShapeRepresentation* rep = new IfcSchema::IfcShapeRepresentation(
122+
file.getSingle<IfcSchema::IfcRepresentationContext>(), S("Body"), S("AdvancedSweptSolid"), items);
123+
reps->push(rep);
124+
125+
IfcSchema::IfcProductDefinitionShape* shape = new IfcSchema::IfcProductDefinitionShape(null, null, reps);
126+
file.addEntity(shape);
127+
128+
rebar->setRepresentation(shape);
129+
130+
IfcSchema::IfcObjectPlacement* storey_placement = file.getSingle<IfcSchema::IfcBuildingStorey>()->ObjectPlacement();
131+
rebar->setObjectPlacement(file.addLocalPlacement(storey_placement, 0, 0, 0));
132+
}
133+
134+
int main()
135+
{
136+
IfcHierarchyHelper file;
137+
file.header().file_name().name("ifc_curve_rebar.ifc");
138+
create_curve_rebar(file);
139+
std::ofstream f("ifc_curve_rebar.ifc");
140+
f << file;
141+
142+
return 0;
143+
}

0 commit comments

Comments
 (0)