[QGIS Commit] r15192 - in trunk/qgis: images images/themes/default src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Feb 18 05:30:57 EST 2011


Author: timlinux
Date: 2011-02-18 02:30:56 -0800 (Fri, 18 Feb 2011)
New Revision: 15192

Added:
   trunk/qgis/images/themes/default/mActionLocalHistogramStretch.png
Modified:
   trunk/qgis/images/images.qrc
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
Log:
Added local histogram stretch icon to the new raster toolbar and wired it up so it works

Modified: trunk/qgis/images/images.qrc
===================================================================
--- trunk/qgis/images/images.qrc	2011-02-18 09:49:14 UTC (rev 15191)
+++ trunk/qgis/images/images.qrc	2011-02-18 10:30:56 UTC (rev 15192)
@@ -3,6 +3,7 @@
     <file>north_arrows/gpsarrow.svg</file>
     <file>north_arrows/gpsarrow2.svg</file>
     <file>themes/default/mActionAddArrow.png</file>
+    <file>themes/default/mActionLocalHistogramStretch.png</file>
     <file>themes/newgis/mActionAddGPSLayer.png</file>
     <file>themes/newgis/mActionAddImage.png</file>
     <file>themes/newgis/mActionAddIsland.png</file>

Added: trunk/qgis/images/themes/default/mActionLocalHistogramStretch.png
===================================================================
--- trunk/qgis/images/themes/default/mActionLocalHistogramStretch.png	                        (rev 0)
+++ trunk/qgis/images/themes/default/mActionLocalHistogramStretch.png	2011-02-18 10:30:56 UTC (rev 15192)
@@ -0,0 +1,36 @@
+‰PNG
+
+   
+IHDR   B   C   (ÓM  
+ziCCPICC Profile  xÕ–gTSÙÇϽ鍒 RBcôzo¢J(1†*bGT`DE¡*8*EÆ‚ˆbaP°; ƒ€2DEåÝÀÃq½õæÛûòvÖ9ë—ÿÞÙ÷äžsÖú@¾Áäña ’¸)|WzhX8÷À@%d²’yö¾¾žàãÃ0€É»:‚^ÿXöߢìèd /’Žb'³’>‡˜Å㧠 ·#zz
+aÔ„ÅøÈ.pìŸpÔw/Öú;"5 À“™L~, ¤?žÆŠEúÑësÙ.ÂÆÛ°â˜l„‘ÐNJZ/àã«GýÐ'öf2£¾÷d2c¿óÒA~‰<؉“ÌKdn\üò¿œ’S‘÷µTd&s½{#ŒI6ÓÉc™y‰‹{¶¨Gsƒ–un”·Ï2Çð]ü—™—âðû.ë™qŽÞ˝ìü½O<Ó]°g‹ýù©þAËœœà¼Ì™q!ËÌŽvú®Çp\Ë:'…ñýY	ë=¾¯xgà
+èÀ	.~è p D!Ø+พ·‘ωK¡Û#'/Z›Îà²tµé†ú‚ôÿMîÜÒbßÝY¼K¤à8ÿ[Ëè Àº9ÏÔ¿µ	 NU •ÿ·¦j‚\¤¶µ€•ÊO[ê'8ê ˆ@ˆ) ”€:ÐAÞ§)°vÈv> „µ€â@àƒt¶ƒöƒC T€ œg@¸ ®€ëà6èCà1ãà˜À<A8ˆÑ )HR´ CȲœ!OÈ
+ƒ"¡Xˆ¥BYÐN(*„J¡J¨ú:]nBÐChš‚ÞBŸaL†Å`YXÖƒÍa{Ø„×À±ð8Ά÷Á%p|n…¯À·á!x~Ï¢ Š„’@) tPæ(G”*ƒâ£¶ rQŨ*TªÕƒº‹AM£>¡±hšŽÖA[¡ÝÐAhzz:]Š®C·¢»ÑwÑ£èô7#ƒÑÂXb˜PL,&“ƒ)ÆÔ`Z0×0C˜qÌ,+UÚaÝ°aØxì&l>ö(¶Û‰ÀŽagq8œNgóÁ1q)¸ÜÜIÜeÜ n÷OÂËã
+ñ.øp<¿_ŒoÀ_Ââ'ðó‚
+Á’àC`6
+Õ„ÂÂ8až(JT#Z‰ñÄíÄbññ	ñ‰DR$YüHÒ6R	é4éi”ô‰L%k’ÉäTò>r-¹“üüŽB¡¨Rì(á”Ê>J=å*åå£MHWˆ!ÄÚ*T&Ô*4(ôZ˜ ¬"l/¼V8S¸Xø¬ðái‚ˆªˆ£Sd‹H™Èy‘û"³¢4QQÑ$Ñ|ÑÑ›¢“TU•êLeS³©'¨W©c4M‰æHcÑvÒªi×hãbX151†X¼XžØ)±>±qª¸±x°x†x™øEñ	”„ªC"Q¢@âŒÄ°Äç²+ìWD¯Ø»¢iÅàŠ9É•’v’Ñ’¹’Í’C’Ÿ¥èRÎR	R¤Ú¤žJ£¥5¥ý¤Ó¥I_“ž^)¶Òj%keîÊ3+ÉÀ2š2þ2›dNÈôÊÌÊÊɺÊòdÈ^•–“³“‹—+’»$7%O“·‘çÈÉ_–I§ÛÓé%ônúŒ‚Œ‚›BªB¥BŸÂ¼¢šbâÅfŧJD%s¥¥"¥.¥eye/å,åFåG*s•8•Ã*=*sªjª!ª»UÛT'Õ$Õj™jjOÔ)ê¶êÔ«Ôïi`5Ì54Žjôkš&šqšešw´`-S-ŽÖQ­mŒ¶…6W»Jû¾YÇ^'M§QgTWB×Sw‡n›îk=e½p½z=zßôMôõ«õP
+Ü
+vt¼5Ô4d–Þ3¢¹m5j7zc¬em|Ìø	ÍÄËd·I—ÉWS3S¾i“é”™²Y¤Y¹Ù}s1s_ó|ó‹­,>YšZ¦Xž±üËJÇ*ÁªÁjr•ÚªèUիƬ­™Ö•Ö#6t›H›ã6#¶
+¶LÛ*ÛçvJvl»»	{
+ûxû“ö¯ôø-sŽ–Ž›;PN®N¹N}ÎTç çRçg.Š.±..3®&®›\;Ý0nnÜî3d,F=cÆÝÌ}³{·Ù#À£Ô㹧¦'ß³Ãör÷:èõÄ[Å›ëÝæ|>}žúªùnðýÕëçëWæ÷ÂßÀ?Ë¿'€°. !àC C`Aàã õ Ô ®`áàˆàú๧Â‘P½ÐÍ¡·Ã¤Ã8aíá¸ðàðšðÙÕΫ­0‰È‰^£¶&cÍ͵Òk×^\'¼Ž¹îl$&2$²!òÓ‡YÅœbD•GÍ°Y‡Y¯Øvì"öT´utaôDŒuLaÌd¬uìÁØ©8Û¸â¸iŽ#§”ó&Þ-¾"~.Á'¡6a!1$±9	Ÿ™tžKå&p»×Ë­ÏX?ÀÓâåðF6Xn8´a†ïÁ¯I†’×$·§ˆ!æ¦7U=uWêhšMZYÚÇôàô³¢܌ލš÷nœÈtÉüyzkSW–BÖö¬ÑÍö›+·@[¢¶tmUÚš½u|›ë¶ºíÄí	ÛÛ¡¿£pÇû!;;²e³·eírÝÕ˜#”ÃϹ¿ÛjwÅôΞ¾½F{ìý–Ë핧ŸWœ÷%Ÿ•ë'ƒŸJ~Zس¯¯À´àØ~ì~îþá¶ê
+E3Çzl-¢å½?´îÐÍbãâŠÃÄé‡GJ<Kڏ(ÙäKi\éP™CYs¹LùÞò¹£ì£ƒÇìŽ5UÈVäU|>Î9þ Òµ²µJµªøöDÚ‰ÕÁÕ=?›ÿ\_#]“Wóµ–[;Rç_×]oV_ß ÓPÐ7¦6NŒ8ÙÊéT{“NSe³DsÞip:õôË_">ãq¦ë¬ùÙ¦s*çÊ[h-¹­PëÆÖ™¶¸¶‘ö°öóîç»:¬:Z~Õýµö‚Â…²‹â./e_Z¸œyy¶“×9}%öÊX׺®ÇWC¯Þëöëî»æqíÆu—ëW{ì{.ß°¾qá¦åÍó·ÌoµÝ6½ÝÚkÒÛò›Éo-}¦}­wÌî´÷[ôw¬¸4h;xå®ÓÝë÷÷ny
+
+?¸qäûÁäÃćo¥=š¼í	æIîS‘§ÅÏdžUý®ñ{óˆéÈÅQ§ÑÞçϏ±Æ^ý‘üÇ—ñì”Åòõ“†“¦\¦ú_®~9þŠ÷j~:çOÑ?Ë_«¿>÷—Ý_½3¡3ãoøoÞæ¿“zWûÞø}׬ïì³Iæçr?J}¬ûdþ©çsÈç‰ùô/¸/%_5¾v|óøöd!iaÇä3½ 
+™á˜ ÞÖ@	€Ö ±sÉ/V at K>aŸAü/ùæÅŒ) ՝ ¬ŸÀΕ"¬Šš kˆØ:ØÈèû@A$Ç.DF¼#¦saáí ¸H ¾ö-,Ì—,,|-F¼Î{ .{/yqAµ~ ƒŠ ød]•iÚ&P~Œöñé.7õ   	pHYs     šœ  #IDATxí[[H]^ÚI¨Yy¡”^„D¨—J/¤¥¦YjH˜ÐCEFFãC ˆ½ÙK‚™wÃK^SÑò† ^ÂR
+/”T*ên­Ý™h윳gΙõgöì½Ö^{­o_מ9Œ1°ÀÓá7¶‘`a¡\¬akD(°åþ³[ª,ŒÂl´²hGåºÐÚn‘Åj€ˆF%y"EÛ˜O¶°K[jÂÃÃcw¼{¦i½¦”µ)ÆINN÷Ñ£G°±±¡09·%@¬¯¯Cjj*ŒÃââ"”––©S§Lv]ÙÜ– ÑÚÚ
+###066ÞÞÞ011«««ðäÉ¥ufæhˆ
+~ò9¡]ò£Ë)NÎZZZ:Þ¿ÏüüüØüü¼¢\‡Œ„:D>š†·µµq£ÎŸ?¯èïcÇŽÁåË—áñãÇŠrÓ2*Ð"D9é1"RRRXII‰M£2™žžf¾¾¾liiIÉp/'aõí5"¾|ùÝÝݐžžn·£9çΝÊ.ßÈBS˲²2¾[xyy9ôéÞ½{PTTäoÃT ***àêÕ«N}9sæìÚµz{{ÊéÍ4
+ˆOŸ>ñm’†¾ˆnÞ¼	Ïž=‰éÊ7
+ˆ††HJJ‚Ý»wÈÌÌ„ÚÚZX^^Êê%`*‰‰‰ªì>pà DDDÀË—/UÉë!d
++++ÐÕÕ.\Pmóµk×€W³È :;;áäÉ“ü8­Ö±+W®Àëׯáëׯj«¸%g
+pñâEM†îß¿âââ ººZS=W…M¢©©‰‡ÜZ¼~ý:¼xñBk5—ä
+ƒ)øùó'?~\³			Ðß߈i®«µ‚á@´··Cll¬V»¸üž={ >>êêê\ª¯¥’á@P´IsÝU¢œššW««¯§"2£èj•U¥xÅðâ…ÍÎΪ’·'D‘(Æ&w{l5e
+mmôùîÝ;õ=³I’´˜˜¨¯¯ßÄÑ7kèÔèèèÐtˆrä…íF¯†Aw“j‚,G ÈåtÛMº~üø!éžLEoÝ#8}ú4477»§ÈImÀèééáÇjg—0Nìú‡eôîaîn››‘ ‹]:¡Òµ¿dî¤ì9J;OXXÐlÄÂÂLMMñy­§Ñiii†í† /o 22’ß=ê
+DUU¬­­é©–ë2ˆW¯^Lz]÷‡††M;½É h¡T{-§Õ¡ŒŒ¨¬¬ÔZM(¯;}}}pðàA8zô¨°qWº¬ÑûbWw è¶úÒ¥K®ø¨ªít¸¢vô$݁xþü¹ÃWzz~ãÆ
+xúô©^ê¸]ºL9qâÄ#)}ûö퟼+TŸôÈD§Ìááaøøñ£\ä~ª"V§xž¶&?ÚM³²²X~~>›››c,88˜íÝ»—þaW^m!Õ÷ôôäúH/éðà»sçŽ
+	ï#„¨„qræÐçÏŸGŒR’Û·oOéYÏŸ¬wff†·‡¯eó¥2„~ê65rssáöíÛpèÐ!Àƒ¼¼<		ìIā	¡1Ž¦ú4åHé%ý““ÙÙÙÄvŸ5þW¹„Ïœ°5ùQ‘â÷PìðáÃÖŠrÊ
+
+±7oÞüS®¥€ê“žÍôýûw†à0Æ6³þÎK˜v‚P •"Nö€øöíÃ+//—ÅLMñÃ>õ>|øà¨]	B?…¨„qÚõ•Ý½{WÙ’´¸¸˜áTáë“$,ú)@%¤ˆ9M_ÅMNN2üH”„[·nÉì-Mùô|øð!etƒn#	S¡ŸBTBŠ8U2<ÝñQ€Wq2k[¤ø½&»ÿ>
+
+bgÏžåÛ,&áOè§PÀ¦Ô†@ì´ŸÍ~¡Ÿ¿ýC÷S²¢³·=§-ìY©‘Žÿ_·ÕNGÃÂÖƒÊÉlkDX#B‰€5"”xXk„
+_“v Žü'    IEND®B`‚
\ No newline at end of file

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2011-02-18 09:49:14 UTC (rev 15191)
+++ trunk/qgis/src/app/qgisapp.cpp	2011-02-18 10:30:56 UTC (rev 15192)
@@ -1209,6 +1209,12 @@
   mWindowActions = new QActionGroup( this );
 #endif
 
+  // Raster toolbar items
+  mActionLocalHistogramStretch = new QAction( getThemeIcon( "mActionmRasterLocalHistogramStretch.png" ), tr( "Local Histogram Stretch" ), this );
+  mActionLocalHistogramStretch->setStatusTip( tr( "Stretch histogram of active raster to view extents" ) );
+  connect( mActionLocalHistogramStretch, SIGNAL( triggered() ), this, SLOT( localHistogramStretch() ) );
+
+
   // Help Menu Items
 
   mActionHelpContents = new QAction( getThemeIcon( "mActionHelpContents.png" ), tr( "Help Contents" ), this );
@@ -1864,7 +1870,15 @@
   mHelpToolBar->addAction( mActionHelpContents );
   mHelpToolBar->addAction( QWhatsThis::createAction() );
   mToolbarMenu->addAction( mHelpToolBar->toggleViewAction() );
+  
+  //
+  // Raster Toolbar
+  mRasterToolBar = addToolBar( tr( "Raster" ) );
+  mRasterToolBar->setObjectName( "Raster" );
+  mRasterToolBar->addAction( mActionLocalHistogramStretch );
+  mToolbarMenu->addAction( mRasterToolBar->toggleViewAction() );
 
+
   //Label Toolbar
   mLabelToolBar = addToolBar( tr( "Label" ) );
   mLabelToolBar->setObjectName( "Label" );
@@ -2070,6 +2084,7 @@
   mActionOptions->setIcon( getThemeIcon( "/mActionOptions.png" ) );
   mActionConfigureShortcuts->setIcon( getThemeIcon( "/mActionOptions.png" ) );
   mActionHelpContents->setIcon( getThemeIcon( "/mActionHelpContents.png" ) );
+  mActionLocalHistogramStretch->setIcon( getThemeIcon( "/mActionLocalHistogramStretch.png" ) );
   mActionQgisHomePage->setIcon( getThemeIcon( "/mActionQgisHomePage.png" ) );
   mActionAbout->setIcon( getThemeIcon( "/mActionHelpAbout.png" ) );
   mActionDraw->setIcon( getThemeIcon( "/mActionDraw.png" ) );
@@ -5459,6 +5474,48 @@
   delete optionsDialog;
 }
 
+void QgisApp::localHistogramStretch()
+{
+  QgsMapLayer * layer = mMapLegend->currentLayer();
+
+  if ( !layer )
+  {
+    QMessageBox::information( this,
+                              tr( "No Layer Selected" ),
+                              tr( "To perform a local histogram stretch, you need to have a raster layer selected." ) );
+    return;
+  }
+
+  QgsRasterLayer* rlayer = qobject_cast<QgsRasterLayer *>( layer );
+  if ( !rlayer )
+  {
+    QMessageBox::information( this,
+                              tr( "No Raster Layer Selected" ),
+                              tr( "To perform a local histogram stretch, you need to have a raster layer selected." ) );
+    return;
+  }
+  if ( rlayer->drawingStyle() == QgsRasterLayer::SingleBandGray ||
+       rlayer->drawingStyle() == QgsRasterLayer::MultiBandSingleBandGray
+    )
+  {
+    rlayer->setContrastEnhancementAlgorithm( "StretchToMinimumMaximum" );
+    rlayer->setMinimumMaximumUsingLastExtent();
+    rlayer->setCacheImage(NULL);
+    //refreshLayerSymbology( rlayer->getLayerID() );
+    mMapCanvas->refresh();
+    return;
+  }
+  else
+  {
+    QMessageBox::information( this,
+      tr( "No Valid Raster Layer Selected" ),
+      tr( "To perform a local histogram stretch, you need to have a grayscale "
+        "(multiband single layer, or singleband grayscale) raster layer "
+        "selected." ) );
+    return;
+  }
+}
+
 void QgisApp::helpContents()
 {
   openURL( "index.html" );

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2011-02-18 09:49:14 UTC (rev 15191)
+++ trunk/qgis/src/app/qgisapp.h	2011-02-18 10:30:56 UTC (rev 15192)
@@ -361,6 +361,7 @@
     QToolBar *attributesToolBar() { return mAttributesToolBar; }
     QToolBar *pluginToolBar() { return mPluginToolBar; }
     QToolBar *helpToolBar() { return mHelpToolBar; }
+    QToolBar *rasterToolBar() { return mRasterToolBar; }
 
     //! run python
     void runPythonString( const QString &expr );
@@ -498,6 +499,8 @@
     void zoomToLayerExtent();
     //! zoom to actual size of raster layer
     void zoomActualSize();
+    //! perform a local histogram stretch on the active raster layer (stretch based on pixel values in view extent)
+    void localHistogramStretch();
     //! plugin manager
     void showPluginManager();
     //! load python support if possible
@@ -876,6 +879,7 @@
     QToolBar *mAttributesToolBar;
     QToolBar *mPluginToolBar;
     QToolBar *mHelpToolBar;
+    QToolBar *mRasterToolBar;
     QToolBar *mLabelToolBar;
 
     // actions for menus and toolbars -----------------
@@ -1013,6 +1017,8 @@
     QAction *mActionHelpSeparator2;
     QAction *mActionAbout;
 
+    QAction *mActionLocalHistogramStretch;
+
     QAction *mActionMoveLabel;
     QAction *mActionRotateLabel;
     QAction *mActionChangeLabelProperties;



More information about the QGIS-commit mailing list