mirror of https://github.com/KLayout/klayout.git
Fixed #68 (OASIS reader issue with degenerated shapes)
This commit is contained in:
parent
0402977424
commit
04b4c21e82
|
|
@ -396,6 +396,12 @@ Repetition::set_base (RepetitionBase *base)
|
|||
mp_base = base;
|
||||
}
|
||||
|
||||
size_t
|
||||
Repetition::size () const
|
||||
{
|
||||
return mp_base ? mp_base->size () : 1;
|
||||
}
|
||||
|
||||
bool
|
||||
Repetition::is_regular (db::Vector &a, db::Vector &b, size_t &n, size_t &m) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -171,6 +171,11 @@ public:
|
|||
return !operator== (d);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the number of elements in this repetition
|
||||
*/
|
||||
size_t size () const;
|
||||
|
||||
/**
|
||||
* @brief Check, if the repetition is an repetition at all
|
||||
*
|
||||
|
|
@ -183,7 +188,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Check, if the repetition is a regular one
|
||||
* @brief Checks, if the repetition is a regular one
|
||||
*
|
||||
* This method returns true, if the repetition is regular. It
|
||||
* returns true, if the repetition can be represented as a
|
||||
|
|
@ -251,6 +256,7 @@ public:
|
|||
virtual bool equals (const RepetitionBase *) const = 0;
|
||||
virtual bool less (const RepetitionBase *) const = 0;
|
||||
virtual bool is_regular (db::Vector &a, db::Vector &b, size_t &n, size_t &m) const = 0;
|
||||
virtual size_t size () const = 0;
|
||||
virtual const std::vector<db::Vector> *is_iterated () const = 0;
|
||||
virtual unsigned int type () = 0;
|
||||
};
|
||||
|
|
@ -294,6 +300,7 @@ public:
|
|||
virtual bool is_regular (db::Vector &a, db::Vector &b, size_t &n, size_t &m) const;
|
||||
virtual const std::vector<db::Vector> *is_iterated () const;
|
||||
virtual unsigned int type () { return 1; }
|
||||
virtual size_t size () const { return m_n * m_m; }
|
||||
|
||||
private:
|
||||
friend class RegularRepetitionIterator;
|
||||
|
|
@ -336,6 +343,7 @@ public:
|
|||
virtual bool is_regular (db::Vector &a, db::Vector &b, size_t &n, size_t &m) const;
|
||||
virtual const std::vector<db::Vector> *is_iterated () const;
|
||||
virtual unsigned int type () { return 2; }
|
||||
virtual size_t size () const { return m_points.size () + 1; }
|
||||
|
||||
void reserve (size_t n)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1702,7 +1702,7 @@ OASISReader::read_pointlist (modal_variable <std::vector <db::Point> > &pointlis
|
|||
pointlist.set_initialized ();
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
OASISReader::read_repetition ()
|
||||
{
|
||||
unsigned char type = get_uint ();
|
||||
|
|
@ -1834,6 +1834,7 @@ OASISReader::read_repetition ()
|
|||
error (tl::sprintf (tl::to_string (QObject::tr ("Invalid repetition type %d")), type));
|
||||
}
|
||||
|
||||
return mm_repetition.get ().size () > 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1980,9 +1981,7 @@ OASISReader::do_read_placement (unsigned char r,
|
|||
|
||||
db::Vector pos (mm_placement_x.get (), mm_placement_y.get ());
|
||||
|
||||
if (m & 0x8) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x8) && read_repetition ()) {
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
||||
|
|
@ -2135,9 +2134,7 @@ OASISReader::do_read_text (bool xy_absolute,
|
|||
ll = open_dl (layout, LDPair (mm_textlayer.get (), mm_texttype.get ()), m_create_layers);
|
||||
}
|
||||
|
||||
if (m & 0x4) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
|
||||
// TODO: should not read properties if layer is not enabled!
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
|
@ -2278,9 +2275,7 @@ OASISReader::do_read_rectangle (bool xy_absolute,
|
|||
|
||||
std::pair<bool, unsigned int> ll = open_dl (layout, LDPair (mm_layer.get (), mm_datatype.get ()), m_create_layers);
|
||||
|
||||
if (m & 0x4) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
||||
|
|
@ -2394,9 +2389,7 @@ OASISReader::do_read_polygon (bool xy_absolute, db::cell_index_type cell_index,
|
|||
|
||||
std::pair<bool, unsigned int> ll = open_dl (layout, LDPair (mm_layer.get (), mm_datatype.get ()), m_create_layers);
|
||||
|
||||
if (m & 0x4) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
||||
|
|
@ -2563,9 +2556,7 @@ OASISReader::do_read_path (bool xy_absolute, db::cell_index_type cell_index, db:
|
|||
|
||||
std::pair<bool, unsigned int> ll = open_dl (layout, LDPair (mm_layer.get (), mm_datatype.get ()), m_create_layers);
|
||||
|
||||
if (m & 0x4) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
||||
|
|
@ -2740,9 +2731,7 @@ OASISReader::do_read_trapezoid (unsigned char r, bool xy_absolute,db::cell_index
|
|||
pts [3] = db::Point (-std::min (delta_a, db::Coord (0)), db::Coord (0));
|
||||
}
|
||||
|
||||
if (m & 0x4) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
||||
|
|
@ -3102,9 +3091,7 @@ OASISReader::do_read_ctrapezoid (bool xy_absolute,db::cell_index_type cell_index
|
|||
--npts;
|
||||
}
|
||||
|
||||
if (m & 0x4) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
||||
|
|
@ -3239,9 +3226,7 @@ OASISReader::do_read_circle (bool xy_absolute, db::cell_index_type cell_index, d
|
|||
ll.first = false;
|
||||
}
|
||||
|
||||
if (m & 0x4) {
|
||||
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
|
||||
std::pair<bool, db::properties_id_type> pp = read_element_properties (layout.properties_repository (), false);
|
||||
|
||||
|
|
@ -3506,8 +3491,8 @@ OASISReader::do_read_cell (db::cell_index_type cell_index, db::Layout &layout)
|
|||
}
|
||||
}
|
||||
|
||||
if (m & 0x4) {
|
||||
read_repetition ();
|
||||
if ((m & 0x4) && read_repetition ()) {
|
||||
// later: handle XGEOMETRY with repetition
|
||||
}
|
||||
|
||||
read_element_properties (layout.properties_repository (), true);
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ private:
|
|||
void mark_start_table ();
|
||||
|
||||
void read_offset_table ();
|
||||
void read_repetition ();
|
||||
bool read_repetition ();
|
||||
void read_pointlist (modal_variable <std::vector <db::Point> > &pointlist, bool for_polygon);
|
||||
void read_properties (db::PropertiesRepository &rep);
|
||||
void store_last_properties (db::PropertiesRepository &rep, db::PropertiesRepository::properties_set &properties, bool ignore_special);
|
||||
|
|
|
|||
Loading…
Reference in New Issue