From a89689b92b07cf1830ad8b46521eda92e7f927c0 Mon Sep 17 00:00:00 2001 From: pansen <pansen626@sina.com> Date: 星期三, 30 一月 2019 16:37:45 +0800 Subject: [PATCH] 修改bug --- QiaoJiaSystem/StructureApp/PerStaticElement.cpp | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/QiaoJiaSystem/StructureApp/PerStaticElement.cpp b/QiaoJiaSystem/StructureApp/PerStaticElement.cpp index 667bb9a..1aa7c86 100644 --- a/QiaoJiaSystem/StructureApp/PerStaticElement.cpp +++ b/QiaoJiaSystem/StructureApp/PerStaticElement.cpp @@ -17,7 +17,8 @@ m_triggerElement(0,0), m_lTime(AppUtil::getCurrentUs()), pManagerEsDB(nullptr), -m_bIsMask(true) +m_bIsMask(true), +m_bSetWH(false) { pManagerEsDB=new EsDBTool(appPref.getStringData("ipAdd"), appPref.getIntData("ipPort")); @@ -36,7 +37,7 @@ void PerStaticElement::threadInitial() { - setMask(m_sdkRule.strAreas.toStdString()); +// setMask(m_sdkRule.strAreas.toStdString()); } @@ -175,14 +176,17 @@ int size=arrayAreas.size(); npts=size; pointArray=new cv::Point2i[size]; + float sizeW=(float)appPref.getIntData(m_sdkRule.strCamId.toStdString()+"width")/480; + float sizeH=(float)appPref.getIntData(m_sdkRule.strCamId.toStdString()+"height")/270; for(int i = 0;i < arrayAreas.size();++i) { QJsonValue jsonValue = arrayAreas[i]; QJsonObject obj = jsonValue.toObject(); - int x = obj.value("x").toDouble()*4; - int y = obj.value("y").toDouble()*4; + int x = obj.value("x").toDouble() *sizeW; + int y = obj.value("y").toDouble() *sizeH; mPolygon<<(QPoint(x,y)); - + DBG("width="<<sizeW); + DBG("height="<<sizeH); } } QJsonArray PerStaticElement::getJsonArrayFromQString(const QString& strJson) @@ -300,4 +304,9 @@ { value.copyTo(image); + if(!m_bSetWH) + { + setMask(m_sdkRule.strAreas.toStdString()); + m_bSetWH=true; + } } -- Gitblit v1.8.0