Inheritance diagram for VxBasePlayerApp::

Public Methods | |
| void | handleOpenSequence () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleOpenSegmentations () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handleOpenDBSegmentations () |
| void | handleOpen (int segMode) |
| void | handleAddSegmentation () |
| void | handleExit () |
| This function is called by _bmenu if the associated menu item is selected. More... | |
| void | handlePlayMode (String mode) |
| void | handlePlayMode (PlayMode mode) |
| void | handleScaleDisplay (double scale) |
| void | handleShowGrid (boolean show) |
| void | handleSingleWindow () |
| void | handleMultWindows () |
| void | handleTimeLineMode (String mode) |
| void | handleQuery () |
Static Public Methods | |
| void | main (String[] args) |
| main is called when this is used as an application. More... | |
Protected Methods | |
| String | getSampleName () |
| boolean | buildSample (JFrame parent, JApplet applet, String[] args) |
| Initialization. More... | |
| String | getSamplePath () |
| void | addVisualizationOptions (ExtMenuBar menu, String menuName) |
| Redefine addVisualizationOptions to add visualization specific options to the menu bar. More... | |
| String[] | demoSegmentations () |
| Redefine demoSegmentations to specify which segmentations are loaded initially. More... | |
| SegmentationVisualization | getVisualization (String segName) |
| Redefine getVisualization to specify how a segmentation is displayed. More... | |
|
|
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. Reimplemented in VxPlayerApp.
00030 {
00031 VxBasePlayerApp app = new VxBasePlayerApp();
00032 app.doMain(args);
00033
00034 // doMain will call buildSample
00035 }
|
|
|
Reimplemented from SampleApp.
00038 {
00039 return "VxPlayerApp";
00040 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00045 {
00046 handleOpen(NO_SEGMENTATIONS);
00047 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00052 {
00053 handleOpen(HX_SEGMENTATIONS);
00054 }
|
|
|
00057 {
00058 if(_session == null) _session = openDBSession();
00059
00060 if(_session != null)
00061 handleOpen(DB_SEGMENTATIONS);
00062 }
|
|
|
00065 {
00066 _tabbedPane.removeAll();
00067 _vxGraphic.clearImage();
00068 _slices.setImageSizes(10000, 500/*_seq.frameSizes().y*/);
00069 _descPanel.clearSegments();
00070
00071 _director.stop();
00072
00073 HxCorba.Constructor constructor =
00074 ServiceRepository.instance().getConstructor();
00075 if(constructor == null) return;
00076
00077 File file = askFilename(SEQ_FILTER, CorbaMediator.instance().hasLocalServer());
00078 if(file == null) return;
00079
00080 try {
00081 _seq = constructor.constructBufferedImageSeq(file.getPath(),BUFF_SIZE+1);
00082 if(_seq == null) {
00083 ErrorStreamArea.println("Image sequence "+file.getName()+" doesn't exist");
00084 return;
00085 }
00086
00087 _seqDisplayer.setSequence(_seq);
00088 _externalPlayer.setSequencePath(file.getPath());
00089
00090 _director = new PlayingDirector(_seq.nrFrames());
00091
00092 FrameNavigatorDisplayer navDisp = new FrameNavigatorDisplayer(_frameNav);
00093 FrameNavigatorDisplayer vxDisp = new FrameNavigatorDisplayer(_vxGraphic);
00094 FrameNavigatorDisplayer slicDisp = new FrameNavigatorDisplayer(_slices);
00095
00096 _director.addPlayingObserver(_seqDisplayer);
00097 _director.addPlayingObserver(makeFrameStatusDisplayer());
00098 _director.addPlayingObserver(navDisp.makeObserver(_director));
00099 _director.addPlayingObserver(_externalPlayer);
00100
00101 handlePlayMode(_playMode);
00102
00103 //Set Director to enable buttons
00104 setDirector(_director);
00105
00106 _segMode = segMode;
00107
00108
00109 if(segMode == HX_SEGMENTATIONS) {
00110 int dot = file.getPath().lastIndexOf('.');
00111 _baseFilename = file.getPath().substring(0, dot+1);
00112 }
00113 else if(segMode == DB_SEGMENTATIONS) {
00114 _baseFilename = nameFromFile(file);
00115 }
00116
00117 if(segMode != NO_SEGMENTATIONS) {
00118 _director.addPlayingObserver(vxDisp.makeObserver(_director));
00119
00120 String[] segList = demoSegmentations();
00121 for(int i=0; i<segList.length; i++) {
00122 HxCorba.VxSegmentation seg = openSegmentation(segList[i]);
00123 if(seg != null) {
00124 updateVisualization(seg, segList[i]);
00125 if(segList[i].equals("blocks")) {
00126 _slices.updateSegs(seg, Color.blue, file);
00127 _director.addPlayingObserver(slicDisp.makeObserver(_director));
00128 }
00129 }
00130 }
00131 }
00132
00133 _director.setCurrentFrame(0);
00134 }
00135 catch(Exception e) {
00136 ErrorStreamArea.println(" "+e);
00137 e.printStackTrace();
00138 }
00139 }
|
|
|
00142 {
00143 if(_segMode == NO_SEGMENTATIONS) {
00144 ErrorStreamArea.println("Open some segmentations first.");
00145 return;
00146 }
00147
00148 String segName = JOptionPane.showInputDialog("Segmentation:");
00149 if(segName == null) return;
00150
00151 HxCorba.VxSegmentation seg = openSegmentation(segName);
00152 if(seg != null) updateVisualization(seg, segName);
00153 }
|
|
|
This function is called by _bmenu if the associated menu item is selected.
00160 {
00161 _externalPlayer.close();
00162
00163 try {
00164 if(_session != null) _session.close();
00165 }
00166 catch(Exception e) {
00167 ErrorStreamArea.println(" "+e);
00168 }
00169 quitSample();
00170 }
|
|
|
00173 {
00174 PlayMode playMode = PlayMode.getMode(mode);
00175 if(playMode == null)
00176 OutputStreamArea.println("Unknown PlayMode: "+mode);
00177 else
00178 handlePlayMode(playMode);
00179 }
|
|
|
00182 {
00183 _playMode = mode;
00184 if(_seq == null) return;
00185
00186 _externalPlayer.setMode(externalPlayerMode(mode));
00187 _director.setRealTime(isRealTimeMode(mode));
00188
00189 _seqDisplayer.setThreadedMode(mode == PlayMode.THREADED);
00190 _seqDisplayer.setEnabled(mode != PlayMode.EXTERNAL);
00191
00192 _director.showCurrentFrame();
00193 }
|
|
|
00196 {
00197 if(scale <= 0.0) {
00198 ErrorStreamArea.println("Scale must be bigger than 0.0");
00199 return;
00200 }
00201
00202 _seqDisplayer.setScale(scale);
00203 }
|
|
|
00206 {
00207 _vxGraphic.setShowGrid(show);
00208 }
|
|
|
00211 {
00212 _windowMode = PlayerWindow.SINGLE_MODE;
00213 for(int i=0; i<_windows.size(); i++)
00214 ((PlayerWindow)_windows.elementAt(i)).setMode(_windowMode);
00215
00216 JFrame parent = getParentFrame();
00217 changeContent(getParentFrame().getContentPane(), _fixedPanel);
00218 _bmenu.remove(_mdiWindowMenu);
00219 _bmenu.add(_singleWindowMenu);
00220 _bmenu.revalidate();
00221 _bmenu.repaint();
00222 }
|
|
|
00225 {
00226 _windowMode = PlayerWindow.MDI_MODE;
00227 for(int i=0; i<_windows.size(); i++)
00228 ((PlayerWindow)_windows.elementAt(i)).setMode(_windowMode);
00229
00230 JFrame parent = getParentFrame();
00231 changeContent(getParentFrame().getContentPane(), _desktop);
00232
00233 _bmenu.remove(_singleWindowMenu);
00234 _bmenu.add(_mdiWindowMenu);
00235 _bmenu.revalidate();
00236 _bmenu.repaint();
00237 }
|
|
|
00240 {
00241 CardLayout cl = (CardLayout)(_timeLinePanel.getLayout());
00242 cl.show(_timeLinePanel, mode);
00243 }
|
|
|
00246 {
00247 if(_segMode != DB_SEGMENTATIONS) {
00248 ErrorStreamArea.println("You must open a segmentation from DB to perform queries.");
00249 return;
00250 }
00251
00252 PlayerQueryPanel qPanel = new PlayerQueryPanel(_baseFilename);
00253 qPanel.setVideoName(_baseFilename);
00254 addExtraWindow(qPanel, "Query");
00255 }
|
|
||||||||||||||||
|
Initialization.
Reimplemented from SampleApp.
00267 {
00268 ErrorStreamArea err = new ErrorStreamArea(parent, 10, 80);
00269
00270 OutputStreamArea.println("Initializing CorbaMediator...");
00271 initCorbaMediator(args);
00272 setAdvancedLookupManager(parent);
00273
00274 OutputStreamArea.println("Building "+getSampleName()+" GUI...");
00275
00276 // Sequence viewer
00277
00278 _seqDisplayer = new SequenceDisplayer(BUFF_SIZE);
00279 //_viewer = ViewerFactory.makeBasicViewer();
00280 Image logo = Toolkit.getDefaultToolkit().createImage(CorbaSamplesRes.get_mia());
00281 _seqDisplayer.setStillImage(new CanvasCorbaImage(new JavaImageData(logo)));
00282
00283 JPanel seqFixedPanel = new JPanel(new BorderLayout());
00284 JInternalFrame seqFrame = new JInternalFrame("Sequence", true, false, true, true);
00285 _windows.add(new PlayerWindow(_seqDisplayer.getViewer(), seqFrame, seqFixedPanel));
00286
00287 // FrameNavigator
00288
00289 _frameNav = new SimpleFrameNavigator();
00290 JPanel ctrlPanel = getPlayingControlsPanel();
00291
00292
00293 JPanel navComponent = new JPanel(new BorderLayout());
00294 navComponent.add(_frameNav, BorderLayout.CENTER);
00295 navComponent.add(ctrlPanel, BorderLayout.SOUTH);
00296
00297 JPanel navFixedPanel = new JPanel(new BorderLayout());
00298 JInternalFrame navFrame = new JInternalFrame("Frame Navigator", true, false, false, true);
00299 _windows.add(new PlayerWindow(navComponent, navFrame, navFixedPanel));
00300
00301 // Segment list tables
00302
00303 _tabbedPane = new JTabbedPane();
00304
00305 JPanel tabFixedPanel = new JPanel(new BorderLayout());
00306 JInternalFrame tabFrame = new JInternalFrame("Segmentations", true, false, true, true);
00307 tabFrame.setBackground(tabFixedPanel.getBackground());
00308 _windows.add(new PlayerWindow(_tabbedPane, tabFrame, tabFixedPanel));
00309
00310 // Segment descriptions
00311
00312 _descPanel = new SegmentDescriptionPanel();
00313 JScrollPane descScroll = new JScrollPane(_descPanel);
00314
00315 JPanel descFixedPanel = new JPanel(new BorderLayout());
00316 JInternalFrame descFrame = new JInternalFrame("Segment Descriptions", true, false, false, true);
00317 _windows.add(new PlayerWindow(descScroll, descFrame, descFixedPanel));
00318 //_windows.add(new PlayerWindow(new JButton("b"), descFrame, descFixedPanel));
00319
00320 // Segment graphic
00321
00322 _vxGraphic = new SegmentGraphicsPanel(null, 3000, 200);
00323 JScrollPane graphicScroll = new JScrollPane(_vxGraphic);
00324
00325 JPanel grFixedPanel = new JPanel(new BorderLayout());
00326 JInternalFrame grFrame = new JInternalFrame("Segments Graphic", true, false, true, true);
00327 _windows.add(new PlayerWindow(graphicScroll, grFrame, grFixedPanel));
00328
00329 // Slices
00330
00331 _slices = new SlicesPanel();
00332 JScrollPane slicesScroll = new JScrollPane(_slices);
00333
00334 JPanel sliFixedPanel = new JPanel(new BorderLayout());
00335 JInternalFrame sliFrame = new JInternalFrame("Slices", true, false, true, true);
00336 _windows.add(new PlayerWindow(slicesScroll, sliFrame, sliFixedPanel));
00337
00338
00339 // Create desktop
00340
00341 _desktop = new JDesktopPane();
00342 //_desktop.putClientProperty("JDesktopPane.dragMode", "outline");
00343
00344 seqFrame.setLocation(0, 0);
00345 navFrame.setLocation(0,375);
00346 navFrame.setSize(715,100);
00347 tabFrame.setLocation(385,0);
00348 tabFrame.setSize(600,330);
00349 descFrame.setLocation(265,265);
00350 descFrame.setSize(725,175);
00351 grFrame.setLocation(0,475);
00352 grFrame.setSize(1000,205);
00353 sliFrame.setSize(825,335);
00354 sliFrame.setLocation(85,345);
00355
00356 JInternalFrame[] frames = {seqFrame, tabFrame, sliFrame,
00357 grFrame, descFrame, navFrame };
00358 for(int i=0; i<frames.length; i++) {
00359 _desktop.add(frames[i]);
00360 frames[i].setVisible(true);
00361 }
00362
00363 // Create fixed panel
00364
00365 _fixedPanel = new JPanel();
00366 _fixedPanel.setLayout(new BoxLayout(_fixedPanel, BoxLayout.Y_AXIS));
00367 //_fixedPanel = new JPanel(new GridBagLayout());
00368
00369 JSplitPane viewSP = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
00370 seqFixedPanel, tabFixedPanel);
00371 viewSP.setOneTouchExpandable(true);
00372 viewSP.setDividerLocation(378);
00373 JPanel spPanel = new JPanel(new BorderLayout());
00374 spPanel.add(viewSP, BorderLayout.CENTER);
00375 spPanel.setPreferredSize(tabFrame.getSize());
00376
00377 navFixedPanel.setPreferredSize(navFrame.getSize());
00378 navFixedPanel.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
00379 descFixedPanel.setPreferredSize(descFrame.getSize());
00380 descFixedPanel.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
00381
00382 String graphicId = "Boundaries";
00383 String slicesId = "Slices";
00384 _timeLinePanel = new JPanel(new CardLayout());
00385 _timeLinePanel.add(grFixedPanel, graphicId);
00386 _timeLinePanel.add(sliFixedPanel, slicesId);
00387 _timeLinePanel.setBorder(BorderFactory.createEmptyBorder(3,3,3,3));
00388 _timeLinePanel.setPreferredSize(grFrame.getSize());
00389
00390 _fixedPanel.add(spPanel);
00391 _fixedPanel.add(navFixedPanel);
00392 _fixedPanel.add(descFixedPanel);
00393 _fixedPanel.add(_timeLinePanel);
00394
00395
00396 // Create ExtMenuBar:
00397
00398 _bmenu = new ExtMenuBar(this);
00399 _bmenu.addMenu("File");
00400 _bmenu.addMenuItem("File", "Open Sequence", "handleOpenSequence");
00401 _bmenu.addMenuItem("File", "Open Segmentations", "handleOpenSegmentations");
00402 _bmenu.addMenuItem("File", "Open Segmentations (DB)", "handleOpenDBSegmentations");
00403 _bmenu.addSeparator("File");
00404 _bmenu.addMenuItem("File", "Add Segmentation", "handleAddSegmentation");
00405 _bmenu.addSeparator("File");
00406 _bmenu.addMenuItem("File", "Exit", "handleExit");
00407
00408 _bmenu.addMenu("Preferences");
00409 _bmenu.addSubMenu("Preferences", "Play mode");
00410 _bmenu.addGroupMenu("Play mode", PlayMode.getNames(), "handlePlayMode",
00411 _playMode.toString());
00412 _bmenu.addMenuItem("Preferences", "Scale Display",
00413 new HxJava.Util.CallableMethod("handleScaleDisplay",
00414 "double", "scale", "double"));
00415 _bmenu.addCheckBoxItem("Preferences", "Show Seg. Graphic Grid",
00416 "handleShowGrid", false);
00417
00418 addVisualizationOptions(_bmenu, "Preferences");
00419
00420 _bmenu.addMenu("Tools");
00421 _bmenu.addMenuItem("Tools", "Query Segmentations", "handleQuery");
00422
00423 _mdiWindowMenu = _bmenu.addMenu("Windows Mdi");
00424 ButtonGroup windowGroup = new ButtonGroup();
00425 for(int i=0; i<frames.length; i++)
00426 _mdiWindowMenu.add(makeWindowMenuItem(frames[i], windowGroup));
00427 _bmenu.addSeparator("Windows Mdi");
00428 _bmenu.addMenuItem("Windows Mdi", "Single Window", "handleSingleWindow");
00429
00430 _singleWindowMenu = _bmenu.addMenu("Windows Single");
00431 String[] vmodes = { graphicId, slicesId };
00432 _bmenu.addSubMenu("Windows Single", "Time line mode");
00433 _bmenu.addGroupMenu("Time line mode", vmodes, "handleTimeLineMode", vmodes[0]);
00434 _bmenu.addSeparator("Windows Single");
00435 _bmenu.addMenuItem("Windows Single", "Multiple Windows", "handleMultWindows");
00436
00437 _mdiWindowMenu.setText("Windows");
00438 _singleWindowMenu.setText("Windows");
00439 _bmenu.remove(_mdiWindowMenu);
00440
00441 parent.setJMenuBar(_bmenu);
00442 handleMultWindows();
00443
00444 seqFrame.pack();
00445
00446 parent.setSize(1000, 730);
00447
00448 OutputStreamArea.println("Done.");
00449 return true;
00450 }
|
|
|
Reimplemented from CorbaSampleApp.
00453 {
00454 return getSampleProperty("VideoDir", ".");
00455 }
|
|
||||||||||||
|
Redefine addVisualizationOptions to add visualization specific options to the menu bar.
Reimplemented in VxPlayerApp.
00461 {
00462 }
|
|
|
Redefine demoSegmentations to specify which segmentations are loaded initially.
Reimplemented in VxPlayerApp.
00468 {
00469 return new String[] { "blocks", "scenes" };
00470 }
|
|
|
Redefine getVisualization to specify how a segmentation is displayed.
Reimplemented in VxPlayerApp.
00475 {
00476 return null;
00477 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001