Ejemplo n.º 1
0
        public IEnumerable <IProperty> getProperties(SpaceTime st)
        {
            Dictionary <string, IProperty> result = new Dictionary <string, IProperty>();

            foreach (IHistoricalGeographicMap map in maps)
            {
                Measurement value = map.get(st);
                if (value != null)
                {
                    result.Add(map.Name, new NamedProperty(map.Name, value, null));
                }
            }

            foreach (KeyValuePair <SpaceTime, IProperty> kvp in properties)
            {
                double overlap = st.Overlap(kvp.Key);
                if (overlap == 0)
                {
                    continue;
                }

                if (result.ContainsKey(kvp.Value.Name))
                {
                    result[kvp.Value.Name] = result[kvp.Value.Name].Merge(kvp.Value, overlap);
                }
                else
                {
                    result[kvp.Value.Name] = kvp.Value.Clone(overlap);
                }
            }

            return(result.Values);
        }
Ejemplo n.º 2
0
        public double Overlap(SpaceTime st)
        {
            if (longitude + eastward <= st.longitude || longitude >= st.longitude + st.eastward)
            {
                return(0);
            }
            if (latitude + northward <= st.latitude || latitude >= st.latitude + st.northward)
            {
                return(0);
            }
            if (time.Add(duration).CompareTo(st.time) <= 0 || st.time.Add(st.duration).CompareTo(time) >= 0)
            {
                return(0);
            }

            double eastwest = Math.Min(Math.Min(eastward, st.eastward),
                                       Math.Min(longitude + eastward - st.longitude, st.longitude + st.eastward - longitude));
            double northsouth = Math.Min(Math.Min(northward, st.northward),
                                         Math.Min(latitude + northward - st.latitude, st.latitude + st.northward - latitude));
            double seconds = Math.Min(Math.Min(duration.TotalSeconds, st.duration.TotalSeconds),
                                      Math.Min(time.Add(duration).Subtract(st.time).TotalSeconds, st.time.Add(st.duration).Subtract(time).TotalSeconds));

            return((eastwest / eastward) * (northsouth / northward) * (seconds / duration.TotalSeconds));
        }
Ejemplo n.º 3
0
 public abstract Measurement get(SpaceTime st);
Ejemplo n.º 4
0
 public void addProperty(SpaceTime st, IProperty property)
 {
     properties.Add(new KeyValuePair <SpaceTime, IProperty>(st, property));
 }