editor in progress
This commit is contained in:
parent
2f4e281425
commit
1b45c3b7c2
|
@ -6,5 +6,5 @@ includedir=${exec_prefix}/include
|
|||
Name: hurricane
|
||||
Description: Hurricane Libs
|
||||
Version: 2.0.b
|
||||
Libs: -L${libdir} -lanalogic -lhurricaneviewer -lhurricane
|
||||
Libs: -L${libdir} -lanalogic -lhurricaneviewer -lhurricaneeditor -lhurricane
|
||||
Cflags: -I${includedir}/coriolis/hurricane
|
||||
|
|
|
@ -4,12 +4,13 @@ include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane)
|
|||
|
||||
set(includes CellEditor.h CellScene.h)
|
||||
set(exports CellEditor.h)
|
||||
set(cpps InstanceFigure.cpp CellScene.cpp CellEditor.cpp)
|
||||
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 ${includes} DESTINATION /include/coriolis/hurricane)
|
||||
install(FILES ${exports} DESTINATION /include/coriolis/hurricane)
|
||||
install(TARGETS hurricaneeditor DESTINATION /lib)
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
#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() {
|
||||
}
|
||||
|
||||
void CellEditor::zoomOut() {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef __CELL_EDITOR_H
|
||||
#define __CELL_EDITOR_H
|
||||
|
||||
#include "Cell.h"
|
||||
using namespace H;
|
||||
|
||||
#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 "InstanceFigure.h"
|
||||
#include "SliceFigure.h"
|
||||
|
||||
#include "Utils.h"
|
||||
#include "CellFigure.h"
|
||||
|
||||
CellFigure::CellFigure(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 InstanceFigure(this, instance);
|
||||
end_for;
|
||||
}
|
||||
//for_each_slice(slice, cell->GetSlices()) {
|
||||
// new SliceFigure(this, slice);
|
||||
// end_for;
|
||||
//}
|
||||
}
|
||||
|
||||
CellFigure::CellFigure(InstanceFigure* master, Cell* c) : QGraphicsItem(master), cell(c) {
|
||||
for_each_instance(instance, cell->GetInstances()) {
|
||||
new InstanceFigure(this, instance);
|
||||
end_for;
|
||||
}
|
||||
for_each_slice(slice, cell->GetSlices()) {
|
||||
new SliceFigure(this, slice);
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
|
||||
QRectF CellFigure::boundingRect() const {
|
||||
Box box = cell->GetBoundingBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
rect = transform().mapRect(rect);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void CellFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem* option, QWidget *) {
|
||||
// QPen pen(Qt::blue);
|
||||
// pen.setWidth(10);
|
||||
// painter->setPen(pen);
|
||||
// painter->drawLine(0, 0, 50, 0);
|
||||
//
|
||||
// painter->drawLine(0, 0, 0, 50);
|
||||
// pen.setColor(Qt::red);
|
||||
// painter->setPen(pen);
|
||||
|
||||
//painter->setClipRect(option->exposedRect);
|
||||
//if (option->levelOfDetail > 1.0) {
|
||||
// drawBoundary(painter);
|
||||
//} else {
|
||||
// drawPhantom(painter);
|
||||
//}
|
||||
}
|
||||
|
||||
void CellFigure::drawBoundary(QPainter* painter) {
|
||||
QPen pen(Qt::black);
|
||||
painter->setPen(pen);
|
||||
Box box = cell->GetAbutmentBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
||||
|
||||
void CellFigure::drawPhantom(QPainter* painter) {
|
||||
painter->setBrush(Qt::red);
|
||||
Box box = cell->GetAbutmentBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
#include <math.h>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "Slice.h"
|
||||
using namespace H;
|
||||
|
||||
#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;
|
||||
//}
|
||||
|
||||
for_each_slice(slice, cell->GetSlices()) {
|
||||
for_each_go(go, slice->GetGos()) {
|
||||
Segment* segment = dynamic_cast<Segment*>(go);
|
||||
if (segment) {
|
||||
new SegmentGraphicsItem(this, segment);
|
||||
}
|
||||
end_for;
|
||||
}
|
||||
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,5 +1,5 @@
|
|||
#ifndef __CELL_FIGURE_H
|
||||
#define __CELL_FIGURE_H
|
||||
#ifndef __CELL_GRAPHICS_ITEM_H
|
||||
#define __CELL_GRAPHICS_ITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
@ -7,12 +7,12 @@
|
|||
#include "Cell.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class InstanceFigure;
|
||||
class InstanceGraphicsItem;
|
||||
|
||||
class CellFigure : public QGraphicsItem {
|
||||
class CellGraphicsItem : public QGraphicsItem {
|
||||
public:
|
||||
CellFigure(Cell* cell);
|
||||
CellFigure(InstanceFigure* master, Cell* cell);
|
||||
CellGraphicsItem(Cell* cell);
|
||||
CellGraphicsItem(InstanceGraphicsItem* master, Cell* cell);
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
@ -23,4 +23,4 @@ class CellFigure : public QGraphicsItem {
|
|||
void drawPhantom(QPainter* painter);
|
||||
};
|
||||
|
||||
#endif /* __CELL_FIGURE_H */
|
||||
#endif /* __CELL_GRAPHICS_ITEM_H */
|
|
@ -1,6 +1,11 @@
|
|||
#include "CellGraphicsItem.h"
|
||||
|
||||
#include "CellScene.h"
|
||||
|
||||
CellScene::CellScene(Cell* c)
|
||||
: QGraphicsScene()
|
||||
, cell(c)
|
||||
{}
|
||||
{
|
||||
CellGraphicsItem* cellItem = new CellGraphicsItem(cell);
|
||||
addItem(cellItem);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
using namespace H;
|
||||
|
||||
#include "Utils.h"
|
||||
#include "InstanceFigure.h"
|
||||
#include "InstanceGraphicsItem.h"
|
||||
|
||||
//InstanceFigure::InstanceFigure(Instance* inst)
|
||||
//InstanceGraphicsItem::InstanceGraphicsItem(Instance* inst)
|
||||
// : instance(inst),
|
||||
// cell(instance->GetMasterCell())
|
||||
//{
|
||||
|
@ -24,42 +24,42 @@ using namespace H;
|
|||
// constructSubInstances();
|
||||
//}
|
||||
|
||||
InstanceFigure::InstanceFigure(Cell* c)
|
||||
InstanceGraphicsItem::InstanceGraphicsItem(Cell* c)
|
||||
: instance(NULL),
|
||||
cell(c)
|
||||
{
|
||||
constructSubInstances();
|
||||
}
|
||||
|
||||
InstanceFigure::InstanceFigure(InstanceFigure* 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();
|
||||
}
|
||||
//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 InstanceFigure::constructSubInstances() {
|
||||
void InstanceGraphicsItem::constructSubInstances() {
|
||||
for_each_instance(instance, cell->GetInstances()) {
|
||||
new InstanceFigure(this, instance);
|
||||
//new InstanceGraphicsItem(this, instance);
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
|
||||
QRectF InstanceFigure::boundingRect() const {
|
||||
QRectF InstanceGraphicsItem::boundingRect() const {
|
||||
Box box = cell->GetAbutmentBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
boxToRectangle(box, rect);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void InstanceFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
|
||||
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);
|
||||
|
@ -69,7 +69,7 @@ void InstanceFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
|
|||
}
|
||||
}
|
||||
|
||||
void InstanceFigure::drawElements(QPainter* painter) {
|
||||
void InstanceGraphicsItem::drawElements(QPainter* painter) {
|
||||
for_each_slice(slice, cell->GetSlices()) {
|
||||
painter->save();
|
||||
BasicLayer* layer = dynamic_cast<BasicLayer*>(slice->GetLayer());
|
||||
|
@ -83,7 +83,7 @@ void InstanceFigure::drawElements(QPainter* painter) {
|
|||
if (segment) {
|
||||
Box box = segment->GetBoundingBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
|
||||
}
|
||||
|
@ -94,19 +94,19 @@ void InstanceFigure::drawElements(QPainter* painter) {
|
|||
}
|
||||
}
|
||||
|
||||
void InstanceFigure::drawBoundary(QPainter* painter) {
|
||||
void InstanceGraphicsItem::drawBoundary(QPainter* painter) {
|
||||
QPen pen(Qt::black);
|
||||
painter->setPen(pen);
|
||||
Box box = cell->GetAbutmentBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
||||
|
||||
void InstanceFigure::drawPhantom(QPainter* painter) {
|
||||
void InstanceGraphicsItem::drawPhantom(QPainter* painter) {
|
||||
painter->setBrush(Qt::red);
|
||||
Box box = cell->GetAbutmentBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __INSTANCE_FIGURE_H
|
||||
#define __INSTANCE_FIGURE_H
|
||||
#ifndef __INSTANCE_GRAPHICS_ITEM_H
|
||||
#define __INSTANCE_GRAPHICS_ITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
@ -8,11 +8,10 @@
|
|||
#include "Cell.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class InstanceFigure : public QGraphicsItem {
|
||||
class InstanceGraphicsItem : public QGraphicsItem {
|
||||
public:
|
||||
InstanceFigure(InstanceFigure* parent, Instance* instance);
|
||||
//InstanceFigure(Instance* instance);
|
||||
InstanceFigure(Cell* cell);
|
||||
//InstanceGraphicsItem(InstanceGraphicsItem* parent, Instance* instance);
|
||||
InstanceGraphicsItem(Cell* cell);
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
@ -27,4 +26,4 @@ class InstanceFigure : public QGraphicsItem {
|
|||
|
||||
};
|
||||
|
||||
#endif /* __INSTANCE_FIGURE_H */
|
||||
#endif /* __INSTANCE_GRAPHICS_ITEM_H */
|
|
@ -7,25 +7,26 @@
|
|||
using namespace H;
|
||||
|
||||
#include "Utils.h"
|
||||
#include "SliceFigure.h"
|
||||
#include "CellGraphicsItem.h"
|
||||
#include "SegmentFigure.h"
|
||||
|
||||
SegmentFigure::SegmentFigure(SliceFigure* master, Segment* s):
|
||||
QGraphicsItem(master),
|
||||
segment(s)
|
||||
{}
|
||||
SegmentGraphicsItem::SegmentGraphicsItem(CellGraphicsItem* master, Segment* s):
|
||||
QGraphicsItem(master),
|
||||
segment(s)
|
||||
{
|
||||
setFlag(ItemIsMovable);
|
||||
}
|
||||
|
||||
QRectF SegmentFigure::boundingRect() const {
|
||||
Box box = getGo()->GetBoundingBox();
|
||||
QRectF SegmentGraphicsItem::boundingRect() const {
|
||||
Box box = segment->GetBoundingBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
boxToRectangle(box, rect);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void SegmentFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
|
||||
Q_UNUSED(widget);
|
||||
void SegmentGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
|
||||
|
||||
if (option->levelOfDetail > 1.0) {
|
||||
//if (option->levelOfDetail > 1.0) {
|
||||
painter->setClipRect(option->exposedRect);
|
||||
BasicLayer* layer = dynamic_cast<BasicLayer*>(segment->GetLayer());
|
||||
if (layer) {
|
||||
|
@ -35,7 +36,18 @@ void SegmentFigure::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
|
|||
}
|
||||
Box box = segment->GetBoundingBox();
|
||||
QRectF rect;
|
||||
BoxToRectangle(box, rect);
|
||||
boxToRectangle(box, rect);
|
||||
painter->drawRect(rect);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
void SegmentGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||
update();
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void SegmentGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
|
||||
update();
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef __SEGMENT_FIGURE_H
|
||||
#define __SEGMENT_FIGURE_H
|
||||
#ifndef __SEGMENT_GRAPHICS_ITEM_H
|
||||
#define __SEGMENT_GRAPHICS_ITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
@ -7,17 +7,18 @@
|
|||
#include "Segment.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class SliceFigure;
|
||||
class CellGraphicsItem;
|
||||
|
||||
class SegmentFigure : public QGraphicsItem {
|
||||
class SegmentGraphicsItem : public QGraphicsItem {
|
||||
public:
|
||||
SegmentFigure(SliceFigure* parent, Segment* segment);
|
||||
SegmentGraphicsItem(CellGraphicsItem* parent, Segment* segment);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const;
|
||||
private:
|
||||
Segment* segment;
|
||||
protected:
|
||||
Go* getGo() const { return segment; }
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
};
|
||||
|
||||
#endif /* __SEGMENT_FIGURE_H */
|
||||
#endif /* __SEGMENT_GRAPHICS_ITEM_H */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "BasicLayer.h"
|
||||
using namespace H;
|
||||
|
||||
#include "SegmentFigure.h"
|
||||
#include "SegmentGraphicsItem.h"
|
||||
#include "Utils.h"
|
||||
#include "SliceFigure.h"
|
||||
|
||||
|
@ -46,7 +46,7 @@ void SliceFigure::constructGoFigures() {
|
|||
for_each_go(go, slice->GetGos()) {
|
||||
Segment* segment = dynamic_cast<Segment*>(go);
|
||||
if (segment) {
|
||||
new SegmentFigure(this, segment);
|
||||
new SegmentGraphicsItem(this, segment);
|
||||
}
|
||||
end_for;
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
#include <QGraphicsItem>
|
||||
#include <QObject>
|
||||
|
||||
#include "CellFigure.h"
|
||||
#include "CellGraphicsItem.h"
|
||||
|
||||
#include "Slice.h"
|
||||
using namespace Hurricane;
|
||||
|
||||
class SliceFigure : public QGraphicsItem {
|
||||
public:
|
||||
SliceFigure(CellFigure* parent, Slice* slice);
|
||||
SliceFigure(CellGraphicsItem* parent, Slice* slice);
|
||||
QRectF boundingRect() const;
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "Transformation.h"
|
||||
using namespace H;
|
||||
|
||||
inline void BoxToRectangle(const Box& box, QRectF& rec) {
|
||||
inline void boxToRectangle(const Box& box, QRectF& rec) {
|
||||
double xmin = GetValue(box.getXMin());
|
||||
double xmax = GetValue(box.getXMax());
|
||||
double ymin = GetValue(box.getYMin());
|
||||
|
@ -15,7 +15,7 @@ inline void BoxToRectangle(const Box& box, QRectF& rec) {
|
|||
rec.setCoords(xmin, ymin, xmax, ymax);
|
||||
}
|
||||
|
||||
inline void HurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) {
|
||||
inline void hurricanePositionToQtPosition(const Transformation& transformation, QTransform& transform, QPoint& position) {
|
||||
double tx = GetValue(transformation.getTx());
|
||||
double ty = GetValue(transformation.getTy());
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ set(includes CellWidget.h LayersWidget.h CellViewer.h)
|
|||
set(exports CellViewer.h)
|
||||
set(cpps CellWidget.cpp LayersWidget.cpp CellViewer.cpp)
|
||||
|
||||
Q4_WRAP_CPP(MOC_SRCS ${includes})
|
||||
QT4_WRAP_CPP(MOC_SRCS ${includes})
|
||||
|
||||
add_library(hurricaneviewer SHARED ${cpps} ${MOC_SRCS})
|
||||
target_link_libraries(hurricaneviewer ${QT_LIBRARIES} hurricane)
|
||||
|
|
Loading…
Reference in New Issue