On Tue, Jan 27, 2009 at 12:49 PM, nvidia <luong8...@hotmail.com> wrote: > > Hi, > > i'm using the tutorials to help me build my gis app to essentially diplay > my shapfile which is done by selecting the file name via java's file menu > item. I a number of files, 1 of which is called ConstructStyle.java which > implements both StyleFactory, LineSymbolizer which essentially builds my > style. I have another file called ConstructMap.java which implements > MapContext and creates a new ConstructStyle object known as constrStyle. > > The problem i'm having is in my ConstructMap.java file where i am adding > my featuressource and the style object to the mapcontext object as it says: > > ava.lang.ClassCastException: com.mycompany.Map_AppV2.ConstructStyle cannot > be cast to org.geotools.styling.Style > at com.mycompany.Map_AppV2.ConstructMap.<init>(ConstructMap.java:81) > at com.mycompany.Map_AppV2.MapApp.main(MapApp.java:41) > > Now i was thinking of doing a bog standard try/catch block but would i need > to initialise this again? to let the compiler know that i'm using the > ConstructStyle class? >
ConstructStyle needs to implement Style. But infact I suspect that ConstructStyle should use a StyleFactory to make a Style object which you should then pass to the mapcontext. Ian ------------------------------------------------------------------------------ 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