/// <summary> /// Initializes a new instance of the <see cref="ArcGeometry"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal ArcGeometry(EditDeserializer editDeserializer) : base(editDeserializer) { m_IsClockwise = editDeserializer.ReadBool(DataField.Clockwise); if (editDeserializer.IsNextField(DataField.Center)) { PointFeature center = editDeserializer.ReadFeatureRef <PointFeature>(this, DataField.Center); // The arc is the first arc attached to the circle. However, we cannot // calculate the radius just yet because the bc/ec points are not persisted // as part of the ArcGeometry definition (they are defined as part of the // LineFeature object that utilizes the ArcGeometry). // Even if we did have the bc/ec points at this stage, their positions will // only be available if the data came from an import (they will still be // undefined if the geometry is calculated, since calculation only occurs // after deserialization has been completed). if (center != null) { ApplyFeatureRef(DataField.Center, center); } } else { ArcFeature firstArc = editDeserializer.ReadFeatureRef <ArcFeature>(this, DataField.FirstArc); if (firstArc != null) { ApplyFeatureRef(DataField.FirstArc, firstArc); } } }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="isTopological">Are we dealing with a polygon label</param> /// <param name="polPos">The label reference point (usually applies onlt to polygon labels). Null if it's /// identical to the position recorded via the geometry object.</param> /// <param name="geom">The geometry for the text.</param> static void ReadData(EditDeserializer editDeserializer, out bool isTopological, out PointGeometry polPos, out TextGeometry geom) { isTopological = editDeserializer.ReadBool(DataField.Topological); if (editDeserializer.IsNextField(DataField.PolygonX)) { polPos = editDeserializer.ReadPointGeometry(DataField.PolygonX, DataField.PolygonY); } else { polPos = null; } geom = editDeserializer.ReadPersistent <TextGeometry>(DataField.Type); }