Merge branch 'refs/heads/j-downsett-drawing'

This commit is contained in:
jriegel 2013-12-18 23:11:02 +01:00
commit 246f8b70f0
3 changed files with 659 additions and 198 deletions

View File

@ -56,7 +56,7 @@ using namespace std;
QString number_to_name(int j) QString number_to_name(int j)
{ {
char * temp[] = {"Front","Right","Back","Left","Top","Bottom"}; char * temp[] = {"Front","Right","Back","Left","Top","Bottom","Axonometric"};
QString translated = QObject::tr(temp[j]); QString translated = QObject::tr(temp[j]);
return translated; return translated;
} }
@ -93,6 +93,44 @@ void rotate_coords(int& x, int& y, int i)
y = t2; y = t2;
} }
void rotate_coords(float & x, float & y, float angle)
{
float tx = x * cos(angle) - y * sin(angle);
y = x * sin(angle) + y * cos(angle);
x = tx;
}
float dot(float * r, float * z)
{
return ( r[0]*z[0] + r[1]*z[1] + r[2]*z[2]);
}
void cross(float * r, float * n, float * p)
{
p[0] = r[1]*n[2] - r[2]*n[1];
p[1] = r[2]*n[0] - r[0]*n[2];
p[2] = r[0]*n[1] - r[1]*n[0];
}
void project(float * r, float * n, float * p)
{
// for r projected onto plane perpendicular to n
// r x n is perpendicular to r and n (.: lies on plane)
// then n x (r x n) is perpendicular to that and to n, is the projection
float c[3];
cross(r, n, c);
cross(n, c, p);
}
void normalise(float * r)
{
float m = 1/sqrt(r[0]*r[0] + r[1]*r[1] + r[2]*r[2]);
r[0] *= m;
r[1] *= m;
r[2] *= m;
}
@ -109,8 +147,8 @@ orthoView::orthoView(std::string name, const char * targetpage, const char * sou
x = 0; x = 0;
y = 0; y = 0;
dir = 0; dir = 0;
angle = 0;
active = true; active = true;
axo = false;
Command::doCommand(Command::Doc,"App.activeDocument().addObject('Drawing::FeatureViewPart','%s')",myname.c_str()); Command::doCommand(Command::Doc,"App.activeDocument().addObject('Drawing::FeatureViewPart','%s')",myname.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.Source = App.activeDocument().%s",myname.c_str(), sourcepart); Command::doCommand(Command::Doc,"App.activeDocument().%s.Source = App.activeDocument().%s",myname.c_str(), sourcepart);
@ -157,6 +195,7 @@ void orthoView::activate(bool state)
void orthoView::setDir(int i) void orthoView::setDir(int i)
{ {
axo = false;
dir = i; dir = i;
int vx = (dir == 1) - (dir == 3); int vx = (dir == 1) - (dir == 3);
int vy = (dir == 0) - (dir == 2); int vy = (dir == 0) - (dir == 2);
@ -176,6 +215,49 @@ void orthoView::setDir(int i)
} }
void orthoView::setDir(float vx, float vy, float vz, float ang, int vert_index)
{
//calcCentre();
vert[0] = 0;
vert[1] = 0;
vert[2] = 0;
switch(vert_index)
{
case 0:
vert[1] = -1;
break;
case 1:
vert[0] = 1;
break;
case 2:
vert[1] = 1;
break;
case 3:
vert[0] = -1;
break;
case 4:
vert[2] = 1;
break;
case 5:
vert[2] = -1;
}
axo = true;
n[0] = vx;
n[1] = vy;
n[2] = vz;
angle = ang;
setOrientation(0);
if (active)
{
Command::doCommand(Command::Doc,"App.activeDocument().%s.Direction = (%f,%f,%f)",myname.c_str(),vx,vy,vz);
Command::doCommand(Command::Doc,"App.activeDocument().%s.Label = '%s'",myname.c_str(),number_to_name(6).toStdString().c_str());
}
}
void orthoView::setPos(float px, float py) void orthoView::setPos(float px, float py)
{ {
if (px != 0 && py !=0) if (px != 0 && py !=0)
@ -208,7 +290,7 @@ void orthoView::setOrientation(int orient)
{ {
orientation = orient; orientation = orient;
if (active) if (active)
Command::doCommand(Command::Doc,"App.activeDocument().%s.Rotation = %d", myname.c_str(), (90*orientation+angle)); Command::doCommand(Command::Doc,"App.activeDocument().%s.Rotation = %f", myname.c_str(), (90*orientation+angle));
calcCentre(); calcCentre();
} }
@ -226,41 +308,61 @@ void orthoView::calcCentre()
float cy = mybox.CalcCenter().y; float cy = mybox.CalcCenter().y;
float cz = mybox.CalcCenter().z; float cz = mybox.CalcCenter().z;
float coords[6][2] = if (axo)
{ {
{-cx, cz}, //front float p[3] = {cx, -cy, cz};
{ cy, cz}, //right float n_p[3] = {n[0], -n[1], n[2]};
{ cx, cz}, //back float proj_p[3];
{-cy, cz}, //left float proj_y[3]; // will be the y axis of the projection
{-cx, -cy}, //top float proj_x[3]; // will be the x axis of the projection
{-cx, cy} //bottom
};
x = coords[dir][0] * scale; project(vert, n_p, proj_y);
y = coords[dir][1] * scale; //project(p, n, proj_p);
rotate_coords(x,y,orientation); cross(proj_y, n_p, proj_x);
normalise(proj_x);
float dx = mybox.LengthX(); normalise(proj_y);
float dy = mybox.LengthY(); x = -scale * dot(p, proj_x);
float dz = mybox.LengthZ(); y = scale * dot(p, proj_y);
//rotate_coords(x, y, angle)
float dims[6][2] = }
else
{ {
{dx, dz}, //front float coords[6][2] =
{dy, dz}, //right {
{dx, dz}, //back {-cx, cz}, //front
{dy, dz}, //left { cy, cz}, //right
{dx, dy}, //top { cx, cz}, //back
{dx, dy} //bottom {-cy, cz}, //left
}; {-cx, -cy}, //top
{-cx, cy} //bottom
};
width = dims[dir][0]; x = coords[dir][0] * scale;
height = dims[dir][1]; y = coords[dir][1] * scale;
if (orientation % 2 == 1) rotate_coords(x,y,orientation);
{
float temp = width; float dx = mybox.LengthX();
width = height; float dy = mybox.LengthY();
height = temp; float dz = mybox.LengthZ();
float dims[6][2] =
{
{dx, dz}, //front
{dy, dz}, //right
{dx, dz}, //back
{dy, dz}, //left
{dx, dy}, //top
{dx, dy} //bottom
};
width = dims[dir][0];
height = dims[dir][1];
if (orientation % 2 == 1)
{
float temp = width;
width = height;
height = temp;
}
} }
} }
@ -345,6 +447,7 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent)
inputs[2] = ui->y_2; inputs[2] = ui->y_2;
inputs[3] = ui->spacing_h_3; inputs[3] = ui->spacing_h_3;
inputs[4] = ui->spacing_v_4; inputs[4] = ui->spacing_v_4;
ui->tabWidget->setTabEnabled(1,false);
for (int i=0; i < 5; i++) for (int i=0; i < 5; i++)
connect(inputs[i], SIGNAL(editingFinished()), this, SLOT(data_entered())); connect(inputs[i], SIGNAL(editingFinished()), this, SLOT(data_entered()));
@ -356,6 +459,12 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent)
connect(ui->auto_tog, SIGNAL(stateChanged(int)), this, SLOT(toggle_auto(int))); connect(ui->auto_tog, SIGNAL(stateChanged(int)), this, SLOT(toggle_auto(int)));
connect(ui->primary, SIGNAL(activated(int)), this, SLOT(setPrimary(int))); connect(ui->primary, SIGNAL(activated(int)), this, SLOT(setPrimary(int)));
connect(ui->axoProj, SIGNAL(activated(int)), this, SLOT(axoChanged(int)));
connect(ui->axoTop, SIGNAL(activated(int)), this, SLOT(axoTopChanged(int)));
connect(ui->axoLeft, SIGNAL(activated(int)), this, SLOT(axoChanged(int)));
connect(ui->flip, SIGNAL(clicked()), this, SLOT(axo_flip()));
connect(ui->axoScale, SIGNAL(editingFinished()), this, SLOT(axoScale()));
//these matrices contain information relating relative position on page to which view appears there, and in which orientation //these matrices contain information relating relative position on page to which view appears there, and in which orientation
//first matrix is for front, right, back, left. Only needs to contain positions above and below primary since in positions horizontally //first matrix is for front, right, back, left. Only needs to contain positions above and below primary since in positions horizontally
@ -385,6 +494,37 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent)
map2[i][j][k] = temp2[i][j][k]; map2[i][j][k] = temp2[i][j][k];
} }
float temp[3][6][4][4] =
// isometric
{{{{1,1,1,180},{-1,1,-1,180},{-1,1,1,180},{1,1,-1,180}}, // top face is the Right
{{1,1,-1,60},{1,-1,1,240},{1,1,1,300},{1,-1,-1,120}}, // Front
{{1,-1,-1,0},{-1,-1,1,0},{1,-1,1,0},{-1,-1,-1,0}}, // Left
{{-1,1,1,60},{-1,-1,-1,240},{-1,-1,1,120},{-1,1,-1,300}}, // Back
{{1,1,1,60},{1,-1,1,120},{-1,-1,1,240},{-1,1,1,300}}, // Top
{{-1,1,-1,60},{1,1,-1,300},{1,-1,-1,240},{-1,-1,-1,120}}}, // Bottom
// dimetric
{{{0.681,0.267,0.681,180},{-0.681,0.267,-0.681,180},{-0.681,0.267,0.681,180},{0.681,0.267,-0.681,180}}, // top face is the Right
{{0.267,0.681,-0.681,0},{0.267,-0.681,0.681,0},{0.267,0.681,0.681,0},{0.267,-0.681,-0.681,0}}, // Front
{{0.681,-0.267,-0.681,0},{-0.681,-0.267,0.681,0},{0.681,-0.267,0.681,0},{-0.681,-0.267,-0.681,0}}, // Left
{{-0.267,0.681,0.681,180},{-0.267,-0.681,-0.681,180},{-0.267,-0.681,0.681,180},{-0.267,0.681,-0.681,180}}, // Back
{{0.681,0.681,0.267,0},{0.681,-0.681,0.267,0},{-0.681,-0.681,0.267,0},{-0.681,0.681,0.267,0}}, // Top
{{-0.681,0.681,-0.267,180},{0.681,0.681,-0.267,180},{0.681,-0.681,-0.267,180},{-0.681,-0.681,-0.267,180}}}, // Bottom
// trimetric
{{{0.211,0.577,0.788,-98.8},{-0.211,0.577,-0.788,81.2},{-0.788,0.577,0.211,81.2},{0.788,0.577,-0.211,-98.8}}, // top face is the Right
{{0.577,0.211,-0.788,81.2},{0.577,-0.211,0.788,-98.8},{0.577,0.788,0.211,-98.8},{0.577,-0.788,-0.211,81.2}}, // Front
{{0.211,-0.577,-0.788,-98.8},{-0.211,-0.577,0.788,81.2},{0.788,-0.577,0.211,81.2},{-0.788,-0.577,-0.211,-98.8}}, // Left
{{-0.577,0.211,0.788,81.2},{-0.577,-0.211,-0.788,-98.8},{-0.577,-0.788,0.211,-98.8},{-0.577,0.788,-0.211,81.2}}, // Back
{{0.788,0.211,0.577,-98.8},{0.211,-0.788,0.577,81.2},{-0.788,-0.211,0.577,81.2},{-0.211,0.788,0.577,-98.8}}, // Top
{{-0.788,0.211,-0.577,-98.8},{0.211,0.788,-0.577,81.2},{0.788,-0.211,-0.577,81.2},{-0.211,-0.788,-0.577,-98.8}}}}; // Bottom
for (int i = 0; i < 3; i++)
for (int j = 0; j < 6; j++)
for (int k = 0; k < 4; k++)
for (int l = 0; l < 4; l++)
axonometric[i][j][k][l] = temp[i][j][k][l];
//initialise variables //initialise variables
for (int i=0; i < 4; i++) for (int i=0; i < 4; i++)
@ -396,6 +536,7 @@ TaskOrthoViews::TaskOrthoViews(QWidget *parent)
rotate = 0; rotate = 0;
proj = 1; proj = 1;
autoscale = 1; autoscale = 1;
axo_flipped = false;
//below are calculated in case autodims is deselected before these values are initialised. //below are calculated in case autodims is deselected before these values are initialised.
float max_dim = max(max(bbox.LengthX(), bbox.LengthY()), bbox.LengthZ()); float max_dim = max(max(bbox.LengthX(), bbox.LengthY()), bbox.LengthZ());
@ -437,7 +578,7 @@ void TaskOrthoViews::changeEvent(QEvent *e)
void TaskOrthoViews::pagesize(std::string& page_template) void TaskOrthoViews::pagesize(std::string& page_template)
{ {
/********update num_templates when adding extra templates*******************/ // /********update num_templates when adding extra templates*******************/
const int num_templates = 2; const int num_templates = 2;
std::string templates[num_templates] = {"A3_Landscape.svg", "A4_Landscape.svg"}; std::string templates[num_templates] = {"A3_Landscape.svg", "A4_Landscape.svg"};
@ -445,7 +586,8 @@ void TaskOrthoViews::pagesize(std::string& page_template)
for (int i=0; i < num_templates; i++) for (int i=0; i < num_templates; i++)
{ {
if (templates[i] == page_template) // if (templates[i] == page_template)
if (page_template.find(templates[i]) != std::string::npos)
{ {
pagewidth = dimensions[i][0] - 2*margin; pagewidth = dimensions[i][0] - 2*margin;
pageh1 = dimensions[i][1] - 2*margin; pageh1 = dimensions[i][1] - 2*margin;
@ -458,7 +600,8 @@ void TaskOrthoViews::pagesize(std::string& page_template)
//code below copied from FeaturePage.cpp //code below copied from FeaturePage.cpp
Base::FileInfo fi(page_template); Base::FileInfo fi(page_template);
if (!fi.isReadable()) { if (!fi.isReadable())
{
fi.setFile(App::Application::getResourceDir() + "Mod/Drawing/Templates/" + fi.fileName()); fi.setFile(App::Application::getResourceDir() + "Mod/Drawing/Templates/" + fi.fileName());
if (!fi.isReadable()) //if so then really shouldn't have been able to get this far, but just in case... if (!fi.isReadable()) //if so then really shouldn't have been able to get this far, but just in case...
{ {
@ -518,7 +661,8 @@ void TaskOrthoViews::pagesize(std::string& page_template)
break; break;
} }
} }
catch (Standard_Failure) { } catch (Standard_Failure)
{ }
file.close(); file.close();
@ -620,15 +764,25 @@ void TaskOrthoViews::autodims()
void TaskOrthoViews::compute() void TaskOrthoViews::compute()
{ {
float temp_scale = scale;
if (autoscale) if (autoscale)
autodims(); autodims();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
views[i]->setScale(scale); if (i == axo && i > 0)
{
if (temp_scale == ui->axoScale->text().toFloat())
{
views[i]->setScale(scale); // only update the axonometric scale if it wasn't manually changed
ui->axoScale->setText(QString::number(scale));
}
}
else
views[i]->setScale(scale);
views[i]->setPos(x_pos + view_status[i][2] * horiz, y_pos + view_status[i][3] * vert); views[i]->setPos(x_pos + view_status[i][2] * horiz, y_pos + view_status[i][3] * vert);
} }
Command::updateActive(); Command::updateActive();
Command::commitCommand(); Command::commitCommand();
} }
@ -661,7 +815,7 @@ void TaskOrthoViews::validate_cbs()
{ {
if (!((i == 2)*(j == 2))) //don't enable the centre one! if (!((i == 2)*(j == 2))) //don't enable the centre one!
/********temporary if statement here, remove the following if to renable 'diagonal' checkboxes *******/ /********temporary if statement here, remove the following if to renable 'diagonal' checkboxes *******/
if ((i-2) * (j-2) == 0) //if ((i-2) * (j-2) == 0)
c_boxes[i][j]->setEnabled(true); //if this box's inner neighbour(s) are checked, then this one enabled c_boxes[i][j]->setEnabled(true); //if this box's inner neighbour(s) are checked, then this one enabled
} }
else else
@ -674,6 +828,7 @@ void TaskOrthoViews::validate_cbs()
} }
} }
void TaskOrthoViews::cb_toggled(bool toggle) void TaskOrthoViews::cb_toggled(bool toggle)
{ {
QString name = sender()->objectName().right(2); QString name = sender()->objectName().right(2);
@ -693,25 +848,55 @@ void TaskOrthoViews::cb_toggled(bool toggle)
} }
int direction, rotation; int direction, rotation;
view_data(dx, dy, direction, rotation);
view_status[i][0] = 1; view_status[i][0] = 1;
view_status[i][2] = dx; view_status[i][2] = dx;
view_status[i][3] = dy; view_status[i][3] = dy;
views[i]->activate(true); views[i]->activate(true);
views[i]->setDir(direction);
views[i]->setOrientation(rotation); if (abs(dx * dy) == 1)
{
axo = i;
ui->tabWidget->setTabEnabled(1,true);
ui->axoScale->setText(QString::number(scale));
set_axo();
}
else
{
view_data(dx, dy, direction, rotation);
views[i]->setDir(direction);
views[i]->setOrientation(rotation);
}
view_count += 1; view_count += 1;
} }
else else
{ {
if (abs(dx) == 1 || abs(dy == 1)) if (((abs(dx) == 1 || abs(dy) == 1)) && (dx*dy) == 0)
{
c_boxes[dx*2+2][dy*2+2]->setChecked(false); c_boxes[dx*2+2][dy*2+2]->setChecked(false);
if (abs(dx) == 1)
{
c_boxes[dx+2][1]->setChecked(false);
c_boxes[dx+2][3]->setChecked(false);
}
else
{
c_boxes[1][dy+2]->setChecked(false);
c_boxes[3][dy+2]->setChecked(false);
}
}
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (view_status[i][2] == dx && view_status[i][3] == dy) if (view_status[i][2] == dx && view_status[i][3] == dy)
break; break;
} }
if (i == axo)
{
axo = 0;
ui->tabWidget->setTabEnabled(1,false);
}
views[i]->activate(false); views[i]->activate(false);
view_status[i][0] = 0; view_status[i][0] = 0;
view_status[i][2] = 0; view_status[i][2] = 0;
@ -775,9 +960,10 @@ void TaskOrthoViews::updateSecondaries()
{ {
int direction, rotation; int direction, rotation;
int dx, dy; int dx, dy;
int n;
for (int i = 1; i < 4; i++) for (int i = 1; i < 4; i++)
if (view_status[i][0] == 1) if ((view_status[i][0] == 1) && (i != axo))
{ {
dx = view_status[i][2]; dx = view_status[i][2];
dy = view_status[i][3]; dy = view_status[i][3];
@ -838,6 +1024,117 @@ void TaskOrthoViews::smooth(int i)
} }
void TaskOrthoViews::axo_flip()
{
axo_flipped = !axo_flipped;
set_axo();
}
void TaskOrthoViews::axoTopChanged(int i)
{
QStringList items;
items << QString::fromUtf8("Front") << QString::fromUtf8("Right") << QString::fromUtf8("Back") << QString::fromUtf8("Left") << QString::fromUtf8("Top") << QString::fromUtf8("Bottom");
if (i == 0 || i == 2)
{
items.removeAt(0);
items.removeAt(1);
}
else if (i == 1 || i == 3)
{
items.removeAt(1);
items.removeAt(2);
}
else
{
items.removeAt(4);
items.removeAt(4);
}
ui->axoLeft->clear();
ui->axoLeft->addItems(items);
set_axo();
}
void TaskOrthoViews::axoChanged(int i)
{
if (i == 2)
ui->flip->setEnabled(true);
else
ui->flip->setEnabled(false);
set_axo();
}
void TaskOrthoViews::axoScale()
{
bool ok;
QString temp = ui->axoScale->text();
float value = temp.toFloat(&ok);
if (ok)
{
views[axo]->setScale(value);
compute();
}
else
ui->axoScale->setText(temp);
}
void TaskOrthoViews::set_axo()
{
float v[3];
float angle;
int proj, primary, left;
proj = ui->axoProj->currentIndex();
primary = ui->axoTop->currentIndex();
left = ui->axoLeft->currentIndex();
v[0] = axonometric[proj][primary][left][0];
v[1] = axonometric[proj][primary][left][1];
v[2] = axonometric[proj][primary][left][2];
angle = axonometric[proj][primary][left][3];
if (axo_flipped && proj == 2)
{
int max_i = 2;
int min_i = 2;
float abs_v[3] = {abs(v[0]), abs(v[1]), abs(v[2])};
if (abs_v[0] < abs_v[1] && abs_v[0] < abs_v[2])
min_i = 0;
else if (abs_v[1] < abs_v[2])
min_i = 1;
if (abs_v[0] > abs_v[1] && abs_v[0] > abs_v[2])
max_i = 0;
else if (abs_v[1] > abs_v[2])
max_i = 1;
v[min_i] = ((v[min_i] > 0) - (v[min_i] < 0)) * abs_v[max_i];
v[max_i] = ((v[max_i] > 0) - (v[max_i] < 0)) * abs_v[min_i];
if (((left == 0 || left == 1) && (primary == 1 || primary == 2)) ||
((left == 2 || left == 3) && (primary == 0 || primary == 3)) ||
((primary == 5) && (left == 0 || left == 2)) ||
((primary == 4) && (left == 1 || left == 3)))
{
angle = - angle;
}
else
{
angle = (angle > 0) ? 98.8 : -81.2;
}
}
views[axo]->setDir(v[0],v[1],v[2], angle, primary);
compute();
}
void TaskOrthoViews::toggle_auto(int i) void TaskOrthoViews::toggle_auto(int i)
{ {
if (i == 2) //auto scale switched on if (i == 2) //auto scale switched on
@ -864,7 +1161,7 @@ void TaskOrthoViews::toggle_auto(int i)
void TaskOrthoViews::data_entered() void TaskOrthoViews::data_entered()
{ {
Command::doCommand(Command::Doc,"#1"); //Command::doCommand(Command::Doc,"#1");
bool ok; bool ok;
QString name = sender()->objectName().right(1); QString name = sender()->objectName().right(1);
@ -881,7 +1178,6 @@ void TaskOrthoViews::data_entered()
return; return;
} }
compute(); compute();
Command::doCommand(Command::Doc,"#2");
} }
@ -900,6 +1196,11 @@ bool TaskOrthoViews::user_input()
break; //stop checking break; //stop checking
} }
} }
if (ui->axoScale->isModified())
{
ui->axoScale->setModified(false);
modified = true;
}
return modified; return modified;
} }

