60 |
import org.geotools.factory.GeoTools; |
import org.geotools.factory.GeoTools; |
61 |
import org.geotools.factory.Hints; |
import org.geotools.factory.Hints; |
62 |
import org.geotools.feature.AttributeType; |
import org.geotools.feature.AttributeType; |
|
import org.geotools.feature.Feature; |
|
|
import org.geotools.feature.FeatureType; |
|
63 |
import org.geotools.feature.IllegalAttributeException; |
import org.geotools.feature.IllegalAttributeException; |
64 |
import org.geotools.geometry.jts.LiteShape2; |
import org.geotools.geometry.jts.LiteShape2; |
65 |
import org.geotools.renderer.lite.StyledShapePainter; |
import org.geotools.renderer.lite.StyledShapePainter; |
74 |
import org.geotools.styling.Symbolizer; |
import org.geotools.styling.Symbolizer; |
75 |
import org.geotools.styling.TextSymbolizer; |
import org.geotools.styling.TextSymbolizer; |
76 |
import org.geotools.util.NumberRange; |
import org.geotools.util.NumberRange; |
77 |
|
import org.opengis.feature.simple.SimpleFeature; |
78 |
|
import org.opengis.feature.simple.SimpleFeatureType; |
79 |
|
|
80 |
import schmitzm.geotools.feature.FeatureUtil; |
import schmitzm.geotools.feature.FeatureUtil; |
81 |
|
|
92 |
* <br> |
* <br> |
93 |
* <ul> |
* <ul> |
94 |
* <li>07.02.2008:<br> |
* <li>07.02.2008:<br> |
95 |
* Determining the default values of a {@link FeatureType} by |
* Determining the default values of a {@link SimpleFeatureType} by |
96 |
* {@link FeatureUtil#getDefaultAttributeValues(FeatureType)} instead of using |
* {@link FeatureUtil#getDefaultAttributeValues(SimpleFeatureType)} instead of using |
97 |
* {@link AttributeType#createDefaultValue()} directly, because the latter |
* {@link AttributeType#createDefaultValue()} directly, because the latter |
98 |
* returns {@code null} even though the attribut is not nillable.</li> |
* returns {@code null} even though the attribut is not nillable.</li> |
99 |
* </ul> |
* </ul> |
247 |
/** |
/** |
248 |
* Puts a BufferedImage into this.legendGraphic |
* Puts a BufferedImage into this.legendGraphic |
249 |
*/ |
*/ |
250 |
public void produceLegendGraphic(FeatureType featureType, Style gt2Style, |
public void produceLegendGraphic(SimpleFeatureType featureType, Style gt2Style, |
251 |
Rule[] applicableRules) { |
Rule[] applicableRules) { |
252 |
|
|
253 |
// final FeatureTypeStyle[] ftStyles = gt2Style.getFeatureTypeStyles(); |
// final FeatureTypeStyle[] ftStyles = gt2Style.getFeatureTypeStyles(); |
448 |
|
|
449 |
/** |
/** |
450 |
* Creates a little BufferedImage that presents the Style/Symbols used by |
* Creates a little BufferedImage that presents the Style/Symbols used by |
451 |
* the {@link MapLegend} to show a legend for the {@link FeatureType} |
* the {@link MapLegend} to show a legend for the {@link SimpleFeatureType} |
452 |
* |
* |
453 |
* @param rule |
* @param rule |
454 |
* {@link Rule} that provides the text and the style to present |
* {@link Rule} that provides the text and the style to present |
455 |
* @param featureType |
* @param featureType |
456 |
* Schema that describes the kind of the sample {@link Feature} |
* Schema that describes the kind of the sample {@link SimpleFeature} |
457 |
* that will be rendered with the {@link Style} |
* that will be rendered with the {@link Style} |
458 |
* @param bg |
* @param bg |
459 |
* Background {@link Color} or <code>null</code> |
* Background {@link Color} or <code>null</code> |
460 |
* |
* |
461 |
* @throws IllegalAttributeException |
* @throws IllegalAttributeException |
462 |
*/ |
*/ |
463 |
public BufferedImage createImageForRule(Rule rule, FeatureType featureType, |
public BufferedImage createImageForRule(Rule rule, SimpleFeatureType featureType, |
464 |
Dimension size, Color bg) { |
Dimension size, Color bg) { |
465 |
|
|
466 |
Symbolizer[] symbolizers = rule.getSymbolizers(); |
Symbolizer[] symbolizers = rule.getSymbolizers(); |
504 |
// RasterSymbolizers.."); |
// RasterSymbolizers.."); |
505 |
// } |
// } |
506 |
// else |
// else |
507 |
final Feature sampleFeature = FeatureUtil.createSampleFeature(featureType); |
final SimpleFeature sampleFeature = FeatureUtil.createSampleFeature(featureType); |
508 |
|
|
509 |
// The SLDStyleFactory has to be recreated, as it seams to cache |
// The SLDStyleFactory has to be recreated, as it seams to cache |
510 |
// some stuff. |
// some stuff. |
559 |
|
|
560 |
/** |
/** |
561 |
* Creates a little BufferedImage that presents the Style/Symbols used by |
* Creates a little BufferedImage that presents the Style/Symbols used by |
562 |
* the {@link MapLegend} to show a legend for the {@link FeatureType} |
* the {@link MapLegend} to show a legend for the {@link SimpleFeatureType} |
563 |
* |
* |
564 |
* @param rule |
* @param rule |
565 |
* {@link Rule} that provides the text and the style to present |
* {@link Rule} that provides the text and the style to present |
566 |
* @param featureType |
* @param featureType |
567 |
* Schema that describes the kind of the sample {@link Feature} |
* Schema that describes the kind of the sample {@link SimpleFeature} |
568 |
* that will be rendered with the {@link Style} |
* that will be rendered with the {@link Style} |
569 |
* |
* |
570 |
* @throws IllegalAttributeException |
* @throws IllegalAttributeException |
571 |
*/ |
*/ |
572 |
public BufferedImage createImageForRule(final Rule rule, |
public BufferedImage createImageForRule(final Rule rule, |
573 |
final FeatureType featureType, final Dimension size) { |
final SimpleFeatureType featureType, final Dimension size) { |
574 |
return createImageForRule(rule, featureType, size, null); |
return createImageForRule(rule, featureType, size, null); |
575 |
} |
} |
576 |
|
|