Revision 35 org.gvsig.lrs/trunk/org.gvsig.lrs/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/java/org/gvsig/lrs/app/calibrateroute/CalibrateRouteExtension.java
CalibrateRouteExtension.java | ||
---|---|---|
43 | 43 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
44 | 44 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
45 | 45 |
import org.gvsig.fmap.dal.feature.FeatureType; |
46 |
import org.gvsig.fmap.dal.store.shp.SHPNewStoreParameters; |
|
46 | 47 |
import org.gvsig.fmap.geom.DataTypes; |
47 | 48 |
import org.gvsig.fmap.geom.Geometry; |
48 | 49 |
import org.gvsig.fmap.geom.type.GeometryType; |
50 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
51 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
|
52 |
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException; |
|
49 | 53 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
50 | 54 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
51 | 55 |
import org.gvsig.fmap.mapcontext.layers.operations.LayerCollection; |
... | ... | |
135 | 139 |
} |
136 | 140 |
LrsAlgorithmsManager algorithmsManager = LrsAlgorithmsLocator.getLrsAlgorithmsManager(); |
137 | 141 |
final LrsAlgorithm algorithm = algorithmsManager.createLrsAlgorithm(params); |
142 |
final SHPNewStoreParameters shpParams=(SHPNewStoreParameters)params.getNewFeatureStoreParameters(); |
|
143 |
|
|
138 | 144 |
final SimpleTaskStatus taskStatus = |
139 | 145 |
ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus(i18nManager.getTranslation("progress")); |
140 | 146 |
|
... | ... | |
148 | 154 |
public void run() { |
149 | 155 |
try { |
150 | 156 |
algorithm.execute(taskStatus); |
157 |
int resultLoadLayer =JOptionPane.showConfirmDialog( |
|
158 |
null, |
|
159 |
i18nManager.getTranslation("load_layer_question"), |
|
160 |
i18nManager.getTranslation("load_layer_question_title"), JOptionPane.YES_NO_OPTION); |
|
161 |
if (resultLoadLayer==JOptionPane.YES_OPTION){ |
|
162 |
loadLayer(shpParams); |
|
163 |
} |
|
151 | 164 |
} catch (Exception e) { |
152 | 165 |
logger.error("Error calibrating route", e); |
153 | 166 |
String message = e.getMessage(); |
... | ... | |
214 | 227 |
return view; |
215 | 228 |
} |
216 | 229 |
|
230 |
private void loadLayer(SHPNewStoreParameters shpParams){ |
|
231 |
if (shpParams!=null ){ |
|
232 |
String name=shpParams.getFile().getName(); |
|
233 |
if (name.contains(".shp")){ |
|
234 |
name=name.substring(0,name.lastIndexOf(".shp")); |
|
235 |
} |
|
236 |
MapContextManager mapContextManager =MapContextLocator.getMapContextManager(); |
|
237 |
|
|
238 |
FLyrVect newLayer=null; |
|
239 |
try { |
|
240 |
newLayer = (FLyrVect) mapContextManager.createLayer(name,shpParams); |
|
241 |
} catch (LoadLayerException e) { |
|
242 |
logger.warn("Couldn't load layer",e); |
|
243 |
} |
|
244 |
getActiveView().getMapControl().getMapContext().getLayers().addLayer(newLayer); |
|
245 |
} |
|
246 |
} |
|
247 |
|
|
217 | 248 |
} |
Also available in: Unified diff