|
|
@@ -752,104 +752,106 @@ namespace OTSModelSharp
|
|
|
m_smallParticlePercentage = percentageOfWhole;
|
|
|
}
|
|
|
|
|
|
- public bool GetFeatureList1(List<COTSSegment> a_listSegments, List<COTSFeature> a_listFeatures)
|
|
|
- {
|
|
|
- List<COTSSegment> listSegmentNew = new List<COTSSegment>();
|
|
|
- Dictionary<List<long>, List<COTSSegment>> mapOneLineSegments;
|
|
|
- foreach(var s in a_listSegments)
|
|
|
- {
|
|
|
- mapOneLineSegments[s.GetHeight()].Add(s);//sorting all the segments base on the line number.
|
|
|
- }
|
|
|
- Dictionary<List<long>, List<COTSSegment>> lineItr = mapOneLineSegments.;//find the highest line
|
|
|
- while (lineItr != mapOneLineSegments.)
|
|
|
- {
|
|
|
- for (var s = lineItr.second.begin(); s < lineItr.second.end();)//find one segment of this line.
|
|
|
- {
|
|
|
- COTSSegment bottomSeg = *s;
|
|
|
- listSegmentNew.Clear();
|
|
|
- listSegmentNew.Add(s);
|
|
|
- s = lineItr.second.erase(s);
|
|
|
- Dictionary<List<long>, List<COTSSegment>> tempItr = lineItr;
|
|
|
- tempItr++;
|
|
|
- for (; tempItr != mapOneLineSegments.end(); tempItr++)//find all other lines of segments
|
|
|
- {
|
|
|
- if (tempItr.first - bottomSeg.GetHeight() > 1)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
+ //public bool GetFeatureList1(List<COTSSegment> a_listSegments, List<COTSFeature> a_listFeatures)
|
|
|
+ //{
|
|
|
+ // List<COTSSegment> listSegmentNew = new List<COTSSegment>();
|
|
|
+ // Dictionary<long, List<COTSSegment>> mapOneLineSegments = new Dictionary<long, List<COTSSegment>>();
|
|
|
+ // foreach(var s in a_listSegments)
|
|
|
+ // {
|
|
|
+ // mapOneLineSegments[s.GetHeight()].Add(s);//sorting all the segments base on the line number.
|
|
|
+ // }
|
|
|
+ // var first = mapOneLineSegments.First();
|
|
|
+ // KeyValuePair<long, List<COTSSegment>> lineItr = first.Value;
|
|
|
+ // mapOneLineSegments.Keys();//find the highest line
|
|
|
+ // while (lineItr != mapOneLineSegments.Last())
|
|
|
+ // {
|
|
|
+ // for (var s = lineItr.Values.First; s < lineItr.second.end();)//find one segment of this line.
|
|
|
+ // {
|
|
|
+ // COTSSegment bottomSeg = *s;
|
|
|
+ // listSegmentNew.Clear();
|
|
|
+ // listSegmentNew.Add(s);
|
|
|
+ // s = lineItr.second.erase(s);
|
|
|
+ // Dictionary<List<long>, List<COTSSegment>> tempItr = lineItr;
|
|
|
+ // tempItr++;
|
|
|
+ // for (; tempItr != mapOneLineSegments.end(); tempItr++)//find all other lines of segments
|
|
|
+ // {
|
|
|
+ // if (tempItr.first - bottomSeg.GetHeight() > 1)
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
|
|
|
- for (var nextLineSegment = tempItr.second.begin(); nextLineSegment < tempItr.second.end();)//find next line's all segments
|
|
|
- {
|
|
|
- if (((*nextLineSegment)->GetStart() - (bottomSeg.GetStart() + bottomSeg.GetLength())) > 1)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (bottomSeg.UpDownConection(**nextLineSegment))
|
|
|
- {
|
|
|
- listSegmentNew.Add(*nextLineSegment);
|
|
|
- bottomSeg = *nextLineSegment;
|
|
|
- nextLineSegment = tempItr.second.erase(nextLineSegment);
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- if (tempItr.second.size() > 0)
|
|
|
- {
|
|
|
- nextLineSegment++;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ // for (var nextLineSegment = tempItr.second.begin(); nextLineSegment < tempItr.second.end();)//find next line's all segments
|
|
|
+ // {
|
|
|
+ // if (((*nextLineSegment)->GetStart() - (bottomSeg.GetStart() + bottomSeg.GetLength())) > 1)
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
|
|
|
- }
|
|
|
- COTSFeature pFeature = new COTSFeature();
|
|
|
- pFeature.SetSegmentsList(listSegmentNew);
|
|
|
- //check if this new feature is connected with other found feature.
|
|
|
- COTSSegment topSeg = listSegmentNew[0];//find the toppest segment of this new feature.
|
|
|
- COTSSegment bottomSegment = listSegmentNew[listSegmentNew.Count - 1];//find the lowest segment of this new feature.
|
|
|
-
|
|
|
- bool haveMerged = false;
|
|
|
- foreach(var f in a_listFeatures)
|
|
|
+ // if (bottomSeg.UpDownConection(**nextLineSegment))
|
|
|
+ // {
|
|
|
+ // listSegmentNew.Add(*nextLineSegment);
|
|
|
+ // bottomSeg = *nextLineSegment;
|
|
|
+ // nextLineSegment = tempItr.second.erase(nextLineSegment);
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (tempItr.second.size() > 0)
|
|
|
+ // {
|
|
|
+ // nextLineSegment++;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ // COTSFeature pFeature = new COTSFeature();
|
|
|
+ // pFeature.SetSegmentsList(listSegmentNew);
|
|
|
+ // //check if this new feature is connected with other found feature.
|
|
|
+ // COTSSegment topSeg = listSegmentNew[0];//find the toppest segment of this new feature.
|
|
|
+ // COTSSegment bottomSegment = listSegmentNew[listSegmentNew.Count - 1];//find the lowest segment of this new feature.
|
|
|
+
|
|
|
+ // bool haveMerged = false;
|
|
|
+ // foreach(var f in a_listFeatures)
|
|
|
|
|
|
- {
|
|
|
- foreach (var seg in f.GetSegmentsList())
|
|
|
- {
|
|
|
- if (bottomSegment.UpDownConection(seg) || topSeg.UpDownConection(seg))
|
|
|
- {
|
|
|
- List<COTSSegment> segs = f.GetSegmentsList();
|
|
|
- foreach (var s in listSegmentNew)
|
|
|
- {
|
|
|
- segs.Add(s);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- f.SetSegmentsList(segs);
|
|
|
- haveMerged = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (haveMerged)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
+ // {
|
|
|
+ // foreach (var seg in f.GetSegmentsList())
|
|
|
+ // {
|
|
|
+ // if (bottomSegment.UpDownConection(seg) || topSeg.UpDownConection(seg))
|
|
|
+ // {
|
|
|
+ // List<COTSSegment> segs = f.GetSegmentsList();
|
|
|
+ // foreach (var s in listSegmentNew)
|
|
|
+ // {
|
|
|
+ // segs.Add(s);
|
|
|
|
|
|
- }
|
|
|
- if (!haveMerged)
|
|
|
- {
|
|
|
- a_listFeatures.Add(pFeature);
|
|
|
- }
|
|
|
+ // }
|
|
|
|
|
|
- if (lineItr.second.size() == 0)
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- lineItr++;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
+ // f.SetSegmentsList(segs);
|
|
|
+ // haveMerged = true;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (haveMerged)
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ // if (!haveMerged)
|
|
|
+ // {
|
|
|
+ // a_listFeatures.Add(pFeature);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (lineItr.second.size() == 0)
|
|
|
+ // {
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // lineItr++;
|
|
|
+ // }
|
|
|
+ // return true;
|
|
|
+ //}
|
|
|
|
|
|
public bool GetIncAParticleList(List<COTSParticle> a_listParticleOut)
|
|
|
{
|