예제 #1
0
        private Tuple <CompoundIdentity, Point2 <double> > GetLocation(VegDataDTO item, EntityBundle sites)
        {
            CompoundIdentity id = null;

            if (!string.IsNullOrEmpty(item.SiteId) && sites.Contains(item.SiteId))
            {
                id = sites.Get(item.SiteId).EntityId;
            }
            Point2 <double> loc = null;

            if (item.AdHocLat.HasValue && item.AdHocLon.HasValue && !MathUtils.IsInfiniteOrNaN(item.AdHocLat.Value) && !MathUtils.IsInfiniteOrNaN(item.AdHocLon.Value))
            {
                loc = GeometryFactory2Double.Instance.ConstructPoint(item.AdHocLon.Value, item.AdHocLat.Value);
            }
            return(new Tuple <CompoundIdentity, Point2 <double> >(id, loc));
        }
예제 #2
0
        private VegSampleDTO GetSample(VegDataDTO item, EntityBundle sites, Dictionary <Tuple <CompoundIdentity, Point2 <double> >, Dictionary <DateTime, VegSampleDTO> > elements)
        {
            Dictionary <DateTime, VegSampleDTO>        element = null;
            Tuple <CompoundIdentity, Point2 <double> > loc     = GetLocation(item, sites);

            if (!elements.ContainsKey(loc))
            {
                element       = new Dictionary <DateTime, VegSampleDTO>();
                elements[loc] = element;
            }
            else
            {
                element = elements[loc];
            }
            if (element.ContainsKey(item.MeasureDateTime.Value))
            {
                return(element[item.MeasureDateTime.Value]);
            }

            VegSampleDTO res = new VegSampleDTO(loc.Item1, item.MeasureDateTime.Value, loc.Item2, float.NaN, float.NaN);

            element[item.MeasureDateTime.Value] = res;
            return(res);
        }