One of the fun things hooking up events is doing is this:
java.lang.IllegalStateException: Please remove from existing parent first
at
org.geotools.event.AbstractGTComponent.setParent(AbstractGTComponent.java:203)
at org.geotools.styling.RuleImpl.setSymbolizers(RuleImpl.java:106)
at org.geotools.map.TestUtils.buildStyle(TestUtils.java:74)
And here is where things get interesting - StyleBuilder.buildStyle( name )
PointSymbolizer ps = sf.getDefaultPointSymbolizer();
Rule r = sf.createRule();
r.setSymbolizers(new Symbolizer[] {ps});
So it appears that:
- the Factory method getDefaultPointSymbolizer() is returning the
*same* Symbolizer all the time
- that Symbolizer has all ready be added at least once somewhere
This is *bad* news as symbolizers get modified, and using the same on in
two places like this
would cause modifications to the actual default ...
I mentioned a couple weeks ago that the range of methods in StyleFactory
did not look thought out:
- createPointSymbolizer();
- createPointSymbolizer( Graphic, String )
- getDefaultPointSymbolizer();
I would like to suggest that the getDefault * methods be depricated and
then removed?
And and createPointSymbolizer() return a symbolizer set up according to
the defaults (specfied in the SLD 1.0 spec).
Can anyone think of a reason why I should not do this? This *is* a
Factory its job is to create things ...
Q: Do you guys need the defaults to be available? Would this work ...
public interface PointSymbolizer extends Symbolizer {
public static final PointSymbolizer DEFAULT = new PointSymbolizer(){
... implemented to return the defaults ...
... and throw an exception when added to something ...
};
}
Later,
Jody
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel