package com.hxzkoa.json;
|
|
import java.awt.geom.Point2D;
|
import java.util.Arrays;
|
import java.util.Vector;
|
|
public class tb_fence {
|
private int id;
|
private String floor;
|
private String type;
|
private String bumen;
|
private String name;
|
private String zuobiao;
|
private String shape;
|
private String start;
|
private String stop;
|
private String addtime;
|
private String color;
|
|
public int getId() {
|
return id;
|
}
|
|
public void setId(int id) {
|
this.id = id;
|
}
|
|
public String getFloor() {
|
return floor;
|
}
|
|
public void setFloor(String floor) {
|
this.floor = floor;
|
}
|
|
public String getType() {
|
return type;
|
}
|
|
public void setType(String type) {
|
this.type = type;
|
}
|
|
public String getBumen() {
|
return bumen;
|
}
|
|
public void setBumen(String bumen) {
|
this.bumen = bumen;
|
}
|
|
public String getName() {
|
return name;
|
}
|
|
public void setName(String name) {
|
this.name = name;
|
}
|
|
public String getZuobiao() {
|
return zuobiao;
|
}
|
|
public void setZuobiao(String zuobiao) {
|
this.zuobiao = zuobiao;
|
}
|
|
public String getShape() {
|
return shape;
|
}
|
|
public void setShape(String shape) {
|
this.shape = shape;
|
}
|
|
public String getStart() {
|
return start;
|
}
|
|
public void setStart(String start) {
|
this.start = start;
|
}
|
|
public String getStop() {
|
return stop;
|
}
|
|
public void setStop(String stop) {
|
this.stop = stop;
|
}
|
|
public String getAddtime() {
|
return addtime;
|
}
|
|
public void setAddtime(String addtime) {
|
this.addtime = addtime;
|
}
|
|
public String getColor() {
|
return color;
|
}
|
|
public void setColor(String color) {
|
this.color = color;
|
}
|
|
public Vector<Point2D.Double> getPts() {
|
Vector<Point2D.Double> pts = new Vector<Point2D.Double>();
|
String zuobiao = this.getZuobiao();// 坐标字符串
|
String shape = this.getShape();
|
String ju_xing = "矩形";
|
if (ju_xing.equals(shape)) {
|
String[] zb = zuobiao.split("\\,");// 用逗号分割
|
int x0 = Integer.parseInt(zb[0]);
|
int y0 = Integer.parseInt(zb[1]);
|
int x2 = Integer.parseInt(zb[2]);
|
int y2 = Integer.parseInt(zb[3]);
|
int x1 = x2;
|
int y1 = y0;
|
int x3 = x0;
|
int y3 = y2;
|
Point2D.Double p0 = new Point2D.Double(x0, y0);
|
Point2D.Double p1 = new Point2D.Double(x1, y1);
|
Point2D.Double p2 = new Point2D.Double(x2, y2);
|
Point2D.Double p3 = new Point2D.Double(x3, y3);
|
pts.add(p0);
|
pts.add(p1);
|
pts.add(p2);
|
pts.add(p3);
|
} else {
|
String[] zb = zuobiao.split("\\,");// 用逗号分割
|
int bian = zb.length/2;
|
for (int i = 0; i < bian; i++) {
|
// String zbxy = zb[i];
|
String[] xy = Arrays.copyOfRange(zb,2*i,2*i+2);// 以“,”分割字符串从而获得每个点的x和y
|
Point2D.Double p = new Point2D.Double(Integer.parseInt(xy[0]), Integer.parseInt(xy[1]));
|
pts.add(p);
|
}
|
|
}
|
return pts;
|
}
|
|
}
|