public static void ExtractTimeSlice(INetworkCoverage source, INetworkCoverage targetSlice /* bad name */, DateTime dateTime, bool copyLocations) { if (!source.IsTimeDependent) { throw new ArgumentException("ExtractTimeSlice: source network coverage should be time dependent.", "source"); } IMultiDimensionalArray <INetworkLocation> networkLocations = copyLocations ? source.Locations.Values : targetSlice.Locations.Values; IMultiDimensionalArray values; if (copyLocations) { values = source.GetValues(new VariableValueFilter <DateTime>(source.Arguments[0], dateTime)); } else { values = source.GetValues(new VariableValueFilter <DateTime>(source.Arguments[0], dateTime), new VariableValueFilter <INetworkLocation>(source.Arguments[1], networkLocations)); } var clonedValues = new ArrayList(values); var clonedLocations = networkLocations.ToArray(); if (copyLocations) { targetSlice.Clear(); targetSlice.Locations.Values.AddRange(clonedLocations); targetSlice.Components[0].NoDataValues = new ArrayList(source.Components[0].NoDataValues); } targetSlice.SetValues(clonedValues); }
public static void ExtractTimeSlice(INetworkCoverage source, INetworkCoverage targetSlice /* bad name */, DateTime dateTime, bool copyLocations) { if (!source.IsTimeDependent) { throw new ArgumentException("ExtractTimeSlice: source network coverage should be time dependent.", "source"); } IEnumerable <INetworkLocation> networkLocations = null; if (copyLocations) { networkLocations = source.Arguments[1].GetValues().Cast <INetworkLocation>(); targetSlice.Clear(); targetSlice.Locations.Values.AddRange(networkLocations); } else { networkLocations = targetSlice.Arguments[0].GetValues().Cast <INetworkLocation>(); // networkLocations = new ArrayList(targetSlice.Arguments[0].GetValues()); } targetSlice.Components[0].NoDataValues = new ArrayList(source.Components[0].NoDataValues); IMultiDimensionalArray values; //var values = source.GetValues(new VariableValueFilter(source.Arguments[0], new[] { dateTime })); if (copyLocations) { values = source.GetValues(new VariableValueFilter <DateTime>(source.Arguments[0], dateTime)); } else { values = source.GetValues(new VariableValueFilter <DateTime>(source.Arguments[0], dateTime), new VariableValueFilter <INetworkLocation>(source.Arguments[1], networkLocations)); } targetSlice.SetValues(values); }
public static void ExtractTimeSlice(INetworkCoverage source, INetworkCoverage targetSlice /* bad name */, DateTime dateTime, bool copyLocations) { if (!source.IsTimeDependent) { throw new ArgumentException("ExtractTimeSlice: source network coverage should be time dependent.", "source"); } IMultiDimensionalArray<INetworkLocation> networkLocations = copyLocations ? source.Locations.Values : targetSlice.Locations.Values; IMultiDimensionalArray values; if (copyLocations) { values = source.GetValues(new VariableValueFilter<DateTime>(source.Arguments[0], dateTime)); } else { values = source.GetValues(new VariableValueFilter<DateTime>(source.Arguments[0], dateTime), new VariableValueFilter<INetworkLocation>(source.Arguments[1], networkLocations)); } var clonedValues = new ArrayList(values); var clonedLocations = networkLocations.ToArray(); if (copyLocations) { targetSlice.Clear(); targetSlice.Locations.Values.AddRange(clonedLocations); targetSlice.Components[0].NoDataValues = new ArrayList(source.Components[0].NoDataValues); } targetSlice.SetValues(clonedValues); }
public static void ExtractTimeSlice(INetworkCoverage source, INetworkCoverage targetSlice /* bad name */, DateTime dateTime, bool copyLocations) { if (!source.IsTimeDependent) { throw new ArgumentException("ExtractTimeSlice: source network coverage should be time dependent.", "source"); } IEnumerable<INetworkLocation> networkLocations = null; if (copyLocations) { networkLocations = source.Arguments[1].GetValues().Cast<INetworkLocation>(); targetSlice.Clear(); targetSlice.Locations.Values.AddRange(networkLocations); } else { networkLocations = targetSlice.Arguments[0].GetValues().Cast<INetworkLocation>(); // networkLocations = new ArrayList(targetSlice.Arguments[0].GetValues()); } targetSlice.Components[0].NoDataValues = new ArrayList(source.Components[0].NoDataValues); IMultiDimensionalArray values; //var values = source.GetValues(new VariableValueFilter(source.Arguments[0], new[] { dateTime })); if (copyLocations) { values = source.GetValues(new VariableValueFilter<DateTime>(source.Arguments[0], dateTime)); } else { values = source.GetValues(new VariableValueFilter<DateTime>(source.Arguments[0], dateTime), new VariableValueFilter<INetworkLocation>(source.Arguments[1], networkLocations)); } targetSlice.SetValues(values); }