View File

@ -41,6 +41,7 @@ public:
void activate(bool); void activate(bool);
void setDir(int); void setDir(int);
void setDir(float,float,float,float,int);
void setPos(float = 0, float = 0); void setPos(float = 0, float = 0);
void setScale(float); void setScale(float);
void setOrientation(int); void setOrientation(int);
@ -61,11 +62,14 @@ private:
std::string myname; std::string myname;
Base::BoundBox3d mybox; Base::BoundBox3d mybox;
int dir; int dir;
int angle; float angle;
float n[3];
int orientation; int orientation;
float x, y; float x, y;
float pageX, pageY; float pageX, pageY;
float scale; float scale;
bool axo;
float vert[3];
}; };
@ -92,6 +96,10 @@ protected Q_SLOTS:
void smooth(int); void smooth(int);
void toggle_auto(int); void toggle_auto(int);
void data_entered(); void data_entered();
void axoChanged(int);
void axoTopChanged(int);
void axo_flip();
void axoScale();
protected: protected:
void changeEvent(QEvent *); void changeEvent(QEvent *);
@ -103,6 +111,7 @@ private:
void validate_cbs(); void validate_cbs();
void view_data(int, int, int &, int &); void view_data(int, int, int &, int &);
void updateSecondaries(); void updateSecondaries();
void set_axo();
private: private:
class Private; class Private;
@ -114,6 +123,7 @@ private:
int map1[4][3][2]; //contains view directions and rotations for vertical secondary positions, for primaries 1,2,3,4 int map1[4][3][2]; //contains view directions and rotations for vertical secondary positions, for primaries 1,2,3,4
int map2[4][3][2]; //contains view directions and rotations for H and V secondary positions, primaries 5,6 int map2[4][3][2]; //contains view directions and rotations for H and V secondary positions, primaries 5,6
float axonometric[3][6][4][4]; //contains view direction vectors and rotations for axonometric views
int view_status[4][4]; //matrix containing status of four orthoView objects (in use, axo, rel x, rel y) int view_status[4][4]; //matrix containing status of four orthoView objects (in use, axo, rel x, rel y)
int view_count; //number of active views int view_count; //number of active views
@ -127,6 +137,9 @@ private:
float horiz, vert; //centre-centre distances float horiz, vert; //centre-centre distances
bool axo_flipped;
int axo;
float pagewidth, pageheight; //these are actually the available width and height, calculated in constructor. float pagewidth, pageheight; //these are actually the available width and height, calculated in constructor.
float pageh1, pageh2; //h1 - total usable page height, h2 - total height allowing for info box. float pageh1, pageh2; //h1 - total usable page height, h2 - total height allowing for info box.
int margin; int margin;

