From 0436e5443295395025f89f0d091aab1e9551d1a4 Mon Sep 17 00:00:00 2001
From: pansen <pansen626@sina.com>
Date: 星期四, 10 一月 2019 20:26:31 +0800
Subject: [PATCH] Merge branch 'ywv1.2' of ssh://192.168.1.226:29418/development/c++ into ywv1.2

---
 QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.h |   88 ++++++++++++++++++++++++++++----------------
 1 files changed, 56 insertions(+), 32 deletions(-)

diff --git a/QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.h b/QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.h
index c2bb157..956c7ad 100644
--- a/QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.h
+++ b/QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.h
@@ -17,63 +17,75 @@
 #include <QJsonObject>
 #include <QJsonDocument>
 #include <QtGui/QPolygon>
+#include "DBStruct.h"
+#include <basic/db/Elasticsearch/EsDBTool.h>
+#include <jsoncpp/json/json.h>
 
-struct VectorPoint{
+struct VectorPoint {
     cv::Point2f start_Point;
     cv::Point2f end_Point;
 };
 
 typedef VectorPoint BaseLine;
-namespace JRTOOL{
+namespace JRTOOL {
 //浠t1涓哄熀鍑�
 //璁$畻涓や釜鍚戦噺鐨勫す瑙�,0~90涔嬮棿涓烘甯�,90~180涓洪�嗚
-static float getAngelOfTwoVector(VectorPoint &pt1, VectorPoint &pt2){
-    float theta = atan2(pt1.end_Point.x - pt1.start_Point.x, pt1.end_Point.y - pt1.start_Point.y)
-            - atan2(pt2.end_Point.x - pt2.start_Point.x, pt2.end_Point.y - pt2.start_Point.y);
-    if (theta > CV_PI)
-        theta -= 2 * CV_PI;
-    if (theta < -CV_PI)
-        theta += 2 * CV_PI;
-    theta = theta * 180.0 / CV_PI;
-    return abs(theta);
-}
+    static float getAngelOfTwoVector(VectorPoint &pt1, VectorPoint &pt2) {
+        float theta = atan2(pt1.end_Point.x - pt1.start_Point.x, pt1.end_Point.y - pt1.start_Point.y)
+                      - atan2(pt2.end_Point.x - pt2.start_Point.x, pt2.end_Point.y - pt2.start_Point.y);
+        if (theta > CV_PI)
+            theta -= 2 * CV_PI;
+        if (theta < -CV_PI)
+            theta += 2 * CV_PI;
+        theta = theta * 180.0 / CV_PI;
+        return abs(theta);
+    }
 
 //婊ゆ尝
-static float low_filter(float a, float b){
-    float sample_value;
-    float X=0.1;
-    sample_value=(1-X)*b+X*a;
-    return(sample_value);
-}
+    static float low_filter(float a, float b) {
+        float sample_value;
+        float X = 0.1;
+        sample_value = (1 - X) * b + X * a;
+        return (sample_value);
+    }
 }
 
 
-class JudgmentRetrogradeTool :public TimerElement {
+class JudgmentRetrogradeTool : public TimerElement {
 public:
-    JudgmentRetrogradeTool();
+    JudgmentRetrogradeTool() : TimerElement(1000) {}
+
+    JudgmentRetrogradeTool(const SdkRule &rule);
 
     virtual ~JudgmentRetrogradeTool();
 
-    bool init(QString area,QString line);
+    bool init(QString area, QString line);
 
     void setYoloObjects(std::vector<ScoredRect> value);
 
-    bool getPerRet(const long&);
+    bool getPerRet(const long &);
 
-     bool getTriggerState() const;
+    bool getTriggerState() const;
+
+    void setFdfs(FastFdsWithLock *p_fdfsClient) {
+        fdfsClient = p_fdfsClient;
+    }
+
+    void setImage(const cv::Mat &value);
 
 private:
-    void setPerPoint(const long&,cv::Point2f);
-    void setPerRect(const long&,cv::Rect rect);
+    void setPerPoint(const long &, cv::Point2f);
+
+    void setPerRect(const long &, cv::Rect rect);
 
     //璁剧疆涓婅鐨勮繍鍔ㄥ熀鍑嗙嚎
-    void setUpBaseline(cv::Point start,cv::Point end);
+    void setUpBaseline(cv::Point start, cv::Point end);
 
     //璁剧疆涓婅妫�娴嬪尯鍩�
     void setUpDetectionArea();
 
     //璁剧疆涓嬭鐨勮繍鍔ㄥ熀鍑嗙嚎
-    void setDownBaseline(cv::Point start,cv::Point end);
+    void setDownBaseline(cv::Point start, cv::Point end);
 
     //璁剧疆涓嬭妫�娴嬪尯鍩�
     void setDownDetectionArea();
@@ -81,14 +93,19 @@
 
     void func();
 
-    float getTheta(BaseLine&,VectorPoint&);
+    float getTheta(BaseLine &, VectorPoint &);
 
     QJsonArray getJsonArrayFromQString(const QString strJson);
 
+    std::string uploadImgToFdfs(cv::Mat &image);
+
+    bool saveInfoToEs(const std::string &imgUrl, const ScoredRect &obj);
+
+    bool isInWeek(const std::vector<LActRuleWeekRecord> &ruleWeek);
 
 private:
     //    virtual void threadInitial() override;
-    virtual void timerFunc()override;
+    virtual void timerFunc() override;
     //    virtual void threadClosing()override;
 
 private:
@@ -99,19 +116,26 @@
 
     //浜哄憳杩愬姩杞ㄨ抗
     //璺熻釜id,杩愬姩涓績鐐�
-    std::map<long,std::vector<cv::Point2f>> m_mapPerPoint;
+    std::map<long, std::vector<cv::Point2f>> m_mapPerPoint;
 
     //璺熻釜id,涓庡熀鍑嗙嚎鐨勫す瑙掑垪琛�
-    std::map<long,std::list<float>> m_mapPerDirection;
+    std::map<long, std::list<float>> m_mapPerDirection;
 
     //璺熻釜id,閫嗚鐘舵��
-    std::map<long,bool> m_mapPerRet;
+    std::map<long, bool> m_mapPerRet;
 
     QPolygon m_polygon;
 
     TriggerElement m_triggerElement;
 
     std::vector<ScoredRect> mObjs;
+
+    const SdkRule m_sdkRule;
+
+    FastFdsWithLock *fdfsClient;
+
+    cv::Mat image;
+    EsDBTool *pManagerEsDB;
 };
 
 

--
Gitblit v1.8.0