Class ContourPlotTest

java.lang.Object
org.opentrafficsim.draw.graphs.ContourPlotTest
All Implemented Interfaces:
UNITS

public class ContourPlotTest extends Object implements UNITS
Test the non-GUI part of the ContourPlot class.

Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Peter Knoppers
  • Field Details

    • mockedPath

      GraphPath<org.opentrafficsim.kpi.interfaces.LaneData> mockedPath
      Mocked GraphPath.
    • section0

      GraphPath.Section<org.opentrafficsim.kpi.interfaces.LaneData> section0
    • section1

      GraphPath.Section<org.opentrafficsim.kpi.interfaces.LaneData> section1
    • mockedLane0

      org.opentrafficsim.kpi.interfaces.LaneData mockedLane0
    • mockedLane1

      org.opentrafficsim.kpi.interfaces.LaneData mockedLane1
    • mockedSamplerData

      org.opentrafficsim.kpi.sampling.SamplerData mockedSamplerData
    • mockedSimulator

      org.opentrafficsim.core.dsol.OtsSimulatorInterface mockedSimulator
    • lastScheduledEvent

      SimEventInterface<Duration> lastScheduledEvent
  • Constructor Details

    • ContourPlotTest

      public ContourPlotTest()
  • Method Details

    • setUp

      public final void setUp() throws SimRuntimeException, NamingException
      Code common to all contour plot tests.
      Throws:
      SimRuntimeException - if that happens uncaught; this test has failed
      NamingException - on error
    • accelerationContourTest

      public final void accelerationContourTest() throws Exception
      Test the ContourPlotAcceleration.
      Throws:
      Exception - when something goes wrong (should not happen)
    • densityContourTest

      public final void densityContourTest() throws Exception
      Test the ContourPlotDensity.
      Throws:
      Exception - when something goes wrong (should not happen)
    • flowContourTest

      public final void flowContourTest() throws Exception
      Test the ContourPlotFlow.
      Throws:
      Exception - when something goes wrong (should not happen)
    • speedContourTest

      public final void speedContourTest() throws Exception
      Test the SpeedContourPlot.
      Throws:
      Exception - when something goes wrong (should not happen)
    • printMatrix

      static void printMatrix(AbstractContourPlot<?> cp, int fromX, int toX, int fromY, int toY)
      Debugging method.
      Parameters:
      cp - AbstractContourPlot<?>; a contour plot
      fromX - int; lower bound of the x coordinate to print (inclusive)
      toX - int; upper bound of the x coordinate to print (inclusive)
      fromY - int; lower bound of the y coordinate to print (inclusive)
      toY - int; upper bound of the y coordinate to print (inclusive)
    • standardContourTests

      public static void standardContourTests(org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, AbstractContourPlot<?> cp, GraphPath<?> path, double expectedZValue, double expectedZValueWithTraffic) throws Exception
      Test various properties of a ContourPlot that has no observed data added.
      Parameters:
      simulator - OtsSimulatorInterface; the simulator
      cp - AbstractContourPlot<?>; the ContourPlot to test
      path - GraphPath<?>; the path
      expectedZValue - double; the value that getZ and getZValue should return for a valid item when no car has passed
      expectedZValueWithTraffic - double; the value that getZ and getZValue should return a valid item where a car has traveled at constant speed of 50 km/h. Supply Double.NaN if the value varies but differs from the value expected when no car has passed
      Throws:
      Exception - when something goes wrong (should not happen)
    • main

      public static void main(String[] args) throws Exception
      Run the DensityContourPlot stand-alone for profiling.
      Parameters:
      args - String[]; the command line arguments (not used)
      Throws:
      Exception - when something goes wrong (should not happen)