fix topology info update
This commit is contained in:
parent
df8de12160
commit
660a7649c9
|
|
@ -58,6 +58,7 @@ signals:
|
|||
|
||||
void updateMonitorTopology(QList<QUuid>);
|
||||
void pannelSelected(QString sPanel,int nType); //界面选择信号,名称,类型(0:editor)
|
||||
void clearTopology();
|
||||
public slots:
|
||||
void onSignal_addDrawingPanel(PowerEntity* p,DiagramMode = DM_edit,QString parent = QString()); //parent:派生运行时的page
|
||||
void onSignal_addGraphicsItem(ModelStateInfo&);
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public:
|
|||
void prepareSaveEditor(); //准备保存
|
||||
void loadBaseSetting(QUuid);
|
||||
void activePreview(); //激活预览
|
||||
void emitTopologySignals(); //发送拓扑数据
|
||||
public slots:
|
||||
void onWidthChanged(int width);
|
||||
void onContainerSizeChanged(EditContainerItem*); //容器大小改变时调整内部大小
|
||||
|
|
@ -80,7 +81,6 @@ private:
|
|||
void processNormalContainerLevel(int level, const QList<ContainerDataPtr>& containers,LayoutBuilder& builder);
|
||||
void processTransformerLevel(const QList<ContainerDataPtr>& containers);
|
||||
void finalizeConstruction();
|
||||
void emitTopologySignals();
|
||||
signals:
|
||||
void panelDelete(const QString&,int);
|
||||
void previewSelected(EditPanel*); //预览选中事件
|
||||
|
|
@ -98,8 +98,6 @@ private:
|
|||
int _maxWidth;
|
||||
int _maxHeight;
|
||||
QList<EditRowData*> _lstData;
|
||||
QList<HierarchyItem> _accumulatedBayItems;
|
||||
QList<HierarchyItem> _accumulatedDeviceItems;
|
||||
QMap<int,QMap<int,EditContainerItem*>> _mapStruct;
|
||||
DiagramEditorModel* _pModel;
|
||||
DiagramEditorPreviewDlg* _pPreview;
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ public:
|
|||
|
||||
QByteArray getWizardInfo(); //返回二进制wizard设置
|
||||
void setWizardInfo(const QByteArray&); //二进制设置wizard
|
||||
void updateTolology(); //更新拓扑列表
|
||||
signals:
|
||||
void updateTopologyItems(QList<HierarchyItem>,bool,bool); //更新当前拓扑列表 <连接关系,是否刷新,显示全部层级>
|
||||
private:
|
||||
|
|
@ -94,5 +95,7 @@ private:
|
|||
EditPanel* _pPanel; //主界面
|
||||
QPointer<DiagramEditorWizard> _pWizard; //向导界面数据
|
||||
int _cableCount; //导线计数
|
||||
QList<HierarchyItem> _lstBay; //间隔层级信息
|
||||
QList<HierarchyItem> _lstItem; //item层级信息
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ public:
|
|||
void startHttpRequest(); //开始请求数据(运行时)
|
||||
void setCavas(QPointer<DiagramCavas> p) {_cavas = p;} //设置所属顶层容器
|
||||
DiagramCavas* getCavas();
|
||||
void updateTopologyLst(); //更新拓扑列表
|
||||
|
||||
QMap<QUuid,GraphicsProjectModelItem*> getProjectItems(){return _nodeItem;}
|
||||
QMap<QUuid,GraphicsBaseModelItem*> getBaseModelItems(){return _baseItem;}
|
||||
|
|
|
|||
|
|
@ -307,6 +307,7 @@ void DiagramCavas::onSignal_loadPage(PowerEntity* p)
|
|||
else //已存在
|
||||
{
|
||||
m_mapDrawPanel[p->name()].first->show();
|
||||
m_mapDrawPanel[p->name()].first->getModelController()->updateTopologyLst();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -324,6 +325,7 @@ void DiagramCavas::onSignal_loadEdit(const QString& sProject,QUuid uid)
|
|||
m_mapEditPanel[sProject].first->show();
|
||||
m_mapEditPanel[sProject].first->activePreview();
|
||||
setActiveSubWindow(m_mapEditPanel[sProject].second);
|
||||
m_mapEditPanel[sProject].first->emitTopologySignals();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -407,6 +409,7 @@ void DiagramCavas::onSignal_panelDelete(const QString& name,int nType)
|
|||
delete pPanel;
|
||||
}
|
||||
calculateLauncherVisible();
|
||||
emit clearTopology();
|
||||
}
|
||||
|
||||
void DiagramCavas::onSignal_createEntity(EntityInfo info)
|
||||
|
|
@ -715,6 +718,7 @@ void DiagramCavas::onSignal_wizardFinished(QString sName,QMap<QUuid,GraphicsBase
|
|||
|
||||
void DiagramCavas::onSignal_unloadProject(const QString& sName)
|
||||
{
|
||||
emit clearTopology();
|
||||
BasePropertyManager::instance().clearEditorData();
|
||||
|
||||
for(auto &pair:m_mapEditPanel){
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void EditBusItem::setGeometry(const QRectF &rect)
|
|||
void EditBusItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
||||
{
|
||||
painter->fillRect(m_boundingRect,Qt::black);
|
||||
painter->drawText(QPointF(-10,0),sName);
|
||||
painter->drawText(QPointF(-10,-5),sName);
|
||||
}
|
||||
|
||||
/********************Bay*********************/
|
||||
|
|
@ -131,7 +131,7 @@ void EditBayItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* optio
|
|||
painter->setPen(QPen(m_normalColor, 2));
|
||||
}
|
||||
painter->drawRect(m_boundingRect);
|
||||
painter->drawText(QPointF(-10,0),sName);
|
||||
painter->drawText(QPointF(-10,-5),sName);
|
||||
|
||||
painter->setFont(QFont("Arial", 12));
|
||||
painter->setPen(Qt::cyan);
|
||||
|
|
|
|||
|
|
@ -465,6 +465,7 @@ void EditPanel::activePreview()
|
|||
if(_pPreview){
|
||||
_pPreview->raise();
|
||||
_pPreview->activateWindow();
|
||||
emitTopologySignals();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -482,8 +483,8 @@ void EditPanel::performCleanup() {
|
|||
// 清理数据
|
||||
qDeleteAll(_lstData);
|
||||
_lstData.clear();
|
||||
_accumulatedBayItems.clear();
|
||||
_accumulatedDeviceItems.clear();
|
||||
//_accumulatedBayItems.clear();
|
||||
//_accumulatedDeviceItems.clear();
|
||||
|
||||
// 清理主部件
|
||||
_mainWidget = nullptr;
|
||||
|
|
@ -553,8 +554,8 @@ void EditPanel::processNormalContainerLevel(int level,
|
|||
}
|
||||
|
||||
// 累积层级项
|
||||
_accumulatedBayItems.append(result.bayItems);
|
||||
_accumulatedDeviceItems.append(result.deviceItems);
|
||||
//_accumulatedBayItems.append(result.bayItems);
|
||||
//_accumulatedDeviceItems.append(result.deviceItems);
|
||||
}
|
||||
|
||||
// 保存行数据
|
||||
|
|
@ -594,8 +595,8 @@ void EditPanel::processTransformerLevel(const QList<ContainerDataPtr>& container
|
|||
rowLayout->addStretch();
|
||||
|
||||
// 累积变压器层级项
|
||||
_accumulatedBayItems.append(result.bayItems);
|
||||
_accumulatedDeviceItems.append(result.deviceItems);
|
||||
//_accumulatedBayItems.append(result.bayItems);
|
||||
//_accumulatedDeviceItems.append(result.deviceItems);
|
||||
}
|
||||
|
||||
// 插入变压器行(在层级0之后)
|
||||
|
|
@ -618,19 +619,13 @@ void EditPanel::finalizeConstruction() {
|
|||
_widgetLayout->addStretch();
|
||||
|
||||
// 发射拓扑更新信号
|
||||
emitTopologySignals();
|
||||
//emitTopologySignals();
|
||||
|
||||
// 延迟初始化连接
|
||||
QTimer::singleShot(300, this, &EditPanel::initBlockConnection);
|
||||
}
|
||||
|
||||
void EditPanel::emitTopologySignals() {
|
||||
if (_pModel) {
|
||||
emit _pModel->updateTopologyItems(_accumulatedBayItems, true, false);
|
||||
emit _pModel->updateTopologyItems(_accumulatedDeviceItems, false, false);
|
||||
}
|
||||
|
||||
// 清空累积的数据
|
||||
_accumulatedBayItems.clear();
|
||||
_accumulatedDeviceItems.clear();
|
||||
if (_pModel)
|
||||
_pModel->updateTolology();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -940,7 +940,7 @@ QMap<int, QList<QString>> DiagramLayoutEngine::getCommonDirectionNode(QMap<QStri
|
|||
|
||||
void DiagramLayoutEngine::updateConfilicNode(QMap<QString, DiagramEditorRouteInfo>& routes,Context& context,const LayoutConfig& config,QMap<int, QList<QString>> directionToNames)
|
||||
{
|
||||
QMap<int, QList<QPair<QString, QString>>> directionConflicts;
|
||||
QMap<int, QList<QPair<QString, QString>>> directionConflicts; //key:占用方向分支 value:first→占用方向相同的设备 second→ 共线lstMain中设备
|
||||
QList<QString> lstMain; //主线设备
|
||||
QMap<QString,QList<QString>> mapSub; //支线设备
|
||||
for(auto& route:routes){
|
||||
|
|
@ -1001,10 +1001,23 @@ void DiagramLayoutEngine::updateConfilicNode(QMap<QString, DiagramEditorRouteInf
|
|||
}
|
||||
|
||||
if(!directionConflicts.isEmpty()){
|
||||
const QString lastMainDev = lstMain.last();
|
||||
for(auto& lstPair:directionConflicts){
|
||||
if(lstPair.size() > 1){ //默认处理倒数第2个
|
||||
QString sObj = lstPair[lstPair.size()-2].first;
|
||||
relayoutTargetRoute(sObj,routes,context,config);
|
||||
QPair<QString, QString> targetPair;
|
||||
|
||||
for (const auto& pair : lstPair)
|
||||
{
|
||||
if (pair.second != lastMainDev)
|
||||
{
|
||||
targetPair = pair;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果找到了,才处理
|
||||
if (!targetPair.first.isEmpty())
|
||||
{
|
||||
relayoutTargetRoute(targetPair.first,routes,context,config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,107 +221,8 @@ void DrawingPanel::loadNodes(QJsonObject obj)
|
|||
}
|
||||
}
|
||||
|
||||
if(_pModel){
|
||||
QString sG;
|
||||
QString sZ;
|
||||
QString sS;
|
||||
for(auto& pBaseItem:_pModel->getProjectItems()) //取grid_zone_station(间隔不含这些内容)
|
||||
{
|
||||
BaseProperty* pBase = dynamic_cast<BaseProperty*>(pBaseItem->getProperty());
|
||||
if(sG.isEmpty())
|
||||
sG = pBase->grid();
|
||||
if(sZ.isEmpty())
|
||||
sZ = pBase->zone();
|
||||
if(sS.isEmpty())
|
||||
sS = pBase->station();
|
||||
break;
|
||||
}
|
||||
|
||||
QList<HierarchyItem> lstFirst;
|
||||
|
||||
for(auto& pOtherItem:_pModel->getProjectBayItems())
|
||||
{
|
||||
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||
if(pBay){
|
||||
// 创建间隔项
|
||||
HierarchyItem bayInfo;
|
||||
bayInfo.item.nEquipType = 0; // 间隔的设备类型为0
|
||||
bayInfo.item.nCategory = 1; // 类别为1表示间隔
|
||||
bayInfo.item.sName = pBay->tag();
|
||||
bayInfo.item.uid = pBay->uuid();
|
||||
bayInfo.item.sVoltageLevel = QString::number(pBay->getVoltage());
|
||||
bayInfo.item.grid = sG;
|
||||
bayInfo.item.zone = sZ;
|
||||
bayInfo.item.station = sS;
|
||||
|
||||
lstFirst.append(bayInfo);
|
||||
}
|
||||
}
|
||||
|
||||
emit _pModel->updateCurrentItems(lstFirst, true);
|
||||
emit _pModel->updateTopologyItems(lstFirst, true,true);
|
||||
|
||||
// 第二阶段:处理所有设备
|
||||
QList<HierarchyItem> lstSecond;
|
||||
|
||||
// 建立间隔UUID到间隔标签的映射,提高查找效率
|
||||
QHash<QString, QString> bayUuidToTag;
|
||||
for(auto& pOtherItem:_pModel->getProjectBayItems())
|
||||
{
|
||||
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||
if(pBay){
|
||||
bayUuidToTag[pBay->uuid().toString()] = pBay->tag();
|
||||
}
|
||||
}
|
||||
|
||||
for(auto& pBaseItem:_pModel->getProjectItems())
|
||||
{
|
||||
BaseProperty* pBase = dynamic_cast<BaseProperty*>(pBaseItem->getProperty());
|
||||
|
||||
HierarchyItem info;
|
||||
info.item.nEquipType = pBase->type();
|
||||
info.item.nCategory = 0; // 类别为0表示设备
|
||||
info.item.sName = pBase->name();
|
||||
info.item.uid = pBase->uuid();
|
||||
|
||||
// 查找设备所属的间隔
|
||||
QString bayTag;
|
||||
QString bayUuid;
|
||||
QString sVoltage;
|
||||
|
||||
// 通过间隔标签直接查找
|
||||
bayTag = pBase->getBay();
|
||||
|
||||
// 如果需要间隔UUID,可以反向查找
|
||||
if(!bayTag.isEmpty()){
|
||||
for(auto& pOtherItem:_pModel->getProjectBayItems()){
|
||||
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||
if(pBay && pBay->tag() == bayTag){
|
||||
bayUuid = pBay->uuid().toString();
|
||||
sVoltage = QString::number(pBay->getVoltage());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!bayTag.isEmpty()){
|
||||
// 设置父间隔信息
|
||||
info.parent.nEquipType = 0;
|
||||
info.parent.nCategory = 1;
|
||||
info.parent.sName = bayTag;
|
||||
info.parent.uid = QUuid(bayUuid);
|
||||
info.parent.sVoltageLevel = sVoltage;
|
||||
info.parent.grid = sG;
|
||||
info.parent.zone = sZ;
|
||||
info.parent.station = sS;
|
||||
}
|
||||
|
||||
lstSecond.append(info);
|
||||
}
|
||||
|
||||
emit _pModel->updateCurrentItems(lstSecond, false);
|
||||
emit _pModel->updateTopologyItems(lstSecond, false,true);
|
||||
}
|
||||
if(_pModel)
|
||||
_pModel->updateTopologyLst();
|
||||
}
|
||||
|
||||
void DrawingPanel::saveNodes(int pageId)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ GraphicsBaseModelItem* DiagramEditorModel::generateComponent(QUuid uid,QString s
|
|||
QByteArray byte;
|
||||
if(nType == 1){ //母线
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon;
|
||||
auto pBus = new ElectricBaseModelSvgBus(QRect(-200, -3, 400, 6));
|
||||
auto pBus = new ElectricBaseModelSvgBus(QRect(-200, -2, 400, 4));
|
||||
pBus->loadSvg(byte);
|
||||
pItem = pBus;
|
||||
pItem->setItemType(GIT_baseBus);
|
||||
|
|
@ -254,7 +254,7 @@ GraphicsBaseModelItem* DiagramEditorModel::generateComponent(QUuid uid,QString s
|
|||
else if(nType == 13){ //电缆出线套筒
|
||||
|
||||
byte = DataBase::GetInstance()->ModelType()[nType].icon;
|
||||
auto pCableTer = new ElectricBaseModelSvgItem(QRect(-10, -10, 20, 20));
|
||||
auto pCableTer = new ElectricBaseModelSvgItem(QRect(-15, -15, 30, 30));
|
||||
pCableTer->loadSvg(byte);
|
||||
pItem = pCableTer;
|
||||
pItem->setItemType(GIT_baseCableTer);
|
||||
|
|
@ -340,6 +340,7 @@ GraphicsBaseModelItem* DiagramEditorModel::generateComponent(QUuid uid,QString s
|
|||
addPreviewItem(uid,pItem,mode);
|
||||
_pCurPreviewScene->addItem(pItem);
|
||||
pItem->setPos(pos);
|
||||
pItem->setSelected(false);
|
||||
}
|
||||
return pItem;
|
||||
}
|
||||
|
|
@ -793,6 +794,8 @@ void DiagramEditorModel::generatePreview(bool bVisible)
|
|||
}
|
||||
emit updateTopologyItems(lstBay,true,false);
|
||||
emit updateTopologyItems(lstItem,false,false);
|
||||
_lstBay = lstBay;
|
||||
_lstItem = lstItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -936,6 +939,12 @@ void DiagramEditorModel::refreshConnection()
|
|||
}
|
||||
}
|
||||
}
|
||||
if(_pCurPreviewScene){
|
||||
for (QGraphicsItem *item : _pCurPreviewScene->items()) {
|
||||
item->setSelected(true);
|
||||
}
|
||||
_pCurPreviewScene->clearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void DiagramEditorModel::applyLayoutResult(const LayoutResult& result) {
|
||||
|
|
@ -1348,13 +1357,13 @@ void DiagramEditorModel::clearCompoDir(QMap<QString,DiagramEditorRouteInfo>& dat
|
|||
int nVal = pItemName->data().toInt();
|
||||
pItemName->setData(QString::number(0)); //在公用模型中更新设备方向占用(重要)
|
||||
//pItemName->setData(QPoint(0,0),Qt::UserRole+2); //设置相对位置
|
||||
pItemName->setData(0,Qt::UserRole+5); //旋转
|
||||
//pItemName->setData(0,Qt::UserRole+5); //旋转
|
||||
}
|
||||
}
|
||||
|
||||
for(auto &compoInfo:compos){
|
||||
compoInfo.nUsedDirection = 0;
|
||||
compoInfo.nRotate = 0;
|
||||
//compoInfo.nRotate = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2486,6 +2495,12 @@ void DiagramEditorModel::setWizardInfo(const QByteArray& btye)
|
|||
_pWizard->setPara(info);
|
||||
}
|
||||
|
||||
void DiagramEditorModel::updateTolology()
|
||||
{
|
||||
emit updateTopologyItems(_lstBay,true,false);
|
||||
emit updateTopologyItems(_lstItem,false,false);
|
||||
}
|
||||
|
||||
QByteArray DiagramEditorModel::serializeWizardData(const DiagramEditorProjectInfo &data)
|
||||
{
|
||||
QByteArray byteArray;
|
||||
|
|
|
|||
|
|
@ -1691,6 +1691,109 @@ DiagramCavas* FixedPortsModel::getCavas()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void FixedPortsModel::updateTopologyLst()
|
||||
{
|
||||
QString sG;
|
||||
QString sZ;
|
||||
QString sS;
|
||||
for(auto& pBaseItem:getProjectItems()) //取grid_zone_station(间隔不含这些内容)
|
||||
{
|
||||
BaseProperty* pBase = dynamic_cast<BaseProperty*>(pBaseItem->getProperty());
|
||||
if(sG.isEmpty())
|
||||
sG = pBase->grid();
|
||||
if(sZ.isEmpty())
|
||||
sZ = pBase->zone();
|
||||
if(sS.isEmpty())
|
||||
sS = pBase->station();
|
||||
break;
|
||||
}
|
||||
|
||||
QList<HierarchyItem> lstFirst;
|
||||
|
||||
for(auto& pOtherItem:getProjectBayItems())
|
||||
{
|
||||
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||
if(pBay){
|
||||
// 创建间隔项
|
||||
HierarchyItem bayInfo;
|
||||
bayInfo.item.nEquipType = 0; // 间隔的设备类型为0
|
||||
bayInfo.item.nCategory = 1; // 类别为1表示间隔
|
||||
bayInfo.item.sName = pBay->tag();
|
||||
bayInfo.item.uid = pBay->uuid();
|
||||
bayInfo.item.sVoltageLevel = QString::number(pBay->getVoltage());
|
||||
bayInfo.item.grid = sG;
|
||||
bayInfo.item.zone = sZ;
|
||||
bayInfo.item.station = sS;
|
||||
|
||||
lstFirst.append(bayInfo);
|
||||
}
|
||||
}
|
||||
|
||||
emit updateCurrentItems(lstFirst, true);
|
||||
emit updateTopologyItems(lstFirst, true,true);
|
||||
|
||||
// 第二阶段:处理所有设备
|
||||
QList<HierarchyItem> lstSecond;
|
||||
|
||||
// 建立间隔UUID到间隔标签的映射,提高查找效率
|
||||
QHash<QString, QString> bayUuidToTag;
|
||||
for(auto& pOtherItem:getProjectBayItems())
|
||||
{
|
||||
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||
if(pBay){
|
||||
bayUuidToTag[pBay->uuid().toString()] = pBay->tag();
|
||||
}
|
||||
}
|
||||
|
||||
for(auto& pBaseItem:getProjectItems())
|
||||
{
|
||||
BaseProperty* pBase = dynamic_cast<BaseProperty*>(pBaseItem->getProperty());
|
||||
|
||||
HierarchyItem info;
|
||||
info.item.nEquipType = pBase->type();
|
||||
info.item.nCategory = 0; // 类别为0表示设备
|
||||
info.item.sName = pBase->name();
|
||||
info.item.uid = pBase->uuid();
|
||||
|
||||
// 查找设备所属的间隔
|
||||
QString bayTag;
|
||||
QString bayUuid;
|
||||
QString sVoltage;
|
||||
|
||||
// 通过间隔标签直接查找
|
||||
bayTag = pBase->getBay();
|
||||
|
||||
// 如果需要间隔UUID,可以反向查找
|
||||
if(!bayTag.isEmpty()){
|
||||
for(auto& pOtherItem:getProjectBayItems()){
|
||||
BayProperty* pBay = dynamic_cast<BayProperty*>(pOtherItem->getProperty());
|
||||
if(pBay && pBay->tag() == bayTag){
|
||||
bayUuid = pBay->uuid().toString();
|
||||
sVoltage = QString::number(pBay->getVoltage());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!bayTag.isEmpty()){
|
||||
// 设置父间隔信息
|
||||
info.parent.nEquipType = 0;
|
||||
info.parent.nCategory = 1;
|
||||
info.parent.sName = bayTag;
|
||||
info.parent.uid = QUuid(bayUuid);
|
||||
info.parent.sVoltageLevel = sVoltage;
|
||||
info.parent.grid = sG;
|
||||
info.parent.zone = sZ;
|
||||
info.parent.station = sS;
|
||||
}
|
||||
|
||||
lstSecond.append(info);
|
||||
}
|
||||
|
||||
emit updateCurrentItems(lstSecond, false);
|
||||
emit updateTopologyItems(lstSecond, false,true);
|
||||
}
|
||||
|
||||
void FixedPortsModel::addPortsToItem_json(PortState sta,QJsonArray jArr,GraphicsBaseItem* pItem)
|
||||
{
|
||||
for(QJsonValueRef portJson:jArr)
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ int GraphicsBaseItem::addPort(PortState typ,QPointF vec,QString id,HandleType hT
|
|||
m_vecHanle.insert(ntagId,pPort);
|
||||
pPort->setParent(this);
|
||||
pPort->setPos(vec);
|
||||
pPort->setSelected(false);
|
||||
|
||||
m_mapPort.insert(pPort->getId(),pPort);
|
||||
return ntagId;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public:
|
|||
|
||||
void initial();
|
||||
void loadTopologyFromDB(); //加载拓扑关系
|
||||
void clearItems();
|
||||
signals:
|
||||
void entityCreate(EntityInfo);
|
||||
void entityChange(EntityInfo);
|
||||
|
|
@ -34,8 +35,8 @@ public slots:
|
|||
void onItemClicked(const QModelIndex &index);
|
||||
void onUpdateTopology(QList<HierarchyItem> lst,bool refresh,bool bFull);
|
||||
void onMonitorUpdate(QList<QUuid>); //更新运行时
|
||||
void onDiagramClose(); //组态关闭
|
||||
private:
|
||||
void clearItems();
|
||||
QString getLevelType(int index);
|
||||
void buildTreeStructure(QStandardItemModel* model, const QVector<ExtraProperty>& properties);
|
||||
QVector<ExtraProperty> getPropertiesForNode(QStandardItem* node);
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ void CMainWindow::initializeAction()
|
|||
connect(m_pTopologyView,&TopologyView::entitySelected,m_pDiagramCavas,&DiagramCavas::onSignal_selectEntity);
|
||||
|
||||
connect(m_pDiagramCavas,&DiagramCavas::prepareUpdateTopology,m_pTopologyView,&TopologyView::onUpdateTopology);
|
||||
connect(m_pDiagramCavas,&DiagramCavas::clearTopology,m_pTopologyView,&TopologyView::onDiagramClose);
|
||||
|
||||
//connect(m_pDiagramView,&DiagramView::diagramCreate,m_pDiagramCavas,&DiagramCavas::onSignal_createDiagram);
|
||||
connect(m_pDiagramView,&DiagramView::diagramChange,m_pDiagramCavas,&DiagramCavas::onSignal_changeDiagram);
|
||||
|
|
@ -360,6 +361,7 @@ void CMainWindow::onAction_createEditor()
|
|||
connect(m_pCreateEdiotr,&CreateEditor::projectCreated,this,[&](){
|
||||
ProjectManager::instance().unloadEditorProject(QString());
|
||||
m_pDiagramView->clearProjectTree();
|
||||
m_pTopologyView->clearItems();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -369,6 +371,7 @@ void CMainWindow::onAction_createEditor()
|
|||
void CMainWindow::onAction_unloadEditor(const QString& str)
|
||||
{
|
||||
m_pDiagramCavas->onSignal_unloadProject(str);
|
||||
m_pTopologyView->clearItems();
|
||||
}
|
||||
|
||||
void CMainWindow::onCavasItemSelected(QObject* obj)
|
||||
|
|
|
|||
|
|
@ -150,6 +150,11 @@ void TopologyView::onMonitorUpdate(QList<QUuid> lst)
|
|||
_treeView->expandAll();
|
||||
}
|
||||
|
||||
void TopologyView::onDiagramClose()
|
||||
{
|
||||
clearItems();
|
||||
}
|
||||
|
||||
void TopologyView::onUpdateTopologyFull(QList<HierarchyItem> lst, bool refresh)
|
||||
{
|
||||
// 第一阶段:处理间隔节点(nCategory == 1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue