Ejemplo n.º 1
0
        private void canvas_MouseMove(object sender, MouseEventArgs e)
        {
            // Custom zoom
            if (isCustomZoomActivated && isDrawingZoomRect)
            {
                DrawZoomRect(e.GetPosition(this));
                return;
            }

            // Display mouse location
            Transformation.MouseLocation = e.GetPosition(this);

            // Hit carriage view
            VCarriage ca = HitCarriage(e.GetPosition(this));

            if (ca != Transformation.HitCarriage)
            {
                Transformation.HitCarriage = ca;
            }

            // Hit passenger view
            VPassenger p = HitPassenger(e.GetPosition(this));

            if (p != Transformation.HitPassenger)
            {
                Transformation.HitPassenger = p;
            }

            // View Moving
            if (isViewMoving)
            {
                ViewMoving(e.GetPosition(this));
            }
        }
Ejemplo n.º 2
0
 public Form_PassengerInfo(VPassenger vPassenger)
 {
     InitializeComponent();
     this.DataContext     = vPassenger;
     dg_event.ItemsSource = vPassenger.Entity.EventList;
     dg_event.Focus();
 }
Ejemplo n.º 3
0
        private void btn_showPassengerList_Click(object sender, RoutedEventArgs e)
        {
            VPassenger vp = passengerPlotCanva.HighlightPassengerView(tb_passengerName.Text);

            if (vp == null)
            {
                tb_passengerName.Text = "Passenger not found!";
            }
            else
            {
                Form_PassengerInfo pi = new Form_PassengerInfo(vp);
                pi.Show();
            }
        }
Ejemplo n.º 4
0
        private void canvas_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Point p = e.GetPosition(this);

            // Custom zoom
            if (isCustomZoomActivated)
            {
                rectZoomOrg       = e.GetPosition(this);
                isDrawingZoomRect = true;
                return;
            }

            VPassenger hitVp = HitPassenger(p);

            if (hitVp != null)
            {
                // Show passenger information list

                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    Form_PassengerInfo passengerInfoForm = new PassengerPlot.Form_PassengerInfo(hitVp);
                    passengerInfoForm.Show();
                }
                else if (e.RightButton == MouseButtonState.Pressed)
                {
                    hitVp.IsTrackDisplayed = !hitVp.IsTrackDisplayed;
                    Draw();
                }
            }
            else
            {
                // Show passenger track

                foreach (VPassenger vp in passengerViewList)
                {
                    vp.IsTrackDisplayed = false;
                }
                Draw();
            }

            // Move views
            if (isViewMovingActivated)
            {
                ViewMoveBegin(p);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generate the view dataset by the entity data
        /// </summary>
        public void GenerateViewData()
        {
            if (EntityData.StationList == null || EntityData.StationList.Count == 0)
            {
                return;
            }
            if (EntityData.SectionList == null || EntityData.SectionList.Count == 0)
            {
                return;
            }

            canvas.ClearVisual();

            foreach (Station sta in EntityData.StationList.Values)
            {
                VNode n = new VNode(sta)
                {
                    Location = sta.Location
                };
                sta.View = n;
                nodeViewList.Add(n);
            }

            foreach (Section sec in EntityData.SectionList.Values)
            {
                VLink l = new VLink(sec)
                {
                    FromNode = sec.FromStation.NodeView,
                    ToNode   = sec.ToStation.NodeView,
                };
                sec.View = l;
                linkViewList.Add(l);
            }

            foreach (StopFacility sf in EntityData.StopFacilityList.Values)
            {
                VStopFacility vsf = new PassengerPlot.VStopFacility(sf);
                facilityViewList.Add(vsf);
            }

            foreach (Carriage ca in EntityData.CarriageList.Values)
            {
                VCarriage c = new VCarriage(ca)
                {
                    Location = new Point(10, 10)
                };
                ca.View = c;
                carriageViewList.Add(c);
            }

            foreach (Passenger p in EntityData.PassengerDict.Values)
            {
                VPassenger vp = new VPassenger(p)
                {
                    Location = new Point(10, 10), Entity = p
                };
                p.View = vp;
                passengerViewList.Add(vp);
                p.View.GeneratePassengerTrack();
            }

            IsDataLoaded = true;
        }