示例#1
0
        private void GetFeatureValueType(Feature[] features, string field)
        {
            _colorTable = ProductColorTableFactory.GetColorTable(_subProductDef.ProductDef.Identify, "ISOT");//ICE,ISOT
            _legendItems.Clear();

            foreach (Feature fet in features)
            {
                string v = fet.GetFieldValue(field);
                if (string.IsNullOrWhiteSpace(v))
                {
                    continue;
                }
                v = v.Trim();
                ProductColor pc = GetColorByValue(v);
                if (pc != null && !_legendItems.ContainsKey(v))
                {
                    _legendItems.Add(v, pc);
                }
                //else if(!_legendItems.ContainsKey(v))
                //    _legendItems.Add(v, Color.FromArgb(_random.Next(255), _random.Next(255), _random.Next(255)));
            }
            //温度按照从大到小排序.
            KeyValuePair <string, ProductColor>[] orderItems = _legendItems.OrderByDescending((item) => { return(item.Key); }).ToArray();
            _legendItems.Clear();
            foreach (KeyValuePair <string, ProductColor> v in orderItems)
            {
                _legendItems.Add(v.Key, v.Value);
            }
        }
示例#2
0
 private void GetFeatureValueType(Feature[] features, string field)
 {
     _colorTable = ProductColorTableFactory.GetColorTable(_subProductDef.ProductDef.Identify, "ISOT");//ISOT
     _legendItems.Clear();
     foreach (Feature fet in features)
     {
         string v = fet.GetFieldValue(field);
         if (v == null)
         {
             continue;
         }
         v = v.Trim();
         if (!_legendItems.ContainsKey(v))
         {
             ProductColor pc = GetColorByValue(v);
             if (pc != null)
             {
                 _legendItems.Add(pc.LableText, pc.Color);
             }
             else
             {
                 _legendItems.Add(v, Color.FromArgb(_random.Next(255), _random.Next(255), _random.Next(255)));
             }
         }
     }
 }
示例#3
0
        private void btOPTD_Click(object sender, EventArgs e)
        {
            ProductColorTable[] tables = ProductColorTableFactory.GetAllColorTables();
            ProductColorTable   table  = ProductColorTableFactory.GetColorTable("FOG", "TIMS");


            ExtractProductIdentify exPro = new ExtractProductIdentify();

            exPro.ThemeIdentify      = "CMA";
            exPro.ProductIdentify    = "FOG";
            exPro.SubProductIdentify = "OPTD";


            ThemeDef      theme = MonitoringThemeFactory.GetThemeDefByIdentify("CMA");
            ProductDef    pro   = theme.GetProductDefByIdentify("FOG");
            SubProductDef sub   = pro.GetSubProductDefByIdentify("OPTD");
            AlgorithmDef  alg   = sub.GetAlgorithmDefByIdentify("OPTDAlgorithm");

            IArgumentProvider arg = MonitoringThemeFactory.GetArgumentProvider(exPro, "OPTDAlgorithm", "FY3A", "MERSI");

            arg.SetArg("OPTDAlgorithm", alg);
            IRasterDataProvider prd = GetRasterDataProvider("FOG");

            arg.DataProvider = prd;
            arg.SetArg("CSRFile", @"E:\code\SMARTII\SRC\【控制】监测分析框架\testCN\bin\Release\TEMP\FOG_0CSR_FY3A_MERSI_10M_20120614001422_20120615001422.dat");
            arg.SetArg("DBLVFile", @"E:\code\SMARTII\SRC\【控制】监测分析框架\testCN\bin\Release\TEMP\FOG_DBLV_FY3A_MERSI_1000M_20120614005135_20120615005135.dat");
            IMonitoringSubProduct       bin    = new SubProductOPTDFOG(sub);
            IPixelFeatureMapper <Int16> result = bin.Make(null) as IPixelFeatureMapper <Int16>;

            result.Dispose();
        }
