Difference between revisions of "Marble/ModelView"

Jump to: navigation, search
(Page moved to community wiki)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= ModelView framework in Marble =
+
{{ Moved To Community }}
 
+
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.
+
 
+
The multiple models in Marble each fit the purpose of feeding some GeoData classes to interested widgets. The way those models are fed could be improved however:
+
 
+
== Model and Data Location ==
+
 
+
* At the moment, each Model contains the list/vector/tree of data it presents. This is not a problem per se, unless all those models present the same data, and retain their own copies. Once the time to edit this data comes, it is tedious or quite impossible to trace back all those copies.
+
 
+
The solution to this is twofold:
+
** keep data unique in one store (wherever that is, a Model class or a list in one Manager)
+
** Try and manipulate references to the data in the Models in such a case: with one change to the central data, multiple models can be notified and each react differently for the views they feed.
+
 
+
== Model or not Model ==
+
 
+
* The Model-View framework is designed to hide the details of the model content, and to present it in a standardised way to views. The advantage of this solution is that the View need not know much about the data it presents.
+
 
+
This solution however is not a one size fit all, because an interested class with some knowledge of the GeoDataTypes for example would be far better off manipulating the methods of GeoData classes.
+
 
+
As a consequence, a choice should be made whether to access GeoData through the model-view framework (nice for a List Widget or for a generic presentation of 'data as a tree', really not so nice for a class which for example would like to calculate the bounding box of all geometric data of a GeoDataDocument, or even for the File read/write, as the knowledge of data types is really known).
+
 
+
== State of the Model ==
+
 
+
There are multiple models with various levels of implementation. Some are needed, others should die...
+
 
+
Here is the list of Model class, and a description of how they are used.
+
 
+
=== QAbstractItemModel ===
+
* {{class|GeoDataDebugModel|kdeedu|4.x}}
+
It represents a data file, parsed into a {{class|GeoDataDocument|kdeedu|4.x}} tree structure.
+
 
+
It is used by the {{class|DataViewPlugin|kdeedu|4.x}} debug plugin (and is broken atm)
+
 
+
* {{class|GpxFileModel|kdeedu|4.x}}
+
It represents a list of gpx data file 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.
+
 
+
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]]
+
 
+
* {{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 is used by the {{class|GeoRenderPlugin|kdeedu|4.x}} to access the list of vector data to draw it.
+
 
+
Action is underway to replace this class with a more generic model, which would hold all opened documents.
+
 
+
=== QAbstractListModel ===
+
* {{class|FileViewModel|kdeedu|4.x}}
+
It represents the list of opened files. The {{class|FileManager|kdeedu|4.x}} appends the documents it opens.
+
 
+
It is used by the {{class|FileViewFloatItem|kdeedu|4.x}} and manipulated by the {{class|FileManager|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 is used by no other code. It should be removed.
+
 
+
* {{class|MarblePlacemarkModel|kdeedu|4.x}}
+
It represents the list of all Placemarks of all opened files. the {{class|PlaceMarkManager|kdeedu|4.x}} appends all the placemarks after reading a file.
+
 
+
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.
+
 
+
It should be replaced by a more generic model, which would hold all open documents and provide both features and geometries. It could also be replaced with a ProxyModel around this new model.
+

Latest revision as of 04:46, 26 October 2016

This page is now on the community wiki.


This page was last modified on 26 October 2016, at 04:46. Content is available under Creative Commons License SA 4.0 unless otherwise noted.