Click here to Skip to main content
15,884,177 members
Articles / Multimedia / GDI+

Visual Surveillance Laboratory

Rate me:
Please Sign up or sign in to vote.
4.85/5 (45 votes)
6 Aug 2008Apache8 min read 147.1K   11K   241  
A description of surveillance systems
/*
 * Created by: efi efi.merdler@gmail.com
 * Created: Sunday, April 29, 2007
 */
using System;
using System.Collections.Generic;
using System.Xml;
using Zoombut.VisualSurveillanceLaboratory.OutputSystem;
using Zoombut.VisualSurveillanceLaboratory.Properties;
using Zoombut.VisualSurveillanceSystem.Properties;

namespace Zoombut.VisualSurveillanceLaboratory
{
	public class OutputSystemFactory
	{
		/// <summary>
		/// Singleton instance.
		/// </summary>
		private static OutputSystemFactory instance = new OutputSystemFactory();

		/// <summary>
		/// Holds tracking systems that were found.
		/// </summary>
		private List<IOutputSystem> availableOutputSystems =
			new List<IOutputSystem>();

		/// <summary>
		/// Singleton constructor.
		/// </summary>
		private OutputSystemFactory()
		{
			// Load available tracking systems.
			XmlDocument document = new XmlDocument();
			document.Load(Settings.Default.ConfigFile);

			// Use xml path.
			XmlNodeList result = document.SelectNodes("/Configuration/OutputSystem");
			foreach (XmlNode node in result)
			{
				// Load values.
				String location = node.Attributes["location"].InnerText;
				String className = node.Attributes["class"].InnerText;

				// Create instance.
				IOutputSystem value;
				try
				{
					value =
						(IOutputSystem) Activator.CreateInstanceFrom(location, className).Unwrap();
					availableOutputSystems.Add(value);
				}catch(Exception)
				{
					// Ignore
					//TODO Notify the user.
				}
			}
		}

		/// <summary>
		/// Get singleton instance.
		/// </summary>
		public static OutputSystemFactory GetInstance()
		{
			return instance;
		}

		/// <summary>
		/// Gets the available tracking systems.
		/// </summary>
		/// <value>The available tracking systems.</value>
		public IList<IOutputSystem> AvailableOutputSystems
		{
			get { return availableOutputSystems.AsReadOnly(); }
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Software Developer
Israel Israel
A computer science master student at Bar Ilan University under the supervision of Dr. Gal Kaminka.
Dealing mainly with trajectory mining.

Comments and Discussions