static void Main(string[] args) { Parser.Default.ParseArguments <Options>(args).WithParsed(o => { if (string.IsNullOrEmpty(o.Model)) { Console.Error.WriteLine("Model name is empty?????"); Environment.ExitCode = 1; return; } string modelName = "static_cover_generator.models." + o.Model.First().ToString().ToUpper() + o.Model.Substring(1) + "Model"; Type modelType = Type.GetType(modelName); if (modelType == null) { Console.Error.WriteLine("Couldn't find model " + modelName); Environment.ExitCode = 2; return; } IImageModel im = (IImageModel)Activator.CreateInstance(modelType); im.Init(o.InputImage, o.OutputFile, o.Width, o.Height); im.Process(); }); }
private Dictionary <int, ICommand> commands; // The commands dictionary /// <summary> /// Contructor for ImageController. /// </summary> /// <param name="modal">An ImageModel, to create the ICommands</param> public ImageController(IImageModel modal) { m_modal = modal; // Storing the Modal Of The System commands = new Dictionary <int, ICommand>() // Creating a commands dictionary { { (int)CommandEnum.NewFileCommand, new NewFileCommand(m_modal) } // used the enum }; }
public static IEnumerable <Plane> VisibilityBoundaries(this IImageModel @this) { var vertices = @this.Domain.Vertices; for (var i = 0; i < 4; i++) { var los1 = @this.LineOfSight(vertices[i]); var los2 = @this.LineOfSight(vertices.ElementAtCyclic(i + 1)); yield return(Plane.Parametric(@this.OpticalCenter, los2, los1)); } }
public static Vector3 ReverseProject(this IImageModel @this, Vector2 point, Plane plane) { var ray = @this.Ray(point); if (ray == null) { return(null); } else { return(ray.Value.Intersect(plane)); } }
public static Ray3?Ray(this IImageModel @this, Vector2 imagePoint) { var los = @this.LineOfSight(imagePoint); if (los == null) { return(null); } else { return(new Ray3(@this.OpticalCenter, los)); } }
public static Vector2?StrictlyProject(this IImageModel @this, Vector3 point) { var projection = @this.Project(point); if (projection.IsVisibleOn(@this)) { return(projection); } else { return(null); } }
/// <summary> /// cons't /// </summary> /// <param name="imageModel"> ImageModel (logic of program)</param> public ImageController(IImageModel imageModel) { //Dictionary: key - CommandState , value - command to execute this.commands = new Dictionary <int, ICommand>(); this.m_imageModel = imageModel; //add new file - to command Dictionary commands[(int)CommandStateEnum.NEW_FILE] = new NewFileCommand(m_imageModel); //TODO BOM commands[(int)CommandStateEnum.GET_APP_CONFIG] = new GetAppConfigCommand(); /* * //close handlers * commands[(int)CommandStateEnum.CLOSE] = new CloseHandleCommand(); */ }
/// <summary> /// constructor - init logger, modal,server,controller /// </summary> /// <param name="args">Not used</param> public ImageService(string[] args) { InitializeComponent(); eventSourceName = ConfigurationManager.AppSettings.Get("SourceName"); logName = ConfigurationManager.AppSettings.Get("LogName"); eventLog1 = new System.Diagnostics.EventLog(); if (!System.Diagnostics.EventLog.SourceExists(eventSourceName)) { System.Diagnostics.EventLog.CreateEventSource(eventSourceName, logName); } eventLog1.Source = eventSourceName; eventLog1.Log = logName; m_logging = new LoggingModel(eventLog1); m_imageService = new ImageModel(); c_controller = new ImageController(m_imageService); server = new ImageServer(c_controller, m_logging); IClientHandler ch = new ClientHandler(new ServerController(m_logging, this.server), this.m_logging); tcpServer = new TcpServer(8005, ch); m_logging.MessageRecieved += OnMsg; m_logging.MessageRecieved += tcpServer.NewLogArriaved; Task t = new Task(() => { tcpServer.Start(); }); t.Start(); }
/// <summary> /// Contructor for NewFileCommand. /// </summary> /// <param name="modal">An ImageModel, to execute the command</param> public NewFileCommand(IImageModel model) { m_model = model; // Storing the Model }
public DummyImageController(IImageModel model) { this.model = model; }
public static bool IsVisibleOn(this Vector3 @this, IImageModel model) { return(model.Project(@this).IsVisibleOn(model)); }
public static bool IsVisibleOn(this Vector2? @this, IImageModel model) { return(@this.HasValue && @this.Value.IsVisibleOn(model)); }
public static bool IsVisibleOn(this Vector2 @this, IImageModel model) { return(model.Domain.Contains(@this)); }
public TransformedImageModel(IImageModel localModel, RotoTranslation3 localToGlobal) { _localModel = localModel; _localToGlobal = localToGlobal; }