View File

@ -26,131 +26,6 @@
<string>Orthographic Projection</string> <string>Orthographic Projection</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Projection</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="projection">
<property name="editable">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Third Angle</string>
</property>
</item>
<item>
<property name="text">
<string>First Angle</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Primary View</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="primary">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<property name="frame">
<bool>true</bool>
</property>
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>Front</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
<item>
<property name="text">
<string>Back</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>- Rotate</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="rotate">
<item>
<property name="text">
<string notr="true">0</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">90</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">180</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">270</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0"> <item row="3" column="0">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="3" column="1"> <item row="3" column="1">
@ -449,7 +324,7 @@
</size> </size>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<property name="enabled"> <property name="enabled">
@ -624,13 +499,285 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="axoTab">
<property name="enabled">
<bool>true</bool>
</property>
<attribute name="title"> <attribute name="title">
<string>Axonometric</string> <string>Axonometric</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="1">
<widget class="QComboBox" name="axoProj">
<property name="enabled">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Isometric</string>
</property>
</item>
<item>
<property name="text">
<string>Dimetric</string>
</property>
</item>
<item>
<property name="text">
<string>Trimetric</string>
</property>
</item>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="flip">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Switch direction</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string> Scale</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string> View projection </string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string> Top face</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string> Left face</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="axoTop">
<property name="enabled">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Front</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
<item>
<property name="text">
<string>Back</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="axoLeft">
<property name="enabled">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="axoScale">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string> Trimetric</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Projection</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="projection">
<property name="editable">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Third Angle</string>
</property>
</item>
<item>
<property name="text">
<string>First Angle</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Primary View</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="primary">
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
<property name="frame">
<bool>true</bool>
</property>
<item>
<property name="text">
<string/>
</property>
</item>
<item>
<property name="text">
<string>Front</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
<item>
<property name="text">
<string>Back</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>- Rotate</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="rotate">
<item>
<property name="text">
<string notr="true">0</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">90</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">180</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">270</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>