root / trunk / extensions / extPublish / src-test / org / gvsig / publish / infoproject / LayerInfoTest.java @ 29308
History | View | Annotate | Download (3.69 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.infoproject.gvsig19.ViewInfo; |
46 |
import org.gvsig.publish.util.LocalResourcesTestUtilities; |
47 |
|
48 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
49 |
|
50 |
public class LayerInfoTest extends TestCase { |
51 |
//gvSIG ProjectView
|
52 |
private ProjectView gvView = null; |
53 |
//information about the view to publish
|
54 |
private IViewInfo viewInfo = null; |
55 |
//get Resources from gvSIG like layers, views, ...
|
56 |
private LocalResourcesTestUtilities util = null; |
57 |
|
58 |
protected void setUp() throws Exception { |
59 |
super.setUp();
|
60 |
//gets a new view from the utilities
|
61 |
util = new LocalResourcesTestUtilities();
|
62 |
|
63 |
//creates a database
|
64 |
//util.createDBPostGIS();
|
65 |
} |
66 |
|
67 |
protected void tearDown() throws Exception { |
68 |
super.tearDown();
|
69 |
//util.dropDBPostGIS();
|
70 |
} |
71 |
|
72 |
/**
|
73 |
* test simple shapes layers
|
74 |
*/
|
75 |
public void test_simpleLayer(){ |
76 |
gvView = util.getView_shape(); |
77 |
viewInfo = new ViewInfo(gvView,null); |
78 |
for (int i = 0; i < this.viewInfo.getLayers().length; i++){ |
79 |
System.err.println("Layer " + i + " --------------"); |
80 |
print(this.viewInfo.getLayers()[i]);
|
81 |
} |
82 |
} |
83 |
/**
|
84 |
* test a grouped layer with shapes and raster
|
85 |
*/
|
86 |
public void test_groupedLayer(){ |
87 |
gvView = util.getView_group(); |
88 |
viewInfo = new ViewInfo(gvView,null); |
89 |
System.err.println("====================================="); |
90 |
for (int i = 0; i < this.viewInfo.getLayers().length; i++){ |
91 |
System.err.println("Layer " + i + " --------------"); |
92 |
print(this.viewInfo.getLayers()[i]);
|
93 |
} |
94 |
} |
95 |
/**
|
96 |
* TODO: print legend, datasourceinfo, ...
|
97 |
* @param l
|
98 |
*/
|
99 |
public static void print(ILayerInfo l){ |
100 |
System.out.println("\t\t ------ TESTING LAYER INFO ---------"); |
101 |
System.err.println("\t\tPath: " + l.getPathString()); |
102 |
System.err.println("\t\tName: " + l.getName()); |
103 |
System.err.println("\t\tTitle: " + l.getTitle()); |
104 |
System.err.println("\t\tMaxScale: " + l.getMaxscale()); |
105 |
System.err.println("\t\tMinScale: " + l.getMinscale()); |
106 |
System.err.println("\t\tMaxX: " + l.getBBox().getMaxX()); |
107 |
System.err.println("\t\tMaxY: " + l.getBBox().getMaxY()); |
108 |
System.err.println("\t\tMinX: " + l.getBBox().getMinX()); |
109 |
System.err.println("\t\tMinY: " + l.getBBox().getMinY()); |
110 |
System.err.println("\t\tSRID: " + l.getSRID()); |
111 |
if (l.getChilds() == null){ |
112 |
System.err.println("\t\tGrouped?: falso"); |
113 |
}else{
|
114 |
System.err.println("\t\tGrouped?: verdadero"); |
115 |
ILayerInfo[] group = l.getChilds();
|
116 |
for(int i= 0; i < group.length; i++ ){ |
117 |
print(group[i]); |
118 |
} |
119 |
} |
120 |
|
121 |
|
122 |
} |
123 |
|
124 |
} |