/// <summary>
        /// Initializes a new instance of the <see cref="LineSubdivisionFace"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal LineSubdivisionFace(EditDeserializer editDeserializer)
        {
            m_IsEntryFromEnd = editDeserializer.ReadBool(DataField.EntryFromEnd);
            m_Distances = editDeserializer.ReadPersistentArray<Distance>(DataField.Sections);

            // The sections are calculated ??
            m_Sections = null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LineSubdivisionFace"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal LineSubdivisionFace(EditDeserializer editDeserializer)
        {
            m_IsEntryFromEnd = editDeserializer.ReadBool(DataField.EntryFromEnd);
            m_Distances      = editDeserializer.ReadPersistentArray <Distance>(DataField.Sections);

            // The sections are calculated ??
            m_Sections = null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ImportOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal ImportOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            if (editDeserializer.IsNextField(DataField.Source))
                m_Source = editDeserializer.ReadString(DataField.Source);
            else
                m_Source = String.Empty;

            m_Data = editDeserializer.ReadPersistentArray<Feature>(DataField.Features);
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PolygonSubdivisionOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal PolygonSubdivisionOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            if (editDeserializer.IsNextField(DataField.DeactivatedLabel))
            {
                m_Label            = editDeserializer.ReadFeatureRef <TextFeature>(DataField.DeactivatedLabel);
                m_Label.IsInactive = true; // later ?
            }

            m_Lines = editDeserializer.ReadPersistentArray <LineFeature>(DataField.Lines);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PolygonSubdivisionOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal PolygonSubdivisionOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            if (editDeserializer.IsNextField(DataField.DeactivatedLabel))
            {
                m_Label = editDeserializer.ReadFeatureRef<TextFeature>(DataField.DeactivatedLabel);
                m_Label.IsInactive = true; // later ?
            }

            m_Lines = editDeserializer.ReadPersistentArray<LineFeature>(DataField.Lines);
        }
        /// <summary>
        /// Reads back updates made to an editing operation.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        /// <returns>The changes made to the edit</returns>
        public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer)
        {
            UpdateItemCollection result = new UpdateItemCollection();

            if (editDeserializer.IsNextField(DataField.Face))
            {
                Distance[] face = editDeserializer.ReadPersistentArray <Distance>(DataField.Face);
                result.Add(new UpdateItem(DataField.Face, face));
            }

            return(result);
        }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PathOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal PathOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            //try
            //{
            m_From             = editDeserializer.ReadFeatureRef <PointFeature>(DataField.From);
            m_To               = editDeserializer.ReadFeatureRef <PointFeature>(DataField.To);
            m_EntryString      = editDeserializer.ReadString(DataField.EntryString);
            m_DefaultEntryUnit = editDeserializer.ReadDistanceUnit(DataField.DefaultEntryUnit);

            Leg[] legs = PathParser.CreateLegs(m_EntryString, m_DefaultEntryUnit);
            PrepareLegs(this.EditSequence, legs);
            m_Legs = new List <Leg>(legs);

            Project p         = editDeserializer.Project;
            IEntity pointType = editDeserializer.ReadEntity(DataField.PointType);
            IEntity lineType  = editDeserializer.ReadEntity(DataField.LineType);

            // Pick up any alternate faces (these may be defined ONLY when dealing with
            // data files that were derived from old CEdit files). The deserializaing
            // constructor will connect the alternate faces to the legs we've just
            // created.
            if (editDeserializer.IsNextField(DataField.AlternateFaces))
            {
                editDeserializer.ReadPersistentArray <LegFace>(DataField.AlternateFaces);
            }

            // Create stubs for everything that we could conceivably create (including
            // any alternate faces).
            FeatureStub[] stubs = CreateStubs(p, pointType, lineType);

            var result = new DeserializationFactory(this, stubs);

            result.PointType = pointType;
            result.LineType  = lineType;

            // Create feature objects
            ProcessFeatures(result);

            // Apply any IDs
            if (editDeserializer.IsNextField(DataField.Ids))
            {
                editDeserializer.ReadIdMappings(DataField.Ids);
            }
            //}

            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
