Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap / src-test / org / gvsig / fmap / mapcontext / rendering / TestCartographicSupportForSymbol.java @ 21156

History | View | Annotate | Download (19 KB)

1
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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 Ib��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.fmap.mapcontext.rendering;
42

    
43
import java.awt.Dimension;
44
import java.awt.geom.Rectangle2D;
45
import java.util.ArrayList;
46
import java.util.Random;
47

    
48
import junit.framework.TestCase;
49

    
50
import org.gvsig.fmap.AllTests;
51
import org.gvsig.fmap.geom.primitive.Point2D;
52
import org.gvsig.fmap.mapcontext.MapContext;
53
import org.gvsig.fmap.mapcontext.ViewPort;
54
import org.gvsig.fmap.mapcontext.rendering.symbol.AbstractSymbolTestCase;
55
import org.gvsig.fmap.mapcontext.rendering.symbol.SimpleFillSymbolTest;
56
import org.gvsig.fmap.mapcontext.rendering.symbol.SimpleLineSymbolTest;
57
import org.gvsig.fmap.mapcontext.rendering.symbol.SimpleMarkerSymbolTest;
58
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport;
59
import org.gvsig.fmap.mapcontext.rendering.symbols.IFillSymbol;
60
import org.gvsig.fmap.mapcontext.rendering.symbols.ILineSymbol;
61
import org.gvsig.fmap.mapcontext.rendering.symbols.IMarkerSymbol;
62
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
63
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbologyFactory;
64

    
65
import com.iver.utiles.IPersistence;
66
import com.iver.utiles.NotExistInXMLEntity;
67
import com.iver.utiles.XMLEntity;
68

    
69
/**
70
 *
71
 * @author jaume dominguez faus - jaume.dominguez@iver.es
72
 */
