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>

 

注意: 通过这种方式更改的是模版文件,只有新建灵活网页布局时才会生效,对已有的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.

 

好了,先到这里。 有问题的话论坛提问: www.newmgdn.com/bbs

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值