Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] (no subject)

I don't remember for sure if there is a convenience method already made for this.  You can look at the FeatureUtils class for some utility methods dealing with features.  If not then the following code snippet should help.  (I haven't compiled it so forgive the typos)

Class type = layer.getSchema().getDefaultGeometry().getType();
Polygon.class.isAssignableFrom( type ) || MultiPolygon.class.isAssignableFrom(type)


Jesse

On Aug 13, 2007, at 4:39 AM, Andy Cox wrote:

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)


Back to the top