installation again

This commit is contained in:
Christophe Alexandre 2008-02-05 20:22:01 +00:00
parent 716aa724f7
commit aa405b5147
10 changed files with 2352 additions and 2221 deletions

View File

@ -1,9 +1,9 @@
# - Find the Hurricane includes and libraries.
# The following variables are set if Hurricane is found. If HURRICANE is not
# found, Hurricane_FOUND is set to false.
# found, HURRICANE_FOUND is set to false.
# HURRICANE_FOUND - True when the Hurricane include directory is found.
# HURRICANE_INCLUDE_DIRS - the path to where the Hurricane include files are.
# HURRICANE_LIBRARY_DIRS - The path to where the Hurricane library files are.
# HURRICANE_INCLUDE_DIR - the path to where the Hurricane include files are.
# HURRICANE_LIBRARIES - The path to where the Hurricane library files are.
SET(HURRICANE_INCLUDE_PATH_DESCRIPTION "directory containing the Hurricane include files. E.g /usr/local/include/hurricane or /asim/coriolis/include/hurricane")
@ -37,10 +37,23 @@ IF(UNIX)
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
#MESSAGE("HURRICANE_DIR_SEARCH : ${HURRICANE_DIR_SEARCH}")
#MESSAGE("HURRICANE_LIBRARY_PATH : ${HURRICANE_LIBRARY_PATH}")
FIND_PATH(HURRICANE_ANALOGIC_INCLUDE_PATH NAMES RdsUnit.h PATHS
# Look in other places.
${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES include/hurricane
# Help the user find it if we cannot.
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_PATH(HURRICANE_GRAPHICAL_INCLUDE_PATH
FIND_LIBRARY(HURRICANE_ANALOGIC_LIBRARY_PATH
NAMES analogic
PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES lib
# Help the user find it if we cannot.
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_PATH(HURRICANE_VIEWER_INCLUDE_PATH
NAMES CellViewer.h
PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES include/hurricane
@ -48,7 +61,7 @@ IF(UNIX)
DOC "The ${HURRICANE_INCLUDE_PATH_DESCRIPTION}"
)
FIND_LIBRARY(HURRICANE_GRAPHICAL_LIBRARY_PATH
FIND_LIBRARY(HURRICANE_VIEWER_LIBRARY_PATH
NAMES hurricaneviewer
PATHS ${HURRICANE_DIR_SEARCH}
PATH_SUFFIXES lib
@ -56,39 +69,77 @@ 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)
IF(HURRICANE_INCLUDE_PATH)
IF(HURRICANE_LIBRARY_PATH)
IF(HURRICANE_ANALOGIC_INCLUDE_PATH)
IF(HURRICANE_ANALOGIC_LIBRARY_PATH)
SET(HURRICANE_FOUND "YES")
SET(HURRICANE_INCLUDE_DIR ${HURRICANE_INCLUDE_PATH})
SET(HURRICANE_LIBRARIES ${HURRICANE_LIBRARY_PATH} -lanalogic)
SET(HURRICANE_INCLUDE_DIR
${HURRICANE_INCLUDE_PATH}
${HURRICANE_ANALOGIC_INCLUDE_PATH}
)
SET(HURRICANE_LIBRARIES
${HURRICANE_LIBRARY_PATH}
${HURRICANE_ANALOGIC_LIBRARY_PATH}
)
ENDIF(HURRICANE_ANALOGIC_LIBRARY_PATH)
ENDIF(HURRICANE_ANALOGIC_INCLUDE_PATH)
ENDIF(HURRICANE_LIBRARY_PATH)
ENDIF(HURRICANE_INCLUDE_PATH)
IF(HURRICANE_GRAPHICAL_INCLUDE_PATH)
IF (HURRICANE_GRAPHICAL_LIBRARY_PATH)
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_GRAPHICAL_INCLUDE_PATH})
SET(HURRICANE_GRAPHICAL_LIBRARIES ${HURRICANE_GRAPHICAL_LIBRARY_PATH} -lhurricaneeditor)
ENDIF(HURRICANE_GRAPHICAL_LIBRARY_PATH)
ENDIF(HURRICANE_GRAPHICAL_INCLUDE_PATH)
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)
IF(NOT HURRICANE_FOUND)
IF(HURRICANE_FOUND)
IF(NOT HURRICANE_FIND_QUIETLY)
MESSAGE(STATUS "HURRICANE was not found. ${HURRICANE_DIR_MESSAGE}")
ELSE(NOT HURRICANE_FIND_QUIETLY)
MESSAGE(STATUS "Found HURRICANE : ${HURRICANE_LIBRARIES}")
ENDIF(NOT HURRICANE_FIND_QUIETLY)
ELSE(HURRICANE_FOUND)
IF(HURRICANE_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "HURRICANE was not found. ${HURRICANE_DIR_MESSAGE}")
ENDIF(HURRICANE_FIND_REQUIRED)
ENDIF(NOT HURRICANE_FIND_QUIETLY)
ENDIF(NOT HURRICANE_FOUND)
ENDIF(HURRICANE_FOUND)
MARK_AS_ADVANCED(
HURRICANE_INCLUDE_PATH
HURRICANE_LIBRARY_PATH
HURRICANE_ANALOGIC_INCLUDE_PATH
HURRICANE_ANALOGIC_LIBRARY_PATH
HURRICANE_GRAPHICAL_INCLUDE_PATH
HURRICANE_GRAPHICAL_LIBRARY_PATH
)

View File

@ -60,9 +60,11 @@ CellEditor::~CellEditor() {
//}
void CellEditor::zoomIn() {
view->scale(1.2, 1.2);
}
void CellEditor::zoomOut() {
view->scale(0.8, 0.8);
}
void CellEditor::fitToWindow() {

View File

@ -22,14 +22,17 @@ CellGraphicsItem::CellGraphicsItem(Cell* c):
// 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) {
new SegmentGraphicsItem(this, segment);
SegmentGraphicsItem* segmentItem = new SegmentGraphicsItem(this, segment);
segmentItem->setZValue(zValue);
}
end_for;
}
zValue += 10;
end_for;
}
}

