kml3d.php
3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
include("../../ms_configura.php");
include("../blacklist.php");
verificaBlFerramentas(basename(dirname(__FILE__)),$i3geoBlFerramentas,false);
include_once (dirname(__FILE__)."/../../classesphp/sani_request.php");
$_GET = array_merge($_GET,$_POST);
include("../../classesphp/funcoes_gerais.php");
$kmlurl = $_GET ["kmlurl"];
$legenda = $_GET ["legenda"];
//define o centro, pegando as coordenadas do mapa de inicializacao
$versao = versao();
$versao = $versao["principal"];
$centroX = -55;
$centroY = -13;
$extensao = "-180,-90,180,90";
if(!isset($_GET["mapext"])){
if(isset($base) && $base != ""){
if(file_exists($base)){
$f = $base;
}
else{
$f = $locaplic."/aplicmap/".$base.".map";
}
}
else
{
$f = "";
if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){
$f = $locaplic."/aplicmap/geral1windowsv".$versao.".map";
}
else{
if($f == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){
$f = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map";
}
if($f == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
$f = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map";
}
if($f == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){
$f = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map";
}
if($f == "")
{
$f = $locaplic."/aplicmap/geral1v".$versao.".map";
}
}
}
if(@ms_newMapObj($f)){
$mapa = ms_newMapObj($f);
$c = $mapa->extent;
$centroX = $c->maxx - ($c->maxx - $c->minx) / 2;
$centroY = $c->maxy - ($c->maxy - $c->miny) / 2;
$extensao = $c->minx.",".$c->miny.",".$c->maxx.",".$c->maxy;
}
}
else{
$c = explode(" ",$_GET["mapext"]);
$centroX = $c[2] - ($c[2] - $c[0]) / 2;
$centroY = $c[3] - ($c[3] - $c[1]) / 2;
$extensao = $c[0].",".$c[1].",".$c[2].",".$c[3];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>KML 3d</title>
<script src="../../pacotes/cesium/Build/Cesium/Cesium.js"></script>
<style>
@import url(../../pacotes/cesium/Build/Cesium/Widgets/widgets.css);
#cesiumContainer {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
overflow: hidden;
padding: 0;
font-family: sans-serif;
}
html {
height: 100%;
}
body {
padding: 0;
margin: 0;
overflow: hidden;
height: 100%;
}
#legenda {
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
margin-top: 5px;
padding-bottom: 2px;
padding-left: 5px;
padding-right: 5px;
padding-top: 2px;
position: absolute;
top: 10px;
left: 10px;
color: white;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<div id="legenda">
<img src='<?php echo strip_tags(str_replace("legend","logo",$legenda));?>' />
<br>
<img src='<?php echo strip_tags($legenda);?>' />
</div>
<script>
var extent = Cesium.Rectangle.fromDegrees(<?php echo $extensao;?>);
Cesium.Camera.DEFAULT_VIEW_RECTANGLE = extent;
Cesium.Camera.DEFAULT_VIEW_FACTOR = 0;
var viewer = new Cesium.Viewer(
'cesiumContainer',
{
timeline : false
}
);
// Add a WMS imagery layer
var imageryLayers = viewer.imageryLayers;
if('<?php echo $kmlurl;?>' != ''){
viewer.dataSources.add(Cesium.KmlDataSource.load('<?php echo strip_tags($kmlurl);?>'))
}
</script>
</body>
</html>