Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.symbology / org.gvsig.symbology.lib / org.gvsig.symbology.lib.impl / src / main / java / org / gvsig / symbology / fmap / mapcontext / rendering / legend / styling / AttrInTableLabelingStrategy.java @ 40560

History | View | Annotate | Download (20.2 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling;
25

    
26
import java.awt.Color;
27
import java.awt.Font;
28
import java.awt.Graphics2D;
29
import java.awt.image.BufferedImage;
30
import java.util.ArrayList;
31
import java.util.List;
32

    
33
import org.cresques.cts.ICoordTrans;
34
import org.cresques.cts.IProjection;
35
import org.slf4j.LoggerFactory;
36

    
37
import org.gvsig.compat.print.PrintAttributes;
38
import org.gvsig.fmap.dal.exception.DataException;
39
import org.gvsig.fmap.dal.exception.ReadException;
40
import org.gvsig.fmap.dal.feature.Feature;
41
import org.gvsig.fmap.dal.feature.FeatureQuery;
42
import org.gvsig.fmap.dal.feature.FeatureSet;
43
import org.gvsig.fmap.dal.feature.FeatureStore;
44
import org.gvsig.fmap.dal.feature.FeatureType;
45
import org.gvsig.fmap.geom.Geometry;
46
import org.gvsig.fmap.geom.exception.CreateGeometryException;
47
import org.gvsig.fmap.geom.operation.GeometryOperationException;
48
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
49
import org.gvsig.fmap.geom.primitive.Envelope;
50
import org.gvsig.fmap.geom.primitive.Point;
51
import org.gvsig.fmap.mapcontext.MapContext;
52
import org.gvsig.fmap.mapcontext.ViewPort;
53
import org.gvsig.fmap.mapcontext.layers.FLayer;
54
import org.gvsig.fmap.mapcontext.layers.vectorial.ContainsEnvelopeEvaluator;
55
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
56
import org.gvsig.fmap.mapcontext.layers.vectorial.IntersectsEnvelopeEvaluator;
57
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingMethod;
58
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
59
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IZoomConstraints;
60
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.impl.CartographicSupportToolkit;
61
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.impl.SimpleTextSymbol;
62
import org.gvsig.tools.ToolsLocator;
63
import org.gvsig.tools.dispose.DisposableIterator;
64
import org.gvsig.tools.dynobject.DynStruct;
65
import org.gvsig.tools.exception.BaseException;
66
import org.gvsig.tools.persistence.PersistenceManager;
67
import org.gvsig.tools.persistence.PersistentState;
68
import org.gvsig.tools.persistence.exception.PersistenceException;
69
import org.gvsig.tools.task.Cancellable;
70
import org.gvsig.tools.util.Callable;
71

    
72

    
73

    
74
/**
75
 * LabelingStrategy used when the user wants to use label sizes, rotations, etc. from
76
 * the values included in fields of the datasource's table
77
 *
78
 * @author jaume dominguez faus - jaume.dominguez@iver.es
79
 *
80
 */
81
public class AttrInTableLabelingStrategy implements IAttrInTableLabelingStrategy {
82
        private static final String FIELD_LABELING_METHOD = "labelingMethod";
83
        private static final String FIELD_ZOOM_CONSTRAINTS = "zoomConstraints";
84
        private static final String FIELD_COLOR_FONT = "colorFont";
85
        private static final String FIELD_REFERENCE_SYSTEM = "referenceSystem";
86
        private static final String FIELD_FIXED_COLOR = "fixedColor";
87
        private static final String FIELD_USE_FIXED_COLOR = "useFixedColor";
88
        private static final String FIELD_FIXED_SIZE = "fixedSize";
89
        private static final String FIELD_USE_FIXED_SIZE = "useFixedSize";
90
        private static final String FIELD_FONT = "font";
91
        private static final String FIELD_UNIT = "Unit";
92
        private static final String FIELD_ROTATION = "RotationField";
93
        private static final String FIELD_COLOR = "ColorField";
94
        private static final String FIELD_HEIGHT = "HeightField";
95
        private static final String FIELD_TEXT = "TextField";
96
        private static final org.slf4j.Logger logger = LoggerFactory.getLogger(AttrInTableLabelingStrategy.class);
97
        public static final double MIN_TEXT_SIZE = 3;
98
        private static final String ATTR_IN_TABLE_LABELING_STRATEGY_PERSISTENCE_DEFINITION_NAME =
99
                        "AttrInTableLabelingStrategy";
100
        private ILabelingMethod method = new DefaultLabelingMethod();
101
        private IZoomConstraints zoom;
102
        private FLyrVect layer;
103
//        private double unitFactor = 1D;
104
        private double fixedSize=10;
105
        private Color fixedColor;
106
        private int unit = -1; //(pixel)
107
        private boolean useFixedSize;
108
        private boolean useFixedColor;
109
        private int referenceSystem;
110
//        private boolean isPrinting;
111
        private String[] usedFields = null;
112
        private Font font;
113
        private Color colorFont;
114
        private String textFieldName;
115
        private String rotationFieldName;
116
        private String heightFieldName;
117
        private String colorFieldName;
118

    
119
        public ILabelingMethod getLabelingMethod() {
120
                return this.method;
121
        }
122

    
123
        public void setLabelingMethod(ILabelingMethod method) {
124
                this.method = method;
125
        }
126

    
127
        public IPlacementConstraints getPlacementConstraints() {
128
                return null; // (automatically handled by the driver)
129
        }
130

    
131
        public void setPlacementConstraints(IPlacementConstraints constraints) {
132
                // nothing
133
        }
134

    
135
        public IZoomConstraints getZoomConstraints() {
136
                return zoom;
137
        }
138

    
139
        public void setZoomConstraints(IZoomConstraints constraints) {
140
                this.zoom = constraints;
141
        }
142

    
143
        private void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
144
                        Cancellable cancel, PrintAttributes props) throws ReadException {
145
            
146
                double scale = viewPort.getScale();
147

    
148
                SimpleTextSymbol sym = new SimpleTextSymbol();
149

    
150
                sym.setFont(getFont());
151

    
152
                sym.setUnit(unit);
153
                sym.setReferenceSystem(referenceSystem);
154
                if (zoom==null ||
155
                        ( zoom.isUserDefined() && (scale >= zoom.getMaxScale())
156
                        && (scale <= zoom.getMinScale()) ) ) {
157
                        FeatureSet set = null;
158
                        DisposableIterator iterator = null;
159
                        try {
160
                                // limit the labeling to the visible extent
161
                                List<String> fields = new ArrayList<String>();
162
                                int heightPos =-1;
163
                                int rotationPos =-1;
164
                                int textPos = -1;
165
                                int colorPos = -1;
166

    
167
                                if (!this.usesFixedSize()) {
168
                                        if (getHeightField() != null) {
169
                                                heightPos = fields.size();
170
                                                fields.add(getHeightField());
171
                                        }
172
                                }
173
                                if (getRotationField() != null) {
174
                                        rotationPos = fields.size();
175
                                        fields.add(getRotationField());
176
                                }
177
                                if (getTextField() != null) {
178
                                        textPos = fields.size();
179
                                        fields.add(getTextField());
180
                                }
181

    
182
                                if (!this.usesFixedColor() && getColorField() != null) {
183
                                        colorPos = fields.size();
184
                                        fields.add(getColorField());
185
                                }
186

    
187
                                FeatureStore featureStore = layer.getFeatureStore();
188
                                ICoordTrans ct = layer.getCoordTrans();
189

    
190
                                String geomName = featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName();
191
                                fields.add(geomName);
192

    
193
                                if (viewPort.getAdjustedEnvelope().contains(
194
                                    layer.getFullEnvelope())) {
195
                                    /*
196
                                     * viewport contains layer completely
197
                                     */
198
                                    set = featureStore.getFeatureSet();
199
                                } else {
200
                                    /*
201
                                     * view port does not contain layer completely
202
                                     */
203
                        IntersectsEnvelopeEvaluator iee = null;
204
                        
205
                        IProjection data_proj = null;
206
                        Envelope env_in_store_crs = null;
207

    
208
                        if (ct == null) {
209
                            env_in_store_crs = viewPort.getAdjustedEnvelope();
210
                            data_proj = viewPort.getProjection();
211
                        } else {
212
                            env_in_store_crs = viewPort.getAdjustedEnvelope().convert(
213
                                ct.getInverted());
214
                            data_proj = ct.getPOrig();
215
                        }
216

    
217
                        iee = new IntersectsEnvelopeEvaluator(
218
                            env_in_store_crs,
219
                            data_proj,
220
                            featureStore.getDefaultFeatureType(),
221
                            geomName);
222
                        FeatureQuery featureQuery = featureStore.createFeatureQuery();
223
                        featureQuery.setAttributeNames((String[]) fields.toArray(new String[fields.size()]));
224
                        featureQuery.setFilter(iee);
225
                        set = featureStore.getFeatureSet(featureQuery);
226
                                }
227

    
228
                                /*
229
                                 * 'set' now has the features that have to be labeled
230
                                 */
231
                                iterator = set.fastIterator();
232
                                while(iterator.hasNext()){
233
                                        if (cancel.isCanceled()){
234
                                                return;
235
                                        }
236
                                        Feature feature=(Feature)iterator.next();
237
                                        double size = 0;
238
                                        Color color = null;
239
                                        if (useFixedSize){
240
                                                // uses fixed size
241
                                                size = fixedSize;// * fontScaleFactor;
242
                                        } else if (heightFieldName != null) {
243
                                                // text size is defined in the table
244
                                                try {
245
                                                        size = feature.getDouble(fields.get(heightPos));
246
                                                } catch (Exception e) {
247
                                                        logger.
248
                                                                warn("Null text height value for text '{}'", feature.getString(fields.get(textPos)));
249

    
250
                                                        continue;
251
                                                }
252
                                        } else {
253
                                                // otherwise will use the size in the symbol
254
                                                size = sym.getFont().getSize();
255
                                        }
256

    
257
                    double the_dpi = MapContext.getScreenDPI();
258
                    if (props != null) {
259
                        int len = PrintAttributes.PRINT_QUALITY_DPI.length;
260
                        int priq = props.getPrintQuality();
261
                        if (priq < 0 || priq >= len) {
262
                            throw new ReadException(featureStore.getName(),
263
                                new Exception("Bad print quality value: "
264
                                    + priq));
265
                        } else {
266
                            the_dpi = PrintAttributes.PRINT_QUALITY_DPI[priq];
267
                        }
268
                    }
269
                            
270
                                        size = CartographicSupportToolkit.
271
                                                                getCartographicLength(this,
272
                                                                                                          size,
273
                                                                                                          viewPort,
274
                                                                                                          the_dpi);
275
                                        if (size <= MIN_TEXT_SIZE) {
276
                                                // label is too small to be readable, will be skipped
277
                                                // this speeds up the rendering in wider zooms
278
                                                continue;
279
                                        }
280

    
281
                                        
282
                                        /*
283
                                         * ym.setFontSize(int) assumes dpi = 72
284
                                         */
285
                    sym.setFontSize(size*72/the_dpi);
286
                    
287

    
288
                                        if (useFixedColor){
289
                                                color = fixedColor;
290
                                        } else if (colorFieldName != null) {
291
                                                // text size is defined in the table
292
                                                try {
293
                                                        color = new Color(feature.getInt(fields.get(colorPos)));
294
                                                } catch (ClassCastException ccEx) {
295
                                                        if (feature.get(fields.get(colorPos)) != null) {
296
                                                                throw new ReadException("Unknown", ccEx);
297
                                                        }
298
                                                        logger.warn(
299
                                                                        "Null color value for text '{}'", 
300
                                                                        feature.getString(textFieldName));
301

    
302
                                                        continue;
303
                                                }
304
                                        } else {
305
                                                color = sym.getTextColor();
306
                                        }
307

    
308
                                        sym.setTextColor(color);
309

    
310
                                        double rotation = 0D;
311
                                        if (rotationFieldName != null) {
312
                                                // text rotation is defined in the table
313
                                                rotation = -Math.toRadians(((Number) feature.get(fields.get(rotationPos))).doubleValue());
314
                                        }
315

    
316
                                        Geometry geom = feature.getDefaultGeometry();
317
                                        sym.setText(feature.getString(fields.get(textPos)));
318
                                        sym.setRotation(rotation);
319
                                        
320
                                        if (ct != null) {
321
                                            /*
322
                                             * Reproject from store CRS to view CRS
323
                                             */
324
                                            geom = geom.cloneGeometry();
325
                                            geom.reProject(ct);
326
                                        }
327
                        
328
                    Point p = createLabelPoint(geom);
329
                    if( p != null ) {                            
330
                                                if (props == null) {
331
                                sym.draw(g, viewPort.getAffineTransform(), p, feature, cancel);
332
                            } else {
333
                                                        sym.print(g, viewPort.getAffineTransform(), p, props);
334
                            }
335
                    }
336
                                }
337

    
338
                        } catch (BaseException e) {
339
                                throw new ReadException(
340
                                                "Could not draw annotation in the layer.", e);
341
                        } finally {
342
                                if (iterator != null) {
343
                                        iterator.dispose();
344
                                }
345
                                if (set != null) {
346
                                        set.dispose();
347
                                }
348

    
349
                        }
350

    
351
                }
352
        }
353
        
354
        public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort,
355
                        Cancellable cancel, double dpi) throws ReadException {
356
                draw(image, g, viewPort, cancel, null);
357
        }