示例#4
0
        private XElement[] ApplyIcelineLayer(string[] shpFiles, XElement layerElement)
        {
            List <XElement> resultElement = new List <XElement>();
            XElement        tempElement   = null;
            int             length        = shpFiles.Length;
            string          shpName;
            XElement        uniqueSymbolsEle = layerElement.Element("Renderer").Element("Symbol");
            XElement        dataSourceEle    = layerElement.Element("FeatureClass").Element("DataSource");

            _colorTable = ProductColorTableFactory.GetColorTable(_subProductDef.ProductDef.Identify, _subColorname);
            for (int i = 0; i < length; i++)
            {
                shpName = Path.GetFileNameWithoutExtension(shpFiles[i]);
                layerElement.Attribute("name").Value = shpName;
                if (uniqueSymbolsEle != null)
                {
                    Color itemColor = _colorTable.ProductColors[i].Color;
                    uniqueSymbolsEle.Attribute("color").Value = string.Format("{0},{1},{2},{3}", itemColor.A, itemColor.R, itemColor.G, itemColor.B);
                }
                if (dataSourceEle != null)
                {
                    dataSourceEle.Attribute("name").Value    = shpName;
                    dataSourceEle.Attribute("fileurl").Value = shpFiles[i];
                }
                tempElement = new XElement(layerElement);
                resultElement.Add(tempElement);
            }
            return(resultElement.Count == 0 ? null : resultElement.ToArray());
        }
示例#5
0
 private void LoadColorList(ProductColorTable colorTable)
 {
     lvColors.Items.Clear();
     ProductColor[] colors = colorTable.ProductColors;
     for (int i = 0; i < colors.Length; i++)
     {
         LoadListViewItem(colors[i]);
     }
 }
示例#6
0
 public static void Init()
 {
     //为数据框注册添加栅格数据的委托
     GeoDo.RSS.Layout.DataFrm.DataFrame.AddFileToCanvasViewerExecutor = (fname, argument, canvas, fileOpenargs, colorTableName) =>
     {
         //IRgbStretcherProvider rgbStretcherpProvider = null;
         //if (fname.ToUpper().EndsWith(".DAT"))
         //    rgbStretcherpProvider = new RgbStretcherProvider();
         IRgbStretcherProvider rgbStretcherpProvider = new RgbStretcherProvider();
         if (string.IsNullOrWhiteSpace(colorTableName))
         {
             colorTableName = GetColorTableName(argument);//兼容最早colortablename放在argument中的模式
         }
         else
         {
             colorTableName = "colortablename=" + colorTableName;
         }
         List <string> options = new List <string>();
         if (!string.IsNullOrWhiteSpace(colorTableName))
         {
             options.Add(colorTableName);
         }
         if (fileOpenargs != null)
         {
             options.AddRange(fileOpenargs);
         }
         IRasterDrawing drawing = new RasterDrawing(fname, canvas, rgbStretcherpProvider, options.ToArray());
         drawing.SelectedBandNos = GetDefaultBands(drawing);
         IRasterLayer lyr = new RasterLayer(drawing);
         canvas.LayerContainer.Layers.Add(lyr);
         canvas.PrimaryDrawObject = drawing;
         canvas.CurrentEnvelope   = drawing.OriginalEnvelope;
         drawing.StartLoading(null);
         TryLoadAOIMaskLayer(canvas, drawing, fname);
     };
     //为栅格图例注册颜色表获取委托
     GeoDo.RSS.Layout.RasterLegendElement.RasterLegendItemsGetter = (colorTableName) =>
     {
         ProductColorTable colorTable = ProductColorTableFactory.GetColorTable(colorTableName);
         if (colorTable == null)
         {
             return(null);
         }
         List <LegendItem> items = new List <LegendItem>();
         foreach (ProductColor c in colorTable.ProductColors)
         {
             if (!c.DisplayLengend)
             {
                 continue;
             }
             string txt = c.LableText;
             items.Add(new LegendItem(txt, c.Color));
         }
         return(items.Count > 0 ? items.ToArray() : null);
     };
 }
