Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Layers Type - Polygon or Multiploygon

You can ask a Layer for its FeatureType and from there get the GeometryAttributeType which will indicate which class is being used. We have some code around that looks at this stuff in order to decide what default Style to apply when the layer is created and what little Glyph to draw in the legend view.

You may need to make this decision based on the Layer's default GeoResource (since it is the keeper of the FeatureType). So chances are this is all reduced to a utility method if you look in the codebase.

Cheers,
Jody

Andy Cox wrote:

Sorry should have included a subject.

------------------------------------------------------------------------

*From:* Andy Cox [mailto:ivyavenue@xxxxxxxxxxx]
*Sent:* 13 August 2007 12:40
*To:* 'User-friendly Desktop Internet GIS'
*Subject:*

Hello,

Does anyone know if there is an easy way to get a layers geometry type. I am trying to populate a list with the layers that are in the map but I only want to include the polygon layers. So far I have

Map map = ApplicationGISInternal./getActiveMap/();

            List<ILayer> layers = map.getMapLayers();

            ILayer layer;

            *for* (i=0; i<layers.size(); i++) {

                  layer = (ILayer)layers.get(i);

*if* (layer IS TYPE OF POLYGON OR MULTIPOLYOGON)) {

                        layerList.add("" + layer.getName());

                  }

            }

Thanks
Andy

------------------------------------------------------------------------

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top