Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] rendering metrics and int arithmatic

I was helping John today go through the style tutorial (which had not yet been ported to trunk). One of the things we found was a mistake in the RenderMetrics calculations where integer arithmetic was being used by accident.
- getRenderAppearanceMetric
- getUserAppearanceMetric

Here is an example of what is going on ...
    public double getRenderAppearanceMetric(IStyleBlackboard blackboard){
... double renderMetric = 1;
        if (expectedStyleIDs.size() > 0){
            renderMetric = numberStylesICanUse / expectedStyleIDs.size();
        }
        return renderMetric;
    }

As a result of this (when a color was placed on the blackboard) the color csv render metrics would only score a 0 (rather than 0.5) as such it would look just as good as the normal csv renderer and not be chosen.

So something like:
double renderMetric = 1.0;
        if (expectedStyleIDs.size() > 0){
renderMetric = (double) numberStylesICanUse / (double) expectedStyleIDs.size();
        }
return renderMetric;

Emily can you confirm that changing all this stuff to double is a good idea?

Other problems turned up to day:
- several failures when using Catalog.search due to a missing null pointer check with inside getKeywords

Cheers,
Jody




Back to the top