示例#7
0
        public static Bitmap ToBitmap <T>(T[] buffer, int width, int height, string colorTableName)
        {
            //string colorTableName = string.Format("Cloudsat.{0}", "2B-GEOPROF.Radar_Reflectivity");
            ProductColorTable productColorTable = ProductColorTableFactory.GetColorTable(colorTableName);

            if (productColorTable == null)
            {
                return(null);
            }
            RgbStretcherProvider stretcherProvier = new RgbStretcherProvider();
            ColorMapTable <int>  colorMapTable    = null;
            Func <T, byte>       stretcher        = null;
            IBitmapBuilder <T>   builder          = null;
            TypeCode             t = Type.GetTypeCode(default(T).GetType());

            if (t == TypeCode.Single)
            {
                stretcher = stretcherProvier.GetStretcher(enumDataType.Float, productColorTable, out colorMapTable) as Func <T, byte>;
                builder   = BitmapBuilderFactory.CreateBitmapBuilderFloat() as IBitmapBuilder <T>;
            }
            else if (t == TypeCode.Int16)
            {
                stretcher = stretcherProvier.GetStretcher(enumDataType.Int16, productColorTable, out colorMapTable) as Func <T, byte>;
                builder   = BitmapBuilderFactory.CreateBitmapBuilderInt16() as IBitmapBuilder <T>;
            }
            Bitmap bitmap = null;

            bitmap         = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
            bitmap.Palette = BitmapBuilderFactory.GetDefaultGrayColorPalette();
            try
            {
                builder.Build(width, height, buffer, stretcher, ref bitmap);
                if (colorMapTable != null)
                {
                    ColorPalette plt = BitmapBuilderFactory.GetDefaultGrayColorPalette();
                    for (int i = 0; i < 256; i++)
                    {
                        plt.Entries[i] = Color.Black;
                    }
                    int idx = 1;
                    foreach (ColorMapItem <int> item in colorMapTable.Items)
                    {
                        for (int v = item.MinValue; v < item.MaxValue; v++)
                        {
                            plt.Entries[idx] = item.Color;
                        }
                        idx++;
                    }
                    bitmap.Palette = plt;
                }
                return(bitmap);
            }
            finally
            {
            }
        }
示例#8
0
        private static object[] GetColorTableFunc(IRasterDataProvider prd, string productIdentify, string subIdentify)
        {
            if (string.IsNullOrEmpty(productIdentify) || string.IsNullOrEmpty(subIdentify))
            {
                return(null);
            }
            ProductColorTable ct = ProductColorTableFactory.GetColorTable(productIdentify + subIdentify);
            Type dataType        = DataTypeHelper.Enum2DataType(prd.DataType);

            return(GetStretcher(dataType, ct));
        }
示例#9
0
 public override IExtractResult Make(Action <int, string> progressTracker)
 {
     if (_argumentProvider == null)
     {
         return(null);
     }
     if (_argumentProvider.GetArg("AlgorithmName") == null)
     {
         return(null);
     }
     if (_argumentProvider.GetArg("AlgorithmName").ToString() == "0IMGAlgorithm")
     {
         try
         {
             string instanceIdentify = _argumentProvider.GetArg("OutFileIdentify") as string;
             if (string.IsNullOrWhiteSpace(instanceIdentify))
             {
                 return(null);
             }
             SubProductInstanceDef instance = FindSubProductInstanceDefs(instanceIdentify);
             if (instance == null || instanceIdentify == "MCSI" || instanceIdentify == "OMCS")
             {
                 return(ThemeGraphyResult(null));
             }
             if ((instance.FileProvider.Contains("DBLV") || instance.FileProvider.Contains("DBHL")) &&
                 instance.OutFileIdentify != "TDBI")
             {
                 string[] selectedFileNames = _argumentProvider.GetArg("SelectedPrimaryFiles") as string[];
                 if (!string.IsNullOrEmpty(selectedFileNames[0]))
                 {
                     CreateLegendItems(selectedFileNames[0], instanceIdentify);
                 }
                 if (_colorTable != null)
                 {
                     instance.ColorTableName = _colorTable.ColorTableName;
                 }
                 else
                 {
                     throw new Exception("无法获取合适的颜色表");
                 }
             }
             return(ThemeGraphyByInstance(instance));
         }
         finally
         {
             _colorTable = null;
             _legendItems.Clear();
         }
     }
     return(null);
 }
