Revision 31946 branches/v2_0_0_prep/extensions/extGeocoding/src/org/gvsig/geocoding/export/MasiveExportThread.java
MasiveExportThread.java | ||
---|---|---|
36 | 36 |
import javax.swing.JFileChooser; |
37 | 37 |
|
38 | 38 |
import org.gvsig.andami.PluginServices; |
39 |
import org.gvsig.app.project.documents.ProjectDocumentFactory; |
|
40 |
import org.gvsig.app.project.documents.table.FeatureTableDocument; |
|
41 |
import org.gvsig.app.project.documents.table.FeatureTableDocumentFactory; |
|
42 |
import org.gvsig.app.project.documents.view.gui.View; |
|
39 |
import org.gvsig.app.project.Project; |
|
40 |
import org.gvsig.app.project.ProjectManager; |
|
41 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
42 |
import org.gvsig.app.project.documents.table.TableManager; |
|
43 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
|
44 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
45 |
|
|
43 | 46 |
import org.gvsig.fmap.dal.DALLocator; |
44 | 47 |
import org.gvsig.fmap.dal.DataManager; |
45 | 48 |
import org.gvsig.fmap.dal.DataServerExplorer; |
... | ... | |
75 | 78 |
import org.gvsig.geocoding.utils.GeocodingExtTags; |
76 | 79 |
import org.gvsig.geocoding.utils.GeocodingUtils; |
77 | 80 |
import org.gvsig.tools.ToolsLocator; |
81 |
import org.gvsig.tools.extensionpoint.ExtensionPoint; |
|
78 | 82 |
import org.gvsig.utils.GenericFileFilter; |
79 | 83 |
import org.slf4j.Logger; |
80 | 84 |
import org.slf4j.LoggerFactory; |
... | ... | |
118 | 122 |
// Create DBF Store Results |
119 | 123 |
FeatureStore dbfStore = createDBFStoreAllResults(dbfFile); |
120 | 124 |
// Load dbf all results in gvSIG proyect |
121 |
FeatureTableDocument table = loadTableAllResults(dbfStore, dbfFile);
|
|
125 |
TableDocument table = loadTableAllResults(dbfStore, dbfFile); |
|
122 | 126 |
// Build shp name |
123 | 127 |
File shpFile = GeocodingUtils.addSHPSuffix(exportFile); |
124 | 128 |
// create layer |
... | ... | |
132 | 136 |
// relate table all results to layer |
133 | 137 |
flyr.setProperty(GeocodingExtTags.GEOCODINGPROPERTY, table); |
134 | 138 |
// add layer to view |
135 |
View view = control.getCurrentView(); |
|
139 |
IView view = control.getCurrentView();
|
|
136 | 140 |
FLayers lyrs = view.getMapControl().getMapContext().getLayers(); |
137 | 141 |
lyrs.addLayer(flyr); |
138 | 142 |
} |
... | ... | |
444 | 448 |
* @param file |
445 | 449 |
* @return |
446 | 450 |
*/ |
447 |
private FeatureTableDocument loadTableAllResults(FeatureStore store, |
|
448 |
File file) { |
|
451 |
private TableDocument loadTableAllResults(FeatureStore store, |
|
452 |
File file) { |
|
453 |
|
|
454 |
ProjectManager pdf = ProjectManager.getInstance(); |
|
455 |
Project proj = pdf.getCurrentProject(); |
|
456 |
TableManager tmanager = new TableManager(); |
|
449 | 457 |
|
450 |
ProjectDocumentFactory pdf = null; |
|
451 |
try { |
|
452 |
pdf = (ProjectDocumentFactory) ToolsLocator |
|
453 |
.getExtensionPointManager().get("Documents").create( |
|
454 |
FeatureTableDocumentFactory.registerName); |
|
455 |
} catch (Exception e) { |
|
456 |
// FIXME Exception |
|
457 |
e.printStackTrace(); |
|
458 |
} |
|
459 |
|
|
460 |
FeatureTableDocument pt = FeatureTableDocumentFactory.createTable(file |
|
461 |
.getName(), store); |
|
462 |
pt.setProjectDocumentFactory(pdf); |
|
463 |
|
|
464 |
// IWindow window = table.createWindow(); |
|
465 |
// if (window == null) { |
|
466 |
// JOptionPane.showMessageDialog((Component) PluginServices |
|
467 |
// .getMainFrame(), PluginServices.getText(this, |
|
468 |
// "error_opening_the_document")); |
|
469 |
// return null; |
|
470 |
// } |
|
471 |
// PluginServices.getMDIManager().addWindow(window); |
|
458 |
TableDocument pt = (TableDocument)tmanager.create(); |
|
459 |
pt.setName(file.getName()); |
|
460 |
pt.setStore(store); |
|
461 |
pt.setProject(proj); |
|
462 |
|
|
472 | 463 |
return pt; |
473 | 464 |
} |
474 | 465 |
|
... | ... | |
581 | 572 |
SHPNewStoreParameters newShpParams = (SHPNewStoreParameters) serverExplorer |
582 | 573 |
.getAddParameters(SHPStoreProvider.NAME); |
583 | 574 |
newShpParams.setFile(shpFile); |
584 |
String proj = control.getCurrentView().getProjection().getAbrev();
|
|
575 |
String proj = ((DefaultViewPanel)this.control.getCurrentView()).getProjection().getAbrev();
|
|
585 | 576 |
newShpParams.setSRSID(proj); |
586 | 577 |
newShpParams.setDynValue("SRSOriginalParameters", proj); |
587 | 578 |
|
Also available in: Unified diff