/// <summary>
            /// Serializes DensityImagePlotItem Version 0.
            /// </summary>
            /// <param name="obj">The DensityImagePlotItem to serialize.</param>
            /// <param name="info">The serialization info.</param>
            /// <param name="context">The streaming context.</param>
            public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            {
                DensityImagePlotItem s = (DensityImagePlotItem)obj;

                info.AddValue("Data", s.m_PlotAssociation);
                info.AddValue("Style", s.m_PlotStyle);
            }
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                DensityImagePlotItem s = (DensityImagePlotItem)obj;

                info.AddValue("Data", s.m_PlotAssociation);
                info.AddValue("Style", s.m_PlotStyle);
            }
            /// <summary>
            /// Deserializes the DensityImagePlotItem Version 0.
            /// </summary>
            /// <param name="obj">The empty DensityImagePlotItem object to deserialize into.</param>
            /// <param name="info">The serialization info.</param>
            /// <param name="context">The streaming context.</param>
            /// <param name="selector">The deserialization surrogate selector.</param>
            /// <returns>The deserialized DensityImagePlotItem.</returns>
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                DensityImagePlotItem s = (DensityImagePlotItem)obj;

                s.m_PlotAssociation = (XYZMeshedColumnPlotData)info.GetValue("Data", typeof(XYZMeshedColumnPlotData));
                s.m_PlotStyle       = (DensityImagePlotStyle)info.GetValue("Style", typeof(DensityImagePlotStyle));

                return(s);
            }
        /// <summary>
        /// Sets the plot style (or sub plot styles) in this item according to a template provided by the plot item in the template argument.
        /// </summary>
        /// <param name="template">The template item to copy the plot styles from.</param>
        /// <param name="strictness">Denotes the strictness the styles are copied from the template. See <see cref="PlotGroupStrictness" /> for more information.</param>
        public override void SetPlotStyleFromTemplate(IGPlotItem template, PlotGroupStrictness strictness)
        {
            if (!(template is DensityImagePlotItem))
            {
                return;
            }
            DensityImagePlotItem from = (DensityImagePlotItem)template;
//      m_PlotStyle.CopyFrom(from.m_PlotStyle);
        }
        protected override void CopyFrom(PlotItem fromb)
        {
            base.CopyFrom(fromb);

            DensityImagePlotItem from = fromb as DensityImagePlotItem;

            if (null != from)
            {
                this.Data  = from.Data;  // also wires the event
                this.Style = from.Style; // also wires the event
            }
        }
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                XYZMeshedColumnPlotData pa = (XYZMeshedColumnPlotData)info.GetValue("Data", o);
                DensityImagePlotStyle   ps = (DensityImagePlotStyle)info.GetValue("Style", o);

                if (o == null)
                {
                    return(new DensityImagePlotItem(pa, ps));
                }
                else
                {
                    DensityImagePlotItem s = (DensityImagePlotItem)o;
                    s.Data  = pa;
                    s.Style = ps;
                    return(s);
                }
            }
    public bool InitializeDocument(params object[] args)
    {
      if (args == null || args.Length == 0)
        return false;

      if (!(args[0] is DensityImagePlotItem))
        return false;
      else
        _doc = _tempdoc = (DensityImagePlotItem)args[0];

     

      if (_useDocument == UseDocument.Copy)
        _tempdoc = (DensityImagePlotItem)_doc.Clone();

      InitializeStyle();
      BringTabToFront(0);

      return true;
    }
		public DensityImagePlotItem(DensityImagePlotItem from)
		{
			CopyFrom(from);
		}
 public DensityImagePlotItem(DensityImagePlotItem from)
 {
     CopyFrom(from);
 }
Exemple #10
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();
		}
Exemple #11
0
		/// <summary>
		/// Plots a density image of the selected columns.
		/// </summary>
		/// <param name="dg"></param>
		/// <param name="bLine"></param>
		/// <param name="bScatter"></param>
		public static void PlotDensityImage(IWorksheetController dg, bool bLine, bool bScatter)
		{
			var graph = Altaxo.Graph.Gdi.GraphTemplates.TemplateWithXYPlotLayerWithG2DCartesicCoordinateSystem.CreateGraph(dg.DataTable.GetPropertyContext(), null, dg.DataTable.Name, true);
			var xylayer = graph.RootLayer.Layers.OfType<XYPlotLayer>().First();
			var context = graph.GetPropertyContext();

			DensityImagePlotStyle plotStyle = new DensityImagePlotStyle();

			XYZMeshedColumnPlotData assoc = new XYZMeshedColumnPlotData(dg.DataTable, dg.SelectedDataRows, dg.SelectedDataColumns, dg.SelectedPropertyColumns);
			if (assoc.DataTableMatrix.RowHeaderColumn == null)
				assoc.DataTableMatrix.RowHeaderColumn = new IndexerColumn();
			if (assoc.DataTableMatrix.ColumnHeaderColumn == null)
				assoc.DataTableMatrix.ColumnHeaderColumn = new IndexerColumn();

			IGPlotItem pi = new DensityImagePlotItem(assoc, plotStyle);
			xylayer.PlotItems.Add(pi);
			Current.ProjectService.CreateNewGraph(graph);
		}