Class Mover

    • Constructor Detail

      • Mover

        public Mover​(ModelElement parent)
        Creates a Mover with the default position within its spatial model. The spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown
        Parameters:
        parent -
      • Mover

        public Mover​(ModelElement parent,
                     java.lang.String name)
        Creates a Mover with the default position within its spatial model. The spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown
        Parameters:
        parent -
        name -
      • Mover

        public Mover​(ModelElement parent,
                     CoordinateIfc coordinate)
        Creates a Mover at the given coordinate within its spatial model. The spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown
        Parameters:
        parent -
        coordinate -
      • Mover

        public Mover​(ModelElement parent,
                     java.lang.String name,
                     SpatialModel spatialModel)
        Creates a Mover with the default position within the given spatial model. If the supplied spatial model is null the spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown
        Parameters:
        parent -
        name -
        spatialModel -
      • Mover

        public Mover​(ModelElement parent,
                     SpatialModel spatialModel)
        Creates a Mover with the default position within the given spatial model. If the supplied spatial model is null the spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown
        Parameters:
        parent -
        spatialModel -
      • Mover

        public Mover​(ModelElement parent,
                     java.lang.String name,
                     SpatialModel spatialModel,
                     CoordinateIfc coordinate)
        Creates a Mover with the given coordinates within the given spatial model. If the supplied spatial model is null the spatial model of the parent is used as the spatial model of this object. If the parent does not have a spatial model (i.e. getSpatialModel() == null), then an IllegalArgumentException is thrown
        Parameters:
        parent -
        name -
        spatialModel -
        coordinate -
    • Method Detail

      • travelTo

        public final void travelTo​(CoordinateIfc destination)
        Causes the element to travel from its current position to the coordinates specified. This starts a trip. A trip is a series of movements to move from the current position to the specified coordinates. At the beginning of a trip, trip start observers are notified. If the trip is broken down into movements, then each movement can have its own velocity, distance, and direction (as long as the final movement ends at the destination). If the destination is the same as the current position of the element then no trip is started and no movement occurs, i.e. nothing occurs If the specified coordinates are not in the element's associated spatial model then outsideSpatialModelHandler() is called. The default action is to throw an exception but this can be overridden in outsideSpatialModelHandler().
        Parameters:
        destination - Must not be null