Class SpatialNetwork2D

java.lang.Object
sim.portrayal.network.SpatialNetwork2D
All Implemented Interfaces:
Serializable

public class SpatialNetwork2D extends Object implements Serializable
A wrapper used by NetworkPortrayal2D to hold a Network and EITHER a Continuous2D OR a SparseGrid2D (or some other SparseField2D). The Continuous2D/SparseGrid2D specifies the spatial location of the nodes; the Network specifies the edges connecting those nodes.

SpatialNetwork2D can also hold an additional location (another Continuous2D/SparseGrid2D) which might hold the nodes if the first location does not. This allows you to (for example) have the FROM nodes in one field and the TO nodes in another field. You can set this location with setAuxillaryField. Note that this will only work properly if the fields have exactly the same dimensions with respect to how their field portrayals draw them onscreen. As a sanity check: you shouldn't have one field be a Continuous2D and the other be a SparseGrid2D.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • setAuxiliaryField

      public void setAuxiliaryField(SparseField2D f)
    • setAuxillaryField

      public void setAuxillaryField(SparseField2D f)
    • getObjectLocation

      public Double2D getObjectLocation(Object node)
      NOTE this used to be deprecated, but it has now been de-deprecated so as to be consistent with SpatialNetwork3D. This method returns the location of the object as a Double2D regardless of which field it is located in and regardless of whether the field is a Double2D or SparseGrid2D. We may re-deprecate it eventually.
    • getDimensions

      public Double2D getDimensions()
      Deprecated.