Exemplo n.º 1
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                // Label sides
                _labelSides = new Collections.SelectableListNodeList
                {
                    new Collections.SelectableListNode("Automatic", null, null == _doc.LabelSide)
                };
                var list = new List <Collections.SelectableListNode>();
                if (_doc.CachedAxisInformation != null)
                {
                    list.Add(new Collections.SelectableListNode(_doc.CachedAxisInformation.NameOfFirstDownSide, CSAxisSide.FirstDown, _doc.LabelSide == CSAxisSide.FirstDown));
                    list.Add(new Collections.SelectableListNode(_doc.CachedAxisInformation.NameOfFirstUpSide, CSAxisSide.FirstUp, _doc.LabelSide == CSAxisSide.FirstUp));
                }
                list.Sort((x, y) => string.Compare(x.Text, y.Text));
                _labelSides.AddRange(list);

                // horizontal and vertical alignment
                _alignmentChoicesX = new Collections.SelectableListNodeList(_doc.AlignmentX);
                _alignmentChoicesY = new Collections.SelectableListNodeList(_doc.AlignmentY);
                _alignmentChoicesZ = new Collections.SelectableListNodeList(_doc.AlignmentZ);

                // label formatting type
                var labelTypes = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(Altaxo.Graph.Graph3D.LabelFormatting.ILabelFormatting));
                _labelStyles = new Collections.SelectableListNodeList();
                for (int i = 0; i < labelTypes.Length; ++i)
                {
                    _labelStyles.Add(new Collections.SelectableListNode(labelTypes[i].Name, labelTypes[i], labelTypes[i] == _doc.LabelFormat.GetType()));
                }

                _labelFormattingSpecificController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.LabelFormat }, typeof(IMVCANController), UseDocument.Directly);
            }

            if (null != _view)
            {
                _view.LabelFont     = _doc.Font;
                _view.LabelMaterial = _doc.Brush;
                _view.AlignmentX_Initialize(_alignmentChoicesX);
                _view.AlignmentY_Initialize(_alignmentChoicesY);
                _view.AlignmentZ_Initialize(_alignmentChoicesY);
                _view.AutomaticAlignment       = _doc.AutomaticAlignment;
                _view.RotationX                = _doc.RotationX;
                _view.RotationY                = _doc.RotationY;
                _view.RotationZ                = _doc.RotationZ;
                _view.OffsetX                  = _doc.OffsetX;
                _view.OffsetY                  = _doc.OffsetY;
                _view.OffsetZ                  = _doc.OffsetZ;
                _view.Background               = _doc.BackgroundStyle;
                _view.SuppressedLabelsByValue  = GUIConversion.ToString(_doc.SuppressedLabels.ByValues);
                _view.SuppressedLabelsByNumber = GUIConversion.ToString(_doc.SuppressedLabels.ByNumbers);
                _view.PrefixText               = _doc.PrefixText;
                _view.PostfixText              = _doc.SuffixText;
                _view.LabelSides               = _labelSides;
                _view.LabelStyle_Initialize(_labelStyles);
                _view.LabelFormattingSpecificGuiControl = null == _labelFormattingSpecificController ? null : _labelFormattingSpecificController.ViewObject;
            }
        }