Inheritance diagram for ImageSurfApp::

Public Methods | |
| void | doArgs (String[] args) |
| void | handleOpen () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleNewImage (HxCorba.ImageRep img, String name) |
| void | handleExit () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleViews () |
| void | handleRandom () |
| void | handleSearch (String invar) |
| void | handleSearchE () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleSearchC () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleSearchWw () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleSearchCw () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleResult (String type, String value) |
| void | viewerEntered (ViewerEvent e) |
| Implementation of ViewerInspectionListener. More... | |
| void | viewerExited (ViewerEvent e) |
| Implementation of ViewerInspectionListener. More... | |
| void | viewerSelected (ViewerEvent e) |
| Implementation of ViewerInspectionListener. More... | |
| void | objectEntered (ViewerEvent e) |
| Implementation of ViewerInspectionListener. More... | |
| void | objectProbed (ViewerEvent e) |
| Implementation of ViewerInspectionListener. More... | |
| void | objectSelected (ViewerEvent e) |
| Implementation of ViewerInspectionListener. More... | |
Static Public Methods | |
| void | main (String[] args) |
| main is called when this is used as an application. More... | |
Protected Methods | |
| boolean | buildSample (JFrame parent, JApplet applet, String[] args) |
|
|
main is called when this is used as an application. This function has to be overloaded in the "leaf node" application itself. Reimplemented from SampleApp.
00041 {
00042 ImageSurfApp app = new ImageSurfApp();
00043 app.doMain(args);
00044
00045 // doMain will call buildSample
00046 }
|
|
|
00049 {
00050 int i, ndb = 0;
00051 String[] dbName = new String[10];
00052
00053 for (i=0; i < args.length; i++) {
00054 if (args[i].equals("-dir"))
00055 _dbDir = args[i+1];
00056 else if (args[i].equals("-db")) {
00057 dbName[ndb] = args[i+1];
00058 ndb++;
00059 }
00060 }
00061
00062 if (ndb == 0) {
00063 ndb = 2;
00064 dbName[0] = _dbName0;
00065 dbName[1] = _dbName1;
00066 }
00067
00068 for (i=0; i < ndb; i++) {
00069 OutputStreamArea.println("Reading Database "+dbName[i]);
00070 _ops.HxInvarOpenDB(dbName[i], _dbDir);
00071 }
00072 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00078 {
00079 // set the file filter for images readable by Horus
00080 _fc.setFileFilter(_horusFilter);
00081
00082 // pop the dialog box and wait for the user to react to it.
00083 int returnVal = _fc.showOpenDialog(this);
00084
00085 // check whether the user has selected a file
00086 if (returnVal != JFileChooser.APPROVE_OPTION)
00087 return;
00088 File file = _fc.getSelectedFile();
00089
00090 HxCorba.ImageRep img = null;
00091 try {
00092 ImageManager imageMgr = ImageManager.defaultImageMgr();
00093 if(imageMgr != null) {
00094 img = imageMgr.loadServerImage(file.getPath());
00095 String imName = nameFromFile(file); // not the full path...
00096 StubRepository.instance().addStub(HxCorba.ImageRepHelper.id(), imName, img);
00097 }
00098 }
00099 catch(org.omg.CORBA.OBJECT_NOT_EXIST ex){
00100 ErrorStreamArea.println("Image "+file.getName()+" doesn't exist");
00101 }
00102 catch(org.omg.CORBA.SystemException ex){
00103 ErrorStreamArea.println(""+ex);
00104 }
00105
00106 handleNewImage(img, file.getName());
00107 }
|
|
||||||||||||
|
00110 {
00111 if (img == null)
00112 return;
00113
00114 // Clear viewer and add new image.
00115 CanvasObject cObj = new CanvasCorbaImage(img);
00116 _mainViewer.doClear();
00117 _mainViewer.addObject(cObj);
00118
00119 _queryImage = img;
00120 _queryName = name;
00121
00122 OutputStreamArea.println("Search Image: " + name);
00123 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00128 {
00129 System.exit(0);
00130 }
|
|
|
00133 {
00134 for (int i=0 ; i<_viewerNames.length ; i++) {
00135 _viewerImages[i] = _fac.fromFile(_dbDir+"/"+_viewerNames[i]);
00136 CanvasObject cObj = new CanvasCorbaImage(_viewerImages[i]);
00137 _viewer[i].doClear();
00138 _viewer[i].addObject(cObj);
00139 _caption[i].setText(_viewerNames[i]);
00140 }
00141 _viewersPanel.invalidate();
00142 }
|
|
|
00145 {
00146 _viewerNames = _ops.HxInvarRandom("E", _nrViewers);
00147 handleViews();
00148 }
|
|
|
00151 {
00152 if (_queryImage == null) {
00153 ErrorStreamArea.println("No query image.");
00154 return;
00155 }
00156
00157 _viewerNames = _ops.HxInvarSearch(_queryImage, invar, _nrViewers);
00158 handleViews();
00159 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00165 {
00166 handleSearch("E");
00167 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00173 {
00174 handleSearch("C");
00175 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00181 {
00182 if (_queryImage == null) {
00183 ErrorStreamArea.println("No query image.");
00184 return;
00185 }
00186 HxCorba.Histogram[] hists = _ops.HxInvarEHisto(_queryImage, 1.0, 256);
00187 for (int i=0 ; i<hists.length ; i++) {
00188 CanvasObject cObj = new CanvasCorbaHistogram(hists[i]);
00189 _viewer[i].doClear();
00190 _viewer[i].addObject(cObj);
00191 }
00192 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00198 {
00199 if (_queryImage == null) {
00200 ErrorStreamArea.println("No query image.");
00201 return;
00202 }
00203 HxCorba.Histogram[] hists = _ops.HxInvarCHisto(_queryImage, 1.0, 256);
00204 for (int i=0 ; i<hists.length ; i++) {
00205 CanvasObject cObj = new CanvasCorbaHistogram(hists[i]);
00206 _viewer[i].doClear();
00207 _viewer[i].addObject(cObj);
00208 }
00209 }
|
|
||||||||||||
|
00213 {
00214 /*if(type.equals("interface ImageRep")) {
00215 HxCorba.ImageRep image = (HxCorba.ImageRep)CorbaMediator.getStub(
00216 HxCorba.ImageRepHelper.id(), value);
00217
00218 showImage(image, _rightViewer);
00219 }
00220 else*/ if(type.equals("void"))
00221 OutputStreamArea.println("void");
00222 else if(type.equals("error"))
00223 ErrorStreamArea.println(value);
00224 else
00225 OutputStreamArea.println("Result: "+value+", type: "+type);
00226 }
|
|
|
Implementation of ViewerInspectionListener.
Reimplemented from ViewerInspectionListener.
00232 {
00233 }
|
|
|
Implementation of ViewerInspectionListener.
Reimplemented from ViewerInspectionListener.
00239 {
00240 }
|
|
|
Implementation of ViewerInspectionListener.
Reimplemented from ViewerInspectionListener.
00246 {
00247 }
|
|
|
Implementation of ViewerInspectionListener.
Reimplemented from ViewerInspectionListener.
00253 {
00254 }
|
|
|
Implementation of ViewerInspectionListener.
Reimplemented from ViewerInspectionListener.
00260 {
00261 }
|
|
|
Implementation of ViewerInspectionListener.
Reimplemented from ViewerInspectionListener.
00266 {
00267 CanvasViewer v = (CanvasViewer) e.getViewer();
00268 int index = -1;
00269 for (int i=0 ; i<_nrViewers ; i++) {
00270 if (_viewer[i] == v)
00271 index = i;
00272 }
00273 if (index != -1) {
00274 OutputStreamArea.println("Image thumbnail selected: " + index);
00275 handleNewImage(_viewerImages[index], _viewerNames[index]);
00276 }
00277 }
|
|
||||||||||||||||
|
Reimplemented from SampleApp.
00287 {
00288 OutputStreamArea out = new OutputStreamArea(10, 80, false);
00289 ErrorStreamArea err = new ErrorStreamArea(parent, 3, 80);
00290
00291 OutputStreamArea.println("Initializing CorbaMediator...");
00292 initCorbaMediator(args);
00293 setAdvancedLookupManager(parent);
00294
00295 _ops = ServiceRepository.instance().getGlobalOps();
00296 if(_ops == null) return false;
00297 _fac = ServiceRepository.instance().getConstructor();
00298 if(_fac == null) return false;
00299
00300 OutputStreamArea.println("Building "+getSampleName()+" GUI...");
00301
00302 // Create FileChooser, for loading images into viewer
00303
00304 _fc = new JFileChooser("\\images");
00305 _horusFilter = new HorusImageFilter();
00306 _fc.addChoosableFileFilter(_horusFilter);
00307
00308 // Main panel
00309
00310 JPanel gui = new JPanel(new GridBagLayout());
00311
00312 // Setup splitpanes
00313
00314 JSplitPane lowerLeft = new JSplitPane(JSplitPane.VERTICAL_SPLIT, out, err);
00315 lowerLeft.setOneTouchExpandable(true);
00316 lowerLeft.setDividerLocation(170);
00317
00318 _mainViewer = ViewerFactory.makeBasicViewer();
00319 _mainViewer.addViewerInspectionListener(this);
00320 JSplitPane left = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
00321 _mainViewer, lowerLeft);
00322 left.setOneTouchExpandable(true);
00323 left.setDividerLocation(512);
00324
00325 JSplitPane viewSP = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
00326 left, makeViewers());
00327 viewSP.setOneTouchExpandable(true);
00328 viewSP.setDividerLocation(512);
00329 HX.addGridComp(gui, viewSP, 0, 0, 1, 1,
00330 GridBagConstraints.BOTH, 1.0, 1.0, 1, 1);
00331
00332
00333 // Create ExtMenuBar:
00334
00335 _bmenu = new ExtMenuBar(this);
00336 _bmenu.addMenu("File");
00337 _bmenu.addMenuItem("File", "Open", "handleOpen");
00338 _bmenu.addSeparator("File");
00339 _bmenu.addMenuItem("File", "Exit", "handleExit");
00340
00341 _bmenu.addMenu("Surf");
00342 _bmenu.addMenuItem("Surf", "Color", "handleSearchE");
00343 _bmenu.addMenuItem("Surf", "Chromaticity", "handleSearchC");
00344 _bmenu.addSeparator("Surf");
00345 _bmenu.addMenuItem("Surf", "Random", "handleRandom");
00346
00347 parent.setJMenuBar(_bmenu);
00348 parent.getContentPane().add(gui, BorderLayout.CENTER);
00349 parent.setSize(1100, 840);
00350 parent.setLocation(0, 0);
00351
00352 doArgs(args);
00353 //handleRandom();
00354
00355 OutputStreamArea.println("Done.");
00356 out.capture();
00357
00358 return true;
00359 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001