ColdFusion9支持Google MAP

   ColdFusion9开始,可以支持Google MAP。这个在Flex/Flash中早已经支持这一特征,现在轮到CF9,其实CF9是使用Google Map API for Javascript处理的。

  例子文件:

  welcome.cfm

 

<cfajaximport params="#{googlemapkey='注册一个google map key'}#">
<cfmap
centerlatitude="28.0670"
centerlongitude="117.1370"
zoomlevel="14"
name="map1"
type="map"
tip="不要指俺家"
zoomControl="small3D"
markerbind="cfc:c008.getMapData({cfmapname}, {cfmaplatitude}, {cfmaplongitude}, {cfmapaddress})"
showmarkerwindow = true
showallmarkers=false>
<cfmapitem name="m2" latitude="40.46" longitude="117.05" showmarkerwindow=true tip="八达岭长城, 北京">
</cfmap>

 

  c008.cfc 处理标记显示

 

 <cfcomponent>
<cffunction name="getMapData" access="remote">
<cfargument name="cfmapname">
<cfargument name="cfmaplatitude">
<cfargument name="cfmaplongitude">
<cfargument name="cfmapaddress">
<cfsavecontent variable="markup">
<br>
<cfoutput>
<table>
<tr>
<td bgcolor='red'><h4><font color='white'>俺的测试例子</font></td>
</tr>
</table>
Map Name: #cfmapname#<br>
Latitude, Longitude: (#DecimalFormat(cfmaplatitude)#,#DecimalFormat(cfmaplongitude)#)<br>
Address: #cfmapaddress#<br>
</cfoutput>
</cfsavecontent>
<cfreturn markup>
</cffunction>
</cfcomponent>

 

 

主要语句说明:

<cfajaximport params="#{googlemapkey='注册一个google map key'}#">

 指定一个google map key'

 

cfmap属性

centerlatitude:地图中心经度

centerlongitude:地图中心纬度

markerbind:标记数据处理组件

 

cfmapitem标签指示指定义的地图标签

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章