Marble/ModelView: Difference between revisions

From KDE Community Wiki
No edit summary
No edit summary
Line 1: Line 1:
== ModelView framework in Marble ==
== ModelView framework in Marble ==


Marble uses Qt's Model/View framework as a way to signal updates to a model to interested parts. In that respect, a Model class can wrap any possible data.
Marble uses Qt's Model/View framework as a way to signal updates in a model to interested parts. In that respect, a Model class can wrap any possible data.


Here is the list of Model class, and a description of how they are used.
Here is the list of Model classes, and a description of how they are used.


=== QAbstractItemModel ===
=== QAbstractItemModel ===
* {{class|GeoDataDebugModel|kdeedu|4.x}}
* {{class|GeoDataDebugModel|kdeedu|4.x}}
It represents a data file, parsed into a {{class|GeoDataDocument|kdeedu|4.x}} tree structure.
It represents the tree of {{class|GeoDataObject|kdeedu|4.x}} elements corresponding to a {{class|GeoDataDocument|kdeedu|4.x}}.


It is used by the {{class|DataViewPlugin|kdeedu|4.x}} debug plugin (and is broken atm)
It is used by the {{class|DataViewPlugin|kdeedu|4.x}} debug plugin (and is broken atm).


* {{class|GpxFileModel|kdeedu|4.x}}
* {{class|GpxFileModel|kdeedu|4.x}}
It represents a list of gpx data file represented as {{class|GpxFile|kdeedu|4.x}}
It represents a list of gpx data files represented as {{class|GpxFile|kdeedu|4.x}}


This was originally intended to but used as the model for the File List View ( which is accessible by running marble with --enableFileView ) but has since been replaced by the FileViewModel.
This was originally intended to but used as the model for the File List View ( which is accessible by running marble with --enableFileView ) but has since been replaced by the FileViewModel.


The model that is in the GpsLayer is currently only being used as a collection class and is deprecated. This, along with the whole current GPX implementation, needs to be removed and updated to the current concepts in Marble. See [[Projects/Marble/GPXStatus|Gpx Status]]
The model is used as a member in the GpsLayer to hold the list of gpx files as a collection class and is deprecated. This, along with the whole current GPX implementation, needs to be removed and updated to the current concepts in Marble. See [[Projects/Marble/GPXStatus|Gpx Status]]


* {{class|MarbleGeometryModel|kdeedu|4.x}}
* {{class|MarbleGeometryModel|kdeedu|4.x}}
It represents the {{class|GeoDataGeometry|kdeedu}} and the {{class|GeoDataFeature|kdeedu|4.x}} items of the last opened {{class|GeoDataDocument|kdeedu|4.x}}.
It represents the {{class|GeoDataGeometry|kdeedu}} and the {{class|GeoDataFeature|kdeedu|4.x}} items of the last opened {{class|GeoDataDocument|kdeedu|4.x}}.


It is used by the {{class|GeoRenderPlugin|kdeedu|4.x}} to access the list of vector data to draw it.
It is used by the {{class|GeoRenderPlugin|kdeedu|4.x}} to access the list of vector data and draw it.


=== QAbstractListModel ===
=== QAbstractListModel ===
* {{class|FileViewModel|kdeedu|4.x}}
* {{class|FileViewModel|kdeedu|4.x}}
It represents the list of opened files. The {{class|PlacemarkManager|kdeedu|4.x}} appends the documents it opens, and the {{class|MarbleWidget|kdeedu}} appends the gpx files it opens.
It represents the list of opened files. The {{class|FileManager|kdeedu|4.x}} signals it about the documents it opens or closes.


It is used by the {{class|FileViewFloatItem|kdeedu|4.x}} and manipulated by the {{class|PlaceMarkManager|kdeedu|4.x}} and the {{class|MarbleModel|kdeedu|4.x}}.
It is used by the {{class|FileViewFloatItem|kdeedu|4.x}} and by a List widget in the {{class|MarbleControlBox|kdeedu|4.X}}.


* {{class|MarbleGeoDataModel|kdeedu|4.x}}
* {{class|MarbleGeoDataModel|kdeedu|4.x}}
It represents a list of {{class|GeoDataDocuments|kdeedu|4.x}}. Only the {{class|PlacemarksPlugin|kdeedu|4.x}} uses it
It represents a list of {{class|GeoDataDocuments|kdeedu|4.x}}. Only the {{class|PlacemarksPlugin|kdeedu|4.x}} uses it.


It is used by no other code.
It is used by no other code.


* {{class|MarblePlacemarkModel|kdeedu|4.x}}
* {{class|MarblePlacemarkModel|kdeedu|4.x}}
It represents the list of all Placemarks of all opened kml files. the {{class|PlaceMarkManager|kdeedu|4.x}} appends all the placemarks after reading a file.
It represents a list of Placemarks.


It is used by the {{class|MarbleControlBox|kdeedu|4.X}} to provide the list of placemarks to search for, and by the {{class|PlacemarkLayout|kdeedu|4.x}} to determine layouting on the map.
The {{class|PlaceMarkManager|kdeedu|4.x}} appends all the placemarks contained in the {{class|GeoDataDocument|kdeedu|4.x}} it knows about in its instance.
 
The {{class|MarbleRunnerManager|kdeedu|4.x}} appends the list of placemarks that the Runners found in its instance.
 
It is used by the {{class|MarbleControlBox|kdeedu|4.X}} to provide a list of placemarks (either from the PlacemarkManager or from the MarbleRunnerManager).
 
It is also used by the {{class|PlacemarkLayout|kdeedu|4.x}} to determine layouting on the map.

Revision as of 16:14, 13 September 2009

ModelView framework in Marble

Marble uses Qt's Model/View framework as a way to signal updates in a model to interested parts. In that respect, a Model class can wrap any possible data.

Here is the list of Model classes, and a description of how they are used.

QAbstractItemModel

It represents the tree of GeoDataObject elements corresponding to a GeoDataDocument.

It is used by the DataViewPlugin debug plugin (and is broken atm).

It represents a list of gpx data files represented as GpxFile

This was originally intended to but used as the model for the File List View ( which is accessible by running marble with --enableFileView ) but has since been replaced by the FileViewModel.

The model is used as a member in the GpsLayer to hold the list of gpx files as a collection class and is deprecated. This, along with the whole current GPX implementation, needs to be removed and updated to the current concepts in Marble. See Gpx Status

It represents the GeoDataGeometry and the GeoDataFeature items of the last opened GeoDataDocument.

It is used by the GeoRenderPlugin to access the list of vector data and draw it.

QAbstractListModel

It represents the list of opened files. The FileManager signals it about the documents it opens or closes.

It is used by the FileViewFloatItem and by a List widget in the MarbleControlBox.

It represents a list of GeoDataDocuments. Only the PlacemarksPlugin uses it.

It is used by no other code.

It represents a list of Placemarks.

The PlaceMarkManager appends all the placemarks contained in the GeoDataDocument it knows about in its instance.

The MarbleRunnerManager appends the list of placemarks that the Runners found in its instance.

It is used by the MarbleControlBox to provide a list of placemarks (either from the PlacemarkManager or from the MarbleRunnerManager).

It is also used by the PlacemarkLayout to determine layouting on the map.