root / branches / v2_0_0_prep / libraries / libDXF / src / org / gvsig / dxf / px / dxf / DxfEntity.java @ 29630
History | View | Annotate | Download (3.5 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 |
package org.gvsig.dxf.px.dxf; |
25 |
|
26 |
import org.cresques.cts.ICoordTrans; |
27 |
import org.cresques.cts.IProjection; |
28 |
import org.cresques.geo.Projected; |
29 |
import org.gvsig.dxf.px.PxObj; |
30 |
|
31 |
|
32 |
/**
|
33 |
* Clase ancestro para las entidades de un fichero DXF.
|
34 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es>
|
35 |
* @author jmorell
|
36 |
*/
|
37 |
public abstract class DxfEntity extends PxObj implements Projected { |
38 |
IProjection proj = null;
|
39 |
DxfLayer layer = null;
|
40 |
|
41 |
//int dxfColor = 256;
|
42 |
int dxfColor = 0; |
43 |
int entitiesFollow = 0; |
44 |
boolean space = false; // false --> model space, true paper space; |
45 |
private int handle; |
46 |
|
47 |
/**
|
48 |
* Constructor gen?rico de entidades procedentes de un fichero DXF.
|
49 |
* @param proj, proyecci?n cartogr?fica en la que se encuentra la entidad.
|
50 |
* @param layer, capa del DXF en la que se encuentra la entidad.
|
51 |
*/
|
52 |
public DxfEntity(IProjection proj, DxfLayer layer) {
|
53 |
setProjection(proj); |
54 |
this.layer = layer;
|
55 |
} |
56 |
|
57 |
/**
|
58 |
* Establece la proyecci?n cartogr?fica en la que se encuentra la entidad.
|
59 |
* @param p, Proyecci?n cartogr?fica.
|
60 |
*/
|
61 |
public void setProjection(IProjection p) { |
62 |
proj = p; |
63 |
} |
64 |
|
65 |
/**
|
66 |
* Devuelve la proyecci?n cartogr?fica en la que se encuentra la entidad.
|
67 |
* @return IProjection, proyecci?n cartogr?fica.
|
68 |
*/
|
69 |
public IProjection getProjection() {
|
70 |
return proj;
|
71 |
} |
72 |
|
73 |
/**
|
74 |
* Permite reproyectar una entidad dado un conjunto de coordenadas de transformaci?n.
|
75 |
* @param rp, coordenadas de transformaci?n.
|
76 |
*/
|
77 |
abstract public void reProject(ICoordTrans ct); |
78 |
|
79 |
/**
|
80 |
* Devuelve el nombre de la capa en la que se encuentra la entidad.
|
81 |
* @return String
|
82 |
*/
|
83 |
public String getLayerName() { |
84 |
return layer.getName();
|
85 |
} |
86 |
|
87 |
/**
|
88 |
* Devuelve el color de la entidad seg?n AutoCAD en forma de texto.
|
89 |
* @return String con el color de la entidad seg?n AutoCAD.
|
90 |
*/
|
91 |
public String getColor() { |
92 |
return "" + dxfColor; |
93 |
} |
94 |
|
95 |
/**
|
96 |
* Permite la escritura de entidades en un fichero DXF2000.
|
97 |
* @return String, la cadena que se escribir? en el fichero con la informaci?n
|
98 |
* de la correspondiente entidad.
|
99 |
*/
|
100 |
abstract public String toDxfString(); |
101 |
|
102 |
/**
|
103 |
* @return Returns the handle.
|
104 |
*/
|
105 |
public int getHandle() { |
106 |
return handle;
|
107 |
} |
108 |
|
109 |
/**
|
110 |
* @param handle The handle to set.
|
111 |
*/
|
112 |
public void setHandle(int handle) { |
113 |
this.handle = handle;
|
114 |
} |
115 |
|
116 |
/**
|
117 |
* Devuelve la capa en la que se encuentra la entidad.
|
118 |
* @return DxfLayer, la capa.
|
119 |
*/
|
120 |
public DxfLayer getLayer() {
|
121 |
return layer;
|
122 |
} |
123 |
} |