Revision 22886

View differences:

trunk/extensions/extTopology/src-test/com/iver/cit/gvsig/referencing/VectorialReferencingPanelTest.java
1
/*
2
 * Created on 10-abr-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: 
47
* $Log: 
48
*/
49
package com.iver.cit.gvsig.referencing;
50

  
51
import java.awt.Graphics2D;
52
import java.awt.Image;
53
import java.awt.geom.Point2D;
54
import java.awt.geom.Rectangle2D;
55
import java.awt.image.BufferedImage;
56
import java.net.URI;
57
import java.util.List;
58
import java.util.Map;
59

  
60
import javax.print.attribute.PrintRequestAttributeSet;
61
import javax.swing.ImageIcon;
62

  
63
import org.cresques.cts.ICoordTrans;
64
import org.cresques.cts.IProjection;
65
import org.gvsig.exceptions.BaseException;
66

  
67
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
68
import com.iver.cit.gvsig.exceptions.expansionfile.ExpansionFileReadException;
69
import com.iver.cit.gvsig.exceptions.layers.LoadLayerException;
70
import com.iver.cit.gvsig.exceptions.layers.ReloadLayerException;
71
import com.iver.cit.gvsig.exceptions.layers.StartEditionLayerException;
72
import com.iver.cit.gvsig.fmap.MapContext;
73
import com.iver.cit.gvsig.fmap.ViewPort;
74
import com.iver.cit.gvsig.fmap.layers.AbstractLinkProperties;
75
import com.iver.cit.gvsig.fmap.layers.FLayer;
76
import com.iver.cit.gvsig.fmap.layers.FLayerStatus;
77
import com.iver.cit.gvsig.fmap.layers.FLayers;
78
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
79
import com.iver.cit.gvsig.fmap.layers.LayerListener;
80
import com.iver.cit.gvsig.fmap.layers.XMLException;
81
import com.iver.cit.gvsig.fmap.layers.layerOperations.ComposedLayer;
82
import com.iver.utiles.XMLEntity;
83
import com.iver.utiles.swing.threads.Cancellable;
84

  
85
import junit.framework.TestCase;
86

  
87
public class VectorialReferencingPanelTest extends TestCase {
88
	public void testPanel(){
89
javax.swing.JFrame f = new javax.swing.JFrame();
90
		
91
		FLayers lyrs = new FLayers();
92
		lyrs.addLayer(new FLyrVect(){
93

  
94
			public void addError(BaseException exception) {
95
				// TODO Auto-generated method stub
96
				
97
			}
98

  
99
			public boolean addLayerListener(LayerListener o) {
100
				// TODO Auto-generated method stub
101
				return false;
102
			}
103

  
104
			public boolean allowLinks() {
105
				// TODO Auto-generated method stub
106
				return false;
107
			}
108

  
109
			public FLayer cloneLayer() throws Exception {
110
				// TODO Auto-generated method stub
111
				return null;
112
			}
113

  
114
			public void draw(BufferedImage image, Graphics2D g,
115
					ViewPort viewPort, Cancellable cancel, double scale)
116
					throws ReadDriverException {
117
				// TODO Auto-generated method stub
118
				
119
			}
120

  
121
			public BufferedImage getCacheImageDrawnLayers() {
122
				// TODO Auto-generated method stub
123
				return null;
124
			}
125

  
126
			public ICoordTrans getCoordTrans() {
127
				// TODO Auto-generated method stub
128
				return null;
129
			}
130

  
131
			public BaseException getError(int i) {
132
				// TODO Auto-generated method stub
133
				return null;
134
			}
135

  
136
			public List getErrors() {
137
				// TODO Auto-generated method stub
138
				return null;
139
			}
140

  
141
			public Map getExtendedProperties() {
142
				// TODO Auto-generated method stub
143
				return null;
144
			}
145

  
146
			public FLayerStatus getFLayerStatus() {
147
				// TODO Auto-generated method stub
148
				return null;
149
			}
150

  
151
			public Rectangle2D getFullExtent() throws ReadDriverException,
152
					ExpansionFileReadException {
153
				// TODO Auto-generated method stub
154
				return null;
155
			}
156

  
157
			public String getInfoString() {
158
				// TODO Auto-generated method stub
159
				return null;
160
			}
161

  
162
			public LayerListener[] getLayerListeners() {
163
				// TODO Auto-generated method stub
164
				return null;
165
			}
166

  
167
			public URI[] getLink(Point2D point, double tolerance) {
168
				// TODO Auto-generated method stub
169
				return null;
170
			}
171

  
172
			public AbstractLinkProperties getLinkProperties() {
173
				// TODO Auto-generated method stub
174
				return null;
175
			}
176

  
177
			public MapContext getMapContext() {
178
				// TODO Auto-generated method stub
179
				return null;
180
			}
181

  
182
			public double getMaxScale() {
183
				// TODO Auto-generated method stub
184
				return 0;
185
			}
186

  
187
			public double getMinScale() {
188
				// TODO Auto-generated method stub
189
				return 0;
190
			}
191

  
192
			public String getName() {
193
				// TODO Auto-generated method stub
194
				return "kk";
195
			}
196

  
197
			public int getNumErrors() {
198
				// TODO Auto-generated method stub
199
				return 0;
200
			}
201

  
202
			public FLayers getParentLayer() {
203
				// TODO Auto-generated method stub
204
				return null;
205
			}
206

  
207
			public Object getProperty(Object key) {
208
				// TODO Auto-generated method stub
209
				return null;
210
			}
211

  
212
			public ImageIcon getTocImageIcon() {
213
				// TODO Auto-generated method stub
214
				return null;
215
			}
216

  
217
			public Image getTocStatusImage() {
218
				// TODO Auto-generated method stub
219
				return null;
220
			}
221

  
222
			public XMLEntity getXMLEntity() throws XMLException {
223
				// TODO Auto-generated method stub
224
				return null;
225
			}
226

  
227
			public boolean isActive() {
228
				// TODO Auto-generated method stub
229
				return false;
230
			}
231

  
232
			public boolean isAvailable() {
233
				// TODO Auto-generated method stub
234
				return false;
235
			}
236

  
237
			public boolean isCachingDrawnLayers() {
238
				// TODO Auto-generated method stub
239
				return false;
240
			}
241

  
242
			public boolean isDirty() {
243
				// TODO Auto-generated method stub
244
				return false;
245
			}
246

  
247
			public boolean isEditing() {
248
				// TODO Auto-generated method stub
249
				return false;
250
			}
251

  
252
			public boolean isInTOC() {
253
				// TODO Auto-generated method stub
254
				return false;
255
			}
256

  
257
			public boolean isOk() {
258
				// TODO Auto-generated method stub
259
				return false;
260
			}
261

  
262
			public boolean isVisible() {
263
				// TODO Auto-generated method stub
264
				return false;
265
			}
266

  
267
			public boolean isWithinScale(double scale) {
268
				// TODO Auto-generated method stub
269
				return false;
270
			}
271

  
272
			public boolean isWritable() {
273
				// TODO Auto-generated method stub
274
				return false;
275
			}
276

  
277
			public void load() throws LoadLayerException {
278
				// TODO Auto-generated method stub
279
				
280
			}
281

  
282
			public ComposedLayer newComposedLayer() {
283
				// TODO Auto-generated method stub
284
				return null;
285
			}
286

  
287
			public void print(Graphics2D g, ViewPort viewPort,
288
					Cancellable cancel, double scale,
289
					PrintRequestAttributeSet properties)
290
					throws ReadDriverException {
291
				// TODO Auto-generated method stub
292
				
293
			}
294

  
295
			public void reload() throws ReloadLayerException {
296
				// TODO Auto-generated method stub
297
				
298
			}
299

  
300
			public boolean removeLayerListener(LayerListener o) {
301
				// TODO Auto-generated method stub
302
				return false;
303
			}
304

  
305
			public void setActive(boolean selected) {
306
				// TODO Auto-generated method stub
307
				
308
			}
309

  
310
			public void setAvailable(boolean available) {
311
				// TODO Auto-generated method stub
312
				
313
			}
314

  
315
			public void setCacheImageDrawnLayers(
316
					BufferedImage cacheImageDrawnLayers) {
317
				// TODO Auto-generated method stub
318
				
319
			}
320

  
321
			public void setCachingDrawnLayers(boolean cacheDrawnLayers) {
322
				// TODO Auto-generated method stub
323
				
324
			}
325

  
326
			public void setCoordTrans(ICoordTrans ct) {
327
				// TODO Auto-generated method stub
328
				
329
			}
330

  
331
			public void setDirty(boolean dirty) {
332
				// TODO Auto-generated method stub
333
				
334
			}
335

  
336
			public void setEditing(boolean b) throws StartEditionLayerException {
337
				// TODO Auto-generated method stub
338
				
339
			}
340

  
341
			public void setFLayerStatus(FLayerStatus status) {
342
				// TODO Auto-generated method stub
343
				
344
			}
345

  
346
			public void setInTOC(boolean b) {
347
				// TODO Auto-generated method stub
348
				
349
			}
350

  
351
			public void setMaxScale(double maxScale) {
352
				// TODO Auto-generated method stub
353
				
354
			}
355

  
356
			public void setMinScale(double minScale) {
357
				// TODO Auto-generated method stub
358
				
359
			}
360

  
361
			public void setName(String name) {
362
				// TODO Auto-generated method stub
363
				
364
			}
365

  
366
			public void setParentLayer(FLayers root) {
367
				// TODO Auto-generated method stub
368
				
369
			}
370

  
371
			public void setProperty(Object key, Object obj) {
372
				// TODO Auto-generated method stub
373
				
374
			}
375

  
376
			public void setVisible(boolean visibility) {
377
				// TODO Auto-generated method stub
378
				
379
			}
380

  
381
			public void setXMLEntity(XMLEntity xml) throws XMLException {
382
				// TODO Auto-generated method stub
383
				
384
			}
385

  
386
			public void setXMLEntity03(XMLEntity xml) throws XMLException {
387
				// TODO Auto-generated method stub
388
				
389
			}
390

  
391
			public boolean visibleRequired() {
392
				// TODO Auto-generated method stub
393
				return false;
394
			}
395

  
396
			public IProjection getProjection() {
397
				// TODO Auto-generated method stub
398
				return null;
399
			}
400

  
401
			public void reProject(ICoordTrans ct) {
402
				// TODO Auto-generated method stub
403
				
404
			}});
405
		
406
		
407
		
408
//		VectorialReferencingPanel panel = new VectorialReferencingPanel(lyrs);
409
//		f.getContentPane().add(panel);
410
//		
411
//		f.setSize(600, 600);
412
//		
413
//		f.setVisible(true);
414
	}
415
}
trunk/extensions/extTopology/src-test/com/iver/cit/gvsig/referencing/ReferencingUtilTest.java
1
/*
2
 * Created on 10-abr-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id: 
47
* $Log: 
48
*/
49
package com.iver.cit.gvsig.referencing;
50

  
51
import org.geotools.referencefork.geometry.GeneralDirectPosition;
52
import org.gvsig.referencing.ReferencingUtil;
53
import org.opengis.spatialschema.geometry.DirectPosition;
54

  
55
import junit.framework.TestCase;
56

  
57
public class ReferencingUtilTest extends TestCase {
58
	public void testTruncateMethod(){
59
		GeneralDirectPosition pos1 = new GeneralDirectPosition(new double[]{0,0,0});
60
		DirectPosition truncated = ReferencingUtil.getInstance().truncateOrShrinkDimension(pos1, 2);
61
		assertTrue(truncated.getDimension() == 2);
62
	}
63
}

Also available in: Unified diff