michaelcache / gds_viewer Goto Github PK
View Code? Open in Web Editor NEWa simple gui viewer to show gdsii geomtery, based on qt, and gdstk
a simple gui viewer to show gdsii geomtery, based on qt, and gdstk
(1)我打开了一个1.gds文件,下图是用Klayou打开时正确的样式:
(2)我用 gds_viewer打开该1.gds文件,效果如下:会把没有计算偏移量的模块也多画出来
(3)我模仿您的 gds_viewer 自己创立了一个新的qt工程项目,按您的方法展示时是同样结果,不知道怎么解决。我展示的代码逻辑与您一样。但我研究了一段时间没能解决这个问题,所以请教您看能不能帮忙解决。十分感谢!(附件是我的1.gds文件)
1.gds.zip
我的展示代码如下:
` // 读取GDS文件
Library lib = gdstk::read_gds(filePath.toLocal8Bit().data(), 0, 1e-2, NULL, &error_code);
for (size_t i = 0; i < lib.cell_array.count; i++) {
Cell* cell = lib.cell_array[i];
gdstk::Array<gdstk::Polygon*> polygons = {0};
// 获取所有的多边形
cell->get_polygons(true, true, -1, false, 0, polygons);
for (size_t j = 0; j < polygons.count ; j++)
{
gdstk::Polygon* currentPolygon = polygons[j];
// get layer
uint32_t layer = gdstk::get_layer(currentPolygon->tag);
Vector2dVector p;
for (size_t i = 0; i < currentPolygon->point_array.count; i++)
{
p.push_back(
(Vector2d(currentPolygon->point_array[i].x, currentPolygon->point_array[i].y)));
}
// instance EDAGraphicsPologyItem
EDAGraphicsPolygonItem *polygonItem = new EDAGraphicsPolygonItem(layer);
polygonItem->setZValue(layer);
// 将图形项polygonItem的数据关联到GDS_LAYER_TAG键上,键值为layer。这样可以在需要的时候通过GDS_LAYER_TAG键来获取或修改该图形项的数据
polygonItem->setData(GDS_LAYER_TAG, layer);
// 层列表添加数据
layerData.insert(layer);
QPolygonF polygon;
// 输入点坐标遍历
for (size_t i = 0; i < p.size(); i++)
{
polygon << QPointF(p[i].GetX() * 100, p[i].GetY() * 100);
}
polygonItem->setPolygon(polygon);
// 多边形列表添加图元
polygonItemList.append(polygonItem);
}
polygons.clear();
}`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.