73
public class TestCartographicSupportForSymbol extends TestCase {
74
        /**
75
         * Geodesic vertex of the Micalet in Valencia (Spain) in <b>EPSG:23030</b>
76
         */
77
        public static final Point2D valenciaUTM30 = new Point2D(725846.080, 4373022.720);
78

    
79
        /**
80
         * Geodesic vertex of the Micalet in Valencia (Spain) in <b>EPSG:4326</b>
81
         */
82
        public static final Point2D valenciaGeo = new Point2D(- (0+ 22/60 +  27.919/3600), 39 + 28/60 + 35.4276/3600);
83
        /**
84
         * Extent that covers the whole Comunitat Valenciana in  <b>EPSG:23030</b>
85
         */
86
        public static final Rectangle2D TEST_UTM30_EXTENT = new Rectangle2D.Double();
87
        {
88
                TEST_UTM30_EXTENT.setFrameFromDiagonal(
89
                                4191037.369934333,
90
                                626674.7454557443,
91

    
92
                                4519266.460824658,
93
                                797903.2656794232
94
                );
95
        }
96
        /**
97
         * Extent that covers the whole Comunitat Valenciana in  <b>EPSG:4326</b>
98
         */
99

    
100
        public static final Rectangle2D TEST_GEO_EXTENT = new Rectangle2D.Double();
101
        {
102
                TEST_GEO_EXTENT.setFrameFromDiagonal(
103

    
104
                                -  (1 + (31/60) + (28.09/3600)),        // Western egde
105
                                37 + (50/60) + (48.05/3600),                // Southern edge
106

    
107
                                0 + (31/60) + (1.85/3600),                // Eastern edge
108
                                40 + (47/60) + (21.36/3600)                // Northern edge
109

    
110
                );
111
        }
112

    
113
        public static final Rectangle2D TEST_EXTENT = new Rectangle2D.Double(
114
                        4191037.369934333,
115
                        626674.7454557443,
116

    
117
                        4519266.460824658 - 4191037.369934333,
118
                        797903.2656794232 -  626674.7454557443
119
        );
120
        private static ArrayList<AbstractSymbolTestCase> symbolsToTest;
121
        private ArrayList<CartographicSupport> csSymbols;
122

    
123
        /**
124
         * Acceptable pixel tolerance error. 1 pixel of error is accetable since it is probably due to
125
         * the java.awt.Graphics
126
         */
127
        private static final double TOL = 1;
128

    
129
        double zooms[] = new double[] {
130
                        1,
131
                        2,
132
                        1.2,
133
                        10,
134
                        0.5
135
        };
136

    
137

    
138

    
139
        public void setUp() {
140
                addSymbolTest(new SimpleFillSymbolTest());
141
                addSymbolTest(new SimpleLineSymbolTest());
142
                addSymbolTest(new SimpleMarkerSymbolTest());
143

    
144
                init();
145
        }
146

    
147
        protected void init() {
148

    
149
                // take the symbols added to the TestISymbol test
150
                ISymbol[] symbols = getNewSymbolInstances();
151

    
152
                csSymbols = new ArrayList<CartographicSupport>();
153
                for (int i = 0; i < symbols.length; i++) {
154
                        if (symbols[i] instanceof CartographicSupport) {
155
                                csSymbols.add((CartographicSupport) symbols[i]);
156
                        }
157
                }
158
        }
159

    
160
        public static void addSymbolTest(AbstractSymbolTestCase symbolTestClass) {
161
                if (symbolsToTest == null) symbolsToTest = new ArrayList<AbstractSymbolTestCase>();
162
                symbolsToTest.add(symbolTestClass);
163
        }
164

    
165
        public static ISymbol[] getNewSymbolInstances() {
166
                ISymbol[] symbols = new ISymbol[symbolsToTest.size()];
167
                for (int i = 0; i < symbols.length; i++) {
168
                        symbols[i] = symbolsToTest.get(i).newInstance();
169
                }
170
                return symbols;
171
        }
172

    
173

    
174
        public void testSymbolUnitDefinition() {
175
                for (int i = 0; i < csSymbols.size(); i++) {
176
                        CartographicSupport symbol = csSymbols.get(i);
177

    
178
                        int aRandomUnit = new Random().nextInt(7);
179

    
180

    
181
                        symbol.setUnit(aRandomUnit);
182
                        XMLEntity xml = ((IPersistence) symbol).getXMLEntity();
183
                        String name = symbol.getClass().getName().substring(
184
                                        symbol.getClass().getName().lastIndexOf('.')+1,
185
                                        symbol.getClass().getName().length());
186

    
187
                        try {
188
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not declare units correctly",
189
                                                symbol.getUnit() == xml.getIntProperty("unit"));
190
                        } catch (NotExistInXMLEntity neiXMLEx) {
191
                                fail(((ISymbol) symbol).getClassName()+ " does not declare field attribute in its XMLEntity");
192
                        }
193
                        symbol.setUnit(5);
194
                        try {
195
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not apply changes to symbol",symbol.getUnit()== 5);
196
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not declare units correctly",
197
                                                5 == ((IPersistence) symbol).getXMLEntity().getIntProperty("unit"));
198
                        } catch (NotExistInXMLEntity neiXMLEx) {
199
                                fail(((ISymbol) symbol).getClassName()+ " does not declare field attribute in its XMLEntity");
200
                        }
201

    
202
                        xml.putProperty("unit", 3);
203
                        ISymbol ts = SymbologyFactory.createSymbolFromXML(xml, xml.getStringProperty("desc"));
204
                        assertTrue("The application of the UNIT value to the XMLEntity didn't have any effect ("+name+")", ((CartographicSupport) ts).getUnit() == 3);
205
                }
206

    
207
        }
