Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/23/15 16:22:22 (8 years ago)
Author:
bburlacu
Message:

#1772: Adapted visualization code according to the changes in the HeuristicLab.Visualization branch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.EvolutionTracking.Views/3.4/GenealogyGraphChart.cs

    r12208 r13061  
    8080    }
    8181
    82     public bool UpdateEnabled {
    83       get { return Chart.UpdateEnabled; }
    84       set { Chart.UpdateEnabled = value; }
    85     }
    86 
    87     public void EnforceUpdate() {
    88       Chart.EnforceUpdate();
    89     }
     82    //    public bool UpdateEnabled {
     83    //      get { return Chart.UpdateEnabled; }
     84    //      set { Chart.UpdateEnabled = value; }
     85    //    }
     86
     87    //    public void EnforceUpdate() {
     88    //      Chart.EnforceUpdate();
     89    //    }
    9090
    9191    private Visualization.Rectangle TargetRectangle { get; set; }
     
    118118
    119119    protected virtual void DrawGraph(double xIncrement, double yIncrement, double diameter) {
    120       Chart.UpdateEnabled = false;
     120      this.SuspendRendering();
    121121      DrawInProgress = true;
    122122
     
    160160          var pen = Pens.Transparent;
    161161          var visualArc = AddArc(Chart, visualParent, visualNode, pen);
    162           visualArc.OneLayerDown(); // send it behind the visual nodes
     162          Chart.OneLayerDown(visualArc); // send it behind the visual nodes
    163163          if (!arcMap.ContainsKey(Tuple.Create(visualParent, visualNode))) {
    164164            arcMap.Add(Tuple.Create(visualParent, visualNode), visualArc);
     
    167167      }
    168168
    169       Chart.UpdateEnabled = true;
    170       Chart.EnforceUpdate();
    171 
     169      ResumeRendering();
    172170      DrawInProgress = false;
    173171    }
     
    187185    #region event handlers
    188186
    189     protected override void pictureBox_MouseMove(object sender, MouseEventArgs e) {
     187    protected override void PictureBoxOnMouseMove(object sender, MouseEventArgs e) {
    190188      if (!DrawInProgress) {
    191189        switch (e.Button) {
    192190          case MouseButtons.Left:
    193             Chart.Mode = ChartMode.Select;
     191            Mode = ChartMode.Select;
    194192            Cursor = Cursors.Default;
    195193            break;
    196194          case MouseButtons.Middle:
    197             Chart.Mode = ChartMode.Move;
     195            Mode = ChartMode.Move;
    198196            Cursor = Cursors.Hand;
    199197            break;
    200198        }
    201199      }
    202       base.pictureBox_MouseMove(sender, e);
    203     }
    204 
    205     protected override void pictureBox_MouseUp(object sender, MouseEventArgs e) {
     200      base.PictureBoxOnMouseMove(sender, e);
     201    }
     202
     203    protected override void PictureBoxOnMouseUp(object sender, MouseEventArgs e) {
    206204      Cursor = Cursors.Default;
    207       if (Chart.Mode == ChartMode.Move) {
    208         Chart.Mode = ChartMode.Select;
     205      if (Mode == ChartMode.Move) {
     206        Mode = ChartMode.Select;
    209207        return;
    210208      }
    211       if (Chart.Mode != ChartMode.Select) {
    212         base.pictureBox_MouseUp(sender, e);
     209      if (Mode != ChartMode.Select) {
     210        base.PictureBoxOnMouseUp(sender, e);
    213211        return;
    214212      }
     
    224222      UpdateSelectedVisualNode(); // redraw ancestries, mark node etc.
    225223
    226       base.pictureBox_MouseUp(sender, e);
     224      base.PictureBoxOnMouseUp(sender, e);
    227225    }
    228226
     
    230228      if (!LockGenealogy) {
    231229        // new node has been selected, clean up
    232         Chart.UpdateEnabled = false;
     230        SuspendRendering();
    233231        if (ModifierKeys != Keys.Shift) {
    234232          // clear colors
     
    247245
    248246      // update
    249       UpdateEnabled = true;
    250       EnforceUpdate();
     247      ResumeRendering();
    251248
    252249      if (SelectedVisualNode != null)
     
    281278      double y2 = y1 + size.Height;
    282279      if (TargetRectangle == null) {
    283         TargetRectangle = new Visualization.Rectangle(Chart, x1, y1, x2, y2, new Pen(Color.Black), null);
     280        var lowerLeft = new PointD(x1, y1);
     281        var upperRight = new PointD(x2, y2);
     282        TargetRectangle = new Visualization.Rectangle(Chart, lowerLeft, upperRight, new Pen(Color.Black), null);
    284283        Chart.Group.Add(TargetRectangle);
    285284      } else {
    286         TargetRectangle.SetPosition(x1, y1, x2, y2);
     285        var lowerLeft = new PointD(x1, y1);
     286        var upperRight = new PointD(x2, y2);
     287        TargetRectangle.SetPosition(lowerLeft, upperRight);
    287288      }
    288289    }
Note: See TracChangeset for help on using the changeset viewer.