358

    
359
        private org.gvsig.fmap.geom.primitive.Point createLabelPoint(org.gvsig.fmap.geom.Geometry geom)
360
                        throws CreateGeometryException {
361
                
362
                try {
363
                        return geom.centroid();
364
                } catch (GeometryOperationNotSupportedException e) {
365
                        return null;
366
                } catch (GeometryOperationException e) {
367
                        return null;
368
                }
369
        }
370

    
371
//        public String getClassName() {
372
//                return getClass().getName();
373
//        }
374

    
375
        public String getRotationField()  {
376
                return this.rotationFieldName;
377
        }
378

    
379
        public String getTextField()  {
380
                return this.textFieldName;
381
        }
382

    
383
        public String getHeightField() {
384
                return this.heightFieldName;
385
        }
386

    
387
        public String getColorField()  {
388
                return this.colorFieldName;
389
        }
390

    
391
        public void setTextField(String textFieldName) {
392
                this.textFieldName=textFieldName;
393
                this.usedFields = null;
394
        }
395

    
396
        public void setRotationField(String rotationFieldName) {
397
                this.rotationFieldName = rotationFieldName;
398
                this.usedFields = null;
399
        }
400

    
401
        /**
402
         * Sets the field that contains the size of the text. The size is computed
403
         * in meters. To use any other unit, call setUnit(int) with the scale factor from meters
404
         * (for centimeters, call <b>setUnitFactor(0.01))</b>.
405
         * @param heightFieldName
406
         */
