Revision 727 org.gvsig.topology/trunk/org.gvsig.topology/org.gvsig.topology.lib/org.gvsig.topology.lib.impl/src/main/java/org/gvsig/topology/lib/impl/DefaultTopologyDataSet.java
DefaultTopologyDataSet.java | ||
---|---|---|
29 | 29 |
import org.apache.commons.lang3.StringUtils; |
30 | 30 |
import org.apache.commons.lang3.mutable.MutableObject; |
31 | 31 |
import org.gvsig.expressionevaluator.Expression; |
32 |
import org.gvsig.fmap.dal.DataStore; |
|
32 | 33 |
import org.gvsig.fmap.dal.EditingNotification; |
33 | 34 |
import org.gvsig.fmap.dal.EditingNotificationManager; |
34 | 35 |
import org.gvsig.fmap.dal.exception.DataException; |
... | ... | |
70 | 71 |
|
71 | 72 |
private TopologyServices services; |
72 | 73 |
private String name; |
73 |
private FeatureStore store;
|
|
74 |
private DataStore store;
|
|
74 | 75 |
private boolean needFinishEditing; |
75 | 76 |
private String fullName; |
76 | 77 |
private PropertiesSupportHelper propertiesHelper; |
... | ... | |
85 | 86 |
this.propertiesHelper = new PropertiesSupportHelper(); |
86 | 87 |
} |
87 | 88 |
|
88 |
public DefaultTopologyDataSet(TopologyServices services, String name, FeatureStore store) {
|
|
89 |
public DefaultTopologyDataSet(TopologyServices services, String name, DataStore store) {
|
|
89 | 90 |
this.services = services; |
90 | 91 |
this.name = name; |
91 | 92 |
this.store = store; |
... | ... | |
128 | 129 |
@Override |
129 | 130 |
public String toString() { |
130 | 131 |
try { |
131 |
FeatureAttributeDescriptor attr = this.getStore().getDefaultFeatureType().getDefaultGeometryAttribute(); |
|
132 |
FeatureAttributeDescriptor attr = this.getFeatureStore().getDefaultFeatureType().getDefaultGeometryAttribute();
|
|
132 | 133 |
String geomType = attr.getGeomType().getName(); |
133 | 134 |
return this.name + " ("+ geomType + ")"; |
134 | 135 |
} catch(Exception ex) { |
... | ... | |
137 | 138 |
} |
138 | 139 |
|
139 | 140 |
@Override |
140 |
public FeatureStore getStore() {
|
|
141 |
public DataStore getStore() {
|
|
141 | 142 |
if (this.store == null) { |
142 | 143 |
this.store = this.services.getFeatureStore(this); |
143 | 144 |
} |
... | ... | |
145 | 146 |
} |
146 | 147 |
|
147 | 148 |
@Override |
149 |
public FeatureStore getFeatureStore() { |
|
150 |
if (this.store == null) { |
|
151 |
this.store = this.services.getFeatureStore(this); |
|
152 |
} |
|
153 |
return (FeatureStore) this.store; |
|
154 |
} |
|
155 |
|
|
156 |
@Override |
|
148 | 157 |
public long getSize() { |
149 | 158 |
try { |
150 |
long size = this.getStore().getFeatureCount(); |
|
159 |
long size = this.getFeatureStore().getFeatureCount();
|
|
151 | 160 |
return size; |
152 | 161 |
} catch (DataException ex) { |
153 | 162 |
// TODO: mensage al log |
... | ... | |
166 | 175 |
@Override |
167 | 176 |
public int getGeometryType() { |
168 | 177 |
try { |
169 |
FeatureStore theStore = this.getStore(); |
|
178 |
FeatureStore theStore = this.getFeatureStore();
|
|
170 | 179 |
FeatureType featureType = theStore.getDefaultFeatureType(); |
171 | 180 |
FeatureAttributeDescriptor attr = featureType.getDefaultGeometryAttribute(); |
172 | 181 |
GeometryType geomType = attr.getGeomType(); |
... | ... | |
178 | 187 |
|
179 | 188 |
@Override |
180 | 189 |
public void accept(Visitor visitor) throws VisitCanceledException { |
181 |
FeatureStore st = this.getStore(); |
|
190 |
FeatureStore st = this.getFeatureStore();
|
|
182 | 191 |
try { |
183 | 192 |
st.accept(visitor); |
184 | 193 |
} catch(VisitCanceledException ex) { |
... | ... | |
190 | 199 |
|
191 | 200 |
@Override |
192 | 201 |
public void edit() throws DataException { |
193 |
FeatureStore theStore = this.getStore(); |
|
202 |
FeatureStore theStore = this.getFeatureStore();
|
|
194 | 203 |
if (!theStore.isEditing()) { |
195 | 204 |
theStore.edit(); |
196 | 205 |
this.needFinishEditing = true; |
... | ... | |
200 | 209 |
@Override |
201 | 210 |
public void finishEditing() throws DataException { |
202 | 211 |
if (this.needFinishEditing) { |
203 |
this.getStore().finishEditing(); |
|
212 |
this.getFeatureStore().finishEditing();
|
|
204 | 213 |
} |
205 | 214 |
} |
206 | 215 |
|
207 | 216 |
@Override |
208 | 217 |
public EditableFeature createNewFeature() throws DataException { |
209 |
EditableFeature f = this.getStore().createNewFeature(); |
|
218 |
EditableFeature f = this.getFeatureStore().createNewFeature();
|
|
210 | 219 |
return f; |
211 | 220 |
} |
212 | 221 |
|
... | ... | |
218 | 227 |
|
219 | 228 |
EditingNotificationManager editingNotificationManager |
220 | 229 |
= DALSwingLocator.getEditingNotificationManager(); |
221 |
FeatureStore theStore = this.getStore(); |
|
230 |
FeatureStore theStore = this.getFeatureStore();
|
|
222 | 231 |
|
223 | 232 |
EditingNotification notification |
224 | 233 |
= editingNotificationManager.notifyObservers(this, // source |
... | ... | |
344 | 353 |
public SpatialIndex getSpatialIndex() { |
345 | 354 |
if( this.spatialIndex == null ) { |
346 | 355 |
this.spatialIndex = new MutableObject<>(); |
347 |
FeatureStore theStore = this.getStore(); |
|
356 |
FeatureStore theStore = this.getFeatureStore();
|
|
348 | 357 |
FeatureStoreProviderFactory storeFactory = (FeatureStoreProviderFactory) theStore.getProviderFactory(); |
349 | 358 |
if( storeFactory.useLocalIndexesCanImprovePerformance()==FeatureStoreProviderFactory.YES ) { |
350 | 359 |
try { |
... | ... | |
396 | 405 |
@Override |
397 | 406 |
public Feature findFirst(Expression filter) { |
398 | 407 |
try { |
399 |
return this.getStore().findFirst(filter); |
|
408 |
return this.getFeatureStore().findFirst(filter);
|
|
400 | 409 |
} catch (Exception ex) { |
401 | 410 |
return null; |
402 | 411 |
} |
Also available in: Unified diff