Author: erwan
Date: Mon Aug 16 18:56:25 2010 New Revision: 986095 URL: http://svn.apache.org/viewvc?rev=986095&view=rev Log: Adding geolocation using openstreetmap, examples are taken from the google existing ones Modified: ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml ofbiz/trunk/framework/example/widget/example/CommonScreens.xml ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Modified: ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl?rev=986095&r1=986094&r2=986095&view=diff ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl (original) +++ ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl Mon Aug 16 18:56:25 2010 @@ -88,6 +88,30 @@ under the License. }); } --></script> + <#elseif geoChart.dataSourceId == "GEOPT_OSM"> + <div id="<#if geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>" style="border:1px solid #979797; background-color:#e5e3df; width:${geoChart.width}; height:${geoChart.height}; margin:2em auto;"> + </div> + <script src="http://www.openlayers.org/api/OpenLayers.js"></script> + <script> + map = new OpenLayers.Map("<#if geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>"); + map.addLayer(new OpenLayers.Layer.OSM()); + <#if geoChart.center?has_content> + var zoom = ${geoChart.center.zoom}; + var center= new OpenLayers.LonLat(${geoChart.center.lon?c},${geoChart.center.lat?c}) + .transform(new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 + map.getProjectionObject() // to Spherical Mercator Projection + ); + </#if> + var markers = new OpenLayers.Layer.Markers( "Markers" ); + map.addLayer(markers); + <#if geoChart.points?has_content> + <#list geoChart.points as point> + markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(${point.lon?c} ,${point.lat?c}).transform( + new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))); + </#list> + </#if> + map.setCenter(center, zoom); + </script> </#if> </#if> <#else> Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml?rev=986095&r1=986094&r2=986095&view=diff ============================================================================== --- ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml (original) +++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml Mon Aug 16 18:56:25 2010 @@ -212,6 +212,10 @@ under the License. <request-map uri="ExampleGeoLocationPointSet3"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationPointSet3"/></request-map> <request-map uri="ExampleGeoLocationPointSet4"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationPointSet4"/></request-map> <request-map uri="ExampleGeoLocationAddress"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationAddress"/></request-map> + <request-map uri="ExampleOsmGeoLocationPointSet1"><security https="true" auth="true"/><response name="success" type="view" value="ExampleOsmGeoLocationPointSet1"/></request-map> + <request-map uri="ExampleOsmGeoLocationPointSet2"><security https="true" auth="true"/><response name="success" type="view" value="ExampleOsmGeoLocationPointSet2"/></request-map> + <request-map uri="ExampleOsmGeoLocationPointSet3"><security https="true" auth="true"/><response name="success" type="view" value="ExampleOsmGeoLocationPointSet3"/></request-map> + <request-map uri="ExampleOsmGeoLocationPointSet4"><security https="true" auth="true"/><response name="success" type="view" value="ExampleOsmGeoLocationPointSet4"/></request-map> <!-- Birt example Requests --> <request-map uri="BirtMain"> @@ -277,6 +281,10 @@ under the License. <view-map name="ExampleGeoLocationPointSet3" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationPointSet3"/> <view-map name="ExampleGeoLocationPointSet4" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationPointSet4"/> <view-map name="ExampleGeoLocationAddress" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationAddress"/> + <view-map name="ExampleOsmGeoLocationPointSet1" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleOsmGeoLocationPointSet1"/> + <view-map name="ExampleOsmGeoLocationPointSet2" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleOsmGeoLocationPointSet2"/> + <view-map name="ExampleOsmGeoLocationPointSet3" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleOsmGeoLocationPointSet3"/> + <view-map name="ExampleOsmGeoLocationPointSet4" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleOsmGeoLocationPointSet4"/> <!-- Birt example View Mappings --> <view-map name="BirtMain" type="screen" page="component://example/widget/example/BirtScreens.xml#main"/> Modified: ofbiz/trunk/framework/example/widget/example/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/CommonScreens.xml?rev=986095&r1=986094&r2=986095&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/CommonScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/CommonScreens.xml Mon Aug 16 18:56:25 2010 @@ -215,6 +215,30 @@ under the License. </section> </screen> + <screen name="CommonExampleOsmGeoLocationDecorator"> + <section> + <actions> + <set field="headerItem" value="ExampleGeoLocation"/> + <set field="geoChart.dataSourceId" value="GEOPT_OSM"/> + <set field="geoChart.width" value="600px"/> + <set field="geoChart.height" value="500px"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </actions> + <widgets> + <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="pre-body"> + <include-menu name="ExampleGeoLocation" location="component://example/widget/example/ExampleMenus.xml"/> + </decorator-section> + <decorator-section name="body"> + <container style="clear" /> + <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="CommonBirtDecorator"> <section> <actions> Modified: ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml?rev=986095&r1=986094&r2=986095&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml Mon Aug 16 18:56:25 2010 @@ -74,6 +74,11 @@ under the License. <menu-item name="ExampleGeoLocationPointSet3" title="${uiLabelMap.PointSet3}"><link target="ExampleGeoLocationPointSet3"/></menu-item> <menu-item name="ExampleGeoLocationPointSet4" title="${uiLabelMap.PointSet4}"><link target="ExampleGeoLocationPointSet4"/></menu-item> <menu-item name="ExampleGeoLocationAddress" title="${uiLabelMap.ExamplePointAddress}"><link target="ExampleGeoLocationAddress"/></menu-item> + <!--Examples using openstreetmap --> + <menu-item name="ExampleOsmGeoLocationPointSet1" title="${uiLabelMap.OsmPointSet1}"><link target="ExampleOsmGeoLocationPointSet1"/></menu-item> + <menu-item name="ExampleOsmGeoLocationPointSet2" title="${uiLabelMap.OsmPointSet2}"><link target="ExampleOsmGeoLocationPointSet2"/></menu-item> + <menu-item name="ExampleOsmGeoLocationPointSet3" title="${uiLabelMap.OsmPointSet3}"><link target="ExampleOsmGeoLocationPointSet3"/></menu-item> + <menu-item name="ExampleOsmGeoLocationPointSet4" title="${uiLabelMap.OsmPointSet4}"><link target="ExampleOsmGeoLocationPointSet4"/></menu-item> </menu> <menu name="BirtTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"> Modified: ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml?rev=986095&r1=986094&r2=986095&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Mon Aug 16 18:56:25 2010 @@ -336,4 +336,134 @@ under the License. </widgets> </section> </screen> + + <screen name="ExampleOsmGeoLocationPointSet1"> + <section> + <actions> + <set field="tabButtonItem" value="ExampleOsmGeoLocationPointSet1"/> + <set field="geoPoints[+0].lat" value="37.4419" type="Float"/> + <set field="geoPoints[0].lon" value="-122.1419" type="Float"/> + <set field="geoPoints[+1].lat" value="37.4819" type="Float"/> + <set field="geoPoints[1].lon" value="-122.1519" type="Float"/> + <set field="geoPoints[+2].lat" value="37.4719" type="Float"/> + <set field="geoPoints[2].lon" value="-122.1319" type="Float"/> + <set field="geoCenter.lat" value="37.4419" type="Float"/> + <set field="geoCenter.lon" value="-122.1419" type="Float"/> + <set field="geoCenter.zoom" value="13"/> + </actions> + <widgets> + <include-screen name="CommonExampleOsmGeoLocationDecorator" location="${parameters.mainDecoratorLocation}"/> + </widgets> + </section> + </screen> + <screen name="ExampleOsmGeoLocationPointSet2"> + <section> + <actions> + <set field="tabButtonItem" value="ExampleOsmGeoLocationPointSet2"/> + <set field="geoPoints[+0].lat" value="37.4459" type="Float"/> + <set field="geoPoints[0].lon" value="-122.1489" type="Float"/> + <set field="geoPoints[+1].lat" value="37.4829" type="Float"/> + <set field="geoPoints[1].lon" value="-122.1599" type="Float"/> + <set field="geoPoints[+2].lat" value="37.4769" type="Float"/> + <set field="geoPoints[2].lon" value="-122.1219" type="Float"/> + <set field="geoCenter.lat" value="37.4419" type="Float"/> + <set field="geoCenter.lon" value="-122.1419" type="Float"/> + <set field="geoCenter.zoom" value="12"/> + </actions> + <widgets> + <include-screen name="CommonExampleOsmGeoLocationDecorator" location="${parameters.mainDecoratorLocation}"/> + </widgets> + </section> + </screen> + <screen name="ExampleOsmGeoLocationPointSet3"> + <section> + <actions> + <set field="tabButtonItem" value="ExampleOsmGeoLocationPointSet3"/> + <set field="geoPoints[+0].lat" value="37.4379" type="Float"/> + <set field="geoPoints[0].lon" value="-122.1119" type="Float"/> + <set field="geoPoints[+1].lat" value="37.4819" type="Float"/> + <set field="geoPoints[1].lon" value="-122.1519" type="Float"/> + <set field="geoPoints[+2].lat" value="37.4229" type="Float"/> + <set field="geoPoints[2].lon" value="-122.1369" type="Float"/> + <set field="geoCenter.lat" value="37.4419" type="Float"/> + <set field="geoCenter.lon" value="-122.1419" type="Float"/> + <set field="geoCenter.zoom" value="11"/> + </actions> + <widgets> + <include-screen name="CommonExampleOsmGeoLocationDecorator" location="${parameters.mainDecoratorLocation}"/> + </widgets> + </section> + </screen> + <screen name="ExampleOsmGeoLocationPointSet4"> + <section> + <actions> + <set field="headerItem" value="ExampleGeoLocation"/> + <set field="tabButtonItem" value="ExampleOsmGeoLocationPointSet4"/> + <set field="geoChart.dataSourceId" value="GEOPT_GOOGLE"/> + <set field="geoChart.width" value="600px"/> + <set field="geoChart.height" value="500px"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </actions> + <widgets> + <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="pre-body"> + <include-menu name="ExampleGeoLocation" location="component://example/widget/example/ExampleMenus.xml"/> + </decorator-section> + <decorator-section name="body"> + <section> + <widgets> + <section> + <actions> + <set field="geoPoints[+0].lat" value="37.4459" type="Float"/> + <set field="geoPoints[0].lon" value="-122.1489" type="Float"/> + <set field="geoPoints[+1].lat" value="37.4829" type="Float"/> + <set field="geoPoints[1].lon" value="-122.1599" type="Float"/> + <set field="geoPoints[+2].lat" value="37.4769" type="Float"/> + <set field="geoPoints[2].lon" value="-122.1219" type="Float"/> + <set field="geoCenter.lat" value="37.4419" type="Float"/> + <set field="geoCenter.lon" value="-122.1419" type="Float"/> + <set field="geoCenter.zoom" value="12"/> + <set field="geoChart.id" value="chart1"/> + <set field="geoChart.dataSourceId" value="GEOPT_OSM"/> + <set field="geoChart.width" value="600px"/> + <set field="geoChart.height" value="500px"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </actions> + <widgets> + <container style="clear" /> + <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/> + </widgets> + </section> + <section> + <actions> + <set field="geoPoints" value=""/> + <set field="geoPoints[+0].lat" value="37.4379" type="Float"/> + <set field="geoPoints[0].lon" value="-122.1119" type="Float"/> + <set field="geoPoints[+1].lat" value="37.4819" type="Float"/> + <set field="geoPoints[1].lon" value="-122.1519" type="Float"/> + <set field="geoPoints[+2].lat" value="37.4229" type="Float"/> + <set field="geoPoints[2].lon" value="-122.1369" type="Float"/> + <set field="geoCenter.lat" value="37.4419" type="Float"/> + <set field="geoCenter.lon" value="-122.1419" type="Float"/> + <set field="geoCenter.zoom" value="11"/> + <set field="geoChart.id" value="chart2"/> + <set field="geoChart.dataSourceId" value="GEOPT_OSM"/> + <set field="geoChart.width" value="800px"/> + <set field="geoChart.height" value="500px"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </actions> + <widgets> + <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/> + </widgets> + </section> + </widgets> + </section> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> </screens> |
Free forum by Nabble | Edit this page |