QGis¶Á½â¡£¡£¡£
1.Qgsrenderer ͼ²ã»æÖÆÆ÷³éÏó»ùÀà
ÿ¸örendererÖ»ÄÜ»æÖÆijһÖÖÊÊÁ¿Í¼ÐζÔÏó£¬ Qgsrenderer ::mVectorType ¶¨ÒåÁËÊÊÁ¿Í¼²ãÀàÐÍ(QGis::VectorType) ,Qgsrenderer¶¨ÒåÁË×÷Ϊһ¸ö»æͼÆ÷µÄ»ù±¾¹¦ÄܽӿÚ
QgsRasterLayer ͨ¹ýQgsSingleSymbolRendererʵÏÖʸÁ¿¶ÔÏóµÄ»æÖÆ 2£® QgsMapLayer µØͼͼ²ã ͼ²ãÀàÐÍ: VECTOR,RASTER 2.1 QgsVectorLayerʸÁ¿Í¼²ã
ÓëQgsVectorLayer¶ÔÓ¦µÄ¾ÍÊÇQgsRasterLayer , QgsMapLayerµÄ×ÓÀàͼ²ã¶ÔÏó½ö½öÕâÁ½ÖÖ¡£
2.2 QgsMapCanvasLayer »°åͼ²ã 2.3 QgsMapLayerRegistry
´æ´¢µ±Ç°ËùÓеØͼ²ã¶ÔÏó,ÌṩLayer id²éѯMapLayer¶ÔÏóµÄ¹¦ÄÜmapLayer(layid) 2.4 QgsMapCanvasLayer
QgsMapCanvasLayerÊÇqgisÓ¦ÓòãµÄͼ²ã¶ÔÏó£¬ÓÃÓÚ´å´Ù¸úÓû§½»»¥µÄÐÅÏ¢£¬Ëü²¢²»ÊÇMapºËÐÄÊý¾Ý¶ÔÏó 3.QgsFeature
ͼ²ãÌØÕ÷¶ÔÏó¡£QgsFeature°üº¬Èô¸ÉAttribute£¬Ò»¸öQgsGeometry¶ÔÏó QgsLine
QgsLineÓÉ2¸öQgsPoint¹¹³ÉµÄÏ߶Π4. QgsMapRender
QgsMapCanvasMapÀûÓô˶ÔÏóʵÏÖ»æÖÆ£¬ÎÞ×ÓÀàʵÏÖ¡£µ±canvas²úÉúʼþ£¬ÖîÈç´óСµ÷Õû¡¢Òƶ¯¡¢Ëõ·ÅµÈµÈÇëÇóʱ£¬QgsMapCanvasÇëÇóQgsMapCanvasMap½øÐÐˢлæÖÆ£¬ºóÕßµ÷ÓÃQgsMapRender::render()½øÐлæÖÆͼ²ã¡£ Render(){
QgsMapRenderÄÚ²¿±£Áôͼ²ãÃû³ÆÊý×飬¸ù¾Ýͼ²ãidµ½
QgsMapLayerRegistryÖлñȡͼ²ã¶ÔÏ󣬻æÖÆͼ²ã´Ó×îµ×²¿¿ªÊ¼¡£ }
5.OgsMapCanvasͼ²ã»æÖÆ°å
N¸öͼ²ãÊÇ»æÖÆÔÚQgsMapCanvasMapÕâ¸ö¶ÔÏóÖ®Éϵģ¬Õâ¸ö¶ÔÏóÊÇQtµÄ»æÖƶÔÏó
QgsMapCanvasMapÆäʵ¾ÍÊÇÌṩOgsMapRenderµÄ»æÖÆ»º³å£¬×îÖÕ»¹ÊÇÇëÇóQgsMapRender½øÐÐͼ²ã»æÖÆ 6. QgsProviderRegistry
QgisµÄÊý¾ÝÔ´×÷Ϊһ¸öprovider½«±»µÇ¼ÇÔÚQgsProviderRegistry¶ÔÏóÖÐ
´´½¨Ò»¸öеÄʸÁ¿Í¼²ã
QgsProviderRegistryÖвéÕÒogrµÄprovider£¬´´½¨Ò»¸öogrµÄʸÁ¿Êý¾Ý¿Õ¼äcreateEmptyDataSource
QgsOgrProvider×÷ΪQgsVectorDataProviderµÄ×ÓÀ࣬QgsVectorDataProvider×÷Ϊ½Ó¿Ú±»ÆäËûÄ£¿é·ÃÎÊ new QgsVectorLayer(ogr){
new QgsSingleSymbolRenderer() }
QgsMapToPixel
µØͼµ¥Î»µ½ÆÁÄ»ÏñËØλÖõÄת»»£¬Õâ¸ö²Ù×÷·Ç³£¼òµ¥£¬¸ù¾ÝÉ趨µÄÿÏñËصØͼ´óСµ¥Î»À´¼ÆËãµØͼµ¥Î»(world)µ½ÆÁÄ»ÏñËصÄת»»£¬·´Ö®ÒàÈ» QgsProject ¡¢QgsProjectFileTransform¡¢Qgsversion
ÕâЩÀàÓÃÓÚqgisÏîÄ¿ÐÅÏ¢¹ÜÀíÖ®Óã¬ÏîÄ¿ÎļþÀàÐÍÃû.qgs,¸ñʽÊÇxml¡£QgsProjectFileTransformÓÃÓÚ²»Í¬°æ±¾µÄqgisµÄ¹¦ÄÜÎļþµÄת»» QgsSymbol
Õâ¸öÀàÒ»·½ÃæÊÇʵÏÖ»æÖÆͼ²ãÀàÐ͵ÄIcon£¬QgisÖÐÈç¹û´´½¨ÐµÄlineʸÁ¿²ã£¬ÔòÕâ¸ö²ãµÄͼ±êÏÔʾÔÚ²ãÏÔʾÊ÷µÄ½ÚµãµÄIcon¾ÍÊÇÓÃQgsSymbol»æÖƲúÉú
ÁíÒ»·½Ãæ,ÔÚ±à¼Ê¸Á¿Í¼²ãʱ£¬Ìí¼ÓµÄÏ߶ζ¼ÓÐÁ½¶ËµÄ½Úµãµã£¬QgsSymbol¾ÍÊÇ»æÖÆÕâ¸ö½Úµã
ʸÁ¿Í¼²ãÀàÐÍ: Point, Line, Polygon, QgsMapTip
ͼ²ãµØ±êÌáʾ¡£µ±Êó±êÔÚMapCanvasÉÏÒƶ¯Ê±,MapTip±»Ò»¸ö¶¨Ê±Æ÷Çý¶¯£¬Õâʱ
MapTip½«µ±Ç°µØͼ×ø±ê×÷ΪÖÐÐĵ㣬ΧÈÆÕâ¸öµã²úÉúÒ»¸öÑ¡ÔñÇøÓò( double searchRadius = mpMapCanvas->extent().width() * (QGis::DEFAULT_IDENTIFY_RADIUS / 100.0 );) Õâ¸öÇøÓò×÷ΪËÑÑ°ÇøÓòÌá½»¸øogr-provider²éÕÒµØͼµÄFeature¶ÔÏó ÔÙÕÒFeatrueµÄ¿ÉÏÔʾµÄ×ֶΣ¬È»ºóÓÃQToolTip½øÐÐÏÔʾ¡£ QToolTip×îÖÕÊÇ
Òª±»Ìæ»»µôµÄ
QgsFieldMap
typedef QMap
ʸÁ¿Í¼²ãµÄ¶ÔÏó¾ßÓжà¸öÊôÐÔ£¬¿ÉÒÔÔÚÌí¼Ó±à¼¶ÔÏóʱÉèÖÃÕâЩÊôÐÔ
attributeFields[CmtAttr] = QgsField(attr[CmtAttr], QVariant::String, \
ÒÔÉÏ´úÂë¾Í¿ÉÒÔÌí¼ÓÒ»ÖÖÊôÐÔÀàÐÍ
µØͼ¾àÀ뵥λ:
METERS,