Skip to content

Commit

Permalink
增加add_tms示例
Browse files Browse the repository at this point in the history
  • Loading branch information
marsprj committed Dec 1, 2016
1 parent 7073f9f commit f762f67
Show file tree
Hide file tree
Showing 2 changed files with 353 additions and 0 deletions.
182 changes: 182 additions & 0 deletions example/layer/layer_add_tms.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../../../lib/css/Map5.min.css">

<script type="text/javascript" src="../../../src/depends/jquery-1.11.1.js"></script>
<script type="text/javascript" src="../../../src/depends/bootstrap.min.js"></script>

<!--Base-->
<script type="text/javascript" src="../../../src/GeoBeans.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Class.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Type.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Color.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/ColorRangeMap.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Envelope.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Raster.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Utility/Utility.js"></script>
<!--Geometry-->
<script type="text/javascript" src="../../../src/GeoBeans/Geometry.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Point.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/LineString.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Line/LinearRing.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Polygon.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/MultiPoint.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/MultiLineString.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/MultiPolygon.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Circle.js"></script>
<!--Projection-->
<script type="text/javascript" src="../../../src/GeoBeans/Proj.js"></script>
<!--View-->
<script type="text/javascript" src="../../../src/GeoBeans/Viewer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Renderer.js"></script>
<!--Stype-->
<script type="text/javascript" src="../../../src/GeoBeans/Style.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Symbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Font.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Fill.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Stroke.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/PointSymbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/LineSymbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/PolygonSymbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/FeatureStyle.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Rule.js"></script>
<!--Control-->
<script type="text/javascript" src="../../../src/GeoBeans/Control.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/DragMapControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/ScrollMapControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/TrackControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/TrackControl/TrackOverlayControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/ZoomControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/MapNavControl.js"></script>
<!--Format-->
<script type="text/javascript" src="../../../src/GeoBeans/Format.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Format/GML.js"></script>
<!--Filter-->
<script type="text/javascript" src="../../../src/GeoBeans/Filter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/SpatialFilter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/SpatialFilter/BBoxFilter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/FilterWriter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Query.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/OrderBy.js"></script>
<!--Workspace-->
<script type="text/javascript" src="../../../src/GeoBeans/Field.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Feature.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/FeatureType.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Workspace.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Workspace/WFS/WFSWorkspace.js"></script>
<!--Source-->
<script type="text/javascript" src="../../../src/GeoBeans/Source.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Feature.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Feature/WFS.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Feature/GeoJSON.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Raster.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Raster/WMS.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Tile.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Tile/AMap.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Tile/MapWorld.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Tile/OpenStreetMap.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Tile/QuadServer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Tile/TMS.js"></script>
<!--Layer-->
<script type="text/javascript" src="../../../src/GeoBeans/Layer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/FeatureLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/OverlayLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/PanoramaLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ImageLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/Tile.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/TileCache.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/TileLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ChartLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ThematicLayer/RippleLayer.js"></script>
<!--Interaction-->
<script type="text/javascript" src="../../../src/GeoBeans/Interaction.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Interaction/Draw.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Interaction/Select.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Interaction/Rotate.js"></script>
<!--Events-->
<script type="text/javascript" src="../../../src/GeoBeans/Events.js"></script>
<!--Render-->
<script type="text/javascript" src="../../../src/GeoBeans/Render/Label/Maplex.js"></script>
<!--Widget-->
<script type="text/javascript" src="../../../src/GeoBeans/Widget.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Widget/CopyRightWidget.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Widget/InfoWindowWidget.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Widget/LegendWidget.js"></script>
<!--Map-->
<script type="text/javascript" src="../../../src/GeoBeans/Selection.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Map.js"></script>

<style type="text/css">
body{
margin: 0px;
}
#mapDiv{
height:800px;
width:100%;
top:60px;
position:absolute;
}
</style>

<title>地图:加载OpenStreetMap地图</title>
<body onload="init()">
<table>
<tr>
<td>Mercator:</td>
<td><input id="m_x" type="text" size="20"> - <input id="m_y" type="text" size="20"></td>
</tr>
<tr>
<td>WGS84:</td>
<td><input id="w_x" type="text" size="20"> - <input id="w_y" type="text" size="20"></td>
</tr>
</table>
<div id="mapDiv" style="height:800px;width:100%;position:absolute;">
</div>
</body>

<script type="text/javascript">

var mapObj = null;
function init(){

// 1、设置地图的范围
var extent = new GeoBeans.Envelope(-180,-90,180,90);

mapObj = new GeoBeans.Map({
target : "mapDiv",
name : "map",
srs : GeoBeans.Proj.WebMercator,
baseLayer : "osm",
layers :[
new GeoBeans.Layer.TileLayer({
name : "osm",
"source" : new GeoBeans.Source.Tile.TMS({
url : "http://a.tile.openstreetmap.org/",
srs: GeoBeans.Proj.WebMercator,
format : "image/png"
}),
"opacity" : 1.0,
"visible" : true
})
],
viewer : {
center : new GeoBeans.Geometry.Point(0,0),
zoom : 2,
}

});
mapObj.on(GeoBeans.Event.MOUSE_MOVE, onMouseMove);
}

function onMouseMove(evt){

document.getElementById("m_x").value = evt.mapX;
document.getElementById("m_y").value = evt.mapY;

var pt = GeoBeans.Proj.toLonLat(evt.mapX, evt.mapY);
document.getElementById("w_x").value = pt.x;
document.getElementById("w_y").value = pt.y;
}
</script>
171 changes: 171 additions & 0 deletions example/layer/layer_add_wmts_2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="../../../lib/css/Map5.min.css">

