package relloc;
|
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.Graphics;
|
import java.awt.Graphics2D;
|
import java.awt.Image;
|
import java.awt.Point;
|
import java.awt.Stroke;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseListener;
|
import java.awt.event.MouseMotionListener;
|
import java.awt.event.MouseWheelEvent;
|
import java.awt.event.MouseWheelListener;
|
import java.lang.ref.SoftReference;
|
import java.util.Vector;
|
import javax.swing.ImageIcon;
|
import javax.swing.JMenuItem;
|
import javax.swing.JPopupMenu;
|
import javax.swing.event.InternalFrameEvent;
|
import javax.swing.event.InternalFrameListener;
|
import BaoWen.Stac;
|
import ColorAndFont.ChooseColor;
|
import ColorAndFont.UIColor;
|
import DrawImage.Drawok;
|
import Frame.AnchorManage;
|
import Frame.AnchorNearby;
|
import Frame.DebugManage;
|
import JNADell.DellJAN;
|
import Judge.JugeNumber;
|
import Method.Bj;
|
import Method.Map_suo_fang;
|
import PbuliClass.FastAddAnc;
|
import PbuliClass.Systems;
|
import PbuliClass.jinternalFrame;
|
import ToolBarS.ToolBarModel;
|
import anchor.Anchor;
|
import anchor.Anchor_Dell;
|
import anchor.Dell_cengao;
|
import circle.Dell_ResultYuang;
|
import circle.Dell_yuang;
|
import circle.ResultYuang;
|
import circle.Yuang;
|
import circle.Yuangvc;
|
import fence.Fences;
|
import fence.kaoqing.Dell_KaoQing;
|
import person.Person;
|
import person.person_Dell;
|
import tbDataModel.RealTrackPoint;
|
import tbDataModel.TbFence;
|
import tbDataModel.TbMap;
|
import tbDataModel.Tb_gas_anchor;
|
import tbDataModel_Dell.Dell_Line;
|
import tbDataModel_Dell.Dell_ReallPoint;
|
import tbDataModel_Dell.Dell_tb_gas_anchor;
|
import tbDataModel_Dell.Dell_yuan;
|
import tbDataModel_Dell.FontChoose;
|
import tbDataModel_Dell.Map_Dell;
|
|
/**¸ÃÀàÓÃÓÚʵʱÏÔʾ±êǩλÖÃ*/
|
public class RealLoc extends jinternalFrame implements Runnable {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
Mycanvas mycanvas=null;
|
double bi=1;//µØÍ¼Ëõ·Å±ÈÀý³õʼֵΪ1ĬÈϲ»Ëõ·Å
|
int countnum=200;
|
Point origin;
|
int x0=0;//µØÍ¼Î»ÖÃX×ø±ê,ͨ¹ý¸Ä±ä´ËÖµ¸Ä±äµØÍ¼Î»ÖÃ
|
int y0=0;//µØÍ¼Î»ÖÃy×ø±ê,ͨ¹ý¸Ä±ä´ËÖµ¸Ä±äµØÍ¼Î»ÖÃ
|
static int x1=0;
|
static int y1=0;
|
int width;//µØÍ¼³õʼ¿í¶È
|
int height;//µØÍ¼³õʼ¸ß¶È
|
int new_width;//µØÍ¼ÐµĿí¶È£¬Í¨¹ý¸Ä±ä´ËÖµ¿ÉÒÔ¸Ä±äµØÍ¼µÄ¿í¶È
|
int new_height;//µØÍ¼Ðµĸ߶ȣ¬Í¨¹ý¸Ä±ä´ËÖµ¿ÉÒÔ¸Ä±äµØÍ¼µÄ¸ß¶È
|
int orix;//µØÍ¼µ±Ç°µÄX×ø±ê
|
int oriy;//µØÍ¼µ±Ç°Y×ø±ê
|
double x_bi;//ͼƬµÄxÏñËØµãºÍʵ¼Ê³¤µÄ±ÈÖµ
|
double y_bi;//ͼƬµÄyÏñËØµãºÍʵ¼Ê¿íµÄ±ÈÖµ
|
double map_true_width;//µØÍ¼Êµ¼Ê³¤¶È
|
double map_true_height;//µØÍ¼Êµ¼Ê¸ß¶È
|
TbMap map=null;//ÉêÃ÷µØÍ¼¶ÔÏó
|
Color color;
|
String mapfloor;
|
int shubiaox;
|
int shubiaoy;
|
int framey;//µ±Ç°Ãæ°å¸ß¶È
|
int framex;//µ±Ç°Ãæ°åµÄ¿í¶È
|
int newOffsetX;
|
int newOffsetY;
|
int shubiao=0;//Êó±êµã»÷µÄ´ÎÊý
|
int[] xy=new int[4];
|
//µØÍ¼Êµ¼ÊÔµã×ø±ê
|
int yuan_x0=0;
|
int yuan_y0=0;
|
|
//µ±Ç°¹â±êµÄ×ø±ê
|
int guangx=0;
|
int guangy=0;
|
static int sosnum=0;
|
static boolean relocopen=false;
|
int corloc=0;
|
static int sleeptime=300;
|
Graphics2D g2=null;
|
|
Image sos=new ImageIcon("image/icon/sos.png").getImage();
|
Image sos1=new ImageIcon("image/icon/sos1.png").getImage();
|
Image anchor_red=new ImageIcon("image/anchor/red.png").getImage();
|
Image anchor_yellow=new ImageIcon("image/anchor/ceju.png").getImage();
|
Image anchor_green=new ImageIcon("image/anchor/lingjin.png").getImage();
|
Image anchor_off=new ImageIcon("image/anchor/anchoroff.png").getImage();
|
Image anchor_on=new ImageIcon("image/anchor/anchoron.png").getImage();
|
|
Color ancid=ChooseColor.getColo("À¶É«",255);
|
int online=0;
|
|
int showguijitime=Systems.get_real_track_time();
|
Color grenn=new Color(50,205,50,150);
|
Color red=new Color(255,105,180,150);
|
|
boolean showname=Systems.sys().getViewName().equals("1");
|
boolean showtagid=Systems.sys().getViewTagid().equals("1");
|
SoftReference<Image> sfRefer =null;
|
int clickx=0;//Êó±êµã»÷ʱºòµÄX
|
int clicky=0;//Êó±êµã»÷ʱºòµÄY
|
Stroke stroke=new BasicStroke(2);//ÉèÖû±Ê
|
|
/**¹¹Ôì·½·¨*/
|
public RealLoc(String floor,String mapName) {
|
map=Map_Dell.get_map(floor);
|
mapfloor=map.getFloor();
|
String mapAdress="image/mapfile/"+map.getMapname();
|
Image image=new ImageIcon(mapAdress).getImage();//»ñÈ¡µØÍ¼
|
sfRefer = new SoftReference<Image> (image );
|
map_true_width=map.getX_Truelength();
|
map_true_height=map.getY_Truewidth();
|
width=image.getWidth(this);
|
height=image.getHeight(this);
|
new_width=width;
|
new_height=height;
|
x_bi=map_true_width/new_width;//µØÍ¼µÄʵ¼Ê³¤¶ÈºÍеĿí¶È±ÈÖµ
|
y_bi=map_true_height/new_height;//µØÍ¼Êµ¼Ê¸ß¶ÈºÍеĸ߶ȱÈÖµ
|
color=Color.red;
|
Container rq=getContentPane();//»ñÈ¡ÈÝÆ÷
|
rq.setLayout(new BorderLayout());
|
rq.setBackground(Color.white);
|
mycanvas=new Mycanvas();//³õʼ»¯»æÍ¼Ãæ°å¶ÔÏó
|
this.setTitle(mapName);
|
this.setFrameIcon(new ImageIcon("image/icon/mapicon.png"));//ÉèÖô°Ìåͼ±ê
|
rq.add(mycanvas,BorderLayout.CENTER);
|
yuan_x0=Map_Dell.get_map(mapfloor).getX0_length();
|
yuan_y0=Map_Dell.get_map(mapfloor).getY0_width();
|
|
startThread();//Æô¶¯Ïß³Ì
|
this.addInternalFrameListener(new InternalFrameListener() {
|
|
@Override
|
public void internalFrameOpened(InternalFrameEvent e) {
|
|
}
|
|
@Override
|
public void internalFrameIconified(InternalFrameEvent e) {
|
sleeptime=2000;
|
relocopen=false;
|
Dell_ReallPoint.clear();
|
}
|
|
@Override
|
public void internalFrameDeiconified(InternalFrameEvent e) {
|
sleeptime=300;
|
relocopen=true;
|
}
|
|
@Override
|
public void internalFrameDeactivated(InternalFrameEvent e) {
|
|
}
|
|
@Override
|
public void internalFrameClosing(InternalFrameEvent e) {
|
relocopen=false;
|
sfRefer =null;
|
Tanchu_Menu.setKusubudain(false);
|
}
|
|
@Override
|
public void internalFrameClosed(InternalFrameEvent e) {
|
}
|
|
@Override
|
public void internalFrameActivated(InternalFrameEvent e) {
|
}
|
});
|
|
|
|
}
|
|
/**Æô¶¯Ï̵߳ķ½·¨*/
|
public void startThread() {
|
Thread t=new Thread(this);
|
relocopen=true;
|
t.start();
|
}
|
|
public void run() {
|
while(true) {
|
try {
|
if(map !=null) {
|
if(relocopen) {
|
mycanvas.repaint();
|
}
|
}
|
Thread.sleep(sleeptime);//ÐÝÃßʱ¼ä
|
} catch (InterruptedException e) {
|
e.printStackTrace();
|
}
|
}
|
}
|
|
/**ÄÚ²¿µÄ»²¼*/
|
class Mycanvas extends Canvas implements MouseListener,MouseMotionListener,MouseWheelListener {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
public void update(Graphics g){ //¸²¸Çupdate·½·¨£¬½ØÈ¡Ä¬Èϵĵ÷Óùý³Ì
|
Image ImageBuffer = createImage(this.getWidth(), this.getHeight()); //´´½¨Í¼Ðλº³åÇø
|
Graphics GraImage = ImageBuffer.getGraphics(); //»ñȡͼÐλº³åÇøµÄͼÐÎÉÏÏÂÎÄ
|
paint(GraImage); //ÓÃpaint·½·¨ÖбàдµÄ»æÍ¼¹ý³Ì¶ÔͼÐλº³åÇø»æÍ¼
|
GraImage.dispose(); //ÊÍ·ÅͼÐÎÉÏÏÂÎÄ×ÊÔ´
|
g.drawImage(ImageBuffer, 0, 0, this); //½«Í¼Ðλº³åÇø»æÖƵ½ÆÁÄ»ÉÏ
|
|
ImageBuffer =null;
|
GraImage =null;
|
}
|
|
public Mycanvas() {
|
origin = new Point();;
|
addMouseWheelListener(this);
|
addMouseListener(this);
|
addMouseMotionListener(this);
|
}
|
|
public void paint(Graphics g) {
|
|
g2=(Graphics2D) g;
|
g2.setColor(getBackground());
|
g2.fillRect(0,0,this.getSize().width,this.getSize().height);
|
g2.drawImage(sfRefer.get(), x0, y0, new_width, new_height,this);
|
x1=x0;
|
y1=y0;
|
framey=this.getSize().height;//µ±Ç°Ãæ°åµÄ¸ß¶È
|
framex=this.getSize().width;
|
|
if(true) { //»æÖÆÔµã
|
double aa=(-yuan_x0/x_bi)+x0;
|
double bb=(-yuan_y0/y_bi)+y0;
|
int x_newyuan=(int)aa;
|
int y_newyuan=(int)bb;
|
g2.setColor(Color.red);
|
g2.fillOval(x_newyuan-4, y_newyuan-4,8,8);
|
}
|
|
Vector<Person> pervc=person_Dell.getPerson_vector();
|
if(Stac.isSerchperson()) {
|
String tagid=Stac.getSerchtagid();
|
if(!tagid.equals("0")) {
|
pervc=person_Dell.serch(tagid);
|
}
|
}
|
|
//»æÖÆ»ùÕ¾
|
draw_anchor(g2);
|
draw_gasanchor(g2) ;//»æÖÆÆøÑ¹»ùÕ¾
|
|
//»æÖƱêÇ©¶ÔÏó
|
int size=pervc.size();
|
online=size;
|
if( size!=0) {
|
for(int i=0;i<size;i++) {
|
Person person=pervc.get(i);
|
String personid=person.getP_tagid();
|
if(Systems.isIssanwei()) {//Èç¹û¿ªÆôÈýάģʽ
|
if( person.getP_name().equals("ÆøÑ¹»ùÕ¾")) {
|
continue;
|
}
|
}
|
|
int person_online=Integer.parseInt(person.getP_online());//±êÇ©ÊÇ·ñÔÚÏß
|
if(person_online==0) {
|
online--;
|
}
|
|
//±êÇ©ÊÇ·ñÔÚ¿¼ÇÚÇøÓò
|
int person_inkaoqing=Integer.parseInt(person.getP_kaoqing());
|
|
//Èç¹û¿ªÆôÀëÏßÏûʧͬʱ±êÇ©ÀëÏß
|
if(Systems.sys().getOffView().equals("1") && person_online==0) {
|
continue;
|
}
|
|
//Èç¹ûϵͳ¿ªÆôÁ˳ö¿¼ÇÚÇøÓòÏûʧͬʱ±êÇ©ÓÖ²»ÔÚ¿¼ÇÚÇøÓò
|
if(Systems.isOffkaoqing() && person_inkaoqing==0 || person.getInwuxiaoqu()==1 ) {
|
//Ìø³öµ±Ç°Ñ»·½øÈëÏÂÒ»´ÎÑ»·
|
continue;
|
}
|
|
|
if(person.getP_floor().equals(mapfloor) ) {
|
int posx=person.getP_x();
|
int posy=person.getP_y();
|
int x=(int)get_xpos(mapfloor,posx);
|
int y=(int)get_ypos(mapfloor,posy);
|
|
int tbw=person.getP_image().getIconWidth();
|
int tbh=person.getP_image().getIconHeight();
|
|
//»ñÈ¡±êÇ©µçÁ¿
|
String powers=person.getP_power();
|
if(powers==null) {
|
powers="100";
|
}else {
|
if(!JugeNumber.isDigit(powers)) {
|
powers="100";
|
}
|
}
|
int power=Integer.parseInt(powers);
|
drawtuoyuan(g2,x,y,person);//»æÖÆÍÖÔ²
|
drawguiji(personid,g2); //»æÖƱêÇ©¹ì¼£
|
ischoosetag(g2,person,posx,posy);//±êÇ©È类ѡÖÐ
|
if(person.getIschoose()==1){
|
drawperson_more(
|
g2,
|
x,
|
y,
|
person.getP_name(),
|
person.getP_phone(),
|
person.getP_tagid(),
|
person.getP_department(),
|
person.getP_power(),
|
person.getJingdu(),
|
person.getWeidu(),
|
person.getGao(),
|
posx,
|
posy,
|
mapfloor,
|
person.getGpsstate(),
|
person,
|
framex,
|
framey);
|
g2.drawImage(person.getP_image().getImage(), x-tbw/2, y-tbh,tbw,tbh,this);
|
}else {
|
//»æÖƱêÇ©,±êÇ©²»ÔÚSOS£¬²»ÔÚΣÏÕÇøÓò£¬±êÇ©ÔÚÏß
|
if(person.getSos_state().equals("0") && person.getP_fence().equals("0") ) {
|
g2.drawImage(person.getP_image().getImage(), x-tbw/2, y-tbh,tbw,tbh,this);
|
}else {
|
tbw=40;
|
tbh=40;
|
sosnum++;
|
if(sosnum==4) {
|
g2.drawImage(sos, x-15,y-30,30,30,this);
|
sosnum=0;
|
}else {
|
g2.drawImage(sos1,x-15, y-30,30,30,this);
|
}
|
}
|
|
if(showtagid && showname) {//»±³¾°¿ò
|
g2.setColor(grenn);//ÂÌÉ«
|
if(power<10) {
|
g2.setColor(red);//ºìÉ«
|
}
|
g2.fillRoundRect(x-45, y-tbh-35,90,30,3,3);
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(Color.white);
|
g2.drawString(person.getP_name(), x-40, y-tbh-15);
|
g2.drawString(person.getP_tagid(), x+10, y-tbh-15);
|
}else {
|
g2.setColor(grenn);//ÂÌÉ«
|
if(power<10) {
|
g2.setColor(red);//ºìÉ«
|
}
|
g2.fillRoundRect(x-30, y-tbh-35,60, 30,3,3);
|
if(showname) {
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(Color.white);
|
g2.drawString(person.getP_name(), x-20, y-tbh-15);
|
}else {
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(Color.white);
|
g2.drawString(person.getP_tagid(), x-20, y-tbh-15);
|
}
|
}
|
|
if(Systems.isShow0ceng()) {
|
g2.setColor(red);//±êǩʵ¼ÊËùÔÚµÄÂ¥²ã
|
g2.fillRoundRect(x-30, y-tbh-70,60, 30,3,3);
|
g2.setColor(Color.white);
|
g2.drawString("ÔÚ"+person.getFloortrue()+"²ã", x-20, y-tbh-50);
|
}
|
|
//ÏÔʾͼ±êʵʱλÖÃ×ø±ê
|
if(Systems.sys().getTagZb().equals("1")) {
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(Color.gray);
|
String zb="["+posx+","+posy+"]";
|
g2.drawString(zb,x-tbw,y+tbh/2);
|
}
|
}
|
}
|
}
|
}
|
|
//ËíµÀģʽ
|
draw_suidaotongji(g2);
|
|
//ÏÔʾÔÚÏß±êÇ©×ÜÊý
|
Drawok.tagidnum(guangx,guangy,framey,framex,g2,online);
|
|
/**»æÖÆÆøÌå´«¸ÐÆ÷¶ÔÏó*/
|
Drawok.gas(mapfloor, x_bi, y_bi, x0, y0, g2);
|
|
/**»Ô²È¦,Èç¹ûϵͳµ÷ÊÔ¿ªÆô**/
|
int rownum=DebugManage.getSelectedRow();
|
if(rownum !=(-1)) {
|
String a=(String) DebugManage.getTable().getValueAt(rownum, 0);
|
int key=Integer.parseInt(a);
|
Yuangvc yvc=Dell_yuang.get_Yuangvc(key,mapfloor);
|
if(yvc !=null) {
|
Vector<Yuang> circ=yvc.getYuangs();
|
int size1=circ.size();
|
if( size1 !=0) {
|
|
for(int i=0;i<size1;i++) {
|
int anx=get_xpos(mapfloor,circ.get(i).getX());
|
int any=get_ypos(mapfloor,circ.get(i).getY());
|
int anchorh=circ.get(i).getAnchor_h();
|
int tagh=circ.get(i).getTag_h();
|
|
//°ë¾¶µÄƽ·½
|
double r=circ.get(i).getWidth();
|
double rr=r*r;
|
//²ã¸ß
|
int cengid=Integer.parseInt(mapfloor);
|
String buttom=Dell_cengao.get_tbceng(cengid).getButtom();
|
double cenggao=Double.parseDouble(buttom);
|
//¸ß¶È²îµÄƽ·½
|
double hh=(anchorh-tagh-cenggao)*(anchorh-tagh-cenggao);
|
double r_h=rr-hh;
|
if (r_h<0){
|
r_h=5;
|
}
|
if(r_h>0) {
|
int r1=2*new Double(Math.sqrt(r_h)/x_bi).intValue();
|
int r2=2*new Double(Math.sqrt(r_h)/y_bi).intValue();
|
g2.setColor(Color.red);
|
g2.setStroke(new BasicStroke(1.0f));
|
g2.drawOval(anx-r1/2, any-r2/2,r1,r2);
|
g2.drawImage(Anchor_Dell.getCeju(), anx-15, any-30,30,30,this);
|
}
|
}
|
|
circ=null;
|
}
|
|
ResultYuang rsy=Dell_ResultYuang.get_resty(key);
|
String afloor=String.valueOf(rsy.getFloor());
|
if(afloor.equals(mapfloor)) {
|
g2.setColor(UIColor.getGrenn());
|
int x=rsy.getX();
|
int y=rsy.getY();
|
int anx=get_xpos(mapfloor,x);
|
int any=get_ypos(mapfloor,y);
|
g2.fillOval(anx-7,any-7,14,14);
|
}
|
rsy=null;
|
afloor=null;
|
}
|
}
|
|
/**»æÖÆÖ±Ïß*/
|
Drawok.drawyuan(x_bi, y_bi, x0, y0, g2);
|
Drawok.line(x_bi, y_bi, x0, y0, g2);
|
|
/**»æÖÆÒѾ´æÔÚµÄΧÀ¸¶ÔÏó**/
|
if(ToolBarModel.isShowfence()) {
|
Drawok.draw_point_inoutLine(mapfloor,g2);
|
Drawok.fence(mapfloor, x_bi, y_bi, x0, y0,yuan_x0,yuan_y0, g2,bi);
|
Drawok.draw_point_inout(mapfloor, x_bi, y_bi, x0, y0,yuan_x0,yuan_y0,g2);
|
}
|
if (ToolBarModel.getSuanFa()){
|
Drawok.lineAndArea(mapfloor, x_bi, y_bi, x0, y0,yuan_x0,yuan_y0,g2);
|
}
|
|
g2=null;
|
|
}
|
|
public void mouseReleased(MouseEvent e) {//°´¼üÊÍ·Å
|
clickx=0;
|
clicky=0;
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
}
|
|
public void mousePressed(MouseEvent e) {//°´¼ü°´ÏÂ
|
origin.x = e.getX(); //»ñµÃÊó±êµã»÷ʱºòµÄX×ø±ê
|
origin.y = e.getY();//»ñµÃÊó±êµã»÷ʱºòµÄY×ø±ê
|
orix=x0;//½«µ±Ç°Í¼Æ¬µÄÆðµã×ø±êX¸øorix
|
oriy=y0;//½«µ±Ç°Í¼Æ¬µÄÆðµã×ø±êX¸øoriy
|
|
int x_cursor=e.getX();//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
int y_cursor=e.getY();//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
shubiaox=(new Double((x_cursor-x0)*x_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx
|
shubiaoy=(new Double((y_cursor-y0)*y_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy
|
clickx=shubiaox+yuan_x0;
|
clicky=shubiaoy+yuan_y0;
|
|
}
|
|
public void mouseExited(MouseEvent e) {//Êó±êÍ˳ö
|
|
}
|
|
public void mouseEntered(MouseEvent e) {//Êó±ê½øÈë
|
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
}
|
|
/**Êó±êµã»÷ʼþ*/
|
public void mouseClicked(MouseEvent e) {//Êó±êµã»÷
|
if(e.isMetaDown()){//¼ì²âÊó±êÓÒ¼üµ¥»÷
|
popupMenu().show(e.getComponent(), e.getX(), e.getY());
|
|
}else if(e.getButton()==MouseEvent.BUTTON1){//µã»÷Êó±ê×ó¼ü
|
if(ToolBarModel.isDrawline()) {
|
if(shubiao==0) {
|
xy[0]=shubiaox;
|
xy[1]=shubiaoy;
|
Dell_yuan.insert_yuan(xy[0], xy[1],6,6);
|
shubiao++;
|
}else if(shubiao==1) {
|
xy[2]=shubiaox;
|
xy[3]=shubiaoy;
|
Dell_yuan.insert_yuan(xy[2], xy[3],6,6);
|
//¹´¹É¶¨Àí¼ÆËãб±ßµÄ³¤¶È
|
double a0=xy[2]-xy[0];
|
double b0=xy[3]-xy[1];
|
double distance=Math.sqrt(a0*a0+b0*b0);
|
Dell_Line.insert_aline(xy,distance);
|
shubiao=0;
|
}
|
}
|
|
//¹öÂÖ°´ÏÂ
|
}else if(e.getButton()==MouseEvent.BUTTON2) {
|
DellJAN.SetSetReferencePoint(guangx,guangy);
|
}
|
|
if(e.getButton()==MouseEvent.BUTTON1 && Tanchu_Menu.isKusubudain()) {
|
if(!Bj.isHavefas()) {
|
FastAddAnc fa=new FastAddAnc("¿ìËÙÔö¼Ó»ùվģʽ");
|
String id=Bj.getAnc()+"";
|
fa.getAnchorIdFile().setText(id);
|
fa.getPosxFile().setText(guangx+"");
|
fa.getPosyFile().setText(guangy+"");
|
fa.getPoszFile().setText("200");
|
Bj.setHavefas(true);
|
}
|
}
|
|
}
|
|
public void mouseDragged(MouseEvent e) {
|
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
|
//Ãæ°åеÄ×ø±êλÖà = ÒÆ¶¯Ç°×ø±êλÖÃ+£¨Êó±êÖ¸Õëµ±Ç°×ø±ê-Êó±ê°´ÏÂʱָÕëµÄλÖã©
|
x0=orix+e.getX()-origin.x;
|
y0=oriy+e.getY()-origin.y;
|
this.repaint();
|
|
}
|
|
public void mouseMoved(MouseEvent e) {
|
int x_cursor=e.getX();//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
int y_cursor=e.getY();//Êó±ê¶ÔÓ¦µÄÏñËØµã
|
shubiaox=(new Double((x_cursor-x0)*x_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êx
|
shubiaoy=(new Double((y_cursor-y0)*y_bi)).intValue();//ÏñËØµã¶ÔÓ¦µÄÊµÊ±×ø±êy
|
guangx=shubiaox+yuan_x0;
|
guangy=shubiaoy+yuan_y0;
|
clickx=0;
|
clicky=0;
|
}
|
|
/**Êó±ê¹öÂÖ¹ö¶¯Ê¼þ¼àÌý*/
|
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();//ͼƬеĸ߶È
|
|
x_bi=map_true_width/new_width;//µØÍ¼µÄʵ¼Ê³¤¶ÈºÍеĿí¶È±ÈÖµ
|
y_bi=map_true_height/new_height;//µØÍ¼Êµ¼Ê¸ß¶ÈºÍеĸ߶ȱÈÖµ
|
map.setXb(x_bi);
|
map.setYb(y_bi);
|
//x0=new Double(xh1-width/2*bi).intValue();
|
//y0=new Double(yh1-height/2*bi).intValue();
|
|
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();
|
}
|
});
|
|
JMenuItem accolor=new JMenuItem("»ùÕ¾ÑÕÉ«");
|
accolor.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
// TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
|
if(corloc==0) {
|
ancid=ChooseColor.getColo("°×É«",255);
|
corloc=1;
|
}else if(corloc==1) {
|
ancid=ChooseColor.getColo("ºÚÉ«",255);
|
corloc=2;
|
}else if(corloc==2) {
|
ancid=ChooseColor.getColo("ºìÉ«",255);
|
corloc=0;
|
}
|
mycanvas.repaint();
|
}
|
});
|
|
|
|
popupMenu.add(center);
|
popupMenu.addSeparator();// Ìí¼Ó·Ö¸ôÏß
|
popupMenu.add(Tanchu_Menu.get_sousuo());
|
popupMenu.addSeparator();
|
popupMenu.add(Tanchu_Menu.get_sendtext());
|
popupMenu.addSeparator();
|
popupMenu.add(accolor);
|
popupMenu.addSeparator();
|
popupMenu.add(Tanchu_Menu.get_fastbudian());
|
popupMenu.addSeparator();
|
popupMenu.add(Tanchu_Menu.get_clerguiji());
|
popupMenu.addSeparator();
|
popupMenu.add(Tanchu_Menu.get_xiangxi());
|
return popupMenu;
|
}
|
|
|
|
/**»ñÈ¡ÔÚµØÍ¼ÖеÄX×ø±ê*/
|
public static int get_xpos(String mapfloor, int x){
|
int a0=Map_Dell.get_map(mapfloor).getX0_length();
|
double anc_x=x-a0;
|
double x1_bi=Map_Dell.get_map(mapfloor).getXb();
|
double xx=(anc_x/x1_bi)+x1;
|
int anx=(int)Math.round(xx);
|
return anx;
|
}
|
|
/**»ñÈ¡ÔÚµØÍ¼ÖеÄY×ø±ê*/
|
public static int get_ypos(String mapfloor,int y){
|
int b0=Map_Dell.get_map(mapfloor).getY0_width();
|
double anc_y=y-b0;
|
double y1_bi=Map_Dell.get_map(mapfloor).getYb();
|
double yy=(anc_y/y1_bi)+y1;
|
int any=(int)Math.round(yy);
|
return any;
|
}
|
|
public static boolean isRelocopen() {
|
return relocopen;
|
}
|
|
|
/**»æÖƱêÇ©¶ÔÏóµÄ¹ì¼£*/
|
public void drawguiji(String tagid,Graphics2D g2) {
|
if( showguijitime !=0) {
|
Vector<RealTrackPoint> track_vector=Dell_ReallPoint.get_rtpt(tagid);
|
if( track_vector !=null && track_vector.size()!=0) {
|
for(int k=0;k<track_vector.size();k++) {
|
RealTrackPoint tb=track_vector.get(k);
|
int tbx1=tb.getX()-Map_Dell.get_map(mapfloor).getX0_length();
|
int tby1=tb.getY()-Map_Dell.get_map(mapfloor).getY0_width();
|
double ff=(tbx1/x_bi)+x0;
|
double gg=(tby1/y_bi)+y0;
|
int tbx=(int)ff;
|
int tby=(int)gg;
|
if(tb.getFloor().equals(mapfloor)) {
|
g2.setColor(Systems.get_real_track_color());
|
g2.fillOval(tbx-2, tby-2,4,4);
|
}
|
tb=null;
|
}
|
//ɾ³ý³¬Ê±µÄ¹ì¼£
|
Dell_ReallPoint.delte_off_time_track(tagid);
|
}
|
}
|
}
|
|
/**»æÖÆ»ùÕ¾¶ÔÏó*/
|
public void draw_anchor(Graphics2D g2) {
|
if(Systems.isShowanchor()) {
|
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);
|
Image image=anchor.getAnc_image();
|
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(image!=null) {
|
int anwidth=image.getWidth(this);
|
int anheight=image.getHeight(this);
|
//Èç¹û»ùÕ¾ÊDZ»Ñ¡ÖеĻùÕ¾
|
if(AnchorManage.getChoose_anchor().equals(anchor.getAnc_id())) {//»ùÕ¾±»Ñ¡ÖÐ
|
image=anchor_yellow;
|
}else {
|
if(anchor.getAnchor_distance_state()==1) {//»ùÕ¾²â¾à״̬Òì³£
|
image=anchor_red;
|
}else if(anchor.getAnchor_power_state()==1){//»ùÕ¾µçÁ¿×´Ì¬Òì³£ºìÉ«
|
image=anchor_red;
|
}else {
|
if(anchor.getAnc_status().equals("1") ){
|
image=anchor_on;
|
}else {
|
image=anchor_off;
|
}
|
|
}
|
}
|
g2.drawImage(image, anx-anwidth/2, any-anheight,anwidth,anheight,this);
|
//Èç¹ûÁÙ½üÅäÖñ»Ñ¡ÖÐ
|
Vector<String> vecnertac=AnchorNearby.getChoose_anchor();
|
if(vecnertac.size() !=0) {
|
for(int i=0;i<vecnertac.size();i++) {
|
String anchorid=vecnertac.get(i);
|
if(i==0 && anchorid.equals(anchor.getAnc_id())) {
|
image=anchor_yellow;
|
}else if(i!=0 && anchorid.equals(anchor.getAnc_id())) {
|
image=anchor_green;
|
}
|
g2.drawImage(image, anx-anwidth/2, any-anheight,anwidth,anheight,this);
|
}
|
}
|
|
|
if(Systems.sys().getViewAnckid().equals("1")) {
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(ancid);
|
g2.drawString(anchor.getAnc_id(),anx-15,any-anheight-6);
|
}
|
|
if(Systems.isShowanczuobiao()) {
|
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);
|
}
|
}
|
}
|
}
|
}
|
}
|
|
}
|
|
/**»æÖÆÆøÑ¹»ùÕ¾*/
|
public void draw_gasanchor(Graphics2D g2) {
|
if(Systems.isIssanwei()) {
|
Vector<Tb_gas_anchor> gas_anchorvc=Dell_tb_gas_anchor.getGas_anchorvc();
|
int size=gas_anchorvc.size();
|
for(int i=0;i<size;i++) {
|
String axs=gas_anchorvc.get(i).getAnchorx();
|
String ays=gas_anchorvc.get(i).getAnchory();
|
double axd = Double.valueOf(axs);
|
double ayd = Double.valueOf(ays);
|
int acx=(int) axd;
|
int acy=(int) ayd;
|
int anx=get_xpos("0",acx);
|
int any=get_ypos("0",acy);
|
int anwidth=gas_anchorvc.get(i).getAnc_image().getWidth(this);
|
int anheight=gas_anchorvc.get(i).getAnc_image().getHeight(this);
|
g2.drawImage(gas_anchorvc.get(i).getAnc_image(), anx-anwidth/2, any-anheight,anwidth,anheight,this);
|
|
g2.setFont(FontChoose.ziti(14));
|
g2.setColor(ancid);
|
g2.drawString(gas_anchorvc.get(i).getAnchorid(),anx-15,any-anheight-6);
|
}
|
}
|
}
|
|
|
/**»æÖÆËíµÀͳ¼Æ*/
|
public void draw_suidaotongji(Graphics2D g2) {
|
if(Systems.isSuidaomoshi()) {
|
Vector<TbFence> kqfc=Fences.get_kaoqing_fences(mapfloor);
|
if(kqfc !=null) {//Èç¹û¿¼ÇÚÇøÓò´æÔÚ
|
int size1=kqfc.size();
|
int hig=60;
|
if (size1>2){
|
hig=30*(size1+1);
|
}
|
int j=30;
|
g2.setColor(ChooseColor.getColo("Æ·ºì", 100));
|
g2.fillRoundRect(50,10,140,hig, 10, 10);
|
g2.setFont(FontChoose.ziti(18));
|
g2.setColor(Color.white);
|
if(size1 !=0) {
|
for(int i=0;i<size1;i++) {
|
String name=kqfc.get(i).getName();
|
if(size1==1) {
|
String kq=Dell_KaoQing.kao_qing_num(name, mapfloor);
|
g2.drawString(kq, 65,50);
|
return;
|
}else {
|
String kq=Dell_KaoQing.kao_qing_num(name, mapfloor);
|
g2.drawString(kq,65, i*j+30);
|
}
|
}
|
//¿¼ÇÚÇøÓò×ÜÈËÊý 2023.07.19 zsh
|
int kq=Dell_KaoQing.all_kaoqing();
|
g2.drawString("×ÜÈËÊý£º"+kq+"ÈË",65,(size1)*j+30);
|
}
|
}
|
}
|
}
|
|
|
/**ÏÔʾ¸ü¶àÐÅÏ¢*/
|
int jxw=280;//¾ØÐ㤶È
|
int jxh=120;//¾ØÐοí¶È
|
public void drawperson_more(
|
Graphics2D g2,
|
int x,
|
int y,
|
String name,
|
String phone,
|
String tagid,
|
String bumen,
|
String power,
|
String jd,//¾¶È
|
String wd,//γ¶È
|
String gc,
|
int posx,
|
int posy,
|
String floor,
|
String state,//¾«¶È״̬
|
Person person,
|
int framex,
|
int framey
|
) {
|
int posfrom=person.getPosfrom();//λÖÃÊý¾ÝÀ´Ô´
|
g2.setColor(grenn);
|
int x2=x-jxw/2;
|
int y2=y-10-jxh;
|
g2.fillRoundRect(x2,y2,jxw,jxh, 10, 10);//»æÖƾØÐÎ
|
int[] xPoints= {x-5,x+5,x};
|
int[] yPoints= {y-10,y-10,y};
|
g2.fillPolygon(xPoints, yPoints,3);
|
g2.setColor(Color.white);
|
g2.setFont(FontChoose.ziti(14));
|
g2.drawString(bumen+","+name+","+tagid+","+power+"%"+","+posfrom,x2+10,y2+20);
|
g2.drawString("µç»°:"+phone,x2+10,y2+45);
|
g2.drawString("¾Î³:"+jd+";"+wd+";"+gc,x2+10,y2+70);
|
g2.drawString("×ø±ê:"+posx+";"+posy+";"+person.getP_z()+";"+floor+";"+state,x2+10,y2+95);
|
|
g2.setColor(ChooseColor.getColo("Æ·ºì", 100));
|
int x22=20;
|
int y22=20;
|
int x23=30;
|
int y23=y22+20;
|
int n=21;
|
g2.fillRoundRect(x22,y22,200,n*11+20,5,5);
|
g2.setColor(Color.white);
|
g2.drawString("É豸±àºÅ:"+person.getP_tagid(),x23,y23);
|
g2.drawString("ÊÇ·ñ²ð³ý:"+person.getTagoff(),x23,y23+n*1);
|
g2.drawString("ʵʱÐÄÂÊ:"+person.getBaoliu16(),x23,y23+n*2);
|
g2.drawString("¾²Ö¹×´Ì¬:"+person.getJingzhi(),x23,y23+n*3);
|
g2.drawString("ÐÞÃß״̬:"+person.getXiumian(),x23,y23+n*4);
|
g2.drawString("ʵʱµçÁ¿:"+person.getP_power(),x23,y23+n*5);
|
g2.drawString("ʱ¼äƬÊý:"+person.getPian(),x23,y23+n*6);
|
g2.drawString("ʵʱƵÂÊ:"+person.getRealhz(),x23,y23+n*7);
|
g2.drawString("²â¾àÖ÷Õ¾:"+person.getNow_ceju_anchorid(),x23,y23+n*8);
|
String reson=person.getIndoor_or_outdoor()+","+person.getReason_indoor_from();
|
g2.drawString("ʵʱ¸ß¶È:"+person.getP_z(),x23,y23+n*9);
|
g2.drawString("λÖÃÀ´Ô´:"+reson,x23,y23+n*10);
|
|
}
|
|
/**µ±Ç°Êó±êµÄXºÍµ±Ç°Êó±êµÄY*/
|
public void ischoosetag(Graphics2D g2,Person person,int posx,int posy) {
|
if(Tanchu_Menu.isShowxiagnxi()) {
|
if(clickx !=0 && clicky !=0) {
|
int x1=clickx+80;
|
int y1=clicky+80;
|
int choose=person.getIschoose();
|
if( clickx-40<=posx && posx<=x1 && clicky-40<=posy && posy<=y1) {
|
if(choose==0) {
|
person.setIschoose(1);
|
}else {
|
person.setIschoose(0);
|
}
|
}
|
}
|
}
|
}
|
|
/**»æÖÆÍÖÔ²*/
|
public static void drawtuoyuan(Graphics2D g2,int x,int y,Person person) {
|
g2.setColor(Color.green);
|
if(person.getPosfrom()==0) {
|
g2.setColor(Color.RED);
|
}
|
int num2=person.getTuoyuan_num();
|
if(person.getJingzhi().equals("1")) {
|
g2.setColor(Color.ORANGE);
|
g2.setStroke(new BasicStroke(4.0f));
|
g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
|
}else {
|
if(num2==3) {
|
g2.setStroke(new BasicStroke(2.0f));
|
g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
|
person.setTuoyuan_num(2);
|
}else if(num2==2) {
|
g2.setStroke(new BasicStroke(4.0f));
|
g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
|
person.setTuoyuan_num(0);
|
}else if(num2==0) {
|
g2.setStroke(new BasicStroke(1.0f));
|
g2.drawOval(x-10,y-5,20,10);//x,y,width,heigh
|
person.setTuoyuan_num(3);
|
}
|
}
|
}
|
|
public int getX0() {
|
return x0;
|
}
|
|
public void setX0(int x0) {
|
this.x0 = x0;
|
}
|
|
|
}
|