Summary

This document tries to give an overview about status of splitting QGIS into several libraries which could be then used by third party applications. For more information refer to QGIS Architecture Roadmap. Tasks marked as done are already in SVN trunk and will be a part of 0.9 release.

Refactoring has started in January 2006 by Tim - code from one directory has been split into several directories:

  • core library
  • gui library
  • qgis application

Tasks

Tasks already completed:

  • Remove GUI dependencies from QgsSpatialRefSys and move it together with QgsCoordinateTransform to core library (./)
  • Remove legend dependencies from QgsMapLayer (./)
  • Store coordinate transform outside of map layer (./)
  • Remove some dependencies in core lib to gui lib in QgsDistanceArea (./)
  • Use QImage instead of QPixmap for rendering core because QPixmaps need X server (./)
  • Remove usage of QMessageBox and similar gui stuff from core lib and providers (./)
  • Remove QgsRenderer's dependency on QgsProject (./)
  • Prepare QgsVectorLayer to be moved to core lib (./)
    • Remove dependency on attribute table (./)
    • Remove dependency on attribute actions (./)
  • Prepare QgsRasterLayer to be moved to core lib (./)
  • Think how to work with user's QGIS DB when using in 3rd party app (./)
    • for now we will use the same DB as used directly in QGIS: ~/.qgis/qgis.db
  • make providers dependent only on core lib (./)
  • make plugins independent from QgisApp (./)
  • move QgsProject to core library (./)
  • start gui library from scratch with inserting only classes prepared to be reusable (./)
    • move mapcanvas (with some tools) there (./)
    • move projection selector there (./)
  • Remove unnecessary classes (which are not intended to be used by other apps) from core lib (./)
  • Think what to do with unused / unfinished / deprecated classes in core and gui libs - delete them! ./)
  • repair visibility settings in legend and project load/save (./)
  • create support for building with CMake make system - Linux and Windows build works (./)
    • see ["Building with CMake"]
  • Start using QGraphicsView from Qt4.2 instead of Q3Canvas (./)
  • resolved most of the warnings in core and gui libraries (./)
  • python bindings (more info: PythonBindings)
    • possibility to use in 3rd party application (./)
    • support for plugins written in python (./)
    • scripting support (python console in QGIS) (./)
  • improved and simplified vector data provider interface (./)
  • use QVariant for feature attributes instead of plain QString (./)
  • enable saving shapefiles for all types of vector layers (./)

Some tasks that has to be done (still growing):

  • vectors handling
    • develop QgsDataSource interface, see ["Redesign_of_QGis_data_model"]
    • get rid of WKB and use only GEOS to handle geometries
  • Move (possibly all) plugin management to a special class, making no difference between C++ and python bindings
  • Add to core lib some more subdirectories with groups of classes logically connected (vector, provider, geometry)
  • rethink general behaviour of map layer registry and how legend(s) work with it
  • fix many TODOs created during the architecture changes (mostly marked with [MD])
  • QgsRasterLayer needs refactoring
  • make possible rendering in separate thread (to allow stopping drawing, updating during rendering and more)
  • convert remaining std::cout and std::cerr to usage of QgsLogger
  • start writing tests (primarily for classes in libraries)
  • finish python bindings

Global tasks:

  • update list of classes to the current state
  • make QGIS API easy to use in applications
  • Remove usage of QSettings and QgsProject for classes intended to be used in 3rd party apps
  • create better structure for code: only CORE and GUI library, both containing subdirs for easier navigation

Class list

Core library

Class
Description
Python
QGis class with some basic enumerations and constants
/)
QgsApplication accessors for application-wide data
/)
QgsLogger class to print debug/warning/error messages to the console
/)

|

Providers
Description
QgsProviderMetadata metadata class for describing a data provider
/)
QgsProviderRegistry singleton class for registering data providers
/)
QgsDataProvider base class for spatial data provider implementations
/)
QgsVectorDataProvider base class for all vector data providers
/)
QgsRasterDataProvider base class for all raster data providers
/)

|

Geometry and spatial references
Description
QgsPoint represents 2D point
/)
QgsLine a simple line composed of two endpoints
/)
QgsRect a rectangle specified by double values
/)
QgsFeature encapsulates a single feature including id and field/value
/)
QgsField encapsulates a field in an attribute table or data source
/)
QgsGeometry represents geometry in WKB/WKT, contains functions for geoprocessing
/)
QgsGeometryVertexIndex identifies particular vertex in a given OGC geometry
/)
QgsClipper class that clips line segments and polygons
/)
QgsDistanceArea distance and area calculations on the ellipsoid
/)
QgsSpatialRefSys class for storing a spatial reference system (SRS)
/)
QgsCoordinateTransform class for doing transformations between two map coordinate systems
/)
QgsSpatialIndex wrapper class for spatial indexing library
/)

