svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.exportto / org.gvsig.exportto.lib / org.gvsig.exportto.lib.api / src / main / java / org / gvsig / export / spi / AbstractExportParametersGeometry.java @ 44354
History | View | Annotate | Download (4.51 KB)
1 |
/*
|
---|---|
2 |
* To change this license header, choose License Headers in Project Properties.
|
3 |
* To change this template file, choose Tools | Templates
|
4 |
* and open the template in the editor.
|
5 |
*/
|
6 |
package org.gvsig.export.spi; |
7 |
|
8 |
import org.cresques.cts.ICoordTrans; |
9 |
import org.cresques.cts.IProjection; |
10 |
import org.gvsig.fmap.geom.GeometryLocator; |
11 |
import org.gvsig.fmap.geom.GeometryManager; |
12 |
import org.gvsig.fmap.geom.type.GeometryType; |
13 |
import org.gvsig.export.ExportParametersGeometry; |
14 |
|
15 |
/**
|
16 |
*
|
17 |
* @author jjdelcerro
|
18 |
*/
|
19 |
public abstract class AbstractExportParametersGeometry |
20 |
extends AbstractExportParameters
|
21 |
implements ExportParametersGeometry
|
22 |
{ |
23 |
|
24 |
private IProjection contextProjection;
|
25 |
private IProjection sourceProjection;
|
26 |
private IProjection targetProjection;
|
27 |
|
28 |
private ICoordTrans sourceTransformation;
|
29 |
private ICoordTrans targetTransformation;
|
30 |
|
31 |
private int geometryChecks; |
32 |
private int geometryChecksAction; |
33 |
private boolean tryToFixGeometry; |
34 |
private String geometryFieldName; |
35 |
private int geometryType; |
36 |
private int geometrySubtype; |
37 |
|
38 |
@Override
|
39 |
public boolean needsSelectTargetProjection() { |
40 |
return true; |
41 |
} |
42 |
|
43 |
@Override
|
44 |
public void setContextProjection(IProjection projection) { |
45 |
this.contextProjection = projection;
|
46 |
} |
47 |
|
48 |
@Override
|
49 |
public IProjection getContextProjection() {
|
50 |
return this.contextProjection; |
51 |
} |
52 |
|
53 |
@Override
|
54 |
public void setSourceProjection(IProjection sourceProjection) { |
55 |
this.sourceProjection = sourceProjection;
|
56 |
} |
57 |
|
58 |
@Override
|
59 |
public IProjection getSourceProjection() {
|
60 |
return sourceProjection;
|
61 |
} |
62 |
|
63 |
@Override
|
64 |
public ICoordTrans getSourceTransformation() {
|
65 |
return sourceTransformation;
|
66 |
} |
67 |
|
68 |
@Override
|
69 |
public void setSourceTransformation(ICoordTrans contextTransformation) { |
70 |
this.sourceTransformation = contextTransformation;
|
71 |
} |
72 |
|
73 |
@Override
|
74 |
public void setTargetProjection(IProjection targetProjection) { |
75 |
this.targetProjection = targetProjection;
|
76 |
} |
77 |
|
78 |
@Override
|
79 |
public IProjection getTargetProjection() {
|
80 |
if( this.targetProjection == null ) { |
81 |
return this.sourceProjection; |
82 |
} |
83 |
return this.targetProjection; |
84 |
} |
85 |
|
86 |
@Override
|
87 |
public void setTargetTransformation(ICoordTrans transformation) { |
88 |
this.targetTransformation = transformation;
|
89 |
} |
90 |
|
91 |
@Override
|
92 |
public ICoordTrans getTargetTransformation() {
|
93 |
return targetTransformation;
|
94 |
} |
95 |
|
96 |
@Override
|
97 |
public int getGeometryChecks() { |
98 |
return this.geometryChecks; |
99 |
} |
100 |
|
101 |
@Override
|
102 |
public int getGeometryChecksAction() { |
103 |
return this.geometryChecksAction; |
104 |
} |
105 |
|
106 |
@Override
|
107 |
public boolean getTryToFixGeometry() { |
108 |
return this.tryToFixGeometry; |
109 |
} |
110 |
|
111 |
@Override
|
112 |
public void setGeometryChecks(int geometryChecks) { |
113 |
this.geometryChecks = geometryChecks;
|
114 |
} |
115 |
|
116 |
@Override
|
117 |
public void setGeometryChecksAction(int geometryChecksAction) { |
118 |
this.geometryChecksAction = geometryChecksAction;
|
119 |
} |
120 |
|
121 |
@Override
|
122 |
public void setTryToFixGeometry(boolean tryToFixGeometry) { |
123 |
this.tryToFixGeometry = tryToFixGeometry;
|
124 |
} |
125 |
|
126 |
@Override
|
127 |
public String getSourceGeometryFieldName() { |
128 |
return this.geometryFieldName; |
129 |
} |
130 |
|
131 |
@Override
|
132 |
public void setSourceGeometryFieldName(String geometryFieldName) { |
133 |
this.geometryFieldName = geometryFieldName;
|
134 |
} |
135 |
|
136 |
@Override
|
137 |
public int getTargetGeometryTypeAsInt() { |
138 |
return geometryType;
|
139 |
} |
140 |
|
141 |
@Override
|
142 |
public int getTargetGeometrySubtype() { |
143 |
return geometrySubtype;
|
144 |
} |
145 |
|
146 |
@Override
|
147 |
public void setTargetGeometryType(int geometryType) { |
148 |
this.geometryType = geometryType;
|
149 |
} |
150 |
|
151 |
@Override
|
152 |
public void setTargetGeometrySubtype(int subtype) { |
153 |
this.geometrySubtype = subtype;
|
154 |
} |
155 |
|
156 |
@Override
|
157 |
public void setTargetGeometryType(GeometryType type) { |
158 |
this.geometryType = type.getType();
|
159 |
this.geometrySubtype = type.getSubType();
|
160 |
} |
161 |
|
162 |
@Override
|
163 |
public GeometryType getTargetGeometryType() {
|
164 |
try {
|
165 |
GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
166 |
GeometryType type = geomManager.getGeometryType( |
167 |
geometryType, |
168 |
geometryType |
169 |
); |
170 |
return type;
|
171 |
} catch (Exception ex) { |
172 |
throw new RuntimeException("Can't create geoemtry type from type "+geometryType+", subtype "+geometrySubtype+".", ex); |
173 |
} |
174 |
} |
175 |
|
176 |
|
177 |
|
178 |
} |