viewer in progress
This commit is contained in:
parent
c465282355
commit
ea0d867b93
|
@ -2,8 +2,9 @@ include(${QT_USE_FILE})
|
|||
|
||||
include_directories(${HURRICANE_SOURCE_DIR}/src/hurricane)
|
||||
|
||||
set(includes CellWidget.h)
|
||||
set(cpps CellWidget.cpp)
|
||||
set(includes CellWidget.h LayersWidget.h CellViewer.h)
|
||||
set(exports CellViewer.h)
|
||||
set(cpps CellWidget.cpp LayersWidget.cpp CellViewer.cpp)
|
||||
|
||||
QT4_WRAP_CPP(MOC_SRCS ${includes})
|
||||
|
||||
|
@ -11,5 +12,5 @@ QT4_WRAP_CPP(MOC_SRCS ${includes})
|
|||
add_library(hurricaneviewer SHARED ${cpps} ${MOC_SRCS})
|
||||
target_link_libraries(hurricaneviewer ${QT_LIBRARIES} hurricane)
|
||||
|
||||
install(FILES ${includes} DESTINATION /include/coriolis/hurricane)
|
||||
install(FILES ${exports} DESTINATION /include/coriolis/hurricane)
|
||||
install(TARGETS hurricaneviewer DESTINATION /lib)
|
||||
|
|
|
@ -120,6 +120,23 @@ void CellWidget::paintEvent(QPaintEvent* event) {
|
|||
redraw();
|
||||
}
|
||||
|
||||
void CellWidget::reframe(double sc) {
|
||||
reframe(center, sc);
|
||||
}
|
||||
|
||||
void CellWidget::reframe(const Point& c, double sc) {
|
||||
if (0 < sc) {
|
||||
center = c;
|
||||
scale = sc;
|
||||
screenDx = -(int)rint((GetValue(center.getX()) - (width() / (scale*2))) * scale);
|
||||
screenDy = -(int)rint((GetValue(center.getY()) - (height() / (scale*2))) * scale);
|
||||
brushDx = 0;
|
||||
brushDy = 0;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::invalidate() {
|
||||
invalidRegion = QRegion(rect());
|
||||
}
|
||||
|
@ -161,7 +178,7 @@ void CellWidget::redraw() {
|
|||
|
||||
for_each_basic_layer(basiclayer, getTechnology()->GetBasicLayers()) {
|
||||
if (isDrawable(basiclayer)) {
|
||||
painter->save();
|
||||
//painter->save();
|
||||
map<BasicLayer*, QBrush>::const_iterator bmit = basicLayersBrush.find(basiclayer);
|
||||
if (bmit != basicLayersBrush.end()) {
|
||||
setBrush(bmit->second, brightness);
|
||||
|
@ -171,11 +188,13 @@ void CellWidget::redraw() {
|
|||
setPen(pmit->second, brightness);
|
||||
}
|
||||
drawContent(cell, basiclayer, area, Transformation());
|
||||
painter->restore();
|
||||
//painter->restore();
|
||||
end_for;
|
||||
}
|
||||
}
|
||||
|
||||
painter = oldPainter;
|
||||
|
||||
invalidRegion = QRegion();
|
||||
}
|
||||
}
|
||||
|
@ -305,14 +324,14 @@ void CellWidget::drawLine(const Unit& xo,
|
|||
int iyo = getScreenY(GetUnit(dyo));
|
||||
int ixe = getScreenX(GetUnit(dxe));
|
||||
int iye = getScreenY(GetUnit(dye));
|
||||
painter->save();
|
||||
//painter->save();
|
||||
if (painter->pen() == Qt::NoPen) {
|
||||
painter->setPen(painter->brush().color());
|
||||
}
|
||||
//painter->moveTo(ixo, iyo);
|
||||
//painter->lineTo(ixe, iye);
|
||||
painter->drawLine(ixo, iyo, ixe, iye);
|
||||
painter->restore();
|
||||
//painter->restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -548,3 +567,7 @@ bool CellWidget::isDrawable(BasicLayer* layer) const {
|
|||
return (layer->GetDisplayThreshold() <= scale);
|
||||
}
|
||||
|
||||
|
||||
double CellWidget::getScale() const {
|
||||
return scale;
|
||||
}
|
||||
|
|
|
@ -10,11 +10,14 @@ using namespace H;
|
|||
|
||||
|
||||
class CellWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CellWidget(Cell* cell, QWidget* parent=0);
|
||||
double getScale() const;
|
||||
void redraw();
|
||||
void reframe(double scale);
|
||||
void reframe(const Point& c, double sc);
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
private:
|
||||
|
@ -26,6 +29,7 @@ class CellWidget : public QWidget {
|
|||
QPainter* painter;
|
||||
QColor backgroundColor;
|
||||
QColor foregroundColor;
|
||||
Point center;
|
||||
double scale;
|
||||
int screenDx;
|
||||
int screenDy;
|
||||
|
@ -34,6 +38,9 @@ class CellWidget : public QWidget {
|
|||
map<BasicLayer*, QBrush> basicLayersBrush;
|
||||
map<BasicLayer*, QPen> basicLayersPen;
|
||||
|
||||
void fitToContent(unsigned screenMargin = 5);
|
||||
void scroll(const Unit& dx, const Unit& dy);
|
||||
|
||||
void drawContent(const Cell* cell, const BasicLayer* basicLayer, const H::Box& updateArea, const Transformation& transformation) const;
|
||||
void drawContent(const Instance* instance, const BasicLayer* basicLayer, const H::Box& updateArea, const Transformation& transformation) const;
|
||||
void drawSlice(const Slice* slice, const BasicLayer* basicLayer, const H::Box& updateArea, const Transformation& transformation) const;
|
||||
|
|
Loading…
Reference in New Issue