Indicate the just-exported origin and basis x and y vectors after

exporting our view to any file that doesn't have a canvas size (and
therefore doesn't get everything shifted to fit with the requested
margins around it in the canvas).

[git-p4: depot-paths = "//depot/solvespace/": change = 2107]
solver
Jonathan Westhues 2010-01-13 21:24:32 -08:00
parent a0a7feda89
commit 342729d9a4
4 changed files with 54 additions and 0 deletions

View File

@ -771,6 +771,8 @@ nogrid:;
glEnd();
}
// An extra line, used to indicate the origin when rotating within the
// plane of the monitor.
if(SS.extraLine.draw) {
glLineWidth(1);
glxLockColorTo(Style::Color(Style::DATUM));
@ -780,6 +782,32 @@ nogrid:;
glEnd();
}
// A note to indicate the origin in the just-exported file.
if(SS.justExportedInfo.draw) {
glxColorRGB(Style::Color(Style::DATUM));
Vector p = SS.justExportedInfo.pt,
u = SS.justExportedInfo.u,
v = SS.justExportedInfo.v;
glLineWidth(1.5);
glBegin(GL_LINES);
glxVertex3v(p.Plus(u.WithMagnitude(-15/scale)));
glxVertex3v(p.Plus(u.WithMagnitude(30/scale)));
glxVertex3v(p.Plus(v.WithMagnitude(-15/scale)));
glxVertex3v(p.Plus(v.WithMagnitude(30/scale)));
glEnd();
glxWriteText("(x, y) = (0, 0) for file just exported",
DEFAULT_TEXT_HEIGHT,
p.Plus(u.ScaledBy(10/scale)).Plus(v.ScaledBy(10/scale)),
u, v, NULL, NULL);
glxWriteText("press Esc to clear this message",
DEFAULT_TEXT_HEIGHT,
p.Plus(u.ScaledBy(40/scale)).Plus(
v.ScaledBy(-(DEFAULT_TEXT_HEIGHT)/scale)),
u, v, NULL, NULL);
}
// And finally the toolbar.
if(SS.showToolbar) {
ToolbarDraw();

View File

@ -175,6 +175,17 @@ void SolveSpace::ExportViewOrWireframeTo(char *filename, bool wireframe) {
u, v, n, origin, SS.CameraTangent()*SS.GW.scale,
out);
}
if(!out->HasCanvasSize()) {
// These file formats don't have a canvas size, so they just
// get exported in the raw coordinate system. So indicate what
// that was on-screen.
SS.justExportedInfo.draw = true;
SS.justExportedInfo.pt = origin;
SS.justExportedInfo.u = u;
SS.justExportedInfo.v = v;
InvalidateGraphics();
}
}
edges.Clear();

View File

@ -334,10 +334,12 @@ void GraphicsWindow::MenuView(int id) {
switch(id) {
case MNU_ZOOM_IN:
SS.GW.scale *= 1.2;
SS.later.showTW = true;
break;
case MNU_ZOOM_OUT:
SS.GW.scale /= 1.2;
SS.later.showTW = true;
break;
case MNU_ZOOM_TO_FIT:
@ -626,6 +628,7 @@ void GraphicsWindow::MenuEdit(int id) {
SS.GW.ClearSuper();
HideTextEditControl();
SS.nakedEdges.Clear();
SS.justExportedInfo.draw = false;
break;
case MNU_SELECT_ALL: {

View File

@ -428,6 +428,7 @@ public:
virtual void Triangle(STriangle *tr) = 0;
virtual void StartFile(void) = 0;
virtual void FinishAndCloseFile(void) = 0;
virtual bool HasCanvasSize(void) = 0;
};
class DxfFileWriter : public VectorFileWriter {
public:
@ -439,6 +440,7 @@ public:
void Bezier(SBezier *sb);
void StartFile(void);
void FinishAndCloseFile(void);
bool HasCanvasSize(void) { return false; }
};
class EpsFileWriter : public VectorFileWriter {
public:
@ -453,6 +455,7 @@ public:
void Bezier(SBezier *sb);
void StartFile(void);
void FinishAndCloseFile(void);
bool HasCanvasSize(void) { return true; }
};
class PdfFileWriter : public VectorFileWriter {
public:
@ -469,6 +472,7 @@ public:
void Bezier(SBezier *sb);
void StartFile(void);
void FinishAndCloseFile(void);
bool HasCanvasSize(void) { return true; }
};
class SvgFileWriter : public VectorFileWriter {
public:
@ -483,6 +487,7 @@ public:
void Bezier(SBezier *sb);
void StartFile(void);
void FinishAndCloseFile(void);
bool HasCanvasSize(void) { return true; }
};
class HpglFileWriter : public VectorFileWriter {
public:
@ -495,6 +500,7 @@ public:
void Bezier(SBezier *sb);
void StartFile(void);
void FinishAndCloseFile(void);
bool HasCanvasSize(void) { return false; }
};
class Step2dFileWriter : public VectorFileWriter {
StepFileWriter sfw;
@ -506,6 +512,7 @@ class Step2dFileWriter : public VectorFileWriter {
void Bezier(SBezier *sb);
void StartFile(void);
void FinishAndCloseFile(void);
bool HasCanvasSize(void) { return false; }
};
class GCodeFileWriter : public VectorFileWriter {
public:
@ -518,6 +525,7 @@ public:
void Bezier(SBezier *sb);
void StartFile(void);
void FinishAndCloseFile(void);
bool HasCanvasSize(void) { return false; }
};
#ifdef LIBRARY
@ -710,6 +718,10 @@ public:
double scale; // pixels per mm
Vector origin;
} bgImage;
struct {
bool draw;
Vector pt, u, v;
} justExportedInfo;
class Clipboard {
public: