Browse Source

complete the GB field visualization.

gsp 2 năm trước cách đây
mục cha
commit
a6109561d4

+ 0 - 12
OTSCPP/OTSRptCalculate/Model/ReportMgr.cpp

@@ -268,19 +268,7 @@ namespace OTSMODEL {
 
 		return flds;
 	}
-	/*COTSParticleList CReportMgr::GetGBDSParticles(CPropParamPtr thePropParam)
-	{
-		CGBCalculate GBCal(this);
-
-		CGBFieldList listRawGBFields =CalGBFields(rstFileMgrPrt);
-
-		CategoryGBInclutions(listRawGBFields, tableType);
-
-		listCGBField = listRawGBFields;
-
-		CGBGradeData gradeData = CGBGradeData(listCGBField);
 	
-	}*/
 
 
 	// protected

+ 1 - 1
OTSCPP/OTSRptCalculate/Model/ReportMgr.h

@@ -63,7 +63,7 @@ namespace OTSMODEL {
 
 		CGBFieldList GetAllGBFields(CPropParamPtr thePropParam);
 
-		//COTSParticleList GetGBDSParticles(CPropParamPtr thePropParam);
+	
 
 		
 		COTSParticleList GetAnalysisParticleList(CString a_DataSourceName);

+ 37 - 84
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -116,7 +116,7 @@ namespace OTSIncAReportGraph.Controls
         //总背景矩形
         private RectangleF m_backRect = new RectangleF();
 
- 
+        private PointF m_ScaleRefPoint;
 
 
         //记录总物理矩形总大小
@@ -194,11 +194,11 @@ namespace OTSIncAReportGraph.Controls
         /// <summary>
         /// 背景矩形属性
         /// </summary>
-        public RectangleF BackRectF
-        {
-            set { m_backRect = value; }
-            get { return m_backRect; }
-        }
+        //public RectangleF BackRectF
+        //{
+        //    set { m_backRect = value; }
+        //    get { return m_backRect; }
+        //}
 
         //public OTSImageDisHelp ImageDisHelper { get => imageDisHelper; set => imageDisHelper = value; }
 
@@ -301,7 +301,7 @@ namespace OTSIncAReportGraph.Controls
             //初始化底层操作类
             imageDisHelper = new OTSImageDisHelp(resultFile);
 
-            m_backRect = imageDisHelper.m_wholeBackRect;
+            m_backRect = imageDisHelper.m_originalBackRect;
 
             string str29 = "begin to compose field picture....";
             log.Info(str29);
@@ -320,8 +320,8 @@ namespace OTSIncAReportGraph.Controls
             for (int i = 0; i < fieldlist.Count(); i++)
             {
                 ProgressBarUpdate(20 + (int)(ls_int_progresscalc * (i + 1)), "finished " + i.ToString() + "total " + resultFile.List_OTSField.Count.ToString() + "field...");
-                //取出该Field的物理坐标,将其转换成对应的屏幕像素坐标,屏幕左上角为原点(0,0)的偏移值,用于后面计算各Segment的位置使用
-                Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };
+              
+                Point thisfield_point = new Point() { X = fieldlist[i].FieldPosX, Y = fieldlist[i].FieldPosY };//get OTS coordination
 
                 Point offset_point = imageDisHelper.ConvertOTSCoordToScreenCoord(thisfield_point);//the ots coordinate is always the up right positive.
                 DisplayField df;
@@ -656,9 +656,11 @@ namespace OTSIncAReportGraph.Controls
       
         private void ImageZoom(float newZoom,PointF refPoint)
         {
-
+           
+            m_ScaleRefPoint = refPoint;
             float zoomDelta = newZoom - m_zoom_record;
-            //if (zoomDelta == 0) return;
+        
+           
             m_backRect.Width +=  m_backRect.Width/m_zoom_record*zoomDelta;
             m_backRect.Height +=  m_backRect.Height / m_zoom_record*zoomDelta;
             //锚点缩放补差值计算,得出差值
@@ -670,7 +672,8 @@ namespace OTSIncAReportGraph.Controls
 
             //对背景矩形与所有的segment进行修补差值
             m_backRect.X = refPoint.X + xShift;
-            m_backRect.Y = refPoint.Y + yShift; 
+            m_backRect.Y = refPoint.Y + yShift;
+
 
             for (int i = 0; i < m_list_allDPart.Count(); i++)
             {
@@ -749,8 +752,8 @@ namespace OTSIncAReportGraph.Controls
 
            
             ImageZoom(currentZoom, new PointF(e.X, e.Y));
-           
 
+           
             Invalidate();
         }
 
@@ -902,7 +905,7 @@ namespace OTSIncAReportGraph.Controls
                     }
                     //同样重新计算backrectf的坐标
                     m_backRect = new RectangleF(m_backRect.Location.X + e.X - m_beforedrag_pointf.X,
-                        m_backRect.Location.Y + e.Y - m_beforedrag_pointf.Y, m_backRect.Width, m_backRect.Height);
+                         m_backRect.Location.Y + e.Y - m_beforedrag_pointf.Y, m_backRect.Width, m_backRect.Height);
                     m_beforedrag_pointf = e.Location;
 
                 
