public void InitializeAxisInformationList(ICoordinateSystem cs, AxisStyleCollection currentAxisStyles)
        {
            var dict = new Dictionary <CSLineID, CSAxisInformation>();

            AxisStyles = new List <CSAxisInformation>();

            foreach (var style in cs.AxisStyles)
            {
                if (!dict.ContainsKey(style.Identifier))
                {
                    dict.Add(style.Identifier, style);
                    AxisStyles.Add(style);
                }
            }

            foreach (var axstyle in currentAxisStyles)
            {
                if (null != axstyle.CachedAxisInformation && !AxisStyles.Contains(axstyle.CachedAxisInformation))
                {
                    if (!dict.ContainsKey(axstyle.CachedAxisInformation.Identifier))
                    {
                        dict.Add(axstyle.CachedAxisInformation.Identifier, axstyle.CachedAxisInformation);
                        AxisStyles.Add(axstyle.CachedAxisInformation);
                    }
                }
            }

            if (null != CurrentStyle && !dict.ContainsKey(CurrentStyle))
            {
                var info = cs.GetAxisStyleInformation(CurrentStyle);
                AxisStyles.Add(info);
            }
        }
        public static void AddAxis(AxisStyleCollection collection, AxisCreationArguments creationArgs)
        {
            var context = collection.GetPropertyContext();
            var axstyle = new AxisStyle(creationArgs.CurrentStyle, false, false, false, null, context);

            if (creationArgs.TemplateStyle != null && collection.Contains(creationArgs.TemplateStyle))
            {
                axstyle.CopyWithoutIdFrom(collection[creationArgs.TemplateStyle]);
                if (creationArgs.MoveAxis)
                {
                    collection.Remove(creationArgs.TemplateStyle);
                }
            }
            collection.Add(axstyle);
        }
Beispiel #3
0
        public DensityImageLegend(DensityImagePlotItem plotItem, Main.IDocumentNode futureParentObject, PointD2D initialLocation, PointD2D graphicSize, Main.Properties.IReadOnlyPropertyBag context)
            : base(new ItemLocationDirect())
        {
            if (null == plotItem)
            {
                throw new ArgumentNullException("plotItem");
            }
            if (null == futureParentObject)
            {
                throw new ArgumentNullException("futureParentObject");
            }

            ParentObject = futureParentObject;
            PlotItem     = plotItem;
            if (null == _plotItemProxy.DocumentPath)
            {
                throw new ArgumentException("No path could be found between plotItem and futureParentObject. This is an indication that one of the objects is not rooted.");
            }

            SetSize(graphicSize.X, graphicSize.Y, Main.EventFiring.Suppressed);
            SetPosition(initialLocation, Main.EventFiring.Suppressed);

            // _orientationIsVertical = true;
            // _scaleIsReversed = false;

            var cachedScale      = (NumericalScale)PlotItem.Style.Scale.Clone();
            var scaleTickSpacing = Altaxo.Graph.Scales.Scale.CreateDefaultTicks(cachedScale.GetType());

            _cachedArea = new DensityLegendArea(Size, true, false, cachedScale, scaleTickSpacing);
            //_cachedArea.ParentObject = this; // --> moved to the end of this function

            _axisStyles = new AxisStyleCollection();
            _axisStyles.UpdateCoordinateSystem(_cachedArea.CoordinateSystem);
            // _axisStyles.ParentObject = this; --> see below

            var sx0 = new AxisStyle(CSLineID.X0, true, true, false, "Z values", context);

            sx0.AxisLineStyle.FirstDownMajorTicks = true;
            sx0.AxisLineStyle.FirstUpMajorTicks   = false;
            sx0.AxisLineStyle.FirstDownMinorTicks = true;
            sx0.AxisLineStyle.FirstUpMinorTicks   = false;

            var sx1 = new AxisStyle(CSLineID.X1, true, false, false, null, context);

            sx1.AxisLineStyle.FirstDownMajorTicks = false;
            sx1.AxisLineStyle.FirstUpMajorTicks   = false;
            sx1.AxisLineStyle.FirstDownMinorTicks = false;
            sx1.AxisLineStyle.FirstUpMinorTicks   = false;

            var sy0 = new AxisStyle(CSLineID.Y0, true, false, false, "Color map", context);
            var sy1 = new AxisStyle(CSLineID.Y1, true, false, false, null, context);

            _axisStyles.Add(sx0);
            _axisStyles.Add(sx1);
            _axisStyles.Add(sy0);
            _axisStyles.Add(sy1);

            sx0.Title.Rotation = 90;
            sx0.Title.Location.ParentAnchorX = RADouble.NewRel(0);   // Left
            sx0.Title.Location.ParentAnchorY = RADouble.NewRel(0.5); // Center
            sx0.Title.Location.LocalAnchorX  = RADouble.NewRel(0.5); // Center
            sx0.Title.Location.LocalAnchorY  = RADouble.NewRel(1);   // Bottom
            sx0.Title.X = -Width / 3;
            sx0.Title.Y = 0;

            sy0.Title.Location.ParentAnchorX = RADouble.NewRel(0.5); // Center
            sy0.Title.Location.ParentAnchorY = RADouble.NewRel(0);   // Top
            sy0.Title.Location.LocalAnchorX  = RADouble.NewRel(0.5); // Center
            sy0.Title.Location.LocalAnchorY  = RADouble.NewRel(1);   // Bottom
            sy0.Title.X = 0;
            sy0.Title.Y = sy0.Title.Height / 2;

            // set the parent objects
            _axisStyles.ParentObject = this;
            _cachedArea.ParentObject = this;
            UpdateTransformationMatrix();
        }
		public AxisStyleControllerConditionalGlue(CSAxisInformation axisInfo, AxisStyleCollection axisStyleCollection)
		{
			_doc = axisStyleCollection;
			AxisInformation = axisInfo;
			InternalInitialize();
		}
 public AxisStyleControllerConditionalGlue(CSAxisInformation axisInfo, AxisStyleCollection axisStyleCollection)
 {
     _doc            = axisStyleCollection;
     AxisInformation = axisInfo;
     InternalInitialize();
 }