407
        public void setHeightField(String heightFieldName) {
408
                this.heightFieldName = heightFieldName;
409
                this.usedFields = null;
410
        }
411

    
412

    
413
        public void setColorField(String colorFieldName) {
414
                this.colorFieldName = colorFieldName;
415
        }
416

    
417
        public void print(Graphics2D g, ViewPort viewPort, Cancellable cancel,
418
                        PrintAttributes props) throws ReadException {
419
                draw(null, g, viewPort, cancel, props);
420
        }
421

    
422
        public void setUsesFixedSize(boolean b) {
423
                useFixedSize = b;
424
                this.usedFields = null;
425
        }
426

    
427
        public boolean usesFixedSize() {
428
                return useFixedSize;
429
        }
430

    
431
        public double getFixedSize() {
432
                return fixedSize;
433
        }
434

    
435
        public void setFixedSize(double fixedSize) {
436
                this.fixedSize = fixedSize;
437
                this.usedFields = null;
438
        }
439

    
440
        public void setUsesFixedColor(boolean b) {
441
                useFixedColor = b;
442
                this.usedFields = null;
443
        }
444

    
445
        public boolean usesFixedColor() {
446
                return useFixedColor;
447
        }
448

    
449
        public Color getFixedColor() {
450
                return fixedColor;
451
        }
