+ CalcPolygonAreaAutonavi
This commit is contained in:
@@ -2,9 +2,12 @@ package jxutils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
)
|
||||
|
||||
func TestSplitSlice(t *testing.T) {
|
||||
@@ -101,3 +104,25 @@ func TestSplitStoreName(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCalcPolygonAreaAutonavi(t *testing.T) {
|
||||
// pointers := GetPolygonFromCircle(104.065702, 30.657488, 3000, 128)
|
||||
// area := CalcPolygonAreaAutonavi(pointers)
|
||||
// t.Logf("area:%f", area)
|
||||
db := dao.GetDB()
|
||||
storeList, err := dao.GetStoreList(db, nil, nil, "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
strBuilder := &strings.Builder{}
|
||||
strBuilder.WriteString("\n")
|
||||
for _, v := range storeList {
|
||||
if v.DeliveryRangeType == model.DeliveryRangeTypePolygon {
|
||||
pointers := CoordinateStr2Points(v.DeliveryRange)
|
||||
area1 := CalcPolygonAreaAutonavi(pointers)
|
||||
strBuilder.WriteString(fmt.Sprintf("%d,%f\n", v.ID, area1))
|
||||
}
|
||||
}
|
||||
t.Log(strBuilder.String())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user