Revision 31496 branches/v2_0_0_prep/extensions/extSextanteGvsigBindings/src/org/gvsig/sextante/gui/gvInputFactory.java
gvInputFactory.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.geom.Rectangle2D; |
4 | 4 |
import java.util.ArrayList; |
5 |
import java.util.List; |
|
5 | 6 |
|
6 | 7 |
import org.gvsig.andami.PluginServices; |
7 | 8 |
import org.gvsig.app.extension.ProjectExtension; |
8 | 9 |
import org.gvsig.app.project.Project; |
9 |
import org.gvsig.app.project.documents.table.FeatureTableDocument; |
|
10 |
import org.gvsig.app.project.documents.table.FeatureTableDocumentFactory; |
|
11 |
import org.gvsig.app.project.documents.view.ProjectView; |
|
12 |
import org.gvsig.app.project.documents.view.ProjectViewFactory; |
|
10 |
import org.gvsig.app.project.Project; |
|
11 |
import org.gvsig.app.project.ProjectManager; |
|
12 |
import org.gvsig.app.project.documents.Document; |
|
13 |
import org.gvsig.app.project.documents.table.TableDocument; |
|
14 |
import org.gvsig.app.project.documents.table.TableManager; |
|
15 |
import org.gvsig.app.project.documents.view.DefaultViewDocument; |
|
16 |
import org.gvsig.app.project.documents.view.ViewManager; |
|
13 | 17 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
14 | 18 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
15 | 19 |
import org.gvsig.fmap.mapcontext.layers.LayersIterator; |
... | ... | |
20 | 24 |
import org.gvsig.sextante.core.gvTable; |
21 | 25 |
import org.gvsig.sextante.core.gvVectorLayer; |
22 | 26 |
|
23 |
|
|
24 | 27 |
import es.unex.sextante.dataObjects.IDataObject; |
25 | 28 |
import es.unex.sextante.gui.core.AbstractInputFactory; |
26 | 29 |
import es.unex.sextante.gui.core.NamedExtent; |
... | ... | |
31 | 34 |
|
32 | 35 |
ArrayList list = new ArrayList(); |
33 | 36 |
|
34 |
Project project = ((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject(); |
|
35 |
ArrayList views = project.getDocumentsByType(ProjectViewFactory.registerName); |
|
37 |
// Project project = ((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject(); |
|
38 |
final Project project = ProjectManager.getInstance().getCurrentProject(); |
|
39 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
|
36 | 40 |
for (int i = 0; i < views.size(); i++) { |
37 |
ProjectView view = (ProjectView) views.get(i);
|
|
41 |
DefaultViewDocument view = (DefaultViewDocument) views.get(i);
|
|
38 | 42 |
FLayers layers = view.getMapContext().getLayers(); |
39 | 43 |
LayersIterator iter = new LayersIterator(layers); |
40 | 44 |
while (iter.hasNext()){ |
... | ... | |
52 | 56 |
} |
53 | 57 |
} |
54 | 58 |
|
55 |
ArrayList tables = project.getDocumentsByType(FeatureTableDocumentFactory.registerName);
|
|
59 |
List<Document> tables = project.getDocuments(TableManager.TYPENAME);
|
|
56 | 60 |
for (int i = 0; i < tables.size(); i++) { |
57 | 61 |
gvTable table = new gvTable(); |
58 |
table.create((FeatureTableDocument) tables.get(i));
|
|
62 |
table.create((TableDocument) tables.get(i)); |
|
59 | 63 |
list.add(table); |
60 | 64 |
} |
61 | 65 |
|
... | ... | |
68 | 72 |
|
69 | 73 |
public NamedExtent[] getPredefinedExtents() { |
70 | 74 |
|
71 |
Project project = ((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject(); |
|
72 |
ArrayList views = project.getDocumentsByType(ProjectViewFactory.registerName); |
|
73 |
NamedExtent ne[] = new NamedExtent[views.size()]; |
|
75 |
// Project project = ((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject(); |
|
76 |
// ArrayList views = project.getDocumentsByType(ProjectViewFactory.registerName); |
|
77 |
final Project project = ProjectManager.getInstance().getCurrentProject(); |
|
78 |
List<Document> views = project.getDocuments(ViewManager.TYPENAME); |
|
79 |
NamedExtent ne[] = new NamedExtent[views.size()]; |
|
74 | 80 |
for (int i = 0; i < views.size(); i++) { |
75 |
ProjectView view = (ProjectView) views.get(i);
|
|
81 |
DefaultViewDocument view = (DefaultViewDocument) views.get(i);
|
|
76 | 82 |
Rectangle2D extent = view.getMapContext().getViewPort().getExtent(); |
77 | 83 |
String sName = view.getName(); |
78 | 84 |
ne[i] = new NamedExtent(sName, extent); |
Also available in: Unified diff