mirror of https://github.com/KLayout/klayout.git
WIP: Introducing names
This commit is contained in:
parent
33cd9fe687
commit
dda18e6f53
|
|
@ -260,7 +260,7 @@ module D25
|
||||||
|
|
||||||
displays.each do |k,zz|
|
displays.each do |k,zz|
|
||||||
display = zz[0].display
|
display = zz[0].display
|
||||||
view.open_display(display.frame, display.fill, display.like)
|
view.open_display(display.frame, display.fill, display.like, display.name)
|
||||||
zz.each do |z|
|
zz.each do |z|
|
||||||
view.entry(z.layer.data, self.dbu, z.zstart, z.zstop)
|
view.entry(z.layer.data, self.dbu, z.zstart, z.zstop)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ Class<lay::D25View> decl_D25View (QT_EXTERNAL_BASE (QDialog) "lay", "D25View",
|
||||||
gsi::method ("begin", &lay::D25View::begin, gsi::arg ("generator"),
|
gsi::method ("begin", &lay::D25View::begin, gsi::arg ("generator"),
|
||||||
"@brief Initiates delivery of display groups"
|
"@brief Initiates delivery of display groups"
|
||||||
) +
|
) +
|
||||||
gsi::method ("open_display", &lay::D25View::open_display, gsi::arg ("frame_color"), gsi::arg ("fill_color"), gsi::arg ("like"),
|
gsi::method ("open_display", &lay::D25View::open_display, gsi::arg ("frame_color"), gsi::arg ("fill_color"), gsi::arg ("like"), gsi::arg ("name"),
|
||||||
"@brief Creates a new display group"
|
"@brief Creates a new display group"
|
||||||
) +
|
) +
|
||||||
gsi::method ("entry", &lay::D25View::entry, gsi::arg ("data"), gsi::arg ("dbu"), gsi::arg ("zstart"), gsi::arg ("zstop"),
|
gsi::method ("entry", &lay::D25View::entry, gsi::arg ("data"), gsi::arg ("dbu"), gsi::arg ("zstart"), gsi::arg ("zstop"),
|
||||||
|
|
|
||||||
|
|
@ -173,10 +173,10 @@ D25View::begin (const std::string &generator)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
D25View::open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like)
|
D25View::open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name)
|
||||||
{
|
{
|
||||||
if (! mp_ui->d25_view->has_error ()) {
|
if (! mp_ui->d25_view->has_error ()) {
|
||||||
mp_ui->d25_view->open_display (frame_color, fill_color, like);
|
mp_ui->d25_view->open_display (frame_color, fill_color, like, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public:
|
||||||
void close ();
|
void close ();
|
||||||
void clear ();
|
void clear ();
|
||||||
void begin (const std::string &generator);
|
void begin (const std::string &generator);
|
||||||
void open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like);
|
void open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name);
|
||||||
void close_display ();
|
void close_display ();
|
||||||
void entry (const db::Region &data, double dbu, double zstart, double zstop);
|
void entry (const db::Region &data, double dbu, double zstart, double zstop);
|
||||||
void finish ();
|
void finish ();
|
||||||
|
|
|
||||||
|
|
@ -555,7 +555,7 @@ static void lp_to_info (const lay::LayerPropertiesNode &lp, D25ViewWidget::Layer
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
D25ViewWidget::open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like)
|
D25ViewWidget::open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name)
|
||||||
{
|
{
|
||||||
m_vertex_chunks.push_back (triangle_chunks_type ());
|
m_vertex_chunks.push_back (triangle_chunks_type ());
|
||||||
m_line_chunks.push_back (line_chunks_type ());
|
m_line_chunks.push_back (line_chunks_type ());
|
||||||
|
|
@ -565,6 +565,14 @@ D25ViewWidget::open_display (const color_t *frame_color, const color_t *fill_col
|
||||||
info.visible = true;
|
info.visible = true;
|
||||||
color_to_gl (frame_color, info.frame_color);
|
color_to_gl (frame_color, info.frame_color);
|
||||||
color_to_gl (fill_color, info.fill_color);
|
color_to_gl (fill_color, info.fill_color);
|
||||||
|
|
||||||
|
info.has_name = (name != 0 || like != 0);
|
||||||
|
if (name) {
|
||||||
|
info.name = *name;
|
||||||
|
} else if (like) {
|
||||||
|
info.name = like->to_string ();
|
||||||
|
}
|
||||||
|
|
||||||
info.vertex_chunk = &m_vertex_chunks.back ();
|
info.vertex_chunk = &m_vertex_chunks.back ();
|
||||||
info.line_chunk = &m_line_chunks.back ();
|
info.line_chunk = &m_line_chunks.back ();
|
||||||
|
|
||||||
|
|
@ -601,9 +609,11 @@ D25ViewWidget::entry (const db::Region &data, double dbu, double zstart, double
|
||||||
m_zmax = std::min (m_zmax, std::max (zstart, zstop));
|
m_zmax = std::min (m_zmax, std::max (zstart, zstop));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LayerInfo &info = m_layers.back ();
|
||||||
|
|
||||||
// try to establish a default color from the region's origin if required
|
// try to establish a default color from the region's origin if required
|
||||||
const db::OriginalLayerRegion *original_region = dynamic_cast<db::OriginalLayerRegion *> (data.delegate ());
|
const db::OriginalLayerRegion *original_region = dynamic_cast<db::OriginalLayerRegion *> (data.delegate ());
|
||||||
if (mp_view && m_layers.back ().fill_color [3] == 0.0 && m_layers.back ().frame_color [3] == 0.0) {
|
if (mp_view && info.fill_color [3] == 0.0 && info.frame_color [3] == 0.0) {
|
||||||
|
|
||||||
if (original_region) {
|
if (original_region) {
|
||||||
|
|
||||||
|
|
@ -614,7 +624,11 @@ D25ViewWidget::entry (const db::Region &data, double dbu, double zstart, double
|
||||||
|
|
||||||
for (lay::LayerPropertiesConstIterator lp = mp_view->begin_layers (); ! lp.at_end (); ++lp) {
|
for (lay::LayerPropertiesConstIterator lp = mp_view->begin_layers (); ! lp.at_end (); ++lp) {
|
||||||
if (! lp->has_children () && lp->source (true).layer_props ().log_equal (like)) {
|
if (! lp->has_children () && lp->source (true).layer_props ().log_equal (like)) {
|
||||||
lp_to_info (*lp, m_layers.back ());
|
lp_to_info (*lp, info);
|
||||||
|
if (! info.has_name) {
|
||||||
|
info.name = like.to_string ();
|
||||||
|
info.has_name = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -625,7 +639,7 @@ D25ViewWidget::entry (const db::Region &data, double dbu, double zstart, double
|
||||||
|
|
||||||
// sequential assignment
|
// sequential assignment
|
||||||
lay::color_t color = mp_view->get_palette ().luminous_color_by_index (m_layers.size ());
|
lay::color_t color = mp_view->get_palette ().luminous_color_by_index (m_layers.size ());
|
||||||
color_to_gl (color, m_layers.back ().fill_color);
|
color_to_gl (color, info.fill_color);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -638,7 +652,7 @@ D25ViewWidget::entry (const db::Region &data, double dbu, double zstart, double
|
||||||
void
|
void
|
||||||
D25ViewWidget::finish ()
|
D25ViewWidget::finish ()
|
||||||
{
|
{
|
||||||
// @@@
|
// .. nothing yet ..
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,8 @@ public:
|
||||||
GLfloat fill_color [4];
|
GLfloat fill_color [4];
|
||||||
GLfloat frame_color [4];
|
GLfloat frame_color [4];
|
||||||
bool visible;
|
bool visible;
|
||||||
|
std::string name;
|
||||||
|
bool has_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
D25ViewWidget (QWidget *parent);
|
D25ViewWidget (QWidget *parent);
|
||||||
|
|
@ -148,7 +150,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear ();
|
void clear ();
|
||||||
void open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like);
|
void open_display (const color_t *frame_color, const color_t *fill_color, const db::LayerProperties *like, const std::string *name);
|
||||||
void close_display ();
|
void close_display ();
|
||||||
void entry (const db::Region &data, double dbu, double zstart, double zstop);
|
void entry (const db::Region &data, double dbu, double zstart, double zstop);
|
||||||
void finish ();
|
void finish ();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue