Hi Sergey, A SimpleFeature doesn't know anything about a MapLayer. In fact, there doesn't have to be a one-to-one relationship between feature and layer. For example, I might display a single set of features concurrently in two separate layers using a different Style with each. This is actually quite common.
A given SimpleFeature just knows the SimpleFeatureType that it belongs to. A MapLayer knows the FeatureSource / FeatureCollection that it is holding and from that we can get the associated SimpleFeatureType. If you know that a given SimpleFeatureType will only ever be associated with a single MapLayer in your use case then the search is obviously very easy. If a given SimpleFeatureType can be associated with multiple layers then you need to query the source / collection associated with each layer to see if the given feature is contained in it. Does that help ? Michael On 9 October 2010 00:28, LSA <[email protected]> wrote: > Hi there, > > Is there a conventional way of getting MapLayer which is currently > holding given SimpleFeature? > > Or SimpleFeature is completely stripped of any references to its holders? > > In my application, it can be guessed from feature.getID(), but this way > is ambiguous. > > Thanks, > Sergey > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today. > http://p.sf.net/sfu/beautyoftheweb > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