|

Exeptions
Description
QgsException QGIS exception class (derived from std::exception)
/)
QgsIOException for qgis I/O exception
/)
QgsProjectBadLayerException for files missing layers while reading project files
/)
QgsCsException coordinate system exception
/)

|

Searching
Description
Flex + Bison sources parser engine
/)
QgsSearchString interface for parsing and evaluation of search strings
/)
QgsSearchTreeNode definition of node for parsed tree of search string
/)

|

Layers
Description
/)
QgsMapLayer base class for all map layer types
/)
QgsMapLayerRegistry singleton class for keeping track of loaded layers
/)
QgsVectorLayer vector layer backed by a data source provider
/)

|

Mapping rendering stuff
Description
QgsMapRender class for rendering map layer set
/)
QgsMapToPixel class for transformation between map and device coordinates
/)
QgsScaleCalculator calculates scale based on map extent and units
/)
QgsLabel class for rendering labels
/)
QgsLabelAttributes storage of attributes for label rendering
/)

|

Renderers (in "renderer" dir)
Description
QgsRenderer abstract base for all renderers. Renderer holds info needed to draw the contents of vector layer
/)
QgsContinuousColorRenderer renderer class which interpolates RGB values between min,max of the classification field
/)
QgsGraduatedSymbolRenderer renders and contains the information for graduated symbol rendering
/)
QgsSingleSymbolRenderer render class to display all the features with a single QgsSymbol
/)
QgsUniqueValueRenderer renderer class to show every feature with unique value
/)

|

Symbology (in "symbology" dir)
Description
QgsSymbologyUtils namespace containing useful methods for symbology widgets
/)
QgsSymbol encapsulates settings for drawing and classification
/)
QgsMarkerCatalogue catalogue of point symbols
/)

|

Raster layers: (in "raster" dir)
Description
QgsRasterLayer provides capability to render raster datasets
/)
QgsRasterBandStats container for statistics about a single raster band
/)
QgsRasterViewPort provides details of the viewable area that a raster will be rendered into
/)
QgsRasterPyramid used to store pyramid info for the raster layer
/)
QgsColorTable color table
/)

|

Attribute actions
Description
QgsAction encapsulates an action and associated information
/)
QgsAttributeAction stores and controls management and execution of actions for layer attributes
/)

|

QGIS Project files
Description
QgsProject implements persistent project state
/)
QgsProperty, QgsProperyValue, QgsPropertyKey helper classes for QgsProject
/)

|

Misc
Description
QgsHttpTransaction Tracks a HTTP request with its response
/)
QgsMessageOutput Interface for showing messages from QGIS in GUI independent way
/)
QgsMessageOutputConsole Displays messages to console
/)
QgsContextHelp provides a context based help browser for a dialog
/)
QgsDataSourceURI structure for storing the component parts of a PgSQL/RDBMS datasource URI
/)
QgsProviderCountCalcEvent custom event to be fired when layer count has been fully calculated used only by postgresql provider
QgsProviderExtentCalcEvent custom event to be fired when layer extent has been fully calculated used only by postgresql provider
QgsRunProcess executes external program/script, optionally captures output
/)
QgsVectorFileWriter generic vector file write
/)

|

GUI library

Class
Description
QgisGui constants used throughout the QGIS GUI
/)
QGisInterface abstract interface for exposing functions for use by plugins
/)
QgsColorButton color button
/)
QgsEncodingFileDialog file dialog which lets user select encoding for a data provider
/)
QgsFileDropEdit file dropable LineEdit
/)
QgsMessageViewer simple dialog for showing longer messages
/)

|

Map canvas
Description
QgsMapCanvas map canvas class for displaying all GIS data types
/)
QgsMapCanvasItem base class for map canvas items
/)
QgsMapCanvasMap class which holds the rendered map
/)
QgsMapTool base class for map canvas tools
/)
QgsMapToolPan tool for panning in map canvas
/)
QgsMapToolZoom tool for zooming in/out using rubberband
/)
QgsMapOverviewCanvas overview canvas
/)
QgsPanningWidget widget for panning in overview canvas
/)
QgsRubberBand rubberband for drawing multilines and polygons
/)
QgsVertexMarker map canvas item for drawing vertex markers
/)

|

Projection support
Description
QgsProjectionSelector widget for selection of projection
/)
QgsLayerProjectionSelector dialog for setting projection system for a layer
/)

|

QGIS application

