1 Reply Latest reply: May 21, 2012 8:06 AM by grueningd RSS

    How to display all layers at the same time?

    Zeydkas
      Hi,

      I have created several theme based FOIs with a checkbox to set visible them. Each theme has some data and when you click in the theme region it displays this data in an information box. But when I set visible more than one theme, can only display the information box of the last one theme that I set visible (the others are not clickable because they are under the last no?). Is there anyway to make all of them clickable at the same time?

      For each theme that I create I call this function:

           function addThemeBasedFOI(value, i) {
      ...

                /* Add JDBC SQL Query theme based FOI */
                baseQuery = "SELECT value,annotation as label FROM " + value;
                var theme = "<themes><theme name='JDBC_THEME'>"
                          + "<jdbc_query asis='true' spatial_column='value' jdbc_srid='4326' label_column='label' " +
           "render_style='colorScheme' datasource='DSTest'>"
                          + baseQuery + "</jdbc_query></theme></themes>";
                buffertheme = new MVThemeBasedFOI('bufferthemeL_' + i, theme);
                buffertheme.addStyle(sc1);          
                
                buffertheme.enableLabels(true);
                buffertheme.setBringToTopOnMouseOver(true);
                buffertheme.setVisible(false);
                buffertheme.setClickable(true);
                buffertheme.enableInfoWindow(true);
                buffertheme.setAutoRefresh(true);
                
                buffertheme.attachEventListener(MVEvent.MOUSE_CLICK, showInfoPanel);          
                mapview.addThemeBasedFOI(buffertheme);
           }
           
           function showInfoPanel (loc, foi){
                
                var width = 250;
                var height = 150;
                var html = "<p style='color:blue'>Name:<br><font color='black'>" + foi.name + "</font></p><br><p style='color:blue'>Localization:<br><font color='black'> X:" + loc.getPointX() + "<br> Y:" + loc.getPointY() + "</font></p>";
                mapview.displayInfoWindow(loc, html, width, height, "MVInfoWindowStyle4");
           }

      /* Function to set visible a layer */
      function setVisible(item) {
                var themebasedfoi = mapview.getThemeBasedFOI(item.value);
                themebasedfoi.setVisible(!themebasedfoi.isVisible());

                if(themebasedfoi.isVisible()) {
                     themebasedfoi.centerToTheme();
                     themebasedfoi.zoomToTheme();
                }
           }

      Thanks in advance,

      Esteban.