优化缩放比例属性,支持按比例缩放可视视图
This commit is contained in:
parent
9b7d6d8936
commit
b9591839be
|
|
@ -73,7 +73,7 @@ signals:
|
|||
void sig_ChangeFillMode(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName,
|
||||
QString newFillType, QString newTargetLine, QColor newColor, QString newLithosImage, QString newHeadFill,
|
||||
float vMin, float vMax, QString strOtherScaleType, QColor frontColor, QColor backColor, QString newFillMode);
|
||||
//置顶层
|
||||
//置顶层,并取消其他表格的选中状态
|
||||
void sig_Raise(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName);
|
||||
|
||||
//插件测试
|
||||
|
|
@ -85,6 +85,9 @@ signals:
|
|||
//鼠标滚动,通知可视解释窗口
|
||||
void sig_mouseWheel(QWheelEvent *event);
|
||||
|
||||
//改变缩放比例
|
||||
void sig_changeScale(int iNewScale);
|
||||
|
||||
//
|
||||
//void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,15 +89,78 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant
|
|||
if(pos>-1)
|
||||
{
|
||||
newScale = newScale.mid(pos+1);
|
||||
iScale = atoi(newScale.toStdString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
iScale = 200;
|
||||
}
|
||||
iScale = atoi(newScale.toStdString().c_str());
|
||||
|
||||
//
|
||||
g_iScale = iScale;
|
||||
|
||||
//清空自定义比例尺,防止混淆
|
||||
for (auto it = m_propertyData.constBegin(); it != m_propertyData.constEnd(); ++it)
|
||||
{
|
||||
if(it.value()=="自定义比例尺")
|
||||
{
|
||||
m_bSelfChange=true;
|
||||
QtVariantProperty *tempProperty = (QtVariantProperty*)it.key();
|
||||
tempProperty->setValue("");
|
||||
}
|
||||
}
|
||||
//通知界面缩放
|
||||
emit CallManage::getInstance()->sig_changeScale(g_iScale);
|
||||
}
|
||||
}
|
||||
else if("自定义比例尺" == m_propertyData[pProperty])
|
||||
{
|
||||
if(m_bSelfChange==true)
|
||||
{
|
||||
m_bSelfChange=false;
|
||||
return;
|
||||
}
|
||||
|
||||
//qDebug() << "自定义比例尺->改变";
|
||||
//当前属性类型
|
||||
if(m_strCurrentProperty == Widget_Property)
|
||||
{
|
||||
int iScale = 200;
|
||||
QString newScale = variant.value<QString>();
|
||||
//qDebug() << "自定义比例尺->" << newScale;
|
||||
newScale.replace(":",":");
|
||||
//
|
||||
int pos = newScale.indexOf(":");
|
||||
if(pos>-1)
|
||||
{
|
||||
QString leftScale = newScale.mid(0, pos);
|
||||
double ileftScale = atof(leftScale.toStdString().c_str());
|
||||
if(ileftScale<=0)
|
||||
{
|
||||
//不合规
|
||||
return;
|
||||
}
|
||||
//
|
||||
QString rightScale = newScale.mid(pos+1);
|
||||
double iRightScale = atof(rightScale.toStdString().c_str());
|
||||
if(iRightScale<=0)
|
||||
{
|
||||
//不合规
|
||||
return;
|
||||
}
|
||||
iScale = iRightScale/ileftScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
//不合规
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
g_iScale = iScale;
|
||||
|
||||
//通知界面缩放
|
||||
emit CallManage::getInstance()->sig_changeScale(g_iScale);
|
||||
}
|
||||
}
|
||||
else if("左刻度" == m_propertyData[pProperty])
|
||||
|
|
@ -636,10 +699,29 @@ void PropertyWidget::initWidgetProperty()
|
|||
listSize.append("1:20");
|
||||
listSize.append("1:50");
|
||||
listSize.append("1:100");
|
||||
listSize.append("1:200");
|
||||
listSize.append("1:500");
|
||||
listSize.append("1:1000");
|
||||
listSize.append("1:2000");
|
||||
listSize.append("1:3000");
|
||||
listSize.append("1:4000");
|
||||
listSize.append("1:5000");
|
||||
listSize.append("1:10000");
|
||||
listSize.append("1:20000");
|
||||
listSize.append("1:1");
|
||||
|
||||
//
|
||||
_CreateEnumPropertyItem("通常", "深度比例尺", 0, listSize);
|
||||
_CreateVariantPropertyItem("通常", "自定义比例尺", "", QVariant::String);
|
||||
QString strScale = "1:" + QString::number(g_iScale);
|
||||
int iIndex = listSize.indexOf(strScale);
|
||||
if(iIndex<0)
|
||||
{
|
||||
_CreateEnumPropertyItem("通常", "深度比例尺", 0, listSize);
|
||||
//
|
||||
_CreateVariantPropertyItem("通常", "自定义比例尺", strScale, QVariant::String);
|
||||
}
|
||||
else {
|
||||
_CreateEnumPropertyItem("通常", "深度比例尺", iIndex, listSize);
|
||||
_CreateVariantPropertyItem("通常", "自定义比例尺", "", QVariant::String);
|
||||
}
|
||||
//
|
||||
_CreateVariantPropertyItem("水平格线", "粗格线间隔(m)", 10.0, QVariant::Double);
|
||||
_CreateVariantPropertyItem("水平格线", "中格线间隔(m)", 2.0, QVariant::Double);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public:
|
|||
double m_colWidth = 1;
|
||||
double m_rowHeight = 1;
|
||||
|
||||
bool m_bSelfChange=false;
|
||||
public:
|
||||
QWidget* GetPropertyWidget();
|
||||
|
||||
|
|
|
|||
|
|
@ -998,8 +998,8 @@ void FormDraw::initWave2(QMyCustomPlot *widget, QString strSlfName, QString strW
|
|||
// widget->xAxis = yAxis;
|
||||
// widget->yAxis = xAxis;
|
||||
|
||||
float nPerHight = 25;
|
||||
float nSpace = 10;
|
||||
float nPerHight = 50;//25
|
||||
float nSpace = 1;
|
||||
for (int i=0; i<m_Record; i++)
|
||||
{
|
||||
//--------------------------------
|
||||
|
|
@ -1023,9 +1023,9 @@ void FormDraw::initWave2(QMyCustomPlot *widget, QString strSlfName, QString strW
|
|||
}
|
||||
|
||||
//x.append(_nSamples-kk-1);
|
||||
//float tempValue = -(_SDep + _Rlev*i+(val*30*2)/vmax);
|
||||
float tempValue = -(_SDep + nPerHight*_Rlev*i + (val*200*2)/vmax);
|
||||
x.append(kk);
|
||||
float tempValue = -(_SDep + nSpace*i+(val*nPerHight*2)/vmax);
|
||||
//float tempValue = -(_SDep + nSpace*i + (val*nPerHight*_Rlev*2)/vmax);
|
||||
y.append(tempValue);
|
||||
}
|
||||
|
||||
|
|
@ -1042,7 +1042,7 @@ void FormDraw::initWave2(QMyCustomPlot *widget, QString strSlfName, QString strW
|
|||
widget->graph()->setPen(graphPen);
|
||||
//widget->replot();
|
||||
|
||||
if(i>=10)
|
||||
if(i>=20)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ int g_iY1 = -3000;
|
|||
int g_iY2 = 0;
|
||||
int g_iCanZoom = 0;
|
||||
|
||||
int g_iScale = 2500;//0
|
||||
int g_iScale = 200;//2500
|
||||
QString g_prjname="";
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) :
|
|||
connect(this, SIGNAL(sig_NewWell(QString)), this, SLOT(s_NewWell(QString)));
|
||||
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_mouseWheel(QWheelEvent*)), this, SLOT(s_mouseWheel(QWheelEvent*)));
|
||||
connect(CallManage::getInstance(), SIGNAL(sig_changeScale(int)), this, SLOT(s_changeScale(int)));
|
||||
|
||||
//数据组织与管理树
|
||||
m_dock1=new QDockWidget(tr(""),this);
|
||||
|
|
@ -1039,6 +1040,12 @@ void MainWindowCurve::Open(QString fileFull)
|
|||
}
|
||||
}
|
||||
|
||||
//改变缩放比例
|
||||
void MainWindowCurve::s_changeScale(int iNewScale)
|
||||
{
|
||||
slot_time();
|
||||
}
|
||||
|
||||
void MainWindowCurve::slot_time()
|
||||
{
|
||||
QProgressBar *progressBar = new QProgressBar(this);
|
||||
|
|
@ -1075,8 +1082,7 @@ void MainWindowCurve::slot_time()
|
|||
}
|
||||
|
||||
//progressBar->setValue(i*iSplit); // 更新进度条的值
|
||||
|
||||
QCoreApplication::processEvents(); // 让界面更新显示进度条的当前值
|
||||
//QCoreApplication::processEvents(); // 让界面更新显示进度条的当前值
|
||||
|
||||
if( ui->tableWidget_2->cellWidget(1, i) != nullptr )
|
||||
{
|
||||
|
|
@ -1091,6 +1097,7 @@ void MainWindowCurve::slot_time()
|
|||
}
|
||||
//
|
||||
progressBar->deleteLater();
|
||||
//update();
|
||||
}
|
||||
|
||||
void MainWindowCurve::DisplayWells(QJsonArray wellsArray)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public:
|
|||
|
||||
public slots:
|
||||
void slot_time();
|
||||
//改变缩放比例
|
||||
void s_changeScale(int iNewScale);
|
||||
|
||||
public slots:
|
||||
void dragEnterEvent(QDragEnterEvent* event);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user