Exemple #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImportOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal ImportOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            if (editDeserializer.IsNextField(DataField.Source))
            {
                m_Source = editDeserializer.ReadString(DataField.Source);
            }
            else
            {
                m_Source = String.Empty;
            }

            m_Data = editDeserializer.ReadPersistentArray <Feature>(DataField.Features);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UpdateOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal UpdateOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            if (editDeserializer.IsNextField(DataField.RevisedEdits))
            {
                m_Revisions = editDeserializer.ReadPersistentArray<RevisedEdit>(DataField.RevisedEdits);
            }
            else
            {
                RevisedEdit rev = new RevisedEdit(editDeserializer);
                m_Revisions = new RevisedEdit[] { rev };
            }

            m_IsApplied = false;
        }
Exemple #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UpdateOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal UpdateOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            if (editDeserializer.IsNextField(DataField.RevisedEdits))
            {
                m_Revisions = editDeserializer.ReadPersistentArray <RevisedEdit>(DataField.RevisedEdits);
            }
            else
            {
                RevisedEdit rev = new RevisedEdit(editDeserializer);
                m_Revisions = new RevisedEdit[] { rev };
            }

            m_IsApplied = false;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PathOperation"/> class
        /// using the data read from persistent storage.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        internal PathOperation(EditDeserializer editDeserializer)
            : base(editDeserializer)
        {
            //try
            //{
                m_From = editDeserializer.ReadFeatureRef<PointFeature>(DataField.From);
                m_To = editDeserializer.ReadFeatureRef<PointFeature>(DataField.To);
                m_EntryString = editDeserializer.ReadString(DataField.EntryString);
                m_DefaultEntryUnit = editDeserializer.ReadDistanceUnit(DataField.DefaultEntryUnit);

                Leg[] legs = PathParser.CreateLegs(m_EntryString, m_DefaultEntryUnit);
                PrepareLegs(this.EditSequence, legs);
                m_Legs = new List<Leg>(legs);

                Project p = editDeserializer.Project;
                IEntity pointType = editDeserializer.ReadEntity(DataField.PointType);
                IEntity lineType = editDeserializer.ReadEntity(DataField.LineType);

                // Pick up any alternate faces (these may be defined ONLY when dealing with
                // data files that were derived from old CEdit files). The deserializaing
                // constructor will connect the alternate faces to the legs we've just
                // created.
                if (editDeserializer.IsNextField(DataField.AlternateFaces))
                    editDeserializer.ReadPersistentArray<LegFace>(DataField.AlternateFaces);

                // Create stubs for everything that we could conceivably create (including
                // any alternate faces).
                FeatureStub[] stubs = CreateStubs(p, pointType, lineType);

                var result = new DeserializationFactory(this, stubs);
                result.PointType = pointType;
                result.LineType = lineType;

                // Create feature objects
                ProcessFeatures(result);

                // Apply any IDs
                if (editDeserializer.IsNextField(DataField.Ids))
                    editDeserializer.ReadIdMappings(DataField.Ids);
            //}

            //catch (Exception ex)
            //{
            //    throw ex;
            //}
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetControlOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal GetControlOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     PointFeature[] points = editDeserializer.ReadPersistentArray <PointFeature>(DataField.Points);
     m_Features = new List <PointFeature>(points);
 }
        /// <summary>
        /// Reads back updates made to an editing operation.
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        /// <returns>The changes made to the edit</returns>
        public UpdateItemCollection ReadUpdateItems(EditDeserializer editDeserializer)
        {
            UpdateItemCollection result = new UpdateItemCollection();

            if (editDeserializer.IsNextField(DataField.Face))
            {
                Distance[] face = editDeserializer.ReadPersistentArray<Distance>(DataField.Face);
                result.Add(new UpdateItem(DataField.Face, face));
            }

            return result;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetControlOperation"/> class
 /// using the data read from persistent storage.
 /// </summary>
 /// <param name="editDeserializer">The mechanism for reading back content.</param>
 internal GetControlOperation(EditDeserializer editDeserializer)
     : base(editDeserializer)
 {
     PointFeature[] points = editDeserializer.ReadPersistentArray<PointFeature>(DataField.Points);
     m_Features = new List<PointFeature>(points);
 }