452

    
453
        public void setFixedColor(Color fixedColor) {
454
                this.fixedColor = fixedColor;
455
        }
456

    
457

    
458
        public void setUnit(int unitIndex) {
459
                unit = unitIndex;
460

    
461
        }
462

    
463
        public int getUnit() {
464
                return unit;
465
        }
466

    
467
        public String[] getUsedFields() {
468
                if (this.usedFields == null) {
469
                        List<String> v = new ArrayList<String>(4);
470
                        if (!this.usesFixedSize()) {
471
                                if (getHeightField() != null) {
472
                                        v.add(getHeightField());
473
                                }
474
                        }
475
                        if (getRotationField() != null) {
476
                                v.add(getRotationField());
477
                        }
478
                        if (getTextField() != null) {
479
                                v.add(getTextField());
480
                        }
481

    
482
                        if (!this.usesFixedColor() && getColorField() != null) {
483
                                v.add(getColorField());
484
                        }
485
                        this.usedFields = (String[]) v.toArray(new String[v.size()]);
486
                }
487
                return this.usedFields;
488
        }
489

    
490
        public int getReferenceSystem() {
491
                return referenceSystem;
492
        }
493

    
494
        public void setReferenceSystem(int referenceSystem) {
495
                this.referenceSystem = referenceSystem;
496
        }