示例#10
0
        private void CreateLegendItems(string selectedFileName, string instanceIdentify)
        {
            string colorTableName = null;

            if (instanceIdentify == "ONMI")
            {
                colorTableName = "LSTANMI";
            }
            else
            {
                RasterIdentify rstIdentify = new RasterIdentify(selectedFileName);
                string         season      = GetSeason(rstIdentify);
                //未能读取到日期时默认设置为春天
                if (string.IsNullOrEmpty(season))
                {
                    season = "Spring";
                }
                switch (season)
                {
                case "Spring":
                    colorTableName = "LSTSP";
                    break;

                case "Summer":
                    colorTableName = "LSTSU";
                    break;

                case "Autumn":
                    colorTableName = "LSTFA";
                    break;

                case "Winter":
                    colorTableName = "LSTWI";
                    break;
                }
            }
            if (string.IsNullOrEmpty(colorTableName))
            {
                return;
            }
            _colorTable = ProductColorTableFactory.GetColorTable(colorTableName);
            if (_colorTable == null || _colorTable.ProductColors.Length < 1)
            {
                return;
            }
            _legendItems.Clear();
            foreach (ProductColor color in _colorTable.ProductColors)
            {
                _legendItems.Add(color);
            }
        }
示例#11
0
        private Color GetBinaryColor(IMonitoringSubProduct subProduct)
        {
            if (subProduct == null)
            {
                return(Color.Red);
            }
            //可使用productColorTableName为产品标识,进行产品判识结果颜色的定义 by chennan 20130930
            ProductColorTable colorTable = ProductColorTableFactory.GetColorTable(subProduct.Definition.ProductDef.Identify);

            if (colorTable != null)
            {
                return(colorTable.GetColor(1f).Color);
            }
            return(subProduct.Definition.Color);
        }
示例#12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lvwColorTableList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvwColorTableList.SelectedItems == null || lvwColorTableList.SelectedItems.Count == 0)
            {
                return;
            }
            int selectedIndex            = lvwColorTableList.SelectedIndices[0];//选择的索引
            ProductColorTable colorTable = lvwColorTableList.SelectedItems[0].Tag as ProductColorTable;

            if (colorTable == null)
            {
                return;
            }
            _selectedProductColorTable = colorTable;
            UpdateColorTableInfo();
            LoadColorList(_selectedProductColorTable);
        }
示例#13
0
        private void CreateLegendItems(string selectedFileName, string instanceIdentify)
        {
            string colorTableName = null;

            if (instanceIdentify == "ONMI")
            {
                colorTableName = "LSTANMI";
            }
            else
            {
                RasterIdentify rstIdentify = new RasterIdentify(selectedFileName);
                string         season      = GetSeason(rstIdentify);
                if (rstIdentify.SubProductIdentify == "DBHL")
                {
                    season = "SummerHight";
                }
                //未能读取到日期时默认设置为春天
                if (string.IsNullOrEmpty(season))
                {
                    season = "Spring";
                }
                else if (instanceIdentify == "0SRI")
                {
                    Set0SRIColorTable(season, ref colorTableName);
                }
                else
                {
                    SetOtherColorTable(season, ref colorTableName);
                }
            }
            if (string.IsNullOrEmpty(colorTableName))
            {
                return;
            }
            _colorTable = ProductColorTableFactory.GetColorTable(colorTableName);
            if (_colorTable == null || _colorTable.ProductColors.Length < 1)
            {
                return;
            }
            _legendItems.Clear();
            foreach (ProductColor color in _colorTable.ProductColors)
            {
                _legendItems.Add(color);
            }
        }
示例#14
0
        public new object GetStretcher(string fname, string colorTableName, out ColorMapTable <int> colorMapTable)
        {
            colorMapTable = null;
            ProductColorTable pct = null;

            if (string.IsNullOrWhiteSpace(colorTableName))
            {
                colorTableName = "Cloudsat.2B-GEOPROF.Radar_Reflectivity";
            }
            pct = ProductColorTableFactory.GetColorTable(colorTableName);
            switch (colorTableName)
            {
            case "Cloudsat.2B-GEOPROF.Radar_Reflectivity":
                return(base.GetStretcher(RSS.Core.DF.enumDataType.Int16, pct, out colorMapTable));

            default:
                return(base.GetStretcher(RSS.Core.DF.enumDataType.Int16, pct, out colorMapTable));
            }
        }
