Permalink
Browse files

Added back a NetBeans project under /rsyn-x/x/ide/netbeans.

  • Loading branch information...
gaflach committed Jan 25, 2018
1 parent 5cd00f1 commit 3e1ef23bb858131a907eaa74d6951cd6f3436970
@@ -1,5 +1,6 @@
# Ignore some knonw OS generated files
# -------------------------------------
########################################
# Ignore some knonw OS generated files #
########################################
.DS_Store
.DS_Store?
._*
@@ -8,17 +9,20 @@
ehthumbs.db
Thumbs.db

# Ignore most of contents of private folder
# -----------------------------------------
########
# Misc #
########

build/*

x/ide/netbeans/*
x/ide/netbeans/nbproject/private
!x/ide/netbeans/nbproject/
!x/ide/netbeans/Makefile

x/build/*

x/bin/*
!x/bin/src
!x/bin/Makefile
!x/bin/POWV9.dat
!x/bin/PORT9.dat
@@ -31,6 +35,11 @@ x/bin/*
!x/bin/report.sh
!x/bin/report-uplace.sh

x/run/*
!x/run/POWV9.dat
!x/run/PORT9.dat
!x/run/ICCAD15.parm

x/misc/iccad2015_evaluate_solution_0831/evaluate
x/misc/iccad2015_evaluate_solution_0831/iccad2015_evaluate_solution
x/misc/iccad2015_evaluate_solution_0831/b19
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -53,26 +53,24 @@ bool ICCAD15Reader::load(const Rsyn::Json &options) {
const bool globalPlacementOnly = options.value("globalPlacementOnly", false);

std::string path = options.value("path", "");
std::string file = options.value("config", "");
optionSetting = options.value("parms", "");
std::string benchmark = options.value("config", "");
std::string params = options.value("parms", "ICCAD15.parm");
optionMaxDisplacement = options.value("maxDisplacement", 400);
optionTargetUtilization = options.value("targetUtilization", 0.85);
optionBenchmark = boost::filesystem::exists(file) ?
file : path + "/" + file;
optionSetting = boost::filesystem::exists(optionSetting) ?
optionSetting : path + "/" + optionSetting;

optionBenchmark = session.findFile(benchmark, path);
optionSetting = session.findFile(params, path);

if (globalPlacementOnly) {
openBenchmarkFromICCAD15ForGlobalPlacementOnly();
} else {
if (boost::filesystem::is_directory(optionBenchmark) || !boost::filesystem::exists(optionBenchmark)) {
std::cout << "Error: File <design>.iccad2015 file not found: " << optionBenchmark << "\n";
std::exit(1);
if (optionBenchmark.empty()) {
std::cout << "Error: File <design>.iccad2015 file not found: '" << benchmark << "'\n";
return false;
} // end if

if (boost::filesystem::is_directory(optionSetting) || !boost::filesystem::exists(optionSetting)) {
std::cout << "Error: File ICCAD15.parm not found: " << optionSetting << "\n";
std::exit(1);
if (optionSetting.empty()) {
std::cout << "Error: File ICCAD15.parm not found: '" << params << "'\n";
return false;
} // end if

openBenchmarkFromICCAD15();
@@ -0,0 +1,61 @@
#ifndef RSYN_GRAPHICS_ITEM_H
#define RSYN_GRAPHICS_ITEM_H

#include <QRect>
#include <QPainterPath>

class QPainter;

namespace Rsyn {

class GraphicsItem {
friend class GraphicsScene;
friend class GraphicsLayer;
public:

//! @brief Renders this graphics item. The rendering should be done in scene
//! coordinates.
virtual void render(QPainter *painter) = 0;

//! @brief Defines the bounding box of this graphics item in scene
//! coordinates.
//! @note The bounding box does not need to be stored as this function is
//! called only when the item is inserted in the graphics layer.
virtual QRect getBoundingRect() const = 0;

//! @brief Defines the outline of this graphics item in scene coordinates.
//! This is used, for instance, to highlight the object when the mouse
//! hovers over it.
virtual QPainterPath getOutline() const {
QPainterPath outline;
outline.addRect(getBoundingRect());
return outline;
} // end method

//! @brief Should return true if (x, y), given in scene coordinates, is
//! insides (intersects) this graphics item.
virtual bool contains(const int x, const int y) const {
return getOutline().contains(QPointF(x, y));
} // end method

//! @brief Gets the user data.
void *getUserData() const {
return clsUserData;
} // end method

//! @brief Sets the user data;
void setUserData(void *data) {
clsUserData = data;
} // end method

private:

void *clsUserData = nullptr;

}; // end class

} // end namespace


#endif

@@ -0,0 +1,64 @@
#include <QPainter>
#include <QStyleOption>

#include "GraphicsScene.h"
#include "GraphicsLayer.h"
#include "GraphicsItem.h"

namespace Rsyn {

// -----------------------------------------------------------------------------

GraphicsLayer::GraphicsLayer() {
setAcceptHoverEvents(false);
setFlag(QGraphicsItem::ItemIsMovable, false);
setFlag(QGraphicsItem::ItemIsSelectable, false);
setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true);
} // end method

// -----------------------------------------------------------------------------

GraphicsLayer::~GraphicsLayer() {
for (GraphicsItem *item : clsItems) {
delete item;
} // end for
} // end method

// -----------------------------------------------------------------------------

QRectF
GraphicsLayer::boundingRect() const {
return clsScene->sceneRect();
} // end method

// -----------------------------------------------------------------------------

QPainterPath
GraphicsLayer::shape() const {
QPainterPath path;
path.addRect(boundingRect());
return path;
} // end method

// -----------------------------------------------------------------------------

void
GraphicsLayer::paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) {
//render(painter, item->exposedRect);
} // end method

// -----------------------------------------------------------------------------

void
GraphicsLayer::render(QPainter *painter, const QRectF &exposedRect) {
painter->setBrush(clsBrush);
painter->setPen(clsPen);
for (GraphicsItem *item : clsItems) {
item->render(painter);
} // end for
} // end method

// -----------------------------------------------------------------------------


} // end namespace
@@ -0,0 +1,70 @@
#ifndef RSYN_GRAPHICS_LAYER_H
#define RSYN_GRAPHICS_LAYER_H

#include <QGraphicsItem>
#include <QPainterPath>
#include <QRectF>
#include <QBrush>
#include <QPen>

#include <tuple>
#include <map>
#include <vector>
#include <deque>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>

namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;

namespace Rsyn {

class GraphicsScene;
class GraphicsItem;

class GraphicsLayer : public QGraphicsItem {
friend class GraphicsScene;
public:

GraphicsLayer();
~GraphicsLayer();

virtual QRectF boundingRect() const final;
virtual QPainterPath shape() const final;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) final;

void render(QPainter *painter, const QRectF &exposedRect);

//! @brief Adds an item to this graphics layer. The graphics layer takes
//! ownership of the item (i.e. it is responsible to delete it).
void addItem(GraphicsItem *item) {
clsItems.push_back(item);
} // end method

//! @brief
void setBrush(const QBrush &brush) {
clsBrush = brush;
} // end method

//! @brief
void setPen(const QPen &pen) {
clsPen = pen;
} // end method

private:

GraphicsScene *clsScene = nullptr;
std::deque<GraphicsItem *> clsItems;

QBrush clsBrush;
QPen clsPen;
}; // end clas

} // end namespae

#endif

@@ -1,9 +1,78 @@
#include <QPainter>

#include "GraphicsScene.h"
#include "GraphicsLayer.h"

extern const bool UseAlternativeSceneMgr;

namespace Rsyn {

GraphicsScene::GraphicsScene(QObject *parent) : QGraphicsScene(parent) {

} // end method

// -----------------------------------------------------------------------------

GraphicsScene::~GraphicsScene() {
for (GraphicsLayer *layer : clsLayers) {
delete layer;
} // end for
} // end method

// -----------------------------------------------------------------------------

void
GraphicsScene::drawBackground(QPainter *painter, const QRectF &rect) {
if (!UseAlternativeSceneMgr)
return;

std::cout << "draw background\n";
painter->fillRect(rect, Qt::white);
for (GraphicsLayer *layer : clsLayers) {
layer->render(painter, rect);
} // end for
} // end method

// -----------------------------------------------------------------------------

void
GraphicsScene::drawForeground(QPainter *painter, const QRectF &rect) {
if (!UseAlternativeSceneMgr)
return;

std::cout << "draw foreground\n";
QPen pen;
pen.setWidth(2);
if (clsHover) {
pen.setColor(Qt::black);
} else {
pen.setColor(Qt::lightGray);
}
pen.setStyle(Qt::DashLine);
pen.setCosmetic(true);

static int offset = 0;
pen.setDashOffset(offset++);

QBrush brush;

painter->setPen(pen);
painter->setBrush(brush);

QPainterPath path;
path.addRect(sceneRect());

painter->drawPath(path);

} // end method

// -----------------------------------------------------------------------------

void
GraphicsScene::addLayer(GraphicsLayer *layer) {
layer->clsScene = this;
clsLayers.push_back(layer);
addItem(layer);
} // end method

} // end namespace
@@ -2,16 +2,34 @@
#define RSYN_GRAPHICS_SCENE_H

#include <QGraphicsScene>
#include <vector>

namespace Rsyn {

class GraphicsLayer;

class GraphicsScene : public QGraphicsScene {
public:

GraphicsScene(QObject *parent = nullptr);
~GraphicsScene();

virtual void drawBackground(QPainter *painter, const QRectF &rect) override;
virtual void drawForeground(QPainter *painter, const QRectF &rect) override;

//! @brief Adds a graphics layer to this graphics scene. The graphics scene
//! takes ownership of the graphics layer (i.e. it is responsible to delete
//! it).
void addLayer(GraphicsLayer *layer);

// temp for experimentation
bool clsHover = false;

private:


std::vector<GraphicsLayer *> clsLayers;

}; // end class

} // end namespace
Oops, something went wrong.

0 comments on commit 3e1ef23

Please sign in to comment.