497

    
498
        public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
499
                // not required here
500
                throw new Error("Undefined in this context");
501
        }
502

    
503
        public void setCartographicSize(double cartographicSize, Geometry geom) {
504
                // not required here
505
                throw new Error("Undefined in this context");
506
        }
507

    
508
        public double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
509
                // not required here
510
                throw new Error("Undefined in this context");
511

    
512
        }
513

    
514
        public void setLayer(FLayer layer) {
515
                this.layer = (FLyrVect) layer;
516
                if (layer == null) {
517
                        return;
518
                }
519
                FeatureType type;
520
                try {
521
                        type = this.layer.getFeatureStore().getDefaultFeatureType();
522
                } catch (DataException e) {
523
                        throw new RuntimeException(this.getClass().getName(), e);
524
                }
525

    
526
                if (textFieldName != null) {
527
                        if (type.getIndex(textFieldName) < 0) {
528
                                // FIXME exception ??
529
                        }
530
                }
531
                if (rotationFieldName != null) {
532
                        if (type.getIndex(rotationFieldName) < 0) {
533
                                // FIXME exception ??
534
                        }
535
                }
536
                if (heightFieldName != null) {
537
                        if (type.getIndex(heightFieldName) < 0) {
538
                                // FIXME exception ??
539
                        }
540
                }
541
                if (colorFieldName != null) {
542
                        if (type.getIndex(colorFieldName) < 0) {
543
                                // FIXME exception ??
544
                        }
545
                }
546
        }
547

    
548
        public boolean shouldDrawLabels(double scale) {
549
                return layer.isWithinScale(scale);
550
        }
551
        public Color getColorFont() {
552
                return colorFont;
553
        }
554

    
555
        public void setColorFont(Color colorFont) {
556
                this.colorFont = colorFont;
557
        }
558

    
559
        public Font getFont() {
560
                return font;
561
        }
562

    
563
        public void setFont(Font selFont) {
564
                this.font = selFont;
565
        }
566

    
567
        /* (non-Javadoc)
568
         * @see org.gvsig.tools.persistence.Persistent#loadFromState(org.gvsig.tools.persistence.PersistentState)
569
         */
570
        public void loadFromState(PersistentState state)
571
                        throws PersistenceException {
572

    
573
                setTextField(state.getString(FIELD_TEXT));
574
                setHeightField(state.getString(FIELD_HEIGHT));
575
                setColorField(state.getString(FIELD_COLOR));
576
                setRotationField(state.getString(FIELD_ROTATION));
577
                setUnit(state.getInt(FIELD_UNIT));
578
                setFont((Font) state.get(FIELD_FONT));
579
                useFixedSize = state.getBoolean(FIELD_USE_FIXED_SIZE);
580
                setFixedSize(state.getDouble(FIELD_FIXED_SIZE));
581
                useFixedColor = state.getBoolean(FIELD_USE_FIXED_COLOR);
582
                setFixedColor((Color) state.get(FIELD_FIXED_COLOR));
583
                setReferenceSystem(state.getInt(FIELD_REFERENCE_SYSTEM));                
584
                setColorFont((Color) state.get(FIELD_COLOR_FONT));
585
                setZoomConstraints((IZoomConstraints) state.get(FIELD_ZOOM_CONSTRAINTS));
586
                setLabelingMethod((ILabelingMethod) state.get(FIELD_LABELING_METHOD));
587
        }