208

    
209

    
210
        public void testSymbolReferenceSystemDefinition() {
211
                for (int i = 0; i < csSymbols.size(); i++) {
212
                        CartographicSupport symbol = csSymbols.get(i);
213
                        XMLEntity xml = ((IPersistence) symbol).getXMLEntity();
214
                        String name = symbol.getClass().getName().substring(
215
                                        symbol.getClass().getName().lastIndexOf('.')+1,
216
                                        symbol.getClass().getName().length());
217
                        try {
218
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not declare units correctly",
219
                                                symbol.getReferenceSystem() == xml.getIntProperty("referenceSystem"));
220
                        } catch (NotExistInXMLEntity neiXMLEx) {
221
                                fail(((ISymbol) symbol).getClassName()+ " does not declare referenceSystem field attribute in its XMLEntity");
222
                        }
223
                        symbol.setReferenceSystem(CartographicSupport.PAPER);
224
                        try {
225
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not apply changes to symbol",symbol.getReferenceSystem()== CartographicSupport.PAPER);
226
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not declare referenceSystem correctly",
227
                                                CartographicSupport.PAPER == ((IPersistence) symbol).getXMLEntity().getIntProperty("referenceSystem"));
228
                        } catch (NotExistInXMLEntity neiXMLEx) {
229
                                fail(((ISymbol) symbol).getClassName()+ " does not declare referenceSystem field attribute in its XMLEntity ("+name+")");
230
                        }
231

    
232
                        symbol.setReferenceSystem(CartographicSupport.WORLD);
233
                        try {
234
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not apply changes to symbol",symbol.getReferenceSystem()== CartographicSupport.WORLD);
235
                                assertTrue( ((ISymbol) symbol).getClassName()+" does not declare referenceSystem correctly",
236
                                                CartographicSupport.WORLD == ((IPersistence) symbol).getXMLEntity().getIntProperty("referenceSystem"));
237
                        } catch (NotExistInXMLEntity neiXMLEx) {
238
                                fail(((ISymbol) symbol).getClassName()+ " does not declare referenceSystem field attribute in its XMLEntity");
239
                        }
240

    
241
                        xml.putProperty("referenceSystem", CartographicSupport.PAPER);
242
                        ISymbol ts = SymbologyFactory.createSymbolFromXML(xml, xml.getStringProperty("desc"));
243
                        assertTrue("The application of the REFERENCE SYSTEM value to the XMLEntity didn't have any effect ("+name+")", ((CartographicSupport) ts).getReferenceSystem() == CartographicSupport.PAPER);
244
                }
245
        }
