zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package fence;
 
import JNADell.DellJAN;
import PbuliClass.IsPtInPoly;
import tag.Tag;
import tag.Tag_Dell;
import tbDataModel.TbFence;
 
import java.awt.geom.Point2D;
import java.util.Vector;
 
/**ÅжϵãÊÇ·ñÔÚ¶¨Î»ÇøÓòÄÚ*/
public class PointIsInWall {
 
    static int px[]=new int[1];
    static int py[]=new int[1];
    public  static  void is_in_wall(String tagid,int x,int y,String floor) {
        Point2D.Double point=new Point2D.Double(x,y);        
        //Èç¹ûÎ§Ç½ÇøÓò´æÔÚ
        int size=Fences.get_fence_vector("Î§Ç½ÇøÓò").size();
        Tag tag=Tag_Dell.get_tag(tagid);
        if(size==0) {
            tag.setTag_in_wall(3);
            return;
        }        
        for(int i=0;i<size;i++) {            
            TbFence tbfenc=Fences.get_fence_vector("Î§Ç½ÇøÓò").get(i);
            //ÅжÏID×ø±êÊÇ·ñÔÚΧÀ¸ÇøÓòÄÚ            
            boolean isin=IsPtInPoly.inPoly(point, tbfenc.getPts());            
            //ÔÚÇøÓòÄÚÔòÖ´ÐÐ
            if(isin) {                
                tag.setTag_in_wall(1);
                return;
            }            
        }
        tag.setTag_in_wall(0);
    }
 
    //±êÇ©ÔÚΧÀ¸ÄÚÏÔʾ
    public static int[] inwall(int x,int y,String floor){
        String floor1=null;
        int [] jnaxy=null;
        Vector<TbFence> fence = Fences.get_fence_vector("Î§Ç½ÇøÓò");
        for (int i = 0; i < fence.size(); i++) {
            floor1 =fence.get(i).getFloor();
            if (floor.equals(floor1)){
                DellJAN.get_position_in_fence(x,y,px,py);
                int[] xy={px[0], py[0]};
                jnaxy= xy;
            }
        }
        return jnaxy;
    }
 
 
}