24 |
24 |
|
25 |
25 |
package org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling;
|
26 |
26 |
|
|
27 |
import org.cresques.cts.ICoordTrans;
|
|
28 |
|
27 |
29 |
import org.gvsig.fmap.dal.exception.DataException;
|
28 |
30 |
import org.gvsig.fmap.dal.feature.FeatureQuery;
|
29 |
31 |
import org.gvsig.fmap.dal.feature.FeatureSet;
|
30 |
32 |
import org.gvsig.fmap.dal.feature.FeatureStore;
|
31 |
33 |
import org.gvsig.fmap.dal.feature.FeatureType;
|
|
34 |
import org.gvsig.fmap.geom.primitive.Envelope;
|
32 |
35 |
import org.gvsig.fmap.mapcontext.ViewPort;
|
33 |
36 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
|
34 |
37 |
import org.gvsig.fmap.mapcontext.layers.vectorial.IntersectsEnvelopeEvaluator;
|
... | ... | |
92 |
95 |
ILabelClass lc,
|
93 |
96 |
ViewPort viewPort,
|
94 |
97 |
String[] usedFields) throws DataException {
|
95 |
|
|
|
98 |
|
96 |
99 |
FeatureStore featureStore=layer.getFeatureStore();
|
97 |
|
|
|
100 |
|
98 |
101 |
if (viewPort == null && usedFields == null) {
|
99 |
102 |
// nothing more to do
|
100 |
103 |
return featureStore.getFeatureSet();
|
101 |
104 |
}
|
102 |
105 |
FeatureQuery featureQuery=featureStore.createFeatureQuery();
|
103 |
|
|
|
106 |
|
104 |
107 |
if (usedFields != null) {
|
105 |
108 |
featureQuery.setAttributeNames(usedFields);
|
106 |
109 |
}
|
107 |
110 |
|
|
111 |
Envelope viewPortEnvelope = viewPort.getAdjustedEnvelope();
|
|
112 |
|
|
113 |
ICoordTrans coordTrans = layer.getCoordTrans();
|
|
114 |
if(coordTrans!=null){
|
|
115 |
Envelope envelopeConverted = viewPortEnvelope.convert(coordTrans.getInverted());
|
|
116 |
viewPortEnvelope = envelopeConverted;
|
|
117 |
}
|
108 |
118 |
Evaluator eva = null;
|
109 |
|
|
|
119 |
|
110 |
120 |
if (viewPort != null) {
|
111 |
121 |
eva = SpatialEvaluatorsFactory.getInstance().intersects(
|
112 |
|
viewPort.getAdjustedEnvelope(),
|
|
122 |
viewPortEnvelope,
|
113 |
123 |
layer.getProjection(),
|
114 |
124 |
featureStore
|
115 |
125 |
);
|
116 |
126 |
}
|
117 |
|
|
|
127 |
|
118 |
128 |
if (lc.getSQLQuery() != null && lc.getSQLQuery().trim().length() > 0) {
|
119 |
129 |
Evaluator vp_eva = eva;
|
120 |
130 |
AndEvaluator and_eva = new AndEvaluator(vp_eva);
|
121 |
|
|
|
131 |
|
122 |
132 |
String sql_str = lc.getSQLQuery();
|
123 |
133 |
/*
|
124 |
134 |
* SQL filter was validated in the dialog
|
125 |
135 |
*/
|
126 |
136 |
Evaluator sql_eval = EvaluatorCreator.getEvaluator(sql_str);
|
127 |
137 |
and_eva.addEvaluator(sql_eval);
|
128 |
|
eva = and_eva;
|
|
138 |
eva = and_eva;
|
129 |
139 |
}
|
130 |
140 |
|
131 |
141 |
featureQuery.setFilter(eva);
|
... | ... | |
152 |
162 |
}
|
153 |
163 |
|
154 |
164 |
public ILabelingMethod cloneMethod() {
|
155 |
|
//XMLENTITY-UPDATED
|
|
165 |
//XMLENTITY-UPDATED
|
156 |
166 |
// if (defaultLabel !=null)
|
157 |
167 |
// try {
|
158 |
168 |
// return new DefaultLabelingMethod(LabelingFactory.createLabelClassFromXML(defaultLabel.getXMLEntity()));
|
... | ... | |
177 |
187 |
public void saveToState(PersistentState state) throws PersistenceException {
|
178 |
188 |
state.set(FIELD_DEFAULT_LABEL, defaultLabel);
|
179 |
189 |
}
|
180 |
|
|
|
190 |
|
181 |
191 |
public static class RegisterPersistence implements Callable {
|
182 |
192 |
|
183 |
193 |
public Object call() throws Exception {
|
... | ... | |
187 |
197 |
DefaultLabelingMethod.class,
|
188 |
198 |
DEFAULT_LABELING_METHOD_PERSISTENCE_DEFINITION_NAME,
|
189 |
199 |
DEFAULT_LABELING_METHOD_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
|
190 |
|
null,
|
|
200 |
null,
|
191 |
201 |
null
|
192 |
202 |
);
|
193 |
|
|
|
203 |
|
194 |
204 |
definition.addDynFieldObject(FIELD_DEFAULT_LABEL).setMandatory(false).setClassOfValue(ILabelClass.class);
|
195 |
205 |
}
|
196 |
206 |
return Boolean.TRUE;
|
197 |
207 |
}
|
198 |
|
|
|
208 |
|
199 |
209 |
}
|
200 |
210 |
|
201 |
211 |
|
202 |
|
|
|
212 |
|
203 |
213 |
}
|