Revision 14834
trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/edition/writers/dxf/DxfWriter.java | ||
---|---|---|
71 | 71 |
int k = 0; |
72 | 72 |
|
73 | 73 |
boolean dxf3DFile = false; |
74 |
private int indexText=-1;//En DXF es 7. |
|
75 |
private int indexHeightText=-1;//En DXF es 8. |
|
76 |
private int indexRotationText=-1;//En DXF es 9. |
|
74 | 77 |
|
75 | 78 |
public void setFile(File f) { |
76 | 79 |
file = f; |
... | ... | |
124 | 127 |
} |
125 | 128 |
|
126 | 129 |
entityMaker = new DxfEntityMaker(proj); |
127 |
|
|
130 |
FieldDescription[] fieldDescriptions=getTableDefinition().getFieldsDesc(); |
|
131 |
for (int i=0;i<fieldDescriptions.length;i++){ |
|
132 |
if (fieldDescriptions[i].getFieldName().equals("Text")){ |
|
133 |
indexText=i; |
|
134 |
}else if (fieldDescriptions[i].getFieldName().equals("HeightText")){ |
|
135 |
indexHeightText=i; |
|
136 |
}else if (fieldDescriptions[i].getFieldName().equals("RotationText")){ |
|
137 |
indexRotationText=i; |
|
138 |
} |
|
139 |
} |
|
128 | 140 |
} |
129 | 141 |
|
130 | 142 |
public void process(IRowEdited row) throws ProcessWriterVisitorException { |
... | ... | |
942 | 954 |
*/ |
943 | 955 |
private void createPoint3D(int handle, int k, IGeometry geom, Value[] values) |
944 | 956 |
throws Exception { |
945 |
if (values.length>6 && !(values[7] instanceof NullValue)) {
|
|
957 |
if (indexText!=-1 && !(values[indexText] instanceof NullValue)){
|
|
946 | 958 |
createText3D(handle, k, geom, values); |
947 | 959 |
return; |
948 | 960 |
} |
... | ... | |
989 | 1001 |
private void createPoint2D(int handle, int k, IGeometry geom, Value[] values) |
990 | 1002 |
throws Exception { |
991 | 1003 |
|
992 |
if (values.length>6 && !(values[7] instanceof NullValue)) {
|
|
1004 |
if (indexText!= -1 && !(values[indexText] instanceof NullValue)){
|
|
993 | 1005 |
createText2D(handle, k, geom, values); |
994 | 1006 |
return; |
995 | 1007 |
} |
... | ... | |
1031 | 1043 |
Double heightText=DEFAULT_HEIGHTTEXT; |
1032 | 1044 |
Double rotationText=DEFAULT_ROTATIONTEXT; |
1033 | 1045 |
|
1034 |
if (fieldsDesc.length > 9) { |
|
1035 |
if (fieldsDesc[7].getFieldName().equals("Text") |
|
1036 |
&& !(values[7] instanceof NullValue)) { |
|
1037 |
text = values[7].toString(); |
|
1038 |
} |
|
1039 |
if (fieldsDesc[8].getFieldName().equals("HeightText") && |
|
1040 |
values[8] instanceof FloatValue) { |
|
1041 |
heightText = new Double(((NumericValue) values[8]) |
|
1042 |
.doubleValue()); |
|
1043 |
} |
|
1044 |
if (fieldsDesc[9].getFieldName().equals("RotationText") && |
|
1045 |
values[9] instanceof DoubleValue) { |
|
1046 |
rotationText = new Double(((NumericValue) values[9]) |
|
1047 |
.doubleValue()); |
|
1048 |
} |
|
1046 |
// if (fieldsDesc.length > 9) { |
|
1047 |
if (indexText!=-1 && !(values[indexText] instanceof NullValue)) { |
|
1048 |
text = values[indexText].toString(); |
|
1049 | 1049 |
} |
1050 |
if (indexHeightText!=-1 && !(values[indexHeightText] instanceof NumericValue)) { |
|
1051 |
heightText = new Double(((NumericValue) values[indexHeightText]) |
|
1052 |
.doubleValue()); |
|
1053 |
} |
|
1054 |
if (indexRotationText!=-1 && !(values[indexRotationText] instanceof NumericValue)) { |
|
1055 |
rotationText = new Double(((NumericValue) values[indexRotationText]) |
|
1056 |
.doubleValue()); |
|
1057 |
} |
|
1058 |
// } |
|
1050 | 1059 |
DxfGroup handleText = new DxfGroup(); |
1051 | 1060 |
handleText.setCode(1); |
1052 | 1061 |
handleText.setData(text); |
... | ... | |
1101 | 1110 |
double[] velev = ((FGeometry) geom).getZs(); |
1102 | 1111 |
elevation = new Double(velev[0]); |
1103 | 1112 |
|
1104 |
if (fieldsDesc[7].getFieldName().equals("Text") && !(values[7] instanceof NullValue)) {
|
|
1105 |
text = values[7].toString();
|
|
1113 |
if (indexText!=-1 && !(values[indexText] instanceof NullValue)) {
|
|
1114 |
text = values[indexText].toString();
|
|
1106 | 1115 |
} |
1107 |
if (fieldsDesc[8].getFieldName().equals("HeightText") && values[8] instanceof DoubleValue) {
|
|
1108 |
heightText = new Double(((NumericValue) values[8]).doubleValue());
|
|
1116 |
if (indexHeightText!=-1 && values[indexHeightText] instanceof NumericValue) {
|
|
1117 |
heightText = new Double(((NumericValue) values[indexHeightText]).doubleValue());
|
|
1109 | 1118 |
} |
1110 |
if (fieldsDesc[9].getFieldName().equals("RotationText") && values[9] instanceof DoubleValue) {
|
|
1111 |
rotationText = new Double(((NumericValue) values[9]).doubleValue());
|
|
1119 |
if (indexRotationText!=-1 && values[indexRotationText] instanceof NumericValue) {
|
|
1120 |
rotationText = new Double(((NumericValue) values[indexRotationText]).doubleValue());
|
|
1112 | 1121 |
} |
1113 | 1122 |
|
1114 | 1123 |
DxfGroup handleText = new DxfGroup(); |
Also available in: Unified diff