From 365f18d49473cb50a66c9af92de1d6794521cac8 Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期四, 07 十一月 2019 20:07:25 +0800 Subject: [PATCH] XMerge branch 'module' of http://192.168.5.5:10010/r/ruleprocess into module --- ruleserver/geoPolygon.go | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ruleserver/geoPolygon.go b/ruleserver/geoPolygon.go index bfe8efe..ec304a4 100644 --- a/ruleserver/geoPolygon.go +++ b/ruleserver/geoPolygon.go @@ -20,10 +20,30 @@ return num1 } +//Point 鍧愭爣鐐� +type Point struct { + X float64 `json:"x"` + Y float64 `json:"y"` +} + +//Rect 妫�娴嬬洰鏍� +type Rect struct { + X float64 + Y float64 + Width float64 + Height float64 +} + +//Pointfloat 鍧愭爣鐐� +type Pointfloat struct { + X float64 `json:"x"` + Y float64 `json:"y"` +} + //PintIsInPolygon 鍒ゆ柇鐐规槸鍚﹀湪澶氳竟褰㈠唴閮� //point涓鸿鍒ゆ柇鐨勫潗鏍囩偣 //polygon鏄杈瑰舰鍚勭偣鏁扮粍 -func pintIsInPolygon(point structure.Pointfloat, polygon []structure.Point, widthScale float64, heightScale float64) bool { +func pintIsInPolygon(point structure.Pointfloat, polygon []Point, widthScale float64, heightScale float64) bool { var nCross int = 0 for i := 0; i < len(polygon); i++ { @@ -72,7 +92,7 @@ } //ComputePolygonArea 璁$畻浠绘剰澶氳竟褰㈤潰绉� -func computePolygonArea(polygon []structure.Point) float64 { +func computePolygonArea(polygon []Point) float64 { pointNum := len(polygon) var s float64 = 0 if pointNum < 3 { @@ -86,7 +106,7 @@ } //PgsInterPercent calculate percent of two polygon intersection 璁$畻涓や釜澶氳竟褰㈢殑閲嶅彔鍗犳瘮 -func PgsInterPercent(pgpts []structure.Point, box structure.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 -- Gitblit v1.8.0