DCCommitAddAxonTerminalCommand::DCCommitAddAxonTerminalCommand(const void *requester, DCCreator *creator, DCCell *axonCell, DCReceptor *receptor)
: DCCommand(requester, creator), d_axonCell(axonCell), d_receptor(receptor), d_receptorName(""), d_isAdded(false)
{
- d_receptorCell = dynamic_cast<DCCell*>(d_receptor->getOwnerCell());
+ d_receptorCell = d_receptor->getOwnerCell();
}
void DCCommitAddAxonTerminalCommand::redo()
DCReceptor *receptor = d_receptorCell->getReceptor(d_receptorName);
if (axon && receptor)
{
- DCAxonTerminal *terminal = dynamic_cast<DCAxonTerminal*>(receptor->getTarget());
+ DCAxonTerminal *terminal = receptor->getTarget();
d_receptorCell->removeReceptor(d_receptorName);
axon->removeAxonTerminal(terminal);
}
{
DCAxon *axon = dynamic_cast <DCAxon*>(d_axonCell->getAxon());
QString receptorName = QString::fromStdString(d_receptorCell->getReceptorName(d_receptor));
- DCAxonTerminal *terminal = dynamic_cast<DCAxonTerminal*>(d_receptor->getTarget());
+ DCAxonTerminal *terminal = d_receptor->getTarget();
d_receptorCell->removeReceptor(receptorName);
axon->removeAxonTerminal(terminal);
if (d_axonTerminal)
{
//delete from axon terminal
- DCReceptor *receptor = dynamic_cast<DCReceptor*>(d_axonTerminal->getTarget());
+ DCReceptor *receptor = d_axonTerminal->getTarget();
DCAxon *axon = dynamic_cast <DCAxon*>(d_axonTerminal->getOwner());
if (receptor && axon)
{
- DCCell *targetCell = dynamic_cast<DCCell*>(receptor->getOwnerCell());
+ DCCell *targetCell = receptor->getOwnerCell();
QString receptorName = QString::fromStdString(targetCell->getReceptorName(receptor));
d_isDeleted = targetCell->removeReceptor(receptorName);
if (d_isDeleted)
{
//delete from receptor name
DCReceptor *receptor = d_cell->getReceptor(d_receptorName);
- DCAxonTerminal *terminal = dynamic_cast<DCAxonTerminal*>(receptor->getTarget());
+ DCAxonTerminal *terminal = receptor->getTarget();
DCAxon *axon = dynamic_cast<DCAxon*>(terminal->getOwner());
d_isDeleted = d_cell->removeReceptor(d_receptorName);
if (d_isDeleted)
#include "dcvcomponent.h"
#include "dcaxon.h"
+#include "dcreceptor.h"
DCAxonTerminal::DCAxonTerminal(DCAxon *theOwner) : TKAxonTerminal(theOwner), mVComponent(NULL),
mIsViewReceptorPointUpdated(false), mIsViewAxonPointUpdated(false)
}
}
+DCReceptor* DCAxonTerminal::getTarget() const
+{
+ return dynamic_cast<DCReceptor*>(mTarget);
+}
+
void DCAxonTerminal::setViewMatrixForAxonPoint(const float matrix[])
{
for (int i = 0; i < 16; i++)
class DCAxon;
class DCVCAxonTerminal;
class DCVComponent;
+class DCReceptor;
class DCAxonTerminal : public TKAxonTerminal
{
public:
virtual ~DCAxonTerminal();
+ DCReceptor* getTarget() const;
DCVComponent* getVComponent() const { return mVComponent; }
bool getIsViewAxonPointUpdated() const { return mIsViewAxonPointUpdated; }
bool getIsViewReceptorPointUpdated() const { return mIsViewReceptorPointUpdated; }
while(it != mReceptors.end())
{
DCReceptor *receptor = dynamic_cast<DCReceptor*>(it->second);
- DCAxonTerminal *terminal = dynamic_cast<DCAxonTerminal*>(receptor->getTarget());
+ DCAxonTerminal *terminal = receptor->getTarget();
if (terminal)
{
DCAxon *receptorTargetCellAxon = dynamic_cast<DCAxon*>(terminal->getOwner());
for (int i = 0; i < axon->getNumberOfTerminals(); i++)
{
DCAxonTerminal *terminal = axon->getTerminalAt(i);
- DCReceptor *axonTargetReceptor = dynamic_cast<DCReceptor*>(terminal->getTarget());
- DCCell *axonTargetCell = dynamic_cast<DCCell*>(axonTargetReceptor->getOwnerCell());
+ DCReceptor *axonTargetReceptor = terminal->getTarget();
+ DCCell *axonTargetCell = axonTargetReceptor->getOwnerCell();
if (axonTargetCell)
{
axonTargetCell->removeReceptor(axonTargetReceptor);
virtual bool doDestroy() {return false;}
virtual bool setCellCode(TKCellCode *code, const void *data);
+ std::string getLocation() const { return mLocation; }
DCVPageComponent * getVComponent() const { return d_vComponent; }
DCVCPage* getPageBelonging() const;
DCCellCode* getCellCode() const { return d_cellCode; }
{
QMutexLocker(d_scene->getSceneLock());
- TKCell *cell = TKContainer::addCell(theLocation, theName, type, customScript);
+ DCCell *cell = dynamic_cast<DCCell*>(TKContainer::addCell(theLocation, theName, type, customScript));
saveCustomScriptToWorkFile(cell, customScript);
{
QMutexLocker(d_scene->getSceneLock());
- TKCell *cell = TKContainer::addCell(theLocation, theName, cellCode, customScript);
+ DCCell *cell = dynamic_cast<DCCell*>(TKContainer::addCell(theLocation, theName, cellCode, customScript));
saveCustomScriptToWorkFile(cell, customScript);
{
QMutexLocker(d_scene->getSceneLock());
- TKCellCode *cellCode = TKContainer::addCellCode(theName, theAPIType, code);
+ DCCellCode *cellCode = dynamic_cast<DCCellCode*>(TKContainer::addCellCode(theName, theAPIType, code));
saveClassScriptToWorkFile(cellCode, code);
return false;
}
-bool DCContainer::saveCustomScriptToWorkFile(TKCell *cell, std::string customScript)
+bool DCContainer::saveCustomScriptToWorkFile(DCCell *cell, std::string customScript)
{
QDir workdir(d_workDirCellRoot + "/" + QString::fromStdString(cell->getLocation()));
if (!workdir.exists())
return true;
}
-bool DCContainer::saveClassScriptToWorkFile(TKCellCode *cellCode, std::string code)
+bool DCContainer::saveClassScriptToWorkFile(DCCellCode *cellCode, std::string code)
{
QString qNamePath = QString::fromStdString(cellCode->getFQNName());
QString path = DCUtil::getContainerBasedPathFromFQNPath(qNamePath);
void beganBuildContainer();
void endedBuildContainer();
- bool saveCustomScriptToWorkFile(TKCell *cell, std::string customScript);
- bool saveClassScriptToWorkFile(TKCellCode *cellCode, std::string code);
+ bool saveCustomScriptToWorkFile(DCCell *cell, std::string customScript);
+ bool saveClassScriptToWorkFile(DCCellCode *cellCode, std::string code);
QString sysFilePathToContainerBasedPath(const QString& sysFilePath);
QString containerBasedPathToSysFilePath(const QString& containerBasedPath);
for (int j = 0; j < axon->getNumberOfTerminals(); j++)
{
DCAxonTerminal *terminal = axon->getTerminalAt(j);
- DCReceptor *receptor = dynamic_cast<DCReceptor*>(terminal->getTarget());
+ DCReceptor *receptor = terminal->getTarget();
if (receptor)
{
- DCCell *targetCell = dynamic_cast<DCCell*>(receptor->getOwnerCell());
+ DCCell *targetCell = receptor->getOwnerCell();
if (targetCell)
{
QString connectionPath = QString::fromStdString(targetCell->getLocation());
void DCCreator::doCommandRemoveAxonTerminal(const void *requester, DCCell *axonCell, DCAxonTerminal *axonTerminal)
{
- DCReceptor *receptor = dynamic_cast<DCReceptor*>(axonTerminal->getTarget());
+ DCReceptor *receptor = axonTerminal->getTarget();
if (!receptor)
return;
- DCCell *targetCell = dynamic_cast<DCCell*>(receptor->getOwnerCell());
+ DCCell *targetCell = receptor->getOwnerCell();
if (!targetCell)
return;
#include "dccell.h"
#include "dcvceditmodecursor.h"
#include "dcvceditmodeterminal.h"
+#include "dcaxonterminal.h"
DCReceptor::DCReceptor(DCCell *owner) : TKReceptor(owner), d_vComponent(NULL), d_isTerminalVisible(true), d_editCursor(NULL)
{
}
}
+DCAxonTerminal* DCReceptor::getTarget() const
+{
+ return dynamic_cast<DCAxonTerminal*>(mTerminal);
+}
+
+DCCell* DCReceptor::getOwnerCell() const
+{
+ return dynamic_cast<DCCell*>(mOwner);
+}
+
DCVComponent* DCReceptor::getVComponent() const
{
return d_vComponent;
*y = 0;
*z = 0;
- DCCell *cell = dynamic_cast<DCCell*>(getOwnerCell());
+ DCCell *cell = getOwnerCell();
if (cell)
{
float cx,cz;
class DCVCReceptor;
class DCVComponent;
class DCVCEditModeCursor;
+class DCAxonTerminal;
class DCReceptor : public TKReceptor
{
public:
virtual ~DCReceptor();
+ DCAxonTerminal* getTarget() const;
+ DCCell* getOwnerCell() const;
DCVComponent* getVComponent() const;
void getViewReceptorOffsetPoint(float dx, float dy, float dz,float *x, float *y, float *z) const;
bool getIsTerminalVisible() const { return d_isTerminalVisible; }
TKAxonTerminal(TKAxon *theOwner) : mOwner(theOwner), mTarget(0) {}
virtual ~TKAxonTerminal() {}
- void setTarget(TKReceptor *theReceptor) {mTarget = theReceptor;}
- void release(TKReceptor *receptor);
+ void setTarget(TKReceptor *theReceptor) {mTarget = theReceptor;}
+ void release(TKReceptor *receptor);
- bool isConnected() { return mTarget != 0; }
- TKAxon* getOwner() { return mOwner; }
- TKReceptor* getTarget() { return mTarget; }
- float getValue();
+ bool isConnected() { return mTarget != 0; }
+ TKAxon* getOwner() { return mOwner; }
+ float getValue();
-private:
+protected:
TKAxon *mOwner;
TKReceptor *mTarget;
void init();
std::string getName() const { return mName; }
- std::string getLocation() const { return mLocation; }
-
float getAxonValue() const;
void setAxonValue(float value);
TKReceptor(TKCell *theOwner) : mOwner(theOwner), mTerminal(0) {}
virtual ~TKReceptor() {}
- void setTarget(TKAxonTerminal *theTerminal);
- TKAxonTerminal* getTarget() const { return mTerminal; }
- TKCell* getOwnerCell() const { return mOwner; }
-
- float getValue();
+ void setTarget(TKAxonTerminal *theTerminal);
+ float getValue();
-private:
+protected:
TKCell *mOwner;
TKAxonTerminal *mTerminal;
};
const TKReceptorMap *receptors = cell->getReceptors();
for ( TKReceptorMap::const_iterator it = receptors->begin(); it != receptors->end(); ++it )
{
- TKReceptor *receptor = it->second;
+ DCReceptor *receptor = dynamic_cast<DCReceptor*>(it->second);
if ( receptor && receptor->getTarget() && ((DCCell*)receptor->getTarget()->getOwner()->getOwner())->getVComponent()->getIsSelected())
{
r = true;
float receptorY = receptorPointMatrix[13];
float receptorZ = receptorPointMatrix[14];
- DCReceptor *receptor = dynamic_cast<DCReceptor*>(d_owner->getTarget());
+ DCReceptor *receptor = d_owner->getTarget();
if (receptor)
{
float ox,oy,oz;
DCVComponent::DCVVisibility DCVCAxonTerminal::getIsVisible() const
{
DCAxon *axon = (DCAxon*)d_owner->getOwner();
- DCReceptor *receptor = (DCReceptor*)d_owner->getTarget();
+ DCReceptor *receptor = d_owner->getTarget();
return ((axon && axon->getIsTerminalVisible()) || (receptor && receptor->getIsTerminalVisible())) ?
DCV_VISIBLE_FULL : DCV_VISIBLE_NONE;
}
DCVComponent* DCVCAxonTerminal::getReceptorComponent() const
{
- DCReceptor *receptor = (DCReceptor*)d_owner->getTarget();
+ DCReceptor *receptor = d_owner->getTarget();
if (receptor)
{
return receptor->getVComponent();
}
d_ownerReceptor = owner;
- d_ownerCell = dynamic_cast<DCCell*>(owner->getOwnerCell());
+ d_ownerCell = owner->getOwnerCell();
if (d_ownerReceptor && d_ownerCell)
{
d_cursorType = DCV_CURSOR_FROM_RECEPTAOR;
DCVComponent *vterminal = getTerminalComponent();
if (vterminal)
{
- ((DCAxonTerminal*)d_owner->getTarget())->setViewMatrixForReceptorPoint(matrix);
+ d_owner->getTarget()->setViewMatrixForReceptorPoint(matrix);
vterminal->prepareForDraw(isAnimationInterval);
}
if (d_owner->hasEditCursor())
DCVComponent* DCVCReceptor::getTerminalComponent() const
{
- DCAxonTerminal *terminal = (DCAxonTerminal*)d_owner->getTarget();
+ DCAxonTerminal *terminal = d_owner->getTarget();
if (terminal)
{
return terminal->getVComponent();
DCCell* DCVCReceptor::getOwnerCell() const
{
- return dynamic_cast<DCCell*>(d_owner->getOwnerCell());
+ return d_owner->getOwnerCell();
}
DCVCPage* DCVCReceptor::getPageBelonging() const
if (d_terminalFromReceptorToolWindow)
{
DCReceptor *receptor = d_scene->getEditReceptor();
- if (receptor)
- d_terminalFromReceptorToolWindow->updateData(dynamic_cast<DCCell*>(receptor->getOwnerCell()),
+ if (receptor)
+ d_terminalFromReceptorToolWindow->updateData(receptor->getOwnerCell(),
receptor,
d_scene->getTerminalEditCursorLocationString(),
d_scene->getTerminalEditCursorDropTarget() ? d_scene->getTerminalEditCursorDropTarget()->getOwnerCell() : NULL);
d_draggedObject.ref()->setSelectable(false);
DCVComponent *obj = getView()->getObjectAt(mousePos.x(), mousePos.y());
d_draggedObject.ref()->setSelectable(true);
- DCCell *cell = dynamic_cast<DCCell*>(d_editReceptor->getOwnerCell());
+ DCCell *cell = d_editReceptor->getOwnerCell();
if (d_cursor->getDropTarget() && d_cursor->getDropTarget() != obj)
{
DCAxonTerminal *tarminal = axon->getTerminalAt(i);
if (tarminal)
{
- targetReceptor = dynamic_cast<DCReceptor*>(tarminal->getTarget());
+ targetReceptor = tarminal->getTarget();
if (targetReceptor)
{
- targetCell = dynamic_cast<DCCell*>(targetReceptor->getOwnerCell());
+ targetCell = targetReceptor->getOwnerCell();
}
}
QString axonTerminalName;
int num = axon->getNumberOfTerminals();
for (int i = 0; i < num; i++)
{
- DCReceptor *receptor = dynamic_cast<DCReceptor*>(axon->getTerminalAt(i)->getTarget());
+ DCReceptor *receptor = axon->getTerminalAt(i)->getTarget();
if (receptor)
{
- DCCell *targetCell = dynamic_cast<DCCell*>(receptor->getOwnerCell());
+ DCCell *targetCell = receptor->getOwnerCell();
if (targetCell)
{
QString targetReceptorName = QString::fromStdString(targetCell->getReceptorName(receptor));
d_receptorItemModel->insertString(receptorName,rroot);
d_receptorItemModel->setData(rroot.child(i,2), QVariant::fromValue(DCResources::deleteItemIcon()));
- TKReceptor *receptor = (*it).second;
- TKAxonTerminal *terminal = receptor->getTarget();
+ DCReceptor *receptor = dynamic_cast<DCReceptor*>((*it).second);
+ DCAxonTerminal *terminal = receptor->getTarget();
if (terminal)
{
- TKCell *targetCell = terminal->getOwner()->getOwner();
+ DCCell *targetCell = dynamic_cast<DCCell*>(terminal->getOwner()->getOwner());
if (targetCell)
{
QString targetPath = DCUtil::getFQNPath(targetCell->getLocation(), targetCell->getName());
DCAxonTerminal *tarminal = axon->getTerminalAt(i);
if (tarminal)
{
- targetReceptor = dynamic_cast<DCReceptor*>(tarminal->getTarget());
+ targetReceptor = tarminal->getTarget();
if (targetReceptor)
{
- targetCell = dynamic_cast<DCCell*>(targetReceptor->getOwnerCell());
+ targetCell = targetReceptor->getOwnerCell();
}
}