Class
Description
Notes
QgisApp main window for the QGIS application too big class, should be refactored
QGisAppInterface implementation of QgisInterface
/)
QgsAbout about dialog for QGIS
/)
QgsBookmarkItem spatial bookmark item (stored in sqlite3)
/)
QgsBookmarks dialog with spatial bookmarks
/)
QgsClipboard internal clipboard for storage of features
/)
QgsMapLayerInterface interface class for map layer plugins
/)
QgsOptions dialog for setting user options and preferences routines with qgis database should be moved somewhere else
QgsNewConnection dialog for configuring connection info for a PostgreSQL db
/)
QgsPgQueryBuilder query builder for PostgreSQL
/)
QgsProjectProperties dialog used for project-wide settings
/)
QgsCustomProjectionDialog custom projection widget for defining parameters of a projection
/)
QgsIdentifyResults dialog for displaying results of identify tool
/)
QgsMapServerExport export QGIS MapCanvas to MapServer so far doesn't make use of map canvas
QgsNumericSortListViewItem a QListViewItem that can sort numerically
/)

|

Attributes handling
Description
Notes
QgsAddAttrDialog dialog for setting new attribute
/)
QgsDelAttrDialog dialog for deleting attributes
/)
QgsAdvancedAttrSearch dialog for advanced searching by attribute
/)
QgsAttributeActionDialog attribute action dialog
/)
QgsAttributeDialog dialog for viewing/editing attributes
/)
QgsAttributeTable customized QTable for displaying attribute table
/)
QgsAttributeTableDisplay dialog for browsing and editing attribute table
/)

|

Layer properties
Description
Notes
QgsDlgVectorLayerProperties unified property dialog for vector layers
/)
QgsRasterLayerProperties dialog for setting up how raster layers are displayed
/)
QgsVectorSymbologyWidget widget for setting symbology for a vector layer
/)
QgsMarkerDialog class for choosing marker SVG images by clicking icons
/)
QgsSiSyDialog dialog to set the symbology for the legend type single symbol
/)
QgsGraSyDialog dialog for graduated symbols
/)
QgsPatternDialog dialog for selecting pattern for rendering vector layers
/)
QgsContColDialog dialog for continuous color renderer
/)
QgsUValDialog
/)
QgsLUDialog
/)
QgsPointStyleWidget widget for selecting point style
/)
QgsLineStyleWidget widget for selecting line style
/)
QgsFillStyleWidget widget for selecting fill style
/)
QgsLineStyleDialog dialog for settings line styles
/)
QgsGeomTypeDialog dialog for setting new vector geometry type and attributes
/)
QgsLabelDialog dialog for setting rendering of labels for vector layer
/)

|

Map canvas tools
Description
Notes
QgsMapToolCapture tool for digitizing
/)
QgsMapToolSelect tool for selecting features using rubberband
/)
QgsMapToolVertexEdit tool for adding/moving/deleting vertices
/)
QgsMeasure tool and widget for measuring distances and areas
/)

|

Plugin management
Description
Notes
QgsPluginItem contains info about loadable plugin - name, description and full path
/)
QgsPluginMetadata stores info about loaded plugin, including pointer to the inst. object
/)
QgsPluginManager plugin manager for loading/unloading plugins
/)
QgsPluginRegistry singleton class for keeping track of installed plugins
/)

|

PostgreSQL GUI stuff
Description
Notes
QgsDbSourceSelect dialog to create connections and add tables from PostgreSQL
/)

|

WMS GUI stuff
Description
Notes
QgsNewHttpConnection dialog for configuring connection info for WMS server
/)
QgsServerSourceSelect dialog to create connections and add layers from WMS
/)
QgsPasteTransformations dialog for setting transformation from source to destination fields (using copy/paste) not implemented yet
QgsTable class to represent an attribute table related to a map layer used nowhere?

|

Composer
Description
Notes
QgsComposer dialog for composing map output
/)
QgsComposerView composer canvas
/)
QgsComposition stores map composition for printing
/)
QgsComposerItem base class for composer items
/)
QgsComposerMap represents map window
/)
QgsComposerLabel represents label
/)
QgsComposerPicture represents pictur
/)
QgsComposerScalebar represents scale bar
/)
QgsComposerVectorLegend represents vector lege
/)

|

Legend
Description
Notes
QgsLegend legend treeview
/)
QgsLegendItem abstract base class for all legend items
/)
QgsLegendGroup special legend item, items below are treated as a group
/)
QgsLegendLayerFileGroup container for layer file group
/)
QgsLegendPropertyGroup container for layer properties
/)
QgsLegendSymbologyGroup container for symbology
/)
QgsLegendLayer container for layer, including layer file(s), symbology, properties
/)
QgsLegendLayerFile legend item for layer file
/)
QgsLegendPropertyItem legend item for representing layer property
/)
QgsLegendSymbologyItem item for symbology
/)
QgsLegendVectorSymbologyItem item for symbology of a vector layer
/)

|

Python support
Description
Notes
QgsPythonDialog dialog with embedded python console
/)
QgsPythonUtils routines for interfacing Python
/)

|