25CPatternDraft::CPatternDraft()
47 Row.erase(remove(Row.begin(), Row.end(),
'\n'), Row.end() );
48 Row.erase(remove(Row.begin(), Row.end(),
'\r'), Row.end() );
70 TGERROR(
"Can't create pattern draft: no weave pattern specified");
76 TGERROR(
"Failed to create heddle draft");
81 TGERROR(
"Failed to create chain draft: no heddle draft specified");
90 vector<string>::iterator itWeavePattern;
98 for (
int i = 0; i < Warps; ++i )
100 if ( (*itWeavePattern)[i] ==
'2' )
103 m_Columns[i].push_back( (*itWeavePattern)[i] );
108 vector<string>::iterator itColumns;
112 vector<string>::iterator itFind;
127 vector<string>::iterator itColumns;
134 vector<string>::iterator itFind;
145 vector<string>::iterator itWeavePattern;
155 for (
int i = 0; i < NumWarps; ++i )
157 if ( (*itWeavePattern)[i] ==
'1' )
167 ofstream
Output(Filename.c_str());
169 vector<string> HeddleDraft;
178 HeddleDraft[j].push_back(
'1');
180 HeddleDraft[j].push_back(
'0');
188 HeddleDraft[i].push_back(
'\t');
192 HeddleDraft[i].push_back(
'1');
194 HeddleDraft[i].push_back(
'0');
198 vector<string>::reverse_iterator itHeddleDraft;
199 for ( itHeddleDraft = HeddleDraft.rbegin(); itHeddleDraft != HeddleDraft.rend(); ++itHeddleDraft )
201 Output << itHeddleDraft->c_str() <<
"\n";
206 vector< string >::iterator itWeavePattern;
207 vector<string> ChainDraft;
211 ChainDraft.push_back(*itWeavePattern);
215 vector<bool>::iterator itChainDraft;
222 ChainRow.push_back( *itChainDraft ?
'1':
'0' );
226 ChainDraft[j].push_back(
'\t');
227 ChainDraft[j].append(ChainRow);
228 Output << ChainDraft[j].c_str() <<
"\n";
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
vector< string > m_Columns
void AddRow(string Row)
Add a row representing one weft insertion '1' indicates warp up, '0' warp down and '2' no yarn.
void Output(string Filename)
Output the complete pattern draft in a text file.
vector< bool > m_ChainDraft
bool CreatePatternDraft()
Calculates the pattern draft based on the weave pattern.
virtual ~CPatternDraft(void)
vector< string > m_UniqueColumns
vector< int > m_HeddleDraft
vector< string > m_WeavePattern
void CreateColumnsVector()
Creates vector of strings where each string represents one unique column of the weave pattern.
bool CreateHeddleDraft()
Create heddle draft. Stored as vector of int.
Namespace containing a series of customised math operations not found in the standard c++ library.
void AddExtensionIfMissing(std::string &Filename, std::string Extension)
Adds an extension to the filename if it is missing otherwise do nothing (e.g. picture -> picture....