MapGuide中如何更改选中地物的颜色?
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>
要想更改当前的灵活网页布局的选中颜色,最简单的办法就是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.
好了,先到这里。 有问题的话论坛提问: www.newmgdn.com/bbs