246

    
247

    
248
        public void testDegreesUnits_MapReferenceSystem() {
249
                for (int j = 0; j < csSymbols.size(); j++) {
250
                        CartographicSupport symbol = csSymbols.get(j);
251

    
252
                        MapContext mc = AllTests.newMapContext(AllTests.TEST_DEFAULT_PROJECTION);
253
                        ViewPort viewPort = mc.getViewPort();
254

    
255
                        int unit = 8;
256
                        Dimension dim = new Dimension(600, 600);
257
                        viewPort.setImageSize(dim);
258

    
259

    
260
                        /*
261
                         * will test with several extents but in the same map image size, so
262
                         * the scale issue is exercised as well.
263
                         */
264
                        for (int i = 0; i < zooms.length; i++) {
265
                                Rectangle2D extent = new Rectangle2D.Double(-30, -30, dim.getWidth()/zooms[i], dim.getHeight()/zooms[i]);
266

    
267
                                viewPort.setMapUnits(unit);
268
                                viewPort.setExtent(extent);
269

    
270

    
271
                                String name = ((IPersistence) symbol).getClassName().substring(
272
                                                ((IPersistence) symbol).getClassName().lastIndexOf('.')+1,
273
                                                ((IPersistence) symbol).getClassName().length());
274

    
275
                                CartographicSupport csSym = (CartographicSupport) symbol;
276
                                csSym.setReferenceSystem(CartographicSupport.WORLD);
277
                                double size = 30;
278

    
279
                                csSym.setUnit(unit);
280

    
281

    
282

    
283
                                if (symbol instanceof IMarkerSymbol) {
284

    
285
                                        IMarkerSymbol markerSym = (IMarkerSymbol) symbol;
286
                                        markerSym.setSize(size);
287
                                        csSym.toCartographicSize(
288
                                                        viewPort,
289
                                                        MapContext.getScreenDPI(),
290
                                                        new Point2D(
291
                                                                        viewPort.getAdjustedExtent().getCenterX(),
292
                                                                        viewPort.getAdjustedExtent().getCenterY()
293
                                                        )
294
                                        );
295
                                        double mySize = markerSym.getSize();
296
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
297
                                                        "It returned "+markerSym.getSize()+" when expecting "+
298
                                                        size+"*"+zooms[i]+"="+size*zooms[i],  Math.abs(mySize-size*zooms[i]) <= TOL );
299
                                }
300

    
301
                                if (symbol instanceof ILineSymbol) {
302

    
303
                                        ILineSymbol lineSym = (ILineSymbol) symbol;
304
                                        lineSym.setLineWidth(size);
305
                                        csSym.toCartographicSize(
306
                                                        viewPort,
307
                                                        MapContext.getScreenDPI(),
308
                                                        new Point2D(
309
                                                                        viewPort.getAdjustedExtent().getCenterX(),
310
                                                                        viewPort.getAdjustedExtent().getCenterY()
311
                                                        )
312
                                        );
313
                                        double mySize = lineSym.getLineStyle().getLineWidth();
314
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
315
                                                        "It returned "+mySize+" when expecting "+
316
                                                        size+"*"+zooms[i]+"="+size*zooms[i], Math.abs(mySize-size*zooms[i]) <= TOL );
317
                                }
318

    
319
                                if (symbol instanceof IFillSymbol) {
320
                                        // this tests if symbol applies the cartographic support to its
321
                                        // outline, since is the only thing that may be resized
322
                                        IFillSymbol fillSym = (IFillSymbol) symbol;
323
                                        if (fillSym.getOutline() == null) {
324
                                                fillSym.setOutline(SymbologyFactory.createDefaultLineSymbol());
325
                                        }
326

    
327
                                        fillSym.getOutline().setLineWidth(size);
328

    
329
                                        csSym.toCartographicSize(
330
                                                        viewPort,
331
                                                        MapContext.getScreenDPI(),
332
                                                        new Point2D(
333
                                                                        viewPort.getAdjustedExtent().getCenterX(),
334
                                                                        viewPort.getAdjustedExtent().getCenterY()
335
                                                        )
336
                                        );
337
                                        double mySize = fillSym.getOutline().getLineStyle().getLineWidth();
338
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
339
                                                        "It returned "+fillSym.getOutline().getLineWidth()+" when expecting "+
340
                                                        size+"*"+zooms[i]+"="+size*zooms[i], Math.abs(mySize-size*zooms[i]) <= TOL );
341
                                }
342

    
343
                        }
344
                }
345
        }
