svn-gvsig-desktop / branches / v10 / extensions / extPublish / src-test / gvsig / publish / infoproject / Test_queryLayer.java @ 16218
History | View | Annotate | Download (4.07 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Iba?ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.publish.infoproject; |
42 |
|
43 |
import junit.framework.TestCase; |
44 |
|
45 |
import org.gvsig.publish.util.LocalResourcesTestUtilities; |
46 |
|
47 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
48 |
|
49 |
public class Test_queryLayer extends TestCase { |
50 |
//gvSIG ProjectView
|
51 |
private ProjectView gvView = null; |
52 |
//information about the view to publish
|
53 |
private IViewInfo viewInfo = null; |
54 |
//get Resources from gvSIG like layers, views, ...
|
55 |
private LocalResourcesTestUtilities util = null; |
56 |
|
57 |
protected void setUp() throws Exception { |
58 |
super.setUp();
|
59 |
//gets a new view from the utilities
|
60 |
util = new LocalResourcesTestUtilities();
|
61 |
|
62 |
//creates a database
|
63 |
//util.createDBPostGIS();
|
64 |
} |
65 |
|
66 |
protected void tearDown() throws Exception { |
67 |
super.tearDown();
|
68 |
//util.dropDBPostGIS();
|
69 |
} |
70 |
|
71 |
/**
|
72 |
* test simple layer
|
73 |
*/
|
74 |
public void test_simpleLayer(){ |
75 |
//gvView = util.getBasicView();
|
76 |
gvView = util.getBasic2layersView(); |
77 |
viewInfo = new ViewInfo(gvView,null); |
78 |
//System.err.println("View name: " + viewInfo.getName());
|
79 |
//query all layers
|
80 |
for (int i = 0; i < this.viewInfo.getLayers().length; i++){ |
81 |
System.err.println("Layer " + i + " --------------"); |
82 |
printLayerInfo(this.viewInfo.getLayers()[i]);
|
83 |
} |
84 |
} |
85 |
/**
|
86 |
*
|
87 |
*/
|
88 |
public void test_groupedLayer(){ |
89 |
//gvView = util.getBasicView();
|
90 |
gvView = util.getGroupView(); |
91 |
viewInfo = new ViewInfo(gvView,null); |
92 |
System.err.println("====================================="); |
93 |
for (int i = 0; i < this.viewInfo.getLayers().length; i++){ |
94 |
System.err.println("Layer " + i + " --------------"); |
95 |
printLayerInfo(this.viewInfo.getLayers()[i]);
|
96 |
} |
97 |
} |
98 |
private void printLayerInfo(ILayerInfo l){ |
99 |
System.err.println("Name: " + l.getName()); |
100 |
System.err.println("Title: " + l.getTitle()); |
101 |
System.err.println("MaxScale: " + l.getMaxscale()); |
102 |
System.err.println("MinScale: " + l.getMinscale()); |
103 |
//System.err.println("MaxX: " + l.getMaxX());
|
104 |
//System.err.println("MaxY: " + l.getMaxY());
|
105 |
//System.err.println("MinX: " + l.getMinX());
|
106 |
if (l.getLayers() == null){ |
107 |
System.err.println("Grouped?: falso"); |
108 |
}else{
|
109 |
System.err.println("Grouped?: verdadero"); |
110 |
ILayerInfo[] group = l.getLayers();
|
111 |
for(int i= 0; i < group.length; i++ ){ |
112 |
printLayerInfo(group[i]); |
113 |
} |
114 |
} |
115 |
|
116 |
|
117 |
} |
118 |
/**
|
119 |
* test getDataSource
|
120 |
*
|
121 |
public void test_getDataSource(){
|
122 |
//ECW
|
123 |
FLayer lyr = util.getLayerECW();
|
124 |
DefaultLayerInfo lyrInf= new DefaultLayerInfo(lyr);
|
125 |
lyrInf.getDataSource();
|
126 |
//PostGIS
|
127 |
lyr = util.getLayerPostGIS();
|
128 |
lyrInf = new DefaultLayerInfo(lyr);
|
129 |
lyrInf.getDataSource();
|
130 |
}*/
|
131 |
|
132 |
/**
|
133 |
* test getDataSource: nested layers
|
134 |
*
|
135 |
public void test_getDataSource2(){
|
136 |
this.gvView = util.getGroupView();
|
137 |
//creates a instance to get view information
|
138 |
this.viewInfo = InfoFactory.getViewInfo(gvView);
|
139 |
//query all layers
|
140 |
for (int i = 0; i < this.viewInfo.getLayers().length; i++){
|
141 |
this.viewInfo.getLayers()[i].getDataSource();
|
142 |
}
|
143 |
}*/
|
144 |
|
145 |
} |