I haven't tested this but I suspect that setting the else rule
(`rule.setElseFilter(true);`) is the problem as it means the rule will only
be executed if the filters of the other rules return false, as you only
have one rule I'm not at all sure what the renderer would do (stepping
through with the debugger would be the "easy" way to answer that) for the
time being I'd just remove that line and see if it fixes it.

Ian

On Thu, 4 Feb 2021 at 19:33, maca delic <macade...@gmx.de> wrote:

> I'm trying to parse a GML file and make it visible with GeoTools. It is
> imported into the MapFrame and the geometry is there, as i get information
> about the polygon if i click on the mappane with the InfoTool.
> But it is invisible. Is this a styling problem? Or am i using the wrong
> aproach in general?
>
> Best regards
>
> File gmlFile = new File("...mypolygon_px6_gml3.1.1.gml");
> InputStream gmlInStream = new FileInputStream(gmlFile);
> GML gml = new GML(Version.GML3);
> SimpleFeatureCollection featureCollection =
> gml.decodeFeatureCollection(gmlInStream);
>
> final StyleBuilder builder = new StyleBuilder();
> final PolygonSymbolizer polygonSymbolize =
> builder.createPolygonSymbolizer(Color.RED, Color.GREEN, 1);
> final Rule rule = builder.createRule(polygonSymbolize);
> rule.setElseFilter(true);
> final Rule rules[] = new Rule[] { rule };
> final FeatureTypeStyle featureTypeStyle =
> builder.createFeatureTypeStyle("Feature", rules);
> final Style style = builder.createStyle();
> style.setName("style");
> style.getDescription().setTitle("User Style");
> style.getDescription().setAbstract("Definition of Style");
> style.featureTypeStyles().add(featureTypeStyle);
>
> FeatureLayer layer = new FeatureLayer(featureCollection, style);
> MapContent mapcontent = new MapContent();
> mapcontent.getViewport().setBounds(layer.getBounds());
> mapcontent.addLayer(layer);
> JMapFrame.showMap(mapcontent);
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>


-- 
Ian Turton
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to