svn-gvsig-desktop / branches / Mobile_Compatible_Hito_1 / libDXF / src / org / cresques / px / dxf / DxfHeaderVariables.java @ 21930
History | View | Annotate | Download (3.31 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.cresques.px.dxf; |
25 |
|
26 |
|
27 |
|
28 |
/**
|
29 |
* Definici?n de las variables que definen un DXF. Estas variables est?n
|
30 |
* establecidas en la secci?n HEADER del propio fichero DXF.
|
31 |
* @author jmorell (jose.morell@gmail.com)
|
32 |
* @version 15-dic-2004
|
33 |
*/
|
34 |
public class DxfHeaderVariables { |
35 |
private String acadVersion; |
36 |
private String acadMaintVer; |
37 |
private boolean writedDxf3D; |
38 |
private double minZFromHeader; |
39 |
private double maxZFromHeader; |
40 |
|
41 |
/**
|
42 |
* Constructor de DxfHeaderVariables.
|
43 |
*/
|
44 |
public DxfHeaderVariables() {
|
45 |
} |
46 |
|
47 |
/**
|
48 |
* Devuelve la versi?n del fichero DXF.
|
49 |
* @return String
|
50 |
*/
|
51 |
public String getAcadVersion() { |
52 |
return acadVersion;
|
53 |
} |
54 |
|
55 |
/**
|
56 |
* Establece la versi?n del fichero DXF.
|
57 |
* @param acadVersion
|
58 |
*/
|
59 |
public void setAcadVersion(String acadVersion) { |
60 |
//System.out.println(acadVersion);
|
61 |
this.acadVersion = acadVersion;
|
62 |
} |
63 |
|
64 |
/**
|
65 |
* Transforma la nomenclatura interna de versiones de ficheros DXF en la
|
66 |
* nomenclatura habitual de versiones de AutoCAD.
|
67 |
* @param codedVersion, versi?n seg?n la nomenclatura interna.
|
68 |
* @return String con la versi?n en la nomenclatura m?s habitual.
|
69 |
*/
|
70 |
public String decodeAcadVersion(String codedVersion) { |
71 |
if (codedVersion.equals("AC1006")) { |
72 |
return new String("R10"); |
73 |
} else if (codedVersion.equals("AC1009")) { |
74 |
return new String("R11&R12"); |
75 |
} else if (codedVersion.equals("AC1012")) { |
76 |
return new String("R13"); |
77 |
} else if (codedVersion.equals("AC1014")) { |
78 |
return new String("R14"); |
79 |
} else if (codedVersion.equals("AC1015")) { |
80 |
return new String("ACAD2000"); |
81 |
} else if (codedVersion.equals("AC1018")) { |
82 |
return new String("ACAD2004"); |
83 |
} else {
|
84 |
return new String("Unknown codedVersion"); |
85 |
} |
86 |
} |
87 |
|
88 |
public boolean isWritedDxf3D() { |
89 |
// si los ext son como los escribimos devolver true
|
90 |
writedDxf3D = false;
|
91 |
double z1 = minZFromHeader;
|
92 |
double z2 = maxZFromHeader;
|
93 |
if (z1==999999999.0 && z2==-999999999.0) writedDxf3D = true; |
94 |
return writedDxf3D;
|
95 |
} |
96 |
|
97 |
public void loadMinZFromHeader(double d) { |
98 |
minZFromHeader = d; |
99 |
} |
100 |
|
101 |
public void loadMaxZFromHeader(double d) { |
102 |
maxZFromHeader = d; |
103 |
} |
104 |
} |