MapGuide OpenSource/Enterprise中選中地物時預設是用藍色表示的。但如果我的地圖上已經有藍色地物了,很容易弄混,能不能自己定義選中地物的顏色呢?
嗯,沒問題,可以的!
MapGuide Enterprise 2009 Update1中,對應的開源版本2.0以後版本
對應Ajax簡答網頁布局:
..\www\viewerfiles\ajaxmappane.templ
line 334
var selectionColor = '0x0000FFFF'; // Blue
改成你希望的顏色就行了
The value is 0xRRGGBBaa where each is a hex value from 0-255 representing your RGB and transparency (alpha) values. Currently I'm not seeing the alpha value have any impact as either FF or 00 so I don't think it's being used.
Don't mistakenly try to use HTML hex color codes as this is an RGB color code.
Here's a site with sample color values.
http://www.blythe.org/webwork/alphacolor.html
對於Flexible靈活網頁布局(MapGuide Enterprise 2010中,2009中沒有):
在ApplicationDefinition.xml中有一個<SelectionColor> 可以對選中地物的顏色進行設定。
這個檔案在哪裡?C:\Program Files\Autodesk\MapGuideEnterprise2010\WebServerExtensions\www\fusion\templates\mapguide\slate
Slate是MapGuide Studio裡面對應的模版名字,你要用別的模版的話就改對應目錄下的ApplicationDefinition.xml。
<MapSet>
<MapGroupType id="Sheboygan">
<Map>
<Type>MapGuide</Type>
<SingleTile>true</SingleTile>
<Extension>
<ResourceId>Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition</ResourceId>
<SelectionAsOverlay>true</SelectionAsOverlay>
<SelectionColor>0x0000FFA0</SelectionColor>
</Extension>
</Map>
<Extension />
</MapGroupType>
</MapSet>
注意: 通過這種方式更改的是模版檔案,只有建立靈活網頁布局時才會生效,對已有的Flexible weblayout不起作用!!!如果你想一勞永逸,以後所有建立的靈活網頁布局都用這種選中顏色,那就使用這種方案。如果你只想更改當前這一個靈活網頁布局的選中顏色,不想改其他的,那麼往下看。
要想更改當前的靈活網頁布局的選中顏色,最簡單的辦法就是MapGuide Studio中的Map 選項卡,點“Edit Map Groups”按鈕出現xml和上面的類似,更改SelectionColor 的值後,儲存靈活網頁布局即可。
For Flexible Web Layouts in MGE 2010 there is a setting exposed in the Flexible Web Layout definition seen through Studio. The user should click the Edit Map Groups button on the Map component panel of the Flexible Layout and contained within each map group section there is a <SelectionColor> setting which allows the Author to specify the selection color for each map. Again the same values as above apply. In MGE 2009 no setting is exposed.
http://sandbox.mapguide.com/index.php/Change_Selection_Color_Setting
好了,先到這裡。 有問題的話論壇提問: www.newmgdn.com/bbs