#include <QRectF>
#include <QRubberBand>
#include <QScrollBar>
+#include <QPrinter>
+#include <QPainter>
#include <math.h>
onBoundingRectChanged();
}
+void GraphicsView_ViewPort::clearItems()
+{
+ myHighlightedObject = 0;
+ mySelectedObjects.clear();
+ myObjects.clear();
+ myScene->clear();
+ onBoundingRectChanged();
+}
+
//================================================================
// Function : getObjects
// Purpose :
return anImage;
}
+bool GraphicsView_ViewPort::dumpViewToPSFormat(const QString& fileName)
+{
+ QPrinter printer(QPrinter::ScreenResolution);
+ printer.setOutputFormat(QPrinter::PostScriptFormat);
+ printer.setOutputFileName(fileName);
+ QPainter painter;
+ if (!painter.begin(&printer))
+ return false;
+
+ QRect view( 0, 0, printer.pageRect().width(), printer.paperRect().height() );
+ QRectF bounds = myScene->itemsBoundingRect();
+
+ if( !view.isEmpty() && !bounds.isEmpty() )
+ {
+ float SCALE = 0.5;//qMin( view.width()/bounds.width(), view.height()/bounds.height() );
+ painter.setViewport( view );
+ painter.scale( SCALE, SCALE );
+ }
+ myScene->render( &painter, QRectF( view ), bounds );
+
+ if (!painter.end())
+ return false;
+ return true;
+}
+
//================================================================
// Function : setSceneGap
// Purpose :