Hi Oliver: We are transitioning to GeoAPI interfaces here ... for GeoTools 2.2 we added in some of the methods names from GeoAPI - we also found that nobody had made a StyleFactoryFinder yet. > Here's some simplified older code that I'm trying to convert. > > <code> > StyleBuilder sb = new StyleBuilder(); > Expression left = sb.attributeExpression(p_Attribute); > Expression right = sb.literalExpression(literal); > org.opengis.filter.Filter filter = filterFactory.less(left, right); > Stroke stroke = sb.createStroke(new Color(0,245,0), 2); > PolygonSymbolizer symbolizer = sb.createPolygonSymbolizer(stroke, > sb.createFill(new Color(155,102,0))); > Rule rule = sb.createRule(symbolizer); > > rule.setFilter((org.geotools.filter.Filter)filter); > > FeatureTypeStyle fts = sb.createFeatureTypeStyle(p_FeatureTypeName, rule); > </code> > > Two questions: > > 1) note the cast in the rule.setFilter - org.geotools.filter.Filter is > deprecated but that's what setFilter requires. Am I just missing the > new way of doing things or is this a bug? > Not sure - lets ask Cory. > 2) when using StyleBuilder.attributeExpression it seems the FeatureType > is never specified - how should that be set (ie I'm specifying a column > but not a table). > Um attribute expressions *always* just worked on the column; the table is represented as the FeatureType (ie you have defined your FeatureType style against a specific table already). The previous version of FilterFactory had a mistake where both FeatureType and attribute name were used (and the only thing that could happen was a mistake when the attribute name was wrong).
By removing this mistake we can now get Filters to work on Objects and Metadata and things other then Features. Jody ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
