Exemplo n.º 1
0
 private void cbbAggreType_SelectedIndexChanged(object sender, EventArgs e)
 {
     OptionsManager.Singleton.AggregateType         = (AggregateType)cbbAggreType.SelectedIndex;
     DisplayManager.Current.CityModel.AggregateType = OptionsManager.Singleton.AggregateType;
     ValueBuffer.UpdateValues();
     Viewer.Current.Canvas.Invalidate();
 }
Exemplo n.º 2
0
        public override void MouseClickHandler(object sender, MouseEventArgs e)
        {
            // mod 20110801
            string[]       types = { "0", "Retail", "Transit", "CrossCityTransportation", "Medical", "Education", "Pollution", "ZeroOne" };
            CityEntityType type  = types[TaskPanel.Current.cbbAddEnt.SelectedIndex].ParseToEnum <CityEntityType>();

            DisplayManager.Current.AddSpot(type, DisplayManager.Current.CityCoordinate(e.X, e.Y));
            ValueBuffer.UpdateValues();
        }
Exemplo n.º 3
0
 private void removeEntityToolStripMenuItem_Click(object sender, EventArgs e)
 {
     PyCmd.sset.ForEach(x =>
     {
         if (x is SpotEntity)
         {
             _display.RemoveSpot(x as SpotEntity);
         }
     });
     SSet.ClearSelection();
     ValueBuffer.UpdateValues();
     Canvas.Invalidate();
 }
Exemplo n.º 4
0
 private void cbbCountParcels_CheckedChanged(object sender, EventArgs e)
 {
     if (cbbCountParcels.Checked)
     {
         DisplayManager.Current.CityModel.CountParcels(true);
     }
     else
     {
         DisplayManager.Current.CityModel.CountParcels(false);
     }
     ValueBuffer.UpdateValues();
     Viewer.Current.Canvas.Invalidate();
 }
Exemplo n.º 5
0
        private void txtCmd_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter && e.Control == true)
            {
                string cmd = txtCmd.Text.Trim(' ', '\n', '\r');
                if (cmd != string.Empty)
                {
                    try
                    {
                        StringWriter print = new StringWriter();
                        _engine.Runtime.IO.SetOutput(_engine.Runtime.IO.OutputStream, print);
                        _result = _engine.Execute(cmd, _scope);
                        if (_result == null)
                        {
                            _result = print.ToString();
                        }
                        _scope.SetVariable("_", _result);
                    }
                    catch (Exception ex)
                    {
                        _result = ex.Message;
                    }

                    EchoLine("In  >> " + cmd);
                    if (_result == null)
                    {
                        EchoLine("Out >> Undefined");
                    }
                    else if (_result.ToString() == string.Empty)
                    {
                        EchoLine("Out >> Empty");
                    }
                    else
                    {
                        EchoLine("Out >> " + _result.ToString());
                    }
                    EchoLine();
                    txtCmd.Focus();
                }
                txtCmd.Text = string.Empty;
                ValueBuffer.UpdateValues();
                Viewer.Current.Canvas.Invalidate(); // newly 20110805
            }
        }
Exemplo n.º 6
0
 public override void MouseHoverHandler(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left) // Take care: this happens before MouseClick
     {
         // Move spot
         if (_hover != null)
         {
             Viewer.Current.Canvas.Cursor = Cursors.Hand;
             _hover.Position = DisplayManager.Current.CityCoordinate(e.X, e.Y);
             ValueBuffer.UpdateValues();
             Viewer.Current.Canvas.Invalidate();
         }
     }
     else if (e.Button == MouseButtons.None)
     {
         // Detect spot
         if (TaskPanel.Current.cbShowSpot.Checked)
         {
             SpotEntity temp = _hover;
             _hover = DisplayManager.Current.DetectSpotHover(e.X, e.Y);
             if (_hover != temp)
             {
                 Viewer.Current.Canvas.Invalidate();
             }
             if (_hover != null)
             {
                 Viewer.Current.Canvas.Cursor = Cursors.Hand;
             }
             else if (CanvasWindow.Current.IsDragging)
             {
                 Viewer.Current.Canvas.Cursor = Cursors.SizeAll;
             }
             else
             {
                 Viewer.Current.Canvas.Cursor = Cursors.Default;
             }
         }
     }
 }
Exemplo n.º 7
0
 private void pictureBox1_MouseEnter(object sender, EventArgs e)
 {
     //this.ActiveControl = pictureBox1;
     ValueBuffer.UpdateValues();
     pictureBox1.Invalidate();
 }
Exemplo n.º 8
0
 private void testToolStripMenuItem_Click(object sender, EventArgs e)
 {
     pythonConsole.RunString("script()");
     ValueBuffer.UpdateValues();
     Canvas.Invalidate();
 }