Statistics
| Revision:

svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / px / dxf / DxfInsert.java @ 2312

History | View | Annotate | Download (3.48 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 * 
4
 * Copyright (C) 2004-5. 
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
 *
20
 * For more information, contact:
21
 * 
22
 * cresques@gmail.com
23
 */
24

    
25
package org.cresques.px.dxf;
26

    
27
import java.awt.Graphics2D;
28
import java.awt.geom.Point2D;
29

    
30
import org.cresques.cts.ICoordTrans;
31
import org.cresques.cts.IProjection;
32
import org.cresques.geo.ViewPortData;
33
import org.cresques.px.Extent;
34
import java.util.Vector;
35

    
36
public class DxfInsert extends DxfEntity {
37
        
38
        Point2D pt;
39
        String blockName;
40
        Point2D scaleFactor;
41
        double rotAngle;
42
        DxfBlock block = new DxfBlock(proj);
43
        Vector blkList;
44
        boolean blockFound = false;
45
        
46
        public DxfInsert(IProjection proj, DxfLayer layer) {
47
                super(proj, layer);
48
                extent = new Extent();
49
        }
50
        
51
        public Point2D getPt() {
52
                return pt;
53
        }
54
        
55
        public double getRotAngle() {
56
                return rotAngle;
57
        }
58
        
59
        public Point2D getScaleFactor() {
60
                return scaleFactor;
61
        }
62
        
63
        public boolean getBlockFound() {
64
                return blockFound;
65
        }
66
        
67
        public void setBlockFound(boolean found) {
68
                blockFound = found;
69
        }
70
        
71
        public boolean encuentraBloque(String blockName) {
72
                int i = 0;
73
                while (i<blkList.size() && blockFound == false) {
74
                        //System.out.println("encuentraBloque: ((DxfBlock)blkList.get(i)).getBlkName() = " + ((DxfBlock)blkList.get(i)).getBlkName());
75
                        //System.out.println("encuentraBloque: blockName = " + blockName);
76
                        if (((DxfBlock)blkList.get(i)).getBlkName().equals(blockName)) {
77
                                //System.out.println("encuentraBloque: Bloque " + i + " encontrado.");
78
                                block = (DxfBlock)blkList.get(i);
79
                                blockFound = true;
80
                        } else {
81
                                //System.out.println("encuentraBloque: Bloque " + blockName + " no encontrado");
82
                                blockFound = false;
83
                        }
84
                        i++;
85
                }
86
                return blockFound;
87
        }
88
        
89
        public DxfLayer getDxfLayer() {
90
                return layer;
91
        }
92
        
93
        public void setBlkList(Vector blkList) {
94
                this.blkList = blkList;
95
        }
96
        
97
        public DxfBlock getDxfBlock() {
98
                return block;
99
        }
100
        
101
        public void setPt(Point2D pt) { 
102
                this.pt = pt;
103
                extent.add(pt);
104
        }
105
        
106
        public void setBlockName(String blockName) {
107
                this.blockName = blockName;
108
        }
109
        
110
        public String getBlockName() {
111
                return blockName;
112
        }
113
        
114
        public void setScaleFactor(Point2D scaleFactor) {
115
                this.scaleFactor = scaleFactor;
116
        }
117
        
118
        public void setRotAngle(double rotAngle) {
119
                this.rotAngle = rotAngle;
120
        }
121

    
122
        /* (non-Javadoc)
123
         * @see org.cresques.px.dxf.DxfEntity#toDxfFileString()
124
         */
125
        public String toDxfString() {
126
                // TODO Auto-generated method stub
127
                return "";
128
        }
129

    
130
        /* (non-Javadoc)
131
         * @see org.cresques.px.dxf.DxfEntity#reProject(org.cresques.geo.ReProjection)
132
         */
133
        public void reProject(ICoordTrans rp) {
134
                // TODO Auto-generated method stub
135
                
136
        }
137

    
138
        /* (non-Javadoc)
139
         * @see org.cresques.px.Drawable#draw(java.awt.Graphics2D, org.cresques.geo.ViewPort)
140
         */
141
        public void draw(Graphics2D g, ViewPortData vp) {
142
                // TODO Auto-generated method stub
143
                
144
        }
145

    
146
}