/// <summary> /// General method to obtain a drawing object for an entity, looks if a /// object exists for that entity, if not one is created. Therefore, it is checked if /// method for object creation has been speciefied for the type of entity /// and calls the corresponding method, otherwise throughs an exception. /// </summary> /// <param name="entity">Entity for which drawing object is required</param> /// <returns>Drawing object for entity</returns> public DrawingObject DrawingObjectPerEntity(Entity entity) { // if entity drawing object hasn't been created // the corresponding method is looked up if (!_drawingObjectPerEntity.ContainsKey(entity)) { // in case no method to create a drawing object for the entity is provided an // exception is thrown if (!EntityVisualizationObjectCreatingMethodsPerType.ContainsKey(entity.GetType())) { throw new InvalidOperationException(String.Format("Creation of Drawing Object for Entity {0} is not provided", entity.ToString())); } // create the drawing object DrawingObject newDrawingObject = EntityVisualizationObjectCreatingMethodsPerType[entity.GetType()](entity); // add drawing obecjt to system, has to be set to visual manually by user DrawingSystem.AddObject(newDrawingObject); // drawing object is stored in the dictionary _drawingObjectPerEntity.Add(entity, newDrawingObject); } // end if // the right key is now in the dictionary return(_drawingObjectPerEntity[entity]); } // end of DrawingObjectPerEntity
//-------------------------------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------------------------------- #region Constructor /// <summary> /// Basic constructor, assigns visualization methods to dictionaries for event and activity types /// </summary> /// <param name="drawingSystem">Drawing system used for visualization</param> /// <param name="position">Position of control unit visualization on drawing system</param> /// <param name="size">Size of control unit visualization on drawing system</param> /// <param name="personSize">Size in which persons are visualized</param> public WPFVisualizationEngineHealthCareDepartmentControlUnit(DrawingOnCoordinateSystem drawingSystem, Point position, Size size, double personSize) : base(drawingSystem) { _personSize = personSize; EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityPatient), CreatePatient); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityDoctor), CreateDoctor); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityNurse), CreateNurse); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityTreatmentFacility), CreateTreatmentFacility); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityMultiplePatientTreatmentFacility), CreateMultiplePatientTreatmentFacility); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityWaitingArea), CreateWaitingRoom); HoldingEntitiesVisualizationMethods.Add(typeof(EntityWaitingArea), DrawHoldingEntity); HoldingEntitiesVisualizationMethods.Add(typeof(EntityMultiplePatientTreatmentFacility), DrawHoldingEntity); ActivityEndEventVisualizationMethods.Add(typeof(ActivityHealthCareAction <T>), HealthCareActionEnd); ActivityStartEventVisualizationMethods.Add(typeof(ActivityHealthCareAction <T>), HealthCareActionStart); ActivityEndEventVisualizationMethods.Add(typeof(ActivityWaitInFacility), WaitInFacilityEnd); ActivityStartEventVisualizationMethods.Add(typeof(ActivityWaitInFacility), WaitInFacilityStart); EventStandaloneDrawingMethods.Add(typeof(EventEmergencyPatientLeave), EventPatientLeave); EventStandaloneDrawingMethods.Add(typeof(EventOutpatientPatientLeave), EventPatientLeave); EventStandaloneDrawingMethods.Add(typeof(EventStaffLeave), EventLeavingStaff); _position = position; _size = size; } // end of BaseWPFControlUnitVisualizationEngine
//-------------------------------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------------------------------- #region Constructor /// <summary> /// Basic constructor, sets entity drawing object methods and event and activity visualization methods /// </summary> /// <param name="drawingSystem"></param> public QueueControlVisualizationEngine(DrawingOnCoordinateSystem drawingSystem) : base(drawingSystem) { EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityClient), CreateClient); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityQueue), CreateQueue); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityServer), CreateServer); ActivityEndEventVisualizationMethods.Add(typeof(ActivityGetServed), GetServedEnd); ActivityStartEventVisualizationMethods.Add(typeof(ActivityGetServed), GetServedStart); HoldingEntitiesVisualizationMethods.Add(typeof(EntityQueue), DrawHoldingEntity); } // end of BaseWPFControlUnitVisualizationEngine
//-------------------------------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------------------------------- #region Constructor /// <summary> /// Basic constructor, assigns visualization methods to dictionaries for event and activity types /// </summary> /// <param name="drawingSystem">Drawing system used for visualization</param> /// <param name="position">Position of control unit visualization on drawing system</param> /// <param name="size">Size of control unit visualization on drawing system</param> /// <param name="personSize">Size in which persons are visualized</param> public WPFVisualizationHealthCareOrganizationalUnit(DrawingOnCoordinateSystem drawingSystem, double personSize, WPFVisualizationEngineHealthCareDepartmentControlUnit <T> parentDepartmentVisualization) : base(drawingSystem) { _personSize = personSize; EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityPatient), CreatePatient); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityDoctor), CreateDoctor); EntityVisualizationObjectCreatingMethodsPerType.Add(typeof(EntityNurse), CreateNurse); HoldingEntitiesVisualizationMethods.Add(typeof(EntityMultiplePatientTreatmentFacility), DrawHoldingEntity); ActivityEndEventVisualizationMethods.Add(typeof(ActivityHealthCareAction <T>), HealthCareActionEnd); ActivityStartEventVisualizationMethods.Add(typeof(ActivityHealthCareAction <T>), HealthCareActionStart); ActivityEndEventVisualizationMethods.Add(typeof(ActivityWaitInFacility), WaitInFacilityEnd); ActivityStartEventVisualizationMethods.Add(typeof(ActivityWaitInFacility), WaitInFacilityStart); EventStandaloneDrawingMethods.Add(typeof(EventStaffLeave), EventLeavingStaff); _parentDepartmentVisaulization = parentDepartmentVisualization; } // end of BaseWPFControlUnitVisualizationEngine