View File

@ -1,8 +1,10 @@
#include <math.h>
#include <QBitmap>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include "CompositeLayer.h"
#include "BasicLayer.h"
using namespace H;
@ -10,11 +12,57 @@ using namespace 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 {
@ -25,22 +73,46 @@ QRectF SegmentGraphicsItem::boundingRect() const {
}
void SegmentGraphicsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
//if (option->levelOfDetail > 1.0) {
painter->setClipRect(option->exposedRect);
BasicLayer* layer = dynamic_cast<BasicLayer*>(segment->GetLayer());
if (layer) {
painter->setBrush(QColor(layer->GetRedValue(), layer->GetGreenValue(), layer->GetBlueValue()));
} else {
painter->setBrush(Qt::blue);
}
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();

View File

@ -8,10 +8,10 @@
using namespace H;
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());
double xmin = GetValue(box.getXMin() * 10.0);
double xmax = GetValue(box.getXMax()) * 10.0;
double ymin = GetValue(box.getYMin()) * 10.0;
double ymax = GetValue(box.getYMax()) * 10.0;
rec.setCoords(xmin, ymin, xmax, ymax);
}

View File

@ -23,30 +23,27 @@ CellViewer::~CellViewer() {
delete layersWidget;
}
//void CellViewer::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);
// }
//}
static int scrollStep = GetUnit(200);
void CellViewer::keyPressEvent(QKeyEvent *event) {
switch (event->key()) {
case Qt::Key_Left:
cellWidget->scroll(-scrollStep, 0);
break;
case Qt::Key_Right:
cellWidget->scroll(+scrollStep, 0);
break;
case Qt::Key_Down:
cellWidget->scroll(0, -scrollStep);
break;
case Qt::Key_Up:
cellWidget->scroll(0, +scrollStep);
break;
default:
QWidget::keyPressEvent(event);
}
}
//
//void CellViewer::wheelEvent(QWheelEvent *event) {
// int numDegrees = event->delta() / 8;

View File

@ -31,6 +31,9 @@ class CellViewer : public QMainWindow {
void zoomIn();
void zoomOut();
void fitToWindow();
protected:
void keyPressEvent(QKeyEvent *event);
};
#endif

View File

@ -22,6 +22,7 @@ using namespace H;
#include <QPaintEvent>
#include <QPainter>
#include <QBitmap>
#include <math.h>
#include <functional>
@ -34,7 +35,7 @@ QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueVal
if (pattern == "FFFFFFFFFFFFFFFF") {
return QBrush(QColor(redValue, greenValue, blueValue));
} else {
char bits[8];
uchar bits[8];
for (int i = 0; i < 8; i++) {
int high = pattern[i * 2];
if (('0' <= high) && (high <= '9')) {
@ -64,10 +65,10 @@ QBrush getBrush(const string &pattern, int redValue, int greenValue, int blueVal
}
}
}
bits[i] = (char)((high * 16) + low);
bits[i] = (uchar)((high * 16) + low);
}
return QBrush(QColor(redValue, greenValue, blueValue),
QPixmap(bits));
return QBrush(QColor(redValue, greenValue, blueValue), QBitmap::fromData(QSize(8,8), bits, QImage::Format_Mono));
}
}
@ -1616,8 +1617,7 @@ CellWidget::scroll(const Unit& dx,
if ((getSize(width()) < labs(dx)) || (getSize(height()) < labs(dy))) {
reframe(getCenter().getTranslated(-dx, -dy));
redraw();
}
else {
} else {
int sdx = getScreenSize(dx);
int sdy = getScreenSize(dy);
@ -1649,32 +1649,35 @@ CellWidget::scroll(const Unit& dx,
if (0 < sdy) {
//bitBlt(this, sdx, 0, this, 0, sdy, w - sdx, h - sdy);
invalidate(QRect(-1, -1, sdx + 1, h + 1));
_redraw();
//_redraw();
invalidate(QRect(sdx - 1, h - sdy - 1, w + 1, h + 1));
_redraw();
}
else {
//_redraw();
update();
} else {
//bitBlt(this, sdx, -sdy, this, 0, 0, w - sdx, h + sdy, CopyROP);
invalidate(QRect(-1, -1, sdx + 1, h + 1));
_redraw();
//_redraw();
invalidate(QRect(sdx - 1, -1, w + 1, -sdy + 1));
_redraw();
//_redraw();
update();
}
}
else {
if (0 < sdy) {
//bitBlt(this, 0, 0, this, -sdx, sdy, w + sdx, h - sdy, CopyROP);
invalidate(QRect(w + sdx - 1, -1, w + 1, h + 1));
_redraw();
// _redraw();
invalidate(QRect(-1, h - sdy - 1, w + sdx + 1, h + 1));
_redraw();
//_redraw();
update();
}
else {
//bitBlt(this, 0, -sdy, this, -sdx, 0, w + sdx, h + sdy);
invalidate(QRect(w + sdx - 1, -1, w + 1, h + 1));
_redraw();
//_redraw();
invalidate(QRect(-1, -1, w + sdx + 1, -sdy + 1));
_redraw();
//_redraw();
update();
}
}