Hi, i added some slight modifications to my app, in particular to adding the createStyle func and cleaning my main file. When running the app, i keep getting the following error:
Exception in thread "main" java.lang.ClassCastException: com.mycompany.Map_AppV2.ConstructStyle cannot be cast to org.geotools.styling.Style at com.mycompany.Map_AppV2.ConstructMap.<init>(ConstructMap.java:84) at com.mycompany.Map_AppV2.MapApp.main(MapApp.java:13) I looked in my ConstructMap.java file and noticed that it was pointing to this particular line of code: mapContext.addLayer(myFeatureSource,(Style) constrStyle); and i then looked at my ConstructStyle java file but in my constructor is currently empty, becuase i commented all that code out to include the construct style func. How do i tell the app that the object constrStyle in my ConstructMap.java file is an implementation of the StyleFactory? Even though i already have addes this. Because when i try to open my shapefile, it is not displayed. Cheers Michael Bedward wrote: > >> The reason i ask is beacuse very early on when following some of the >> tutorials in my ConstructMap.java i created a constrStyle object passed >> the >> following: >> >> // Pass file and feature schema referrence to myCreateStyle function >> constrStyle.myCreateStyle(file, myFeatureTypeSchema); > > There are various ways of doing it but the way I suggested is simple > and should work. I like simple things :-) > >> can be commented away, which i guess is yes :( (all that hardwork)? > > My own learning is like that too. Ratio of code written / code used = > very large number > >> I have general question here that i would like to ask, when creating >> styles/symbolizers for a shap file, how does one know what he or she >> needs >> to create? > > You need to know if you're drawing points, lines or polygons. If > you're not sure what type of geometry a feature is you can query it, > for example... > > Geometry geom = (Geometry) aFeature.getDefaultGeometry(); > String typeName = geom.getGeometryType(); > > Hope this helps > > Michael > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by: > SourcForge Community > SourceForge wants to tell your story. > http://p.sf.net/sfu/sf-spreadtheword > _______________________________________________ > Geotools-gt2-users mailing list > Geotools-gt2-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > -- View this message in context: http://n2.nabble.com/Styling-problem-tp2227157p2250026.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users