list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

Routes And Locations

This example has been built for the Comparing Modeling Approaches Workshop

Example

// RoutesAndLocations.ump  Class diagram represented in Umple
//
// Author: Timothy C. Lethbridge

namespace routesAndLocations;

/* 

This file describes reusable model elements that are used in the 
bCMS Crisis Management System. It is necessary to have a rudimentary
Graphical Information System such as described in this submodel as part
of bCMS in order to plan routes and to track where crises are. This file
has the necessary classes.

*/

/* 
 * A CityMap contains the precompiled streets and landmarks
 * This must be read in from the database on system initialization
 */
class CityMap {
  singleton;
  0..1 -> * Landmark fireStn;
  0..1 -> * Landmark policeStn;
  0..1 -> * Landmark otherLm;
  0..1 -> * NamedRoad;
}
  
/*
 * A Location describes a place such as an intersection, landmark, bend in a road, etc.
 */
class Location {
  Float lattitude;
  Float longitude;
}

class Landmark {
  isA Location;
  
  // Name of landmark (name of fire station, business, address)
  description;  
  landmarkType { fireStation { } policeStation { } touristDestination { } other { } } 
}

/*
 * RoadNodes are places where RoadSegments connect. A node with just one incoming
 * and one outgoing is used to handle changes in direction, e.g. as a road turns
 * a corner, changes in speed limit, changes in number of lanes, and other factors.
 * When there is more than one outgoing or incoming, the node represents points
 * where traffic flow can split and join.
 * A crossroads is one type. Entry into a roundabout would be another,
 * Highway merges and exits are other kinds as are parking lots and entries
 * into or out of fire stations..
 *
 * RoadSegments leaving the city lead to no RoadNode
 * RoadSegments entering the city come from no RoadNode
 */
class RoadNode {
  Integer id;
   // Could be at a landmark
  0..1 -> 1 Location nodeLocation;
  0..1 end -- * RoadSegment incomingRoads;
  0..1 start -- * RoadSegment outgoingRoads;
}

class Intersection {
  isA RoadNode;
  // illegal, but possible turns for police and fire
  0..1 -> * Turn illegalTurns;
  // Impossible turns , e.g. because of barriers, turning radius
  0..1 -> * Turn impossibleTurns;
}

/* 
 * Turns are used to model illegal turns, e.g. turning left
 * when there is 'no left turn' allowed, or 'no U turn' allowed.
 */
class Turn {
  RoadSegment turnFrom;
  RoadSegment turnTo;
}

/*
 * A named road might have the name of a street, the number of
 * a highway, etc. A RoadSegment can have several names because
 * for example, sometimes several numbered highways share a segment
 */
class NamedRoad {
  name;
  
  // Most roads have two directions, e.g. North and South
  direction;  
  
  // Listed in order
  * -- 1..* RoadSegment segments; 
}
  
/*
 * A RoadSegment represents a section of road on which a vehicle can drive.
 * The ends of each segment have been modeled using RoadNodes.
 * Note that distance can be calculated from the speed limit, and locations
 */
class RoadSegment {
  Integer speedLimit;
  
  // Indicator of real-time congestion; 0=blocked
  Integer currentReportedSpeed; 
  Integer lanes;
  
  // The following are used to determine addresses
  Integer streetNumberAtStart;
  Integer streetNumberAtEnd;
  * -> * RoadSegment inverseSegments;
}

/* 
 * A route is a plan to get from one location to another
 * It is built by algorithms that traverse the nodes and arcs of the map
 * taking into account speed, congestion, etc.
 */
class Route {
   // Ordered list of segments
   0..1 -> 1..* RoadSegment;

   // Time seconds at current flow speeds
   Integer estimatedTime; 
}

      

Load the above code into UmpleOnline