Beispiel #6
0
		public DensityImageLegend(DensityImagePlotItem plotItem, Main.IDocumentNode futureParentObject, PointD2D initialLocation, PointD2D graphicSize, Main.Properties.IReadOnlyPropertyBag context)
			: base(new ItemLocationDirect())
		{
			if (null == plotItem)
				throw new ArgumentNullException("plotItem");
			if (null == futureParentObject)
				throw new ArgumentNullException("futureParentObject");

			this.ParentObject = futureParentObject;
			this.PlotItem = plotItem;
			if (null == this._plotItemProxy.DocumentPath)
				throw new ArgumentException("No path could be found between plotItem and futureParentObject. This is an indication that one of the objects is not rooted.");

			this.SetSize(graphicSize.X, graphicSize.Y, Main.EventFiring.Suppressed);
			this.SetPosition(initialLocation, Main.EventFiring.Suppressed);

			// _orientationIsVertical = true;
			// _scaleIsReversed = false;

			var cachedScale = (NumericalScale)PlotItem.Style.Scale.Clone();
			var scaleTickSpacing = Altaxo.Graph.Scales.Scale.CreateDefaultTicks(cachedScale.GetType());
			_cachedArea = new DensityLegendArea(Size, true, false, cachedScale, scaleTickSpacing);
			//_cachedArea.ParentObject = this; // --> moved to the end of this function

			_axisStyles = new AxisStyleCollection();
			_axisStyles.UpdateCoordinateSystem(_cachedArea.CoordinateSystem);
			// _axisStyles.ParentObject = this; --> see below

			var sx0 = new AxisStyle(CSLineID.X0, true, true, false, "Z values", context);
			sx0.AxisLineStyle.FirstDownMajorTicks = true;
			sx0.AxisLineStyle.FirstUpMajorTicks = false;
			sx0.AxisLineStyle.FirstDownMinorTicks = true;
			sx0.AxisLineStyle.FirstUpMinorTicks = false;

			var sx1 = new AxisStyle(CSLineID.X1, true, false, false, null, context);
			sx1.AxisLineStyle.FirstDownMajorTicks = false;
			sx1.AxisLineStyle.FirstUpMajorTicks = false;
			sx1.AxisLineStyle.FirstDownMinorTicks = false;
			sx1.AxisLineStyle.FirstUpMinorTicks = false;

			var sy0 = new AxisStyle(CSLineID.Y0, true, false, false, "Color map", context);
			var sy1 = new AxisStyle(CSLineID.Y1, true, false, false, null, context);
			_axisStyles.Add(sx0);
			_axisStyles.Add(sx1);
			_axisStyles.Add(sy0);
			_axisStyles.Add(sy1);

			sx0.Title.Rotation = 90;
			sx0.Title.Location.ParentAnchorX = RADouble.NewRel(0); // Left
			sx0.Title.Location.ParentAnchorY = RADouble.NewRel(0.5); // Center
			sx0.Title.Location.LocalAnchorX = RADouble.NewRel(0.5); // Center
			sx0.Title.Location.LocalAnchorY = RADouble.NewRel(1); // Bottom
			sx0.Title.X = -Width / 3;
			sx0.Title.Y = 0;

			sy0.Title.Location.ParentAnchorX = RADouble.NewRel(0.5); // Center
			sy0.Title.Location.ParentAnchorY = RADouble.NewRel(0); // Top
			sy0.Title.Location.LocalAnchorX = RADouble.NewRel(0.5); // Center
			sy0.Title.Location.LocalAnchorY = RADouble.NewRel(1); // Bottom
			sy0.Title.X = 0;
			sy0.Title.Y = sy0.Title.Height / 2;

			// set the parent objects
			_axisStyles.ParentObject = this;
			_cachedArea.ParentObject = this;
			this.UpdateTransformationMatrix();
		}