/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public virtual void WriteData(EditSerializer editSerializer) { if (m_Font != null) { editSerializer.WriteInt32(DataField.Font, m_Font.Id); } editSerializer.WritePointGeometry(DataField.X, DataField.Y, m_Position); editSerializer.WriteDouble(DataField.Width, Math.Round((double)m_Width, 2)); editSerializer.WriteDouble(DataField.Height, Math.Round((double)m_Height, 2)); // TODO: May want to cover indirect rotations editSerializer.WriteRadians(DataField.Rotation, new RadianValue(m_Rotation.Radians)); }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public override void WriteData(EditSerializer editSerializer) { editSerializer.WriteBool(DataField.Clockwise, m_IsClockwise); // If the circle's first arc has geometry that corresponds to this instance, write // out the circle center point. Otherwise refer to the first arc (we'll get the // circle geometry from there). if (Object.ReferenceEquals(m_Circle.FirstArc.Geometry, this)) { editSerializer.WriteFeatureRef <PointFeature>(DataField.Center, m_Circle.CenterPoint); } else { editSerializer.WriteFeatureRef <ArcFeature>(DataField.FirstArc, m_Circle.FirstArc); } }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public override void WriteData(EditSerializer editSerializer) { // Express the data as one long string (about 30 chars per position) var sb = new StringBuilder(30 * m_Data.Length); foreach (IPointGeometry p in m_Data) { if (sb.Length > 0) { sb.Append(","); } sb.Append(p.Easting.Meters); sb.Append(" "); sb.Append(p.Northing.Meters); } editSerializer.WriteString(DataField.LineString, sb.ToString()); }
/// <summary> /// Checks whether two observations are the same. By rights, this should be /// included as part of <c>Observation</c> classes. It's here only because /// the method for making the comparison is a bit dumb, and I don't want to /// make use of it more generally. /// </summary> /// <param name="a">The first observation</param> /// <param name="b">The observation to compare with</param> /// <returns></returns> bool IsEqual(Observation a, Observation b) { if (a == null || b == null) { return(a == null && b == null); } else { if (Object.ReferenceEquals(a, b)) { return(true); } // The following is kind of heavy-handed string sa = EditSerializer.GetSerializedString <Observation>(DataField.Test, a); string sb = EditSerializer.GetSerializedString <Observation>(DataField.Test, b); return(sa.Equals(sb)); } }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public override void WriteData(EditSerializer editSerializer) { base.WriteData(editSerializer); }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public virtual void WriteData(EditSerializer editSerializer) { editSerializer.WriteUInt32(DataField.Id, m_Sequence); editSerializer.WriteDateTime(DataField.When, m_When); }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public override void WriteData(EditSerializer editSerializer) { // RowTextGeometry must be written out via the RowTextContent class. throw new ApplicationException("Unexpected attempt to serialize RowTextGeometry"); }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public void WriteData(EditSerializer editSerializer) { editSerializer.WriteInternalId(DataField.Id, m_InternalId); editSerializer.WriteEntity(DataField.Entity, m_What); editSerializer.WriteFeatureId(m_Id); }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public void WriteData(EditSerializer editSerializer) { editSerializer.WriteInternalId(DataField.Id, m_InternalId); editSerializer.WriteUInt32(DataField.Key, m_RawId); }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> abstract public void WriteData(EditSerializer editSerializer);
/// <summary> /// Opens an editing project that was previously created. /// </summary> /// <param name="projectName">The user-perceived name of the project</param> /// <returns>Information describing the state of the project (null if it could not be found).</returns> internal Project OpenProject(string projectName) { if (String.IsNullOrWhiteSpace(projectName)) { throw new ArgumentNullException(); } // Obtain the project ID string projectGuid = FindProjectId(projectName); if (projectGuid == null) { throw new ApplicationException(); } // Load the project creation event Guid projectId = Guid.Parse(projectGuid); string dataFolder = CreateDataFolder(projectId); string creationFileName = Path.Combine(dataFolder, NewProjectEvent.FileName); // Read current project settings dataFolder = CreateDataFolder(projectId); string settingsFileName = Path.Combine(dataFolder, "settings.txt"); ProjectSettings ps = ProjectSettings.CreateInstance(settingsFileName); Settings.Default.LastProjectName = projectName; Settings.Default.Save(); // Now load the data Project result = new Project(this, projectId, ps); // Get rid of any undo folder that may be left over from a crashed editing session result.DeleteUndoFolder(); // Bit jumbled up here (historical reasons), should tidy up... EditingController.Current.SetProject(result); result.LoadEdits(dataFolder); //EditingController.Current.SetProject(result); EditingController.Current.SetMapModel(result.Model, null); result.Model.Load(); // Get rid of any empty sessions //result.Model.RemoveEmptySessions(); // Debug CedExporter string ptsFileName = Path.Combine(dataFolder, projectName + ".pts"); CheckPts(ptsFileName, result.Model); // Need to set it again (need to find out why)... if you don't you get a null // ref on opening last project at startup EditingController.Current.SetMapModel(result.Model, null); // Create a new editing session uint sessionId = result.AllocateId(); NewSessionEvent s = new NewSessionEvent(sessionId) { UserName = System.Environment.UserName, MachineName = System.Environment.MachineName, }; string sessionFile = Path.Combine(dataFolder, GetDataFileName(sessionId)); string sessionText = EditSerializer.GetSerializedString <Change>(DataField.Edit, s); File.WriteAllText(sessionFile, sessionText); Session session = new Session(result, s, sessionFile); result.Model.AddSession(session); result.Model.SetWorkingSession(session); result.SetLastItem(session.Id); return(result); }
/// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public override void WriteData(EditSerializer editSerializer) { editSerializer.WriteFeatureRef <LineFeature>(DataField.Base, m_Base); }
/// <summary> /// Makes a copy of this text. /// </summary> /// <param name="where">The position for the copy. Specify null if the copy should /// be at the same position as this text.</param> /// <returns>The copy that was created.</returns> /* * TextGeometry MakeText(IPosition where) * { * // If a position was not specified, get the position of this text. * IPosition pos = (where==null ? this.Position : where); * * // Create a new key text object. * MiscText text = new MiscText(pos, m_Text); * * // Pick up info from this object ... the constructor did it. * * // Pick up info from the base class. * DefineText(text); * return text; * } */ /// <summary> /// Extracts this text primitive into another map. /// </summary> /// <param name="xref">Info about the extract.</param> /// <param name="exLabel">The extract label that has already been created.</param> /// <returns>The text that was created.</returns> /* * TextGeometry Extract(ExTranslation xref, TextFeature exLabel) * { * throw new NotImplementedException(); * * // What map are we extracting into? * CeMap& output = xref.GetExMap(); * * // Create a new misc-text primitive in the output map. * CeVertex pos(GetEasting(),GetNorthing()); * CeMiscText* pEx = new ( os_database::of(&output) * , os_ts<CeMiscText>::get() ) * CeMiscText(pos,m_pString); * * // Define base class stuff. * CeText::Extract(xref,*pEx); * * // Return the address of the text we created. * return pEx; * } */ /// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public override void WriteData(EditSerializer editSerializer) { base.WriteData(editSerializer); editSerializer.WriteString(DataField.Text, m_Text); }
/* * // @mfunc Create transient primitives (CeMiscText objects, and * // optionally CeSegment objects) that correspond * // to any angles associated with this point. * // * // The caller is responsible for deleting the primitives * // once done with them. * // * // @parm List of pointers to created primitives. * // @parm Should lines be produced too? NOT IMPLEMENTED. * // * // @rdesc The number of primitives that were created (if any). * // * ////////////////////////////////////////////////////////////////////// * #include "CeMiscText.h" * * UINT4 CePoint::CreateAngleText ( CPtrList& prims * , const LOGICAL wantLinesToo ) const { * * // Get the creating op to create any angle text for * // this point. * CeOperation* pop = GetpCreator(); * if ( pop ) pop->CreateAngleText(prims,wantLinesToo,this); * * // Get the location to do the same for any operations that * // utilize this point as part of an angular observation. * m_pLocation->CreateAngleText(prims,wantLinesToo,this); * * // Return the number of primitives in the list. * return prims.GetCount(); * * } // end of CreateAngleText */ /// <summary> /// Writes the content of this instance to a persistent storage area. /// </summary> /// <param name="editSerializer">The mechanism for storing content.</param> public override void WriteData(EditSerializer editSerializer) { base.WriteData(editSerializer); editSerializer.WritePointGeometry(DataField.X, DataField.Y, m_Geom); }