Forráskód Böngészése

报告添加堆叠图

zty 3 éve
szülő
commit
59da107576

+ 88 - 3
Bin/x64/Debug/Resources/HTML/charts.html

@@ -33,23 +33,31 @@
         <li><input type="radio" name="radio" value="bar" data-labelauty="bar"></li>
         <li><input type="radio" name="radio" value="line" data-labelauty="line"></li>
         <li><input type="radio" name="radio" value="stack" data-labelauty="stack"></li>
-
+        <li><input type="radio" name="radio" value="stackBar" ID="stackBar" data-labelauty="stackBar"></li>
     </ul>
     <div id="main" style="width:100%;height:350px;"></div>
     <script type="text/javascript">
         var myChart;
         var json;
+        var jsonCombin;
         var re=0;
-        function showchart(str, ty) {
+        function showchart(str, strCombin, ty) {
             if (ty == '') {
                 ty = 'pie'
             }
+			if(strCombin == ""){
+				document.getElementById("stackBar").type="hidden";
+			}
+			else{
+				jsonCombin = JSON.parse(strCombin);
+			}
             $("#main").height($(window).height() - 100);
             if(ty == 'triangle') {
                 $("#main").width($(window).height());
             }
             myChart = echarts.init(document.getElementById('main'));
             json = JSON.parse(str);
+
             show(ty);
             $(':radio[value="' + ty+'"]').eq(0).attr("checked", true);
         }
@@ -70,6 +78,9 @@
             if (type == 'stack') {
                 setstack();
             }
+			if (type == 'stackBar') {
+                setstackBar();
+            }
            
             if (type == 'triangle') {
                 re = 1;
@@ -445,7 +456,6 @@
             };
 
 
-
             for (var i = 0; i < json.ListData.length; i++) {
                 var item = {
                     type: 'bar',
@@ -544,6 +554,81 @@
             myChart.setOption(option);
           
         }
+		//stackBar
+        function setstackBar() {
+            var ser = [];
+            for (var i = 0; i < jsonCombin.ListData.length; i++) {
+                var item = {
+                    type: 'bar',
+                    name: jsonCombin.ListData[i].name,
+                    stack: 'total',
+					emphasis: {
+						focus : 'series'
+						},
+                    data: eval('['+ jsonCombin.ListData[i].value + ']')
+                }
+                ser.push(item);
+            }
+
+            var option = {
+                title: {
+                    text: json.Title,
+                    top: 5,
+                    left: 'center',
+                    textStyle: {
+                        fontSize: 16
+                    }
+                },
+                legend: {
+                    type: 'scroll',
+                    top: 45,
+                    right: '5%',
+                    data: jsonCombin.ListName
+                },
+                tooltip: {
+					trigger: 'axis',
+						axisPointer: {
+						type: 'shadow'
+						}
+                },
+                grid: {
+                    top: 95,
+                    left: '3%',
+                    right: '4%',
+                    bottom: '5%',
+                    containLabel: true
+                },
+                xAxis: [{
+                    type: 'category',
+                    data: json.ListName
+                }],
+                yAxis: {
+                    type: 'value',
+                    name: json.YName,
+                    nameTextStyle: {
+                        fontSize: 10,
+                        color: '#4D4D4D'
+                    },
+                    axisLabel: {
+                        textStyle: {
+                            fontSize: 10,
+                            color: '#4D4D4D'
+                        }
+                    },
+                    axisLine: {
+                        lineStyle: {
+                            color: '#707070'
+                        }
+                    }
+                },
+                series: ser
+            };
+
+
+          
+            myChart.setOption(option);
+        }
+		
         //triangle
         function settri() {
 

+ 1 - 1
OTSIncAMeasureApp/0-OTSModel/Measure/4-ReMeasure/SmplMeasureReMeasure.cs

@@ -62,7 +62,7 @@ namespace OTSMeasureApp._0_OTSModel.Measure._4_ReMeasure
                     scan.SetDwellTime(nBrukerDwellTimeId);
                     scan.SetImageSize(width, height);
                     CBSEImgClr imgClr = scan.AcquireBSEImage(0, 0, (int)nBrukerDwellTime);
-                    Bitmap bitmap = Imagepro.ToGrayBitmap(imgClr.GetImageDataPtr(), width, height);
+                    Bitmap bitmap = CImageHandler.ToGrayBitmap(imgClr.GetImageDataPtr(), width, height);
                     bitmap.Save(samplePath + "Field" + keyValues.ElementAt(i).Value[0].FieldId + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
                     //打能谱
                     log.Info("Begin to GetXRayByPoints count : " + keyValues.ElementAt(i).Value.Count);

+ 1 - 1
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceGraphicsPanelFun.cs

@@ -458,7 +458,7 @@ namespace OTSMeasureApp
             //图片
             Bitmap bitmap = null;
             //将byte数据转换为图片
-            bitmap = Imagepro.ToGrayBitmap(ImageByte, width, height);
+            bitmap = CImageHandler.ToGrayBitmap(ImageByte, width, height);
             return bitmap;
         }
         #endregion

+ 1 - 1
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -4413,7 +4413,7 @@ namespace OTSMeasureApp
                         ImgRegionHeight = Convert.ToInt32(m_ImageSingleGDIObjects[i].RegionF.Height);
 
                         //获取图片
-                        bseImage = Imagepro.ToGrayBitmap(ImageData, m_iWidth, m_iHeigh);
+                        bseImage = CImageHandler.ToGrayBitmap(ImageData, m_iWidth, m_iHeigh);
                         //获取工作样品位置
                         Point drawImageLocation = itemWorkSample.Region.Location;
                         //绘制图像

+ 4 - 4
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/OTSMeasureStatusWindow.cs

@@ -144,7 +144,7 @@ namespace OTSMeasureApp
         {
             try
             {
-                Bitmap bitmap = Imagepro.ToGrayBitmap(bBseData, m_iWidth, m_iHeigh);
+                Bitmap bitmap = CImageHandler.ToGrayBitmap(bBseData, m_iWidth, m_iHeigh);
                 pbBSEImage.Image = bitmap;
                 //设置Pictrue显示位置
                 pbBSEImage.Height = this.RestoreBounds.Height;
@@ -175,7 +175,7 @@ namespace OTSMeasureApp
         {
             try
             {
-                return Imagepro.ToGrayBitmap(bBseData, m_iWidth, m_iHeigh);
+                return CImageHandler.ToGrayBitmap(bBseData, m_iWidth, m_iHeigh);
             }
             catch (Exception ex)
             {
@@ -1911,7 +1911,7 @@ namespace OTSMeasureApp
             int grayEnd = 0;
             if (bBseData != null)
             {
-                Bitmap bitmap = Imagepro.ToGrayBitmap(bBseData, m_iWidth, m_iHeight);
+                Bitmap bitmap = CImageHandler.ToGrayBitmap(bBseData, m_iWidth, m_iHeight);
                 toolWindow.BseImg = bitmap;
                 toolWindow.BBseData = bBseData;
                 //获取去背景灰度值
@@ -1950,7 +1950,7 @@ namespace OTSMeasureApp
             int grayEnd = 0;
             if (bBseData != null)
             {
-                Bitmap bitmap = Imagepro.ToGrayBitmap(bBseData, m_iWidth, m_iHeight);
+                Bitmap bitmap = CImageHandler.ToGrayBitmap(bBseData, m_iWidth, m_iHeight);
                 toolWindow.BseImg = bitmap;
                 toolWindow.SetBBseData(bBseData);
                 //获取颗粒灰度范围

+ 1 - 1
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/ToolWindow.cs

@@ -263,7 +263,7 @@ namespace OTSMeasureApp
                 bool bfResult = imagefun.GetBSEImage(bBseData, m_iHeight, m_iWidth, grayStart, grayEnd, ref cBseData);
                 if (bfResult)
                 {
-                    Bitmap reImg= Imagepro.ToGrayBitmap(cBseData, m_iWidth, m_iHeight);
+                    Bitmap reImg= CImageHandler.ToGrayBitmap(cBseData, m_iWidth, m_iHeight);
                     return reImg;
                 }
                 else

+ 2 - 2
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/frmSpecialGrayParticle.cs

@@ -184,7 +184,7 @@ namespace OTSMeasureApp
                 bBseData = cBseData;
                 //取图不成功就返回
                 if (!bfResult) { return; }
-                Bitmap bitmap = Imagepro.ToGrayBitmap(cBseData, m_iWidth, m_iHeight);
+                Bitmap bitmap = CImageHandler.ToGrayBitmap(cBseData, m_iWidth, m_iHeight);
                 ShowBSEImage(bitmap);
                
             }
@@ -334,7 +334,7 @@ namespace OTSMeasureApp
                 bool bfResult = imagefun.GetBSEImage(bBseData, m_iHeight, m_iWidth, grayStart, grayEnd, ref cBseData);
                 if (bfResult)
                 {
-                    Bitmap reImg= Imagepro.ToGrayBitmap(cBseData, m_iWidth, m_iHeight);
+                    Bitmap reImg= CImageHandler.ToGrayBitmap(cBseData, m_iWidth, m_iHeight);
                     return reImg;
                 }
                 else

+ 0 - 1
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -330,7 +330,6 @@
     <Compile Include="ServiceCenter\FileHelper.cs" />
     <Compile Include="ServiceCenter\IClassifyEngine.cs" />
     <Compile Include="ServiceCenter\IImageProcess.cs" />
-    <Compile Include="ServiceCenter\Imagepro.cs" />
     <Compile Include="ServiceCenter\IMeasureHardware.cs" />
     <Compile Include="ServiceCenter\IpcSEMController.cs" />
     <Compile Include="ServiceCenter\ScanController.cs" />

+ 64 - 1
OTSIncAMeasureApp/ServiceCenter/CImageHandler.cs

@@ -12,11 +12,74 @@ namespace OTSModelSharp.ServiceInterface
 {
     using OTSCLRINTERFACE;
     using OTSIMGPROC;
- 
+    using System.Drawing.Imaging;
     using System.Windows;
 
     public class CImageHandler:IImageProcess
     {
+        #region 通过byte数组生成BMP图像文件
+        /// <summary>    
+        /// 将一个byte的数组转换为8bit灰度位图
+        /// </summary>    
+        /// <param name="data">数组</param>    
+        /// <param name="width">图像宽度</param>    
+        /// <param name="height">图像高度</param>    
+        /// <returns>位图</returns>    
+        public static Bitmap ToGrayBitmap(byte[] data, int width, int height)
+        {
+            //// 申请目标位图的变量,并将其内存区域锁定    
+            Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
+            //// BitmapData这部分内容  需要 using System.Drawing.Imaging;  
+            BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, width, height),
+            ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
+
+            //// 获取图像参数    
+            // 扫描线的宽度   
+            int stride = bmpData.Stride;
+            // 显示宽度与扫描线宽度的间隙  
+            int offset = stride - width;
+            // 获取bmpData的内存起始位置
+            IntPtr iptr = bmpData.Scan0;
+            // 用stride宽度,表示这是内存区域的大小
+            int scanBytes = stride * height;
+
+            //// 下面把原始的显示大小字节数组转换为内存中实际存放的字节数组    
+            int posScan = 0;
+            int posReal = 0;// 分别设置两个位置指针,指向源数组和目标数组    
+            byte[] pixelValues = new byte[scanBytes];  //为目标数组分配内存    
+
+            //for (int x = height-1;x>=0 ; x--) data[startIndex+ y];//
+            for (int x = 0; x < height; x++)
+            {
+                int startIndex = x * width;
+                //// 下面的循环节是模拟行扫描    
+                for (int y = 0; y < width; y++)
+                {
+                    pixelValues[posScan++] = data[posReal++];
+                }
+                posScan += offset;  //行扫描结束,要将目标位置指针移过那段“间隙”    
+            }
+            //// 用Marshal的Copy方法,将刚才得到的内存字节数组复制到BitmapData中    
+            System.Runtime.InteropServices.Marshal.Copy(pixelValues, 0, iptr, scanBytes);
+            bmp.UnlockBits(bmpData);  // 解锁内存区域    
+
+            //// 下面的代码是为了修改生成位图的索引表,从伪彩修改为灰度    
+            ColorPalette tempPalette;
+            using (Bitmap tempBmp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
+            {
+                tempPalette = tempBmp.Palette;
+            }
+            for (int i = 0; i < 256; i++)
+            {
+                tempPalette.Entries[i] = Color.FromArgb(i, i, i);
+            }
+            bmp.Palette = tempPalette;
+
+
+            return bmp;
+        }
+        #endregion
+
         //获取测量的BSE图
         //COTSSample WSample: 工作样品测量
         //Byte[] BSEImage: 带背景图数据

+ 146 - 0
OTSIncAMeasureApp/ServiceCenter/ScanController.cs

@@ -138,5 +138,151 @@ namespace OTSModelSharp.ServiceInterface
                 return scan.SetImageSize(width, height);
             }
         }
+
+        public static int GetScanImage(int iWidth, int iHeigh, string DwellTime, ref byte[] bImageData)
+        {
+            if (FileHelper.GetXMLInformations("SemControllerName") == "FEI")
+            {
+                ScanController m_ScanHardwareMgr = ScanController.GetScanController();
+                m_ScanHardwareMgr.Init();
+                m_ScanHardwareMgr.SetImageSize(iWidth, iHeigh);
+                bImageData = m_ScanHardwareMgr.AcquireBSEImage(0, 0, int.Parse(DwellTime)).GetImageDataPtr();
+                return 1;
+            }
+            else
+            {
+                //电镜设置对象
+                var cfun = COTSControlFunExport.GetControllerInstance();
+                int GetImgCount = 0;
+                try
+                {
+                    //连接电镜
+                    bool IsConnec = cfun.ConncetSem();
+                    if (!IsConnec)
+                    {
+                        return 0;
+                    }
+                    //实例电镜初始化
+                    bool IsScan = cfun.ScanInit();
+                    if (!IsScan)
+                    {
+                        return 0;
+                    }
+                    int a_ExternalMode = 0;
+                    //获取终止模式
+
+                    a_ExternalMode = cfun.GetSemExternalMode();
+
+                    //保存初始模式变量
+                    int a_oldMode = 0;
+                    //获取初始模式
+                    if (!cfun.GetSemScanMode(ref a_oldMode))
+                    {
+                        return 0;
+                    }
+                    //设置当前模式
+                    if (!cfun.SetSemScanMode(a_ExternalMode))
+                    {
+                        return 0;
+                    }
+
+                    #region BeamBlank
+                    int a_nBeamBlank = 0;
+                    //获取参数
+                    if (!cfun.GetSemBeamBlank(ref a_nBeamBlank))
+                    {
+                        cfun.SetSemScanMode(a_oldMode);
+                        return 0;
+                    }
+                    //设置参数
+                    if (!cfun.SetSemBeamBlank(false))
+                    {
+                        cfun.SetSemScanMode(a_oldMode);
+                        return 0;
+                    }
+                    #endregion
+
+                    #region 获得放大倍数
+                    //获得放大倍数
+                    double a_dMagnification = 0;
+                    //m_MsrApp.m_LogFunExport.TraceLog("APP_GetSemMagnification-----begin------");
+                    //获取参数
+                    if (!cfun.GetSemMagnification(ref a_dMagnification))
+                    {
+                        cfun.SetSemScanMode(a_oldMode);
+                        return 0;
+                    }
+                    //m_MsrApp.m_LogFunExport.TraceLog("APP_GetSemMagnification_a_dMagnification:" + a_dMagnification + "------");
+                    //m_MsrApp.m_LogFunExport.TraceLog("APP_GetSemMagnification-----end------");
+                    #endregion
+
+                    #region 获取 电镜 X、Y轴 与角度
+                    //获取 电镜 X、Y轴 与角度
+                    double PositionX = 0;
+                    double PositionY = 0;
+                    double PositionR = 0;
+                    //获取参数
+                    if (!cfun.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR))
+                    {
+                        cfun.SetSemScanMode(a_oldMode);
+                        return 0;
+                    }
+                    #endregion
+
+                    #region 设置图像分辨率
+                    //设置宽度
+                    if (!cfun.SetImageSize(iWidth, iHeigh))
+                    {
+                        cfun.SetSemScanMode(a_oldMode);
+                        return 0;
+                    }
+                    #endregion
+
+                    #region 采集时间
+                    //采集时间
+                    int nDwellTime = Convert.ToInt32(DwellTime);
+                    //设置采集时间
+                    if (!cfun.SetDwellTime(nDwellTime))
+                    {
+                        cfun.SetSemScanMode(a_oldMode);
+                        return 0;
+                    }
+                    #endregion
+
+                    #region MatrixSize
+                    //获得放大倍数
+                    int a_MatrixSize = 0;
+                    Size size = new Size();
+                    //获取参数
+                    size = cfun.GetMatrixSize(a_MatrixSize);
+                    #endregion
+
+                    //获取图像数据
+
+                    int resultCount = iWidth * iHeigh;
+                    GetImgCount = cfun.AcquireBSEImage(0, 0, 0, ref bImageData);
+                    //记录日志
+                    if (resultCount == GetImgCount)
+                    {
+                        //设置为原始 扫描模式
+                        cfun.SetSemScanMode(a_oldMode);
+
+
+                    }
+                    else
+                    {
+                        cfun.SetSemScanMode(a_oldMode);
+
+                    }
+
+                }
+                catch (Exception ex)
+                {
+                    throw ex;
+                }
+
+                return GetImgCount;
+            }
+        }
     }
 }

+ 131 - 1
OTSIncAReportApp/1-UI/Control_ECharts/EChart_ParticlesComposition.cs

@@ -147,6 +147,15 @@ namespace OTSIncAReportApp.Control_ECharts
                 List<Chartdate> list_json_str = GetListJsonStrByChartStruct();
                 url = "Resources/HTML/charts.html";
                 m_ReportApp.data = JsonConvert.SerializeObject(list_json_str[0]);
+                if (ComSel == "PSize")
+                {
+                    ComSel = "PSizeCombin";
+                    m_ReportApp.dataCombin = JsonConvert.SerializeObject(GetListJsonStrByChartStruct()[0]);
+                }
+                else
+                {
+                    m_ReportApp.dataCombin = "";
+                }
             }
             InitBrowser();
         }
@@ -779,6 +788,123 @@ namespace OTSIncAReportApp.Control_ECharts
             chart.ListData = listData;
             return chart;
         }
+        private Chartdate GetPSizeDataCombin(string path)
+        {
+
+            DataOperation.DataAccess.ParticleData particledata = new DataOperation.DataAccess.ParticleData(path);
+            //创建新的图形数据源
+            Chartdate chart = new Chartdate();
+            chart.Title = m_ReportApp.m_reportname;
+            chart.YName = m_str_AxisY;
+
+            //设置标签名称
+            List<string> listName = new List<string>();
+
+            //获取粒级表
+            string pathe = m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder + m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
+            DataSet ds = DataOperation.DataAccess.XMLoperate.GetXml(pathe);
+            string sizestr = ds.Tables[0].Rows[0]["Sizes"].ToString();
+
+            for (int i = 0; i < sizestr.Split(',').Length - 1; i++)
+            {
+                if (sizestr.Split(',')[i].Length > 0)
+                {
+                    double d1 = Convert.ToDouble(sizestr.Split(',')[i]);
+                    double d2 = Convert.ToDouble(sizestr.Split(',')[i + 1]);
+                    listName.Add(d1.ToString() + "~" + d2.ToString());
+                }
+            }
+            double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
+            listName.Add(d.ToString() + "~MAX");
+
+            //int idx = m_ReportApp.m_DataMgrFun.GetPropIndexByPropItemName(m_ReportApp.SourceGridData.ConditionItemList, OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
+            //int sel = m_ReportApp.SourceGridData.ConditionItemList[idx].comboDownList.IndexOf(m_ReportApp.SourceGridData.ConditionItemList[idx].itemVal.ToString());
+            //int sel = m_conditionChoose.m_SourceGridData.GetPropIndexByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
+            int sel = m_ReportApp.m_conditionChoose.m_SourceGridData.GetComboDownListIndexByItemName(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE);
+            string filedAndParticl = "";
+            if (sel == 1)
+            {
+                List<Particle> selectParticles = m_ReportApp.GetSelectedParticles();
+                foreach (var item in selectParticles)
+                {
+                    filedAndParticl = filedAndParticl + "," + (item.FieldId.ToString() + "-" + item.ParticleId.ToString());
+                }
+                if (filedAndParticl != "")
+                {
+                    filedAndParticl = filedAndParticl + ",";
+                }
+            }
+
+            //idx = m_ReportApp.m_DataMgrFun.GetPropIndexByPropItemName(m_ReportApp.SourceGridData.ConditionItemList, OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE);
+            //string con = m_ReportApp.SourceGridData.ConditionItemList[idx].itemVal.ToString();
+            string con = m_conditionChoose.m_SourceGridData.GetPropItemDisplayValueByPropItemName(OTS_REPORT_PROP_GRID_ITEMS.SIZE_CAL_METHOD_TYPE).ToString();
+            string po = "";
+            switch (con)
+            {
+                case "DMAX":
+                    po = "DMAX";
+                    break;
+                case "DMIN":
+                    po = "DMIN";
+                    break;
+                case "CIRCLE":
+                    po = "Area";
+                    break;
+                case "FERET":
+                    po = "DFERET";
+                    break;
+            }
+            DataTable dtp = particledata.GetParticleAll(filedAndParticl);
+
+            //计算分类整个表的数据
+            DataTable dt = ClassificationIntegration(path);
+            List<string> listClassificationName = new List<string>();
+            //ListName
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                listClassificationName.Add(dt.Rows[i]["e1"].ToString());
+            }
+            chart.ListName = listClassificationName;
+            //设置数据
+            List<Item> listData = new List<Item>();
+            //ListData
+            string strNameGroup = "";
+            for (int j = 0; j < listClassificationName.Count; j++)
+            {
+                string strGroup = "";
+                for (int k = 0; k < listName.Count; k++)
+                {
+                    string str = listName[k];
+                    string d1 = str.Split('~')[0];
+                    string d2 = str.Split('~')[1];
+                    if (d2 == "MAX")
+                    {
+                        d2 = "999";
+                    }
+
+                    DataRow[] datas = dtp.Select(getWhere(d2, d1, po) + " and GroupName = '" + listClassificationName[j] + "'");
+                    strGroup += datas.Count();
+                    if (k != listName.Count - 1)
+                    {
+                        strGroup += ",";
+                    }
+                }
+                Item item = new Item()
+                {
+                    value = strGroup,
+                    name = listClassificationName[j]
+                };
+                listData.Add(item);
+                strNameGroup += listClassificationName[j];
+                if (j != listClassificationName.Count - 1)
+                {
+                    strNameGroup += ",";
+                }
+            }
+            chart.Title = "[" + strNameGroup + "]";
+            chart.ListData = listData;
+            return chart;
+        }
         private string getWhere(string max, string min, string col)
         {
             return col + ">=" + min + " and " + col + "<=" + max;
@@ -810,6 +936,9 @@ namespace OTSIncAReportApp.Control_ECharts
                 case "PSize":
                     chartdate = GetPSizeData(m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()].FilePath);
                     break;
+                case "PSizeCombin":
+                    chartdate = GetPSizeDataCombin(m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()].FilePath);
+                    break;
                 case "InclusionareaRatio":
                     chartdate = GetInclusionAreaRatioData(m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()].FilePath);
                     break;