@@ -1456,8 +1459,7 @@ namespace OTSIncAReportGraph.Controls
         {
             this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
             SaveFileDialog sfd = new SaveFileDialog();
-            //|ALL Files(*.*)|*.*
-            //BMP Files(*.bmp)| *.bmp |
+          
             sfd.Filter = "png Files(*.png)| *.png |BMP Files(*.bmp)| *.bmp |JPG Files(*.jpg)|*.jpg;*.jpeg";
             if (sfd.ShowDialog() == DialogResult.OK)
             {
@@ -1669,7 +1671,7 @@ namespace OTSIncAReportGraph.Controls
 
             //同样重新计算backrectf的坐标
             m_backRect = new RectangleF(in_pointf.X, in_pointf.Y,
-                m_backRect.Width, m_backRect.Height);
+                 m_backRect.Width, m_backRect.Height);
 
             for (int i = 0; i < m_list_allDPart.Count; i++)
             {
@@ -1915,67 +1917,7 @@ namespace OTSIncAReportGraph.Controls
         #endregion
 
     
-      
-
-        private static byte[] ImgtoByte(Image img)
-        {
-            MemoryStream ms = new MemoryStream();
-            byte[] imagedata = null;
-            img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
-            imagedata = ms.GetBuffer();
-            return imagedata;
-        }
-        private static Image BytesToImage(byte[] buffer)
-        {
-            MemoryStream ms = new MemoryStream(buffer);
-            Image image = System.Drawing.Image.FromStream(ms);
-            return image;
-        }
-
-        #region Debug下执行的辅助测试代码
-        private void Control_DrawDistrbutionImageAndBSE_MouseDoubleClick(object sender, MouseEventArgs e)
-        {
-#if DEBUG
-            Screen[] screens = Screen.AllScreens;
-            string ls_str = "";
-            for (int i = 0; i < screens.Count(); i++)
-            {
-                ls_str = ls_str + "显示器" + (i + 1).ToString() + "  名称:" + screens[i].DeviceName + Environment.NewLine +
-                "显示器" + (i + 1).ToString() + "  是否主要显示器:" + screens[i].Primary + Environment.NewLine +
-                "显示器" + (i + 1).ToString() + "  WorkingArea:" + screens[i].WorkingArea + Environment.NewLine +
-                "显示器" + (i + 1).ToString() + "  Bounds:" + screens[i].Bounds + Environment.NewLine +
-                "显示器" + (i + 1).ToString() + "  色深:" + screens[i].BitsPerPixel + Environment.NewLine;
-            }
-
-            MessageBox.Show("------------------该段代码主要用来测试程序---------------------" + Environment.NewLine +
-                //"当前窗体X:" + this.ParentForm.Location.X.ToString() + "   Y:" + this.ParentForm.Location.Y.ToString() + Environment.NewLine +
-                "显示器数量" + Screen.AllScreens.Count().ToString() + Environment.NewLine +
-                ls_str +
-                "DESKTOP.Width:" + MyPrimaryScreen.DESKTOP.Width + "   DESKTOP.Height:" + MyPrimaryScreen.DESKTOP.Height + Environment.NewLine +
-                "DpiX:" + MyPrimaryScreen.DpiX + "   DpiY:" + MyPrimaryScreen.DpiY + Environment.NewLine +
-                "ScaleX:" + MyPrimaryScreen.ScaleX + "   ScaleY:" + MyPrimaryScreen.ScaleY + Environment.NewLine +
-                "WorkingArea.Width:" + MyPrimaryScreen.WorkingArea.Width + "   WorkingArea.Height:" + MyPrimaryScreen.WorkingArea.Height + Environment.NewLine +
-                "this.Width:" + this.Width + "   this.Height:" + this.Height + Environment.NewLine +
-                "单像素比:" + m_pixelSize.ToString() + Environment.NewLine +
-                "缩放倍数:" + m_zoom_record.ToString() + Environment.NewLine +
-                "屏幕像素backrectf  x:" + m_backRect.X.ToString() + "  y:" + m_backRect.Y.ToString() + "  width:" + m_backRect.Width.ToString() + "  height:" + m_backRect.Height.ToString() + Environment.NewLine +
-                //"屏幕像素oldbackrectf  x:" + m_original_backRect.X.ToString() + "  y:" + m_original_backRect.Y.ToString() + "  width:" + m_original_backRect.Width.ToString() + "  height:" + m_original_backRect.Height.ToString() + Environment.NewLine +
-                "物理像素back_wl_rectf  x:" + m_back_wl_rectf.X.ToString() + "  y:" + m_back_wl_rectf.Y.ToString() + "  width:" + m_back_wl_rectf.Width.ToString() + "  height:" + m_back_wl_rectf.Height.ToString() + Environment.NewLine +
-                //"单个Field视域屏幕像素宽:" + m_OneField_Screen_BackRectf.Width.ToString() + " 高:" + m_OneField_Screen_BackRectf.Height.ToString() + Environment.NewLine +
-                //"单个OTS视域屏幕像素宽:" + m_OneField_OTS_Rect.Width.ToString() + " 高:" + m_OneField_OTS_Rect.Height.ToString() + Environment.NewLine +
-                "屏幕像素backrectf  x:" + m_backRect.X.ToString() + "  y:" + m_backRect.Y.ToString() + "  width:" + m_backRect.Width.ToString() + "  height:" + m_backRect.Height.ToString() + Environment.NewLine +
-                //"包含Field数量:" + imageDisHelper.m_field_count.ToString() + " Particle数量:" + imageDisHelper.m_particle_count.ToString() + Environment.NewLine +
-                "正常显示Paticle数量:" + GetParticleNumberByState(PaintState.PAINT).ToString() + " 不显示Particel数量:" + GetParticleNumberByState(PaintState.NOPAINT).ToString() + Environment.NewLine +
-                //"删除Particle数量:" + GetParticleNumberByState("删除").ToString() + " 选中Particle数量:" + GetParticleNumberByState("选择").ToString() + Environment.NewLine +
-                //"加载底层数据用时:" + imageDisHelper.m_time_str + Environment.NewLine +
-                //"组建并计算图像用时:" + imageDisHelper.m_time_str2 + Environment.NewLine +
-                "---------------------------END----------------------------------"
-                );
-#endif
-        }
-
-
-        #endregion
+     
 
         private void ExportoriginalspliceToolStripMenuItem_Click(object sender, EventArgs e)
         {
@@ -2211,6 +2153,10 @@ namespace OTSIncAReportGraph.Controls
                     clr_prop.SetCalTableType((int)CALCULATE_TABLE_TYPE.GB_Method2);
                     tbl = m_ReportApp.m_rstDataMgr.m_ReportMgr.GetGBDSParticles(clr_prop);
                     break;
+                case "ASTMAll":
+                    clr_prop.SetCalTableType((int)CALCULATE_TABLE_TYPE.ASTM);
+                    tbl = m_ReportApp.m_rstDataMgr.m_ReportMgr.GetAllGBFields(clr_prop);
+                    break;
 
                 default:
                     tbl = new DataTable();
@@ -2219,21 +2165,28 @@ namespace OTSIncAReportGraph.Controls
 
 
             }
-            FullGraphMatch();
-            if (tag == "All1" || tag == "All2")
+           
+            if (tag == "All1" || tag == "All2" || tag=="ASTMAll")
             {
                 if (tbl.Rows.Count > 0)
                 {
                     foreach (DataRow r in tbl.Rows)
                     {
                         Point p = new Point(Convert.ToInt32(r["fieldX"]), Convert.ToInt32(r["fieldY"]));
-                        //double GBFieldwidth = 710;
+                       
                         Point screenP = imageDisHelper.ConvertOTSCoordToScreenCoord(p);
+
                         int gbfldwidth = Convert.ToInt32(710.0 / imageDisHelper.m_pixelSize);
+                       
 
                         var df = new DisplayField(gbfldwidth, gbfldwidth, screenP);
-                        df.Zoom(m_zoom_record - 1, new Point(0,0));
-                      
+
+                        
+                        df.Zoom(m_zoom_record - 1, new PointF(0, 0));
+
+                        
+
+                        df.Move(new SizeF(-m_backRect.X,-m_backRect.Y));
 
                         int topgrade = Convert.ToInt32(r["topGrade"]);
                         switch (topgrade)
@@ -2248,7 +2201,7 @@ namespace OTSIncAReportGraph.Controls
                                 df.DisColor = Color.Purple;
                                 break;
                             case 3:
-                                df.DisColor = Color.DarkBlue;
+                                df.DisColor = Color.Blue;
                                 break;
                             case 4:
                                 df.DisColor = Color.Red;

+ 26 - 5
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.designer.cs

@@ -44,6 +44,8 @@
             this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripMenuItem();
+            this.aSTMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.显示所有帧ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.清除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.CMenuStrip.SuspendLayout();
             this.SuspendLayout();
@@ -117,6 +119,7 @@
             this.显示国标信息ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripMenuItem2,
             this.toolStripMenuItem3,
+            this.aSTMToolStripMenuItem,
             this.清除ToolStripMenuItem});
             this.显示国标信息ToolStripMenuItem.Name = "显示国标信息ToolStripMenuItem";
             this.显示国标信息ToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
@@ -135,7 +138,7 @@
             // toolStripMenuItem1
             // 
             this.toolStripMenuItem1.Name = "toolStripMenuItem1";
-            this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
+            this.toolStripMenuItem1.Size = new System.Drawing.Size(160, 22);
             this.toolStripMenuItem1.Tag = "All1";
             this.toolStripMenuItem1.Text = "显示所有国标帧";
             this.toolStripMenuItem1.Click += new System.EventHandler(this.显示国标信息ToolStripMenuItem_Click);
@@ -143,7 +146,7 @@
             // 查询DS类颗粒ToolStripMenuItem
             // 
             this.查询DS类颗粒ToolStripMenuItem.Name = "查询DS类颗粒ToolStripMenuItem";
-            this.查询DS类颗粒ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+            this.查询DS类颗粒ToolStripMenuItem.Size = new System.Drawing.Size(160, 22);
             this.查询DS类颗粒ToolStripMenuItem.Tag = "DS1";
             this.查询DS类颗粒ToolStripMenuItem.Text = "查询DS类颗粒";
             this.查询DS类颗粒ToolStripMenuItem.Click += new System.EventHandler(this.显示国标信息ToolStripMenuItem_Click);
@@ -160,7 +163,7 @@
             // toolStripMenuItem4
             // 
             this.toolStripMenuItem4.Name = "toolStripMenuItem4";
-            this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22);
+            this.toolStripMenuItem4.Size = new System.Drawing.Size(160, 22);
             this.toolStripMenuItem4.Tag = "All2";
             this.toolStripMenuItem4.Text = "显示所有国标帧";
             this.toolStripMenuItem4.Click += new System.EventHandler(this.显示国标信息ToolStripMenuItem_Click);
@@ -168,11 +171,28 @@
             // toolStripMenuItem10
             // 
             this.toolStripMenuItem10.Name = "toolStripMenuItem10";
-            this.toolStripMenuItem10.Size = new System.Drawing.Size(180, 22);
+            this.toolStripMenuItem10.Size = new System.Drawing.Size(160, 22);
             this.toolStripMenuItem10.Tag = "DS2";
             this.toolStripMenuItem10.Text = "查询DS类颗粒";
             this.toolStripMenuItem10.Click += new System.EventHandler(this.显示国标信息ToolStripMenuItem_Click);
             // 
+            // aSTMToolStripMenuItem
+            // 
+            this.aSTMToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.显示所有帧ToolStripMenuItem});
+            this.aSTMToolStripMenuItem.Name = "aSTMToolStripMenuItem";
+            this.aSTMToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+            this.aSTMToolStripMenuItem.Tag = "";
+            this.aSTMToolStripMenuItem.Text = "ASTM";
+            // 
+            // 显示所有帧ToolStripMenuItem
+            // 
+            this.显示所有帧ToolStripMenuItem.Name = "显示所有帧ToolStripMenuItem";
+            this.显示所有帧ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+            this.显示所有帧ToolStripMenuItem.Tag = "ASTMAll";
+            this.显示所有帧ToolStripMenuItem.Text = "显示所有帧";
+            this.显示所有帧ToolStripMenuItem.Click += new System.EventHandler(this.显示国标信息ToolStripMenuItem_Click);
+            // 
             // 清除ToolStripMenuItem
             // 
             this.清除ToolStripMenuItem.Name = "清除ToolStripMenuItem";
