Re: [Geotools-gt2-users] Styling problem

2009-02-01 Thread Michael Bedward
Hi Luong, I don't quite understand what you're trying to do, but passing an instance of your ConstructStyle class to the map context or whatever won't work because it is NOT a Style object. What you want to pass it is the return value of the createStyle method. If you want a separate style

Re: [Geotools-gt2-users] Styling problem

2009-02-01 Thread nvidia
Hi, That was exactly what i was trying to do, attempting to pass the return value from the function createStyle method into the mapcontext. Sorry for the confusion, it makes a little more sense now. What i did in my ConstructMap.java code was created a style variable, and color c variable

Re: [Geotools-gt2-users] Styling problem

2009-02-01 Thread Michael Bedward
Hi Luong, I suspect the problem is in your frame class. What sort of object are you using to display the rendered map ? E.g. a JMapPane ? If it's not too long, post the code for that class and let's see what we can see. Michael

Re: [Geotools-gt2-users] Styling problem

2009-02-01 Thread Michael Bedward
PS. in case it's easier, here is a skeletal example of how you might do things... // in your main class, after code for creating map context and adding layer(s) MyFrame frame = new MyFrame(My beautiful map); frame.setMap(mapContext);

Re: [Geotools-gt2-users] Styling problem

2009-01-31 Thread nvidia
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

Re: [Geotools-gt2-users] Styling problem

2009-01-29 Thread nvidia
Hi, thanks for the reply, i added the section to my ConstructStyle.java class file, but wanted to ask because i want to display my shapefile by using java's file chooser (i.e file-open-my.shp), is there anything that i would need to also add with regards to the function createLineStyle? The

Re: [Geotools-gt2-users] Styling problem

2009-01-29 Thread Michael Bedward
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

Re: [Geotools-gt2-users] Styling problem

2009-01-29 Thread nvidia
I will try it i'll let u know how it goes. Thanks again. 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

Re: [Geotools-gt2-users] Styling problem

2009-01-27 Thread Ian Turton
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

Re: [Geotools-gt2-users] Styling problem

2009-01-27 Thread Michael Bedward
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

Re: [Geotools-gt2-users] Styling problem

2009-01-27 Thread nvidia
Hi, i did some adjustments to my code, in particular i declared a stylefactory object within my ConstructStyle.java and in the constructor i added it by doing: this.lineStyle = styleFactory.createStyle(); to help create the style with the addition of doing declaring an instance

Re: [Geotools-gt2-users] Styling problem

2009-01-27 Thread Michael Bedward
Hi Luong, There's some confusion about what's what in your code - especially regarding interfaces. The good news is that it can all be a lot simpler :) For starters, to make a simple style for a line feature type you can just use a method like this... public Style createLineStyle(String