How to apply a custom rendering profile in AJAX?

This forum deals with any kind of web based client technology, whether it is the well known java script based Ajax servlet or the upcoming approaches such as Leaflet, OpenLayers and so on.
Post Reply
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

How to apply a custom rendering profile in AJAX?

Post by Bernd Welter »

Cheerio,

this week a partner asked me weether it is possible to apply a custom profile in AJAX maps (xMap 1). He wanted to display EMISSION ZONES on a map. Well, here's the result and below you can find the instructions:
sample - ready to be executeed in the AJAX tutorial
sample - ready to be executeed in the AJAX tutorial
What we need:
  • a proper native rendering profile
    greenzones.ini
    A sample profile - it emphasizes the greenzones
    (447 Bytes) Downloaded 368 times
  • a set of ajax profiles ("bg", "fg", "ov"):
    xmap-greenzones-ov.properties
    overlay
    (6.43 KiB) Downloaded 376 times
    xmap-greenzones-fg.properties
    foreground
    (6.48 KiB) Downloaded 373 times
    xmap-greenzones-bg.properties
    background
    (6.48 KiB) Downloaded 361 times
  • propagate the profiles in the ajaxmaps.properties as a new "group" - they define a so-called ProfileGroup:
    xmap.profile.foreground.greenzones = greenzones-fg
    xmap.profile.background.greenzones = greenzones-bg
    xmap.profile.overview.greenzones = greenzones-ov
  • Request the profile group in the ajax maps call:

    Code: Select all

    <html>
      <head>
        <!--[if IE]><script type="text/javascript" src="webcomponent/script/excanvas.js"></script><![endif]-->
        <script type="text/javascript" src="webcomponent/script/qooxdoo/script/qx-transport.js"></script>
        <script type="text/javascript" src=".qxrpc"></script>
        <script type="text/javascript" src="webcomponent/script/map.js"></script>
    
        <script type="text/javascript">
          function init() {
            var container =
              document.getElementById("mapContainer");
            var map =
              new com.ptvag.webcomponent.map.Map(container);
              map.setProfileGroup("greenzones");
            window.onresize = function() {
              map.updateSize();
            };
          }
    
          qxp.dev.log.Logger.ROOT_LOGGER.setMinLevel(qxp.dev.log.Logger.LEVEL_INFO);
          qxp.dev.log.Logger.getClassLogger(qxp.core.Init).setMinLevel(qxp.dev.log.Logger.LEVEL_ERROR);
        </script>
      </head>
    
      <body onload="init()">
        <div id="mapContainer"
          style="width:100%;height:100%">
        </div>
      </body>
    </html>
Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply