1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License as
4  * published by the Free Software Foundation; either version 2 of the
5  * License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOUSE. See the GNU
10  * General Public License for more details.
11  *
12  * You should have recieved a copy of the GNU General Public License
13  * along with this program; if not write to the Free Software
14  * Foundation, inc., 59 Temple Place, Suite 330, Boston MA 02111-1307
15  * USA
16  */
17 package j3d;
18 
19 import java.awt.geom.*;
20 import javax.swing.tree.*;
21 import java.awt.image.*;
22 import java.io.*;
23 import javax.swing.*;
24 import gui.*;
25 /**
26  * Insert the type's description here.
27  *
28  * @author: Yuriy Mikhaylovskiy
29  */
30 
31 public class _BgImage extends _Object implements Serializable{
32   public int x,y;
33   public BufferedImage img;
34 
writeObject(ObjectOutputStream out)35   private void writeObject(ObjectOutputStream out)  throws IOException{
36     out.writeFloat(x);
37     out.writeFloat(y);
38     out.writeObject(img);
39     out.writeObject(Id);
40   }
readObject(ObjectInputStream in)41   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException{
42     x = in.readInt();
43     y = in.readInt();
44     img = (BufferedImage)in.readObject();
45     Id = (String)in.readObject();
46     selected = false;
47   }
48 
reset(boolean do_mesh)49   public void reset(boolean do_mesh) {};
mesh(int type, float size)50   public void mesh(int type, float size){}
_BgImage(BufferedImage i, int xx, int yy)51   public _BgImage(BufferedImage i, int xx, int yy){
52     img=i;
53     x=xx;
54     y=yy;
55   }
_BgImage(BufferedImage i)56   public _BgImage(BufferedImage i){
57     img=i;
58     x=0;
59     y=0;
60   }
get_Array(Canvas3D j3d)61   public Object[] get_Array(Canvas3D j3d){
62     shp t = new shpBgImage(img,x,y);
63         t.setShow(show);
64     Object[] arr = {t};
65     return arr;
66   }
isSelected()67   public boolean isSelected(){return selected;}
setSelected(boolean sel)68   public void setSelected(boolean sel){ selected=sel; }
toString()69   public String toString(){ return "Background Image ID="+Id;}
get_TreeNode()70   public MutableTreeNode get_TreeNode(){
71     DefaultMutableTreeNode node = new DefaultMutableTreeNode(this);
72     //node.add(new DefaultMutableTreeNode("Color"));
73     return node;
74   }
transform3D(Matrix3D t)75   public void transform3D(Matrix3D t){
76     if(!selected || processed)return;
77     int xx=(int)(x*t.xx+y*t.xy+t.xo);
78     int yy=(int)(x*t.yx+y*t.yy+t.yo);
79     x=xx; y=yy;
80   }
getEditPanel(Canvas3D j3d, PreProcessor pp)81   public JPanel getEditPanel(Canvas3D j3d, PreProcessor pp){
82       J3D = j3d;
83       PreP = pp;
84       return new JPanel();
85       }
get_Nodes()86   public _Node[] get_Nodes(){return null;}
get_Elements()87   public _Object[] get_Elements(){return null;}
duplicate(Canvas3D out, boolean add)88   public _Object duplicate(Canvas3D out, boolean add){
89       _BgImage o = null;
90       try {
91         o = (_BgImage)this.clone();
92     } catch (CloneNotSupportedException e) {
93         e.printStackTrace();
94     }
95       if (add) out.add3D(o);
96 
97       return o;
98       }
isPickPoint(int x, int y, boolean show, boolean ogl)99   public boolean isPickPoint(int x, int y, boolean show, boolean ogl) {
100 
101       return false;
102   }
103 
isPickPoint(Rectangle2D r, boolean show, boolean ogl)104 public boolean isPickPoint(Rectangle2D r, boolean show, boolean ogl) {
105 
106       return false;
107   }
108 
deselectRequiredObjects()109 public void deselectRequiredObjects() {
110     // Do nothing
111 }
112 
replaceObjectWith(_Object o, _Object replacement)113 public void replaceObjectWith(_Object o, _Object replacement) {
114     // Do nothing
115 }
116 
117 }