This discussion is archived
3 Replies Latest reply: Aug 19, 2013 11:14 AM by jsharma RSS

printng FOIs with labels do not hidde not visible labels when using print function

user3571083 Newbie
Currently Being Moderated

Hello,

 

when I use the print function the HTMLElement labels on a FOI object

that are not in the visible scope are not hidden. I provided an example

where the 'Dallas' FOI is not in the visible area and when you print it

the circle is invisible but the label 'Dallas' is on the print out.

 

The second problem is that all lables on the printout have the same

color.

 

Im using Mapviewer 11.1.1.7 and the testcase is based on a mvdemo map.

If you use the print function you should see the problem:



 

<html>

<head>

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

 

<style type="text/css">

@media screen

{

.noscreen {display: none;}

}

@media print

{

.noprint{display: none;}

}

</style>

 

<script language="Javascript" src="/mapviewer/fsmc/jslib/oraclemaps.js"></script>

<script language=javascript>

var mapview;

var baseURL = "http://"+document.location.host+"/mapviewer";

 

function showMap()

{

mapview = new MVMapView(document.getElementById("map"), baseURL);

mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.demo_map"));

mapview.setCenter(MVSdoGeometry.createPoint(-122.45, 37.6706,8307));

mapview.setZoomLevel(4);

mapview.display();

//adds custom foi with label

var xmlDef = '<svg width="1in" height="1in">'+

'<g class="marker" '+

'style="width:40;height:40;font-family:sans-serif;font-size:20pt;stroke:0xff0000;fill:0x00ff00;stroke-width:1.5">'+

'<circle r="20"/>'+

'</g>'+

'</svg>';

//var markerStyle = new MVXMLStyle("my_vector_icon_", xmlDef);

var markerGreen = new MVStyleMarker("my_vector_icon_", "vector");

markerGreen.setStrokeColor("ff0000");

markerGreen.setFillColor("00ff00");   

markerGreen.setVectorShape("c:30");

 

var markerRed = new MVStyleMarker("my_vector_icon_", "vector");

markerRed.setStrokeColor("0000FF");

markerRed.setFillColor("ff0000");   

markerRed.setVectorShape("c:30");

 

var markerBlue = new MVStyleMarker("my_vector_icon_", "vector");

markerBlue.setStrokeColor("ff0000");

markerBlue.setFillColor("0000FF");   

markerBlue.setVectorShape("c:30");

 

 

mpoint_green = MVSdoGeometry.createPoint(-112.30, 34.73,8307);

var v_result_green = new MVFOI("10", mpoint_green, markerGreen, null, 60, 60);

v_result_green.setHTMLElement('Phoenix',10,10);

 

mpoint_red = MVSdoGeometry.createPoint(-122.30, 37.50,8307);

var v_result_red = new MVFOI("11", mpoint_red, markerRed, null, 60, 60);

v_result_red.setHTMLElement('San Francisco',10,10);

 

 

mpoint_blue = MVSdoGeometry.createPoint(-97.30, 33.50,8307);

var v_result_blue = new MVFOI("12", mpoint_blue, markerBlue, null, 60, 60);

v_result_blue.setHTMLElement('Dallas',10,10);

 

 

 

mapview.addFOI(v_result_red);

mapview.addFOI(v_result_blue);

mapview.addFOI(v_result_green);

}

 

function mapPrint()

{

var a=document.getElementById("printmap");

mapview.print(a);

}

</script>

 

</head>

 

<body onload=javascript:showMap()>

<div id="map" style="position:absolute;top:50px; left:10px; width:600px; height:450px;border:0px"></div>

<div id="printmap" class="noscreen"></div>

<p>Please click <a href="javascript:mapPrint()">here</a> to print map</p>

</body>

</html>





  • 1. Re: printng FOIs with labels do not hidde not visible labels when using print function
    jsharma Pro
    Currently Being Moderated

    Try it with the overflow:hidden on the printmap div. i.e.

    <div id="printmap" style="overflow:hidden;" class="noscreen"></div>

     

    or add an overflow:hidden to the media print style, i.e.

    @media print
    {
    .noprint{display: none;}
    .noscreen {overflow: hidden;}
    }

     

    As far as I can tell no color was specified for the label text in the example above.

    e.g. v_result_blue.setHTMLElement('Dallas',10,10); does not specify a color so the default font and color will be used.

    However I'll test this (text color qs) out further and let you know

  • 2. Re: printng FOIs with labels do not hidde not visible labels when using print function
    jsharma Pro
    Currently Being Moderated

    The issue with the symbols all showing up in the same color (e.g. sfo and phoenix both as green circles instead of red and green) is intermittent/inconsistent in my tests. Saw it initially but not again. Will look into it further.

     

    Meanwhile let me know if the overflow:hidden part works for you.

  • 3. Re: printng FOIs with labels do not hidde not visible labels when using print function
    jsharma Pro
    Currently Being Moderated

    All marker symbols (SFO, Phoenix) show up in the same color (in print) because the same name is used for all the maker styles. Change the style names and the right colors should be used in printed map.

    i.e. change the lines

    var markerGreen = new MVStyleMarker("my_vector_icon_", "vector");

     

    var markerRed = new MVStyleMarker("my_vector_icon_", "vector");

     

    var markerBlue = new MVStyleMarker("my_vector_icon_", "vector");

     

    to

    var markerGreen = new MVStyleMarker("my_vector_icon_g", "vector");

     

    var markerRed = new MVStyleMarker("my_vector_icon_r", "vector");

    var markerBlue = new MVStyleMarker("my_vector_icon_b", "vector");

     

    and it should be fine.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points