/// <summary> /// Initializes a new instance of the <see cref="Distance"/> class /// using the data read from persistent storage. /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> internal Distance(EditDeserializer editDeserializer) { double distance = editDeserializer.ReadDouble(DataField.Value); DistanceUnitType unitType = (DistanceUnitType)editDeserializer.ReadByte(DataField.Unit); m_EnteredUnit = EditingController.GetUnits(unitType); m_ObservedMetric = m_EnteredUnit.ToMetric(distance); if (editDeserializer.IsNextField(DataField.Fixed)) { m_IsFixed = editDeserializer.ReadBool(DataField.Fixed); } else { m_IsFixed = false; } if (editDeserializer.IsNextField(DataField.Flipped)) { IsAnnotationFlipped = editDeserializer.ReadBool(DataField.Flipped); } else { IsAnnotationFlipped = false; } }
/// <summary> /// Reads data that was previously written using <see cref="WriteData"/> /// </summary> /// <param name="editDeserializer">The mechanism for reading back content.</param> /// <param name="font">The text style</param> /// <param name="position">Position of the text's reference point</param> /// <param name="height">The height of the text, in meters on the ground.</param> /// <param name="width">The total width of the text, in meters on the ground.</param> /// <param name="rotation">Clockwise rotation from horizontal</param> static void ReadData(EditDeserializer editDeserializer, out IFont font, out PointGeometry position, out float height, out float width, out IAngle rotation) { if (editDeserializer.IsNextField(DataField.Font)) { int fontId = editDeserializer.ReadInt32(DataField.Font); font = EnvironmentContainer.FindFontById(fontId); } else { font = null; } position = editDeserializer.ReadPointGeometry(DataField.X, DataField.Y); width = (float)editDeserializer.ReadDouble(DataField.Width); height = (float)editDeserializer.ReadDouble(DataField.Height); rotation = editDeserializer.ReadRadians(DataField.Rotation); }