private void Initialize(ILevelControllerOptions options)
        {
            // Constructs all the in-level components, then stores the ones that'll be needed later in member variables.
            // Done this way rather than directly initializing the member variables because this way if they're reordered,
            // the compiler will complain if something's being constructed before its dependency.
            var surface    = GeodesicSphereFactory.Build(options);
            var simulation = new SimulationController(surface, options);

            var cameraController = new CameraController(options);

            var meshManager      = new MeshManager(surface);
            var cursorTracker    = new CursorTracker(cameraController.Camera, meshManager);
            var fieldManipulator = new FieldManipulator(surface, cursorTracker, options);

            var colorMapView     = new ColorMapView(surface, meshManager.Mesh, options);
            var particleMapView  = new ParticleMapView(surface, options);
            var rawValuesView    = new RawValuesView(cursorTracker);
            var timeDilationView = new TimeView(50, options.Timestep);
            var latLongGridView  = new LatLongGridView(options.Radius);

            _simulationController = simulation;
            _colorMapView         = colorMapView;
            _particleMapView      = particleMapView;
            _rawValuesView        = rawValuesView;
            _timeView             = timeDilationView;
            _latLongGridView      = latLongGridView;
            _cameraController     = cameraController;
            _cursorTracker        = cursorTracker;
            _fieldManipulator     = fieldManipulator;
        }
 /// <summary>
 /// Constructs a FieldManipulator instance that allows the cursor tracked by cursorTracker to interact with
 /// fields defined on polyhedron.
 /// </summary>
 /// <param name="polyhedron"></param>
 /// <param name="cursorTracker"></param>
 /// <param name="options"></param>
 public FieldManipulator(IPolyhedron polyhedron, CursorTracker cursorTracker, IFieldManipulatorOptions options)
 {
     _polyhedron    = polyhedron;
     _cursorTracker = cursorTracker;
     _settings      = new FieldManipulatorSettings(options);
     _options       = options;
 }
Example #3
0
        protected override void OnShown()
        {
            SetSizeRequest(-1, -1);
            Visible   = true;
            show_time = DateTime.UtcNow;
            Reposition();

            CursorTracker.ForDisplay(Display).Enabled = false;

            GLib.Timeout.Add(10, delegate {
                Gdk.GrabStatus status = Gdk.Pointer.Grab(
                    GdkWindow,
                    true,
                    Gdk.EventMask.ButtonPressMask |
                    Gdk.EventMask.ButtonReleaseMask,
                    null,
                    null,
                    Gtk.Global.CurrentEventTime);

                if (status == GrabStatus.AlreadyGrabbed || status == GrabStatus.Success)
                {
                    Gdk.Keyboard.Grab(GdkWindow, true, Gtk.Global.CurrentEventTime);
                    Gtk.Grab.Add(this);
                    return(false);
                }
                return(true);
            });

            base.OnShown();
        }
Example #4
0
 protected override void OnHidden()
 {
     Visible = false;
     CursorTracker.ForDisplay(Display).Enabled = true;
     base.OnHidden();
 }
 public RawValuesView(CursorTracker cursorTracker)
 {
     _cursorTracker = cursorTracker;
 }
Example #6
0
        public void GetCursorPathScriptTest(string inputString, string expectedPathScript)
        {
            var actualPathScript = CursorTracker.GetCursorPathScript(inputString);

            Assert.AreEqual(actualPathScript, expectedPathScript);
        }