Skip to content

Commit 12e6286

Browse files
committed
odb: dbTransform smal fixes
Signed-off-by: osamahammad21 <[email protected]>
1 parent 2234847 commit 12e6286

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

src/odb/include/odb/dbTransform.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,66 +18,66 @@ class dbIStream;
1818
class dbTransform
1919
{
2020
friend class _dbBlock;
21-
dbOrientType::Value _orient = dbOrientType::R0;
22-
Point3D _offset;
21+
dbOrientType::Value orient_ = dbOrientType::R0;
22+
Point3D offset_;
2323
bool mirror_z_ = false;
2424

2525
public:
2626
// T = <R0, (0,0,0), false>
2727
dbTransform() = default;
2828

2929
// T = <R0, (offset,0), false>
30-
dbTransform(const Point offset) : _offset(offset, 0) {}
30+
dbTransform(const Point offset) : offset_(offset, 0) {}
3131

3232
// T = <R0, offset, false>
33-
dbTransform(const Point3D& offset) : _offset(offset) {}
33+
dbTransform(const Point3D& offset) : offset_(offset) {}
3434

3535
// T = <orient, (0,0,0), false>
36-
dbTransform(const dbOrientType orient) : _orient(orient) {}
36+
dbTransform(const dbOrientType orient) : orient_(orient) {}
3737

3838
// T = <orient, (0,0,0), orient.mirror_z_>
3939
dbTransform(const dbOrientType3D& orient)
40-
: _orient(orient.getOrientType2D()), mirror_z_(orient.isMirrorZ())
40+
: orient_(orient.getOrientType2D()), mirror_z_(orient.isMirrorZ())
4141
{
4242
}
4343

4444
// T = <orient, (offset,0), false>
4545
dbTransform(const dbOrientType orient, const Point& offset)
46-
: _orient(orient), _offset(offset, 0)
46+
: orient_(orient), offset_(offset, 0)
4747
{
4848
}
4949

5050
dbTransform(const dbOrientType3D orient, const Point3D& offset)
51-
: _orient(orient.getOrientType2D()),
52-
_offset(offset),
51+
: orient_(orient.getOrientType2D()),
52+
offset_(offset),
5353
mirror_z_(orient.isMirrorZ())
5454
{
5555
}
5656

5757
bool operator==(const dbTransform& t) const
5858
{
59-
return (_orient == t._orient) && (_offset == t._offset)
59+
return (orient_ == t.orient_) && (offset_ == t.offset_)
6060
&& (mirror_z_ == t.mirror_z_);
6161
}
6262

6363
bool operator!=(const dbTransform& t) const { return !operator==(t); }
6464

65-
void setOrient(const dbOrientType orient) { _orient = orient; }
65+
void setOrient(const dbOrientType orient) { orient_ = orient; }
6666

6767
void setOrient(const dbOrientType3D& orient)
6868
{
69-
_orient = orient.getOrientType2D();
69+
orient_ = orient.getOrientType2D();
7070
mirror_z_ = orient.isMirrorZ();
7171
}
7272

73-
void setOffset(const Point offset) { _offset = Point3D(offset, 0); }
73+
void setOffset(const Point offset) { offset_ = Point3D(offset, 0); }
7474

75-
void setOffset(const Point3D& offset) { _offset = offset; }
75+
void setOffset(const Point3D& offset) { offset_ = offset; }
7676

7777
void setTransform(const dbOrientType orient, const Point& offset)
7878
{
79-
_orient = orient;
80-
_offset = Point3D(offset, 0);
79+
orient_ = orient;
80+
offset_ = Point3D(offset, 0);
8181
}
8282

8383
// Apply transform to this point
@@ -107,8 +107,8 @@ class dbTransform
107107
// Compute inverse transform
108108
void invert();
109109

110-
dbOrientType getOrient() const { return _orient; }
111-
Point getOffset() const { return Point(_offset.x(), _offset.y()); }
110+
dbOrientType getOrient() const { return orient_; }
111+
Point getOffset() const { return Point(offset_.x(), offset_.y()); }
112112

113113
friend dbOStream& operator<<(dbOStream& stream, const dbTransform& t);
114114
friend dbIStream& operator>>(dbIStream& stream, dbTransform& t);

src/odb/src/db/dbTransform.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ static const dbOrientType::Value orientMul[8][8] = {{dbOrientType::R0,
8181

8282
dbOStream& operator<<(dbOStream& stream, const dbTransform& t)
8383
{
84-
stream << (int) t._orient;
85-
stream << t._offset;
84+
stream << (int) t.orient_;
85+
stream << t.offset_;
8686
return stream;
8787
}
8888

8989
dbIStream& operator>>(dbIStream& stream, dbTransform& t)
9090
{
9191
int orient;
9292
stream >> orient;
93-
t._orient = (dbOrientType::Value) orient;
94-
stream >> t._offset;
93+
t.orient_ = (dbOrientType::Value) orient;
94+
stream >> t.offset_;
9595
return stream;
9696
}
9797

@@ -112,10 +112,10 @@ dbIStream& operator>>(dbIStream& stream, dbTransform& t)
112112
//
113113
void dbTransform::invert(dbTransform& result) const
114114
{
115-
Point offset(-_offset.x(), -_offset.y());
115+
Point offset(-offset_.x(), -offset_.y());
116116
dbOrientType::Value orient;
117117

118-
switch (_orient) {
118+
switch (orient_) {
119119
case dbOrientType::R0:
120120
orient = dbOrientType::R0;
121121
break;
@@ -160,14 +160,14 @@ void dbTransform::invert(dbTransform& result) const
160160
throw std::runtime_error("Unknown orientation");
161161
}
162162

163-
result._offset = Point3D(offset, mirror_z_ ? _offset.z() : -_offset.z());
164-
result._orient = orient;
163+
result.offset_ = Point3D(offset, mirror_z_ ? offset_.z() : -offset_.z());
164+
result.orient_ = orient;
165165
result.mirror_z_ = mirror_z_;
166166
}
167167

168168
void dbTransform::apply(Point& p) const
169169
{
170-
switch (_orient) {
170+
switch (orient_) {
171171
case dbOrientType::R0:
172172
break;
173173

@@ -202,8 +202,8 @@ void dbTransform::apply(Point& p) const
202202
break;
203203
}
204204

205-
p.addX(_offset.x());
206-
p.addY(_offset.y());
205+
p.addX(offset_.x());
206+
p.addY(offset_.y());
207207
}
208208

209209
void dbTransform::apply(Point3D& p) const
@@ -218,7 +218,7 @@ void dbTransform::apply(Point3D& p) const
218218

219219
p.setX(p2d.x());
220220
p.setY(p2d.y());
221-
p.setZ(z + _offset.z());
221+
p.setZ(z + offset_.z());
222222
}
223223

224224
void dbTransform::apply(Rect& r) const
@@ -250,9 +250,9 @@ void dbTransform::apply(Polygon& p) const
250250

251251
void dbTransform::concat(const dbTransform& t, dbTransform& result)
252252
{
253-
result._offset = _offset;
254-
t.apply(result._offset);
255-
result._orient = orientMul[_orient][t._orient];
253+
result.offset_ = offset_;
254+
t.apply(result.offset_);
255+
result.orient_ = orientMul[orient_][t.orient_];
256256
result.mirror_z_ = mirror_z_ ^ t.mirror_z_;
257257
}
258258

0 commit comments

Comments
 (0)