gvsig-projects-pool / org.gvsig.lidar.app / org.gvsig.lidar.app.mainplugin / src / main / java / org / gvsig / exportto / swing / prov / lidar / ExporttoLASProvider.java @ 281
History | View | Annotate | Download (3.75 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2016 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.exportto.swing.prov.lidar; |
24 |
|
25 |
import java.io.File; |
26 |
import java.util.ArrayList; |
27 |
import java.util.List; |
28 |
|
29 |
import org.cresques.cts.ICoordTrans; |
30 |
import org.cresques.cts.IProjection; |
31 |
import org.gvsig.exportto.ExporttoService; |
32 |
import org.gvsig.exportto.swing.panel.SelectEnvelopeOptionPanel; |
33 |
import org.gvsig.exportto.swing.prov.file.AbstractExporttoFileProvider; |
34 |
import org.gvsig.exportto.swing.spi.ExporttoSwingProviderPanel; |
35 |
import org.gvsig.fmap.dal.exception.DataException; |
36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
37 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters; |
38 |
import org.gvsig.fmap.geom.primitive.Envelope; |
39 |
import org.gvsig.tools.service.spi.ProviderServices; |
40 |
import org.slf4j.Logger; |
41 |
import org.slf4j.LoggerFactory; |
42 |
import org.gvsig.exportto.swing.prov.lidar.ExporttoLASService; |
43 |
|
44 |
/**
|
45 |
* Exporto provider which gets Exporto from a file.
|
46 |
*
|
47 |
* @author <a href="mailto:cmartinez@scolab.es">Cesar Martinez Izquierdo</a>
|
48 |
*/
|
49 |
public class ExporttoLASProvider extends AbstractExporttoFileProvider |
50 |
implements ExporttoLASOptions {
|
51 |
|
52 |
private static Logger logger = LoggerFactory.getLogger( |
53 |
ExporttoLASProvider.class); |
54 |
|
55 |
protected List<ExporttoSwingProviderPanel> panels = new ArrayList<ExporttoSwingProviderPanel>(); |
56 |
|
57 |
private String storeName = null; |
58 |
protected SelectEnvelopeOptionPanel envelopePanel;
|
59 |
|
60 |
public ExporttoLASProvider(ProviderServices providerServices,
|
61 |
FeatureStore sourceStore, IProjection targetProjection) { |
62 |
super(providerServices, sourceStore, targetProjection);
|
63 |
IProjection sourceProjection = getSourceSrs(sourceStore); |
64 |
envelopePanel = new SelectEnvelopeOptionPanel(sourceProjection);
|
65 |
} |
66 |
|
67 |
protected IProjection getSourceSrs(FeatureStore sourceStore) {
|
68 |
try {
|
69 |
return sourceStore.getDefaultFeatureType().getDefaultGeometryAttribute().getSRS();
|
70 |
} catch (Exception e) {} |
71 |
return null; |
72 |
} |
73 |
|
74 |
public int getPanelCount() { |
75 |
return super.getPanelCount()+1; |
76 |
//return this.panels.size();
|
77 |
} |
78 |
|
79 |
public ExporttoSwingProviderPanel getPanelAt(int index) { |
80 |
if (super.getPanelCount()>index) { |
81 |
return super.getPanelAt(index); |
82 |
} |
83 |
else {
|
84 |
return envelopePanel;
|
85 |
} |
86 |
} |
87 |
|
88 |
public FeatureStore getSource() {
|
89 |
return this.featureStore; |
90 |
} |
91 |
|
92 |
public ExporttoService createExporttoService() {
|
93 |
return new ExporttoLASService(this); |
94 |
} |
95 |
|
96 |
public FilesystemServerExplorerParameters getExplorerParameters() {
|
97 |
return null; |
98 |
// CMI return this.connectionPanel.getServerExplorerParameters();
|
99 |
} |
100 |
|
101 |
|
102 |
|
103 |
public File getOutputFile() { |
104 |
return this.selectFileOptionPanel.getSelectedFile(); |
105 |
} |
106 |
|
107 |
|
108 |
|
109 |
public IProjection getTargetProjection() {
|
110 |
return this.projection; |
111 |
} |
112 |
|
113 |
|
114 |
public Envelope getFilterEnvelope() {
|
115 |
return this.envelopePanel.getEnvelope(); |
116 |
} |
117 |
} |