<script type="text/javascript" src="../../../src/depends/jquery-1.11.1.js"></script>
<script type="text/javascript" src="../../../src/depends/bootstrap.min.js"></script>

<!--Base-->
<script type="text/javascript" src="../../../src/GeoBeans.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Class.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Color.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/BaseTypes/Envelope.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Utility/Utility.js"></script>

<!--View-->
<script type="text/javascript" src="../../../src/GeoBeans/Viewer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Renderer.js"></script>
<!--Geometry-->
<script type="text/javascript" src="../../../src/GeoBeans/Geometry.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Point.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/LineString.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Line/LinearRing.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Polygon.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/MultiPoint.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/MultiLineString.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/MultiPolygon.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Geometry/Circle.js"></script>
<!--Stype-->
<script type="text/javascript" src="../../../src/GeoBeans/Style.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Symbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Font.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Fill.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Stroke.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/PointSymbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/LineSymbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/PolygonSymbolizer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/FeatureStyle.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Style/Rule.js"></script>
<!--Control-->
<script type="text/javascript" src="../../../src/GeoBeans/Control.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/DragMapControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/ScrollMapControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/TrackControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/TrackControl/TrackOverlayControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/ZoomControl.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Control/MapNavControl.js"></script>
<!--Format-->
<script type="text/javascript" src="../../../src/GeoBeans/Format.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Format/GML.js"></script>
<!--Filter-->
<script type="text/javascript" src="../../../src/GeoBeans/Filter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/SpatialFilter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/SpatialFilter/BBoxFilter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/FilterWriter.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Query.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Filter/OrderBy.js"></script>


<!--Workspace-->
<script type="text/javascript" src="../../../src/GeoBeans/Field.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Feature.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/FeatureType.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Workspace.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Workspace/WFS/WFSWorkspace.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Source/Workspace/WMS/WMSWorkspace.js"></script>
<!--Layer-->
<script type="text/javascript" src="../../../src/GeoBeans/Layer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/FeatureLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/OverlayLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/PanoramaLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ImageLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/Tile.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/TileCache.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/TileLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/TileLayer/QSLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/TileLayer/WMTSLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ChartLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ThematicLayer/RippleLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/FeatureLayer/WFSLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/MapLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ImageLayer.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Layer/ImageLayer/WMSLayer.js"></script>
<!--Interaction-->
<script type="text/javascript" src="../../../src/GeoBeans/Interaction.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Interaction/Draw.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Interaction/Select.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Interaction/Rotate.js"></script>
<!--Events-->
<script type="text/javascript" src="../../../src/GeoBeans/Events.js"></script>
<!--Render-->
<script type="text/javascript" src="../../../src/GeoBeans/Render/Label/Maplex.js"></script>
<!--Widget-->
<script type="text/javascript" src="../../../src/GeoBeans/Widget.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Widget/CopyRightWidget.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Widget/InfoWindowWidget.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Widget/LegendWidget.js"></script>
<!--Map-->
<script type="text/javascript" src="../../../src/GeoBeans/Selection.js"></script>
<script type="text/javascript" src="../../../src/GeoBeans/Map.js"></script>

<script type="text/javascript" src="../js/initMap.js"></script>

<style type="text/css">
body{
margin: 0px;
}
</style>
<script type="text/javascript">
// 地图变量
var mapObj = null;
function init(){

// 1、设置地图的范围
var extent = new GeoBeans.Envelope(-180,-90,180,90);

// 2、初始化地图变量,参数分别为:
// 地图的容器为"mapDiv",地图名称"map",地图范围,地图的空间参考,4326为经纬度
mapObj = new GeoBeans.Map({
id : "mapDiv",
name : "map",
srid : 4326
});
if(mapObj == null){
return;
}

// 1、geoserver服务器地址
// var server = "/geoserver/radi/ows?";
var server = "/geoserver/gwc/service/wmts"

// 2、设置要添加的图层数组,可以添加多个
var lname = ["cities_2"];

// 3、定义WMTS图层
// 备注:EPSG:4326可以显示,但是级别不对,GoogleCRS84Quad无法显示,有待调试
// var extent = new GeoBeans.Envelope(-180,-90,180,90);
// var layer = new GeoBeans.Layer.WMTSLayer("cities", //图层名称
// server, // 服务器地址
// "radi:country_2", // 图层名称
// extent, // 空间范围
// "GoogleCRS84Quad", //切图格式
// "image/png", //图片格式
// null);


// 配合Auge服务端的可以显示,可参考
var extent = new GeoBeans.Envelope(-180,-90,180,90);
var layer = new GeoBeans.Layer.WMTSLayer("m1","/ows/user1/mgr","m1",extent,"GoogleCRS84Quad","image/png","tfs");

// 4、添加图层
mapObj.addLayer(layer);


// 5、设置中心点和显示级别
var zoom = 3;
var center = new GeoBeans.Geometry.Point(0,0);
var viewer = mapObj.getViewer();
viewer.setZoomCenter(zoom,center);
}

</script>
<title>图层:添加WTMS图层</title>
<body onload="init()">
<!-- mapDiv 为初始化地图的容器,给定高度和宽度,并指定定位方式为绝对定位 -->
<div id="mapDiv" style="height:800px;width:100%;position:absolute;top:80px;">
</div>
</body>

0 comments on commit f762f67

Please sign in to comment.