From 2e33ad7d4499e095c80c2b77fe30ac2bd527cb23 Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期四, 07 十一月 2019 19:29:00 +0800
Subject: [PATCH] ---
---
ruleserver/geoPolygon.go | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/ruleserver/geoPolygon.go b/ruleserver/geoPolygon.go
index a87fb54..7421add 100644
--- a/ruleserver/geoPolygon.go
+++ b/ruleserver/geoPolygon.go
@@ -2,6 +2,7 @@
import (
"math"
+ "ruleprocess/structure"
)
func min(num1 float64, num2 float64) float64 {
@@ -72,7 +73,7 @@
}
//GetLocation 灏嗕竴涓粰瀹氳捣濮嬪潗鏍囷紝瀹藉害闀垮害鐨勭煩褰㈠尯鍩熷潎鍒嗕负n鏂逛唤骞惰繑鍥炰腑蹇冨潗鏍囷紙n涓哄崟杈瑰钩鍒嗘暟鍊硷級鍜岄潰绉�
-func getLocation(rect Rect, n int) ([]Pointfloat, float64) {
+func getLocation(rect structure.Rect, n int) ([]Pointfloat, float64) {
xArr := make([]float64, n) // 鐢ㄥ垏鐗囦笉鐢ㄦ暟缁勶紝鏁扮粍涓嶈兘鐢ㄥ彉閲忓畾涔夐暱搴�
yArr := make([]float64, n)
pointArr := make([]Pointfloat, 0, n*n)
@@ -105,7 +106,7 @@
}
//PgsInterPercent calculate percent of two polygon intersection 璁$畻涓や釜澶氳竟褰㈢殑閲嶅彔鍗犳瘮
-func PgsInterPercent(pgpts []Point, box Rect, widthScale float64, heightScale float64) (percent float64) {
+func PgsInterPercent(pgpts []Point, box structure.Rect, widthScale float64, heightScale float64) (percent float64) {
areapts, areaBox := getLocation(box, 10)
var count = 0
@@ -120,7 +121,7 @@
perInterPg := areaInter / areaPg // 閲嶅悎闈㈢Н鍗犲杈瑰舰鍖哄煙鐨勬瘮渚�
// 鍝釜鍗犵殑姣斾緥澶ф寜鍝釜璁$畻
if perInterBox > perInterPg {
- return perInterBox
+ return (perInterBox*100)
}
return (perInterPg*100)
}
--
Gitblit v1.8.0