/// <summary> /// Initializes a new instance of the <see cref="RasterPresentation" /> class. /// </summary> /// <param name="model">The presentation model.</param> /// <param name="colorSpace">The color space.</param> /// <param name="bands">The bands.</param> /// <exception cref="System.ArgumentException">Pseudo-color and density slicing models must define a color map.</exception> public RasterPresentation(RasterPresentationModel model, RasterColorSpace colorSpace, params RasterColorSpaceBand[] bands) { if (model == RasterPresentationModel.DensitySlicing || model == RasterPresentationModel.PseudoColor) { throw new ArgumentException("Pseudo-color and density slicing models must define a color map.", "model"); } Model = model; ColorSpace = colorSpace; _bands = bands.ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="RasterPresentation" /> class. /// </summary> /// <param name="model">The presentation model.</param> /// <param name="colorPalette">The color palette.</param> /// <exception cref="System.ArgumentException">Only pseudo-color and density slicing models may define a color map.</exception> /// <exception cref="System.ArgumentNullException">The color map is null.</exception> public RasterPresentation(RasterPresentationModel model, IReadOnlyDictionary <Int32, UInt16[]> colorPalette) { if (model != RasterPresentationModel.DensitySlicing && model != RasterPresentationModel.PseudoColor) { throw new ArgumentException("Only pseudo-color and density slicing models can define a color map.", "model"); } if (colorPalette == null) { throw new ArgumentNullException("colorMap", "The color map is null."); } Model = model; _colorPalette = colorPalette.ToDictionary(pair => pair.Key, pair => pair.Value); _bands = new RasterColorSpaceBand[1] { RasterColorSpaceBand.Value }; }