%let name=mc2a;
filename odsout '.';

%let mc2path=\\l72586.na.sas.com\public\VAST_2011\MC_2_Core_Data\;

%let background_image=&mc2path.mc2_pic.jpg;

%let xsize=835;
%let ysize=717;

/* The paper size needs to be a little bigger, to make room for the titles */
%let xpaper=900;
%let ypaper=900;
goptions xpixels=&xpaper ypixels=&ypaper;


/*
This is the blank rectangular outline of the casino floorplan map
(make sure it's the same proportions as the original map).
You will later 'annotate' the floorplan image into this area.
*/
data floorplan_blank;
 idnum=1;
 x=0; y=0; output;
 x=&xsize; y=0; output;
 x=&xsize; y=&ysize; output;
 x=0; y=&ysize; output;
run;


data id_loc;
length id_num $20;
input id_num x y;
/* flip the y-value, since SAS/GRAPH's coordinate system starts at bottom/left */
y=&ysize-y;
datalines;
192.168.2.10-50 715 562
172.20.1.1 294 242
172.20.1.5 67 243
192.168.1.50 132 370
192.168.1.16 405 350
192.168.1.7 92 625
192.168.1.6 167 558
192.168.1.5 232 614
192.168.1.4 324 545
192.168.1.3 403 599
192.168.1.2 477 535
192.168.1.14 550 580
;
run;

/* Which areas had security risks?*/
data risks;
length id_num $20;
input id_num has_risks;
datalines;
192.168.2.10-50 1
;
run;

proc sql;
create table anno_dots as
select risks.*, id_loc.x, id_loc.y
from risks left join id_loc
on risks.id_num = id_loc.id_num;
quit; run;


/*
Create an annotated dot for each id_loc 
*/
data anno_dots; set anno_dots;
length function color $8;
xsys='2'; ysys='2'; hsys='3'; when='a';   
html='href="mc2b.htm"';
function='pie'; rotate=360; style='pempty'; width=2; size=6;
color='red';
output;
run;


/*
This is the floorplan image you'll annotate onto the blank rectangular gmap.
*/
data anno_floorplan;
length  function $8;
xsys='2'; ysys='2'; hsys='3'; when='b'; 
function='move'; x=0; y=0; output;
function='image'; x=&xsize; y=&ysize; style='fit';
 imgpath="&background_image"; output;
run;


GOPTIONS DEVICE=png;
ODS LISTING CLOSE;
ODS HTML path=odsout body="&name..htm" style=minimal;

goptions gunit=pct ftitle="albany amt/bold" ftext="albany amt" htitle=3 htext=2;

pattern1 v=empty;

title1 ls=1.5 "Nessus Security Summary";
title2 "Areas with security risks circled in " c=red "red";
title3 "(click red circle to see details)";
proc gmap data=floorplan_blank map=floorplan_blank anno=anno_floorplan; 
 id idnum; 
 choro idnum / nolegend coutline=black
 anno=anno_dots
 des="" name="&name"; 
run;

quit;
ODS HTML CLOSE;
ODS LISTING;
 
