From: Dinesh C. <cho...@gm...> - 2007-03-24 07:00:57
|
Dear Adrian, First of all I am very thankful to you to give me very important information regarding to my problem. My goal is to make one desktop based application. In which I have to make use of shape file viewer. Currently I am using Linux + java(AWT) for developing this application.Would you please suggest me nessesary steps,technologies,resourses which will be useful to me for developing this applcication? Thanks & Regards, Dinesh On 3/23/07, Adrian Custer <ac...@gm...> wrote: > > Hey, > > The version of geotools is critical since *lots* has changed in the past > few months, let alone the past few years. The name of the geotools files > should give you the version. > > >From your file it seems like you are using a geotools version prior to > 2.0. Geotools 0.x/1.x was a very different design meant to be used in an > applet. That version is very, very old and few of us know much about it. > It's so old that you are probably better off looking at alternative > technologies. > > What is your overall goal? To have a desktop client viewer (see uDig) or > to serve up a web page with a shapefile image (see Geoserver, MapServer, > OpenLayers...)? > > --adrian > > On Fri, 2007-03-23 at 16:28 +0530, Dinesh Chothe wrote: > > hello, > > As per our recent mailing discussion here is some information I would > > like to share with you. > > I have been using linux knoppix(debian4) operating system.& I dont > > know about my geotools version that i have been using.Following is the > > code that i have been using for this developement.Please give me > > suggetions so I can modify my code. > > > > package dineshPackage; > > import java.awt.*; > > import java.applet.*; > > import java.net.URL ; > > import uk.ac.leeds.ccg.geotools.ShapefileReader; > > import uk.ac.leeds.ccg.geotools.Theme; > > import uk.ac.leeds.ccg.geotools.Viewer; > > import uk.ac.leeds.ccg.widgets.*; > > > > // Create a subclass of Frame > > class MenuFrame extends Frame { > > String msg = ""; > > Viewer view = new Viewer(); > > URL url; > > // CheckboxMenuItem debug, test; > > MenuFrame(String title) { > > super(title); > > > > // create menu bar and add it to frame > > MenuBar mbar = new MenuBar(); > > setMenuBar(mbar); > > > > // create the menu items > > Menu file = new Menu("File"); > > MenuItem item1, item2, item3, item4, item5; > > // file.add(item1 = new MenuItem("New...")); > > file.add(item2 = new MenuItem("Open...")); > > file.add(item3 = new MenuItem("Close")); > > file.add(item4 = new MenuItem("-")); > > file.add(item5 = new MenuItem("Quit...")); > > mbar.add(file); > > > > // create an object to handle action and item events > > MyMenuHandler handler = new MyMenuHandler(this); > > // register it to receive those events > > > > item2.addActionListener(handler); > > item3.addActionListener(handler); > > item4.addActionListener(handler); > > item5.addActionListener (handler); > > // create an object to handle window events > > MyWindowAdapter1 adapter = new MyWindowAdapter1(this); > > // register it to receive those events > > addWindowListener(adapter); > > } > > } > > class MyWindowAdapter1 extends WindowAdapter { > > MenuFrame menuFrame; > > public MyWindowAdapter1(MenuFrame menuFrame) { > > this.menuFrame = menuFrame; > > } > > public void windowClosing(WindowEvent we) { > > menuFrame.setVisible(false); > > } > > } > > > > class MyMenuHandler extends Frame implements ActionListener, > > ItemListener { > > MenuFrame menuFrame; > > URL url; > > public MyMenuHandler(MenuFrame menuFrame) { > > this.menuFrame = menuFrame; > > } > > Viewer view = new Viewer(); > > // Handle action events > > > > public void actionPerformed(ActionEvent ae) { > > String msg=""; > > String arg = (String) ae.getActionCommand(); > > if (arg.equals("Open...")) { > > Frame f = new SampleFrame("File Dialog Demo"); > > f.setVisible(true); > > f.setSize(500, 700); > > FileDialog fd = new FileDialog(f, "File Dialog"); > > fd.setVisible(true); > > > > String basename = fd.getFile(); > > String fpath = fd.getDirectory(); > > String path = fpath + basename; > > msg += "Opened File:" + path; > > > > ToolBar tools = new ToolBar(view); > > //add the toolbar > > add(tools,BorderLayout.SOUTH); > > add(new Label("indicrant"), BorderLayout.NORTH); > > try { > > url = new URL(path); > > } catch (IOException e) { > > System.out.println("Exception in catch block"); > > } > > > > ShapefileReader sfr = new ShapefileReader(url); > > Theme t = sfr.getTheme(); > > view.addTheme(t); > > setSize(850, 598); > > setLocation(172, 100); > > view.setVisible (true); > > show(); > > } > > > > if (arg.equals("Close")) { > > dispose(); > > msg +="File Closed"; > > } > > > > if (arg.equals("Quit...")) { > > System.exit(1); > > } > > menuFrame.msg = msg; > > menuFrame.repaint(); > > } > > > > public void itemStateChanged(ItemEvent ie) { > > menuFrame.repaint(); > > } > > } > > > > // Create frame window. > > public class MenuDemo extends Applet { > > Frame f; > > public void init() { > > f = new MenuFrame("Menu Demo"); > > f.setSize(1035, 800); > > f.setVisible (true); > > } > > public void start() { > > f.setVisible(true); > > } > > public void stop() { > > f.setVisible(false); > > } > > } > > Thanks & Regards, > > Dinesh > > > > > > On 3/23/07, Adrian Custer <ac...@gm...> wrote: > > Welcome, > > > > Perhaps someone can help you with the information you have > > given us, but > > I would need to know more. For example, what version of > > Geotools are you > > using, how are you "adding" the renderer, and such > > subtleties. > > > > Ideally, you could give us some details on your situation > > (Operating > > Systems, Geotools version...) and then show us the code you > > are using to > > add the renderer into your Frame. It sounds like you are using > > a full > > widget rather than adding the renderer to your own widget. > > > > --adrian > > > > > > On Fri, 2007-03-23 at 13:05 +0530, Dinesh Chothe wrote: > > > Hello, > > > I am Dinesh.I have newly joined as a GIS Engineer. > > > I am developing one application Shapefile Viewer using AWT + > > geotools. > > > In which i have one problem,When i run my java program I get > > one Frame > > > window.On which i can open File dialog box .From which i > > can select > > > shape file.But when i open any shape file , It get opened in > > a new > > > window.I want it get open in same Frame window.Can > > anyone help me? > > > > > > Thanks & Regards > > > Dinesh > > > > > > ------------------------------------------------------------------------- > > > 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 > > Geo...@li... > > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > > > > > |