Ability to change the threshold for the goodness fit algorithm for polygon 
labels
---------------------------------------------------------------------------------

                 Key: GEOT-1868
                 URL: http://jira.codehaus.org/browse/GEOT-1868
             Project: GeoTools
          Issue Type: Improvement
          Components: core render
            Reporter: Niklas Eklund
            Assignee: Jesse Eichar


We have a case where several labels for polygon geometries are not rendered due 
to the fact that they don't score high enough in the goodness fit algorithm. 
Since spaceAround and group can be changed via options (by VendorOption) the 
goodness fit threshold value should too imho. Not able to post a proper patch 
unfortunately but the changes are pretty small:

* Add variable, getter and setter for the threshold value in 
LabelCacheItem.java.

* Add a method to get the value in LabelCacheDefault similar to 
isGrouping/getSpaceAround:

        private double getMinGoodnessFit(TextSymbolizer symbolizer) {
                String value = symbolizer.getOption("minGoodnessFit");
                if (value == null)
                        return DEFAULT_MIN_GOODNESS_FIT;
                try {
                        return Double.parseDouble(value);
                } catch (Exception e) {
                        return DEFAULT_MIN_GOODNESS_FIT;
                }
        }

* set the value on the labelItem in the put()-method:
    item.setMinGoodnessFit(getMinGoodnessFit(symbolizer));

* Change the check in the end()-method to something like:

        double minGoodnessFit = labelItem.getMinGoodnessFit();
        // <= 0 means no check for goodness fit
        if (minGoodnessFit > 0 && goodnessOfFit(glyphVector, tempTransform,
                representativeGeom) < minGoodnessFit)
            continue;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to