登录页修改及多边形范围判断修改
@@ -8,6 +8,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fangjia.open.util.InsidePolygon2;
|
||||
import com.fangjia.service.mongo.fangjia.PriceBorderService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
@@ -808,10 +809,13 @@ public class WeiXinEvaluationController {
|
||||
Point point = new Point(Double.valueOf(ll[0]), Double.valueOf(ll[1]));
|
||||
points.add(point);
|
||||
}
|
||||
Point point = new Point(district.getLng2()/10000000000.0, district.getLat2()/10000000000.0);
|
||||
boolean flag = InsidePolygon.aboutZone(point, points);
|
||||
Point point = new Point(district.getLng()/10000000000.0, district.getLat()/10000000000.0);
|
||||
//boolean flag = InsidePolygon.aboutZone(point, points);
|
||||
//boolean flag = InsidePolygon.isPtInPoly(point.getLon(), point.getLat(), points);
|
||||
boolean flag = InsidePolygon2.checkIsInPolygon(point, points);
|
||||
if(flag){
|
||||
pbObj = pb;
|
||||
System.out.println(district.getRegion()+" "+district.getName()+" "+pb.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,5 +143,44 @@ public class InsidePolygon {
|
||||
if ( ( (odd >> 1) << 1) == odd)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isPtInPoly (double ALon , double ALat , List<Point> ps) {
|
||||
int iSum, iCount, iIndex;
|
||||
double dLon1 = 0, dLon2 = 0, dLat1 = 0, dLat2 = 0, dLon;
|
||||
if (ps.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
iSum = 0;
|
||||
iCount = ps.size();
|
||||
for (iIndex = 0; iIndex<iCount;iIndex++) {
|
||||
if (iIndex == iCount - 1) {
|
||||
dLon1 = ps.get(iIndex).getLon();
|
||||
dLat1 = ps.get(iIndex).getLat();
|
||||
dLon2 = ps.get(0).getLon();
|
||||
dLat2 = ps.get(0).getLat();
|
||||
} else {
|
||||
dLon1 = ps.get(iIndex).getLon();
|
||||
dLat1 = ps.get(iIndex).getLat();
|
||||
dLon2 = ps.get(iIndex + 1).getLon();
|
||||
dLat2 = ps.get(iIndex + 1).getLat();
|
||||
}
|
||||
// 以下语句判断A点是否在边的两端点的水平平行线之间,在则可能有交点,开始判断交点是否在左射线上
|
||||
if (((ALat >= dLat1) && (ALat < dLat2)) || ((ALat >= dLat2) && (ALat < dLat1))) {
|
||||
if (Math.abs(dLat1 - dLat2) > 0) {
|
||||
//得到 A点向左射线与边的交点的x坐标:
|
||||
dLon = dLon1 - ((dLon1 - dLon2) * (dLat1 - ALat) ) / (dLat1 - dLat2);
|
||||
// 如果交点在A点左侧(说明是做射线与 边的交点),则射线与边的全部交点数加一:
|
||||
if (dLon < ALon) {
|
||||
iSum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((iSum % 2) != 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.fangjia.open.util;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class InsidePolygon2 {
|
||||
/**
|
||||
* 判断当前位置是否在多边形区域内
|
||||
*
|
||||
* @param checkPoint 当前经纬度
|
||||
* @param areaAround 围栏范围
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkIsInPolygon(Point checkPoint, List<Point> areaAround) {
|
||||
Point2D.Double point = new Point2D.Double(checkPoint.getLat(), checkPoint.getLon());
|
||||
List<Point2D.Double> pointList = new ArrayList<Point2D.Double>();
|
||||
for (Point everyPoint : areaAround) {
|
||||
Point2D.Double polygonPoint = new Point2D.Double(everyPoint.getLat(), everyPoint.getLon());
|
||||
pointList.add(polygonPoint);
|
||||
}
|
||||
return checkIsPtInPoly(point, pointList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断点是否在多边形内,如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
|
||||
*
|
||||
* @param point 检测点
|
||||
* @param pts 多边形的顶点
|
||||
* @return 点在多边形内返回true, 否则返回false
|
||||
*/
|
||||
public static boolean checkIsPtInPoly(Point2D.Double point, List<Point2D.Double> pts) {
|
||||
int N = pts.size();
|
||||
//如果点位于多边形的顶点或边上,也算做点在多边形内,直接返回true
|
||||
boolean boundOrVertex = true;
|
||||
//cross points count of x
|
||||
int intersectCount = 0;
|
||||
//浮点类型计算时候与0比较时候的容差
|
||||
double precision = 2e-10;
|
||||
//neighbour bound vertices
|
||||
Point2D.Double p1, p2;
|
||||
//当前点
|
||||
Point2D.Double p = point;
|
||||
//left vertex
|
||||
p1 = pts.get(0);
|
||||
//check all rays
|
||||
for (int i = 1; i <= N; ++i) {
|
||||
if (p.equals(p1)) {
|
||||
//p is an vertex
|
||||
return boundOrVertex;
|
||||
}
|
||||
//right vertex
|
||||
p2 = pts.get(i % N);
|
||||
//ray is outside of our interests
|
||||
if (p.x < Math.min(p1.x, p2.x) || p.x > Math.max(p1.x, p2.x)) {
|
||||
p1 = p2;
|
||||
//next ray left point
|
||||
continue;
|
||||
}
|
||||
//ray is crossing over by the algorithm (common part of)
|
||||
if (p.x > Math.min(p1.x, p2.x) && p.x < Math.max(p1.x, p2.x)) {
|
||||
//x is before of ray
|
||||
if (p.y <= Math.max(p1.y, p2.y)) {
|
||||
//overlies on a horizontal ray
|
||||
if (p1.x == p2.x && p.y >= Math.min(p1.y, p2.y)) {
|
||||
return boundOrVertex;
|
||||
}
|
||||
//ray is vertical
|
||||
if (p1.y == p2.y) {
|
||||
//overlies on a vertical ray
|
||||
if (p1.y == p.y) {
|
||||
return boundOrVertex;
|
||||
//before ray
|
||||
} else {
|
||||
++intersectCount;
|
||||
}
|
||||
} else {
|
||||
//cross point on the left side
|
||||
//cross point of y
|
||||
double xinters = (p.x - p1.x) * (p2.y - p1.y) / (p2.x - p1.x) + p1.y;
|
||||
//overlies on a ray
|
||||
if (Math.abs(p.y - xinters) < precision) {
|
||||
return boundOrVertex;
|
||||
}
|
||||
//before ray
|
||||
if (p.y < xinters) {
|
||||
++intersectCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//special case when ray is crossing through the vertex
|
||||
//p crossing over p2
|
||||
if (p.x == p2.x && p.y <= p2.y) {
|
||||
//next vertex
|
||||
Point2D.Double p3 = pts.get((i + 1) % N);
|
||||
//p.x lies between p1.x & p3.x
|
||||
if (p.x >= Math.min(p1.x, p3.x) && p.x <= Math.max(p1.x, p3.x)) {
|
||||
++intersectCount;
|
||||
} else {
|
||||
intersectCount += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
//next ray left point
|
||||
p1 = p2;
|
||||
}
|
||||
//偶数在多边形外
|
||||
if (intersectCount % 2 == 0) {
|
||||
return false;
|
||||
} else {
|
||||
//奇数在多边形内
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 266 KiB |
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 69 KiB |
@@ -21,8 +21,9 @@
|
||||
|
||||
<div class="page-group">
|
||||
<div class="page page-current">
|
||||
<div class="content login_bg">
|
||||
<div class="login_logo"><img src="../static/images/bohaiyidai2.jpg"></div>
|
||||
<div class="content login_bg" style="background: url(../static/images/bhbm.png);">
|
||||
<div class="login_logo" style="margin-top: 0px;"><img src="../static/images/bohaiyidai2.jpg" style="width: 80%;height: 100px;margin: 20px auto;"></div>
|
||||
<div class="login_logo" style="margin-top: 0px;"><img src="../static/images/bh1.png" id="bannersDiv" style="width: 100%;height: 150px;"></div>
|
||||
<div class="login_content">
|
||||
<div class="login_input">
|
||||
<div class="inputInfo01">
|
||||
@@ -40,9 +41,10 @@
|
||||
</div>
|
||||
<p>忘记密码请拨打客服电话<a href="tel:4001883787">400-888-8811</a>进行查询</p>
|
||||
<div class="content-block">
|
||||
<p><a href="#" class="button button-big login_btn">登录</a></p>
|
||||
<p><a href="#" class="button button-big login_btn" style="background: #045FB4;">登录</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="login_logo" style="margin-top: 0px;"><img src="../static/images/bhbm.png" style="width: 80%;height: 150px;"></div>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +53,28 @@
|
||||
<script type='text/javascript' src='https://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script>
|
||||
<script type='text/javascript' charset='utf-8'>
|
||||
$(function() {
|
||||
|
||||
|
||||
|
||||
var counter = 0
|
||||
var images = ["bh1.png","bh2.png", "bh3.png", "bh4.png"]
|
||||
|
||||
function run(){
|
||||
console.log("coming")
|
||||
setInterval(changeImg, 5000)
|
||||
}
|
||||
|
||||
function changeImg(){
|
||||
counter++
|
||||
if(counter==images.length)
|
||||
counter=0
|
||||
var imgUrl = "../static/images/"+images[counter]
|
||||
console.log(imgUrl)
|
||||
$("#bannersDiv").attr("src",imgUrl)
|
||||
}
|
||||
|
||||
|
||||
run();
|
||||
|
||||
var checkUsername = function(username) {
|
||||
if(username == "") {
|
||||
$.toast("用户名不能为空");
|
||||
|
||||