Package gov.nasa.arc.mct.fastplot.bridge

Examples of gov.nasa.arc.mct.fastplot.bridge.PlotView$Builder


  /**
   * Create the plot from persisted settings if available. Otherwise, create a default plot.
   */
  static PlotView createPlot(PlotSettings settings, long currentTime, PlotViewManifestation parentManifestation,
                         int numberOfSubPlots, PlotView oldPlot, AbbreviatingPlotLabelingAlgorithm plotLabelingAlgorithm, String viewStateTimeSystem) {   
        PlotView thePlot;
       
        // Insure we always have at least one plot.
        numberOfSubPlots = settings.getAxisOrientationSetting() == AxisOrientationSetting.Z_AXIS_AS_TIME ?
            1 : Math.max(1,numberOfSubPlots);
       
    if (!settings.isNull()) {
      if (settings.getTimeSystemSetting() == null) {
        settings.setTimeSystemSetting(viewStateTimeSystem);
      }

      // The plot has persisted settings so apply them.
      if (!settings.getPinTimeAxis()) {
        adjustPlotStartAndEndTimeToMatchCurrentTime(settings, currentTime);
      }
      thePlot = createPlotFromSettings(settings, numberOfSubPlots, plotLabelingAlgorithm);
    } else {
      // Setup a default plot to view while the user is configuring it.
      thePlot = new PlotView.Builder(PlotterPlot.class).
             numberOfSubPlots(numberOfSubPlots).
                   plotLabelingAlgorithm(plotLabelingAlgorithm).build();
    }  
    thePlot.setManifestation(parentManifestation);
    thePlot.setPlotLabelingAlgorithm(plotLabelingAlgorithm);
     
    assert thePlot!=null : "Plot labeling algorithm should NOT be NULL at this point.";
   
    logger.debug("plotLabelingAlgorithm.getPanelContextTitleList().size()="
        + plotLabelingAlgorithm.getPanelContextTitleList().size()
        + ", plotLabelingAlgorithm.getCanvasContextTitleList().size()=" + plotLabelingAlgorithm.getCanvasContextTitleList().size());
   
    // Copy across feed mapping from old plot, unless structure is different
    if (oldPlot!=null && oldPlot.subPlots.size() == numberOfSubPlots) {
      for (String dataSetName: oldPlot.dataSetNameToSubGroupMap.keySet()) {
        String nameLower = dataSetName.toLowerCase();
        for(AbstractPlottingPackage plot : oldPlot.dataSetNameToSubGroupMap.get(dataSetName)) {
          int indexInOldPlot = oldPlot.subPlots.indexOf(plot);
          thePlot.addDataSet(indexInOldPlot, dataSetName, oldPlot.dataSetNameToDisplayMap.get(nameLower))
        }
      }
    }
    return thePlot;
  }
View Full Code Here


   */
  static PlotView createPlotFromSettings(PlotConfiguration settings, int numberOfSubPlots, AbbreviatingPlotLabelingAlgorithm plotLabelingAlgorithm) {     
      Class<? extends AbstractPlottingPackage> plottingPackage =
        settings.getAxisOrientationSetting() != AxisOrientationSetting.Z_AXIS_AS_TIME ?
            PlotterPlot.class : ScatterPlot.class;
      PlotView newPlot = new PlotView.Builder(plottingPackage)
      .plotSettings(settings)
      .numberOfSubPlots(numberOfSubPlots)
      .plotLabelingAlgorithm(plotLabelingAlgorithm)
      .build();
     
      newPlot.setPlotLabelingAlgorithm(plotLabelingAlgorithm);
     
      return newPlot;
  }
