Fixed some build issues that appeared during merge

This commit is contained in:
Matthias Koefferlein 2021-03-30 23:20:39 +02:00
parent 94556c1448
commit cf51130339
23 changed files with 218 additions and 25 deletions

View File

@ -196,6 +196,18 @@ void DeepEdgePairs::do_transform (const db::ICplxTrans &t)
invalidate_bbox ();
}
void DeepEdgePairs::do_transform (const db::IMatrix2d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepEdgePairs::do_transform (const db::IMatrix3d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepEdgePairs::reserve (size_t)
{
// Not implemented for deep regions

View File

@ -54,6 +54,8 @@ public:
virtual void do_transform (const db::Trans &t);
virtual void do_transform (const db::ICplxTrans &t);
virtual void do_transform (const db::IMatrix2d &t);
virtual void do_transform (const db::IMatrix3d &t);
virtual void flatten ();

View File

@ -256,6 +256,18 @@ void DeepEdges::do_transform (const db::ICplxTrans &t)
invalidate_bbox ();
}
void DeepEdges::do_transform (const db::IMatrix2d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepEdges::do_transform (const db::IMatrix3d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepEdges::reserve (size_t)
{
// Not implemented for deep regions

View File

@ -55,6 +55,8 @@ public:
virtual void do_transform (const db::Trans &t);
virtual void do_transform (const db::ICplxTrans &t);
virtual void do_transform (const db::IMatrix2d &t);
virtual void do_transform (const db::IMatrix3d &t);
virtual void flatten ();

View File

@ -267,6 +267,18 @@ void DeepRegion::do_transform (const db::ICplxTrans &t)
invalidate_bbox ();
}
void DeepRegion::do_transform (const db::IMatrix2d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepRegion::do_transform (const db::IMatrix3d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepRegion::reserve (size_t)
{
// Not implemented for deep regions

View File

@ -57,6 +57,8 @@ public:
virtual void do_transform (const db::Trans &t);
virtual void do_transform (const db::ICplxTrans &t);
virtual void do_transform (const db::IMatrix2d &t);
virtual void do_transform (const db::IMatrix3d &t);
virtual void flatten ();

View File

@ -218,6 +218,18 @@ void DeepTexts::do_transform (const db::ICplxTrans &t)
invalidate_bbox ();
}
void DeepTexts::do_transform (const db::IMatrix2d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepTexts::do_transform (const db::IMatrix3d &t)
{
transform_deep_layer (deep_layer (), t);
invalidate_bbox ();
}
void DeepTexts::reserve (size_t)
{
// Not implemented for deep regions

View File

@ -55,6 +55,8 @@ public:
virtual void do_transform (const db::Trans &t);
virtual void do_transform (const db::ICplxTrans &t);
virtual void do_transform (const db::IMatrix2d &t);
virtual void do_transform (const db::IMatrix3d &t);
virtual void flatten ();

View File

@ -94,6 +94,16 @@ public:
transform_generic (t);
}
virtual void do_transform (const db::IMatrix2d &t)
{
transform_generic (t);
}
virtual void do_transform (const db::IMatrix3d &t)
{
transform_generic (t);
}
virtual void flatten () { }
db::Shapes &raw_edge_pairs () { return *mp_edge_pairs; }

View File

@ -99,7 +99,17 @@ public:
transform_generic (t);
}
void do_transform(const db::ICplxTrans &t)
void do_transform (const db::ICplxTrans &t)
{
transform_generic (t);
}
void do_transform (const db::IMatrix2d &t)
{
transform_generic (t);
}
void do_transform (const db::IMatrix3d &t)
{
transform_generic (t);
}

View File

@ -109,6 +109,16 @@ public:
transform_generic (t);
}
virtual void do_transform (const db::IMatrix2d &t)
{
transform_generic (t);
}
virtual void do_transform (const db::IMatrix3d &t)
{
transform_generic (t);
}
void flatten () { }
db::Shapes &raw_polygons () { return *mp_polygons; }

View File

@ -97,6 +97,16 @@ public:
transform_generic (t);
}
virtual void do_transform (const db::IMatrix2d &t)
{
transform_generic (t);
}
virtual void do_transform (const db::IMatrix3d &t)
{
transform_generic (t);
}
db::Shapes &raw_texts () { return *mp_texts; }
const db::Shapes &raw_texts () const { return *mp_texts; }

View File

@ -121,13 +121,13 @@ public:
* @param char_spacing Additional spacing between the lines in µm
* @param The resulting polygons will be put here (the vector will be cleared before)
*/
void text (const std::string &t, double target_dbu, double mag, bool inv, double bias, double char_spacing, double line_spacing, std::vector<db::Polygon> &polygons) const;
void text (const std::string &t, double target_dbu, double mag2, bool inv, double bias, double char_spacing, double line_spacing, std::vector<db::Polygon> &polygons) const;
/**
* @brief Creates the given text as a region
* For the parameters see "text"
*/
db::Region text_as_region (const std::string &t, double target_dbu, double mag, bool inv, double bias, double char_spacing, double line_spacing) const;
db::Region text_as_region (const std::string &t, double target_dbu, double mag2, bool inv, double bias, double char_spacing, double line_spacing) const;
/**
* @brief Gets the glyph for a given character

View File

@ -46,7 +46,7 @@ matrix_2d<C>::to_string () const
template <class C>
std::pair<double, double>
matrix_2d<C>::mag () const
matrix_2d<C>::mag2 () const
{
double s1 = sqrt (m_m11 * m_m11 + m_m21 * m_m21);
double s2 = sqrt (m_m12 * m_m12 + m_m22 * m_m22);
@ -65,7 +65,7 @@ template <class C>
double
matrix_2d<C>::angle () const
{
std::pair <double, double> m = mag ();
std::pair <double, double> m = mag2 ();
double u1 = m.first;
double u2 = is_mirror () ? -m.second : m.second;
double n11 = m_m11 / u1;
@ -98,7 +98,7 @@ template <class C>
bool
matrix_2d<C>::has_shear () const
{
std::pair <double, double> m = mag ();
std::pair <double, double> m = mag2 ();
double u1 = m.first;
double u2 = is_mirror () ? -m.second : m.second;
double n11 = m_m11 / u1;
@ -114,7 +114,7 @@ template <class C>
double
matrix_2d<C>::shear_angle () const
{
std::pair <double, double> m = mag ();
std::pair <double, double> m = mag2 ();
double u1 = m.first;
double u2 = is_mirror () ? -m.second : m.second;
double n11 = m_m11 / u1;

View File

@ -309,7 +309,15 @@ public:
* into the geometrical base transformations. This member returns the x and y magnification
* components. The order of the execution is mirror, magnification, shear and rotation.
*/
std::pair<double, double> mag () const;
std::pair<double, double> mag2 () const;
/**
* @brief For compatibility with other transformations
*/
double mag () const
{
return mag2 ().first;
}
/**
* @brief Return the x magnification component of the matrix
@ -320,7 +328,7 @@ public:
*/
double mag_x () const
{
return mag ().first;
return mag2 ().first;
}
/**
@ -332,7 +340,7 @@ public:
*/
double mag_y () const
{
return mag ().second;
return mag2 ().second;
}
/**
@ -356,6 +364,22 @@ public:
return matrix_2d<C> (m, 0.0, 0.0, m);
}
/**
* @brief A dummy displacement accessor (matrix2d does not have a displacement)
*/
db::vector<coord_type> disp () const
{
return db::vector<coord_type> ();
}
/**
* @brief For compatibility with other transformations
*/
coord_type ctrans (coord_type c) const
{
return db::coord_traits<coord_type>::rounded (mag2 ().first * c);
}
/**
* @brief Return the mirror component of the matrix
*
@ -759,9 +783,25 @@ public:
* into the geometrical base transformations. This member returns the magnification
* component for both x and y direction (anisotropic magnification). The order of the execution is mirror, magnification, shear, rotation, perspective and displacement.
*/
std::pair<double, double> mag () const
std::pair<double, double> mag2 () const
{
return m2d ().mag ();
return m2d ().mag2 ();
}
/**
* @brief For compatibility with other transformations
*/
double mag () const
{
return mag2 ().first;
}
/**
* @brief For compatibility with other transformations
*/
coord_type ctrans (coord_type c) const
{
return db::coord_traits<coord_type>::rounded (mag2 ().first * c);
}
/**
@ -769,7 +809,7 @@ public:
*/
double mag_x () const
{
return mag ().first;
return mag2 ().first;
}
/**
@ -777,7 +817,7 @@ public:
*/
double mag_y () const
{
return mag ().second;
return mag2 ().second;
}
/**

View File

@ -49,6 +49,8 @@ public:
virtual void do_transform (const db::Trans &t) = 0;
virtual void do_transform (const db::ICplxTrans &t) = 0;
virtual void do_transform (const db::IMatrix2d &t) = 0;
virtual void do_transform (const db::IMatrix3d &t) = 0;
virtual void flatten () = 0;
@ -58,6 +60,8 @@ public:
void transform (const db::Disp &t) { do_transform (db::Trans (t)); }
void transform (const db::Trans &t) { do_transform (t); }
void transform (const db::ICplxTrans &t) { do_transform (t); }
void transform (const db::IMatrix2d &t) { do_transform (t); }
void transform (const db::IMatrix3d &t) { do_transform (t); }
void insert (const db::EdgePair &edge_pair) { do_insert (edge_pair); }
void insert (const db::Shape &shape);

View File

@ -47,6 +47,8 @@ public:
virtual void do_transform (const db::Trans &t) = 0;
virtual void do_transform (const db::ICplxTrans &t) = 0;
virtual void do_transform (const db::IMatrix2d &t) = 0;
virtual void do_transform (const db::IMatrix3d &t) = 0;
virtual void flatten () = 0;
@ -58,6 +60,8 @@ public:
void transform (const db::Disp &t) { do_transform (db::Trans (t)); }
void transform (const db::Trans &t) { do_transform (t); }
void transform (const db::ICplxTrans &t) { do_transform (t); }
void transform (const db::IMatrix2d &t) { do_transform (t); }
void transform (const db::IMatrix3d &t) { do_transform (t); }
void insert (const db::Edge &edge) { do_insert (edge); }
void insert (const db::Box &box);

View File

@ -51,9 +51,13 @@ public:
void transform (const db::Disp &t) { do_transform (db::Trans (t)); }
void transform (const db::Trans &t) { do_transform (t); }
void transform (const db::ICplxTrans &t) { do_transform (t); }
void transform (const db::IMatrix2d &t) { do_transform (t); }
void transform (const db::IMatrix3d &t) { do_transform (t); }
virtual void do_transform (const db::Trans &t) = 0;
virtual void do_transform (const db::ICplxTrans &t) = 0;
virtual void do_transform (const db::IMatrix2d &t) = 0;
virtual void do_transform (const db::IMatrix3d &t) = 0;
virtual void flatten () = 0;

View File

@ -49,6 +49,8 @@ public:
virtual void do_transform (const db::Trans &t) = 0;
virtual void do_transform (const db::ICplxTrans &t) = 0;
virtual void do_transform (const db::IMatrix3d &t) = 0;
virtual void do_transform (const db::IMatrix2d &t) = 0;
virtual void flatten () = 0;
@ -58,6 +60,8 @@ public:
void transform (const db::Disp &t) { do_transform (db::Trans (t)); }
void transform (const db::Trans &t) { do_transform (t); }
void transform (const db::ICplxTrans &t) { do_transform (t); }
void transform (const db::IMatrix3d &t) { do_transform (t); }
void transform (const db::IMatrix2d &t) { do_transform (t); }
void insert (const db::Text &text) { do_insert (text); }
void insert (const db::Shape &shape);

View File

@ -688,7 +688,8 @@ public:
text<C> &transform (const Tr &t)
{
typedef typename Tr::target_coord_type target_coord_type;
m_trans = simple_trans<target_coord_type> ((t.fp_trans () * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ());
fixpoint_trans<coord_type> fp (t);
m_trans = simple_trans<target_coord_type> ((fp * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ());
m_size = t.ctrans (m_size);
return *this;
}
@ -708,13 +709,14 @@ public:
text<typename Tr::target_coord_type> transformed (const Tr &t) const
{
typedef typename Tr::target_coord_type target_coord_type;
fixpoint_trans<coord_type> fp (t);
size_t p = (size_t) mp_ptr;
if (p & 1) {
return text<target_coord_type> (reinterpret_cast<StringRef *> (p - 1), simple_trans<target_coord_type> ((t.fp_trans () * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ()), t.ctrans (m_size), m_font, m_halign, m_valign);
return text<target_coord_type> (reinterpret_cast<StringRef *> (p - 1), simple_trans<target_coord_type> ((fp * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ()), t.ctrans (m_size), m_font, m_halign, m_valign);
} else if (mp_ptr) {
return text<target_coord_type> (mp_ptr, simple_trans<target_coord_type> ((t.fp_trans () * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ()), t.ctrans (m_size), m_font, m_halign, m_valign);
return text<target_coord_type> (mp_ptr, simple_trans<target_coord_type> ((fp * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ()), t.ctrans (m_size), m_font, m_halign, m_valign);
} else {
return text<target_coord_type> (simple_trans<target_coord_type> ((t.fp_trans () * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ()), t.ctrans (m_size), m_font, m_halign, m_valign);
return text<target_coord_type> (simple_trans<target_coord_type> ((fp * m_trans.fp_trans ()).rot (), t (point_type () + m_trans.disp ()) - point<target_coord_type> ()), t.ctrans (m_size), m_font, m_halign, m_valign);
}
}

View File

@ -112,6 +112,8 @@ void Texts::insert (const db::Shape &shape, const T &trans)
template DB_PUBLIC void Texts::insert (const db::Shape &, const db::ICplxTrans &);
template DB_PUBLIC void Texts::insert (const db::Shape &, const db::Trans &);
template DB_PUBLIC void Texts::insert (const db::Shape &, const db::Disp &);
template DB_PUBLIC void Texts::insert (const db::Shape &, const db::IMatrix2d &);
template DB_PUBLIC void Texts::insert (const db::Shape &, const db::IMatrix3d &);
void Texts::clear ()
{

View File

@ -376,6 +376,32 @@ public:
// .. nothing else ..
}
/**
* @brief Reduction
*/
template <class T>
explicit fixpoint_trans (const T &t)
: m_f (0)
{
*this = t.fp_trans ();
}
/**
* @brief Reduction from a matrix2d
*/
explicit fixpoint_trans (const db::matrix_2d<coord_type> &t)
{
m_f = ((int (floor (t.angle () / 90.0 + 0.5) + 4)) % 4) + (t.is_mirror () ? 4 : 0);
}
/**
* @brief Reduction from a matrix3d
*/
explicit fixpoint_trans (const db::matrix_3d<coord_type> &t)
{
m_f = ((int (floor (t.angle () / 90.0 + 0.5) + 4)) % 4) + (t.is_mirror () ? 4 : 0);
}
/**
* @brief Returns true, if the transformation is unity
*/
@ -420,7 +446,18 @@ public:
// .. nothing else ..
}
/**
/**
* @brief The standard constructor using a code rather than angle and mirror and no displacement
*
* @param f The rotation/mirror code (r0 .. m135 constants)
*/
explicit fixpoint_trans (unsigned int f)
: m_f (f)
{
// .. nothing else ..
}
/**
* @brief The rotation/mirror codes
*/
static const int r0 = 0; // No rotation
@ -1651,7 +1688,7 @@ public:
{
tl_assert (! m.has_shear ());
tl_assert (! m.has_perspective ());
std::pair<double, double> mag = m.mag ();
std::pair<double, double> mag = m.mag2 ();
tl_assert (fabs (mag.first - mag.second) < 1e-10);
double rot = m.angle () * M_PI / 180.0;
m_mag = m.is_mirror () ? -mag.first : mag.first;
@ -1674,7 +1711,7 @@ public:
: m_u (u)
{
tl_assert (! m.has_shear ());
std::pair<double, double> mag = m.mag ();
std::pair<double, double> mag = m.mag2 ();
tl_assert (fabs (mag.first - mag.second) < 1e-10);
double rot = m.angle () * M_PI / 180.0;
m_mag = m.is_mirror () ? -mag.first : mag.first;

View File

@ -114,10 +114,10 @@ TEST(1)
EXPECT_EQ (tl::to_string (db::Matrix2d::shear (17).has_shear ()), "true");
EXPECT_EQ (tl::to_string (db::Matrix2d::shear (40).shear_angle ()), "40");
EXPECT_EQ (tl::to_string (db::Matrix2d::shear (-40).shear_angle ()), "-40");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (17.5).inverted ().mag ().first), "17.5");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (17.5).inverted ().mag ().second), "17.5");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (27.5, 7.5).inverted ().mag ().first), "27.5");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (27.5, 7.5).inverted ().mag ().second), "7.5");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (17.5).inverted ().mag2 ().first), "17.5");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (17.5).inverted ().mag2 ().second), "17.5");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (27.5, 7.5).inverted ().mag2 ().first), "27.5");
EXPECT_EQ (tl::to_string (1.0 / db::Matrix2d::mag (27.5, 7.5).inverted ().mag2 ().second), "7.5");
EXPECT_EQ (tl::to_string (db::Matrix2d::mirror (true).inverted ().is_mirror ()), "true");
EXPECT_EQ (tl::to_string (db::Matrix2d::mirror (false).inverted ().is_mirror ()), "false");
EXPECT_EQ (tl::to_string (db::Matrix2d::rotation (25).inverted ().angle ()), "-25");