588

    
589
        /* (non-Javadoc)
590
         * @see org.gvsig.tools.persistence.Persistent#saveToState(org.gvsig.tools.persistence.PersistentState)
591
         */
592
        public void saveToState(final PersistentState state) throws PersistenceException {
593
                state.set(FIELD_TEXT, getTextField());
594
                state.set(FIELD_HEIGHT, getHeightField());
595
                state.set(FIELD_COLOR, getColorField());
596
                state.set(FIELD_ROTATION, getRotationField());
597
                state.set(FIELD_UNIT, getUnit());
598
                state.set(FIELD_FONT, getFont());
599
                state.set(FIELD_USE_FIXED_SIZE, useFixedSize);
600
                state.set(FIELD_FIXED_SIZE, getFixedSize());
601
                state.set(FIELD_USE_FIXED_COLOR, useFixedColor);
602
                state.set(FIELD_FIXED_COLOR, getFixedColor());
603
                state.set(FIELD_REFERENCE_SYSTEM, getReferenceSystem());                
604
                state.set(FIELD_COLOR_FONT, getColorFont());
605
                state.set(FIELD_ZOOM_CONSTRAINTS, getZoomConstraints());
606
                state.set(FIELD_LABELING_METHOD, getLabelingMethod());
607
        }
608
        
609
        public static class RegisterPersistence implements Callable {
610

    
611
                public Object call() throws Exception {
612
                        PersistenceManager manager = ToolsLocator.getPersistenceManager();
613
                        if( manager.getDefinition(ATTR_IN_TABLE_LABELING_STRATEGY_PERSISTENCE_DEFINITION_NAME)==null ) {
614
                                DynStruct definition = manager.addDefinition(
615
                                                AttrInTableLabelingStrategy.class,
616
                                                ATTR_IN_TABLE_LABELING_STRATEGY_PERSISTENCE_DEFINITION_NAME,
617
                                                ATTR_IN_TABLE_LABELING_STRATEGY_PERSISTENCE_DEFINITION_NAME+" Persistence definition",
618
                                                null, 
619
                                                null
620
                                );
621
                                definition.addDynFieldString(FIELD_TEXT).setMandatory(true);
622
                                definition.addDynFieldString(FIELD_HEIGHT).setMandatory(false);
623
                                definition.addDynFieldString(FIELD_COLOR).setMandatory(false);
624
                                definition.addDynFieldString(FIELD_ROTATION).setMandatory(false);
625
                                definition.addDynFieldInt(FIELD_UNIT).setMandatory(true);
626
                                definition.addDynFieldObject(FIELD_FONT).setMandatory(false).setClassOfValue(Font.class);
627
                                definition.addDynFieldBoolean(FIELD_USE_FIXED_SIZE).setMandatory(true);
628
                                definition.addDynFieldDouble(FIELD_FIXED_SIZE).setMandatory(false);
629
                                definition.addDynFieldBoolean(FIELD_USE_FIXED_COLOR).setMandatory(true);
630
                                definition.addDynFieldObject(FIELD_FIXED_COLOR).setMandatory(false).setClassOfValue(Color.class);
631
                                definition.addDynFieldInt(FIELD_REFERENCE_SYSTEM).setMandatory(true);                                
632
                                definition.addDynFieldObject(FIELD_COLOR_FONT).setMandatory(false).setClassOfValue(Color.class);
633
                                definition.addDynFieldObject(FIELD_ZOOM_CONSTRAINTS).setMandatory(false).setClassOfValue(IZoomConstraints.class);
634
                                definition.addDynFieldObject(FIELD_LABELING_METHOD).setMandatory(true).setClassOfValue(ILabelingMethod.class);
635
                        }
636
                        return Boolean.TRUE;
637
                }
638
                
639
        }
640
}