Пример #1
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _instances = new Dictionary <Type, IItemLocation>
                {
                    { _doc.GetType(), _doc }
                };

                if (_layer.ParentLayer == null && !(_doc is ItemLocationDirect))
                {
                    _doc = new ItemLocationDirect();
                }

                CreateSubController();
            }

            if (null != _view)
            {
                _view.UseDirectPositioning           = _doc is ItemLocationDirect;
                _view.SubPositionView                = _subController.ViewObject;
                _view.IsPositioningTypeChoiceVisible = !IsRootLayerPosition;
            }
        }
Пример #2
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _srcSize     = _doc.GetImageSizePt();
                _docScale    = new PointD2D(_doc.Size.X / _srcSize.X, _doc.Size.Y / _srcSize.Y);
                _docLocation = new ItemLocationDirect();
                _docLocation.CopyFrom(_doc.Location);
                _docLocation.Scale  = new PointD2D(_doc.Size.X / _srcSize.X, _doc.Size.Y / _srcSize.Y);
                _locationController = new ItemLocationDirectController()
                {
                    UseDocumentCopy = UseDocument.Directly
                };
                _locationController.InitializeDocument(new object[] { _docLocation });
                Current.Gui.FindAndAttachControlTo(_locationController);

                _locationController.SizeXChanged  += EhLocController_SizeXChanged;
                _locationController.SizeYChanged  += EhLocController_SizeYChanged;
                _locationController.ScaleXChanged += EhLocController_ScaleXChanged;
                _locationController.ScaleYChanged += EhLocController_ScaleYChanged;
                _locationController.ShowSizeElements(true, !_doc.IsSizeCalculationBasedOnSourceSize);
                _locationController.ShowScaleElements(true, _doc.IsSizeCalculationBasedOnSourceSize);
            }
            if (_view != null)
            {
                _view.SourceSize       = _srcSize;
                _view.AspectPreserving = _doc.AspectRatioPreserving;
                _view.IsSizeCalculationBasedOnSourceSize = _doc.IsSizeCalculationBasedOnSourceSize;
                _view.LocationView = _locationController.ViewObject;
            }
        }
Пример #3
0
 protected override IEnumerable <Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName()
 {
     if (null != _location)
     {
         yield return(new Main.DocumentNodeAndName(_location, () => _location = null, "Location"));
     }
 }
Пример #4
0
		protected OpenPathShapeBase(ItemLocationDirect location, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
			: base(location)
		{
			if (null == context)
				context = PropertyExtensions.GetPropertyContextOfProject();

			var penWidth = GraphDocument.GetDefaultPenWidth(context);
			var foreColor = context.GetValue(GraphDocument.PropertyKeyDefaultForeColor);
			Pen = new PenX3D(foreColor, penWidth);
		}
Пример #5
0
        /// <summary>
        /// Initializes a fresh instance of this class with default values
        /// </summary>
        protected GraphicBase(ItemLocationDirect location)
        {
            if (null == location)
            {
                throw new ArgumentNullException(nameof(location));
            }

            _location = location;
            _location.ParentObject = this;
        }
Пример #6
0
        protected GraphicBase(GraphicBase from)
        {
            if (null == from)
            {
                throw new ArgumentNullException(nameof(from));
            }

            _location = from._location.Clone();
            _location.ParentObject = this;

            CopyFrom(from);
        }
Пример #7
0
        private void EhPositioningTypeChanged()
        {
            if (_subController.Apply(false))
            {
                _instances[_subController.ModelObject.GetType()] = (IItemLocation)_subController.ModelObject;
            }

            bool useDirectPositioning = _view.UseDirectPositioning || _layer.ParentLayer == null; // if this is the root layer, then choice of grid positioning is not available

            IItemLocation oldDoc = _doc;
            IItemLocation newDoc = null;

            if (useDirectPositioning)
            {
                if (_instances.ContainsKey(typeof(ItemLocationDirect)))
                {
                    newDoc = _instances[typeof(ItemLocationDirect)];
                }
                else
                {
                    newDoc = new ItemLocationDirect();
                }
            }
            else
            {
                if (_instances.ContainsKey(typeof(ItemLocationByGrid)))
                {
                    newDoc = _instances[typeof(ItemLocationByGrid)];
                }
                else
                {
                    newDoc = new ItemLocationByGrid();
                }
            }

            if (!object.ReferenceEquals(oldDoc, newDoc))
            {
                _doc = newDoc;
                OnMadeDirty(); // change for super-controller to pick up new instance

                if (null != _suspendToken)
                {
                    _suspendToken.Dispose();
                    _suspendToken = _doc.SuspendGetToken();
                }

                CreateSubController();

                _view.UseDirectPositioning = useDirectPositioning;
                _view.SubPositionView      = _subController.ViewObject;
            }
        }
Пример #8
0
        protected OpenPathShapeBase(ItemLocationDirect location, Altaxo.Main.Properties.IReadOnlyPropertyBag context)
            : base(location)
        {
            if (null == context)
            {
                context = PropertyExtensions.GetPropertyContextOfProject();
            }

            var penWidth  = GraphDocument.GetDefaultPenWidth(context);
            var foreColor = context.GetValue(GraphDocument.PropertyKeyDefaultForeColor);

            Pen = new PenX(foreColor, penWidth);
        }
Пример #9
0
        public override bool Apply(bool disposeController)
        {
            if (!_locationController.Apply(disposeController))
            {
                return(false);
            }

            _docLocation = (ItemLocationDirect)_locationController.ModelObject;

            if (!object.ReferenceEquals(_doc.Location, _docLocation))
            {
                _doc.Location.CopyFrom(_docLocation);
            }

            // all other properties where already set during the session

            return(ApplyEnd(true, disposeController));
        }
Пример #10
0
 protected OpenPathShapeBase(ItemLocationDirect location, Altaxo.Serialization.Xml.IXmlDeserializationInfo info)
     : base(location)
 {
 }
Пример #11
0
		protected OpenPathShapeBase(ItemLocationDirect location, Altaxo.Serialization.Xml.IXmlDeserializationInfo info)
			: base(location)
		{
		}