Beispiel #1
0
        private void glControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (project == null || project.Analysis == null)
            {
                return;
            }

            if (e.Button == MouseButtons.Left)
            {
                if (project.Analysis.Points.FirstOrDefault(p => !p.Placed) != null)
                {
                    return;
                }

                var measurement = PickModelPoint();
                if (!fixPoint)
                {
                    var point = ClosestPoint(measurement, 1);
                    if (point != null)
                    {
                        originalMeasurement = point.Measurement;
                        selectedPoint       = point;
                        fixPoint            = true;
                    }
                }
                else
                {
                    selectedPoint.Measurement = measurement;
                }
            }
        }
Beispiel #2
0
        private void glControl_MouseClick(object sender, MouseEventArgs e)
        {
            if (project == null || e.Button != MouseButtons.Left)
            {
                return;
            }

            if (setScale && scaleRefs.Count < scaleRefs.Capacity)
            {
                var point = PickModelPoint();
                commandExecutor.Execute(
                    () => { scaleRefs.Add(point); setScaleButton.Enabled = scaleNumericUpDown.Enabled = scaleRefs.Count == scaleRefs.Capacity; UpdateStatus(); },
                    () => { scaleRefs.RemoveAt(scaleRefs.Count - 1); setScaleButton.Enabled = scaleNumericUpDown.Enabled = false; UpdateStatus(); });
            }
            else if (project.Analysis != null)
            {
                var measurement = PickModelPoint();
                if (fixPoint)
                {
                    var point           = selectedPoint;
                    var prevMeasurement = originalMeasurement;

                    commandExecutor.Execute(
                        () => point.Measurement = measurement,
                        () => point.Measurement = prevMeasurement);

                    originalMeasurement = Vector2.Zero;
                    selectedPoint       = null;
                    fixPoint            = false;
                }
                else
                {
                    var point = project.Analysis.Points.FirstOrDefault(p => !p.Placed);
                    if (point != null)
                    {
                        var prevMeasurement = point.Measurement;

                        commandExecutor.Execute(
                            () => { point.Measurement = measurement; point.Placed = true; UpdateStatus(); },
                            () => { point.Measurement = prevMeasurement; point.Placed = false; UpdateStatus(); });
                    }
                }
            }
        }