@@ -187,7 +207,6 @@
             this.Name = "Control_DrawDistrbutionImageAndBSE";
             this.Size = new System.Drawing.Size(1204, 781);
             this.Load += new System.EventHandler(this.Control_DrawDistrbutionImageAndBSE_Load);
-            this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Control_DrawDistrbutionImageAndBSE_MouseDoubleClick);
             this.CMenuStrip.ResumeLayout(false);
             this.ResumeLayout(false);
 
@@ -213,5 +232,7 @@
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem10;
         private System.Windows.Forms.ToolStripMenuItem 清除ToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem aSTMToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem 显示所有帧ToolStripMenuItem;
     }
 }

+ 8 - 6
OTSIncAReportApp/1-UI/Control_Graph/OTSIncAReportGraphFuncation/OTSImageDisHelp.cs

@@ -52,10 +52,12 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
 
         public Point OTSRightUpPoint;
 
-        public RectangleF m_wholeBackRect;
+        public RectangleF m_originalBackRect;
 
        
         public double m_pixelSize;
+
+      
         private List<Point> fieldCenterList;
 
         NLog.Logger log;
@@ -104,10 +106,9 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
 
             OTSRightUpPoint = GetOTSCoordRightUpPoint(fieldCenterList, (int)physicalfiledsize.Width, (int)physicalfiledsize.Height);
 
