package Frame;
|
import java.awt.BasicStroke;
|
import java.awt.BorderLayout;
|
import java.awt.Canvas;
|
import java.awt.Color;
|
import java.awt.Container;
|
import java.awt.Cursor;
|
import java.awt.Font;
|
import java.awt.Graphics;
|
import java.awt.Graphics2D;
|
import java.awt.Image;
|
import java.awt.Point;
|
import java.awt.Stroke;
|
import java.awt.event.*;
|
import java.util.List;
|
import java.util.Timer;
|
import java.util.Vector;
|
import javax.swing.*;
|
import BaoWen.Juge_indoor;
|
import ColorAndFont.ChooseColor;
|
import ColorAndFont.UIColor;
|
import ColorAndFont.buttonTitle;
|
import DataBase.DatabaseManagement;
|
import DrawImage.Drawok;
|
import JNADell.DellJAN;
|
import Method.GetColor;
|
import Method.GetNowTime;
|
import Method.Map_suo_fang;
|
import PbuliClass.BuMens;
|
import PbuliClass.JButtonModel;
|
import PbuliClass.JlableModel;
|
import PbuliClass.Polygon;
|
import PbuliClass.Rectangle;
|
import PbuliClass.ShowMessage;
|
import PbuliClass.Systems;
|
import PbuliClass.jinternalFrame;
|
import Xunjian.Dell_xunjianset;
|
import anchor.Anchor;
|
import anchor.Anchor_Dell;
|
import fence.Fences;
|
import person.Person;
|
import person.person_Dell;
|
import tbDataModel.TbMap;
|
import tbDataModel_Dell.Dell_Fenceinout;
|
import tbDataModel_Dell.Dell_Polygon;
|
import tbDataModel_Dell.Dell_tbline;
|
import tbDataModel_Dell.FontChoose;
|
import tbDataModel_Dell.Map_Dell;
|
import tbDataModel_Dell.Tools;
|
|
@SuppressWarnings("rawtypes")
|
/**¸ÃÀàÓÃÓÚ»æÖÆÎ§À¸*/
|
public class Fence extends jinternalFrame {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
JPanel leftJpanel = null;//×ó²àÃæ°å
|
JTextField searchFileld = null;//ËÑË÷Îı¾¿ò
|
JButtonModel huizhi = null;//»æÖÆ
|
JButtonModel baocun = null;//±£´æ
|
JButtonModel quxiao = null;//È¡Ïû
|
JButtonModel jbt_bjsure = null;//È·¶¨
|
JlableModel chooseMap;//Ñ¡Ôñͼ²ã
|
JlableModel jl_xingzhuang=new JlableModel("ΧÀ¸ÐÎ×´:");
|
JlableModel jl_banjing=new JlableModel("Ô²Ðΰ뾶:");
|
JTextField nameField;//ÊäÈëΧÀ¸Ãû³ÆÎı¾¿ò
|
JTextField jt_banjing=new JTextField();
|
JTextField group = new JTextField("·ÇһάÏß²»ÐèÒªÌîд", 5);
|
MapManage map = new MapManage();
|
JComboBox<String> comboBox = null;//Ñ¡Ôñͼ²ãÏÂÀ¿ò
|
JComboBox<String> leixingBox = null;//Ñ¡ÔñΧÀ¸ÀàÐÍÏÂÀ¿ò
|
JComboBox<String> departmentBox = null;//Ñ¡Ôñ²¿ÃÅÀàÐÍÏÂÀ¿ò
|
JComboBox<String> colorBox = null;//Ñ¡Ôñ²¿ÃÅΧÀ¸ÑÕÉ«ÏÂÀ¿ò
|
JComboBox<String> jc_xingzhuang = null;//Ñ¡ÔñΧÀ¸ÐÎ×´
|
String imageAdress = null;//ͼƬµØÖ·
|
Vector<String> row = null;//µØÍ¼Ãû³ÆµÄ¼¯ºÏ
|
Mycanvas mycanvas = null;
|
Image image = null;//µØÍ¼
|
JTextField zuobiao = null;//Êó±êµÄÊµÊ±×ø±ê
|
String zuobiaoText;//¹â±êµãµÄ
|
int width;
|
int height;
|
int new_width;//ͼƬµÄ¿í
|
int new_height;//ͼƬµÄ¸ß
|
double map_true_width;//µØÍ¼Êµ¼Ê³¤¶È
|
double map_true_height;//µØÍ¼Êµ¼Ê¸ß¶È
|
double x_bi;//ͼƬµÄxÏñËØµãºÍʵ¼Ê³¤µÄ±ÈÖµ
|
double y_bi;//ͼƬµÄyÏñËØµãºÍʵ¼Ê¿íµÄ±ÈÖµ
|
int x0;//ͼƬÆðµã×ø±êx
|
int y0;//ͼƬÆðµã×ø±êy
|
JTextArea zuo_biao_ji = null;//×ø±êΧÀ¸×ø±ê¼¯ºÏ
|
int rspx;//¾ØÐÎÆðµãX×ø±ê
|
int rspy;//¾ØÐÎÆðµãY×ø±ê
|
int repx;//¾ØÐÎÖÕµãX×ø±ê
|
int repy;//¾ØÐÎÖÕµãY×ø±ê
|
boolean huizhiStart = false;
|
String reczb;//¾ØÐÎΧÀ¸×ø±ê
|
String reczbjwd;//¾ØÐÎΧÀ¸×ø±ê,¾Î³¶ÈµÄ¶È¸ñʽ
|
String shape;//ΧÀ¸ÐÎ×´
|
String zuid;//×éID
|
Rectangle rectang;//¾ØÐζÔÏó
|
Polygon polygons;//¶à±ßÐζÔÏó
|
List<Rectangle> rec;//¾ØÐζÔÏóµÄ¼¯ºÏ
|
List<Polygon> polygs;//¶à±ßÐζÔÏóµÄ¼¯ºÏ
|
int rWidth;//¾ØÐεÄеĿí¶È
|
int rHeight;//¾ØÐεÄеĸ߶È
|
int new_rWidth;//¾ØÐεÄпí¶È
|
int new_rHeight;//¾ØÐεÄи߶È
|
int rx0;//¾ØÐεÄX0
|
int ry0;//¾ØÐεÄY0
|
int m; //¶à±ßÐÎÊýÁ¿
|
Font font = new Font("ËÎÌå", Font.BOLD, 14);
|
String xuanze = "ºìÉ«";//Ñ¡ÔñµÄÑÕÉ«
|
int mouseclicknum = 0;//Êó±êµã»÷µÄ´ÎÊý
|
List listRec;//½«ÁбíÖÐËùÓнá¹û¼¯¸øµ½list¼¯ºÏ
|
List listPoly;//½«ÁбíÖÐËùÓжà±ßÐνá¹û¼¯¸øµ½list¼¯ºÏ
|
int xingzhuang=0;//0±íʾ¾ØÐΣ¬1±íʾ¶à±ßÐΣ¬2±íʾԲÐΣ¬3±íʾһάÏß
|
String xzstr="¾ØÐÎ";
|
Color color;
|
Stroke stroke;//ÉèÖû±Ê
|
int framey;//µ±Ç°Ãæ°å¸ß¶È
|
int framex;//µ±Ç°Ãæ°åµÄ¿í¶È
|
String floor = "0";
|
String allFloor = "0";//¶ÔËùÓÐͼ²ãÉúЧ 2023.08.21 zsh
|
|
|
//Êó±êÒÆ¶¯Ê±ºò¶ÔÓ¦µÄʵʱµÄXY×ø±ê
|
int xpos = 0;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx
|
int ypos = 0;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy
|
|
int xpy = 0;//µØÍ¼ÔµãX·½ÏòµÄÆ«ÒÆÁ¿
|
int ypy = 0;//µØÍ¼Ôµãy·½ÏòµÄÆ«ÒÆÁ¿
|
|
int x_cursor;//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
int y_cursor;//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
|
Color grenn = new Color(50, 205, 50, 150);
|
double bi=1;//ͼƬËõ·Å±ÈÀý
|
|
//¶à±ßÐεÄÁÙʱÊý¾Ý±£´æ
|
Vector<Integer> xpointvc = new Vector<Integer>();//X×ø±êµÄ¼¯ºÏ
|
Vector<Integer> ypointvc = new Vector<Integer>();//X×ø±êµÄ¼¯ºÏ
|
Vector<String> xpointvcjd = new Vector<String>();//¾Î³¶È×ø±ê¾¶È×ø±êµÄ¼¯ºÏ
|
Vector<String> ypointvcwd = new Vector<String>();//¾Î³¶È×ø±êγ¶È×ø±êµÄ¼¯ºÏ
|
int pointnum = 0;//¶¨µãµÄÊýÁ¿
|
|
//¾ØÐεÄÁÙʱÊý¾Ý±£´æ
|
Vector<Integer> xjuxingc = new Vector<Integer>();//¾ØÐÎX×ø±êµÄ¼¯ºÏ
|
Vector<Integer> yjuxingc = new Vector<Integer>();//¾ØÐÎY×ø±êµÄ¼¯ºÏ
|
int pointjuxingnum = 0;//¾ØÐ樵ãµÄÊýÁ¿
|
double[] juxing_wh = new double[2];
|
|
//һάÏßµÄÁÙʱÊý¾Ý±£´æ
|
Vector<Integer> xline = new Vector<Integer>();//һάÏßX×ø±êµÄ¼¯ºÏ
|
Vector<Integer> yline = new Vector<Integer>();//һάÏßY×ø±êµÄ¼¯ºÏ
|
Vector<String> xlinejd = new Vector<String>();//¾Î³¶È×ø±ê¾¶È×ø±êµÄ¼¯ºÏ
|
Vector<String> ylinewd = new Vector<String>();//¾Î³¶È×ø±êγ¶È×ø±êµÄ¼¯ºÏ
|
int pointlinenum = 0;//һάÏß¶¨µãµÄÊýÁ¿
|
|
//Ô²ÐÎÁÙʱ±£´æ
|
int xyuangvc = 0;//X×ø±ê
|
int yyuangvc = 0;//Y×ø±ê
|
int bj=0;//°ë¾¶¼¯ºÏ
|
|
|
Color ancid = ChooseColor.getColo("À¶É«", 255);
|
|
/**¹¹Ôì´úÂë¿éÓÃÓÚ³õʼ»¯±äÁ¿*/ {
|
stroke = new BasicStroke(2);//ÉèÖû±Ê
|
color = Color.red;
|
|
}
|
|
|
public Fence() {
|
if (Map_Dell.getMap_vector().size() != 0) {//Èç¹ûµØÍ¼¶ÔÏó²»Îª¿ÕÔòÔËÐÐ
|
TbMap map = Map_Dell.get_map("0");
|
if (map != null) {
|
String name = map.getMapname();//»ñÈ¡µØÍ¼Ãû³Æ
|
image = new ImageIcon("image/mapfile/" + name).getImage();
|
map_true_width = map.getX_Truelength();//µØÍ¼X·½Ïòʵ³¤
|
map_true_height = map.getY_Truewidth();//µØÍ¼Y·½Ïòʵ³¤
|
width = image.getWidth(this);//ͼƬxÏñËØ
|
height = image.getHeight(this);//ͼyÏñËØ
|
new_width = width;
|
new_height = height;
|
x0 = 0;
|
y0 = 0;
|
xpy = map.getX0_length();
|
ypy = map.getY0_width();
|
}
|
} else {
|
ShowMessage.zidingyi_24("µØÍ¼²»´æÔÚ,ÇëÏÈÉÏ´«µØÍ¼£¡");
|
this.dispose();
|
return;
|
}
|
|
x_bi = map_true_width / new_width;
|
y_bi = map_true_height / new_height;
|
Container rq = getContentPane();//»ñÈ¡ÈÝÆ÷
|
rq.setLayout(new BorderLayout());
|
rq.setBackground(UIColor.getNorth_color());
|
mycanvas = new Mycanvas();//³õʼ»¯»æÍ¼Ãæ°å¶ÔÏó0
|
String title = "ΧÀ¸»æÖÆ";
|
if (Systems.sys().getLanguage().equals("English")) {
|
title = "Fence drawing";
|
}
|
|
this.setTitle(title);
|
this.setSize(1100, 760);
|
this.setFrameIcon(new ImageIcon("image/icon/fenceicon.png"));//ÉèÖô°Ìåͼ±ê
|
rq.add(getLeftJpanel(), BorderLayout.WEST);
|
rq.add(mycanvas, BorderLayout.CENTER);
|
}
|
|
|
/**
|
* »ñÈ¡±±²¿Ãæ°å
|
*/
|
public JPanel getLeftJpanel() {
|
if (leftJpanel == null) {
|
leftJpanel = new JPanel(new BorderLayout());
|
JPanel mb1 = new JPanel();
|
mb1.setLayout(null);
|
JlableModel lx = new JlableModel();
|
lx.setText("ΧÀ¸ÀàÐÍ:");
|
JlableModel gl = new JlableModel();
|
gl.setText("¹ØÁª²¿ÃÅ:");
|
JlableModel name = new JlableModel();
|
name.setText("ÇøÓòÃû³Æ:");
|
JlableModel fenceColor = new JlableModel();
|
fenceColor.setText("ΧÀ¸ÑÕÉ«:");
|
nameField = new JTextField(5);
|
JlableModel namegroup = new JlableModel();
|
namegroup.setText("С×éId:");
|
int x=10;
|
int y=15;
|
int width=80;
|
int width2=120;
|
int x2=x+width;
|
int h=25;
|
//Ñ¡Ôñͼ²ã
|
getChooseMap().setBounds(x, y,width,h);
|
getComboBox().setBounds(x2,y,width2,h);
|
|
|
//ΧÀ¸ÀàÐÍ
|
int y1=y+h+30;
|
lx.setBounds(x,y1,width, h);
|
getLeixngBox().setBounds(x2,y1,width2, h);
|
|
//¹ØÁª¶ÔÏó
|
int y2=y+2*(30+h);
|
gl.setBounds(x,y2,width, h);
|
getDepartmentBox().setBounds(x2,y2,width2, h);
|
|
//ÇøÓòÃû³Æ
|
int y3=y+3*(30+h);
|
name.setBounds(x,y3, 70, h);
|
nameField.setBounds(x2,y3,width2, h);
|
|
//ÐÎ×´
|
int y4=y+4*(30+h);
|
mb1.add(jl_xingzhuang);
|
mb1.add(getJc_xingzhuang());
|
jl_xingzhuang.setBounds(x,y4,width, h);
|
getJc_xingzhuang().setBounds(x2,y4,width2, h);
|
jt_banjing.setEnabled(false);
|
|
int y5=y+5*(30+h);
|
jl_banjing.setBounds(x,y5,width, h);
|
jt_banjing.setBounds(x2,y5,width2, h);
|
mb1.add(jl_banjing);
|
mb1.add(jt_banjing);
|
jt_banjing.setEnabled(false);
|
|
//×éID
|
int y6=y+6*(30+h);
|
namegroup.setBounds(x,y6,width, h);
|
getGroup().setBounds(x2,y6,width2, h);
|
|
//ΧÀ¸ÑÕÉ«
|
int y7=y+7*(30+h);
|
fenceColor.setBounds(x,y7,width, h);
|
getColorBox().setBounds(x2,y7,width2, h);
|
|
//»æÖư´¼ü
|
int y8=y+8*(30+h);
|
getHuizhi().setBounds(x, y8, 50, h);//»æÖư´¼ü
|
getBaocun().setBounds(73,y8, 50, h);//±£´æ°´¼ü
|
getQuxiao().setBounds(136,y8, 50, h);//È¡Ïû°´¼ü
|
|
int y9=y+9*(30+h);
|
getZuo_biao_ji().setBounds(x,y9, 190, 140);
|
mb1.add(getChooseMap());//Ñ¡Ôñͼ²ã
|
mb1.add(getComboBox());//Ìí¼ÓÏÂÀÁбí¿ò
|
mb1.add(lx);//Ìí¼ÓÏÂÀÁбí¿ò
|
mb1.add(getLeixngBox());//Ìí¼ÓÀàÐÍÑ¡ÔòÏÂÀÁбí¿ò
|
mb1.add(gl);//Ìí¼Ó¹ØÁª¶ÔÏó
|
mb1.add(getDepartmentBox());//Ìí¼Ó¹ØÁª¶ÔÏó
|
mb1.add(name);//Ìí¼ÓÇøÓòÃû³Æ
|
mb1.add(nameField);//Ãû³ÆÊäÈë¿ò
|
mb1.add(namegroup);//Ìí×éID
|
mb1.add(getGroup());//×éIdÊäÈë¿ò
|
mb1.add(fenceColor);//Ìí¼ÓΧÀ¸ÑÕÉ«
|
mb1.add(getColorBox());//Ìí¼ÓÑÕɫѡÔñÏÂÀ¿ò
|
mb1.add(getHuizhi());//Ìí¼Ó»æÖư´Å¥
|
mb1.add(getBaocun());//Ìí¼ÓÈ·¶¨°´Å¥
|
mb1.add(getQuxiao());//Ìí¼ÓÈ¡Ïû°´Å¥
|
mb1.add(getZuo_biao_ji());//Ìí¼Ó×ø±ê¼¯ºÏ
|
leftJpanel.add(getZuobiao(), BorderLayout.NORTH);
|
leftJpanel.add(mb1, BorderLayout.CENTER);
|
}
|
|
return leftJpanel;
|
}
|
|
/**
|
* »ñÈ¡×ø±êµÄ¼¯ºÏ
|
*/
|
public JTextArea getZuo_biao_ji() {
|
if (zuo_biao_ji == null) {
|
zuo_biao_ji = new JTextArea(5, 5);
|
}
|
return zuo_biao_ji;
|
|
}
|
|
/**
|
* »ñÈ¡»æÖư´Å¥µÄ·½·¨
|
*/
|
public JButtonModel getHuizhi() {
|
if (huizhi == null) {
|
huizhi = new JButtonModel("»æÖÆ");
|
huizhi.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
chushihua();
|
String name = nameField.getText();
|
|
if (name.equals("")) {
|
ShowMessage.zidingyi("ΧÀ¸Ãû³Æ²»ÄÜΪ¿Õ£¡");
|
return;
|
}
|
if(xingzhuang==3) {
|
zuid= group.getText();
|
if (zuid==null || zuid.length()<1 || zuid.length()>8) {
|
ShowMessage.zidingyi("һάÏß×éId²»ºÏ·¨Çë¼ì²é£¡");
|
return;
|
}
|
}
|
|
// Èç¹û´æÔÚÏàͬµÄΧÀ¸Ãû³ÆÔòÖ´ÐÐ
|
if (Dell_Polygon.found(name) != null) {
|
ShowMessage.zidingyi(name + "ÒѾ´æÔÚ²»ÄÜÖØ¸´Ìí¼Ó£¡");
|
return;
|
}
|
|
huizhi.setBackground(UIColor.getGrenn());
|
if (xingzhuang==0) {
|
getZuo_biao_ji().setText("µØÍ¼Éϵ¥»÷Êó±ê×ó¼ü¼ü\nÈ·¶¨ÆðµãºÍÖÕµã");
|
} else if (xingzhuang==1) {
|
getZuo_biao_ji().setText("µ¥»÷Êó±ê×ó¼ü»æÖƱպ϶à±ßÐΣ¡");
|
|
} else if (xingzhuang==2) {
|
getZuo_biao_ji().setText("µ¥»÷Êó±ê×ó¼ü»æÖÆÔ²ÐΣ¡");
|
String bjstr=jt_banjing.getText().trim();
|
if(bjstr.length()<1) {
|
ShowMessage.zidingyi("ÊäÈëÔ²Ðΰ뾶µ¥Î»ÀåÃ×");
|
return;
|
}
|
bj=Integer.parseInt(bjstr);
|
|
}else if(xingzhuang==3) {
|
getZuo_biao_ji().setText("µ¥»÷Êó±ê×ó¼ü»æÖÆÒ»Î¬Ïߣ¡");
|
}
|
int selectedIndex = leixingBox.getSelectedIndex();
|
if (selectedIndex == 14 && xingzhuang==0) {
|
ShowMessage.zidingyi("Î§Ç½ÇøÓò²»Ö§³Ö¾ØÐÎ");
|
return;
|
}
|
|
huizhiStart = true;
|
mycanvas.repaint();
|
|
}
|
});
|
}
|
return huizhi;
|
}
|
|
/**
|
* »ñÈ¡±£´æ°´Å¥µÄ·½·¨
|
*/
|
public JButtonModel getBaocun() {
|
if (baocun == null) {
|
baocun = new JButtonModel(buttonTitle.getSave());
|
baocun.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
huizhiStart = false;//µã»÷Íê±£´æºóÐèÒªÔٴεã»÷»æÖƲÅÄÜ¿ªÊ¼ÏÂÒ»¸öΧÀ¸µÄ»æÖÆ
|
String floor = (String) getComboBox().getSelectedItem();
|
if (floor.equals("ËùÓÐͼ²ã")){
|
floor="0";
|
}
|
String type = (String) getLeixngBox().getSelectedItem();
|
if (type.equals("¿¼ÇÚÇøÓò")&&!Systems.isSuidaomoshi()){
|
ShowMessage.zidingyi_24("»æÖÆ¿¼ÇÚΧÀ¸Ð迪ÆôËíµÀ¶¨Î»");
|
return;
|
}
|
String bumen = (String) getDepartmentBox().getSelectedItem();
|
String name = nameField.getText();
|
|
if (name.equals("")) {
|
ShowMessage.zidingyi("ΧÀ¸Ãû³Æ²»ÄÜΪ¿Õ£¡");
|
return;
|
}
|
|
// Èç¹û´æÔÚÏàͬµÄΧÀ¸Ãû³ÆÔòÖ´ÐÐ
|
if (Dell_Polygon.found(name) != null) {
|
ShowMessage.zidingyi_24(name + "ÒѾ´æÔÚ²»ÄÜÖØ¸´Ìí¼Ó£¡");
|
return;
|
}
|
String start = "00:00:00";
|
String stop = "23:59:59";
|
String color = (String) getColorBox().getSelectedItem();
|
|
//×ø±ê¼¯ºÏ
|
StringBuffer zuobiaos = new StringBuffer();
|
|
//Èç¹ûÑ¡ÖеÄÊǾØÐÎ
|
if (xingzhuang==0) {
|
if (pointjuxingnum == 2) {
|
int x1 = xjuxingc.get(0);
|
int y1 = yjuxingc.get(0);
|
int x3 = xjuxingc.get(1);
|
int y3 = yjuxingc.get(1);
|
int x2 = x3;
|
int y2 = y1;
|
int x4 = x1;
|
int y4 = y3;
|
reczb = x1 + "," + y1 + "," + x3 + "," + y3;//¾ØÐÎΧÀ¸×ø±ê
|
shape = "¾ØÐÎ";
|
zuobiaos.append(x1 + "," + y1 + ";" + x2 + "," + y2 + ";" + x3 + "," + y3 + ";" + x4 + "," + y4);
|
reczbjwd = getjxjwd(x1, y1, x2, y2, x3, y3, x4, y4, floor);//¶È¸ñʽµÄΧÀ¸×ø±ê
|
Dell_Polygon.add_a_fence_tomap(floor,type,bumen,name,reczb,shape,start,stop,color,allFloor);
|
}
|
|
} else if (xingzhuang==1) {
|
if (pointnum > 2) {
|
shape = "¶à±ßÐÎ";
|
reczb = getzuobiaos(xpointvc, ypointvc).toString();
|
Dell_Polygon.add_a_fence_tomap(floor,type,bumen,name,reczb,shape,start,stop,color,allFloor);
|
reczbjwd = getzuobiaosjwd(xpointvcjd, ypointvcwd).toString();
|
}
|
} else if(xingzhuang==2) {
|
shape = "Ô²ÐÎ";
|
reczb=xyuangvc+","+yyuangvc+","+bj;
|
Dell_Polygon.add_a_fence_tomap(floor,type,bumen,name,reczb,shape,start,stop,color,allFloor);
|
|
} else if (xingzhuang==3) {
|
if (type.equals("¶¨Î»ÇøÓò")) {
|
int s = Tools.suanfaVersion();
|
if (s < 43) {
|
ShowMessage.zidingyi_24("µ±Ç°Ëã·¨°æ±¾Îª" + DellJAN.getSuanfaversion() + ",Çë¸ü»»2.0.43ÒÔÉϵİ汾");
|
chushihua();
|
return;
|
}
|
shape = "һάÏß";
|
reczb = getzuobiaos(xline, yline).toString();
|
reczbjwd = getzuobiaosjwd(xlinejd, ylinewd).toString();
|
zuid= group.getText();
|
if (zuid==null || zuid.length()<1 || zuid.length()>8) {
|
ShowMessage.zidingyi("һάÏß×éId²»ºÏ·¨Çë¼ì²é£¡");
|
return;
|
}
|
Dell_Polygon.add_a_fence_tomap(floor,type,bumen,name,reczb,shape,start,stop,color,allFloor);
|
}
|
}
|
if (shape != null) {
|
//baoliu8¾Î³¶È¶È¸ñÊ½×ø±ê¸ñʽ
|
String[] ziduan = {"floor", "type", "bumen", "name", "zuobiao", "shape", "start", "stop",
|
"addtime", "color", "baoliu7", "baoliu8","baoliu10", "baoliu11","baoliu12"};
|
String[] zhi = {floor, type, bumen, name, reczb, shape, start, stop,
|
GetNowTime.now(), color, "1", reczbjwd,allFloor,"-1","-1"};
|
|
if (DatabaseManagement.insertfast("tb_fence", ziduan, zhi)) {
|
Fences.add_tbfence(floor, type, bumen, name, reczb, shape,
|
start, stop, GetNowTime.now(), color, "CS",allFloor);
|
ShowMessage.zidingyi("ΧÀ¸±£´æ" + name + "³É¹¦!");
|
if (type.equals("Ѳ¼ìÇøÓò")) {
|
Dell_xunjianset.insert(name);
|
} else if (type.equals("¶¨Î»ÇøÓò")) {
|
if (shape.equals("¾ØÐÎ")) {
|
Dell_Fenceinout.insert(name, zuobiaos.toString(), shape, floor, 0,allFloor);
|
} else if (shape.equals("¶à±ßÐÎ")) {
|
Dell_Fenceinout.insert(name, reczb, shape, floor, 0,allFloor);
|
} else if (shape.equals("һάÏß")) {
|
int size = xline.size();
|
int[] xs = new int[size];
|
int[] ys = new int[size];
|
for (int i = 0; i < size; i++) {
|
xs[i] = xline.get(i);
|
ys[i] = yline.get(i);
|
}
|
if (type.equals("¶¨Î»ÇøÓò")) {
|
Dell_tbline.insert_line(name, floor,zuid, String.valueOf(size), xs, ys, "1",allFloor);
|
}
|
}
|
} else if (type.equals("ÎÞÐ§ÇøÓò")) {
|
if (shape.equals("¾ØÐÎ")) {
|
Dell_Fenceinout.insert(name, zuobiaos.toString(), shape, floor, 3,allFloor);
|
} else if (shape.equals("¶à±ßÐÎ")) {
|
Dell_Fenceinout.insert(name, reczb, shape, floor, 3,allFloor);
|
}
|
}
|
chushihua();
|
zuo_biao_ji.setText("±£´æÎ§À¸³É¹¦");
|
}
|
} else {
|
ShowMessage.zidingyi("дÈëÊý¾Ý¿â³ö´í£¡");
|
}
|
|
}
|
});
|
}
|
return baocun;
|
}
|
|
/**
|
* »ñȡȡÏû°´Å¥µÄ·½·¨
|
*/
|
public JButtonModel getQuxiao() {
|
if (quxiao == null) {
|
quxiao = new JButtonModel("È¡Ïû");
|
quxiao.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
getZuo_biao_ji().setText("");
|
chushihua();
|
}
|
});
|
}
|
return quxiao;
|
}
|
|
|
/**
|
* »ñȡѡÔñ²¿ÃÅÏÂÀ¿ò
|
*/
|
public JComboBox<String> getDepartmentBox() {
|
|
if (departmentBox == null) {
|
departmentBox = new JComboBox<>();//´´½¨ÏÂÀ¿ò¶ÔÏó
|
departmentBox.setBackground(Color.white);
|
departmentBox.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå
|
if (BuMens.getBumenNames() == null) {
|
return departmentBox;
|
}
|
ComboBoxModel<String> coModel = new DefaultComboBoxModel<>(BuMens.getBumenNames());//ÏÂÀÁбíÄ£ÐÍ
|
departmentBox.setModel(coModel);
|
departmentBox.updateUI();//¸üÐÂUI
|
|
}
|
|
return departmentBox;
|
}
|
|
|
public JlableModel getChooseMap() {
|
if (chooseMap == null) {
|
chooseMap = new JlableModel();
|
chooseMap.setText("Ñ¡Ôñͼ²ã:");
|
}
|
return chooseMap;
|
}
|
|
/**
|
* »ñȡѡÔñͼ²ãÏÂÀÁбí¿ò
|
*/
|
public JComboBox<String> getComboBox() {
|
ComboBoxModel<String> coModel = new DefaultComboBoxModel<>(Map_Dell.get_all_floor());//ÏÂÀÁбíÄ£ÐÍ
|
if (comboBox == null) {
|
comboBox = new JComboBox<>();//´´½¨ÏÂÀ¿ò¶ÔÏótagComboBox
|
comboBox.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå
|
comboBox.setBackground(Color.white);
|
comboBox.setModel(coModel);
|
comboBox.setSelectedIndex(0);
|
comboBox.addItemListener(new ItemListener() {
|
public void itemStateChanged(ItemEvent e) {
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
floor = (String) getComboBox().getSelectedItem();//ͼƬËùÔڵIJã
|
if (floor.equals("ËùÓÐͼ²ã")){
|
allFloor="1";
|
floor="0";
|
}else {
|
allFloor="0";
|
}
|
TbMap map = Map_Dell.get_map(floor);
|
if(map !=null) {
|
String name = map.getMapname();//»ñÈ¡µØÍ¼Ãû³Æ
|
image = new ImageIcon("image/mapfile/" + name).getImage();
|
map_true_width = Map_Dell.get_map(floor).getX_Truelength();//µØÍ¼X·½Ïòʵ³¤
|
map_true_height = Map_Dell.get_map(floor).getY_Truewidth();//µØÍ¼Y·½Ïòʵ³¤
|
width = Map_Dell.get_map(floor).getX_Pixel();//ͼƬxÏñËØ
|
height = Map_Dell.get_map(floor).getY_Pixel();//ͼyÏñËØ
|
new_width = width;
|
new_height = height;
|
x_bi = map_true_width / new_width;
|
y_bi = map_true_height / new_height;
|
x0 = 0;
|
y0 = 0;
|
xpy = Map_Dell.get_map(floor).getX0_length();
|
ypy = Map_Dell.get_map(floor).getY0_width();
|
}
|
}
|
mycanvas.repaint();
|
}
|
});
|
|
|
}
|
return comboBox;
|
}
|
|
|
public JComboBox<String> getLeixngBox() {
|
if (leixingBox == null) {
|
String[] leixing = {"¿¼ÇÚÇøÓò", "½øÈë¸æ¾¯", "³öÈ¥¸æ¾¯", "³¬Ô±±¨¾¯", "³¬Ê±±¨¾¯", "Ѳ¼ìÇøÓò", "¶¨Î»ÇøÓò",
|
"ÊÒÄÚÇøÓò", "Çл»ÇøÓò", "ÊÓÆµÇøÓò", "ÎÞÐ§ÇøÓò", "×÷񵂿Óò", "½øÃŸ澯", "³öß澯", "Î§Ç½ÇøÓò"};
|
leixingBox = new JComboBox<>(leixing);//´´½¨ÏÂÀ¿ò¶ÔÏótagComboBox
|
leixingBox.setFont(new Font("TimesRoman", Font.PLAIN, 13));//ÉèÖÃ×ÖÌå
|
leixingBox.setBackground(Color.white);
|
leixingBox.setEnabled(true);
|
|
}
|
return leixingBox;
|
|
}
|
|
//×éid
|
public JTextField getGroup() {
|
group.setForeground(Color.gray);
|
group.addFocusListener(new FocusAdapter() {
|
@Override
|
public void focusGained(FocusEvent e) {
|
|
group.setText("");
|
group.setForeground(Color.black);
|
}
|
});
|
return group;
|
}
|
|
public JComboBox<String> getColorBox() {
|
if (colorBox == null) {
|
String[] ys = {"ºìÉ«", "À¶É«", "ÂÌÉ«", "ºÚÉ«", "°×É«", "Æ·ºì"};
|
colorBox = new JComboBox<>(ys);//´´½¨ÏÂÀ¿ò¶ÔÏótagComboBox
|
colorBox.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå
|
colorBox.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
xuanze = (String) colorBox.getSelectedItem();
|
}
|
});
|
}
|
return colorBox;
|
|
}
|
|
|
|
|
|
/**
|
* »ñÈ¡µØÍ¼
|
*/
|
public Image getImage() {
|
return image;
|
}
|
|
/**
|
* ÉèÖõØÍ¼
|
*/
|
public void setImage(String imageAdress) {
|
image = new ImageIcon(imageAdress).getImage();//»ñÈ¡µØÍ¼
|
}
|
|
public JTextField getZuobiao() {
|
if (zuobiao == null) {
|
zuobiao = new JTextField(20);
|
}
|
return zuobiao;
|
}
|
|
/**
|
* ÄÚ²¿µÄ»²¼
|
*/
|
class Mycanvas extends Canvas implements MouseListener, MouseMotionListener, MouseWheelListener {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
int countnum = 200;
|
Point origin;
|
int orix;
|
int oriy;
|
int rox;
|
int roy;
|
boolean dian = false;
|
boolean title = false;
|
String zuobiao;
|
Timer timer = new Timer();//н¨¶¨Ê±Æ÷£¬Ë«»÷¼ì²â¼ä¸ôΪ500ms
|
boolean flag = false;//Ë«»÷ʼþÒÑÖ´ÐÐʱÖÃÎªÕæ
|
int clickNum = 1; //ָʾÊó±êµã»÷´ÎÊý£¬Ä¬ÈÏΪµ¥»÷
|
|
Image ImageBuffer = null;
|
Graphics GraImage = null;
|
|
public void update(Graphics g) { //¸²¸Çupdate·½·¨£¬½ØÈ¡Ä¬Èϵĵ÷Óùý³Ì
|
ImageBuffer = createImage(this.getWidth(), this.getHeight()); //´´½¨Í¼Ðλº³åÇø
|
GraImage = ImageBuffer.getGraphics(); //»ñȡͼÐλº³åÇøµÄͼÐÎÉÏÏÂÎÄ
|
paint(GraImage); //ÓÃpaint·½·¨ÖбàдµÄ»æÍ¼¹ý³Ì¶ÔͼÐλº³åÇø»æÍ¼
|
GraImage.dispose(); //ÊÍ·ÅͼÐÎÉÏÏÂÎÄ×ÊÔ´
|
g.drawImage(ImageBuffer, 0, 0, this); //½«Í¼Ðλº³åÇø»æÖƵ½ÆÁÄ»ÉÏ
|
}
|
|
|
public Mycanvas() {
|
origin = new Point();
|
addMouseWheelListener(this);
|
addMouseListener(this);
|
addMouseMotionListener(this);
|
}
|
|
|
public void paint(Graphics g) {
|
Graphics2D g2 = (Graphics2D) g;
|
g2.drawImage(image, x0, y0, new_width, new_height, this);
|
framey = this.getSize().height;//µ±Ç°Ãæ°åµÄ¸ß¶È
|
framex = this.getSize().width;
|
|
|
if (true) { //»æÖÆÔµã
|
g2.setColor(Color.red);
|
g2.fillOval(x0, y0, 8, 8);
|
/**»æÖÆÒѾ´æÔÚµÄΧÀ¸¶ÔÏó**/
|
Drawok.fence(floor, x_bi, y_bi, x0, y0, xpy, ypy, g2,bi);
|
//»æÖÆ×ø±êʵʱ
|
drawxy(g2);
|
//»æÖƱêÇ©¶ÔÏó
|
drawperson(g2);
|
}
|
|
/**»æÖÆÁÙʱ¾ØÐÎ*/
|
if (huizhiStart && xingzhuang==0) {
|
drawjuxing(g2, pointjuxingnum, xjuxingc, yjuxingc);
|
}
|
|
//Èç¹ûÑ¡Ôñ¶à±ßÐÎÔòÖ´ÐлæÖƶà±ßÐÎ
|
if (huizhiStart && xingzhuang==1) {
|
drawduobianxing(g2, pointnum, xpointvc, ypointvc);
|
}
|
|
//Èç¹ûÑ¡ÔñһάÏß
|
if (huizhiStart && xingzhuang==3) {
|
drawLine(g2, pointlinenum, xline, yline);
|
}
|
|
//Èç¹ûÑ¡Ôñ»æÖÆÔ²ÐÎ
|
if (huizhiStart && xingzhuang==2) {
|
draw_yuan(g2);
|
}
|
|
|
|
//»æÖÆ»ùÕ¾
|
draw_anchor(g2, floor);
|
}
|
|
|
public void mouseReleased(MouseEvent e) {//°´¼üÊÍ·Å
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
this.repaint();
|
|
}
|
|
//°´¼ü°´ÏÂ
|
public void mousePressed(MouseEvent e) {
|
origin.x = e.getX(); //»ñµÃÊó±êµã»÷ʱºòµÄX×ø±ê
|
origin.y = e.getY();//»ñµÃÊó±êµã»÷ʱºòµÄY×ø±ê
|
orix = x0;//½«µ±Ç°Í¼Æ¬µÄÆðµã×ø±êX¸øorix
|
oriy = y0;//½«µ±Ç°Í¼Æ¬µÄÆðµã×ø±êX¸øoriy
|
rox = rx0;//½«¾ØÐÎµÄÆôµã×ø±ê¸øROX
|
roy = ry0;//½«¾ØÐÎµÄÆôµã×ø±ê¸øROX
|
}
|
|
public void mouseExited(MouseEvent e) {//Êó±êÍ˳ö
|
|
}
|
|
public void mouseEntered(MouseEvent e) {//Êó±ê½øÈë
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
|
}
|
|
|
/**
|
* Êó±êµã»÷ʼþ
|
*/
|
public void mouseClicked(MouseEvent e) {//Êó±êµã»÷
|
//µã»÷Êó±ê×ó¼üͬʱѡÔñµÄÊǾØÐβ¢ÇÒµã»÷ÁË¿ªÊ¼»æÖÆ
|
if (e.getButton() == MouseEvent.BUTTON1 && huizhiStart) {
|
int xpoint = (new Double((e.getX() - x0) * x_bi)).intValue() + xpy;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx;
|
int ypoint = (new Double((e.getY() - y0) * y_bi)).intValue() + ypy;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy;
|
if (xingzhuang==0) {
|
if (mouseclicknum == 0) {
|
xjuxingc.add(xpoint);
|
yjuxingc.add(ypoint);
|
pointjuxingnum = 1;
|
mouseclicknum = 1;
|
zuo_biao_ji.setText("»æÖƵÚ" + pointjuxingnum + "¸öµã\n xy=" + xpoint + ";" + xpoint);
|
} else if (mouseclicknum == 1) {
|
mouseclicknum = 2;
|
xjuxingc.add(xpoint);
|
yjuxingc.add(ypoint);
|
pointjuxingnum = 2;
|
zuo_biao_ji.setText("ΧÀ¸ÒѾ»æÖÆÍê³Éµã»÷±£´æ");
|
}
|
|
} else if (xingzhuang==1) {
|
pointnum++;
|
xpointvc.add(xpoint);
|
ypointvc.add(ypoint);
|
String[] jw = Juge_indoor.xy2d(xpoint + "", ypoint + "", floor);//XY×ø±êתΪ¾Î³¶È
|
xpointvcjd.add(jw[0]);//XY×ø±êתΪ¾Î³¶È¾¶È¼¯ºÏ
|
ypointvcwd.add(jw[1]);//XY×ø±êתΪ¾Î³¶Èγ¶È¼¯ºÏ
|
getZuo_biao_ji().setText("»æÖƵÚ" + pointnum + "¸öµã\n xy=" + xpoint + ";" + xpoint);
|
} else if(xingzhuang==2){
|
mouseclicknum=2;
|
xyuangvc=xpoint;
|
yyuangvc=ypoint;
|
getZuo_biao_ji().setText("Ô²ÐÄ×ø±ê" + "xy=" + xpoint + ";" + xpoint);
|
|
} else if (xingzhuang==3) {
|
pointlinenum++;
|
xline.add(xpoint);
|
yline.add(ypoint);
|
String[] jw = Juge_indoor.xy2d(xpoint + "", ypoint + "", floor);//XY×ø±êתΪ¾Î³¶È
|
xlinejd.add(jw[0]);//XY×ø±êתΪ¾Î³¶È¾¶È¼¯ºÏ
|
ylinewd.add(jw[1]);//XY×ø±êתΪ¾Î³¶Èγ¶È¼¯ºÏ
|
getZuo_biao_ji().setText("»æÖƵÚ" + pointlinenum + "¸öµã\n xy=" + xpoint + ";" + xpoint);
|
}
|
this.repaint();
|
}
|
}
|
|
|
public void mouseDragged(MouseEvent e) {
|
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
|
//Ãæ°åеÄ×ø±êλÖà = ÒÆ¶¯Ç°×ø±êλÖÃ+£¨Êó±êÖ¸Õëµ±Ç°×ø±ê-Êó±ê°´ÏÂʱָÕëµÄλÖã©
|
x0 = e.getX() - origin.x + orix;
|
y0 = e.getY() - origin.y + oriy;
|
rx0 = e.getX() - origin.x + rox;
|
ry0 = e.getY() - origin.y + roy;
|
this.repaint();
|
|
}
|
|
|
/**
|
* Êó±êÒÆ¶¯Ê¼þ¼àÌý
|
*/
|
public void mouseMoved(MouseEvent e) {
|
x_cursor = e.getX();//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
y_cursor = e.getY();//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
xpos = (new Double((x_cursor - x0) * x_bi)).intValue() + xpy;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx
|
ypos = (new Double((y_cursor - y0) * y_bi)).intValue() + ypy;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy
|
zuobiaoText = " ×ø±ê£ºX=" + xpos + " Y=" + ypos + "(" + x_cursor + ";" + y_cursor + ")";
|
getZuobiao().setText(zuobiaoText);
|
|
if (mouseclicknum == 1 && huizhiStart) {
|
if(xingzhuang==0) {
|
juxing_wh[0] = (new Double((x_cursor - x0) * x_bi)).intValue() + xpy;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx;
|
juxing_wh[1] = (new Double((y_cursor - y0) * y_bi)).intValue() + ypy;//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy
|
}
|
}
|
if(mouseclicknum > 1 && huizhiStart) {
|
if(xingzhuang==2) {
|
bj=Integer.parseInt(jt_banjing.getText());
|
}
|
}
|
this.repaint();
|
}
|
|
|
/**
|
* Êó±ê¹öÂÖ¹ö¶¯Ê¼þ¼àÌý
|
*/
|
public void mouseWheelMoved(MouseWheelEvent e) {//Êó±ê¹öÂÖ¹ö¶¯¼àÌý
|
//e.getWheelRotation()>0±íʾÊó±ê¹öÂÖÏòÍâ¹ö¶¯Ð¡ÓÚ0±íʾÏòÄÚ¹ö¶¯
|
|
int xh1 = e.getX();
|
int yh1 = e.getY();
|
double bi0 = bi;
|
int xr = x0;
|
int yr = y0;
|
|
if (e.getWheelRotation() > 0 && countnum > 0) {//ËõСͼƬ
|
countnum = countnum - 50;
|
bi = Map_suo_fang.get_bi(countnum);
|
|
}
|
|
if (e.getWheelRotation() < 0 && countnum < 600) {//·Å´óͼƬ
|
countnum = countnum + 50;
|
bi = Map_suo_fang.get_bi(countnum);
|
}
|
|
new_width = new Double(width * bi).intValue();
|
new_height = new Double(height * bi).intValue();
|
new_rWidth = new Double(rWidth * bi).intValue();//¾ØÐεĿí¶È
|
new_rHeight = new Double(rHeight * bi).intValue();//¾ØÐεĿí¶È
|
x_bi = map_true_width / new_width;//µØÍ¼µÄʵ¼Ê³¤¶ÈºÍеĿí¶È±ÈÖµ
|
y_bi = map_true_height / new_height;//µØÍ¼Êµ¼Ê¸ß¶ÈºÍеĸ߶ȱÈÖµ
|
rx0 = new Double(rspx / x_bi + x0).intValue();//¾ØÐÎÆðµã×ø±êx
|
ry0 = new Double(rspy / y_bi + y0).intValue();//¾ØÐÎÆðµã×ø±êy
|
x0 = new Double(xh1 - (xh1 - xr) * bi / bi0).intValue();
|
y0 = new Double(yh1 - (yh1 - yr) * bi / bi0).intValue();
|
this.repaint();
|
}
|
|
}
|
|
/**
|
* µ¯³ö²Ëµ¥
|
*/
|
public JPopupMenu popupMenu() {
|
JPopupMenu popupMenu = new JPopupMenu();// ´´½¨µ¯³öʽ²Ëµ¥¶ÔÏó
|
popupMenu.setBorderPainted(false);
|
JMenuItem center = new JMenuItem("Ôµã¾ÓÖÐ");//´´½¨²Ëµ¥Ïî
|
center.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
x0 = framex / 2;
|
y0 = framey / 2;
|
mycanvas.repaint();
|
}
|
});
|
popupMenu.add(center);
|
return popupMenu;
|
}
|
|
/**
|
* »æÖÆÊµÊ±×ø±ê±³¾°¿ò
|
*/
|
public void drawxy(Graphics2D g2) {
|
g2.setColor(grenn);//ÂÌÉ«
|
g2.fillRoundRect(50, 10, 140, 60, 10, 10);
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(Color.white);
|
g2.setFont(FontChoose.ziti(18));
|
g2.drawString("x:" + xpos, 60, 35);
|
g2.drawString("y:" + ypos, 60, 55);
|
//»æÖƵ±Ç°Êó±êµÄλÖÃ
|
g2.setColor(Color.red);
|
g2.fillOval(xtonowx(xpos), ytonowy(ypos), 8, 8);
|
|
}
|
|
/**
|
* »æÖƱêÇ©¶ÔÏó
|
*/
|
public void drawperson(Graphics2D g2) {
|
if (person_Dell.getPerson_vector().size() != 0) {
|
for (int i = 0; i < person_Dell.getPerson_vector().size(); i++) {
|
Person person = person_Dell.getPerson_vector().get(i);
|
if (person == null) {
|
continue;
|
}
|
String online = person.getP_online();
|
if (online.equals("0")) {
|
continue;
|
}
|
if (!person.getP_floor().equals(floor)) {
|
continue;
|
}
|
int posx = person.getP_x();
|
int posy = person.getP_y();
|
int x = xtonowx(posx);
|
int y = ytonowy(posy);
|
int tbw = person.getP_image().getIconWidth();
|
int tbh = person.getP_image().getIconHeight();
|
//»æÖƱêÇ©
|
g2.drawImage(person.getP_image().getImage(), x - tbw / 2, y - tbh, tbw, tbh, this);
|
g2.setColor(GetColor.getGreen());//ÂÌÉ«
|
g2.fillRoundRect(x - 45, y - tbh - 40, 90, 30, 3, 3);
|
g2.setColor(Color.BLACK);
|
g2.setFont(font);
|
g2.drawString(person.getP_name(), x - 40, y - tbh - 20);
|
g2.drawString(person.getP_tagid(), x + 10, y - tbh - 20);
|
|
}
|
}
|
}
|
|
/**
|
* ½«µ±Ç°×ø±êתΪͼÉÏλÖõķ½·¨
|
*/
|
public int xtonowx(int posx) {
|
int posx_x0 = posx - Map_Dell.get_map(floor).getX0_length();
|
double xx = (posx_x0 / x_bi) + x0;
|
int x = (int) xx;
|
return x;
|
}
|
|
/**
|
* ½«µ±Ç°×ø±êתΪͼÉÏλÖõķ½·¨
|
*/
|
public int ytonowy(int posy) {
|
int posy_y0 = posy - Map_Dell.get_map(floor).getY0_width();
|
double yy = (posy_y0 / y_bi) + y0;
|
int y = (int) yy;
|
return y;
|
}
|
|
/**
|
* »æÖƶà±ßÐÎ
|
*/
|
public void drawduobianxing(
|
Graphics2D g2,
|
int pointnum,
|
Vector<Integer> xpointvc,
|
Vector<Integer> ypointvc) {
|
g2.setColor(Color.RED);
|
g2.setStroke(stroke);
|
if (pointnum > 2) {//»æÖƶà±ßÐÎ
|
g2.setColor(ChooseColor.getColo(xuanze, 90));
|
int[] xPoints = new int[pointnum];
|
int[] yPoints = new int[pointnum];
|
for (int i = 0; i < pointnum; i++) {
|
xPoints[i] = xpointvc.get(i);
|
yPoints[i] = ypointvc.get(i);
|
xPoints[i] = (new Double((xPoints[i] - xpy) / x_bi)).intValue() + x0;
|
yPoints[i] = (new Double((yPoints[i] - ypy) / y_bi)).intValue() + y0;
|
|
}
|
g2.fillPolygon(xPoints, yPoints, pointnum);
|
} else if (pointnum == 2) {//»æÖÆÖ±Ïß
|
int x1 = xpointvc.get(0);
|
int x2 = xpointvc.get(1);
|
int y1 = ypointvc.get(0);
|
int y2 = ypointvc.get(1);
|
x1 = (new Double((x1 - xpy) / x_bi)).intValue() + x0;
|
x2 = (new Double((x2 - xpy) / x_bi)).intValue() + x0;
|
y1 = (new Double((y1 - ypy) / y_bi)).intValue() + y0;
|
y2 = (new Double((y2 - ypy) / y_bi)).intValue() + y0;
|
g2.drawLine(x1, y1, x2, y2);
|
|
} else if (pointnum == 1) {//»æÖÆÔ²ÐÎ
|
int x1 = xpointvc.get(0);
|
int y1 = ypointvc.get(0);
|
x1 = (new Double((x1 - xpy) / x_bi)).intValue() + x0;
|
y1 = (new Double((y1 - ypy) / y_bi)).intValue() + y0;
|
g2.fillOval(x1 - 3, y1 - 3, 6, 6);
|
}
|
}
|
|
/**
|
* »æÖÆÒ»Î¬Ïß
|
*/
|
public void drawLine(Graphics2D g2, int pointnum, Vector<Integer> xpointvc, Vector<Integer> ypointvc) {
|
g2.setColor(Color.RED);
|
g2.setStroke(stroke);
|
g2.setColor(ChooseColor.getColo(xuanze, 90));
|
int[] xPoints = new int[pointnum];
|
int[] yPoints = new int[pointnum];
|
for (int i = 0; i < pointnum; i++) {
|
xPoints[i] = xpointvc.get(i);
|
yPoints[i] = ypointvc.get(i);
|
xPoints[i] = (new Double((xPoints[i] - xpy) / x_bi)).intValue() + x0;
|
yPoints[i] = (new Double((yPoints[i] - ypy) / y_bi)).intValue() + y0;
|
|
}
|
g2.drawPolyline(xPoints, yPoints, pointnum);
|
|
}
|
|
/**»æÖÆÔ²ÐÎ*/
|
public void draw_yuan(Graphics2D g2) {
|
int posx = (new Double((xyuangvc - xpy) / x_bi)).intValue() + x0;
|
int posy = (new Double((yyuangvc - ypy) / y_bi)).intValue() + y0;
|
int r1=2*(new Double(bj/x_bi)).intValue();
|
int r2=2*(new Double(bj/y_bi)).intValue();
|
g2.setColor(ChooseColor.getColo(xuanze, 90));
|
g2.fillOval(posx-4, posy-4,8,8);
|
g2.fillOval(posx-r1/2, posy-r2/2,r1,r2);
|
}
|
/**
|
* »æÖƾØÐÎ
|
*/
|
public void drawjuxing(
|
Graphics2D g2,
|
int pointnum,
|
Vector<Integer> xpointvc,
|
Vector<Integer> ypointvc) {
|
g2.setColor(Color.RED);
|
g2.setStroke(stroke);
|
if (pointnum == 1) {
|
int x1 = xpointvc.get(0);
|
int y1 = ypointvc.get(0);
|
if (mouseclicknum == 1) {
|
g2.setColor(ChooseColor.getColo(xuanze, 90));
|
int posx = (new Double((x1 - xpy) / x_bi)).intValue() + x0;
|
int posy = (new Double((y1 - ypy) / y_bi)).intValue() + y0;
|
int x2 = new Double(juxing_wh[0]).intValue();
|
int y2 = new Double(juxing_wh[1]).intValue();
|
int posw = (new Double((x2 - x1) / x_bi)).intValue();
|
int posh = (new Double((y2 - y1) / y_bi)).intValue();
|
g2.fillRect(posx, posy, posw, posh);
|
} else {
|
int posx = (new Double((x1 - xpy) / x_bi)).intValue() + x0;
|
int posy = (new Double((y1 - ypy) / y_bi)).intValue() + y0;
|
g2.fillOval(posx - 3, posy - 3, 6, 6);
|
}
|
|
|
} else if (pointnum == 2) {
|
g2.setColor(ChooseColor.getColo(xuanze, 90));
|
int x1 = xpointvc.get(0);
|
int x2 = xpointvc.get(1);
|
int y1 = ypointvc.get(0);
|
int y2 = ypointvc.get(1);
|
int posx = (new Double((x1 - xpy) / x_bi)).intValue() + x0;
|
int posy = (new Double((y1 - ypy) / y_bi)).intValue() + y0;
|
int posw = (new Double((x2 - x1) / x_bi)).intValue();
|
int posh = (new Double((y2 - y1) / y_bi)).intValue();
|
g2.fillRect(posx, posy, posw, posh);
|
}
|
|
}
|
|
/**
|
* »ñÈ¡×ø±êµÄ¼¯ºÏ
|
*/
|
public double[] getpoint(Vector<Integer> pointvc) {
|
int size = pointvc.size();
|
double[] point = new double[size];
|
for (int i = 0; i < size; i++) {
|
point[i] = pointvc.get(i);
|
}
|
return point;
|
}
|
|
/**
|
* XY×ø±êµÄ¼¯ºÏ
|
*/
|
public StringBuffer getzuobiaos(Vector<Integer> xpointvc, Vector<Integer> ypointvc) {
|
StringBuffer zuobiaos = new StringBuffer();
|
int size = xpointvc.size();
|
for (int i = 0; i < size; i++) {
|
int x = xpointvc.get(i);
|
int y = ypointvc.get(i);
|
String xy = x + "," + y;
|
if (i == size - 1) {
|
zuobiaos.append(xy);
|
} else {
|
zuobiaos.append(xy + ";");
|
}
|
}
|
return zuobiaos;
|
}
|
|
/**
|
* »ñÈ¡¾Î³¶È×ø±êµÄ×Ö·û´®
|
*/
|
public StringBuffer getzuobiaosjwd(Vector<String> xpointvc, Vector<String> ypointvc) {
|
StringBuffer zuobiaos = new StringBuffer();
|
int size = xpointvc.size();
|
for (int i = 0; i < size; i++) {
|
String jd = xpointvc.get(i);
|
String wd = ypointvc.get(i);
|
String xy = jd + "," + wd;
|
if (i == size - 1) {
|
zuobiaos.append(xy);
|
} else {
|
zuobiaos.append(xy + ";");
|
}
|
}
|
return zuobiaos;
|
}
|
|
/**
|
* ³õʼ»¯
|
*/
|
public void chushihua() {
|
|
mouseclicknum = 0;
|
pointnum = 0;//¶¨µãµÄÊýÁ¿
|
pointjuxingnum = 0;
|
pointlinenum = 0;
|
xpointvc.removeAllElements();
|
ypointvc.removeAllElements();
|
xjuxingc.removeAllElements();
|
yjuxingc.removeAllElements();
|
xline.removeAllElements();
|
yline.removeAllElements();
|
mycanvas.repaint();
|
}
|
|
/**
|
* »æÖÆ»ùÕ¾¶ÔÏó
|
*/
|
public void draw_anchor(Graphics2D g2, String mapfloor) {
|
int size2 = Anchor_Dell.getAnchor_vector().size();
|
if (size2 != 0) {
|
for (int k = 0; k < size2; k++) {
|
Anchor anchor = Anchor_Dell.getAnchor_vector().get(k);
|
if (mapfloor.equals(anchor.getAnc_floor())) {
|
String axs = anchor.getAnc_x();
|
String ays = anchor.getAnc_y();
|
double axd = Double.valueOf(axs);
|
double ayd = Double.valueOf(ays);
|
int acx = (int) axd;
|
int acy = (int) ayd;
|
int anx = get_xpos(mapfloor, acx);
|
int any = get_ypos(mapfloor, acy);
|
if (anchor.getAnc_image() != null) {
|
int anwidth = anchor.getAnc_image().getWidth(this);
|
int anheight = anchor.getAnc_image().getHeight(this);
|
//Èç¹û»ùÕ¾ÊDZ»Ñ¡ÖеĻùÕ¾
|
if (AnchorManage.getChoose_anchor().equals(anchor.getAnc_id())) {
|
g2.drawImage(Anchor_Dell.getCeju(), anx - anwidth / 2, any - anheight, anwidth, anheight, this);
|
} else {
|
g2.drawImage(anchor.getAnc_image(), anx - anwidth / 2, any - anheight, anwidth, anheight, this);
|
}
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(ancid);
|
g2.drawString(anchor.getAnc_id(), anx - 15, any - anheight - 6);
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(Color.gray);
|
String anx1 = anchor.getAnc_x();
|
String any1 = anchor.getAnc_y();
|
String anzb = "[" + anx1 + "," + any1 + "]";
|
g2.drawString(anzb, anx - 20, any + 14);
|
}
|
}
|
}
|
}
|
}
|
|
/**
|
* »ñÈ¡ÔÚµØÍ¼ÖеÄX×ø±ê
|
*/
|
public int get_xpos(String mapfloor, int x) {
|
double anc_x = x - Map_Dell.get_map(mapfloor).getX0_length();
|
double xx = (anc_x / x_bi) + x0;
|
int anx = (int) Math.round(xx);
|
return anx;
|
}
|
|
/**
|
* »ñÈ¡ÔÚµØÍ¼ÖеÄY×ø±ê
|
*/
|
public int get_ypos(String mapfloor, int y) {
|
double anc_y = y - Map_Dell.get_map(mapfloor).getY0_width();
|
double yy = (anc_y / y_bi) + y0;
|
int any = (int) Math.round(yy);
|
return any;
|
}
|
|
/**
|
* »ñÈ¡¾ØÐÎΧÀ¸µÄ¾Î³¶È×ø±ê
|
*/
|
public static String getjxjwd(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, String floor) {
|
String ax = x1 + "";
|
String ay = y1 + "";
|
String bx = x2 + "";
|
String by = y2 + "";
|
String cx = x3 + "";
|
String cy = y3 + "";
|
String dx = x4 + "";
|
String dy = y4 + "";
|
String[] xy1 = Juge_indoor.xy2d(ax, ay, floor);
|
ax = xy1[0];
|
ay = xy1[1];
|
String[] xy2 = Juge_indoor.xy2d(bx, by, floor);
|
bx = xy2[0];
|
by = xy2[1];
|
String[] xy3 = Juge_indoor.xy2d(cx, cy, floor);
|
cx = xy3[0];
|
cy = xy3[1];
|
String[] xy4 = Juge_indoor.xy2d(dx, dy, floor);
|
dx = xy4[0];
|
dy = xy4[1];
|
String reczb = ax + "," + ay + ";" + bx + "," + by + ";" + cx + "," + cy + ";" + dx + "," + dy;//¾ØÐÎΧÀ¸×ø±ê
|
return reczb;
|
}
|
|
|
public JComboBox<String> getJc_xingzhuang() {
|
if (jc_xingzhuang == null) {
|
jc_xingzhuang = new JComboBox<>();//´´½¨ÏÂÀ¿ò¶ÔÏó
|
jc_xingzhuang.setBackground(Color.white);
|
jc_xingzhuang.setFont(new Font("΢ÈíÑźÚ", Font.PLAIN, 12));//ÉèÖÃ×ÖÌå
|
String[] a0= {"¾ØÐÎ","¶à±ßÐÎ","Ô²ÐÎ","һάÏß"};
|
ComboBoxModel<String> coModel = new DefaultComboBoxModel<>(a0);//ÏÂÀÁбíÄ£ÐÍ
|
jc_xingzhuang.setModel(coModel);
|
jc_xingzhuang.updateUI();//¸üÐÂUI
|
jc_xingzhuang.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
xingzhuang=jc_xingzhuang.getSelectedIndex();
|
xzstr=(String) jc_xingzhuang.getSelectedItem();
|
if(xingzhuang==3) {
|
getLeixngBox().setSelectedIndex(6);
|
getLeixngBox().setEnabled(false);
|
jt_banjing.setEnabled(false);
|
}else if(xingzhuang==2){
|
jt_banjing.setEnabled(true);
|
}else {
|
getLeixngBox().setEnabled(true);
|
jt_banjing.setEnabled(false);
|
}
|
}
|
});
|
|
}
|
return jc_xingzhuang;
|
}
|
|
|
|
|
}
|