Revision 39493
branches/v2_0_0_prep/extensions/org.gvsig.daltransform.app.mainplugin/src/main/java/org/gvsig/daltransform/swing/impl/DataTransformSelectionAction.java | ||
---|---|---|
58 | 58 |
/* (non-Javadoc) |
59 | 59 |
* @see jwizardcomponent.Action#performAction() |
60 | 60 |
*/ |
61 |
public void performAction() { |
|
61 |
public void performAction() { |
|
62 |
|
|
63 |
/* |
|
64 |
* For layer attributes table, this depends on the user |
|
65 |
* decision. For tables without layer, for example, this is |
|
66 |
* always false |
|
67 |
*/ |
|
68 |
boolean result_added_separately = dataTransformWizard.isLayerLoaded(); |
|
62 | 69 |
//Gets the selected transformation |
63 | 70 |
DataTransformGui featureTransformGui = dataTransformWizard.getDataTransformGui(); |
64 | 71 |
|
65 | 72 |
//Gets the selected FeatureStore |
66 |
FeatureStore featureStore = dataTransformWizard.getFeatureStore(); |
|
67 |
FeatureStore cloned_store = null; |
|
68 |
try { |
|
69 |
cloned_store = (FeatureStore) featureStore.clone(); |
|
70 |
} catch (CloneNotSupportedException e1) { |
|
71 |
/* |
|
72 |
* FeatureStore always implements the clone method |
|
73 |
*/ |
|
74 |
} |
|
73 |
FeatureStore fsto = dataTransformWizard.getFeatureStore(); |
|
74 |
// FeatureStore cloned_store = null; |
|
75 |
|
|
76 |
if (result_added_separately) { |
|
77 |
try { |
|
78 |
/* |
|
79 |
* Clone if added separately |
|
80 |
*/ |
|
81 |
fsto = (FeatureStore) fsto.clone(); |
|
82 |
} catch (CloneNotSupportedException e1) { |
|
83 |
// FeatureStore always implements the clone method |
|
84 |
} |
|
85 |
} |
|
75 | 86 |
|
76 | 87 |
try { |
77 | 88 |
//Gets the transform |
78 |
FeatureStoreTransform featureStoreTransform = featureTransformGui.createFeatureStoreTransform(cloned_store);
|
|
89 |
FeatureStoreTransform fst = null;
|
|
79 | 90 |
|
80 | 91 |
// Apply the transformation |
81 |
cloned_store.getTransforms().add(featureStoreTransform); |
|
82 |
|
|
92 |
fst = featureTransformGui.createFeatureStoreTransform(fsto); |
|
93 |
fsto.getTransforms().add(fst); |
|
94 |
|
|
83 | 95 |
//Create and load a new layer... |
84 |
if (dataTransformWizard.isLayerLoaded()){
|
|
96 |
if (result_added_separately){
|
|
85 | 97 |
MapContextManager manager = MapContextLocator.getMapContextManager(); |
86 | 98 |
FLayer layer = manager.createLayer( |
87 | 99 |
featureTransformGui.toString(), |
88 |
cloned_store);
|
|
100 |
fsto);
|
|
89 | 101 |
dataTransformWizard.getMapContext().getLayers().addLayer(layer); |
90 | 102 |
layer.dispose(); |
91 | 103 |
} |
Also available in: Unified diff