示例#15
0
 private static object[] GetStretcher(Type dataType, ProductColorTable ct)
 {
     if (dataType.Equals(typeof(byte)))
     {
         return(ProductColorTableFactory.GetStretcher <byte>(ct));
     }
     else if (dataType.Equals(typeof(Int16)))
     {
         return(ProductColorTableFactory.GetStretcher <Int16>(ct));
     }
     else if (dataType.Equals(typeof(UInt16)))
     {
         return(ProductColorTableFactory.GetStretcher <UInt16>(ct));
     }
     else if (dataType.Equals(typeof(Int32)))
     {
         return(ProductColorTableFactory.GetStretcher <Int32>(ct));
     }
     else if (dataType.Equals(typeof(UInt32)))
     {
         return(ProductColorTableFactory.GetStretcher <UInt32>(ct));
     }
     else if (dataType.Equals(typeof(Int64)))
     {
         return(ProductColorTableFactory.GetStretcher <Int64>(ct));
     }
     else if (dataType.Equals(typeof(UInt64)))
     {
         return(ProductColorTableFactory.GetStretcher <UInt64>(ct));
     }
     else if (dataType.Equals(typeof(float)))
     {
         return(ProductColorTableFactory.GetStretcher <float>(ct));
     }
     else if (dataType.Equals(typeof(double)))
     {
         return(ProductColorTableFactory.GetStretcher <double>(ct));
     }
     return(null);
 }
示例#16
0
        private void LoadCurProductColorTable(ProductDic product)
        {
            _selectedProductDic         = product;
            _selectedProductColorTables = null;
            _selectedProductColorTable  = null;
            if (product == null || string.IsNullOrWhiteSpace(product.FileName))
            {
                ClearPcts();
                return;
            }
            ProductColorTableParser parser = new ProductColorTableParser();

            _selectedProductColorTables = ProductColorTableParser.Parse(product.FileName);
            if (_selectedProductColorTables == null)
            {
                ClearPcts();
            }
            else
            {
                LoadColorTable(_selectedProductColorTables);
            }
        }
示例#17
0
        private void CreateLegendItems(string[] shpFiles)
        {
            _colorTable = ProductColorTableFactory.GetColorTable(_subProductDef.ProductDef.Identify, _subColorname);//ICE,EDGE
            _legendItems.Clear();
            int index = 0;

            foreach (string file in shpFiles)
            {
                index++;
                RasterIdentify identify = new RasterIdentify(file);
                DateTime       dt       = identify.OrbitDateTime;
                ProductColor   pcolor   = _colorTable.GetColor(index);
                if (pcolor == null)
                {
                    _legendItems.Add(dt.AddHours(8).ToString(), Color.FromArgb(255, 166, 208, 255));
                }
                else
                {
                    _legendItems.Add(dt.AddHours(8).ToString(), pcolor.Color);
                }
            }
        }
示例#18
0
        public object GetStretcher(string fname, enumDataType inDataType, string colorTableName, out ColorMapTable <int> colorMapTable)
        {
            colorMapTable = null;
            ProductColorTable pct = null;

            if (colorTableName == null)
            {
                string[] parts = Path.GetFileName(fname).Split('_');
                //by chennan 20120819 单通道ldf产品付色
                //if (parts.Length < 3 && !fname.ToUpper().EndsWith(".DAT"))
                if (parts.Length < 3)
                {
                    return(null);
                }
                string productIdentify    = parts[0];
                string subProductIdentify = parts[1];
                pct = ProductColorTableFactory.GetColorTable(productIdentify, subProductIdentify);
            }
            else
            {
                pct = ProductColorTableFactory.GetColorTable(colorTableName);
            }
            if (pct == null)
            {
                return(null);
            }
            //enumDataType dataType = enumDataType.Atypism;
            if (inDataType == enumDataType.Atypism)
            {
                using (IRasterDataProvider prd = GeoDataDriver.Open(fname) as IRasterDataProvider)
                {
                    inDataType = prd.DataType;
                }
            }
            return(GetStretcher(inDataType, pct, out colorMapTable));
        }
