OpenUpdateSession() -> UpdateSession::open()
remove hurricane editor (QGraphicsView framework)
This commit is contained in:
parent
6fd1529cff
commit
b774770407
|
@ -53,22 +53,6 @@ IF(UNIX)
|
|||
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
|
||||
)
|
||||
|
||||
FIND_PATH(HURRICANE_EDITOR_INCLUDE_PATH
|
||||
NAMES CellEditor.h
|
||||
PATHS ${HURRICANE_DIR_SEARCH}
|
||||
PATH_SUFFIXES include/hurricane
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
|
||||
)
|
||||
|
||||
FIND_LIBRARY(HURRICANE_EDITOR_LIBRARY_PATH
|
||||
NAMES hurricaneeditor
|
||||
PATHS ${HURRICANE_DIR_SEARCH}
|
||||
PATH_SUFFIXES lib
|
||||
# Help the user find it if we cannot.
|
||||
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
|
||||
)
|
||||
|
||||
# Assume we didn't find it.
|
||||
SET(HURRICANE_FOUND 0)
|
||||
SET(HURRICANE_GRAPHICAL_FOUND 0)
|
||||
|
@ -87,19 +71,13 @@ IF(UNIX)
|
|||
|
||||
IF(HURRICANE_VIEWER_INCLUDE_PATH)
|
||||
IF(HURRICANE_VIEWER_LIBRARY_PATH)
|
||||
IF(HURRICANE_EDITOR_INCLUDE_PATH)
|
||||
IF(HURRICANE_EDITOR_LIBRARY_PATH)
|
||||
SET(HURRICANE_GRAPHICAL_FOUND "YES")
|
||||
SET(HURRICANE_GRAPHICAL_INCLUDE_DIR
|
||||
${HURRICANE_VIEWER_INCLUDE_PATH}
|
||||
${HURRICANE_EDITOR_INCLUDE_PATH}
|
||||
)
|
||||
SET(HURRICANE_GRAPHICAL_LIBRARIES
|
||||
${HURRICANE_VIEWER_LIBRARY_PATH}
|
||||
${HURRICANE_EDITOR_LIBRARY_PATH}
|
||||
)
|
||||
ENDIF(HURRICANE_EDITOR_LIBRARY_PATH)
|
||||
ENDIF(HURRICANE_EDITOR_INCLUDE_PATH)
|
||||
ENDIF(HURRICANE_VIEWER_LIBRARY_PATH)
|
||||
ENDIF(HURRICANE_VIEWER_INCLUDE_PATH)
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
ADD_SUBDIRECTORY(hurricane)
|
||||
ADD_SUBDIRECTORY(viewer)
|
||||
ADD_SUBDIRECTORY(editor)
|
||||
ADD_SUBDIRECTORY(pyext)
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
include(${QT_USE_FILE})
|
||||
|
||||
include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane)
|
||||
|
||||
set(includes CellEditor.h CellScene.h)
|
||||
set(exports CellEditor.h)
|
||||
set(cpps CellGraphicsItem.cpp InstanceGraphicsItem.cpp SegmentFigure.cpp
|
||||
CellScene.cpp CellEditor.cpp)
|
||||
|
||||
QT4_WRAP_CPP(MOC_SRCS ${includes})
|
||||
|
||||
add_library(hurricaneeditor SHARED ${cpps} ${MOC_SRCS})
|
||||
target_link_libraries(hurricaneeditor ${QT_LIBRARIES} hurricane)
|
||||
|
||||
install(FILES ${exports} DESTINATION /include/hurricane)
|
||||
install(TARGETS hurricaneeditor DESTINATION /lib)
|
|
@ -1,103 +0,0 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include "Utils.h"
|
||||
#include "CellScene.h"
|
||||
|
||||
#include "CellEditor.h"
|
||||
|
||||
CellEditor::CellEditor(Cell* c)
|
||||
: QMainWindow(),
|
||||
cell(c)
|
||||
{
|
||||
|
||||
createActions();
|
||||
createMenus();
|
||||
|
||||
scene = new CellScene(cell);
|
||||
view = new QGraphicsView(scene);
|
||||
|
||||
setCentralWidget(view);
|
||||
|
||||
setWindowTitle(tr("Cell Editor"));
|
||||
resize(1000, 500);
|
||||
fitToWindow();
|
||||
}
|
||||
|
||||
CellEditor::~CellEditor() {
|
||||
delete view;
|
||||
delete scene;
|
||||
}
|
||||
|
||||
//void CellEditor::keyPressEvent(QKeyEvent *event) {
|
||||
// switch (event->key()) {
|
||||
// case Qt::Key_Plus:
|
||||
// zoom(ZoomInFactor);
|
||||
// break;
|
||||
// case Qt::Key_Minus:
|
||||
// zoom(ZoomOutFactor);
|
||||
// break;
|
||||
// case Qt::Key_Left:
|
||||
// scroll(-ScrollStep, 0);
|
||||
// break;
|
||||
// case Qt::Key_Right:
|
||||
// scroll(+ScrollStep, 0);
|
||||
// break;
|
||||
// case Qt::Key_Down:
|
||||
// scroll(0, -ScrollStep);
|
||||
// break;
|
||||
// case Qt::Key_Up:
|
||||
// scroll(0, +ScrollStep);
|
||||
// break;
|
||||
// default:
|
||||
// QWidget::keyPressEvent(event);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void CellEditor::wheelEvent(QWheelEvent *event) {
|
||||
// int numDegrees = event->delta() / 8;
|
||||
// double numSteps = numDegrees / 15.0f;
|
||||
// zoom(pow(ZoomInFactor, numSteps));
|
||||
//}
|
||||
|
||||
void CellEditor::zoomIn() {
|
||||
view->scale(1.2, 1.2);
|
||||
}
|
||||
|
||||
void CellEditor::zoomOut() {
|
||||
view->scale(0.8, 0.8);
|
||||
}
|
||||
|
||||
void CellEditor::fitToWindow() {
|
||||
if (cell) {
|
||||
Box area(cell->getBoundingBox());
|
||||
QRectF rect;
|
||||
boxToRectangle(area, rect);
|
||||
view->fitInView(rect);
|
||||
}
|
||||
}
|
||||
|
||||
void CellEditor::createActions() {
|
||||
zoomInAct = new QAction(tr("Zoom &In (25%)"), this);
|
||||
zoomInAct->setShortcut(tr("Ctrl++"));
|
||||
zoomInAct->setEnabled(true);
|
||||
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
|
||||
|
||||
zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this);
|
||||
zoomOutAct->setShortcut(tr("Ctrl+-"));
|
||||
zoomOutAct->setEnabled(true);
|
||||
connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut()));
|
||||
|
||||
fitToWindowAct = new QAction(tr("Fit &To &Window"), this);
|
||||
fitToWindowAct->setShortcut(tr("f"));
|
||||
fitToWindowAct->setEnabled(true);
|
||||
connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow()));
|
||||
}
|
||||
|
||||
void CellEditor::createMenus() {
|
||||
viewMenu = new QMenu(tr("&View"), this);
|
||||
viewMenu->addAction(zoomInAct);
|
||||
viewMenu->addAction(zoomOutAct);
|
||||
viewMenu->addAction(fitToWindowAct);
|
||||
|
||||
menuBar()->addMenu(viewMenu);
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
#ifndef __CELL_EDITOR_H
|
||||
#define __CELL_EDITOR_H
|
||||
|
||||
#include "Cell.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
class QGraphicsView;
|
||||
class CellScene;
|
||||
|
||||
class CellEditor : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CellEditor(Cell* cell);
|
||||
~CellEditor();
|
||||
private:
|
||||
Cell* cell;
|
||||
CellScene *scene;
|
||||
QGraphicsView *view;
|
||||
|
||||
QAction *zoomInAct;
|
||||
QAction *zoomOutAct;
|
||||
QAction *fitToWindowAct;
|
||||
QMenu *viewMenu;
|
||||
|
||||
void createActions();
|
||||
void createMenus();
|
||||
|
||||
private slots:
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void fitToWindow();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,80 +0,0 @@
|
|||
#include <math.h>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "Slice.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
#include "Utils.h"
|
||||
#include "InstanceGraphicsItem.h"
|
||||
#include "SegmentFigure.h"
|
||||
#include "CellGraphicsItem.h"
|
||||
|
||||
CellGraphicsItem::CellGraphicsItem(Cell* c):
|
||||
QGraphicsItem(),
|
||||
cell(c) {
|
||||
//QTransform transform;
|
||||
//transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
//setTransform(transform);
|
||||
//for_each_instance(instance, cell->getInstances()) {
|
||||
// new InstanceGraphicsItem(this, instance);
|
||||
// end_for;
|
||||
//}
|
||||
|
||||
unsigned zValue = 10;
|
||||
for_each_slice(slice, cell->getSlices()) {
|
||||
for_each_go(go, slice->getGos()) {
|
||||
Segment* segment = dynamic_cast<Segment*>(go);
|
||||
if (segment) {
|
||||
SegmentGraphicsItem* segmentItem = new SegmentGraphicsItem(this, segment);
|
||||
segmentItem->setZValue(zValue);
|
||||
}
|
||||
end_for;
|
||||
}
|
||||
zValue += 10;
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
|
||||
CellGraphicsItem::CellGraphicsItem(InstanceGraphicsItem* master, Cell* c) : QGraphicsItem(master), cell(c) {
|
||||
//for_each_instance(instance, cell->getInstances()) {
|
||||
// new InstanceGraphicsItem(this, instance);
|
||||
// end_for;
|
||||
//}
|
||||
//for_each_slice(slice, cell->getSlices()) {
|
||||
// new SliceFigure(this, slice);
|
||||
// end_for;
|
||||
//}
|
||||
}
|
||||
|
||||
QRectF CellGraphicsItem::boundingRect() const {
|
||||
Box box = cell->getBoundingBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
//rect = transform().mapRect(rect);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void CellGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem* option, QWidget *) {
|
||||
painter->setClipRect(option->exposedRect);
|
||||
drawBoundary(painter);
|
||||
//drawPhantom(painter);
|
||||
}
|
||||
|
||||
void CellGraphicsItem::drawBoundary(QPainter* painter) {
|
||||
QPen pen(Qt::black);
|
||||
painter->setPen(pen);
|
||||
Box box = cell->getAbutmentBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
||||
|
||||
void CellGraphicsItem::drawPhantom(QPainter* painter) {
|
||||
painter->setBrush(Qt::red);
|
||||
Box box = cell->getAbutmentBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
#ifndef __CELL_GRAPHICS_ITEM_H
|
||||
#define __CELL_GRAPHICS_ITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
||||
#include "Cell.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class InstanceGraphicsItem;
|
||||
|
||||
class CellGraphicsItem : public QGraphicsItem {
|
||||
public:
|
||||
CellGraphicsItem(Cell* cell);
|
||||
CellGraphicsItem(InstanceGraphicsItem* master, Cell* cell);
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
private:
|
||||
Cell* cell;
|
||||
void drawBoundary(QPainter* painter);
|
||||
void drawPhantom(QPainter* painter);
|
||||
};
|
||||
|
||||
#endif /* __CELL_GRAPHICS_ITEM_H */
|
|
@ -1,11 +0,0 @@
|
|||
#include "CellGraphicsItem.h"
|
||||
|
||||
#include "CellScene.h"
|
||||
|
||||
CellScene::CellScene(Cell* c)
|
||||
: QGraphicsScene()
|
||||
, cell(c)
|
||||
{
|
||||
CellGraphicsItem* cellItem = new CellGraphicsItem(cell);
|
||||
addItem(cellItem);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef __CELL_SCENE_H
|
||||
#define __CELL_SCENE_H
|
||||
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include "Cell.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class CellScene : public QGraphicsScene {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CellScene(Cell* cell);
|
||||
private:
|
||||
Cell* cell;
|
||||
};
|
||||
|
||||
#endif /* __CELL_SCENE_H */
|
|
@ -1,19 +0,0 @@
|
|||
#include <math.h>
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "SliceFigure.h"
|
||||
|
||||
#include "Utils.h"
|
||||
#include "GoFigure.h"
|
||||
|
||||
GoFigure::GoFigure(SliceFigure* master):
|
||||
QGraphicsItem(master)
|
||||
{}
|
||||
|
||||
QRectF GoFigure::boundingRect() const {
|
||||
Box box = getGo()->GetBoundingBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
return rect;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef __GO_FIGURE_H
|
||||
#define __GO_FIGURE_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
||||
#include "Go.h"
|
||||
using namespace H;
|
||||
|
||||
class SliceFigure;
|
||||
|
||||
class GoFigure : public QGraphicsItem {
|
||||
public:
|
||||
GoFigure(SliceFigure* parent);
|
||||
QRectF boundingRect() const;
|
||||
protected:
|
||||
virtual Go* getGo() const = 0;
|
||||
};
|
||||
|
||||
#endif /* __GO_FIGURE_H */
|
|
@ -1,112 +0,0 @@
|
|||
#include <QPainter>
|
||||
#include <QTransform>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "Cell.h"
|
||||
#include "Slice.h"
|
||||
#include "Segment.h"
|
||||
#include "BasicLayer.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
#include "Utils.h"
|
||||
#include "InstanceGraphicsItem.h"
|
||||
|
||||
//InstanceGraphicsItem::InstanceGraphicsItem(Instance* inst)
|
||||
// : instance(inst),
|
||||
// cell(instance->getMasterCell())
|
||||
//{
|
||||
// Transformation transformation = instance->getTransformation();
|
||||
// QTransform transform;
|
||||
// QPoint pos;
|
||||
// HurricanePositionToQtPosition(transformation, transform, pos);
|
||||
// setTransform(transform);
|
||||
// setPos(pos);
|
||||
// constructSubInstances();
|
||||
//}
|
||||
|
||||
InstanceGraphicsItem::InstanceGraphicsItem(Cell* c)
|
||||
: instance(NULL),
|
||||
cell(c)
|
||||
{
|
||||
constructSubInstances();
|
||||
}
|
||||
|
||||
//InstanceGraphicsItem::InstanceGraphicsItem(InstanceGraphicsItem* parent, Instance* inst)
|
||||
// : QGraphicsItem(parent),
|
||||
// instance(inst),
|
||||
// cell(instance->getMasterCell())
|
||||
//{
|
||||
// Transformation transformation = instance->getTransformation();
|
||||
// QTransform transform;
|
||||
// QPoint pos;
|
||||
// HurricanePositionToQtPosition(transformation, transform, pos);
|
||||
// setTransform(transform);
|
||||
// setPos(pos);
|
||||
// constructSubInstances();
|
||||
//}
|
||||
|
||||
void InstanceGraphicsItem::constructSubInstances() {
|
||||
for_each_instance(instance, cell->getInstances()) {
|
||||
//new InstanceGraphicsItem(this, instance);
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
|
||||
QRectF InstanceGraphicsItem::boundingRect() const {
|
||||
Box box = cell->getAbutmentBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void InstanceGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
|
||||
painter->setClipRect(option->exposedRect.adjusted(-1.0, -1.0, 1.0, 1.0));
|
||||
if (option->levelOfDetail > 1.0) {
|
||||
drawBoundary(painter);
|
||||
drawElements(painter);
|
||||
} else {
|
||||
drawPhantom(painter);
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceGraphicsItem::drawElements(QPainter* painter) {
|
||||
for_each_slice(slice, cell->getSlices()) {
|
||||
painter->save();
|
||||
BasicLayer* layer = dynamic_cast<BasicLayer*>(slice->getLayer());
|
||||
if (layer) {
|
||||
painter->setBrush(QColor(layer->getRedValue(), layer->getGreenValue(), layer->getBlueValue()));
|
||||
} else {
|
||||
painter->setBrush(Qt::blue);
|
||||
}
|
||||
for_each_go(go, slice->getGos()) {
|
||||
Segment* segment = dynamic_cast<Segment*>(go);
|
||||
if (segment) {
|
||||
Box box = segment->getBoundingBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
|
||||
}
|
||||
end_for;
|
||||
}
|
||||
painter->restore();
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceGraphicsItem::drawBoundary(QPainter* painter) {
|
||||
QPen pen(Qt::black);
|
||||
painter->setPen(pen);
|
||||
Box box = cell->getAbutmentBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
||||
|
||||
void InstanceGraphicsItem::drawPhantom(QPainter* painter) {
|
||||
painter->setBrush(Qt::red);
|
||||
Box box = cell->getAbutmentBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef __INSTANCE_GRAPHICS_ITEM_H
|
||||
#define __INSTANCE_GRAPHICS_ITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
||||
#include "Instance.h"
|
||||
#include "Cell.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class InstanceGraphicsItem : public QGraphicsItem {
|
||||
public:
|
||||
//InstanceGraphicsItem(InstanceGraphicsItem* parent, Instance* instance);
|
||||
InstanceGraphicsItem(Cell* cell);
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
private:
|
||||
Instance* instance;
|
||||
Cell* cell;
|
||||
void drawPhantom(QPainter* painter);
|
||||
void drawBoundary(QPainter* painter);
|
||||
void drawElements(QPainter* painter);
|
||||
void constructSubInstances();
|
||||
|
||||
};
|
||||
|
||||
#endif /* __INSTANCE_GRAPHICS_ITEM_H */
|
|
@ -1,125 +0,0 @@
|
|||
#include <math.h>
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "CompositeLayer.h"
|
||||
#include "BasicLayer.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
#include "Utils.h"
|
||||
#include "CellGraphicsItem.h"
|
||||
#include "SegmentFigure.h"
|
||||
|
||||
namespace {
|
||||
|
||||
QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueValue) {
|
||||
if (pattern == "FFFFFFFFFFFFFFFF") {
|
||||
return QBrush(QColor(redValue, greenValue, blueValue));
|
||||
} else {
|
||||
uchar bits[8];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int high = pattern[i * 2];
|
||||
if (('0' <= high) && (high <= '9')) {
|
||||
high = high - '0';
|
||||
} else {
|
||||
if (('a' <= high) && (high <= 'f')) {
|
||||
high = 10 + high - 'a';
|
||||
} else {
|
||||
if (('A' <= high) && (high <= 'F')) {
|
||||
high = 10 + high - 'A';
|
||||
} else {
|
||||
high = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
int low = pattern[(i * 2) + 1];
|
||||
if (('0' <= low) && (low <= '9')) {
|
||||
low = low - '0';
|
||||
} else {
|
||||
if (('a' <= low) && (low <= 'f')) {
|
||||
low = 10 + low - 'a';
|
||||
} else {
|
||||
if (('A' <= low) && (low <= 'F')) {
|
||||
low = 10 + low - 'A';
|
||||
} else {
|
||||
low = '0';
|
||||
}
|
||||
}
|
||||
}
|
||||
bits[i] = (uchar)((high * 16) + low);
|
||||
}
|
||||
return QBrush(QColor(redValue, greenValue, blueValue), QBitmap::fromData(QSize(8,8), bits, QImage::Format_Mono));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SegmentGraphicsItem::SegmentGraphicsItem(CellGraphicsItem* master, Segment* s):
|
||||
QGraphicsItem(master),
|
||||
segment(s)
|
||||
{
|
||||
setFlag(ItemIsMovable);
|
||||
setFlag(ItemIsSelectable);
|
||||
setFlag(ItemIsFocusable);
|
||||
}
|
||||
|
||||
QRectF SegmentGraphicsItem::boundingRect() const {
|
||||
Box box = segment->getBoundingBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void SegmentGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
|
||||
//if (option->levelOfDetail > 1.0) {
|
||||
painter->setClipRect(option->exposedRect);
|
||||
Box box = segment->getBoundingBox();
|
||||
QRectF rect;
|
||||
boxToRectangle(box, rect);
|
||||
BasicLayer* blayer = dynamic_cast<BasicLayer*>(segment->getLayer());
|
||||
if (blayer) {
|
||||
QColor layerColor(blayer->getRedValue(),
|
||||
blayer->getGreenValue(),
|
||||
blayer->getBlueValue());
|
||||
QBrush brush(layerColor);
|
||||
brush.setStyle(Qt::Dense1Pattern);
|
||||
painter->setBrush(brush);
|
||||
//painter->setBrush(getBrush(blayer->getFillPattern(),
|
||||
// blayer->getRedValue(),
|
||||
// blayer->getGreenValue(),
|
||||
// blayer->getBlueValue()));
|
||||
painter->setPen(layerColor);
|
||||
painter->drawRect(rect);
|
||||
} else {
|
||||
CompositeLayer* clayer = dynamic_cast<CompositeLayer*>(segment->getLayer());
|
||||
if (clayer) {
|
||||
for_each_basic_layer(basiclayer, clayer->getBasicLayers()) {
|
||||
QColor layerColor(basiclayer->getRedValue(),
|
||||
basiclayer->getGreenValue(),
|
||||
basiclayer->getBlueValue());
|
||||
QBrush brush(layerColor);
|
||||
brush.setStyle(Qt::Dense1Pattern);
|
||||
painter->setBrush(brush);
|
||||
//painter->setBrush(getBrush(basiclayer->getFillPattern(),
|
||||
// basiclayer->getRedValue(),
|
||||
// basiclayer->getGreenValue(),
|
||||
// basiclayer->getBlueValue()));
|
||||
painter->setPen(layerColor);
|
||||
painter->drawRect(rect);
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SegmentGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||
update();
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void SegmentGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
||||
update();
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef __SEGMENT_GRAPHICS_ITEM_H
|
||||
#define __SEGMENT_GRAPHICS_ITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
||||
#include "Segment.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class CellGraphicsItem;
|
||||
|
||||
class SegmentGraphicsItem : public QGraphicsItem {
|
||||
public:
|
||||
SegmentGraphicsItem(CellGraphicsItem* parent, Segment* segment);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const;
|
||||
private:
|
||||
Segment* segment;
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
};
|
||||
|
||||
#endif /* __SEGMENT_GRAPHICS_ITEM_H */
|
|
@ -1,53 +0,0 @@
|
|||
#include <QPainter>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "BasicLayer.h"
|
||||
using namespace H;
|
||||
|
||||
#include "SegmentGraphicsItem.h"
|
||||
#include "Utils.h"
|
||||
#include "SliceFigure.h"
|
||||
|
||||
SliceFigure::SliceFigure(CellFigure* parent, Slice* sli):
|
||||
QGraphicsItem(parent),
|
||||
slice(sli)
|
||||
{
|
||||
// constructGoFigures();
|
||||
}
|
||||
|
||||
QRectF SliceFigure::boundingRect() const {
|
||||
Box box = slice->GetBoundingBox();
|
||||
return QRectF(box.GetXMin(), box.GetXMax(), box.GetYMin(), box.GetYMax());
|
||||
}
|
||||
|
||||
void SliceFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
|
||||
// if (option->levelOfDetail > 1.0) {
|
||||
//// painter->setClipRect(option->exposedRect);
|
||||
// BasicLayer* layer = dynamic_cast<BasicLayer*>(slice->GetLayer());
|
||||
// if (layer) {
|
||||
// painter->setBrush(QColor(layer->GetRedValue(), layer->GetGreenValue(), layer->GetBlueValue()));
|
||||
// } else {
|
||||
// painter->setBrush(Qt::blue);
|
||||
// }
|
||||
// for_each_go(go, slice->GetGos()) {
|
||||
// Segment* segment = dynamic_cast<Segment*>(go);
|
||||
// if (segment) {
|
||||
// Box box = segment->GetBoundingBox();
|
||||
// QRectF rect;
|
||||
// BoxToRectangle(box, rect);
|
||||
// painter->drawRect(rect);
|
||||
// }
|
||||
// end_for;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void SliceFigure::constructGoFigures() {
|
||||
for_each_go(go, slice->GetGos()) {
|
||||
Segment* segment = dynamic_cast<Segment*>(go);
|
||||
if (segment) {
|
||||
new SegmentGraphicsItem(this, segment);
|
||||
}
|
||||
end_for;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef __SLICE_FIGURE_H
|
||||
#define __SLICE_FIGURE_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
||||
#include "CellGraphicsItem.h"
|
||||
|
||||
#include "Slice.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class SliceFigure : public QGraphicsItem {
|
||||
public:
|
||||
SliceFigure(CellGraphicsItem* parent, Slice* slice);
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
private:
|
||||
Slice* slice;
|
||||
void constructGoFigures();
|
||||
};
|
||||
|
||||
#endif /* __SLICE_FIGURE_H */
|
|
@ -1,44 +0,0 @@
|
|||
#ifndef __UTILS_H
|
||||
#define __UTILS_H
|
||||
|
||||
#include <QRectF>
|
||||
#include <QTransform>
|
||||
#include "Box.h"
|
||||
#include "Transformation.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
inline void boxToRectangle(const Box& box, QRectF& rec) {
|
||||
double xmin = getValue(box.getXMin());
|
||||
double xmax = getValue(box.getXMax());
|
||||
double ymin = getValue(box.getYMin());
|
||||
double ymax = getValue(box.getYMax());
|
||||
rec.setCoords(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
|
||||
inline void hurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) {
|
||||
double tx = getValue(transformation.getTx());
|
||||
double ty = getValue(transformation.getTy());
|
||||
|
||||
position.setX((int)tx);
|
||||
position.setY((int)ty);
|
||||
|
||||
switch (transformation.getOrientation()) {
|
||||
case Transformation::Orientation::ID:
|
||||
transform.setMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
break;
|
||||
case Transformation::Orientation::MX:
|
||||
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
break;
|
||||
case Transformation::Orientation::MY:
|
||||
transform.setMatrix(1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
break;
|
||||
case Transformation::Orientation::R2:
|
||||
transform.setMatrix(-1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* __UTILS_H */
|
|
@ -130,7 +130,7 @@ void Cell::setAbutmentBox(const Box& abutmentBox)
|
|||
void Cell::flattenNets(bool buildRings)
|
||||
// ************************************
|
||||
{
|
||||
openUpdateSession ();
|
||||
UpdateSession::open();
|
||||
|
||||
for_each_occurrence ( occurrence, getHyperNetRootNetOccurrences() ) {
|
||||
HyperNet hyperNet ( occurrence );
|
||||
|
@ -193,7 +193,7 @@ void Cell::flattenNets(bool buildRings)
|
|||
end_for
|
||||
}
|
||||
|
||||
closeUpdateSession ();
|
||||
UpdateSession::close();
|
||||
}
|
||||
|
||||
void Cell::materialize()
|
||||
|
|
|
@ -53,12 +53,12 @@ void DataBase::_postCreate()
|
|||
void DataBase::_preDestroy()
|
||||
// ************************
|
||||
{
|
||||
openUpdateSession();
|
||||
UpdateSession::open();
|
||||
Inherit::_preDestroy();
|
||||
|
||||
if (_rootLibrary) _rootLibrary->destroy();
|
||||
if (_technology) _technology->destroy();
|
||||
closeUpdateSession ();
|
||||
UpdateSession::close();
|
||||
|
||||
DATA_BASE = NULL;
|
||||
}
|
||||
|
|
|
@ -96,13 +96,13 @@ void DisplaySlot::hide()
|
|||
void DisplaySlot::flush()
|
||||
// **********************
|
||||
{
|
||||
openUpdateSession();
|
||||
UpdateSession::open();
|
||||
vector<Go*> govect;
|
||||
_quadTree.getGos().fill(govect);
|
||||
for (unsigned i = 0 ; i < govect.size() ; i++) {
|
||||
govect[i]->destroy();
|
||||
}
|
||||
closeUpdateSession();
|
||||
UpdateSession::close();
|
||||
}
|
||||
|
||||
UserGos DisplaySlot::getUserGos() const
|
||||
|
|
|
@ -449,13 +449,13 @@ void Net::setExternal(bool isExternal)
|
|||
}
|
||||
_isExternal = isExternal;
|
||||
if (_isExternal) {
|
||||
openUpdateSession();
|
||||
UpdateSession::open();
|
||||
setPosition(Point(0, 0));
|
||||
for_each_instance(instance, _cell->getSlaveInstances()) {
|
||||
Plug::_create(instance, this);
|
||||
end_for;
|
||||
}
|
||||
closeUpdateSession();
|
||||
UpdateSession::close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,23 +151,13 @@ void Go::invalidate(bool propagateFlag)
|
|||
// trace_out();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ****************************************************************************************************
|
||||
// Generic functions
|
||||
// ****************************************************************************************************
|
||||
|
||||
void openUpdateSession()
|
||||
// *********************
|
||||
{
|
||||
void UpdateSession::open() {
|
||||
// trace << "OpenUpdateSession()" << endl;
|
||||
// trace_in();
|
||||
UpdateSession::_create();
|
||||
}
|
||||
|
||||
void closeUpdateSession()
|
||||
// **********************
|
||||
{
|
||||
void UpdateSession::close() {
|
||||
// trace << "CloseUpdateSession()" << endl;
|
||||
// trace_in();
|
||||
|
||||
|
|
|
@ -59,6 +59,10 @@ class UpdateSession : public SharedProperty {
|
|||
public: virtual string _getString() const;
|
||||
public: virtual Record* _getRecord() const;
|
||||
|
||||
public: static void open();
|
||||
public: static void close();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -66,10 +70,10 @@ class UpdateSession : public SharedProperty {
|
|||
// Generic functions
|
||||
// ****************************************************************************************************
|
||||
|
||||
void openUpdateSession();
|
||||
|
||||
void closeUpdateSession();
|
||||
|
||||
//void openUpdateSession();
|
||||
//
|
||||
//void closeUpdateSession();
|
||||
//
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -526,8 +526,8 @@ extern "C" {
|
|||
{ { "getUnit" , PyUnit_getUnit , METH_VARARGS, "Convert to Unit." }
|
||||
, { "getValue" , PyUnit_getValue , METH_VARARGS, "Convert a Unit to a value." }
|
||||
, { "getDataBase" , (PyCFunction)PyDataBase_getDataBase , METH_NOARGS , "Get the current DataBase." }
|
||||
, { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." }
|
||||
, { "closeUpdateSession" , (PyCFunction)PyUpdateSession_closeUpdateSession, METH_NOARGS , "Close an UpdateSession." }
|
||||
//, { "openUpdateSession" , (PyCFunction)PyUpdateSession_openUpdateSession , METH_NOARGS , "Open an UpdateSession." }
|
||||
//, { "closeUpdateSession" , (PyCFunction)PyUpdateSession_closeUpdateSession, METH_NOARGS , "Close an UpdateSession." }
|
||||
, { "getExternalComponents" , (PyCFunction)PyNetExternalComponents_getExternalComponents, METH_VARARGS, "Returns the components collection of an external net" }
|
||||
, {NULL, NULL, 0, NULL} /* sentinel */
|
||||
};
|
||||
|
|
|
@ -72,13 +72,13 @@ extern "C" {
|
|||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyUpdateSession_openUpdateSession ()"
|
||||
// Attribute Method : "PyUpdateSession_open ()"
|
||||
|
||||
extern PyObject* PyUpdateSession_openUpdateSession ( PyObject* module ) {
|
||||
trace << "PyUpdateSession_openUpdateSession ()" << endl;
|
||||
extern PyObject* PyUpdateSession_open ( PyObject* module ) {
|
||||
trace << "PyUpdateSession_open()" << endl;
|
||||
|
||||
HTRY
|
||||
openUpdateSession ();
|
||||
UpdateSession::open ();
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
@ -88,14 +88,14 @@ extern "C" {
|
|||
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Attribute Method : "PyUpdateSession_closeUpdateSession ()"
|
||||
// Attribute Method : "PyUpdateSession_close()"
|
||||
|
||||
extern PyObject* PyUpdateSession_closeUpdateSession ( PyObject* module )
|
||||
extern PyObject* PyUpdateSession_close( PyObject* module )
|
||||
{
|
||||
trace << "PyUpdateSession_closeUpdateSession ()" << endl;
|
||||
trace << "PyUpdateSession_close()" << endl;
|
||||
|
||||
HTRY
|
||||
closeUpdateSession ();
|
||||
UpdateSession::close();
|
||||
HCATCH
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
|
|
@ -77,8 +77,8 @@ extern "C" {
|
|||
// -------------------------------------------------------------------
|
||||
// Functions & Types exported to "PyHurricane.ccp".
|
||||
|
||||
extern PyObject* PyUpdateSession_openUpdateSession ( PyObject* module );
|
||||
extern PyObject* PyUpdateSession_closeUpdateSession ( PyObject* module );
|
||||
extern PyObject* PyUpdateSession_open ( PyObject* module );
|
||||
extern PyObject* PyUpdateSession_close ( PyObject* module );
|
||||
|
||||
|
||||
} // End of extern "C".
|
||||
|
|
Loading…
Reference in New Issue