123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #include "stdafx.h"
- #include "OTSFeatureClr.h"
- #include "../OTSLog/COTSUtilityDllFunExport.h"
- namespace OTSCLRINTERFACE {
- COTSFeatureClr::COTSFeatureClr()
- {
- mFeature =new COTSFeaturePtr( new COTSFeature());
- }
- COTSFeatureClr::COTSFeatureClr(COTSFeatureClr^ pOTSFeature)
- {
- auto src = pOTSFeature->GetOTSFeaturePtr();
- mFeature = new COTSFeaturePtr(src.get());
- }
-
- COTSFeatureClr::COTSFeatureClr(COTSFeaturePtr pOTSFeature) // copy constructor
- {
-
- mFeature = new COTSFeaturePtr(pOTSFeature);
-
-
-
- }
- COTSFeatureClr::!COTSFeatureClr()
- {
- if (mFeature != nullptr)
- {
- delete mFeature;
- mFeature = NULL;
- }
- }
- COTSFeatureClr::~COTSFeatureClr()
- {
- if (mFeature != nullptr)
- {
- delete mFeature;
- mFeature = NULL;
- }
- }
-
- COTSFeaturePtr COTSFeatureClr::GetOTSFeaturePtr()
- {
- return *mFeature;
- }
-
- COTSSegmentListClr ^ COTSFeatureClr::GetSegmentsList()
- {
- auto fs = mFeature->get()->GetSegmentsList();
- COTSSegmentListClr ^ segList = gcnew COTSSegmentListClr();
- for each (auto s in fs)
- {
- segList->Add(gcnew COTSSegmentClr(s));
- }
- return segList;
- }
- void COTSFeatureClr::SetSegmentsList(COTSSegmentListClr^ a_plistSegment, bool a_bClear)
- {
- if (a_plistSegment == nullptr)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("SetSegmentsList::set invalid pointer."));
- return;
- }
- COTSSegmentsList flist;
-
-
- for(auto s = a_plistSegment->GetEnumerator();s.MoveNext ();)
- {
- flist.push_back(s.Current ->GetOTSSegmentPtr());
- }
-
- mFeature->get()->SetSegmentsList(flist, a_bClear);
-
- }
- COTSSegmentClr^ COTSFeatureClr::GetSegmentByIndex(int a_nIndex)
- {
-
- COTSFeaturePtr pFeature = GetOTSFeaturePtr();
-
- ASSERT(pFeature);
- if (pFeature)
- {
- LogErrorTrace(__FILE__, __LINE__, _T("GetSegmentByIndex: can't get feature pointer."));
- return nullptr;
- }
- COTSSegmentPtr pSegment = pFeature->GetSegmentByIndex(a_nIndex);
- COTSSegmentClr^ pSegmentClr = gcnew COTSSegmentClr(pSegment);
- return pSegmentClr;
- }
-
- }
|