Hi:

Here is the solution I used
https://github.com/guziy/GeotoolsDemo/blob/master/src/RoughCreatingPoint.java

It creates a maplayer event,  where the changed layer is specified and then
fires it using MapPane method layerChanged()...

Still I find it too much reloading a whole layer for just one point, we
should think of a better solution mayb another event object where the
region changed could be specified....

void createFeatures(MapMouseEvent ev) {
        double[] xy = ev.getWorldPos().getCoordinate();
        Point point = geometryFactory.createPoint(new Coordinate(xy[0], xy[1]));
        pointCollection.add(SimpleFeatureBuilder.build(pointType, new
Object[]{point}, null));

        //create map layer event
        MapLayerEvent mple = new MapLayerEvent(pointLayer,
MapLayerEvent.DATA_CHANGED);
        //create maplayer list event
        MapLayerListEvent mplle = new MapLayerListEvent(map,
pointLayer, map.layers().indexOf(pointLayer), mple);

        mapFrame.getMapPane().layerChanged(mplle);
        System.out.println(MessageFormat.format("Created Point: {0}", point));
    }




Cheers
--
Sasha


2013/8/22 David Purdy <[email protected]>

> Does anyone else have any experience with repainting a particular layer?
> Or any other suggestions to get the map refreshed with updated/new
> features?  I wouldn't think creating a layer for every feature would be a
> desirable solution for anyone.****
>
> ** **
>
> Thanks,****
>
> Dave****
>
> ** **
>
> *From:* [email protected] [mailto:[email protected]] *On Behalf
> Of *Andrea Aime
> *Sent:* Thursday, August 22, 2013 11:17 AM
>
> *To:* David Purdy
> *Cc:* [email protected]
> *Subject:* Re: [Geotools-gt2-users] Geotools 8.0 to 9.4 difference with
> SimpleFeatureCollection and Map refresh****
>
> ** **
>
> On Thu, Aug 22, 2013 at 5:14 PM, David Purdy <[email protected]>
> wrote:****
>
> Thanks for the quick reply Andrea.****
>
>  ****
>
> I just took a look at the Layer API and I don't see any means to have the
> layer repaint.  Do you know the API that cause this to happen?****
>
> ** **
>
> Nope, I'm a server side guy, I don't play with swing guis at all...****
>
> ** **
>
> Cheers****
>
> Andrea****
>
> ** **
>
> -- ****
>
> ==****
>
> Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
> information.****
>
> ==****
>
> ** **
>
> Ing. Andrea Aime ****
>
> @geowolf****
>
> Technical Lead****
>
> ** **
>
> GeoSolutions S.A.S.****
>
> Via Poggio alle Viti 1187****
>
> 55054  Massarosa (LU)****
>
> Italy****
>
> phone: +39 0584 962313****
>
> fax: +39 0584 1660272****
>
> mob: +39  339 8844549****
>
> ** **
>
> http://www.geo-solutions.it****
>
> http://twitter.com/geosolutions_it****
>
> ** **
>
> -------------------------------------------------------****
>
>
> ------------------------------------------------------------------------------
> Introducing Performance Central, a new site from SourceForge and
> AppDynamics. Performance Central is your source for news, insights,
> analysis and resources for efficient Application Performance Management.
> Visit us today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to