예제 #1
0
        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();
            });
        }
예제 #2
0
        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
            };
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
        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));
            }
        }
예제 #5
0
        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));
            }
        }
예제 #6
0
        public static Vector2?StrictlyProject(this IImageModel @this, Vector3 point)
        {
            var projection = @this.Project(point);

            if (projection.IsVisibleOn(@this))
            {
                return(projection);
            }
            else
            {
                return(null);
            }
        }
예제 #7
0
        /// <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();
             */
        }
예제 #8
0
        /// <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();
        }
예제 #9
0
 /// <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;
 }
예제 #11
0
 public DummyImageController(IImageModel model)
 {
     this.model = model;
 }
예제 #12
0
 public static bool IsVisibleOn(this Vector3 @this, IImageModel model)
 {
     return(model.Project(@this).IsVisibleOn(model));
 }
예제 #13
0
 public static bool IsVisibleOn(this Vector2? @this, IImageModel model)
 {
     return(@this.HasValue && @this.Value.IsVisibleOn(model));
 }
예제 #14
0
 public static bool IsVisibleOn(this Vector2 @this, IImageModel model)
 {
     return(model.Domain.Contains(@this));
 }
예제 #15
0
 public TransformedImageModel(IImageModel localModel, RotoTranslation3 localToGlobal)
 {
     _localModel    = localModel;
     _localToGlobal = localToGlobal;
 }