/// <summary>
        /// Creates a brand new graph which has an x-y plot layer. The graph is not named, nor is it already part of the project.
        /// </summary>
        /// <param name="propertyContext">The property context. Can be retrieved for instance from the table the plot is initiated or the folder.</param>
        /// <param name="folderName">Name of the folder.</param>
        /// <returns>The created graph.</returns>
        private static GraphDocument CreateBuiltinGraph(IReadOnlyPropertyBag propertyContext, string folderName)
        {
            if (null == propertyContext)
            {
                if (null != folderName)
                {
                    propertyContext = Altaxo.PropertyExtensions.GetPropertyContextOfProjectFolder(folderName);
                }
                else
                {
                    propertyContext = PropertyExtensions.GetPropertyContextOfProject();
                }
            }

            var graph = new GraphDocument();

            TemplateBase.AddStandardPropertiesToGraph(graph, propertyContext);

            // apply the default location from the property in the path
            graph.RootLayer.Location.CopyFrom(propertyContext.GetValue(GraphDocument.PropertyKeyDefaultRootLayerSize));
            var layer = new XYZPlotLayer(graph.RootLayer, new CS.G3DCartesicCoordinateSystem());

            graph.RootLayer.Layers.Add(layer);
            layer.CreateDefaultAxes(propertyContext);
            graph.ViewToRootLayerCenter(new VectorD3D(-1, -2, 1), new VectorD3D(0, 0, 1), 1);

            return(graph);
        }
예제 #2
0
 public PlotItemCollection(XYZPlotLayer owner)
 {
     _parent    = owner;
     _plotItems = new ObservableList <IGPlotItem>();
     _plotItems.CollectionChanged += EhPlotItemsCollectionChanged;
     _plotGroupStyles              = new PlotGroupStyleCollection()
     {
         ParentObject = this
     };
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlotItemCollection"/> class.
        /// </summary>
        /// <param name="owner">The owner of this collection.</param>
        /// <param name="plotItems">The plot items that should initially belong to this collection.</param>
        /// <param name="clonePlotItems">If set to <c>true</c> the plot items are cloned before added to this collection. If false, the plot items are added directly to this collection.</param>
        public PlotItemCollection(XYZPlotLayer owner, PlotItemCollection plotItems, bool clonePlotItems)
        {
            _parent          = owner;
            _plotGroupStyles = new PlotGroupStyleCollection()
            {
                ParentObject = this
            };
            if (clonePlotItems)
            {
                _plotItems = new ObservableList <IGPlotItem>(plotItems.Select(pi => { var result = (IGPlotItem)pi.Clone(); result.ParentObject = this; return(result); }));
            }
            else
            {
                _plotItems = new ObservableList <IGPlotItem>(plotItems);
            }
            _plotItems.CollectionChanged += EhPlotItemsCollectionChanged;

            // special way neccessary to handle plot groups
            ChildCopyToMember(ref _plotGroupStyles, plotItems._plotGroupStyles);
        }
		/// <summary>
		/// Creates a brand new graph which has an x-y plot layer. The graph is not named, nor is it already part of the project.
		/// </summary>
		/// <param name="propertyContext">The property context. Can be retrieved for instance from the table the plot is initiated or the folder.</param>
		/// <param name="folderName">Name of the folder.</param>
		/// <returns>The created graph.</returns>
		private static GraphDocument CreateBuiltinGraph(IReadOnlyPropertyBag propertyContext, string folderName)
		{
			if (null == propertyContext)
			{
				if (null != folderName)
					propertyContext = Altaxo.PropertyExtensions.GetPropertyContextOfProjectFolder(folderName);
				else
					propertyContext = PropertyExtensions.GetPropertyContextOfProject();
			}

			var graph = new GraphDocument();
			TemplateBase.AddStandardPropertiesToGraph(graph, propertyContext);

			// apply the default location from the property in the path
			graph.RootLayer.Location.CopyFrom(propertyContext.GetValue(GraphDocument.PropertyKeyDefaultRootLayerSize));
			var layer = new XYZPlotLayer(graph.RootLayer, new CS.G3DCartesicCoordinateSystem());
			graph.RootLayer.Layers.Add(layer);
			layer.CreateDefaultAxes(propertyContext);
			graph.ViewToRootLayerCenter(new VectorD3D(-1, -2, 1), new VectorD3D(0, 0, 1), 1);

			return graph;
		}
예제 #5
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _parentLayerOfOriginalDoc = AbsoluteDocumentPath.GetRootNodeImplementing <XYZPlotLayer>(_doc);

                _locationController = (IMVCANController)Current.Gui.GetController(new object[] { _doc.Location }, typeof(IMVCANController), UseDocument.Directly);
                Current.Gui.FindAndAttachControlTo(_locationController);
            }

            if (_view != null)
            {
                _view.BeginUpdate();

                _view.SelectedBackground = _doc.Background;

                _view.EditText = _doc.Text;

                // fill the font name combobox with all fonts
                _view.SelectedFont = _doc.Font;

                _view.SelectedLineSpacing = _doc.LineSpacing;

                // fill the font size combobox with reasonable values
                //this.m_cbFontSize.Items.AddRange(new string[] { "8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "26", "28", "36", "48", "72" });
                //this.m_cbFontSize.Text = m_TextObject.Font.Size.ToString();

                // fill the color dialog box
                _view.SelectedFontBrush = _doc.TextFillBrush;

                _view.LocationView = _locationController.ViewObject;

                _view.EndUpdate();
            }
        }
예제 #6
0
 /// <summary>
 /// Fires the Invalidate event.
 /// </summary>
 /// <param name="sender">The layer which needs to be repainted.</param>
 protected internal virtual void OnInvalidate(XYZPlotLayer sender)
 {
     EhSelfChanged(EventArgs.Empty);
 }