81
105
void DrawCross(long x, long y);
82
106
void SetFont(int fontcode);
83
107
void SetColour(int colourcode);
84
void WriteString(const char *s);
108
void WriteString(const wxString & s);
85
109
void DrawEllipse(long x, long y, long r, long R);
86
110
void SolidRectangle(long x, long y, long w, long h);
87
111
int Charset(void);
89
113
void NewPage(int pg, int pagesX, int pagesY);
90
114
void ShowPage(const char *szPageDetails);
115
void PlotLR(const vector<XSect> & centreline);
116
void PlotUD(const vector<XSect> & centreline);
91
117
char * Init(FILE **fh_list, bool fCalibrate);
93
119
svxPrintout(MainFrm *mainfrm, layout *l, wxPageSetupDialogData *data, const wxString & title);
132
163
svxPrintDlg::svxPrintDlg(MainFrm* mainfrm_, const wxString & filename,
133
164
const wxString & title, const wxString & datestamp,
134
165
double angle, double tilt_angle,
135
bool labels, bool crosses, bool legs, bool surf)
136
: wxDialog(mainfrm_, -1, wxString(msg(/*Print*/399))),
166
bool labels, bool crosses, bool legs, bool surf,
168
: wxDialog(mainfrm_, -1, wxString(printing ? wmsg(/*Print*/399) : wmsg(/*Export*/383))),
137
169
m_layout(wxGetApp().GetPageSetupDialogData()),
138
170
m_File(filename), mainfrm(mainfrm_)
140
183
m_layout.Labels = labels;
141
184
m_layout.Crosses = crosses;
142
185
m_layout.Shots = legs;
143
186
m_layout.Surface = surf;
144
m_layout.datestamp = osstrdup(datestamp.c_str());
187
m_layout.datestamp = datestamp;
145
188
m_layout.rot = int(angle + .001);
146
if (title.length() > 11 &&
147
title.substr(title.length() - 11) == " (extended)") {
148
m_layout.title = osstrdup(title.substr(0, title.length() - 11).c_str());
189
m_layout.title = title;
190
if (mainfrm->IsExtendedElevation()) {
149
191
m_layout.view = layout::EXTELEV;
150
192
if (m_layout.rot != 0 && m_layout.rot != 180) m_layout.rot = 0;
151
193
m_layout.tilt = 0;
167
208
/* setup our print dialog*/
168
209
wxBoxSizer* v1 = new wxBoxSizer(wxVERTICAL);
169
210
wxBoxSizer* h1 = new wxBoxSizer(wxHORIZONTAL); // holds controls
170
wxBoxSizer* v2 = new wxStaticBoxSizer(new wxStaticBox(this, -1, msg(/*View*/255)), wxVERTICAL);
171
wxBoxSizer* v3 = new wxStaticBoxSizer(new wxStaticBox(this, -1, msg(/*Elements*/256)), wxVERTICAL);
211
wxBoxSizer* v2 = new wxStaticBoxSizer(new wxStaticBox(this, -1, wmsg(/*View*/255)), wxVERTICAL);
212
wxBoxSizer* v3 = new wxStaticBoxSizer(new wxStaticBox(this, -1, wmsg(/*Elements*/256)), wxVERTICAL);
172
213
wxBoxSizer* h2 = new wxBoxSizer(wxHORIZONTAL); // holds buttons
174
{ // this isn't the "too wide" bit...
176
label = new wxStaticText(this, -1, wxString(msg(/*Scale*/154)) + " 1:");
177
if (scales[0].empty()) scales[0].assign(msg(/*One page*/258));
178
m_scale = new wxComboBox(this, svx_SCALE, scales[0], wxDefaultPosition,
179
wxDefaultSize, sizeof(scales) / sizeof(scales[0]),
181
wxBoxSizer* scalebox = new wxBoxSizer(wxHORIZONTAL);
182
scalebox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
183
scalebox->Add(m_scale, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
185
v2->Add(scalebox, 0, wxALIGN_LEFT|wxALL, 0);
217
label = new wxStaticText(this, -1, wxString(wmsg(/*Scale*/154)) + wxT(" 1:"));
218
if (scales[0].empty()) scales[0].assign(wmsg(/*One page*/258));
219
m_scale = new wxComboBox(this, svx_SCALE, scales[0], wxDefaultPosition,
220
wxDefaultSize, sizeof(scales) / sizeof(scales[0]),
222
wxBoxSizer* scalebox = new wxBoxSizer(wxHORIZONTAL);
223
scalebox->Add(label, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
224
scalebox->Add(m_scale, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
226
v2->Add(scalebox, 0, wxALIGN_LEFT|wxALL, 0);
228
// Make the dummy string wider than any sane value and use that to
229
// fix the width of the control so the sizers allow space for bigger
231
m_printSize = new wxStaticText(this, -1, wxString::Format(wmsg(/*%d pages (%dx%d)*/257), 9604, 98, 98));
232
v2->Add(m_printSize, 0, wxALIGN_LEFT|wxALL, 5);
188
// Make the dummy string wider than any sane value and use that to
189
// fix the width of the control so the sizers allow space for bigger
191
m_printSize = new wxStaticText(this, -1, wxString::Format(msg(/*%d pages (%dx%d)*/257), 9604, 98, 98));
192
v2->Add(m_printSize, 0, wxALIGN_LEFT|wxALL, 5);
194
235
if (m_layout.view != layout::EXTELEV) {
195
236
wxFlexGridSizer* anglebox = new wxFlexGridSizer(2);
196
237
wxStaticText * brg_label, * tilt_label;
197
brg_label = new wxStaticText(this, -1, msg(/*Bearing*/259));
238
brg_label = new wxStaticText(this, -1, wmsg(/*Bearing*/259));
198
239
anglebox->Add(brg_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5);
199
240
m_bearing = new wxSpinCtrl(this, svx_BEARING);
200
241
m_bearing->SetRange(0, 359);
201
242
anglebox->Add(m_bearing, 0, wxALIGN_CENTER|wxALL, 5);
202
tilt_label = new wxStaticText(this, -1, msg(/*Tilt angle*/263));
243
tilt_label = new wxStaticText(this, -1, wmsg(/*Tilt angle*/263));
203
244
anglebox->Add(tilt_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5);
204
m_tilt = new wxSpinCtrl(this,svx_TILT);
245
m_tilt = new wxSpinCtrl(this, svx_TILT);
205
246
m_tilt->SetRange(-90, 90);
206
247
anglebox->Add(m_tilt, 0, wxALIGN_CENTER|wxALL, 5);
208
249
v2->Add(anglebox, 0, wxALIGN_LEFT|wxALL, 0);
210
251
wxBoxSizer * planelevsizer = new wxBoxSizer(wxHORIZONTAL);
211
planelevsizer->Add(new wxButton(this, svx_PLAN, "Plan"),
252
planelevsizer->Add(new wxButton(this, svx_PLAN, wmsg(/*Plan*/117)),
212
253
0, wxALIGN_CENTRE_VERTICAL|wxALL, 5);
213
planelevsizer->Add(new wxButton(this, svx_ELEV, "Elevation"),
254
planelevsizer->Add(new wxButton(this, svx_ELEV, wmsg(/*Elevation*/118)),
214
255
0, wxALIGN_CENTRE_VERTICAL|wxALL, 5);
216
257
v2->Add(planelevsizer, 0, wxALIGN_LEFT|wxALL, 5);
219
260
h1->Add(v2, 0, wxALIGN_LEFT|wxALL, 5);
221
m_legs = new wxCheckBox(this, svx_LEGS, msg(/*Underground Survey Legs*/262));
262
m_legs = new wxCheckBox(this, svx_LEGS, wmsg(/*Underground Survey Legs*/262));
222
263
v3->Add(m_legs, 0, wxALIGN_LEFT|wxALL, 2);
223
m_surface = new wxCheckBox(this, svx_SCALEBAR, msg(/*Sur&face Survey Legs*/403));
264
m_surface = new wxCheckBox(this, svx_SURFACE, wmsg(/*Sur&face Survey Legs*/403));
224
265
v3->Add(m_surface, 0, wxALIGN_LEFT|wxALL, 2);
225
m_stations = new wxCheckBox(this, svx_STATIONS, msg(/*Crosses*/261));
266
m_stations = new wxCheckBox(this, svx_STATIONS, wmsg(/*Crosses*/261));
226
267
v3->Add(m_stations, 0, wxALIGN_LEFT|wxALL, 2);
227
m_names = new wxCheckBox(this, svx_NAMES, msg(/*Station Names*/260));
268
m_names = new wxCheckBox(this, svx_NAMES, wmsg(/*Station Names*/260));
228
269
v3->Add(m_names, 0, wxALIGN_LEFT|wxALL, 2);
229
m_borders = new wxCheckBox(this, svx_BORDERS, msg(/*Page Borders*/264));
230
v3->Add(m_borders, 0, wxALIGN_LEFT|wxALL, 2);
231
// m_blanks = new wxCheckBox(this, svx_BLANKS, msg(/*Blank Pages*/266));
232
// v3->Add(m_blanks, 0, wxALIGN_LEFT|wxALL, 2);
233
m_infoBox = new wxCheckBox(this, svx_INFOBOX, msg(/*Info Box*/265));
234
v3->Add(m_infoBox, 0, wxALIGN_LEFT|wxALL, 2);
271
m_borders = new wxCheckBox(this, svx_BORDERS, wmsg(/*Page Borders*/264));
272
v3->Add(m_borders, 0, wxALIGN_LEFT|wxALL, 2);
273
// m_blanks = new wxCheckBox(this, svx_BLANKS, wmsg(/*Blank Pages*/266));
274
// v3->Add(m_blanks, 0, wxALIGN_LEFT|wxALL, 2);
275
m_infoBox = new wxCheckBox(this, svx_INFOBOX, wmsg(/*Info Box*/265));
276
v3->Add(m_infoBox, 0, wxALIGN_LEFT|wxALL, 2);
236
279
h1->Add(v3, 0, wxALIGN_LEFT|wxALL, 5);
238
281
v1->Add(h1, 0, wxALIGN_LEFT|wxALL, 5);
241
but = new wxButton(this, wxID_CANCEL, msg(/*&Cancel*/402));
242
h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
243
but = new wxButton(this, svx_PREVIEW, msg(/*Pre&view*/401));
244
h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
245
but = new wxButton(this, svx_PRINT, msg(/*&Print*/400));
284
but = new wxButton(this, wxID_CANCEL, wmsg(/*&Cancel*/402));
285
h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
288
but = new wxButton(this, svx_PREVIEW, wmsg(/*Pre&view*/401));
289
h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
290
but = new wxButton(this, svx_PRINT, wmsg(/*&Print*/400));
292
but = new wxButton(this, svx_PRINT, wmsg(/*&Print*/400) + wxT("..."));
295
but = new wxButton(this, svx_EXPORT, wmsg(/*&Export...*/230));
246
297
but->SetDefault();
247
298
h2->Add(but, 0, wxALIGN_RIGHT|wxALL, 5);
248
299
v1->Add(h2, 0, wxALIGN_RIGHT|wxALL, 5);
324
svxPrintDlg::OnExport(wxCommandEvent&) {
327
wxFileName::SplitPath(m_File, NULL, NULL, &baseleaf, NULL, wxPATH_NATIVE);
328
wxFileDialog dlg(this, wxT("Export as:"), wxString(), baseleaf,
329
wxT("DXF files|*.dxf|SVG files|*.svg|Sketch files|*.sk|EPS files|*.eps|Compass PLT for use with Carto|*.plt|HPGL for plotters|*.hpgl"),
330
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
331
if (dlg.ShowModal() == wxID_OK) {
332
if (!Export(dlg.GetPath(), m_layout.title, mainfrm,
333
m_layout.rot, m_layout.tilt,
334
m_layout.Labels, m_layout.Crosses,
335
m_layout.Shots, m_layout.Surface)) {
336
wxGetApp().ReportError(wxString::Format(wxT("Couldn't write file `%s'"), m_File.c_str()));
278
343
svxPrintDlg::OnPreview(wxCommandEvent&) {
279
344
SomethingChanged();
280
345
wxPageSetupDialogData * psdd = wxGetApp().GetPageSetupDialogData();
417
487
m_layout.yMax = m_layout.xMax = -DBL_MAX;
418
488
m_layout.yMin = m_layout.xMin = DBL_MAX;
420
double SIN,COS,SINT,COST;
421
SIN = sin(rad(m_layout.rot));
422
COS = cos(rad(m_layout.rot));
423
SINT = sin(rad(m_layout.tilt));
424
COST = cos(rad(m_layout.tilt));
490
double SIN = sin(rad(m_layout.rot));
491
double COS = cos(rad(m_layout.rot));
492
double SINT = sin(rad(m_layout.tilt));
493
double COST = cos(rad(m_layout.tilt));
426
if (m_layout.Surface || m_layout.Shots) {
427
for (int i=0; i < NUM_DEPTH_COLOURS; ++i) {
428
list<PointInfo*>::const_iterator p = mainfrm->GetPoints(i);
429
while (p != mainfrm->GetPointsEnd(i)) {
430
double x = (*p)->GetX();
431
double y = (*p)->GetY();
432
double z = (*p)->GetZ();
433
if ((*p)->IsSurface() ? m_layout.Surface : m_layout.Shots) {
434
double X = x * COS - y * SIN;
435
if (X > m_layout.xMax) m_layout.xMax = X;
436
if (X < m_layout.xMin) m_layout.xMin = X;
437
double Y = (x * SIN + y * COS) * SINT + z * COST;
438
if (Y > m_layout.yMax) m_layout.yMax = Y;
439
if (Y < m_layout.yMin) m_layout.yMin = Y;
495
if (m_layout.Shots) {
496
list<traverse>::const_iterator trav = mainfrm->traverses_begin();
497
list<traverse>::const_iterator tend = mainfrm->traverses_end();
498
for ( ; trav != tend; ++trav) {
499
vector<PointInfo>::const_iterator pos = trav->begin();
500
vector<PointInfo>::const_iterator end = trav->end();
501
for ( ; pos != end; ++pos) {
502
double x = pos->GetX();
503
double y = pos->GetY();
504
double z = pos->GetZ();
505
double X = x * COS - y * SIN;
506
if (X > m_layout.xMax) m_layout.xMax = X;
507
if (X < m_layout.xMin) m_layout.xMin = X;
508
double Y = (x * SIN + y * COS) * SINT + z * COST;
509
if (Y > m_layout.yMax) m_layout.yMax = Y;
510
if (Y < m_layout.yMin) m_layout.yMin = Y;
514
if (m_layout.Surface) {
515
list<traverse>::const_iterator trav = mainfrm->surface_traverses_begin();
516
list<traverse>::const_iterator tend = mainfrm->surface_traverses_end();
517
for ( ; trav != tend; ++trav) {
518
vector<PointInfo>::const_iterator pos = trav->begin();
519
vector<PointInfo>::const_iterator end = trav->end();
520
for ( ; pos != end; ++pos) {
521
double x = pos->GetX();
522
double y = pos->GetY();
523
double z = pos->GetZ();
524
double X = x * COS - y * SIN;
525
if (X > m_layout.xMax) m_layout.xMax = X;
526
if (X < m_layout.xMin) m_layout.xMin = X;
527
double Y = (x * SIN + y * COS) * SINT + z * COST;
528
if (Y > m_layout.yMax) m_layout.yMax = Y;
529
if (Y < m_layout.yMin) m_layout.yMin = Y;
558
644
SetColour(PR_COLOUR_TEXT);
560
WriteString(msg(/*Elevation on*/116));
562
sprintf(szTmp, "%03d"DEG, (l->rot + 270) % 360);
563
MOVEMM(65, 20); WriteString(szTmp);
564
sprintf(szTmp, "%03d"DEG, (l->rot + 90) % 360);
565
MOVEMM(85, 20); WriteString(szTmp);
646
WriteString(wmsg(/*Elevation on*/116));
649
WriteString(wxString::Format(wxT("%03d"DEG),
650
(l->rot + 270) % 360 ));
652
WriteString(wxString::Format(wxT("%03d"DEG),
653
(l->rot + 90) % 360 ));
568
WriteString(msg(/*Elevation*/118));
655
WriteString(wmsg(/*Elevation*/118));
570
657
case layout::EXTELEV:
571
658
SetColour(PR_COLOUR_TEXT);
573
WriteString(msg(/*Extended elevation*/191));
660
WriteString(wmsg(/*Extended elevation*/191));
577
664
MOVEMM(5, boxheight - 7); WriteString(l->title);
579
strcpy(szTmp, msg(/*Scale*/154));
580
p = szTmp + strlen(szTmp);
581
sprintf(p, " 1:%.0f", l->Scale);
582
MOVEMM(5, boxheight - 27); WriteString(szTmp);
666
MOVEMM(5, boxheight - 27);
667
WriteString(wxString::Format(wmsg(/*Scale*/154) + wxT(" 1:%.0f"),
584
670
if (l->view != layout::EXTELEV) {
586
msg(l->view == layout::PLAN ? /*Up page*/168 : /*View*/169));
587
p = szTmp + strlen(szTmp);
588
sprintf(p, " %03d"DEG, l->rot);
589
MOVEMM(5, 3); WriteString(szTmp);
672
s = wmsg(l->view == layout::PLAN ? /*Up page*/168 : /*View*/169);
673
s.Append(wxString::Format(wxT(" %03d"DEG), l->rot));
674
MOVEMM(5, 3); WriteString(s);
592
677
/* This used to be a copyright line, but it was occasionally
593
678
* mis-interpreted as us claiming copyright on the survey, so let's
594
679
* give the website URL instead */
595
680
MOVEMM(boxwidth + 2, 2);
596
WriteString("Survex "VERSION" - http://www.survex.com/");
681
WriteString(wxT("Survex "VERSION" - http://www.survex.com/"));
598
683
draw_scale_bar(boxwidth + 10.0, 17.0, l->PaperWidth - boxwidth - 18.0);
932
1007
const double Sc = 1000 / l->Scale;
934
if (l->Surface || l->Shots) {
935
for (int i=0; i < mainfrm->GetNumDepthBands(); ++i) {
936
list<PointInfo*>::const_iterator p = mainfrm->GetPoints(i);
937
while (p != mainfrm->GetPointsEnd(i)) {
938
double px = (*p)->GetX();
939
double py = (*p)->GetY();
940
double pz = (*p)->GetZ();
941
double X = px * COS - py * SIN;
942
double Y = (px * SIN + py * COS) * SINT + pz * COST;
943
long xnew = (long)((X * Sc + l->xOrg) * l->scX);
944
long ynew = (long)((Y * Sc + l->yOrg) * l->scY);
946
if ((*p)->IsLine()) {
947
bool draw = ((*p)->IsSurface() ? l->Surface : l->Shots);
949
SetColour((*p)->IsSurface() ?
950
PR_COLOUR_SURFACE_LEG : PR_COLOUR_LEG);
953
if ((*p)->IsSurface() != last_leg_surface)
956
/* avoid drawing superfluous lines */
957
if (pending_move || xnew != x || ynew != y) {
959
if (pending_move) MoveTo(x, y);
960
pending_move = false;
965
last_leg_surface = (*p)->IsSurface();
970
/* avoid superfluous moves */
971
if (xnew != x || ynew != y) {
1010
SetColour(PR_COLOUR_LEG);
1011
list<traverse>::const_iterator trav = mainfrm->traverses_begin();
1012
list<traverse>::const_iterator tend = mainfrm->traverses_end();
1013
for ( ; trav != tend; ++trav) {
1014
vector<PointInfo>::const_iterator pos = trav->begin();
1015
vector<PointInfo>::const_iterator end = trav->end();
1016
for ( ; pos != end; ++pos) {
1017
double x = pos->GetX();
1018
double y = pos->GetY();
1019
double z = pos->GetZ();
1020
double X = x * COS - y * SIN;
1021
double Y = (x * SIN + y * COS) * SINT + z * COST;
1022
long px = (long)((X * Sc + l->xOrg) * l->scX);
1023
long py = (long)((Y * Sc + l->yOrg) * l->scY);
1024
if (pos == trav->begin()) {
1033
if (l->Shots && (l->tilt == 0.0 || l->tilt == 90.0 || l->tilt == -90.0)) {
1034
list<vector<XSect> >::const_iterator trav = mainfrm->tubes_begin();
1035
list<vector<XSect> >::const_iterator tend = mainfrm->tubes_end();
1036
for ( ; trav != tend; ++trav) {
1037
if (l->tilt == 90.0 || l->tilt == -90.0) PlotLR(*trav);
1038
if (l->tilt == 0.0) PlotUD(*trav);
1043
SetColour(PR_COLOUR_SURFACE_LEG);
1044
list<traverse>::const_iterator trav = mainfrm->surface_traverses_begin();
1045
list<traverse>::const_iterator tend = mainfrm->surface_traverses_end();
1046
for ( ; trav != tend; ++trav) {
1047
vector<PointInfo>::const_iterator pos = trav->begin();
1048
vector<PointInfo>::const_iterator end = trav->end();
1049
for ( ; pos != end; ++pos) {
1050
double x = pos->GetX();
1051
double y = pos->GetY();
1052
double z = pos->GetZ();
1053
double X = x * COS - y * SIN;
1054
double Y = (x * SIN + y * COS) * SINT + z * COST;
1055
long px = (long)((X * Sc + l->xOrg) * l->scX);
1056
long py = (long)((Y * Sc + l->yOrg) * l->scY);
1057
if (pos == trav->begin()) {
1303
1387
svxPrintout::Pre()
1305
font_labels = new wxFont(fontsize_labels,wxDEFAULT,wxNORMAL,wxNORMAL,false,fontname_labels,wxFONTENCODING_ISO8859_1);
1306
font_default = new wxFont(fontsize,wxDEFAULT,wxNORMAL,wxNORMAL,false,fontname,wxFONTENCODING_ISO8859_1);
1389
font_labels = new wxFont(fontsize_labels, wxDEFAULT, wxNORMAL, wxNORMAL,
1390
false, wxString(fontname_labels, wxConvUTF8),
1391
wxFONTENCODING_ISO8859_1);
1392
font_default = new wxFont(fontsize, wxDEFAULT, wxNORMAL, wxNORMAL,
1393
false, wxString(fontname, wxConvUTF8),
1394
wxFONTENCODING_ISO8859_1);
1307
1395
current_font = font_default;
1308
1396
pen_leg = new wxPen(colour_leg,0,wxSOLID);
1309
1397
pen_surface_leg = new wxPen(colour_surface_leg,0,wxSOLID);
1437
svxPrintout::PlotLR(const vector<XSect> & centreline)
1439
assert(centreline.size() > 1);
1441
Vector3 last_right(1.0, 0.0, 0.0);
1443
const double Sc = 1000 / m_layout->Scale;
1444
const double SIN = sin(rad(m_layout->rot));
1445
const double COS = cos(rad(m_layout->rot));
1447
vector<XSect>::const_iterator i = centreline.begin();
1448
vector<XSect>::size_type segment = 0;
1449
while (i != centreline.end()) {
1450
// get the coordinates of this vertex
1451
const XSect & pt_v = *i++;
1455
const Vector3 up_v(0.0, 0.0, 1.0);
1458
assert(i != centreline.end());
1461
// get the coordinates of the next vertex
1462
const XSect & next_pt_v = *i;
1464
// calculate vector from this pt to the next one
1465
Vector3 leg_v = next_pt_v - pt_v;
1467
// obtain a vector in the LRUD plane
1468
right = leg_v * up_v;
1469
if (right.magnitude() == 0) {
1474
} else if (segment + 1 == centreline.size()) {
1477
// Calculate vector from the previous pt to this one.
1478
Vector3 leg_v = pt_v - prev_pt_v;
1480
// Obtain a horizontal vector in the LRUD plane.
1481
right = leg_v * up_v;
1482
if (right.magnitude() == 0) {
1483
right = Vector3(last_right.GetX(), last_right.GetY(), 0.0);
1488
assert(i != centreline.end());
1489
// Intermediate segment.
1491
// Get the coordinates of the next vertex.
1492
const XSect & next_pt_v = *i;
1494
// Calculate vectors from this vertex to the
1495
// next vertex, and from the previous vertex to
1497
Vector3 leg1_v = pt_v - prev_pt_v;
1498
Vector3 leg2_v = next_pt_v - pt_v;
1500
// Obtain horizontal vectors perpendicular to
1501
// both legs, then normalise and average to get
1502
// a horizontal bisector.
1503
Vector3 r1 = leg1_v * up_v;
1504
Vector3 r2 = leg2_v * up_v;
1508
if (right.magnitude() == 0) {
1509
// This is the "mid-pitch" case...
1515
// Scale to unit vectors in the LRUD plane.
1518
Double l = pt_v.GetL();
1519
Double r = pt_v.GetR();
1522
Vector3 p = pt_v - right * l;
1523
double X = p.GetX() * COS - p.GetY() * SIN;
1524
double Y = (p.GetX() * SIN + p.GetY() * COS);
1525
long x = (long)((X * Sc + m_layout->xOrg) * m_layout->scX);
1526
long y = (long)((Y * Sc + m_layout->yOrg) * m_layout->scY);
1527
MoveTo(x - PWX_CROSS_SIZE, y - PWX_CROSS_SIZE);
1529
DrawTo(x - PWX_CROSS_SIZE, y + PWX_CROSS_SIZE);
1532
Vector3 p = pt_v + right * r;
1533
double X = p.GetX() * COS - p.GetY() * SIN;
1534
double Y = (p.GetX() * SIN + p.GetY() * COS);
1535
long x = (long)((X * Sc + m_layout->xOrg) * m_layout->scX);
1536
long y = (long)((Y * Sc + m_layout->yOrg) * m_layout->scY);
1537
MoveTo(x + PWX_CROSS_SIZE, y - PWX_CROSS_SIZE);
1539
DrawTo(x + PWX_CROSS_SIZE, y + PWX_CROSS_SIZE);
1549
svxPrintout::PlotUD(const vector<XSect> & centreline)
1551
assert(centreline.size() > 1);
1552
const double Sc = 1000 / m_layout->Scale;
1554
vector<XSect>::const_iterator i = centreline.begin();
1555
while (i != centreline.end()) {
1556
// get the coordinates of this vertex
1557
const XSect & pt_v = *i++;
1559
Double u = pt_v.GetU();
1560
Double d = pt_v.GetD();
1562
if (u >= 0 || d >= 0) {
1564
double SIN = sin(rad(m_layout->rot));
1565
double COS = cos(rad(m_layout->rot));
1566
double X = p.GetX() * COS - p.GetY() * SIN;
1567
double Y = p.GetZ();
1568
long x = (long)((X * Sc + m_layout->xOrg) * m_layout->scX);
1570
long y = (long)(((Y + u) * Sc + m_layout->yOrg) * m_layout->scY);
1571
MoveTo(x - PWX_CROSS_SIZE, y + PWX_CROSS_SIZE);
1573
DrawTo(x + PWX_CROSS_SIZE, y + PWX_CROSS_SIZE);
1576
long y = (long)(((Y - d) * Sc + m_layout->yOrg) * m_layout->scY);
1577
MoveTo(x - PWX_CROSS_SIZE, y - PWX_CROSS_SIZE);
1579
DrawTo(x + PWX_CROSS_SIZE, y - PWX_CROSS_SIZE);
1345
1585
static wxColour
1346
1586
to_rgb(const char *var, char *val)
1371
1610
fCalibrate = fCalibrate; /* suppress unused argument warning */
1373
vals = ini_read_hier(fh_list, "win", vars);
1612
vals = ini_read(fh_list, "aven", vars);
1374
1613
fontsize_labels = 10;
1375
if (vals[1]) fontsize_labels = as_int(vars[1], vals[1], 1, INT_MAX);
1614
if (vals[0]) fontsize_labels = as_int(vars[0], vals[0], 1, INT_MAX);
1378
1617
colour_text = colour_labels = colour_frame = colour_leg = colour_cross = colour_surface_leg = *wxBLACK;
1379
if (vals[2]) colour_text = to_rgb(vars[2], vals[2]);
1380
if (vals[3]) colour_labels = to_rgb(vars[3], vals[3]);
1381
if (vals[4]) colour_frame = to_rgb(vars[4], vals[4]);
1382
if (vals[5]) colour_leg = to_rgb(vars[5], vals[5]);
1383
if (vals[6]) colour_cross = to_rgb(vars[6], vals[6]);
1384
if (vals[7]) colour_surface_leg = to_rgb(vars[7], vals[7]);
1618
if (vals[1]) colour_text = to_rgb(vars[1], vals[1]);
1619
if (vals[2]) colour_labels = to_rgb(vars[2], vals[2]);
1620
if (vals[3]) colour_frame = to_rgb(vars[3], vals[3]);
1621
if (vals[4]) colour_leg = to_rgb(vars[4], vals[4]);
1622
if (vals[5]) colour_cross = to_rgb(vars[5], vals[5]);
1623
if (vals[6]) colour_surface_leg = to_rgb(vars[6], vals[6]);
1385
1624
m_layout->scX = 1;
1386
1625
m_layout->scY = 1;