-            m_wholeBackRect = new RectangleF(0, 0, (float)((OTSRightUpPoint.X - OTSLeftBottomPoint.X)/m_pixelSize), (float)((OTSRightUpPoint.Y - OTSLeftBottomPoint.Y)/m_pixelSize));
+            m_originalBackRect = new RectangleF(0, 0, (float)((OTSRightUpPoint.X - OTSLeftBottomPoint.X)/m_pixelSize), (float)((OTSRightUpPoint.Y - OTSLeftBottomPoint.Y)/m_pixelSize));
 
 
-            
 
             log = NLog.LogManager.GetCurrentClassLogger();
         }
@@ -165,11 +166,12 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
            
             var OTSPoint=new Point(currenFldOTSPos.X - OTSLeftBottomPoint.X, currenFldOTSPos.Y - OTSLeftBottomPoint.Y);
 
-            int screenHeight = (int)m_wholeBackRect.Height + (0 - (int)(Convert.ToDouble(OTSPoint.Y) / m_pixelSize));//because the screen coordinate is downward rightward positive,so we need to translate the Y coordinate of the OTS system which is upward rightward positive.
+            int screenHeight = (int)m_originalBackRect.Height + (0 - (int)(Convert.ToDouble(OTSPoint.Y) / m_pixelSize));//because the screen coordinate is downward rightward positive,so we need to translate the Y coordinate of the OTS system which is upward rightward positive.
            
