123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857 |
- using OTSCLRINTERFACE;
- using OTSMeasureApp._0_OTSModel.OTSDataType;
- using OTSModelSharp;
- using OTSModelSharp.ServiceCenter;
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Xml;
- namespace OTSDataType
- {
- public class COTSField : ISlo
- {
- public COTSField leftField = null;
- public COTSField upField = null;
- public COTSField downField = null;
- public COTSField rightField = null;
- protected NLog.Logger log;
- // ID
- int m_nID;
- int measureSequence;
- // position (from field center manager)
- protected System.Drawing.PointF m_otsPos;
- protected CBSEImgClr m_pBSEImg;
- protected double m_pixelSize;
- protected CImageHandler m_ImagePro;
- protected List<COTSParticleClr> m_listAllParticles = new List<COTSParticleClr>();//hold up all the particles abstracted from bse image;
- protected List<COTSParticleClr> m_listAnalysisParticles = new List<COTSParticleClr>();// according to xraylimit constraint,pick out the first big particles.
- protected List<COTSParticleClr> m_listXrayParticles = new List<COTSParticleClr>();//hold up all the particles that needing the xray data.
- private int imgheight;
- private int imgwidth;
- private COTSRect m_otsRect;
- private COTSSample m_sample;
- public COTSField()
- {
- log = NLog.LogManager.GetCurrentClassLogger();
- Init();
- }//only using in xmlserialization
- public int ImgHeight { get => imgheight; set => imgheight = value; }
- public int ImgWidth { get => imgwidth; set => imgwidth = value; }
- public COTSSample Sample { get => m_sample; set => m_sample = value; }
- internal COTSRect GetOTSRect()
- {
- return m_otsRect;
- }
- internal void SetOTSRect(COTSRect value)
- {
- m_otsRect = value;
- }
- public int GetMeasureSequence()
- {
- return measureSequence;
- }
- public void SetMeasureSequence(int value)
- {
- measureSequence = value;
- }
- public List<string> strKeyName;
- public bool GetIsMeasureComplete()
- {
- return isMeasureComplete;
- }
- public void SetIsMeasureComplete(bool value)
- {
- isMeasureComplete = value;
- }
- private bool isMeasureComplete;
- public PointF GetSemPos()
- {
- return m_semPos;
- }
- public void SetSemPos(PointF value)
- {
- m_semPos = value;
- }
- private PointF m_semPos;
- public List<COTSParticleClr> GetAllParticles()
- {
- return m_listAllParticles;
- }
- public List<COTSParticleClr> GetListAnalysisParticles()
- {
- return m_listAnalysisParticles;
- }
- public List<COTSParticleClr> GetListXrayParticles()
- {
- m_listXrayParticles.Clear();
- foreach (var p in m_listAnalysisParticles)
- {
- if (p.IsXrayParticle())
- {
- m_listXrayParticles.Add(p);
- }
- }
- return m_listXrayParticles;
- }
- public void SetListAnalysisParticles(List<COTSParticleClr> value)
- {
- m_listAnalysisParticles = value;
- }
- public COTSField(PointF centerPoint, double a_dPixelSize)
- {
- log = NLog.LogManager.GetCurrentClassLogger();
- Init();
- //m_pBSEImg = a_pBSEImg;
- m_otsPos = centerPoint;
- m_pixelSize = a_dPixelSize;
- }
- public double GetPixelSize()
- {
- return m_pixelSize;
- }
- public void SetPixelSize(double size)
- {
- m_pixelSize = size;
- }
- // initialization
- void Init()
- {
- // initialization
- m_nID = -1;
- m_otsPos = new System.Drawing.Point(0, 0);
- m_listAllParticles.Clear();
- }
- public COTSField(COTSField a_poSource)
- {
- // can't copy itself
- if (a_poSource == this)
- {
- return;
- }
- Duplicate(a_poSource);
- }
- public CBSEImgClr GetBSEImage()
- {
- return m_pBSEImg;
- }
- public void SetBSEImage(CBSEImgClr a_pBSEImg)
- {
- if (a_pBSEImg == null)
- {
- // invalid BSE image.
- log.Error("SetBSEImage: invalid BSE image.");
- return;
- }
- m_pBSEImg = a_pBSEImg;
- imgwidth = a_pBSEImg.GetWidth();
- imgheight = a_pBSEImg.GetHeight();
- }
- public void RemoveImgBGAndGetParticles(COTSImageProcParam a_pImageProcessParam, double a_pixelSize, bool ifXray)
- {
- if (m_pBSEImg == null)
- return;
- CImageHandler imghandler = new CImageHandler();
- List<COTSParticleClr> allParts = new List<COTSParticleClr>();
- imghandler.RemoveBGAndGetParts(this, a_pImageProcessParam, ref allParts);
- foreach (var p in allParts)
- {
- p.SetIsXrayParticle(ifXray);
- m_listAllParticles.Add(p);
- }
- return;
- }
- public void RemoveDuplicateOverlapParticles(int overlap)
- {
- List<COTSParticleClr> finalparts = new List<COTSParticleClr>();
- List<COTSParticleClr> duplicateparts = new List<COTSParticleClr>();
- //find left side duplicate particles
- var leftparts = this.GetSideParticlesByOverlap(SORTING_DIRECTION.LEFT, overlap);
- if (leftField != null && leftField.measureSequence < this.measureSequence)
- {
- var rightsideparts = leftField.GetSideParticlesByOverlap(SORTING_DIRECTION.RIGHT, overlap);
- if (leftField.upField != null && leftField.upField.measureSequence < this.measureSequence)//include the left up corner parts
- {
- var leftupParts = leftField.upField.GetSideParticlesByOverlap(SORTING_DIRECTION.RIGHT, overlap);
- rightsideparts.AddRange(leftupParts);
- }
- if (leftField.downField != null && leftField.downField.measureSequence < this.measureSequence)//include the left down corner parts
- {
- var leftdownParts = leftField.downField.GetSideParticlesByOverlap(SORTING_DIRECTION.RIGHT, overlap);
- rightsideparts.AddRange(leftdownParts);
- }
- log.Info("left side particles num:" + leftparts.Count.ToString());
- foreach (var p in leftparts)
- {
- int pleft = 0, pright = 0, ptop = 0, pbottom = 0;
- p.GetOTSRect(ref pleft, ref ptop, ref pright, ref pbottom);
- COTSRect prec = new COTSRect(pleft, ptop, pright, pbottom);
- PointF pcenter = prec.GetCenterPoint();
- foreach (var p1 in rightsideparts)
- {
- int p1left = 0, p1right = 0, p1top = 0, p1bottom = 0;
- p1.GetOTSRect(ref p1left, ref p1top, ref p1right, ref p1bottom);
- COTSRect p1rec = new COTSRect(p1left, p1top, p1right, p1bottom);
- PointF p1Center = p1rec.GetCenterPoint();
- if (Math.Abs(pcenter.X - p1Center.X) < 2 * overlap && Math.Abs(pcenter.Y - p1Center.Y) < 2 * overlap)
- {
- var sim = p.CalculateSimilarity(p1);
- if (sim > 0.95)
- {
- log.Warn("remove left side duplicate particle,similarity:" + sim.ToString("F3"));
- log.Warn("P1:" + p.GetImgPortraitString());
- log.Warn("P2:" + p1.GetImgPortraitString());
- duplicateparts.Add(p);
- break;
- }
- }
- }
- }
- }
- //find up side duplicate particles
- var upparts = this.GetSideParticlesByOverlap(SORTING_DIRECTION.UP, overlap);
- if (upField != null && upField.measureSequence < this.measureSequence)
- {
- var othersideparts = upField.GetSideParticlesByOverlap(SORTING_DIRECTION.DOWN, overlap);
- log.Info("up side particles num:" + upparts.Count.ToString());
- foreach (var p in upparts)
- {
- int pleft = 0, pright = 0, ptop = 0, pbottom = 0;
- p.GetOTSRect(ref pleft, ref ptop, ref pright, ref pbottom);
- COTSRect prec = new COTSRect(pleft, ptop, pright, pbottom);
- PointF pcenter = prec.GetCenterPoint();
- foreach (var p1 in othersideparts)
- {
- int p1left = 0, p1right = 0, p1top = 0, p1bottom = 0;
- p1.GetOTSRect(ref p1left, ref p1top, ref p1right, ref p1bottom);
- COTSRect p1rec = new COTSRect(p1left, p1top, p1right, p1bottom);
- PointF p1Center = p1rec.GetCenterPoint();
- if (Math.Abs(pcenter.X - p1Center.X) < 2 * overlap && Math.Abs(pcenter.Y - p1Center.Y) < 2 * overlap)
- {
- var sim = p.CalculateSimilarity(p1);
- if (sim > 0.95)
- {
- log.Warn("remove upside duplicate particle,similarity:" + sim.ToString("F3"));
- log.Warn("P1:" + p.GetImgPortraitString());
- log.Warn("P2:" + p1.GetImgPortraitString());
- duplicateparts.Add(p);
- break;
- }
- }
- }
- }
- }
- //find right side duplicate particles
- var rightparts = this.GetSideParticlesByOverlap(SORTING_DIRECTION.RIGHT, overlap);
- if (rightField != null && rightField.measureSequence < this.measureSequence)
- {
- log.Info("right side particles num:" + rightparts.Count.ToString());
- var othersideparts = rightField.GetSideParticlesByOverlap(SORTING_DIRECTION.LEFT, overlap);
- if (rightField.upField != null && rightField.upField.measureSequence < this.measureSequence)// right up corner parts
- {
- var rightupParts = rightField.upField.GetSideParticlesByOverlap(SORTING_DIRECTION.LEFT, overlap);
- othersideparts.AddRange(rightupParts);
- }
- if (rightField.downField != null && leftField.downField.measureSequence < this.measureSequence)// rightdown corner parts
- {
- var rightdownParts = leftField.downField.GetSideParticlesByOverlap(SORTING_DIRECTION.LEFT, overlap);
- othersideparts.AddRange(rightdownParts);
- }
- foreach (var p in rightparts)
- {
- int pleft = 0, pright = 0, ptop = 0, pbottom = 0;
- p.GetOTSRect(ref pleft, ref ptop, ref pright, ref pbottom);
- COTSRect prec = new COTSRect(pleft, ptop, pright, pbottom);
- PointF pcenter = prec.GetCenterPoint();
- foreach (var p1 in othersideparts)
- {
- int p1left = 0, p1right = 0, p1top = 0, p1bottom = 0;
- p1.GetOTSRect(ref p1left, ref p1top, ref p1right, ref p1bottom);
- COTSRect p1rec = new COTSRect(p1left, p1top, p1right, p1bottom);
- PointF p1Center = p1rec.GetCenterPoint();
- if (Math.Abs(pcenter.X - p1Center.X) < 2 * overlap && Math.Abs(pcenter.Y - p1Center.Y) < 2 * overlap)
- {
- var sim = p.CalculateSimilarity(p1);
- if (sim > 0.95)
- {
- log.Warn("remove right side duplicate particle,similarity:" + sim.ToString("F3"));
- log.Warn("P1:" + p.GetImgPortraitString());
- log.Warn("P2:" + p1.GetImgPortraitString());
- duplicateparts.Add(p);
- break;
- }
- }
- }
- }
- }
- //find down side duplicate particles
- var downparts = this.GetSideParticlesByOverlap(SORTING_DIRECTION.DOWN, overlap);
- if (downField != null && downField.measureSequence < this.measureSequence)
- {
- log.Info("down side particles num:" + downparts.Count.ToString());
- var othersideparts = downField.GetSideParticlesByOverlap(SORTING_DIRECTION.UP, overlap);
- foreach (var p in downparts)
- {
- int pleft = 0, pright = 0, ptop = 0, pbottom = 0;
- p.GetOTSRect(ref pleft, ref ptop, ref pright, ref pbottom);
- COTSRect prec = new COTSRect(pleft, ptop, pright, pbottom);
- PointF pcenter = prec.GetCenterPoint();
- foreach (var p1 in othersideparts)
- {
- int p1left = 0, p1right = 0, p1top = 0, p1bottom = 0;
- p1.GetOTSRect(ref p1left, ref p1top, ref p1right, ref p1bottom);
- COTSRect p1rec = new COTSRect(p1left, p1top, p1right, p1bottom);
- PointF p1Center = p1rec.GetCenterPoint();
- if (Math.Abs(pcenter.X - p1Center.X) < 2 * overlap && Math.Abs(pcenter.Y - p1Center.Y) < 2 * overlap)
- {
- var sim = p.CalculateSimilarity(p1);
- if (sim > 0.95)
- {
- log.Warn("remove down side duplicate particle,similarity:" + sim.ToString("F3"));
- log.Warn("P1:" + p.GetImgPortraitString());
- log.Warn("P2:" + p1.GetImgPortraitString());
- duplicateparts.Add(p);
- break;
- }
- }
- }
- }
- }
- foreach (var p in leftparts)
- {
- if (duplicateparts.Contains(p))
- {
- continue;
- }
- if (!finalparts.Contains(p))
- {
- finalparts.Add(p);
- }
- }
- foreach (var p in upparts)
- {
- if (duplicateparts.Contains(p))
- {
- continue;
- }
- if (!finalparts.Contains(p))
- {
- finalparts.Add(p);
- }
- }
- foreach (var p in rightparts)
- {
- if (duplicateparts.Contains(p))
- {
- continue;
- }
- if (!finalparts.Contains(p))
- {
- finalparts.Add(p);
- }
- }
- foreach (var p in downparts)
- {
- if (duplicateparts.Contains(p))
- {
- continue;
- }
- if (!finalparts.Contains(p))
- {
- finalparts.Add(p);
- }
- }
- foreach (var p in this.GetSideParticlesByOverlap(SORTING_DIRECTION.CENTER, overlap))
- {
- if (!finalparts.Contains(p))
- {
- finalparts.Add(p);
- }
- }
- this.SetListAnalysisParticles(finalparts);
- log.Info("removing duplicate particles result:" + finalparts.Count);
- }
- private List<COTSParticleClr> GetSideParticlesByOverlap(SORTING_DIRECTION direction, int overlap)
- {
- List<COTSParticleClr> sideparts = new List<COTSParticleClr>();
- var borderedparts = this.GetBorderedParticles();
- if (direction == SORTING_DIRECTION.LEFT)
- {
-
- foreach (var p in this.GetListAnalysisParticles())
- {
- int left = 0, top = 0, right = 0, bottom = 0;
- p.GetOTSRect(ref left, ref top, ref right, ref bottom);
- if (Math.Abs(right - this.GetOTSRect().GetTopLeft().X) < 2 * overlap)
- {
- if (!borderedparts.Contains(p) || Math.Abs(left - right) > 2 * overlap)//not on the border or it's a big particle
- {
- sideparts.Add(p);
- }
- }
- }
- }
- if (direction == SORTING_DIRECTION.RIGHT)
- {
-
- foreach (var p in this.GetListAnalysisParticles())
- {
- int left = 0, top = 0, right = 0, bottom = 0;
- p.GetOTSRect(ref left, ref top, ref right, ref bottom);
- if (Math.Abs(this.GetOTSRect().GetBottomRight().X - left) < 2 * overlap)
- {
- if (!borderedparts.Contains(p) || Math.Abs(left - right) > 2 * overlap)//not on the border or is a big part
- {
- sideparts.Add(p);
- }
- }
- }
- }
- if (direction == SORTING_DIRECTION.UP)
- {
-
- foreach (var p in this.GetListAnalysisParticles())
- {
- int left = 0, top = 0, right = 0, bottom = 0;
- p.GetOTSRect(ref left, ref top, ref right, ref bottom);
- if (Math.Abs(this.GetOTSRect().GetTopLeft().Y - bottom) < 2 * overlap)
- {
- if (!borderedparts.Contains(p) || Math.Abs(top - bottom) > 2 * overlap)//not on the border
- {
- sideparts.Add(p);
- }
- }
- }
- }
- if (direction == SORTING_DIRECTION.DOWN)
- {
-
- foreach (var p in this.GetListAnalysisParticles())
- {
- int left = 0, top = 0, right = 0, bottom = 0;
- p.GetOTSRect(ref left, ref top, ref right, ref bottom);
- if (Math.Abs(top - this.GetOTSRect().GetBottomRight().Y) < 2 * overlap)
- {
- if (!borderedparts.Contains(p) || Math.Abs(top - bottom) > 2 * overlap)//not on the border
- {
- sideparts.Add(p);
- }
- }
- }
- }
- if (direction == SORTING_DIRECTION.CENTER)
- {
- foreach (var p in this.GetListAnalysisParticles())
- {
- int left = 0, top = 0, right = 0, bottom = 0;
- p.GetOTSRect(ref left, ref top, ref right, ref bottom);
- var fldrec = this.GetOTSRect();
- int fldleft = (int)fldrec.GetTopLeft().X;
- int fldright = (int)fldrec.GetBottomRight().X;
- int fldtop = (int)fldrec.GetTopLeft().Y;
- int fldbottom = (int)fldrec.GetBottomRight().Y;
- if ((Math.Abs(top - fldtop) > 2 * overlap) && (Math.Abs(fldbottom - bottom) > 2 * overlap) && (Math.Abs(left - fldleft) > 2 * overlap) && (Math.Abs(fldright - right) > 2 * overlap))
- {
- sideparts.Add(p);
- }
- }
- }
- return sideparts;
- }
- public void GetPartsBySpecialGray(CIntRangeClr grayRange, CDoubleRangeClr diameterRange, double pixelSize, bool ifXray)
- {
- if (m_pBSEImg == null)
- return;
- CImageHandler imghandler = new CImageHandler();
- List<COTSParticleClr> specialParts = new List<COTSParticleClr>();
- imghandler.GetParticlesBySpecialGray(m_pBSEImg, grayRange, diameterRange, pixelSize, ref specialParts);
- foreach (var p in specialParts)
- {
- p.SetIsXrayParticle(ifXray);
- m_listAllParticles.Add(p);
- }
- return;
- }
- public bool CalParticleImageProp(List<COTSParticleClr> particles)
- {
- m_ImagePro = new CImageHandler();
- foreach (COTSParticleClr part in particles)
- {
- m_ImagePro.CalParticleImageProp(part, m_pixelSize);
- }
- return true;
- }
- public void InitParticles(COTSImageProcParam a_pImageProcessParam)
- {
- // get area range
- CDoubleRange oAreaRange = a_pImageProcessParam.GetIncAreaRange();
- double rMin = oAreaRange.GetStart() / 2.0;
- double rMax = oAreaRange.GetEnd() / 2.0;
- int nTagId = 0;
- foreach (COTSParticleClr pParticle in m_listAnalysisParticles)//m_listAllParticles memorize all the particles .
- {
- pParticle.SetParticleId(nTagId);//give all the conforming particles a unified sequence no.
- pParticle.SetFieldId(GetId());
- pParticle.SetType((int)otsdataconst.OTS_PARTICLE_TYPE.NO_ANALYSIS_X_RAY);
- pParticle.SetTypeName("Not Identified");
- pParticle.SetAnalysisId(nTagId); // the same as the tagId no use now.
- nTagId++;
- }
- log.Info("Total analysis Particles: (>" + rMin.ToString("f2") + "): " + "<" + rMax.ToString("f2") + "): " + m_listAnalysisParticles.Count);
- }
- public bool CreateXrayList(List<COTSParticleClr> a_listParticles)
- {
- foreach (COTSParticleClr pPart in a_listParticles)
- {
- System.Drawing.Point poi = (System.Drawing.Point)pPart.GetXRayPos();
- CPosXrayClr pPosXray = new CPosXrayClr();
- pPosXray.SetPosition(poi);
- pPosXray.SetPartTagId(pPart.GetParticleId());
- pPosXray.SetIndex(pPart.GetAnalysisId());
- pPosXray.SetScanFieldId(pPart.GetFieldId());
- pPart.SetXray(pPosXray);
- }
- return true;
- }
- public bool NoParticle()
- {
- if (m_listAllParticles.Count == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- public bool NoAnalysisParticle()
- {
- if (m_listAllParticles.Count == 0)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- public bool PositionEquals(COTSField a_oSource)
- {
- if (a_oSource.m_otsPos == this.m_otsPos)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- // ID
- public int GetId()
- {
- return m_nID;
- }
- public void SetId(int a_nID)
- {
- m_nID = a_nID;
- }
- // position (from field center manager)
- public System.Drawing.PointF GetOTSPosition()
- {
- return m_otsPos;
- }
- public void SetOTSPosition(System.Drawing.PointF a_poiPos)
- {
- m_otsPos = a_poiPos;
- }
- public List<COTSParticleClr> GetTopBorderedParticles()
- {
- List<COTSParticleClr> parts = new List<COTSParticleClr>();
- foreach (var p in m_listAnalysisParticles)
- {
- var segs = p.GetFeature().GetSegmentsList();//COTSSegment
- foreach (var seg in segs)
- {
- if (seg.GetHeight() == 0)
- {
- parts.Add(p);
- break;
- }
- }
- }
- return parts;
- }
- public List<COTSParticleClr> GetBottomBorderedParticles()
- {
- List<COTSParticleClr> parts = new List<COTSParticleClr>();
- foreach (var p in m_listAnalysisParticles)
- {
- var segs = p.GetFeature().GetSegmentsList();
- foreach (var seg in segs)
- {
- if (seg.GetHeight() == this.ImgHeight - 1)//the lowest height is 767(height-1),cause starting from 0.
- {
- parts.Add(p);
- break;
- }
- }
- }
- return parts;
- }
- public List<COTSParticleClr> GetBorderedParticles()
- {
- List<COTSParticleClr> parts = new List<COTSParticleClr>();
- var leftparts = this.GetLeftBorderedParticles();
- var rightp = this.GetRightBorderedParticles();
- var topp = this.GetTopBorderedParticles();
- var bottomp = this.GetBottomBorderedParticles();
- foreach (var p in leftparts)
- {
- if (!parts.Contains(p))
- {
- parts.Add(p);
- }
- }
- foreach (var p in rightp)//
- {
- if (!parts.Contains(p))
- {
- parts.Add(p);
- }
- }
- foreach (var p in topp)
- {
- if (!parts.Contains(p))//there may be some particles connect to both the left and top.
- {
- parts.Add(p);
- }
- }
- foreach (var p in bottomp)
- {
- if (!parts.Contains(p))
- {
- parts.Add(p);
- }
- }
- return parts;
- }
- public List<COTSParticleClr> GetLeftBorderedParticles()
- {
- List<COTSParticleClr> parts = new List<COTSParticleClr>();
- foreach (var p in m_listAnalysisParticles)
- {
- var segs = p.GetFeature().GetSegmentsList();
- foreach (var seg in segs)
- {
- if (seg.GetStart() == 0)
- {
- parts.Add(p);
- break;
- }
- }
- }
- return parts;
- }
- public List<COTSParticleClr> GetRightBorderedParticles()
- {
- List<COTSParticleClr> parts = new List<COTSParticleClr>();
- foreach (var p in m_listAnalysisParticles)
- {
- var segs = p.GetFeature().GetSegmentsList();
- foreach (var seg in segs)
- {
- if (seg.GetStart() + seg.GetLength() == this.ImgWidth)
- {
- parts.Add(p);
- break;
- }
- }
- }
- return parts;
- }
- // is empty
- public bool IsEmpty()
- {
- return m_listAllParticles.Count == 0;
- }
- void Duplicate(COTSField a_oSource)
- {
- m_nID = a_oSource.m_nID;
- m_otsPos = a_oSource.m_otsPos;
- // copy data over
- foreach (var pParticle in a_oSource.m_listAllParticles)
- {
- m_listAllParticles.Add(pParticle);
- }
- }
- public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
- {
- xPoint xPos = new xPoint();
- Slo slo = new Slo();
- slo.Register("OTSPosition", xPos);
- if (isStoring)
- {
- xPos.AssignValue(new System.Drawing.Point((int)m_otsPos.X, (int)m_otsPos.Y));
- slo.Serialize(true, classDoc, rootNode);
- }
- else
- {
- slo.Serialize(false, classDoc, rootNode);
- m_otsPos = xPos.value();
- }
- }
- }
- }
|