1.Qgsrenderer 圖層繪制器抽象基類
每個(gè)renderer只能繪制某一種適量圖形對(duì)象, Qgsrenderer ::mVectorType
定義了適量圖層類型(QGis::VectorType)
,Qgsrenderer定義了作為一個(gè)繪圖器的基本功能接口
QgsRasterLayer 通過QgsSingleSymbolRenderer實(shí)現(xiàn)矢量對(duì)象的繪制
2.
QgsMapLayer 地圖圖層
圖層類型: VECTOR,RASTER
2.1 QgsVectorLayer矢量圖層
與QgsVectorLayer對(duì)應(yīng)的就是QgsRasterLayer , QgsMapLayer的子類圖層對(duì)象僅僅這兩種。
2.2 QgsMapCanvasLayer 畫板圖層
2.3 QgsMapLayerRegistry
存儲(chǔ)當(dāng)前所有地圖層對(duì)象,提供Layer id查詢MapLayer對(duì)象的功能mapLayer(layid)
2.4 QgsMapCanvasLayer
QgsMapCanvasLayer是qgis應(yīng)用層的圖層對(duì)象,用于村促跟用戶交互的信息,它并不是Map核心數(shù)據(jù)對(duì)象
3.QgsFeature
圖層特征對(duì)象。QgsFeature包含若干Attribute,一個(gè)QgsGeometry對(duì)象
QgsLine
QgsLine由2個(gè)QgsPoint構(gòu)成的線段
4. QgsMapRender
QgsMapCanvasMap利用此對(duì)象實(shí)現(xiàn)繪制,無子類實(shí)現(xiàn)。當(dāng)canvas產(chǎn)生事件,諸如大小調(diào)整、移動(dòng)、縮放等等請(qǐng)求時(shí),QgsMapCanvas請(qǐng)求QgsMapCanvasMap進(jìn)行刷新繪制,后者調(diào)用QgsMapRender::render()進(jìn)行繪制圖層。
Render(){
QgsMapRender內(nèi)部保留圖層名稱數(shù)組,根據(jù)圖層id到QgsMapLayerRegistry中獲取圖層對(duì)象,繪制圖層從最底部開始。
}
5.OgsMapCanvas圖層繪制板
N個(gè)圖層是繪制在QgsMapCanvasMap這個(gè)對(duì)象之上的,這個(gè)對(duì)象是Qt的繪制對(duì)象
QgsMapCanvasMap其實(shí)就是提供OgsMapRender的繪制緩沖,最終還是請(qǐng)求QgsMapRender進(jìn)行圖層繪制。
6. QgsProviderRegistry
Qgis的數(shù)據(jù)源作為一個(gè)provider將被登記在QgsProviderRegistry對(duì)象中
創(chuàng)建一個(gè)新的矢量圖層
QgsProviderRegistry中查找ogr的provider,創(chuàng)建一個(gè)ogr的矢量數(shù)據(jù)空間createEmptyDataSource
QgsOgrProvider作為QgsVectorDataProvider的子類,QgsVectorDataProvider作為接口被其他模塊訪問
new QgsVectorLayer(ogr){
new
QgsSingleSymbolRenderer()
}
QgsMapToPixel
地圖單位到屏幕像素位置的轉(zhuǎn)換,這個(gè)操作非常簡單,根據(jù)設(shè)定的每像素地圖大小單位來計(jì)算地圖單位(world)到屏幕像素的轉(zhuǎn)換,反之亦然
QgsProject 、QgsProjectFileTransform、Qgsversion
這些類用于qgis項(xiàng)目信息管理之用,項(xiàng)目文件類型名.qgs,格式是xml。QgsProjectFileTransform用于不同版本的qgis的功能文件的轉(zhuǎn)換
QgsSymbol
這個(gè)類一方面是實(shí)現(xiàn)繪制圖層類型的Icon,Qgis中如果創(chuàng)建新的line矢量層,則這個(gè)層的圖標(biāo)顯示在層顯示樹的節(jié)點(diǎn)的Icon就是用QgsSymbol繪制產(chǎn)生

另一方面,在編輯矢量圖層時(shí),添加的線段都有兩端的節(jié)點(diǎn)點(diǎn),QgsSymbol就是繪制這個(gè)節(jié)點(diǎn)

矢量圖層類型:
Point,
Line,
Polygon,
QgsMapTip
圖層地標(biāo)提示。當(dāng)鼠標(biāo)在MapCanvas上移動(dòng)時(shí),MapTip被一個(gè)定時(shí)器驅(qū)動(dòng),這時(shí)MapTip將當(dāng)前地圖坐標(biāo)作為中心點(diǎn),圍繞這個(gè)點(diǎn)產(chǎn)生一個(gè)選擇區(qū)域( double searchRadius =
mpMapCanvas->extent().width() * (QGis::DEFAULT_IDENTIFY_RADIUS / 100.0 );)
這個(gè)區(qū)域作為搜尋區(qū)域提交給ogr-provider查找地圖的Feature對(duì)象
再找Featrue的可顯示的字段,然后用QToolTip進(jìn)行顯示。 QToolTip最終是要被替換掉的
QgsFieldMap
typedef QMap<int, QgsField>
QgsFieldMap;
矢量圖層的對(duì)象具有多個(gè)屬性,可以在添加編輯對(duì)象時(shí)設(shè)置這些屬性

attributeFields[CmtAttr] = QgsField(attr[CmtAttr],
QVariant::String, "text");
以上代碼就可以添加一種屬性類型
地圖距離單位:
METERS,
FEET,
DEGREES,
Mbr : 可能全稱 Max boundary Rectangle
坐標(biāo)轉(zhuǎn)換:
1.空間坐標(biāo)轉(zhuǎn)換: long/lat坐標(biāo)投影到世界地圖坐標(biāo) 【QgsCoordinateTransform實(shí)現(xiàn)】
2.世界坐標(biāo)轉(zhuǎn)換到屏幕坐標(biāo)【QgsMapToPixel實(shí)現(xiàn)】
//數(shù)學(xué)宏
#define PI 3.1415926
//角度轉(zhuǎn)弧度
#define DEG_TO_RAD(ang) ((ang)*PI/180.0)
//弧度轉(zhuǎn)角度
#define RAD_TO_DEG(rad) ((rad)*180.0/PI)
//取得x~y之間任意一個(gè)值
#define RAND_RANGE(x,y) ((x) + rand() % ((y) - (x) + 1)))
GPX
www.gpsbabel.org
是不同gps日志數(shù)據(jù)的通用解析和轉(zhuǎn)換工具
gps log數(shù)據(jù)分類:
l
Waypoints: 我的行徑上要路過的點(diǎn)。比如我去北京,順便到徐州拜訪朋友,所以途經(jīng)的徐州是我要停留的waypoint
l
Routes: 是指所有WayPoint的集合構(gòu)成的線路
l
Tracks: 我途經(jīng)的路上所有走過的軌跡點(diǎn)(因該是最多的數(shù)據(jù)量)
WayPoint和route我理解為是面向應(yīng)用的,而Track就是基礎(chǔ)數(shù)據(jù),是物理的記錄
看看老外的注釋
> a) waypoint
A geopoint with some special tags like name, comment and the like.
Usually used to mark special locations as your home, a hotel or a
geocache. Huge collections of gas stations, post boxes, shops and the
like are called "points of interest" (aka POIs).
> b) track
A collection of geopoints recorded by your GPS device while traveling. A
trackpoint doesn't have a name or comment, but it usually has a
timestamp. This distibguishes a trackpoint from a waypoint.
> c) route
A collection of waypoints defining the route you want to pass while
traveling.