mirror of https://github.com/KLayout/klayout.git
WIP
This commit is contained in:
parent
e766b12c3e
commit
6e4ac71442
|
|
@ -199,51 +199,51 @@ PCellVariant::update (ImportLayerMapping *layer_mapping)
|
|||
|
||||
if (m_parameters[i].is_user<db::DBox> ()) {
|
||||
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::BoxWithProperties(db::Box (m_parameters[i].to_user<db::DBox> () * (1.0 / layout ()->dbu ())), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::BoxWithProperties (db::Box (m_parameters[i].to_user<db::DBox> () * (1.0 / layout ()->dbu ())), layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::Box> ()) {
|
||||
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::BoxWithProperties(m_parameters[i].to_user<db::Box> (), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::BoxWithProperties (m_parameters[i].to_user<db::Box> (), layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::DEdge> ()) {
|
||||
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::EdgeWithProperties(db::Edge (m_parameters[i].to_user<db::DEdge> () * (1.0 / layout ()->dbu ())), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::EdgeWithProperties (db::Edge (m_parameters[i].to_user<db::DEdge> () * (1.0 / layout ()->dbu ())), layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::Edge> ()) {
|
||||
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::EdgeWithProperties(m_parameters[i].to_user<db::Edge> (), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::EdgeWithProperties (m_parameters[i].to_user<db::Edge> (), layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::DPoint> ()) {
|
||||
|
||||
db::DPoint p = m_parameters[i].to_user<db::DPoint> ();
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::BoxWithProperties(db::Box (db::DBox (p, p) * (1.0 / layout ()->dbu ())), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PointWithProperties (db::Point (p * (1.0 / layout ()->dbu ())), layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::Point> ()) {
|
||||
|
||||
db::Point p = m_parameters[i].to_user<db::Point> ();
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::BoxWithProperties(db::Box (p, p), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PointWithProperties (p, layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::DPolygon> ()) {
|
||||
|
||||
db::complex_trans<db::DCoord, db::Coord> dbu_trans (1.0 / layout ()->dbu ());
|
||||
db::Polygon poly = m_parameters[i].to_user<db::DPolygon> ().transformed (dbu_trans, false);
|
||||
// Hint: we don't compress the polygon since we don't want to loose information
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PolygonWithProperties(poly, layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PolygonWithProperties (poly, layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::Polygon> ()) {
|
||||
|
||||
db::Polygon poly = m_parameters[i].to_user<db::Polygon> ();
|
||||
// Hint: we don't compress the polygon since we don't want to loose information
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PolygonWithProperties(poly, layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PolygonWithProperties (poly, layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::DPath> ()) {
|
||||
|
||||
db::complex_trans<db::DCoord, db::Coord> dbu_trans (1.0 / layout ()->dbu ());
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PathWithProperties(dbu_trans * m_parameters[i].to_user<db::DPath> (), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PathWithProperties (dbu_trans * m_parameters[i].to_user<db::DPath> (), layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (m_parameters[i].is_user<db::Path> ()) {
|
||||
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PathWithProperties(m_parameters[i].to_user<db::Path> (), layout ()->properties_repository ().properties_id (props)));
|
||||
shapes (layout ()->guiding_shape_layer ()).insert (db::PathWithProperties (m_parameters[i].to_user<db::Path> (), layout ()->properties_repository ().properties_id (props)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,282 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PointPropertiesPage</class>
|
||||
<widget class="QWidget" name="PointPropertiesPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>531</width>
|
||||
<height>370</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" stdset="0">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame1">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" stdset="0">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Sans Serif</family>
|
||||
<pointsize>12</pointsize>
|
||||
<italic>false</italic>
|
||||
<bold>true</bold>
|
||||
<underline>false</underline>
|
||||
<strikeout>false</strikeout>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Point Properties</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="layer_lbl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Point position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>x = </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="x_le">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>y = </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="y_le">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>478</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="dbu_cb">
|
||||
<property name="text">
|
||||
<string>Coordinates in database units</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="abs_cb">
|
||||
<property name="text">
|
||||
<string>Absolute (accumulated) transformations</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>478</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" stdset="0">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>211</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="prop_pb">
|
||||
<property name="text">
|
||||
<string>User Properties</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="inst_pb">
|
||||
<property name="text">
|
||||
<string>Instantiation</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>dbu_cb</tabstop>
|
||||
<tabstop>abs_cb</tabstop>
|
||||
<tabstop>prop_pb</tabstop>
|
||||
<tabstop>inst_pb</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -92,3 +92,6 @@ LIBS += -L$$DESTDIR -lklayout_tl -lklayout_gsi -lklayout_laybasic -lklayout_layv
|
|||
|
||||
}
|
||||
|
||||
FORMS += \
|
||||
PointPropertiesPage.ui
|
||||
|
||||
|
|
|
|||
|
|
@ -2537,6 +2537,7 @@ public:
|
|||
{
|
||||
mp_polygon_service = view->get_plugin <edt::PolygonService> ();
|
||||
mp_box_service = view->get_plugin <edt::BoxService> ();
|
||||
mp_point_service = view->get_plugin <edt::PointService> ();
|
||||
mp_text_service = view->get_plugin <edt::TextService> ();
|
||||
mp_path_service = view->get_plugin <edt::PathService> ();
|
||||
mp_inst_service = view->get_plugin <edt::InstService> ();
|
||||
|
|
@ -2587,6 +2588,7 @@ public:
|
|||
private:
|
||||
edt::PolygonService *mp_polygon_service;
|
||||
edt::BoxService *mp_box_service;
|
||||
edt::PointService *mp_point_service;
|
||||
edt::TextService *mp_text_service;
|
||||
edt::PathService *mp_path_service;
|
||||
edt::InstService *mp_inst_service;
|
||||
|
|
|
|||
|
|
@ -2795,6 +2795,9 @@ PartialService::partial_select (const db::DBox &box, lay::Editable::SelectionMod
|
|||
if (edt::boxes_enabled ()) {
|
||||
shape_flags |= db::ShapeIterator::Boxes;
|
||||
}
|
||||
if (edt::points_enabled ()) {
|
||||
shape_flags |= db::ShapeIterator::Points;
|
||||
}
|
||||
if (edt::texts_enabled ()) {
|
||||
shape_flags |= db::ShapeIterator::Texts;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,8 +245,12 @@ public:
|
|||
|
||||
virtual bool implements_mouse_mode (std::string &title) const
|
||||
{
|
||||
title = m_mouse_mode;
|
||||
return true;
|
||||
if (! m_mouse_mode.empty ()) {
|
||||
title = m_mouse_mode;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -282,6 +286,11 @@ static tl::RegisteredClass<lay::PluginDeclaration> config_decl4 (
|
|||
"edt::Service(Paths)"
|
||||
);
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl5 (
|
||||
new edt::PluginDeclaration<edt::PointService> (tl::to_string (tr ("Points")), std::string (), 0, &get_shape_editor_options_pages),
|
||||
4014,
|
||||
"edt::Service(Points)"
|
||||
);
|
||||
static tl::RegisteredClass<lay::PluginDeclaration> config_decl6 (
|
||||
new edt::PluginDeclaration<edt::InstService> (tl::to_string (tr ("Instances")), "instance:edit_mode\t" + tl::to_string (tr ("Instance")) + "\t<:instance_24px.png>" + tl::to_string (tr ("{Create a cell instance}")), &get_inst_options, &get_inst_editor_options_pages),
|
||||
4020,
|
||||
"edt::Service(CellInstances)"
|
||||
|
|
@ -302,6 +311,7 @@ bool is_enabled ()
|
|||
bool polygons_enabled () { return is_enabled<edt::PolygonService> (); }
|
||||
bool paths_enabled () { return is_enabled<edt::PathService> (); }
|
||||
bool boxes_enabled () { return is_enabled<edt::BoxService> (); }
|
||||
bool points_enabled () { return is_enabled<edt::PointService> (); }
|
||||
bool texts_enabled () { return is_enabled<edt::TextService> (); }
|
||||
bool instances_enabled () { return is_enabled<edt::InstService> (); }
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ namespace edt
|
|||
// other types ...
|
||||
bool paths_enabled ();
|
||||
bool boxes_enabled ();
|
||||
bool points_enabled ();
|
||||
bool texts_enabled ();
|
||||
bool instances_enabled ();
|
||||
|
||||
|
|
|
|||
|
|
@ -197,6 +197,42 @@ db::Shape BoxDimensionsChangeApplicator::do_apply (db::Shapes &shapes, const db:
|
|||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// PointDimensionsChangeApplicator implementation
|
||||
|
||||
PointDimensionsChangeApplicator::PointDimensionsChangeApplicator (const db::Point &point, const db::Point &org_point)
|
||||
: m_point (point), m_org_point (org_point)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
db::Shape PointDimensionsChangeApplicator::do_apply (db::Shapes &shapes, const db::Shape &shape, double /*dbu*/, bool relative) const
|
||||
{
|
||||
db::Point org_point;
|
||||
shape.point (org_point);
|
||||
|
||||
db::Point new_point;
|
||||
if (relative) {
|
||||
new_point = org_point + (m_point - m_org_point);
|
||||
} else if (m_point != m_org_point) {
|
||||
new_point = org_point;
|
||||
if (m_point.x () != m_org_point.x ()) {
|
||||
new_point.set_x (m_point.x ());
|
||||
}
|
||||
if (m_point.y () != m_org_point.y ()) {
|
||||
new_point.set_y (m_point.y ());
|
||||
}
|
||||
}
|
||||
|
||||
if (new_point != org_point) {
|
||||
// shape changed - replace the old by the new one
|
||||
return shapes.replace (shape, new_point);
|
||||
} else {
|
||||
// shape did not change
|
||||
return shape;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// PolygonChangeApplicator implementation
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,22 @@ private:
|
|||
db::Coord m_l, m_b, m_r, m_t;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A point change applicator
|
||||
*/
|
||||
class PointDimensionsChangeApplicator
|
||||
: public ChangeApplicator
|
||||
{
|
||||
public:
|
||||
PointDimensionsChangeApplicator (const db::Point &point, const db::Point &org_point);
|
||||
|
||||
bool supports_relative_mode () const { return true; }
|
||||
db::Shape do_apply (db::Shapes &shapes, const db::Shape &shape, double dbu, bool relative) const;
|
||||
|
||||
private:
|
||||
db::Point m_point, m_org_point;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief A polygon change applicator
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -853,6 +853,124 @@ BoxPropertiesPage::changed ()
|
|||
emit edited ();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// PointPropertiesPage implementation
|
||||
|
||||
PointPropertiesPage::PointPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent)
|
||||
: ShapePropertiesPage (tl::to_string (tr ("Points")), service, manager, parent),
|
||||
m_dbu (1.0)
|
||||
{
|
||||
setupUi (this);
|
||||
setup ();
|
||||
|
||||
if (! readonly ()) {
|
||||
|
||||
connect (x_le, SIGNAL (editingFinished ()), this, SLOT (changed ()));
|
||||
connect (y_le, SIGNAL (editingFinished ()), this, SLOT (changed ()));
|
||||
|
||||
} else {
|
||||
|
||||
x_le->setReadOnly (true);
|
||||
y_le->setReadOnly (true);
|
||||
|
||||
}
|
||||
|
||||
connect (inst_pb, SIGNAL (clicked ()), this, SLOT (show_inst ()));
|
||||
connect (prop_pb, SIGNAL (clicked ()), this, SLOT (show_props ()));
|
||||
}
|
||||
|
||||
std::string
|
||||
PointPropertiesPage::description (size_t entry) const
|
||||
{
|
||||
const db::Shape &sh = shape (entry);
|
||||
db::CplxTrans dbu_trans (dbu (entry));
|
||||
return ShapePropertiesPage::description (entry) + " - " + tl::sprintf (tl::to_string (tr ("Point%s")), (dbu_trans * sh.point ()).to_string ());
|
||||
}
|
||||
|
||||
void
|
||||
PointPropertiesPage::do_update (const db::Shape &shape, double dbu, const std::string &lname)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
|
||||
layer_lbl->setText (tl::to_qstring (lname));
|
||||
|
||||
db::Point point;
|
||||
shape.point (point);
|
||||
set_point (point);
|
||||
}
|
||||
|
||||
ChangeApplicator *
|
||||
PointPropertiesPage::create_applicator (db::Shapes & /*shapes*/, const db::Shape &shape, double dbu)
|
||||
{
|
||||
m_dbu = dbu;
|
||||
|
||||
db::Point point = get_point ();
|
||||
|
||||
db::Point org_point;
|
||||
shape.point (org_point);
|
||||
|
||||
if (point != org_point) {
|
||||
return new PointDimensionsChangeApplicator (point, org_point);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
db::Point
|
||||
PointPropertiesPage::get_point () const
|
||||
{
|
||||
bool has_error = false;
|
||||
double x = 0.0, y = 0.0;
|
||||
|
||||
try {
|
||||
tl::from_string_ext (tl::to_string (x_le->text ()), x);
|
||||
lay::indicate_error (x_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (x_le, &ex);
|
||||
has_error = true;
|
||||
}
|
||||
|
||||
try {
|
||||
tl::from_string_ext (tl::to_string (y_le->text ()), y);
|
||||
lay::indicate_error (y_le, (tl::Exception *) 0);
|
||||
} catch (tl::Exception &ex) {
|
||||
lay::indicate_error (y_le, &ex);
|
||||
has_error = true;
|
||||
}
|
||||
|
||||
if (has_error) {
|
||||
throw tl::Exception (tl::to_string (tr ("Invalid values - see highlighted entry boxes")));
|
||||
}
|
||||
|
||||
db::VCplxTrans t = db::VCplxTrans (trans ().inverted ());
|
||||
bool du = dbu_units ();
|
||||
|
||||
return point_from_dpoint (db::DPoint (x, y), m_dbu, du, t);
|
||||
}
|
||||
|
||||
void
|
||||
PointPropertiesPage::set_point (const db::Point &point)
|
||||
{
|
||||
db::CplxTrans t = db::CplxTrans (trans ());
|
||||
db::DPoint pt = db::DPoint (t (point));
|
||||
|
||||
bool du = dbu_units ();
|
||||
|
||||
x_le->setText (tl::to_qstring (coord_to_string (pt.x (), m_dbu, du)));
|
||||
y_le->setText (tl::to_qstring (coord_to_string (pt.y (), m_dbu, du)));
|
||||
}
|
||||
|
||||
void
|
||||
PointPropertiesPage::changed ()
|
||||
{
|
||||
try {
|
||||
set_point (get_point ());
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
emit edited ();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// TextPropertiesPage implementation
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "edtService.h"
|
||||
#include "ui_PolygonPropertiesPage.h"
|
||||
#include "ui_BoxPropertiesPage.h"
|
||||
#include "ui_PointPropertiesPage.h"
|
||||
#include "ui_PathPropertiesPage.h"
|
||||
#include "ui_EditablePathPropertiesPage.h"
|
||||
#include "ui_TextPropertiesPage.h"
|
||||
|
|
@ -152,6 +153,34 @@ private:
|
|||
void set_box (const db::Box &box);
|
||||
};
|
||||
|
||||
class PointPropertiesPage
|
||||
: public ShapePropertiesPage,
|
||||
public Ui::PointPropertiesPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PointPropertiesPage (edt::Service *service, db::Manager *manager, QWidget *parent);
|
||||
|
||||
virtual std::string description (size_t entry) const;
|
||||
virtual std::string description () const { return ShapePropertiesPage::description (); }
|
||||
virtual void do_update (const db::Shape &shape, double dbu, const std::string &lname);
|
||||
virtual ChangeApplicator *create_applicator (db::Shapes &shapes, const db::Shape &shape, double dbu);
|
||||
|
||||
public slots:
|
||||
void changed ();
|
||||
|
||||
protected:
|
||||
virtual QCheckBox *dbu_checkbox () const { return dbu_cb; }
|
||||
virtual QCheckBox *abs_checkbox () const { return abs_cb; }
|
||||
|
||||
private:
|
||||
double m_dbu;
|
||||
|
||||
db::Point get_point () const;
|
||||
void set_point (const db::Point &point);
|
||||
};
|
||||
|
||||
class TextPropertiesPage
|
||||
: public ShapePropertiesPage,
|
||||
public Ui::TextPropertiesPage
|
||||
|
|
|
|||
|
|
@ -386,6 +386,20 @@ ShapeEditService::deliver_shape (const db::Box &box)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShapeEditService::deliver_shape (const db::Point &point)
|
||||
{
|
||||
if (m_combine_mode == CM_Add) {
|
||||
if (manager ()) {
|
||||
manager ()->transaction (tl::to_string (tr ("Create point")));
|
||||
}
|
||||
cell ().shapes (layer ()).insert (point);
|
||||
if (manager ()) {
|
||||
manager ()->commit ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// PolygonService implementation
|
||||
|
||||
|
|
@ -816,6 +830,103 @@ BoxService::selection_applies (const lay::ObjectInstPath &sel) const
|
|||
return !sel.is_cell_inst () && sel.shape ().is_box ();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// PointService implementation
|
||||
|
||||
PointService::PointService (db::Manager *manager, lay::LayoutViewBase *view)
|
||||
: ShapeEditService (manager, view, db::ShapeIterator::Points)
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
std::vector<lay::PropertiesPage *>
|
||||
PointService::properties_pages (db::Manager *manager, QWidget *parent)
|
||||
{
|
||||
std::vector<lay::PropertiesPage *> pages;
|
||||
pages.push_back (new edt::PointPropertiesPage (this, manager, parent));
|
||||
return pages;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
PointService::do_begin_edit (const db::DPoint &p)
|
||||
{
|
||||
get_edit_layer ();
|
||||
|
||||
db::DPoint pp = snap2 (p);
|
||||
m_p = pp;
|
||||
|
||||
set_edit_marker (new lay::Marker (view (), cv_index ()));
|
||||
update_marker ();
|
||||
}
|
||||
|
||||
db::Point
|
||||
PointService::get_point () const
|
||||
{
|
||||
return db::Point (trans () * m_p);
|
||||
}
|
||||
|
||||
void
|
||||
PointService::update_marker ()
|
||||
{
|
||||
lay::Marker *marker = dynamic_cast<lay::Marker *> (edit_marker ());
|
||||
if (marker) {
|
||||
|
||||
db::Point pt = get_point ();
|
||||
marker->set (db::Box (pt, pt), db::VCplxTrans (1.0 / layout ().dbu ()) * trans ().inverted ());
|
||||
|
||||
view ()->message (std::string ("x: ") +
|
||||
tl::micron_to_string (m_p.x ()) +
|
||||
std::string (" y: ") +
|
||||
tl::micron_to_string (m_p.y ()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PointService::do_mouse_move_inactive (const db::DPoint &p)
|
||||
{
|
||||
lay::PointSnapToObjectResult snap_details = snap2_details (p);
|
||||
mouse_cursor_from_snap_details (snap_details);
|
||||
}
|
||||
|
||||
void
|
||||
PointService::do_mouse_move (const db::DPoint &p)
|
||||
{
|
||||
do_mouse_move_inactive (p);
|
||||
|
||||
set_cursor (lay::Cursor::cross);
|
||||
m_p = snap2 (p);
|
||||
update_marker ();
|
||||
}
|
||||
|
||||
bool
|
||||
PointService::do_mouse_click (const db::DPoint &p)
|
||||
{
|
||||
do_mouse_move (p);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PointService::do_finish_edit ()
|
||||
{
|
||||
deliver_shape (get_point ());
|
||||
commit_recent (view ());
|
||||
}
|
||||
|
||||
void
|
||||
PointService::do_cancel_edit ()
|
||||
{
|
||||
// .. nothing yet ..
|
||||
}
|
||||
|
||||
bool
|
||||
PointService::selection_applies (const lay::ObjectInstPath &sel) const
|
||||
{
|
||||
return !sel.is_cell_inst () && sel.shape ().is_point ();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// TextService implementation
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ protected:
|
|||
void deliver_shape (const db::Polygon &poly);
|
||||
void deliver_shape (const db::Path &path);
|
||||
void deliver_shape (const db::Box &box);
|
||||
void deliver_shape (const db::Point &point);
|
||||
virtual void current_layer_changed () { }
|
||||
|
||||
private:
|
||||
|
|
@ -140,6 +141,33 @@ private:
|
|||
db::Box get_box () const;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Implementation of edt::Service for point editing
|
||||
*/
|
||||
class PointService
|
||||
: public ShapeEditService
|
||||
{
|
||||
public:
|
||||
PointService (db::Manager *manager, lay::LayoutViewBase *view);
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
virtual std::vector<lay::PropertiesPage *> properties_pages (db::Manager *manager, QWidget *parent);
|
||||
#endif
|
||||
virtual void do_begin_edit (const db::DPoint &p);
|
||||
virtual void do_mouse_move (const db::DPoint &p);
|
||||
virtual void do_mouse_move_inactive (const db::DPoint &p);
|
||||
virtual bool do_mouse_click (const db::DPoint &p);
|
||||
virtual void do_finish_edit ();
|
||||
virtual void do_cancel_edit ();
|
||||
virtual bool selection_applies (const lay::ObjectInstPath &sel) const;
|
||||
|
||||
private:
|
||||
db::DPoint m_p;
|
||||
|
||||
void update_marker ();
|
||||
db::Point get_point () const;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Implementation of edt::Service for text editing
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -260,19 +260,19 @@ get_parameters_from_pcell_and_guiding_shapes (db::Layout *layout, db::cell_index
|
|||
std::map <std::string, size_t>::const_iterator pnm = pname_map.find (pv->second.to_string ());
|
||||
if (pnm != pname_map.end ()) {
|
||||
|
||||
db::CplxTrans dbu_trans (layout->dbu ());
|
||||
|
||||
if (sh->is_box ()) {
|
||||
if (sh->box ().width () == 0 && sh->box ().height () == 0) {
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (sh->box ().lower_left () * layout->dbu ());
|
||||
} else {
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (sh->box () * layout->dbu ());
|
||||
}
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (dbu_trans * sh->box ());
|
||||
} else if (sh->is_edge ()) {
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (sh->edge () * layout->dbu ());
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (dbu_trans * sh->edge ());
|
||||
} else if (sh->is_point ()) {
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (dbu_trans * sh->point ());
|
||||
} else if (sh->is_polygon ()) {
|
||||
// Hint: we don't compress since we don't want to loose information
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (sh->polygon ().transformed (db::CplxTrans (layout->dbu ()), false));
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (sh->polygon ().transformed (dbu_trans, false));
|
||||
} else if (sh->is_path ()) {
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (db::CplxTrans (layout->dbu ()) * sh->path ());
|
||||
parameters_for_pcell [pnm->second] = tl::Variant (dbu_trans * sh->path ());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -315,7 +315,7 @@ get_parameters_from_pcell_and_guiding_shapes (db::Layout *layout, db::cell_index
|
|||
} else if (org_parameters[i].is_user<db::DPoint> ()) {
|
||||
|
||||
db::DPoint p = org_parameters[i].to_user<db::DPoint> ();
|
||||
guiding_shapes.insert (db::BoxWithProperties(db::Box (db::DBox (p, p) * (1.0 / layout->dbu ())), layout->properties_repository ().properties_id (props)));
|
||||
guiding_shapes.insert (db::PointWithProperties(db::Point (p * (1.0 / layout->dbu ())), layout->properties_repository ().properties_id (props)));
|
||||
|
||||
} else if (org_parameters[i].is_user<db::DPolygon> ()) {
|
||||
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ BitmapRenderer::draw (const db::Shape &shape, const db::CplxTrans &trans,
|
|||
db::Box bbox = shape.bbox ();
|
||||
double threshold = 1.0 / trans.mag ();
|
||||
|
||||
if (bbox.width () <= threshold && bbox.height () <= threshold) {
|
||||
if (bbox.width () <= threshold && bbox.height () <= threshold && !shape.is_point ()) {
|
||||
|
||||
db::DPoint dc = trans * bbox.center ();
|
||||
if (fill && ! shape.is_edge ()) {
|
||||
|
|
@ -440,7 +440,7 @@ BitmapRenderer::draw (const db::Shape &shape, const db::CplxTrans &trans,
|
|||
render_dot (dc.x (), dc.y (), vertices);
|
||||
}
|
||||
|
||||
} else if (shape.is_box ()) {
|
||||
} else if (shape.is_box () || shape.is_point ()) {
|
||||
|
||||
draw (bbox, trans, fill, frame, vertices, text);
|
||||
|
||||
|
|
|
|||
|
|
@ -1059,7 +1059,7 @@ RedrawThreadWorker::any_shapes (db::cell_index_type cell_index, unsigned int lev
|
|||
int ret = false;
|
||||
|
||||
const db::Cell &cell = mp_layout->cell (cell_index);
|
||||
if (! cell.shapes (m_layer).begin (db::ShapeIterator::Polygons | db::ShapeIterator::Edges | db::ShapeIterator::Paths | db::ShapeIterator::Boxes, mp_prop_sel, m_inv_prop_sel).at_end ()) {
|
||||
if (! cell.shapes (m_layer).begin (db::ShapeIterator::Polygons | db::ShapeIterator::Edges | db::ShapeIterator::Paths | db::ShapeIterator::Boxes | db::ShapeIterator::Points, mp_prop_sel, m_inv_prop_sel).at_end ()) {
|
||||
ret = true;
|
||||
} else if (levels > 1) {
|
||||
for (db::Cell::child_cell_iterator cc = cell.begin_child_cells (); !cc.at_end () && !ret; ++cc) {
|
||||
|
|
@ -1624,7 +1624,7 @@ RedrawThreadWorker::draw_layer_wo_cache (int from_level, int to_level, db::cell_
|
|||
size_t current_quad_id = 0;
|
||||
size_t current_array_quad_id = 0;
|
||||
|
||||
db::ShapeIterator shape (shapes.begin_touching (*v, db::ShapeIterator::Boxes | db::ShapeIterator::Polygons | db::ShapeIterator::Edges | db::ShapeIterator::Paths, mp_prop_sel, m_inv_prop_sel));
|
||||
db::ShapeIterator shape (shapes.begin_touching (*v, db::ShapeIterator::Boxes | db::ShapeIterator::Polygons | db::ShapeIterator::Edges | db::ShapeIterator::Paths | db::ShapeIterator::Points, mp_prop_sel, m_inv_prop_sel));
|
||||
while (! shape.at_end ()) {
|
||||
|
||||
test_snapshot (update_snapshot);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ Renderer::draw_propstring (const db::Shape &shape, const db::PropertiesRepositor
|
|||
dp = trans * (db::Point () + shape.text_trans ().disp ());
|
||||
} else if (shape.is_box ()) {
|
||||
dp = trans (shape.box ().p1 ());
|
||||
} else if (shape.is_point ()) {
|
||||
dp = trans (shape.point ());
|
||||
} else if (shape.is_polygon ()) {
|
||||
db::Shape::polygon_edge_iterator e = shape.begin_edge ();
|
||||
dp = trans ((*e).p1 ());
|
||||
|
|
|
|||
Loading…
Reference in New Issue