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