Business logic of developed sample - OraMapsWithTable.zip, is to provide a possibility of browsing through a table with cities data and to show selected city on the map. For the data source is used CITIES table from MVDEMO schema. Geometry theme for the CITIES table is declared using Oracle MapBuilder product. Oracle MapViewer, Oracle MapBuilder, MVDEMO schema and other spatial products you can download from - OTN. In the application Model layer EJB and TopLink are used, and ADF Faces components in the View layer.
Ok, if you have successfully deployed and configured MVDEMO schema, Oracle MapViewer and Oracle MapBuidler, it is time to describe how I have developed this sample application.
As you may notice, I'm using cities data, however cities geometry theme declaration doesn't come with MVDEMO. So, we need to declare it. You can declare it in the less than a minute, just use Oracle MapBuilder tool. There are two main things you should define, when declaring geometry theme for cities - hidden info field and query condition. In the hidden info field you should define all fields you want to show in pop-up window when city's point on the map will be clicked. In the query condition, data selection criteria is defined. More information on this topic is available in MapViewer User's Guide section - 8.3.1 Theme-Based FOI Layers. Shortly, cities geometry theme declaration for this application should look like this:
Application Model layer is generated using JDeveloper wizards, and there is no any custom code added. However, I have deleted default session definition and created - oramaps session definition with data source location pointed to jdbc/OraMapsDS data source.
Application View layer contains cities table and map image. Cities table row selection is implemented using af:commandLink component for #{row.city} field. Partial submit is enabled on af:commandLink and partial trigger points to af:panelHorizontal that contains map image. There is no any action or action listener defined on #{row.city} field, for map image update is used JavaScript onclick functionality onclick="showCity(#{row.rank90})". You should notice, that in ADF Faces it is possible to pass value from binding expression, as JavaScript function parameter. showCity(param) function is used to display selected city, function logic is implemented using JavaScript Oracle Maps API. Function source:
I have tested this sample on standalone Oracle Application Server (deployment profile is included into application workspace). Finally, we have a table and a map:
Let's say, we select Milwaukee city in the cities table, then similar map will be displayed:
So, what is better - to have a table or to have spatially enabled table? ;-)
0 comments:
Post a Comment