View Full Code Here

      // for coverage.
      originalPlotMan.updateMonitoredGUI();
      originalPlotMan.updateMonitoredGUI(new AddChildEvent(nowPlus, feed1Component));
      originalPlotMan.updateMonitoredGUI(new RemoveChildEvent(nowPlus, feed1Component));
     
      PlotView thePlotView = originalPlotMan.getPlot();     
      PlotConfiguration settings = new PlotPersistenceHandler(originalPlotMan).loadPlotSettingsFromPersistance();
      PlotView secondPlotView =  PlotViewFactory.createPlotFromSettings(settings, 1, plotLabelingAlgorithm);
     
      // Should be different plots.
      Assert.assertNotSame(thePlotView, secondPlotView);
     
      originalPlotMan.setupPlot(new PlotSettings(AxisOrientationSetting.X_AXIS_AS_TIME,
View Full Code Here

   
  @Test
  public void testSetupChart() {
    TestersComponent component = new TestersComponent("x");
    PlotViewManifestation panel = new PlotViewManifestation(component, new ViewInfo(PlotViewManifestation.class,"",ViewType.OBJECT));
    PlotView originalPlot = new PlotView.Builder(ShellPlotPackageImplementation.class).build();
   
    panel.setPlot(originalPlot);
   
    GregorianCalendar minTime = new GregorianCalendar();
    GregorianCalendar maxTime = new GregorianCalendar();
View Full Code Here

      @Override
      public ExtendedProperties getViewProperties() {
        return viewProps;
      }
    };
    PlotView thePlot = new PlotView.Builder(PlotterPlot.class).build();
   
    AbbreviatingPlotLabelingAlgorithm plotLabelingAlgorithm = new AbbreviatingPlotLabelingAlgorithm();
    final String baseDisplayName = "DSCU PUI1";
    plotLabelingAlgorithm.setCanvasPanelTitle("PUI123");
    plotLabelingAlgorithm.setPanelOrWindowTitle("DSCU");
   
    panel.setPlot(thePlot);
    thePlot.setManifestation(panel);
    Assert.assertEquals(panel.getPlot(), thePlot);
   
    panel.getPlot().addDataSet(baseDisplayName);
   
    List<Map<String, String>> dataSetAUpdateFromFeed = new ArrayList<Map<String, String>>();
View Full Code Here

    // if two objects are equal, then their hashCode values must be equal as well
    PlotViewManifestation panelA = new PlotViewManifestation(mockComponent, new ViewInfo(PlotViewManifestation.class,"",ViewType.OBJECT));
    PlotViewManifestation panelPlotEqual = new PlotViewManifestation(mockComponent, new ViewInfo(PlotViewManifestation.class,"",ViewType.OBJECT));
    PlotViewManifestation panelNotEqualA = new PlotViewManifestation(mockComponent, new ViewInfo(PlotViewManifestation.class,"",ViewType.OBJECT));
   
    PlotView panelAsPlot = new PlotView.Builder(ShellPlotPackageImplementation.class).build();
    PlotView notPanelAsPlot = new PlotView.Builder(ShellPlotPackageImplementation.class).build();
   
    panelA.setPlot(panelAsPlot);
    panelPlotEqual.setPlot(panelAsPlot);
    panelNotEqualA.setPlot(notPanelAsPlot);
   
View Full Code Here

    PlotSettings settings = new PlotSettings();
    settings.setMinTime(0);
    settings.setMaxTime(100);
    settings.setXAxisMaximumLocation(XAxisMaximumLocationSetting.MAXIMUM_AT_RIGHT);
   
    PlotView plotMaxAtRight = new PlotView.Builder(PlotterPlot.class).plotSettings(settings).build();
   
   
    Assert.assertEquals(plotMaxAtRight.getMaxTime(), 100);
    Assert.assertEquals(plotMaxAtRight.getMinTime(), 0);
   
    settings.setXAxisMaximumLocation(XAxisMaximumLocationSetting.MAXIMUM_AT_LEFT);
   
    PlotView plotMaxAtLeft = new PlotView.Builder(PlotterPlot.class).plotSettings(settings).build();
   
    Assert.assertEquals(plotMaxAtLeft.getMaxTime(), 100);
    Assert.assertEquals(plotMaxAtLeft.getMinTime(), 0);
   
    settings.setAxisOrientationSetting(AxisOrientationSetting.Y_AXIS_AS_TIME);
    settings.setYAxisMaximumLocation(YAxisMaximumLocationSetting.MAXIMUM_AT_TOP);
    settings.setTimeAxisSubsequentSetting(TimeAxisSubsequentBoundsSetting.SCRUNCH);
   
    PlotView plotTimeOnYMaxAtTop = new PlotView.Builder(PlotterPlot.class).plotSettings(settings).build();
   
    Assert.assertEquals(plotTimeOnYMaxAtTop.getMaxTime(), 100);
    Assert.assertEquals(plotTimeOnYMaxAtTop.getMinTime(), 0);

    settings.setYAxisMaximumLocation(YAxisMaximumLocationSetting.MAXIMUM_AT_BOTTOM);
   
    PlotView plotTimeOnYMaxAtBottom = new PlotView.Builder(PlotterPlot.class).plotSettings(settings).build();
   
    Assert.assertEquals(plotTimeOnYMaxAtBottom.getMaxTime(), 100);
    Assert.assertEquals(plotTimeOnYMaxAtBottom.getMinTime(), 0)
  }
View Full Code Here

  }
 
  @Test
  public void testScatterPlotMatchesSettingsViaPlotView() {
    PlotSettings s = new PlotSettings();
    PlotView basePlot = new PlotView.Builder(ScatterPlot.class).plotSettings(s).build();   
    Assert.assertTrue(basePlot.plotMatchesSetting(s));
  }