346

    
347

    
348
        public void testKilometersUnits_MapReferenceSystem() {
349
                for (int j = 0; j < csSymbols.size(); j++) {
350
                        CartographicSupport symbol = csSymbols.get(j);
351
                        MapContext mc = AllTests.newMapContext(AllTests.TEST_DEFAULT_MERCATOR_PROJECTION);
352
                        ViewPort viewPort = mc.getViewPort();
353

    
354
                        int unit = 0;
355
                        Dimension dim = new Dimension(60, 60);
356
                        viewPort.setImageSize(dim);
357

    
358

    
359
                        /*
360
                         * will test with several extents but in the same map image size, so
361
                         * the scale issue is exercised as well.
362
                         */
363
                        for (int i = 0; i < zooms.length; i++) {
364
                                Rectangle2D extent = new Rectangle2D.Double(-30, -30, dim.getWidth()/zooms[i], dim.getHeight()/zooms[i]);
365

    
366
                                viewPort.setMapUnits(unit);
367
                                viewPort.setExtent(extent);
368

    
369

    
370
                                String name = ((IPersistence) symbol).getClassName().substring(
371
                                                ((IPersistence) symbol).getClassName().lastIndexOf('.')+1,
372
                                                ((IPersistence) symbol).getClassName().length());
373

    
374
                                CartographicSupport csSym = (CartographicSupport) symbol;
375
                                csSym.setReferenceSystem(CartographicSupport.WORLD);
376
                                double size = 30;
377

    
378
                                csSym.setUnit(unit);
379

    
380

    
381

    
382

    
383
                                if (symbol instanceof IMarkerSymbol) {
384

    
385
                                        IMarkerSymbol markerSym = (IMarkerSymbol) symbol;
386
                                        markerSym.setSize(size);
387
                                        csSym.toCartographicSize(
388
                                                        viewPort,
389
                                                        MapContext.getScreenDPI(),
390
                                                        new Point2D(
391
                                                                        viewPort.getAdjustedExtent().getCenterX(),
392
                                                                        viewPort.getAdjustedExtent().getCenterY()
393
                                                        )
394
                                        );
395
                                        double mySize = markerSym.getSize();
396
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
397
                                                        "It returned "+markerSym.getSize()+" when expecting "+
398
                                                        size+"*"+zooms[i]+"="+size*zooms[i],  Math.abs(mySize-size*zooms[i]) <= TOL );
399
                                }
400

    
401
                                if (symbol instanceof ILineSymbol) {
402

    
403
                                        ILineSymbol lineSym = (ILineSymbol) symbol;
404
                                        lineSym.setLineWidth(size);
405
                                        csSym.toCartographicSize(
406
                                                        viewPort,
407
                                                        MapContext.getScreenDPI(),
408
                                                        new Point2D(
409
                                                                        viewPort.getAdjustedExtent().getCenterX(),
410
                                                                        viewPort.getAdjustedExtent().getCenterY()
411
                                                        )
412
                                        );
413
                                        double mySize = lineSym.getLineStyle().getLineWidth();
414
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
415
                                                        "It returned "+lineSym.getLineWidth()+" when expecting "+
416
                                                        size+"*"+zooms[i]+"="+size*zooms[i], Math.abs(mySize-size*zooms[i]) <= TOL );
417
                                }
418

    
419
                                if (symbol instanceof IFillSymbol) {
420
                                        // this tests if symbol applies the cartographic support to its
421
                                        // outline, since is the only thing that may be resized
422
                                        IFillSymbol fillSym = (IFillSymbol) symbol;
423
                                        if (fillSym.getOutline() == null) {
424
                                                fillSym.setOutline(SymbologyFactory.createDefaultLineSymbol());
425
                                        }
426

    
427
                                        fillSym.getOutline().setLineWidth(size);
428

    
429
                                        csSym.toCartographicSize(
430
                                                        viewPort,
431
                                                        MapContext.getScreenDPI(),
432
                                                        new Point2D(
433
                                                                        viewPort.getAdjustedExtent().getCenterX(),
434
                                                                        viewPort.getAdjustedExtent().getCenterY()
435
                                                        )
436
                                        );
437
                                        double mySize = fillSym.getOutline().getLineStyle().getLineWidth();
438
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
439
                                                        "It returned "+fillSym.getOutline().getLineWidth()+" when expecting "+
440
                                                        size+"*"+zooms[i]+"="+size*zooms[i], Math.abs(mySize-size*zooms[i]) <= TOL );
441
                                }
442

    
443
                        }
444
                }
445

    
446
        }
