use bitset to_string for column retrieval
This commit is contained in:
parent
dd3f85d1a1
commit
81ee548f7f
|
@ -619,7 +619,7 @@ void Model::updateSlot()
|
||||||
//go with first visible parent for now.
|
//go with first visible parent for now.
|
||||||
if (!(*theGraph)[currentParent].dagVisible)
|
if (!(*theGraph)[currentParent].dagVisible)
|
||||||
continue;
|
continue;
|
||||||
destinationColumn = static_cast<int>(std::log2((*theGraph)[currentParent].column.to_ulong()));
|
destinationColumn = static_cast<int>(columnFromMask((*theGraph)[currentParent].column));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -691,14 +691,15 @@ void Model::updateSlot()
|
||||||
Vertex target = boost::target(*it, *theGraph);
|
Vertex target = boost::target(*it, *theGraph);
|
||||||
if (!(*theGraph)[target].dagVisible)
|
if (!(*theGraph)[target].dagVisible)
|
||||||
continue; //we don't make it here if source isn't visible. So don't have to worry about that.
|
continue; //we don't make it here if source isn't visible. So don't have to worry about that.
|
||||||
float dependentX = pointSpacing * static_cast<int>(std::log2((*theGraph)[target].column.to_ulong())) + pointSize / 2.0; //on center.
|
float dependentX = pointSpacing * static_cast<int>(columnFromMask((*theGraph)[target].column)) + pointSize / 2.0; //on center.
|
||||||
|
columnFromMask((*theGraph)[target].column);
|
||||||
float dependentY = rowHeight * (*theGraph)[target].row + rowHeight / 2.0;
|
float dependentY = rowHeight * (*theGraph)[target].row + rowHeight / 2.0;
|
||||||
|
|
||||||
QGraphicsPathItem *pathItem = (*theGraph)[*it].connector.get();
|
QGraphicsPathItem *pathItem = (*theGraph)[*it].connector.get();
|
||||||
pathItem->setBrush(Qt::NoBrush);
|
pathItem->setBrush(Qt::NoBrush);
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.moveTo(currentX, currentY);
|
path.moveTo(currentX, currentY);
|
||||||
if (currentColumn == static_cast<int>(std::log2((*theGraph)[target].column.to_ulong())))
|
if (currentColumn == static_cast<int>(columnFromMask((*theGraph)[target].column)))
|
||||||
path.lineTo(currentX, dependentY); //straight connector in y.
|
path.lineTo(currentX, dependentY); //straight connector in y.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -882,6 +883,12 @@ void Model::updateStates()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t Model::columnFromMask(const ColumnMask &maskIn)
|
||||||
|
{
|
||||||
|
std::string maskString = maskIn.to_string();
|
||||||
|
return maskString.size() - maskString.find("1") - 1;
|
||||||
|
}
|
||||||
|
|
||||||
RectItem* Model::getRectFromPosition(const QPointF& position)
|
RectItem* Model::getRectFromPosition(const QPointF& position)
|
||||||
{
|
{
|
||||||
RectItem *rect = nullptr;
|
RectItem *rect = nullptr;
|
||||||
|
|
|
@ -111,6 +111,7 @@ namespace Gui
|
||||||
void addVertexItemsToScene(const Vertex &vertexIn);
|
void addVertexItemsToScene(const Vertex &vertexIn);
|
||||||
void removeVertexItemsFromScene(const Vertex &vertexIn);
|
void removeVertexItemsFromScene(const Vertex &vertexIn);
|
||||||
void updateStates();
|
void updateStates();
|
||||||
|
std::size_t columnFromMask(const ColumnMask&);
|
||||||
|
|
||||||
RectItem* getRectFromPosition(const QPointF &position); //!< can be nullptr
|
RectItem* getRectFromPosition(const QPointF &position); //!< can be nullptr
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user