[QGIS Commit] r8229 - branches/rendercontext-branch/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Mar 16 04:56:35 EDT 2008


Author: mhugent
Date: 2008-03-16 04:56:35 -0400 (Sun, 16 Mar 2008)
New Revision: 8229

Added:
   branches/rendercontext-branch/src/core/qgsrendercontext.cpp
   branches/rendercontext-branch/src/core/qgsrendercontext.h
Modified:
   branches/rendercontext-branch/src/core/CMakeLists.txt
Log:
Added initial implementation of QgsRenderContext. Not wired into rendering operations yet

Modified: branches/rendercontext-branch/src/core/CMakeLists.txt
===================================================================
--- branches/rendercontext-branch/src/core/CMakeLists.txt	2008-03-16 07:02:25 UTC (rev 8228)
+++ branches/rendercontext-branch/src/core/CMakeLists.txt	2008-03-16 08:56:35 UTC (rev 8229)
@@ -37,6 +37,7 @@
 qgsproviderregistry.cpp
 qgsrasterdataprovider.cpp
 qgsrect.cpp
+qgsrendercontext.cpp
 qgsrunprocess.cpp
 qgsscalecalculator.cpp
 qgssearchstring.cpp

Added: branches/rendercontext-branch/src/core/qgsrendercontext.cpp
===================================================================
--- branches/rendercontext-branch/src/core/qgsrendercontext.cpp	                        (rev 0)
+++ branches/rendercontext-branch/src/core/qgsrendercontext.cpp	2008-03-16 08:56:35 UTC (rev 8229)
@@ -0,0 +1,36 @@
+/***************************************************************************
+                              qgsrendercontext.cpp    
+                              --------------------
+  begin                : March 16, 2008
+  copyright            : (C) 2008 by Marco Hugentobler
+  email                : marco dot hugentobler at karto dot baug dot ethz dot ch
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+
+#include "qgsrendercontext.h"
+
+QgsRenderContext::QgsRenderContext(): mCoordTransform(0), mDrawEditingInformation(false), mForceVectorOutput(true), mRenderingStopped(false)
+{
+
+}
+
+QgsRenderContext::~QgsRenderContext()
+{
+  delete mCoordTransform;
+}
+
+void QgsRenderContext::setCoordTransform(QgsCoordinateTransform* t) 
+{
+  delete mCoordTransform;
+  mCoordTransform = t;
+}
+

Added: branches/rendercontext-branch/src/core/qgsrendercontext.h
===================================================================
--- branches/rendercontext-branch/src/core/qgsrendercontext.h	                        (rev 0)
+++ branches/rendercontext-branch/src/core/qgsrendercontext.h	2008-03-16 08:56:35 UTC (rev 8229)
@@ -0,0 +1,84 @@
+/***************************************************************************
+                              qgsrendercontext.h    
+                              ------------------
+  begin                : March 16, 2008
+  copyright            : (C) 2008 by Marco Hugentobler
+  email                : marco dot hugentobler at karto dot baug dot ethz dot ch
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef QGSRENDERCONTEXT_H
+#define QGSRENDERCONTEXT_H
+
+#include "qgscoordinatetransform.h"
+#include "qgsmaptopixel.h"
+#include "qgsrect.h"
+
+/**Contains information about the context of a rendering operation*/
+class QgsRenderContext
+{
+ public:
+  QgsRenderContext();
+  ~QgsRenderContext();
+
+  //getters
+  const QgsCoordinateTransform* coordTransform() const {return mCoordTransform;}
+
+  const QgsRect* extent() const {return &mExtent;}
+
+  const QgsMapToPixel* mapToPixel() const {return &mMapToPixel;}
+
+  double scaleFactor() const {return mScaleFactor;}
+  
+  bool renderingStopped() const {return mRenderingStopped;}
+
+  bool forceVectorOutput() const {return mForceVectorOutput;}
+
+  bool drawEditingInformation() const {return mDrawEditingInformation;}
+
+  //setters
+
+  /**Sets coordinate transformation. QgsRenderContext takes ownership of the pointer and takes \
+   care of releasing the memory properly*/
+  void setCoordTransform(QgsCoordinateTransform* t);
+  void setMapToPixel(const QgsMapToPixel& mtp) {mMapToPixel = mtp;}
+  void setExtent(const QgsRect& extent){mExtent = extent;}
+  void setDrawEditingInformation(bool b){mDrawEditingInformation = b;}
+  void setRenderingStopped(bool stopped){mRenderingStopped = stopped;}
+  void setScaleFactor(double factor){mScaleFactor = factor;}
+
+ private:
+
+  //Copy constructor and assignement operator forbidden
+   QgsRenderContext(const QgsRenderContext& other){}
+   QgsRenderContext& operator=(const QgsRenderContext&){}
+
+  /**For transformation between coordinate systems. Can be 0 if on-the-fly reprojection is not used*/
+  QgsCoordinateTransform* mCoordTransform;
+
+  /**True if vertex markers for editing should be drawn*/
+  bool mDrawEditingInformation;
+
+  QgsRect mExtent;
+
+  /**If true then no rendered vector elements should be cached as image*/
+  bool mForceVectorOutput;
+  
+  QgsMapToPixel mMapToPixel;
+         
+  /**True if the rendering has been canceled*/
+  bool mRenderingStopped;
+        
+  /**Factor to scale line widths and point marker sizes*/
+  double mScaleFactor;
+};
+
+#endif



More information about the QGIS-commit mailing list