-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Raw data Object to handle diiferent types of samples
- Loading branch information
salamb
committed
Jan 15, 2016
1 parent
ec6b784
commit 928725b
Showing
10 changed files
with
217 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include"stdafx.h" | ||
|
||
bool RawData::changeSourceTxt(String^ file) { | ||
if (file != nullptr) { | ||
|
||
sourceFile = file; | ||
} | ||
try { | ||
read = gcnew StreamReader(file); | ||
} | ||
catch (Exception ^e) { | ||
Console::WriteLine(e); | ||
return false; | ||
} | ||
type = TXTFILE->Clone; | ||
|
||
} | ||
bool RawData::parse() { | ||
coor->Clear(); | ||
if (type == TXTFILE) { | ||
return parseTxt(); | ||
} | ||
} | ||
|
||
|
||
bool RawData::parseTxt() { | ||
String ^data = nullptr; | ||
array<String^>^ values; | ||
array<double>^ coorWithTimeDiff; | ||
while (!read->EndOfStream) { | ||
data = read->ReadLine(); | ||
if (!data->Contains("#") && data->Contains("UNAVAILABLE")) { | ||
values = data->Split(); | ||
coorWithTimeDiff = gcnew array<double>(4); | ||
coorWithTimeDiff[0]= Convert::ToDouble(values[0]); | ||
coorWithTimeDiff[1] = Convert::ToDouble(values[1]); | ||
coorWithTimeDiff[2] = Convert::ToDouble(values[2]); | ||
coor->Add(coorWithTimeDiff); | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
} | ||
|
||
__int64 RawData::getSize() { | ||
return coor->Count; | ||
|
||
} | ||
array<double>^ RawData::getCoor(__int64 i) { | ||
|
||
if (i < getSize()) { return coor[i]; } | ||
else { | ||
|
||
return nullptr; | ||
} | ||
} | ||
|
||
double RawData::actualFeedRate(__int64 i, __int64 j) { | ||
array<double>^ coor1 = getCoor(i); | ||
array<double>^ coor2 = getCoor(j); | ||
|
||
double dx = coor1[0] - coor2[0]; | ||
double dy = coor1[1] - coor2[1]; | ||
double dz = coor1[2] - coor2[2]; | ||
|
||
double dist = Math::Sqrt(Math::Pow(dx, 2) + Math::Pow(dy, 2) + Math::Pow(dz, 2)) / coor2[3]; | ||
|
||
//Console::WriteLine("dx {0} dy{1} dz {2} deltat {3} speed{4}",dx,dy,dz,coor2[3],dist); | ||
|
||
return dist; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
using namespace System; | ||
using namespace System; | ||
using namespace System::Net; | ||
|
||
using namespace System::Collections::Generic; | ||
using namespace System::IO; | ||
using namespace System::Text; | ||
using namespace System::Xml; | ||
using namespace System::Collections::Generic; | ||
ref class RawData { | ||
private: | ||
const String^ TXTFILE = "TXT"; | ||
String^ sourceFile; | ||
StreamReader ^read ; | ||
String^type; | ||
List<array<double>^>^ coor; | ||
public: | ||
|
||
bool changeSourceTxt(String^ file); | ||
//bool changeSourceXml(String^file); | ||
//bool changeSourceMTConnect(String^ request); | ||
|
||
bool parse(); | ||
RawData() { read = nullptr; | ||
sourceFile = nullptr; | ||
} | ||
__int64 getSize(); | ||
bool RawData::parseTxt(); | ||
|
||
array<double>^getCoor(__int64 i); | ||
|
||
double actualFeedRate(__int64, __int64); | ||
|
||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,5 @@ using namespace STEPNCLib; | |
#include"MtConnector.h" | ||
#include"Patcher.h" | ||
#include"ToolPath.h" | ||
|
||
#include"RawData.h" | ||
|