Hi to all,

I used this code for displaying Point, Line and Polygon shape files in color. 
When I run this program the Line and Polygon are displayed in color but the 
Point layer was disappeared. Here I attached my code and error. Can any one 
please help me. 



public static void main(String[] args) throws Exception {

        File file1 = JFileDataStoreChooser.showOpenFile("shp", null);
        File file2 = JFileDataStoreChooser.showOpenFile("shp", null);
        File file3 = JFileDataStoreChooser.showOpenFile("shp", null);
        if (file1 == null || file2 == null || file3 == null) {
            return;
        }
        FileDataStore store1 = FileDataStoreFinder.getDataStore(file1);
        FileDataStore store2 = FileDataStoreFinder.getDataStore(file2);
        FileDataStore store3 = FileDataStoreFinder.getDataStore(file3);
     
        
        SimpleFeatureSource featureSource1 =  store1.getFeatureSource();
        SimpleFeatureSource featureSource2 =  store2.getFeatureSource();
        SimpleFeatureSource featureSource3 =  store3.getFeatureSource();
        
        /*
         * Create the JMapFrame and set it to display the shapefile's features
         * with a default line and colour style
         */
        MapContent map = new MapContent();
        map.setTitle("Feature selection tool example");
        Style style1 = SLD.createLineStyle(COLOUR, OPACITY, null, null);
        Style style2 = SLD.createPolygonStyle(POLYGON_COLOUR, FILL_COLOUR, 
OPACITY,null, null);
        Style style3 = SLD.createPointStyle(null, COLOUR, COLOUR, OPACITY, 
OPACITY);
        
        Layer layer1 = new FeatureLayer (featureSource1, style1);
        Layer layer2 = new FeatureLayer (featureSource2, style2);
        Layer layer3 = new FeatureLayer (featureSource3, style3);
        
        map.addLayer(layer1);
        map.addLayer(layer2);
        map.addLayer(layer3);
        
        JMapFrame.showMap(map);

    }   
}




run:
Feb 18, 2013 10:19:58 AM org.geotools.renderer.lite.StreamingRenderer 
fireErrorEvent
SEVERE: null
java.lang.NullPointerException
    at 
org.geotools.renderer.style.ExpressionExtractor.splitCqlExpressions(ExpressionExtractor.java:76)
    at 
org.geotools.renderer.style.ExpressionExtractor.extractCqlExpressions(ExpressionExtractor.java:163)
    at 
org.geotools.styling.StyleAttributeExtractor.visitCqlExpression(StyleAttributeExtractor.java:403)
    at 
org.geotools.styling.StyleAttributeExtractor.visit(StyleAttributeExtractor.java:390)
    at org.geotools.styling.MarkImpl.accept(MarkImpl.java:169)
    at 
org.geotools.styling.StyleAttributeExtractor.visit(StyleAttributeExtractor.java:356)
    at org.geotools.styling.GraphicImpl.accept(GraphicImpl.java:354)
    at 
org.geotools.styling.StyleAttributeExtractor.visit(StyleAttributeExtractor.java:243)
    at 
org.geotools.styling.PointSymbolizerImpl.accept(PointSymbolizerImpl.java:93)
    at 
org.geotools.styling.StyleAttributeExtractor.visit(StyleAttributeExtractor.java:113)
    at 
org.geotools.renderer.lite.StreamingRenderer.findStyleAttributes(StreamingRenderer.java:1512)
    at 
org.geotools.renderer.lite.StreamingRenderer.getStyleQuery(StreamingRenderer.java:1022)
    at 
org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:2001)
    at 
org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:829)
    at org.geotools.swing.RenderingTask.call(RenderingTask.java:106)
    at org.geotools.swing.RenderingTask.call(RenderingTask.java:41)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to