예제 #1
0
  public void addRenderer(String klass, Map<String, String> props, String uniqueId) {
    WaveletViewRenderer renderer = null;
    try {
      renderer = RendererRegistry.findRenderer(klass);
    } catch (Exception ex) {
      LOGGER.error("Cannot find renderer " + klass);
      LOGGER.error("  message: " + ex.getMessage());
    }
    if (renderer == null) {
      return;
    }

    // set the data entity to be rendered and add renderer to viewer
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    Map<String, Object> results =
        ServiceProvider.getRepository().get(new EntityUniqueIdSpecification(uniqueId));
    Object[] objects = results.values().toArray();
    renderer.setData(shell, WaveletViewer.this, objects, false);
    // Put wavelet info on the tool bar
    Wavelet wavelet = (Wavelet) renderer.getRenderedObjects()[0];
    IPlotPolyline waveletPolyline = (IPlotPolyline) renderer.getShapes()[0];
    _legendToolbar.addLabel(wavelet.getDisplayName() + ":");
    _legendToolbar.addColorRectangle(waveletPolyline.getLineColor());
    // set the renderer's model properties
    Model model = renderer.getSettingsModel();
    // Note: if model is null, renderer is TraceSectionRenderer (at least)
    if (model != null) {
      model.unpickle(props);
    }
  }
예제 #2
0
 @Override
 protected void initializeToolBars() {
   // Add the help action to the shared toolbar.
   SharedToolBar sharedToolbar = getSharedToolBar();
   sharedToolbar.addPushButton(new HelpAction("org.geocraft.ui.waveletviewer.WaveletPlot"));
   _legendToolbar = addCustomToolBar();
   _legendToolbar.addLabel("");
 }