1    /*
2    Copyright 2003 by Ralph Hartley
3    This software is licenced under the terms of the
4    Gnu Public Licence
5    */
6    
7    import java.awt.geom.*;
8    import java.util.*;
9    
10   public class Passage extends Comp implements Region {
11     private static final long serialVersionUID = Version.getSUID();
12   
13     public Map bounds = new HashMap();
14     public Set segments = new HashSet();
15   
16     public Area getIn(View view) {
17       Area in = new Area();
18       Area out = new Area();
19       for (Iterator it = bounds.keySet().iterator();it.hasNext();) {
20         Region item = (Region)it.next();
21         int op = ((Integer)bounds.get(item)).intValue();
22         if (op==IN) in.add(item.getIn(view));
23         if (op==OUT) out.add(item.getIn(view));
24       }
25       in.subtract(out);
26       return(in);
27     }
28   
29     public Area getOut(View view) {
30       Area in = new Area();
31       Area out = new Area();
32       for (Iterator it = bounds.keySet().iterator();it.hasNext();) {
33         Region item = (Region)it.next();
34         int op = ((Integer)bounds.get(item)).intValue();
35         if (op==IN) in.add(item.getIn(view));
36         if (op==OUT) out.add(item.getIn(view));
37       }
38       in.subtract(out);
39       Area res = new Area(view.clip);
40       res.subtract(in);
41       return(res);
42     }
43   
44     public Editor getEditor(CartoFrame frame) {
45       return(new PassageEditor(this,frame));
46     }
47   
48   }
49