@@ -1225,8 +1354,9 @@ namespace OTSIncAReportApp.Control_ECharts
             {
                 //为页面图形提供数据参数
                 string str = m_ReportApp.data;
+                string strCombin = m_ReportApp.dataCombin;
                 //执行网页脚本事件
-                m_ReportApp.browser.ExecuteScriptAsync("showchart('" + str + "','" + m_ReportApp.type + "')");
+                m_ReportApp.browser.ExecuteScriptAsync("showchart('" + str + "','" + strCombin + "','" + m_ReportApp.type + "')");
             }
         }
         //public string GetPic()

+ 1 - 0
OTSIncAReportApp/1-UI/frmReportApp.cs

@@ -103,6 +103,7 @@ namespace OTSIncAReportApp
         public JsEvent js = new JsEvent();
         public string m_reportname;
         public string data;
+        public string dataCombin;
         public string type;
         public bool timerKG;
 

+ 2 - 2
OTSSysMgrApp/ControllerSettingForm.cs

@@ -244,14 +244,14 @@ namespace OTSSysMgrApp
                     Bitmap bitmap = null;
                     int iWidth = Convert.ToInt32(tbRWidth.Text);
                     int iHeight = Convert.ToInt32(tbRHeight.Text);
-                    int resultValue = Imagepro.GetScanImage(iWidth, iHeight, ddlDwellTime.Text, ref ImageByte);
+                    int resultValue = ScanController.GetScanImage(iWidth, iHeight, ddlDwellTime.Text, ref ImageByte);
                     string str2 = table["str2"].ToString();
 
                     if (resultValue > 0)
                     {
                         if (ImageByte != null)
                         {
-                            bitmap = Imagepro.ToGrayBitmap(ImageByte, width, height);
+                            bitmap = CImageHandler.ToGrayBitmap(ImageByte, width, height);
                             pbImage.Image = bitmap;
                             btnSaveImage.Enabled = true;
                             log.Info("Image capture success!\nImage resolution:" + tbRWidth.Text + "X" + tbRHeight.Text + ";");

+ 0 - 231
OTSSysMgrApp/Imagepro.cs

@@ -1,231 +0,0 @@
-
-using OTSCLRINTERFACE;
-using OTSModelSharp.ServiceInterface;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace OTSSysMgrApp
-{
-    public class Imagepro
-    {
-        public Imagepro()
-        {
-        }
-
-        #region 通过byte数组生成BMP图像文件
-        /// <summary>    
-        /// 将一个byte的数组转换为8bit灰度位图
-        /// </summary>    
-        /// <param name="data">数组</param>    
-        /// <param name="width">图像宽度</param>    
-        /// <param name="height">图像高度</param>    
-        /// <returns>位图</returns>    
-        public static Bitmap ToGrayBitmap(byte[] data, int width, int height)
-        {
-            //// 申请目标位图的变量,并将其内存区域锁定    
-            Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
-            //// BitmapData这部分内容  需要 using System.Drawing.Imaging;  
-            BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, width, height),
-            ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
-
-            //// 获取图像参数    
-            // 扫描线的宽度   
-            int stride = bmpData.Stride;
-            // 显示宽度与扫描线宽度的间隙  
-            int offset = stride - width;
-            // 获取bmpData的内存起始位置
-            IntPtr iptr = bmpData.Scan0;
-            // 用stride宽度,表示这是内存区域的大小
-            int scanBytes = stride * height;
-
-            //// 下面把原始的显示大小字节数组转换为内存中实际存放的字节数组    
-            int posScan = 0;
-            int posReal = 0;// 分别设置两个位置指针,指向源数组和目标数组    
-            byte[] pixelValues = new byte[scanBytes];  //为目标数组分配内存    
-
-            //for (int x = height-1;x>=0 ; x--) data[startIndex+ y];//
-            for (int x = 0; x < height; x++)
-            {
-                int startIndex = x * width;
-                //// 下面的循环节是模拟行扫描    
-                for (int y = 0; y < width; y++)
-                {
-                    pixelValues[posScan++] = data[posReal++];
-                }
-                posScan += offset;  //行扫描结束,要将目标位置指针移过那段“间隙”    
-            }
-            //// 用Marshal的Copy方法,将刚才得到的内存字节数组复制到BitmapData中    
-            System.Runtime.InteropServices.Marshal.Copy(pixelValues, 0, iptr, scanBytes);
-            bmp.UnlockBits(bmpData);  // 解锁内存区域    
-
-            //// 下面的代码是为了修改生成位图的索引表,从伪彩修改为灰度    
-            ColorPalette tempPalette;
-            using (Bitmap tempBmp = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
-            {
-                tempPalette = tempBmp.Palette;
-            }
-            for (int i = 0; i < 256; i++)
-            {
-                tempPalette.Entries[i] = Color.FromArgb(i, i, i);
-            }
-            bmp.Palette = tempPalette;
-
-          
-            return bmp;
-        }
-        #endregion
-
-        public static int GetScanImage(int iWidth, int iHeigh, string DwellTime, ref byte[] bImageData)
-        {
-            if(FileHelper.GetXMLInformations("SemControllerName") == "FEI")
-            {
-                ScanController m_ScanHardwareMgr = ScanController.GetScanController();
-                m_ScanHardwareMgr.Init();
-                m_ScanHardwareMgr.SetImageSize(iWidth, iHeigh);
-                bImageData = m_ScanHardwareMgr.AcquireBSEImage(0, 0, int.Parse(DwellTime)).GetImageDataPtr();
-                return 1;
-            }
-            else
-            {
-                //电镜设置对象
-                var cfun = COTSControlFunExport.GetControllerInstance();
-                int GetImgCount = 0;
-                try
-                {
-                    //连接电镜
-                    bool IsConnec = cfun.ConncetSem();
-                    if (!IsConnec)
-                    {
-                        return 0;
-                    }
-                    //实例电镜初始化
-                    bool IsScan = cfun.ScanInit();
-                    if (!IsScan)
-                    {
-                        return 0;
-                    }
-                    int a_ExternalMode = 0;
-                    //获取终止模式
-
-                    a_ExternalMode = cfun.GetSemExternalMode();
-
-                    //保存初始模式变量
-                    int a_oldMode = 0;
-                    //获取初始模式
-                    if (!cfun.GetSemScanMode(ref a_oldMode))
-                    {
-                        return 0;
-                    }
-                    //设置当前模式
-                    if (!cfun.SetSemScanMode(a_ExternalMode))
-                    {
-                        return 0;
-                    }
-
-                    #region BeamBlank
-                    int a_nBeamBlank = 0;
-                    //获取参数
-                    if (!cfun.GetSemBeamBlank(ref a_nBeamBlank))
-                    {
-                        cfun.SetSemScanMode(a_oldMode);
-                        return 0;
-                    }
-                    //设置参数
-                    if (!cfun.SetSemBeamBlank(false))
-                    {
-                        cfun.SetSemScanMode(a_oldMode);
-                        return 0;
-                    }
-                    #endregion
-
-                    #region 获得放大倍数
-                    //获得放大倍数
-                    double a_dMagnification = 0;
-                    //m_MsrApp.m_LogFunExport.TraceLog("APP_GetSemMagnification-----begin------");
-                    //获取参数
-                    if (!cfun.GetSemMagnification(ref a_dMagnification))
-                    {
-                        cfun.SetSemScanMode(a_oldMode);
-                        return 0;
-                    }
-                    //m_MsrApp.m_LogFunExport.TraceLog("APP_GetSemMagnification_a_dMagnification:" + a_dMagnification + "------");
-                    //m_MsrApp.m_LogFunExport.TraceLog("APP_GetSemMagnification-----end------");
-                    #endregion
-
-                    #region 获取 电镜 X、Y轴 与角度
-                    //获取 电镜 X、Y轴 与角度
-                    double PositionX = 0;
-                    double PositionY = 0;
-                    double PositionR = 0;
-                    //获取参数
-                    if (!cfun.GetSemPositionXY(ref PositionX, ref PositionY, ref PositionR))
-                    {
-                        cfun.SetSemScanMode(a_oldMode);
-                        return 0;
-                    }
-                    #endregion
-
-                    #region 设置图像分辨率
-                    //设置宽度
-                    if (!cfun.SetImageSize(iWidth, iHeigh))
-                    {
-                        cfun.SetSemScanMode(a_oldMode);
-                        return 0;
-                    }
-                    #endregion
-
-                    #region 采集时间
-                    //采集时间
-                    int nDwellTime = Convert.ToInt32(DwellTime);
-                    //设置采集时间
-                    if (!cfun.SetDwellTime(nDwellTime))
-                    {
-                        cfun.SetSemScanMode(a_oldMode);
-                        return 0;
-                    }
-                    #endregion
-
-                    #region MatrixSize
-                    //获得放大倍数
-                    int a_MatrixSize = 0;
-                    Size size = new Size();
-                    //获取参数
-                    size = cfun.GetMatrixSize(a_MatrixSize);
-                    #endregion
-
-                    //获取图像数据
-
-                    int resultCount = iWidth * iHeigh;
-                    GetImgCount = cfun.AcquireBSEImage(0, 0, 0, ref bImageData);
-                    //记录日志
-                    if (resultCount == GetImgCount)
-                    {
-                        //设置为原始 扫描模式
-                        cfun.SetSemScanMode(a_oldMode);
-
-
-                    }
-                    else
-                    {
-                        cfun.SetSemScanMode(a_oldMode);
-
-                    }
-
-                }
-                catch (Exception ex)
-                {
-                    throw ex;
-                }
-
-                return GetImgCount;
-            }
-        }
-    }
-}