View Full Code Here

 
  @Test
  public void testGetPlotAbstraction() {
    PlotSettings s = new PlotSettings();
    PlotView basePlot = new PlotView.Builder(ScatterPlot.class).plotSettings(s).build();   
    ScatterPlot p = new ScatterPlot();
    p.setPlotAbstraction(basePlot);
    Assert.assertEquals(p.getPlotAbstraction(), basePlot);

    // Should also pull recognize PlotAbstraction from constructor
View Full Code Here

    return !feedProvidersRef.get().isEmpty();
  }
 
  void assignFeedsToSubPlots() {
    assert feedsToPlot !=null : "Feeds to plot must be defined";
    PlotView plot = plotViewManifestation.getPlot();

    if (plot.getAxisOrientationSetting() == AxisOrientationSetting.Z_AXIS_AS_TIME) {
      int count = 0;
      // If we are non-time non-time, supply independent variable first
      for (Collection<FeedProvider> feedsForSubPlot : feedsToPlot) {
        String independent = null;
        for (FeedProvider fp : feedsForSubPlot) {
          String id = fp.getSubscriptionId();
          if (independent == null) {
            independent = id;
          } else {
            id = independent + PlotConstants.NON_TIME_FEED_SEPARATOR + id;
          }
          if (count < PlotConstants.MAX_NUMBER_OF_DATA_ITEMS_ON_A_PLOT) {
            AbstractComponent comp = components.get(fp);
            AbstractLegendEntry legendEntry = (AbstractLegendEntry) LegendEntryView.VIEW_INFO.createView(comp);
            plot.addDataSet(0, id, legendEntry);
            count++;
          }
        }
      }
    } else {
      // Add feeds to the plot.
      int subPlotNumber = 0;
      for (Collection<FeedProvider> feedsForSubPlot : feedsToPlot) {
        assert feedsForSubPlot != null;
        int numberOfItemsOnSubPlot = 0;
        for (FeedProvider fp : feedsForSubPlot) {
          if (numberOfItemsOnSubPlot < PlotConstants.MAX_NUMBER_OF_DATA_ITEMS_ON_A_PLOT) {
            plot.addDataSet(subPlotNumber, fp.getSubscriptionId(),
                fp.getLegendText());
            numberOfItemsOnSubPlot++;
          }
        }
        subPlotNumber++;
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.fastplot.bridge.PlotView$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.