123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using OTSMeasureApp._4_OTSSamplespaceGraphicsPanel.VisualGDIObjects;
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
- {
- public class CVisualSampleArea
- {
-
-
- CDisplayGDIObject m_SampleHoleGDIObject;//
- CMeasureArea m_MeasureGDIObject;//path
-
- public float GetZoomNum()
- {
- return m_SampleHoleGDIObject.GetZoomNumber();
- }
- public PointF GetDisplayRefPoint()
- {
- return m_SampleHoleGDIObject.GetDisplayRefPoint();
- }
-
- public CVisualSampleArea()
- {
- m_SampleHoleGDIObject = new CDisplayGDIObject();
- //测量区域
- m_MeasureGDIObject = new CMeasureArea();
- }
- public CDisplayGDIObject GetSampleGDIObject()
- {
- return m_SampleHoleGDIObject;
- }
- public void SetSampleGDIObject(CDisplayGDIObject value)
- {
- m_SampleHoleGDIObject = value;
-
- }
- public CMeasureArea GetMeasureGDIObject()
- {
- return m_MeasureGDIObject;
- }
- public void SetMeasureGDIObject(CMeasureArea value)
- {
- m_MeasureGDIObject = value;
-
- }
- public string GetSampleName()
- {
- return m_SampleHoleGDIObject.SampleName;
- }
- public void SetSampleName(string value)
- {
- m_SampleHoleGDIObject.SampleName = value;
- }
-
- public bool IsWorkSample()
- {
- return m_SampleHoleGDIObject.IsWorkSample;
- }
- public void SetIsWorkSample(bool value)
- {
- m_SampleHoleGDIObject.IsWorkSample = value;
- }
- public List<CVisualFieldGDIObject> GetMeasureFieldGDIObjects()
- {
- return m_MeasureGDIObject.SubItems();
- }
- public RectangleF GetAllGDIObjectsRectangle()
- {
- double left, top, right, bottom;
- var itm1 = m_MeasureGDIObject.SubItems()[0];
- var rec1 = itm1.GetZoomedRegionF();
- left = rec1.Left;
- top = rec1.Top;
- right = rec1.Right;
- bottom = rec1.Bottom;
- foreach (var itm in m_MeasureGDIObject.SubItems())
- {
- var rec = itm.GetZoomedRegionF();
- if (rec.Left < rec1.Left)
- {
- left = rec.Left;
- }
- if (rec.Top < rec1.Top)
- {
- top = rec.Top;
- }
- if (rec.Right > rec1.Right)
- {
- right = rec.Right;
- }
- if(rec.Bottom > rec1.Bottom)
- {
- bottom = rec.Bottom;
- }
- }
- return new RectangleF((float)left, (float)top, (float)(right -left), (float)(bottom -top));
- }
- public void SetMeasureFieldGDIObjects(List<CVisualFieldGDIObject> value)
- {
- m_MeasureGDIObject.ClearSubItems();
- foreach (var gdi in value)
- {
- m_MeasureGDIObject.AddSubItems(gdi);
-
- }
- }
- public void AddFieldGDIObject( CVisualFieldGDIObject gdi)
- {
- gdi.SetZoomNumber(m_MeasureGDIObject.GetZoomNumber());
- gdi.SetDisplayRefPoint(m_MeasureGDIObject.GetDisplayRefPoint());
- m_MeasureGDIObject.AddSubItems(gdi);
- }
-
- }
- }
|