-            var screenPoint = new Point((int)(Convert.ToDouble(OTSPoint.X)/m_pixelSize), (int)screenHeight);
+            var screenPoint = new Point((int)(Convert.ToDouble(OTSPoint.X)/m_pixelSize), (int)(screenHeight));
 
-            var curP = new Point((int)(screenPoint.X - m_wholeBackRect.X), (int)(screenPoint.Y - m_wholeBackRect.Y));
+            //var curP = new Point((int)(screenPoint.X + m_wholeBackRect.X), (int)(screenPoint.Y + m_wholeBackRect.Y));
+            var curP = new Point((int)(screenPoint.X + m_originalBackRect.X), (int)(screenPoint.Y + m_originalBackRect.Y));
 
             return curP;
         }

+ 2 - 2
OTSIncAReportApp/2-CommonFunction/CommonClass/DisplayField.cs

@@ -117,8 +117,8 @@ namespace OTSIncAReportGraph
         public void Move(SizeF xyShift)
         {
             m_Rect = new RectangleF(
-                           m_Rect.Left- Convert.ToSingle((xyShift.Width)),
-                          m_Rect.Top - Convert.ToSingle((xyShift.Height)),
+                           m_Rect.Left- Convert.ToSingle(xyShift.Width),
+                          m_Rect.Top - Convert.ToSingle(xyShift.Height),
                           m_Rect.Width,
                            m_Rect.Height);
            

+ 1 - 0
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -779,6 +779,7 @@
     <EmbeddedResource Include="1-UI\OutputNlog.resx">
       <DependentUpon>OutputNlog.cs</DependentUpon>
     </EmbeddedResource>
+    <None Include="1-UI\Control_Graph\Controls\ClassDiagram1.cd" />
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>