447

    
448
        public void testMapInKilometersSymbolInMeters_MapReferenceSystem() {
449
                for (int j = 0; j < csSymbols.size(); j++) {
450
                        CartographicSupport symbol = csSymbols.get(j);
451

    
452
                        MapContext mc = AllTests.newMapContext(AllTests.TEST_DEFAULT_MERCATOR_PROJECTION);
453
                        ViewPort viewPort = mc.getViewPort();
454

    
455
                        int mapUnit = 0;
456
                        int symbolUnit = 1;
457
                        Dimension dim = new Dimension(60, 60);
458
                        viewPort.setImageSize(dim);
459

    
460

    
461
                        /*
462
                         * will test with several extents but in the same map image size, so
463
                         * the scale issue is exercised as well.
464
                         */
465
                        for (int i = 0; i < zooms.length; i++) {
466
                                Rectangle2D extent = new Rectangle2D.Double(-30, -30, dim.getWidth()/zooms[i], dim.getHeight()/zooms[i]);
467

    
468
                                viewPort.setMapUnits(mapUnit);
469
                                viewPort.setExtent(extent);
470
                                double size = 30;
471

    
472

    
473
                                String name = ((IPersistence) symbol).getClassName().substring(
474
                                                ((IPersistence) symbol).getClassName().lastIndexOf('.')+1,
475
                                                ((IPersistence) symbol).getClassName().length());
476

    
477

    
478
                                CartographicSupport csSym = (CartographicSupport) symbol;
479
                                csSym.setReferenceSystem(CartographicSupport.WORLD);
480

    
481
                                csSym.setUnit(symbolUnit);
482

    
483
                                if (symbol instanceof IMarkerSymbol) {
484

    
485
                                        IMarkerSymbol markerSym = (IMarkerSymbol) symbol;
486
                                        markerSym.setSize(size*MapContext.CHANGEM[mapUnit]); // 30m*1000 = 30 km
487
                                        csSym.toCartographicSize(
488
                                                        viewPort,
489
                                                        MapContext.getScreenDPI(),
490
                                                        new Point2D(
491
                                                                        viewPort.getAdjustedExtent().getCenterX(),
492
                                                                        viewPort.getAdjustedExtent().getCenterY()
493
                                                        )
494
                                        );
495
                                        double mySize = markerSym.getSize();
496
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
497
                                                        "It returned "+markerSym.getSize()+" when expecting "+
498
                                                        size+"*"+zooms[i]+"="+size*zooms[i],  Math.abs(mySize-size*zooms[i]) <= TOL );
499
                                }
500

    
501
                                if (symbol instanceof ILineSymbol) {
502

    
503
                                        ILineSymbol lineSym = (ILineSymbol) symbol;
504
                                        lineSym.setLineWidth(size*MapContext.CHANGEM[mapUnit]); // 30m*1000 = 30 km
505
                                        csSym.toCartographicSize(
506
                                                        viewPort,
507
                                                        MapContext.getScreenDPI(),
508
                                                        new Point2D(
509
                                                                        viewPort.getAdjustedExtent().getCenterX(),
510
                                                                        viewPort.getAdjustedExtent().getCenterY()
511
                                                        )
512
                                        );
513
                                        double mySize = lineSym.getLineStyle().getLineWidth();
514
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
515
                                                        "It returned "+lineSym.getLineWidth()+" when expecting "+
516
                                                        size+"*"+zooms[i]+"="+size*zooms[i], Math.abs(mySize-size*zooms[i]) <= TOL );
517
                                }
518

    
519
                                if (symbol instanceof IFillSymbol) {
520
                                        // this tests if symbol applies the cartographic support to its
521
                                        // outline, since is the only thing that may be resized
522
                                        IFillSymbol fillSym = (IFillSymbol) symbol;
523
                                        if (fillSym.getOutline() == null) {
524
                                                fillSym.setOutline(SymbologyFactory.createDefaultLineSymbol());
525
                                        }
526

    
527
                                        fillSym.getOutline().setLineWidth(size*MapContext.CHANGEM[mapUnit]);
528

    
529
                                        csSym.toCartographicSize(
530
                                                        viewPort,
531
                                                        MapContext.getScreenDPI(),
532
                                                        new Point2D(
533
                                                                        viewPort.getAdjustedExtent().getCenterX(),
534
                                                                        viewPort.getAdjustedExtent().getCenterY()
535
                                                        )
536
                                        );
537
                                        double mySize = fillSym.getOutline().getLineStyle().getLineWidth();
538
                                        assertTrue("The Symbol '"+name+"' failed computing cartographic size. " +
539
                                                        "It returned "+fillSym.getOutline().getLineWidth()+" when expecting "+
540
                                                        size+"*"+zooms[i]+"="+size*zooms[i], Math.abs(mySize-size*zooms[i]) <= TOL );
541
                                }
542

    
543
                        }
544
                }
545
        }
546

    
547
}