解释结论取消选中,合并复合层逻辑。
This commit is contained in:
parent
746166482a
commit
cd829e4692
|
|
@ -726,7 +726,12 @@ void TransparentGroupResult::onMousePress(QMouseEvent *event)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mDragMode = DragNone;
|
mDragMode = DragNone;
|
||||||
setSelectRect(false);
|
|
||||||
|
if (event->modifiers() & Qt::ControlModifier) {
|
||||||
|
//qDebug() << "鼠标点击时按住了Ctrl键";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
setSelectRect(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1247,6 +1247,9 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event)
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割为层内层", this, &QMyCustomPlot::segmentationInnerLayer);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割为层内层", this, &QMyCustomPlot::segmentationInnerLayer);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割为独立层", this, &QMyCustomPlot::segmentationIndependentLayer);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割为独立层", this, &QMyCustomPlot::segmentationIndependentLayer);
|
||||||
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "拆分复合层成独立层", this, &QMyCustomPlot::splitIndependentLayer);
|
menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "拆分复合层成独立层", this, &QMyCustomPlot::splitIndependentLayer);
|
||||||
|
QMap<double, TransparentGroupResult*> mapsort = this->getSelectGroupResult();
|
||||||
|
if (mapsort.size() > 1)
|
||||||
|
menu.addAction(QIcon(::GetImagePath() + "icon/decreasey.png"), "合并", this, &QMyCustomPlot::megResultLayer);
|
||||||
}
|
}
|
||||||
menu.exec(event->globalPos());
|
menu.exec(event->globalPos());
|
||||||
|
|
||||||
|
|
@ -3682,6 +3685,18 @@ void QMyCustomPlot::addItems_Gujing()
|
||||||
//取消选中
|
//取消选中
|
||||||
void QMyCustomPlot::ClearSelectItems()
|
void QMyCustomPlot::ClearSelectItems()
|
||||||
{
|
{
|
||||||
|
if (m_strLineName == "RESULT")
|
||||||
|
{
|
||||||
|
QMap<double, TransparentGroupResult*> mapsort = this->getSelectGroupResult();
|
||||||
|
QList<TransparentGroupResult*> listGroup = mapsort.values();
|
||||||
|
for (int i = 0; i < listGroup.size(); i++)
|
||||||
|
{
|
||||||
|
TransparentGroupResult* pGroup = listGroup.at(i);
|
||||||
|
if (pGroup == NULL)
|
||||||
|
continue;
|
||||||
|
pGroup->setSelectRect(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
//属性清空
|
//属性清空
|
||||||
PropertyService()->InitCurrentViewInfo();
|
PropertyService()->InitCurrentViewInfo();
|
||||||
}
|
}
|
||||||
|
|
@ -6934,6 +6949,21 @@ TransparentGroupResult* QMyCustomPlot::getCurGroupResult(double x_val)
|
||||||
return pClickGroup;
|
return pClickGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<double, TransparentGroupResult*> QMyCustomPlot::getSelectGroupResult()
|
||||||
|
{
|
||||||
|
QMap<double, TransparentGroupResult*> mapsort;
|
||||||
|
QObjectList objList = m_mapDragGroup.values();
|
||||||
|
for (int i = 0; i < objList.size(); i++)
|
||||||
|
{
|
||||||
|
TransparentGroupResult *pGroup = qobject_cast<TransparentGroupResult *>(objList.at(i));
|
||||||
|
if (pGroup == nullptr || !pGroup->getSelect())
|
||||||
|
continue;
|
||||||
|
QCPRange rg = pGroup->getRange();
|
||||||
|
mapsort.insert(-rg.upper, pGroup);
|
||||||
|
}
|
||||||
|
return mapsort;
|
||||||
|
}
|
||||||
|
|
||||||
void QMyCustomPlot::segmentationInnerLayer()
|
void QMyCustomPlot::segmentationInnerLayer()
|
||||||
{
|
{
|
||||||
//获取鼠标点位置
|
//获取鼠标点位置
|
||||||
|
|
@ -7058,6 +7088,66 @@ void QMyCustomPlot::splitIndependentLayer()
|
||||||
this->replot();
|
this->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMyCustomPlot::megResultLayer()
|
||||||
|
{
|
||||||
|
if (QMessageBox::information(NULL, QObject::tr("提示"), QObject::tr("合并为复合层?"), tr("是"), tr("否")) != 0) return;
|
||||||
|
// 筛选出选中的Group, 并且排序
|
||||||
|
QMap<double, TransparentGroupResult*> mapsort = this->getSelectGroupResult();
|
||||||
|
if (mapsort.size() <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 取出Group下面的DraggableResult,并且调整 lower,删除原来选中的Group
|
||||||
|
double dupper;
|
||||||
|
double dlower;
|
||||||
|
QVector<QPair<QCPRange, QString>> gr;
|
||||||
|
QList<TransparentGroupResult*> listGroup = mapsort.values();
|
||||||
|
for (int i = 0; i < listGroup.size(); i++)
|
||||||
|
{
|
||||||
|
TransparentGroupResult* pGroup = listGroup.at(i);
|
||||||
|
if (pGroup == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
dupper = pGroup->getRange().upper;
|
||||||
|
}
|
||||||
|
if (i == listGroup.size() - 1)
|
||||||
|
{
|
||||||
|
dlower = pGroup->getRange().lower;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVector<QString>& vec = pGroup->getVecResult();
|
||||||
|
const QMap<QString, QObject*>& mapResult = pGroup->getMapDraggable_Result();
|
||||||
|
|
||||||
|
for (int k = 0; k < vec.size(); k++)
|
||||||
|
{
|
||||||
|
TransparentDraggableResult* pret = qobject_cast<TransparentDraggableResult*>(mapResult.value(vec.at(k)));
|
||||||
|
if (pret == NULL)
|
||||||
|
continue;
|
||||||
|
QCPRange rg = pret->getRange();
|
||||||
|
if (i + 1 < listGroup.size())
|
||||||
|
{
|
||||||
|
TransparentGroupResult* pLowGroup = listGroup.at(i+1);
|
||||||
|
if (pGroup)
|
||||||
|
rg.lower = pLowGroup->getRange().upper;
|
||||||
|
}
|
||||||
|
gr << qMakePair(rg, pret->getResult());
|
||||||
|
}
|
||||||
|
pGroup->removeAllResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成新的Group
|
||||||
|
QString strUuid = "";
|
||||||
|
TransparentGroupResult* pNewG = this->addResultGroup(dlower, dupper, strUuid);
|
||||||
|
strUuid = "";
|
||||||
|
for (int i = 0; i < gr.size(); i++)
|
||||||
|
{
|
||||||
|
const QPair<QCPRange, QString>& r = gr.at(i);
|
||||||
|
pNewG->addResultToPlot(r.first.lower, r.first.upper, r.second, strUuid);
|
||||||
|
}
|
||||||
|
this->replot();
|
||||||
|
}
|
||||||
|
|
||||||
bool QMyCustomPlot::getIsEditor()
|
bool QMyCustomPlot::getIsEditor()
|
||||||
{
|
{
|
||||||
if (m_strLineName == "RESULT")
|
if (m_strLineName == "RESULT")
|
||||||
|
|
|
||||||
|
|
@ -407,9 +407,12 @@ public slots:
|
||||||
void updateGroupZone(); //更新层号
|
void updateGroupZone(); //更新层号
|
||||||
|
|
||||||
TransparentGroupResult* getCurGroupResult(double x_val);
|
TransparentGroupResult* getCurGroupResult(double x_val);
|
||||||
|
// 筛选出选中的Group, 并且排序
|
||||||
|
QMap<double, TransparentGroupResult*> getSelectGroupResult();
|
||||||
void segmentationInnerLayer(); // 分割为层内层
|
void segmentationInnerLayer(); // 分割为层内层
|
||||||
void segmentationIndependentLayer(); // 分割为独立层
|
void segmentationIndependentLayer(); // 分割为独立层
|
||||||
void splitIndependentLayer(); // 拆分复合层成独立层
|
void splitIndependentLayer(); // 拆分复合层成独立层
|
||||||
|
void megResultLayer();// 合并
|
||||||
|
|
||||||
bool getIsEditor();
|
bool getIsEditor();
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user