示例#19
0
        public static void UpdateLegend(ProductColorTable[] colors, Action <int, string> percentProgress)
        {
            string path = System.AppDomain.CurrentDomain.BaseDirectory + "LayoutTemplate";

            if (!Directory.Exists(path))
            {
                return;
            }
            string[] files = Directory.GetFiles(path, "*.gxt", SearchOption.AllDirectories);
            if (files == null || files.Length == 0)
            {
                return;
            }
            for (int i = 0; i < files.Length; i++)
            {
                string          fname    = files[i];
                ILayoutTemplate template = LayoutTemplate.LoadTemplateFrom(fname);

                //LayoutTemplate.LoadTemplateFrom(fname);
                if (template == null)
                {
                    return;
                }
                if (percentProgress != null)
                {
                    percentProgress((int)((i + 1) * 100f / files.Length), "");
                }
                ILayout layout   = template.Layout;
                bool    haUpdate = false;
                for (int e = 0; e < layout.Elements.Count; e++)
                {
                    if (layout.Elements[e] is ILegendElement)
                    {
                        ILegendElement legendEle = layout.Elements[e] as ILegendElement;
                        string         colotName = legendEle.ColorTableName;
                        if (!string.IsNullOrWhiteSpace(colotName))
                        {
                            ProductColorTable colorTable = ProductColorTableFactory.GetColorTable(colotName);
                            if (colorTable != null)
                            {
                                List <LegendItem> items = new List <LegendItem>();
                                foreach (ProductColor pc in colorTable.ProductColors)
                                {
                                    if (!pc.DisplayLengend)
                                    {
                                        continue;
                                    }
                                    LegendItem item = new LegendItem(pc.LableText, pc.Color);
                                    items.Add(item);
                                }
                                legendEle.LegendItems = items.ToArray();
                                haUpdate = true;
                            }
                        }
                    }
                }
                if (haUpdate)
                {
                    template.SaveTo(fname);
                }
            }
        }
示例#20
0
        public object GetStretcher(enumDataType dataType, ProductColorTable oColorMapTable, out ColorMapTable <int> colorMapTable)
        {
            object stretcher = null;

            switch (dataType)
            {
            case enumDataType.Byte:
                Func <byte, byte> stByte = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stByte;
                break;

            case enumDataType.Float:
                Func <float, byte> stFloat = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stFloat;
                break;

            case enumDataType.Double:
                Func <double, byte> stDouble = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stDouble;
                break;

            case enumDataType.UInt16:
                Func <UInt16, byte> stUInt16 = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stUInt16;
                break;

            case enumDataType.Int16:
                Func <Int16, byte> stInt16 = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stInt16;
                break;

            case enumDataType.Int32:
                Func <Int32, byte> stInt32 = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stInt32;
                break;

            case enumDataType.UInt32:
                Func <UInt32, byte> stUInt32 = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stUInt32;
                break;

            case enumDataType.Int64:
                Func <Int64, byte> stInt64 = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stInt64;
                break;

            case enumDataType.UInt64:
                Func <UInt64, byte> stUInt64 = (v) =>
                {
                    for (byte i = 0; i < oColorMapTable.ProductColors.Length; i++)
                    {
                        if (v >= oColorMapTable.ProductColors[i].MinValue && v < oColorMapTable.ProductColors[i].MaxValue)
                        {
                            return((byte)(i + 1));
                        }
                    }
                    return(255);
                };
                stretcher = stUInt64;
                break;
            }
            colorMapTable = new ColorMapTable <int>();
            for (byte i = 1; i <= oColorMapTable.ProductColors.Length; i++)
            {
                colorMapTable.Items.Add(new ColorMapItem <int>(i, i + 1, oColorMapTable.ProductColors[i - 1].Color));
            }
            return(stretcher);
        }
示例#21
0
        private void button22_Click(object sender, EventArgs e)
        {
            ProductColorTable ct = ProductColorTableFactory.GetColorTable("FOG", "DBLV");

            object[] sts = ProductColorTableFactory.GetStretcher <UInt16>(ct);
        }