Esempio n. 1
0
            private void DeserializeAnnotationBoxes(StoredAnnotationBoxGroup group, XmlNodeList annotationBoxNodes)
            {
                foreach (XmlElement annotationBoxNode in annotationBoxNodes)
                {
                    string normalizedRectangleString = annotationBoxNode.GetAttribute("normalized-rectangle");

                    RectangleF normalizedRectangle;
                    if (!DeserializeNormalizedRectangle(normalizedRectangleString, out normalizedRectangle))
                    {
                        continue;
                    }

                    XmlElement boxSettingsNode = (XmlElement)annotationBoxNode.SelectSingleNode("box-settings");

                    AnnotationBox newBox = group.DefaultBoxSettings.Clone();
                    newBox.NormalizedRectangle = normalizedRectangle;

                    if (boxSettingsNode != null)
                    {
                        DeserializeBoxSettings(newBox, boxSettingsNode);
                    }

                    string annotationItemIdentifier = annotationBoxNode.GetAttribute("annotation-item-id");
                    foreach (IAnnotationItem item in _availableAnnotationItems)
                    {
                        if (item.GetIdentifier() == annotationItemIdentifier)
                        {
                            newBox.AnnotationItem = item;
                            break;
                        }
                    }

                    group.AnnotationBoxes.Add(newBox);
                }
            }
Esempio n. 2
0
            private void DeserializeAnnotationBoxGroups(StoredAnnotationLayout layout, XmlNodeList groupNodes)
            {
                foreach (XmlElement groupNode in groupNodes)
                {
                    string newGroupId = groupNode.GetAttribute("id");
                    StoredAnnotationBoxGroup newGroup = new StoredAnnotationBoxGroup(newGroupId);

                    XmlElement defaultBoxSettingsNode = (XmlElement)groupNode.SelectSingleNode("default-box-settings");

                    if (defaultBoxSettingsNode != null)
                    {
                        DeserializeBoxSettings(newGroup.DefaultBoxSettings, defaultBoxSettingsNode);
                    }

                    XmlNodeList annotationBoxNodes = groupNode.SelectNodes("annotation-boxes/annotation-box");
                    if (annotationBoxNodes != null)
                    {
                        DeserializeAnnotationBoxes(newGroup, annotationBoxNodes);
                    }

                    layout.AnnotationBoxGroups.Add(newGroup);
                }
            }
Esempio n. 3
0
			private void DeserializeAnnotationBoxes(StoredAnnotationBoxGroup group, XmlNodeList annotationBoxNodes)
			{
				foreach (XmlElement annotationBoxNode in annotationBoxNodes)
				{
					string normalizedRectangleString = annotationBoxNode.GetAttribute("normalized-rectangle");

					RectangleF normalizedRectangle;
					if (!DeserializeNormalizedRectangle(normalizedRectangleString, out normalizedRectangle))
						continue;

					XmlElement boxSettingsNode = (XmlElement)annotationBoxNode.SelectSingleNode("box-settings");

					AnnotationBox newBox = group.DefaultBoxSettings.Clone();
					newBox.NormalizedRectangle = normalizedRectangle;

					if (boxSettingsNode != null)
						DeserializeBoxSettings(newBox, boxSettingsNode);

					string annotationItemIdentifier = annotationBoxNode.GetAttribute("annotation-item-id");
					foreach (IAnnotationItem item in _availableAnnotationItems)
					{
						if (item.GetIdentifier() == annotationItemIdentifier)
						{
							newBox.AnnotationItem = item;
							break;
						}
					}

					group.AnnotationBoxes.Add(newBox);
				}
			}
Esempio n. 4
0
			private void DeserializeAnnotationBoxGroups(StoredAnnotationLayout layout, XmlNodeList groupNodes)
			{
				foreach (XmlElement groupNode in groupNodes)
				{
					string newGroupId = groupNode.GetAttribute("id");
					StoredAnnotationBoxGroup newGroup = new StoredAnnotationBoxGroup(newGroupId);

					XmlElement defaultBoxSettingsNode = (XmlElement)groupNode.SelectSingleNode("default-box-settings");

					if (defaultBoxSettingsNode != null)
						DeserializeBoxSettings(newGroup.DefaultBoxSettings, defaultBoxSettingsNode);

					XmlNodeList annotationBoxNodes = groupNode.SelectNodes("annotation-boxes/annotation-box");
					if (annotationBoxNodes != null)
						DeserializeAnnotationBoxes(newGroup, annotationBoxNodes);

					layout.AnnotationBoxGroups.Add(newGroup);
				}
			}
		/// <summary>
		/// Cloning constructor.
		/// </summary>
		/// <param name="source">The source object from which to clone.</param>
		/// <param name="context">This parameter is unused.</param>
		private StoredAnnotationBoxGroup(StoredAnnotationBoxGroup source, ICloningContext context)
		{
			this._identifier = source._identifier;
			this._defaultBoxSettings = source._defaultBoxSettings.Clone();
			this._annotationBoxes = source._annotationBoxes.Clone();
		}
 /// <summary>
 /// Cloning constructor.
 /// </summary>
 /// <param name="source">The source object from which to clone.</param>
 /// <param name="context">This parameter is unused.</param>
 private StoredAnnotationBoxGroup(StoredAnnotationBoxGroup source, ICloningContext context)
 {
     this._identifier         = source._identifier;
     this._defaultBoxSettings = source._defaultBoxSettings.Clone();
     this._annotationBoxes    = source._annotationBoxes.Clone();
 }