Last change
on this file since 13847 was
12762,
checked in by aballeit, 9 years ago
|
#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)
|
File size:
2.7 KB
|
Rev | Line | |
---|
[12762] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 |
|
---|
| 4 | using System.Windows;
|
---|
| 5 |
|
---|
| 6 | namespace SharpVectors.Renderers.Texts
|
---|
| 7 | {
|
---|
| 8 | public sealed class WpfTextPlacement
|
---|
| 9 | {
|
---|
| 10 | #region Private Fields
|
---|
| 11 |
|
---|
| 12 | private bool _isRotateOnly;
|
---|
| 13 | private Point _location;
|
---|
| 14 | private double _rotation;
|
---|
| 15 | private IList<WpfTextPosition> _positions;
|
---|
| 16 |
|
---|
| 17 | #endregion
|
---|
| 18 |
|
---|
| 19 | #region Constructors and Destructor
|
---|
| 20 |
|
---|
| 21 | public WpfTextPlacement()
|
---|
| 22 | {
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public WpfTextPlacement(Point location, double rotation)
|
---|
| 26 | {
|
---|
| 27 | if (Double.IsNaN(rotation) || Double.IsInfinity(rotation))
|
---|
| 28 | {
|
---|
| 29 | rotation = 0;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | _location = location;
|
---|
| 33 | _rotation = rotation;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | public WpfTextPlacement(Point location, double rotation,
|
---|
| 37 | IList<WpfTextPosition> positions, bool isRotateOnly)
|
---|
| 38 | {
|
---|
| 39 | if (Double.IsNaN(rotation) || Double.IsInfinity(rotation))
|
---|
| 40 | {
|
---|
| 41 | rotation = 0;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | _location = location;
|
---|
| 45 | _rotation = rotation;
|
---|
| 46 | _positions = positions;
|
---|
| 47 | _isRotateOnly = isRotateOnly;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | #endregion
|
---|
| 51 |
|
---|
| 52 | #region Public Properties
|
---|
| 53 |
|
---|
| 54 | public bool HasPositions
|
---|
| 55 | {
|
---|
| 56 | get
|
---|
| 57 | {
|
---|
| 58 | return (_positions != null && _positions.Count != 0);
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | public Point Location
|
---|
| 63 | {
|
---|
| 64 | get
|
---|
| 65 | {
|
---|
| 66 | return _location;
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | public double Rotation
|
---|
| 71 | {
|
---|
| 72 | get
|
---|
| 73 | {
|
---|
| 74 | return _rotation;
|
---|
| 75 | }
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | public bool IsRotateOnly
|
---|
| 79 | {
|
---|
| 80 | get
|
---|
| 81 | {
|
---|
| 82 | return _isRotateOnly;
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | public IList<WpfTextPosition> Positions
|
---|
| 87 | {
|
---|
| 88 | get
|
---|
| 89 | {
|
---|
| 90 | return _positions;
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | #endregion
|
---|
| 95 |
|
---|
| 96 | #region Public Methods
|
---|
| 97 |
|
---|
| 98 | public void UpdatePositions(string targetText)
|
---|
| 99 | {
|
---|
| 100 | //if (String.IsNullOrEmpty(targetText) || (_positions == null || _positions.Count == 0))
|
---|
| 101 | //{
|
---|
| 102 | // return;
|
---|
| 103 | //}
|
---|
| 104 |
|
---|
| 105 | //int posCount = _positions.Count;
|
---|
| 106 | //int textCount = targetText.Length;
|
---|
| 107 |
|
---|
| 108 | //if (textCount <= posCount)
|
---|
| 109 | //{
|
---|
| 110 | // return;
|
---|
| 111 | //}
|
---|
| 112 | //WpfTextPosition textPos = new WpfTextPosition(_location, _rotation);
|
---|
| 113 | //for (int i = posCount; i < textCount; i++)
|
---|
| 114 | //{
|
---|
| 115 | // _positions.Add(textPos);
|
---|
| 116 | //}
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | #endregion
|
---|
| 120 | }
|
---|
| 121 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.