[TD]simplify ActiveView
- remove copyActiveViewToSvgFile - use bitmap image instead of Svg - upgrade Task with crop options
This commit is contained in:
committed by
WandererFan
parent
6347f90b15
commit
b97c93008e
@@ -53,7 +53,6 @@
|
||||
#include "QGIView.h"
|
||||
#include "ViewProviderPage.h"
|
||||
#include "ViewProviderDrawingView.h"
|
||||
#include "Grabber3d.h"
|
||||
|
||||
namespace TechDrawGui {
|
||||
|
||||
@@ -71,9 +70,6 @@ public:
|
||||
add_varargs_method("exportPageAsSvg", &Module::exportPageAsSvg,
|
||||
"exportPageAsSvg(DrawPageObject, FilePath) -- print page as Svg to file."
|
||||
);
|
||||
add_varargs_method("copyActiveViewToSvgFile", &Module::copyActiveViewToSvgFile,
|
||||
"copyActiveViewToSvgFile(DrawPageObject, FilePath) -- copy ActiveView to Svg file."
|
||||
);
|
||||
add_varargs_method("addQGIToView", &Module::addQGIToView,
|
||||
"addQGIToView(View, QGraphicsItem) -- insert graphics item into view's graphic."
|
||||
);
|
||||
@@ -258,69 +254,6 @@ private:
|
||||
return Py::None();
|
||||
}
|
||||
|
||||
//!copyActiveViewToSvgFile(document, fileSpec)
|
||||
Py::Object copyActiveViewToSvgFile(const Py::Tuple& args)
|
||||
{
|
||||
double result = 1.0;
|
||||
PyObject *docObj = nullptr;
|
||||
PyObject *colorObj = nullptr;
|
||||
PyObject *paintObj = Py_True;
|
||||
char* name;
|
||||
|
||||
App::Document* appDoc = nullptr;
|
||||
std::string fileSpec;
|
||||
double outWidth = 138.5; //TODO: change to A4 for release
|
||||
double outHeight = 95.0; //ISO A5 defaults
|
||||
bool paintBackground = true;
|
||||
QColor bgColor = QColor(Qt::white);
|
||||
double lineWidth = 1.0; //1 mm
|
||||
double border = 0.0; //no border
|
||||
int mode = 0; //SoRenderManager::RenderMode(0) - AS_IS
|
||||
|
||||
if (!PyArg_ParseTuple(args.ptr(), "Oet|ddOOddi",
|
||||
&docObj, "utf-8", &name,
|
||||
&outWidth, &outHeight,
|
||||
&paintObj, &colorObj,
|
||||
&lineWidth, &border,
|
||||
&mode)) {
|
||||
throw Py::TypeError("expected (doc, file|, options)");
|
||||
}
|
||||
|
||||
fileSpec = std::string(name);
|
||||
PyMem_Free(name);
|
||||
|
||||
if (paintObj == Py_True) {
|
||||
paintBackground = true;
|
||||
} else {
|
||||
paintBackground = false;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if (PyObject_TypeCheck(docObj, &(App::DocumentPy::Type))) {
|
||||
appDoc = static_cast<App::DocumentPy*>(docObj)->getDocumentPtr();
|
||||
if (colorObj && PyTuple_Check(colorObj)) {
|
||||
App::Color c = TechDraw::DrawUtil::pyTupleToColor(colorObj);
|
||||
bgColor = c.asValue<QColor>();
|
||||
}
|
||||
result =
|
||||
Grabber3d::copyActiveViewToSvgFile(appDoc, fileSpec,
|
||||
outWidth, outHeight,
|
||||
paintBackground, bgColor,
|
||||
lineWidth, border,
|
||||
mode); //TODO: add svg scale factor?
|
||||
}
|
||||
}
|
||||
catch (Base::Exception &e) {
|
||||
e.setPyException();
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
PyObject* pyResult = nullptr;
|
||||
pyResult = PyFloat_FromDouble(result);
|
||||
return Py::asObject(pyResult);
|
||||
}
|
||||
|
||||
Py::Object addQGIToView(const Py::Tuple& args)
|
||||
{
|
||||
PyObject *viewPy = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user