Ejemplo n.º 1
0
        /// <summary>
        /// Formats the trajectory station data.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="parser">The query parser.</param>
        /// <returns>A collection of formatted trajectory stations.</returns>
        protected virtual List <TChild> FormatStationData(T entity, WitsmlQueryParser parser)
        {
            var returnElements = parser.ReturnElements();
            var stations       = GetTrajectoryStations(entity);

            if (OptionsIn.ReturnElements.All.Equals(returnElements) ||
                OptionsIn.ReturnElements.DataOnly.Equals(returnElements) ||
                !parser.IncludeTrajectoryStations())
            {
                return(stations);
            }

            var stationParser = parser
                                .ForkProperties(ObjectTypes.TrajectoryStation, ObjectTypes.TrajectoryStation)
                                .FirstOrDefault();

            if ((stationParser == null && !OptionsIn.ReturnElements.StationLocationOnly.Equals(returnElements)) ||
                (stationParser != null && !stationParser.HasElements() && !stationParser.Element().HasAttributes))
            {
                return(stations);
            }

            const string prefix = "TrajectoryStation.";

            var fields = GetProjectionPropertyNames(parser)
                         .Where(x => x.StartsWith(prefix))
                         .Select(x => x.Substring(prefix.Length))
                         .ToList();

            var mapper = new DataObjectMapper <TChild>(Container, stationParser, fields);

            return(mapper.Map(stations));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Formats the mudlog geology interval data.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <param name="parser">The query parser.</param>
        /// <returns>A collection of formatted mudlog geology intervals.</returns>
        protected virtual List <TChild> FormatGeologyIntervalData(T entity, WitsmlQueryParser parser)
        {
            var returnElements   = parser.ReturnElements();
            var geologyIntervals = GetGeologyIntervals(entity);

            if (OptionsIn.ReturnElements.All.Equals(returnElements) ||
                OptionsIn.ReturnElements.DataOnly.Equals(returnElements) ||
                !parser.IncludeGeologyIntervals())
            {
                return(geologyIntervals);
            }

            var geologyIntervalParser = parser
                                        .ForkProperties(ObjectTypes.GeologyInterval, ObjectTypes.GeologyInterval)
                                        .FirstOrDefault();

            if ((geologyIntervalParser != null && !geologyIntervalParser.HasElements() && !geologyIntervalParser.Element().HasAttributes))
            {
                return(geologyIntervals);
            }

            const string prefix = "GeologyInterval.";

            var fields = GetProjectionPropertyNames(parser)
                         .Where(x => x.StartsWith(prefix))
                         .Select(x => x.Substring(prefix.Length))
                         .ToList();

            var mapper = new DataObjectMapper <TChild>(Container, geologyIntervalParser, fields);

            return(mapper.Map(geologyIntervals));
        }