QueryByBounds() 공개 메소드

在指定的地图上,查询与指定的矩形范围以及符合某种空间关系和查询条件的几何对象。
public QueryByBounds ( string mapName, Rectangle2D bounds, QueryParameterSet queryParameterSet ) : QueryResult
mapName string 地图名称。
bounds Rectangle2D 矩形范围。
queryParameterSet SuperMap.Connector.Utility.QueryParameterSet 查询参数集。可对某个地图的多个图层进行查询,单个图层的查询参数在 queryParameters.queryParams[i] 中进行设置。
리턴 SuperMap.Connector.Utility.QueryResult
예제 #1
0
 public void QueryByBoundsTest_Error()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     QueryParameterSet queryParameterSet = new QueryParameterSet();
     queryParameterSet.ExpectCount = 20;
     queryParameterSet.QueryOption = QueryOption.ATTRIBUTE;
     queryParameterSet.QueryParams = new QueryParameter[1];
     queryParameterSet.QueryParams[0] = new QueryParameter("ContinentLabelError@World");
     queryParameterSet.ReturnContent = true;
     Rectangle2D bounds = new Rectangle2D();
     bounds.LeftBottom = new Point2D(0, 0);
     bounds.RightTop = new Point2D(100, 100);
     QueryResult qr = null;
     try
     {
         qr = map.QueryByBounds("世界地图", bounds, queryParameterSet);
     }
     catch (ServiceException e)
     {
         Assert.AreEqual(e.Message, "查询目标图层不存在。(ContinentLabelError@World)");
     }
 }
예제 #2
0
 public void QueryByBoundsTest()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     QueryParameterSet queryParameterSet = new QueryParameterSet();
     queryParameterSet.ExpectCount = 20;
     queryParameterSet.QueryOption = QueryOption.ATTRIBUTE;
     Rectangle2D bounds = new Rectangle2D();
     bounds.LeftBottom = new Point2D(0, 0);
     bounds.RightTop = new Point2D(100, 100);
     queryParameterSet.QueryParams = new QueryParameter[1];
     queryParameterSet.QueryParams[0] = new QueryParameter("ContinentLabel@World");
     queryParameterSet.ReturnContent = true;
     QueryResult qr = map.QueryByBounds("世界地图", bounds, queryParameterSet);
     Assert.AreEqual(qr.CurrentCount, 6);
     Assert.AreEqual(qr.Recordsets[0].Features[3].FieldValues[0], "9");
     Assert.IsNull(qr.Recordsets[0].Features[1].Geometry);
     Assert.AreEqual(qr.Recordsets[0].DatasetName, "ContinentLabel@World");
 }
예제 #3
0
 public void QueryByBoundsTest_ErrorBoundsIsNull()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     QueryParameterSet queryParameterSet = new QueryParameterSet();
     queryParameterSet.ExpectCount = 20;
     queryParameterSet.QueryOption = QueryOption.ATTRIBUTE;
     queryParameterSet.QueryParams = new QueryParameter[1];
     queryParameterSet.QueryParams[0] = new QueryParameter("ContinentLabel@World");
     queryParameterSet.ReturnContent = true;
     QueryResult qr = null;
     try
     {
         qr = map.QueryByBounds("世界地图", null, queryParameterSet);
     }
     catch (ArgumentNullException e)
     {
         Assert.AreEqual(e.Message, "参数不能为空。\r\n参数名: bounds");
     }
 }
예제 #4
0
 public void QueryByBoundsTest_Default()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     QueryParameterSet queryParameterSet = new QueryParameterSet();
     queryParameterSet.QueryOption = QueryOption.ATTRIBUTE;
     Rectangle2D bounds = new Rectangle2D();
     bounds.LeftBottom = new Point2D(0, 0);
     bounds.RightTop = new Point2D(100, 100);
     queryParameterSet.QueryParams = new QueryParameter[1];
     queryParameterSet.QueryParams[0] = new QueryParameter("ContinentLabel@World");
     QueryResult qr = map.QueryByBounds("世界地图", bounds, queryParameterSet);
     Assert.IsNull(qr.Recordsets);
     Assert.IsTrue(qr.ResourceInfo.Succeed);
     Assert.IsNotNull(qr.ResourceInfo.NewResourceID);
     Assert.IsNull(qr.ResourceInfo.Bounds);
     Assert.IsNotNull(qr.ResourceInfo.NewResourceLocation);
     Assert.AreEqual(qr.TotalCount, 0);
 }