Oracle Maps example - creating styles on the fly

Instructions

This demo shows how to create temporary MapViewer styles in the JavaScript client and use it to display user defined FOIs.

In this specific example, the user defined FOIs are rendered by the server using dynamic styles created in the client side using the JavaScript API.

Source code

  function showMap()
  { 
    var baseURL  = "http://"+document.location.host+"/mapviewer";
    var mapCenterLon = -122.45;
    var mapCenterLat =  37.6706;
    var mapZoom      =  3;  
    var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
    var mapview = new MVMapView(document.getElementById("map"), baseURL);
    mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.demo_map")); 
    mapview.setCenter(mpoint); 
    mapview.setZoomLevel(mapZoom);    

    // Create a marker FOI with a dynamic marker style
    
    var markerStyle = new MVStyleMarker("my_vector_icon", "vector");
    markerStyle.setStrokeColor("ff0000");
    markerStyle.setFillColor("00ff00");    
    markerStyle.setVectorShape("c:50");
        
    var marker = new MVFOI("markerfoi", mpoint, markerStyle, null, 20, 20) ;
    mapview.addFOI(marker);
    
    // Create a rectangle FOI with a dynamic color style
    
    var colorStyle = new MVStyleColor("my_color_style", "ff0000", "0000FF");    
        
    var polygon = MVSdoGeometry.createRectangle(-122.80, 37.60, -122.50, 37.80,8307) ;
    var rect = new MVFOI("rectfoi", polygon, colorStyle) ;
    mapview.addFOI(rect);
    
    mapview.addNavigationPanel("WEST");
    
    mapview.display();        
  }