forked from marsprj/Map5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
3,447 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
<!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> | ||
<script type="text/javascript" src="../../../src/GeoBeans/Style/Symbol.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/ComparisionFilter.js"></script> | ||
<script type="text/javascript" src="../../../src/GeoBeans/Filter/ComparisionFilter/IsBetweenFilter.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/Filter/Expression.js"></script> | ||
<script type="text/javascript" src="../../../src/GeoBeans/Filter/Expression/PropertyName.js"></script> | ||
<script type="text/javascript" src="../../../src/GeoBeans/Filter/Expression/Literal.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> | ||
<!--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/QueryLayer.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/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> | ||
<!--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/Map.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("mapDiv","map",extent,4326); | ||
if(mapObj == null){ | ||
return; | ||
} | ||
|
||
// 3、添加一个底图 | ||
// 定义一个QuadServer图层,作为底图,第一个参数为图层名称,第二个参数为QuadServer地址 | ||
var baselayer = new GeoBeans.Layer.QSLayer("base","/QuadServer/maprequest?services=world_vector"); | ||
mapObj.addLayer(baselayer); | ||
var server = "/geoserver/radi/ows?"; | ||
|
||
// 4、添加WFS图层 | ||
wfsLayer = new GeoBeans.Layer.WFSLayer("cities", //在地图中的名称 | ||
server, //服务器 | ||
"radi:cities_2", //图层在geoserver的名称 | ||
"GML2"); // 格式 | ||
mapObj.addLayer(wfsLayer); | ||
|
||
|
||
// 5、设置中心点和显示级别 | ||
var zoom = 3; | ||
var center = new GeoBeans.Geometry.Point(0,0); | ||
var viewer = mapObj.getViewer(); | ||
viewer.setZoomCenter(zoom,center); | ||
} | ||
|
||
/** | ||
IsBetweenFilter查询 | ||
查询属性在指定值区间段内的记录 | ||
**/ | ||
function query(){ | ||
|
||
// 1、定义字段 | ||
var prop = new GeoBeans.Expression.PropertyName(); | ||
prop.setName("populat"); | ||
|
||
// 2、设定最小值 | ||
var lowerLiteral = new GeoBeans.Expression.Literal(); | ||
lowerLiteral.setValue("100000"); | ||
|
||
// 3、设定最大值 | ||
var upperLiteral = new GeoBeans.Expression.Literal(); | ||
upperLiteral.setValue("500000"); | ||
|
||
// sql 100000 <= populat <= 500000 | ||
// 4、查询 | ||
// 参数一:查询字段,参数二:查询的最小值,参数三:查询的最大值 | ||
var filter = new GeoBeans.Filter.IsBetweenFilter(prop,lowerLiteral,upperLiteral); | ||
|
||
// 5、定义查询类 | ||
var query = new GeoBeans.Query({ | ||
typeName : null, | ||
fields : null, // 字段 | ||
maxFeatures : null, //返回结果数 | ||
offset : null, //偏移量 | ||
orderby : null, //排序类 | ||
filter : filter //查询过滤条件 | ||
}); | ||
|
||
// 6、定义查询结果 | ||
var handler = { | ||
target : this, | ||
execute : queryFeatures_callback //查询回调函数 | ||
}; | ||
|
||
// 7、图层查询 | ||
wfsLayer.query(query,handler); | ||
} | ||
|
||
// 查询结果回调函数 | ||
function queryFeatures_callback(features){ | ||
|
||
// 返回查询的features | ||
if(!$.isArray(features)){ | ||
return; | ||
} | ||
|
||
$("#result span").html(features.length); | ||
for(var i = 0; i< features.length;++i){ | ||
|
||
var feature = features[i]; | ||
|
||
// 查询id | ||
var fid = feature.fid; | ||
console.log(fid); | ||
} | ||
} | ||
</script> | ||
<title>Map5 -- between查询</title> | ||
<body onload="init()"> | ||
<!-- mapDiv 为初始化地图的容器,给定高度和宽度,并指定定位方式为绝对定位 --> | ||
<div id="mapDiv" style="height:800px;width:100%;position:absolute;top:60px;"> | ||
</div> | ||
<button onclick="query()">查询</button> | ||
<br/> | ||
<div id="result"> | ||
返回的结果个数:<span></span> | ||
</div> | ||
</body> | ||
|
Oops, something went wrong.