Hi, im using the WFSDataStore with MapServer( gt 2.2RC3 ) and i saw that i "have" to give the style to paint the Feature.
 - Why we have to put a style if we already said to MapServer (or geoserver) how to paint that feature?
 - Is there a way to add the layer direct from the MapServer, without creating a new style.
 
Thx, Fred.
 
 
here is the code:
 
 ...
 
JMapPane mp = new JMapPane();

 ...

URL url = "" URL("http://www.opengeo.com.br:8082/geoserver/wfs/GetCapabilities");

HashMap m = new HashMap();

m.put( WFSDataStoreFactory.URL.key, url );

m.put( WFSDataStoreFactory.TIMEOUT.key, new Integer( 10000 ) )

DataStore wfs = (new WFSDataStoreFactory()).createDataStore(m);

Query query = new DefaultQuery( wfs.getTypeNames()[1] );  // i need only the first element returned by the MapServer

FeatureReader ft = wfs.getFeatureReader( query, Transaction.AUTO_COMMIT );
   FeatureCollection fc = FeatureCollections.newCollection();
   try
   {
        int count = 0;
        while( ft.hasNext() )
        {
             fc.add( ft.next() );
             count++;
        }
        System.out.println( "Found " + count + " features" );
   }

...

style = builder.createStyle( builder.createLineSymbolizer( Color.BLUE, 1 ) );  /// WHY???????

...

MapContext context = new DefaultMapContext();

context.addLayer( fs, style );

context.getLayerBounds();

mp.setHighlightLayer( context.getLayer( 0 ) );

GTRenderer renderer = new StreamingRenderer();

mp.setRenderer( renderer );

mp.setContext( context );

...

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to