Пример #1
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SplitLineTool" /> class.
 /// </summary>
 /// <param name="controller">The controller.</param>
 public SplitLineTool([NotNull] TilingController controller, float tolerance)
     : base(controller, ToolName)
 {
     if (tolerance <= 0)
     {
         throw new ArgumentOutOfRangeException(nameof(tolerance));
     }
     _tolerance = tolerance;
 }
Пример #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="EditLineTool" /> class.
 /// </summary>
 /// <param name="controller">The controller.</param>
 /// <param name="tolerance">The tolerance. Must be greater than 0.</param>
 public EditLineTool([NotNull] TilingController controller, float tolerance)
     : base(controller, ToolName)
 {
     if (tolerance <= 0)
     {
         throw new ArgumentOutOfRangeException(nameof(tolerance));
     }
     _tolerance       = tolerance;
     ChangeLineOption = new Option(ChangeLineTypeName, typeof(Line));
     ChangeLineOption.ValueChanged += ChangeLineType;
 }
Пример #3
0
        /// <summary>
        ///     Opens the tiling given for editing.
        /// </summary>
        /// <param name="tiling">The tiling.</param>
        private void OpenTiling([NotNull] Tiling tiling)
        {
            Debug.Assert(tiling != null, "tiling != null");

            lock (_lock)
            {
                try
                {
                    // Dont call the ViewBoundsChanged event handler while changing the tiling
                    _layoutSuspended = true;

                    // Reset view
                    _translate = _invTranslate = Matrix3x2.Identity;
                    _zoom = 100f;
                    UpdateScale();

                    if (_tilingController == null)
                        _tilingController = CreateTilingController(tiling);
                    else
                        _tilingController.SetTiling(tiling);

                    ActiveController = _tilingController;

                    UpdateStyleManager(tiling.StyleManager);

                    IsDirty = false;
                }
                finally
                {
                    _layoutSuspended = false;
                }
            }
        }
Пример #4
0
        /// <summary>
        ///     Creates the tiling controller.
        /// </summary>
        /// <param name="tiling">The tiling.</param>
        /// <returns></returns>
        private TilingController CreateTilingController([NotNull] Tiling tiling)
        {
            Debug.Assert(tiling != null, "tiling != null");

            TilingController tc = new TilingController(tiling, this);

            tc.EditLine.OptionsChanged += TilingController_EditLineTool_OptionsChanged;
            tc.EditLine.ChangeLineOption.ValueChanged += v => _changeLineTypeCmb.SelectedItem = v;
            _changeLineTypeCmb.SelectedItem = tc.EditLine.ChangeLineOption.Value;

            tc.StyleManagerChanged += (sender, args) => IsDirty = true;
            tc.CurrentToolChanged += controller_CurrentToolChanged;
            _panTool = new PanTool(tc, this);
            _selectTileTool = new SelectTileTool(tc);

            _toolBtns.Add(_panTool, _panToolBtn);

            UpdateTools();

            return tc;
        }