X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/cfe8322b50c9ef08ffbc3e52b0849bca4cd1d0bf..8fb3c55ee009a11db5e1c08a4cfb286979412745:/AbstractBoxItem.cpp diff --git a/AbstractBoxItem.cpp b/AbstractBoxItem.cpp index 925cd6f..7912813 100644 --- a/AbstractBoxItem.cpp +++ b/AbstractBoxItem.cpp @@ -12,11 +12,17 @@ #include "AbstractInterface.h" #include "ConnectedInterface.h" +int AbstractBoxItem::NoLock = 0; +int AbstractBoxItem::Position = 1; +int AbstractBoxItem::Dimension = 2; +int AbstractBoxItem::Interfaces = 4; +int AbstractBoxItem::Names = 8; -AbstractBoxItem:: AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem *parent) : QGraphicsItem(parent) { +AbstractBoxItem::AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params, int _lock, QGraphicsItem *parent) : QGraphicsItem(parent) { dispatcher = _dispatcher; params = _params; refBlock = _refBlock; + lock = _lock; QFontMetrics fmId(params->defaultBlockFont); nameWidth = fmId.width(refBlock->getName()); nameHeight = fmId.height(); @@ -43,10 +49,11 @@ AbstractBoxItem:: AbstractBoxItem(AbstractBlock *_refBlock, Dispatcher *_dispat // NOTE : initInterfaces() is only called in subclasses } -AbstractBoxItem::AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, QGraphicsItem* parent) : QGraphicsItem(parent) { +AbstractBoxItem::AbstractBoxItem(Dispatcher *_dispatcher, Parameters *_params, int _lock, QGraphicsItem* parent) : QGraphicsItem(parent) { dispatcher = _dispatcher; - params = _params; + params = _params; refBlock = NULL; + lock = _lock; nameWidth = 0; nameHeight = 0; nameMargin = 10; @@ -87,7 +94,7 @@ bool AbstractBoxItem::isGroupItem() { return false; } -bool AbstractBoxItem::isSourceItem() { +bool AbstractBoxItem::isStimuliItem() { return false; } @@ -128,7 +135,7 @@ void AbstractBoxItem::setRefBlock(AbstractBlock* _refBlock) { nameHeight = fmId.height(); } -void AbstractBoxItem::initInterfaceItems() { +void AbstractBoxItem::createInterfaceItems(Parameters::Direction posInputs, Parameters::Direction posOutputs, Parameters::Direction posBidirs) { /* TO DO : creating all needed InterfaceItem, with by default, input at west and output at east */ int orientation = Parameters::West; @@ -139,11 +146,11 @@ void AbstractBoxItem::initInterfaceItems() { if (inter->getPurpose() != AbstractInterface::Control) { InterfaceItem *item; if(inter->getDirection() == AbstractInterface::Input){ - orientation = Parameters::West; + orientation = posInputs; } else if(inter->getDirection() == AbstractInterface::Output){ - orientation = Parameters::East; + orientation = posOutputs; } else if(inter->getDirection() == AbstractInterface::InOut){ - orientation = Parameters::North; + orientation = posBidirs; } item = new InterfaceItem(0.0 , orientation, (ConnectedInterface *)inter, this, params); interfaces.append(item); @@ -295,7 +302,7 @@ QRectF AbstractBoxItem::boundingRectInScene() { */ bool AbstractBoxItem::isInterfaces(int orientation) const { foreach(InterfaceItem* inter, interfaces) { - if (inter->getOrientation() == orientation) return true; + if ((inter->visible) && (inter->getOrientation() == orientation)) return true; } return false; }