As you can see in the above code, when createing a dynamic theme, you need to supply the theme's actual XML definition, including the SQL query and styling rule (which default rendering style to use et al).function createThemeFOI() { var baseQuery= "select geom, state from states"; var theme = "<themes><theme name='MY_JDBC_THEME' >" + "<jdbc_query spatial_column='geom' jdbc_srid='8307' " + "render_style='C.COUNTIES' datasource='mvdemo'>" + baseQuery + "</jdbc_query></theme></themes>" ; themebasedfoi = new MVThemeBasedFOI('ajdbctheme',theme); themebasedfoi.setBringToTopOnMouseOver(true); mapview.addThemeBasedFOI(themebasedfoi); }
The following code sets up the actual BI data and the NSDP that will be attached to the theme.
In the above code, we first create a NSDP object (using the Oracle Maps API), tell it the name of the MapViewer dynamic theme that should be joined with the business data (my_jdbc_theme in this case). You must also specify a key column from the base table of the theme, so that MapViewer can fetch the join key values from the theme's base table. In this case the "state" column will be used to match the business data provided by the Non-Spatial Data Provider.function setupNsdp(themebasedfoi) { var nsdpInfo = new MVNSDP("defaultNSDP"); nsdpInfo.setTheme("MY_JDBC_THEME"); nsdpInfo.setKeyColumn("state"); var xml_data = "<nsdp_xml>"+ "<table>"+ "<tr><th>State</th> <th>Revenue (M)</th></tr>"+ "<tr><td>Oregon</td> <td>120.0</td></tr>"+ "<tr><td>California</td> <td>124.0</td></tr>"+ "<tr><td>Nevada</td> <td>70.0</td></tr>"+ "<tr><td>Arizona</td> <td>100.0</td></tr>"+ "<tr><td>Texas</td> <td>175.0</td></tr>"+ "<tr><td>Colorado</td> <td>169.0</td></tr>"+ "<tr><td>Idaho</td> <td>50.0</td></tr>"+ "<tr><td>Iowa</td> <td>40.0</td></tr>"+ "<tr><td>Ohio</td> <td>165.0</td></tr>"+ "<tr><td>Michigan</td> <td>180.0</td></tr>"+ "<tr><td>North Dakota</td> <td>60.0</td></tr>"+ "<tr><td>New Mexico</td> <td>19.0</td></tr>"+ "<tr><td>Oklahoma</td> <td>45.0</td></tr>"+ "<tr><td>Utah</td> <td>110.0</td></tr>"+ "<tr><td>Wisconsin</td> <td>50.0</td></tr>"+ "<tr><td>Alabama</td> <td>40.0</td></tr>"+ "</table>"+ "</nsdp_xml>"; var ps = new Object(); ps["xml"] = xml_data; nsdpInfo.setParameters(ps); themebasedfoi.setNSDP(nsdpInfo); themebasedfoi.setRenderingStyle("V.WHITE SCHEME"); }