Example #1
0
 void _colormap_ColorsChanged(object sender, ColorMap.ColorsChangedEventArgs e)
 {
     Invalidate();
     InvokeColorMapChanged(new ColorMapChangedEventArgs());
 }
Example #2
0
        private void ColorMapControl_MouseUp(object sender, MouseEventArgs e)
        {
            _leftMouseDown = false;

            if (_colormap == null)
                return;

            // check if we have a click event
            if (Math.Abs(_mouseDownPosition.X - e.X) <= 2 && Math.Abs(_mouseDownPosition.Y - e.Y) <= 2)
                {
                int index = WorldToIndex(e.X);

                if (e.Button == MouseButtons.Left)
                    {
                    if (ClientSize.Width - e.X < 8)
                        index = _colormap.Count;
                    ColorDialog cd = new ColorDialog();
                    cd.FullOpen = true;
                    cd.AnyColor = true;
                    if (cd.ShowDialog() == DialogResult.OK)
                        {
                        _colormap.AddColorAt(cd.Color, index);
                        }
                    }
                else if (e.Button == MouseButtons.Right)
                    {
                    if (_colormap.Count > 1)
                        _colormap.RemoveColorAt(index);
                    }
                }
            else if (_draggingColor)
                {
                _draggingColor = false;
                colormap = _tempMap;
                }
        }
Example #3
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public ColorMapControl()
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            this.DoubleBuffered = true;

            InitializeComponent();

            List<Color> colors = new List<Color>();
            colors.Add(Color.Black);
            colors.Add(Color.White);
            _colormap = new ColorMap(colors);
            _colormap.ColorsChanged += new ColorMap.ColorsChangedEventHandler(_colormap_ColorsChanged);

            if (DesignMode)
                {
                this.Size = new System.Drawing.Size(96, 24);
                }
        }
Example #4
0
        private void ColorMapControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (_colormap == null)
                return;

            if (_leftMouseDown && (Math.Abs(_mouseDownPosition.X - e.X) > 2 || Math.Abs(_mouseDownPosition.Y - e.Y) > 2))
                {
                int origin = WorldToIndex(_mouseDownPosition.X);
                int destination = WorldToIndex(e.X);
                List<Color> l = _colormap.GetListCopy();

                Color c = l[origin];
                l[origin] = l[destination];
                l[destination] = c;

                _tempMap = new ColorMap(l);
                _draggingColor = true;
                Invalidate();
                }
        }
        /// <summary>
        /// Standardkonstruktor des Hauptformulars
        /// </summary>
        public MainForm()
        {
            timelineSteuerung.maxTime = 50;

            InitializeComponent();

            List<Color> tmp = new List<Color>();
            tmp.Add(Color.DarkRed);
            tmp.Add(Color.Yellow);
            tmp.Add(Color.DarkGreen);
            Tools.ColorMap cm = new Tools.ColorMap(tmp);
            cmcVelocityMapping.colormap = cm;

            _dockingManager = new Crownwood.Magic.Docking.DockingManager(this, VisualStyle.IDE);
            _dockingManager.SaveCustomConfig += new DockingManager.SaveCustomConfigHandler(_dockingManager_SaveCustomConfig);
            _dockingManager.LoadCustomConfig += new DockingManager.LoadCustomConfigHandler(_dockingManager_LoadCustomConfig);
            SetupDockingStuff();

            trafficLightTreeView.steuerung = timelineSteuerung;
            trafficLightForm.SelectedEntryChanged += new TrafficLightForm.SelectedEntryChangedEventHandler(trafficLightForm_SelectedEntryChanged);

            timelineSteuerung.CurrentTimeChanged += new TimelineSteuerung.CurrentTimeChangedEventHandler(timelineSteuerung_CurrentTimeChanged);
            timelineSteuerung.MaxTimeChanged += new TimelineSteuerung.MaxTimeChangedEventHandler(timelineSteuerung_MaxTimeChanged);

            nodeSteuerung.NetworkLayersChanged += new NodeSteuerung.NetworkLayersChangedEventHandler(nodeSteuerung_NetworkLayersChanged);
            nodeSteuerung.AddNetworkLayer("Layer 1", true);

            zoomComboBox.SelectedIndex = 7;
            daGridScrollPosition = new Point(0, 0);
            UpdateDaGridClippingRect();
            DaGrid.Dock = DockStyle.Fill;

            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

            renderOptionsDaGrid.renderLineNodes = true;
            renderOptionsDaGrid.renderNodeConnections = true;
            renderOptionsDaGrid.renderVehicles = true;
            renderOptionsDaGrid.performClipping = true;
            renderOptionsDaGrid.clippingRect = new Rectangle(0, 0, 10000, 10000);
            renderOptionsDaGrid.renderIntersections = false;
            renderOptionsDaGrid.renderLineChangePoints = false;
            renderOptionsDaGrid.renderLineNodeDebugData = false;
            renderOptionsDaGrid.renderNodeConnectionDebugData = false;
            renderOptionsDaGrid.renderVehicleDebugData = false;

            renderOptionsThumbnail.renderLineNodes = false;
            renderOptionsThumbnail.renderNodeConnections = true;
            renderOptionsThumbnail.renderVehicles = false;
            renderOptionsThumbnail.performClipping = false;
            renderOptionsThumbnail.renderIntersections = false;
            renderOptionsThumbnail.renderLineChangePoints = false;
            renderOptionsThumbnail.renderLineNodeDebugData = false;
            renderOptionsThumbnail.renderNodeConnectionDebugData = false;
            renderOptionsThumbnail.renderVehicleDebugData = false;
        }