GetResource() public method

根据资源图片参数获取资源图片。
public GetResource ( string mapName, ResourceParameter resourceParameter, ImageOutputOption imageOutputOption ) : ResourceImage
mapName string 地图名称。
resourceParameter ResourceParameter 资源图片参数,如生成的图片的高度、宽度、类型,资源的类型、风格等。
imageOutputOption SuperMap.Connector.Utility.ImageOutputOption 资源图片输出设置。
return SuperMap.Connector.Utility.ResourceImage
Exemplo n.º 1
0
 public void GetResourceTest_LineID()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     string mapName = "世界地图";
     ResourceParameter parameter = new ResourceParameter();
     parameter.Style = new Style();
     parameter.Style.LineSymbolID = 5;
     parameter.Type = ResourceType.SYMBOLLINE;
     ImageOutputOption option = new ImageOutputOption();
     option.ImageOutputFormat = ImageOutputFormat.PNG;
     option.ImageReturnType = ImageReturnType.URL;
     ResourceImage image = map.GetResource(mapName, parameter, option);
     Assert.AreEqual(image.ImageUrl, "http://192.168.116.114:8090/iserver/output/resources/%E4%B8%96%E7%95%8C%E5%9C%B0%E5%9B%BE/SYMBOLLINE/5_781806645.png");
 }
Exemplo n.º 2
0
 public void GetResourceTest_Marker()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     string mapName = "世界地图";
     ResourceParameter parameter = new ResourceParameter();
     parameter.Type = ResourceType.SYMBOLMARKER;
     ImageOutputOption option = new ImageOutputOption();
     option.ImageOutputFormat = ImageOutputFormat.PNG;
     option.ImageReturnType = ImageReturnType.URL;
     ResourceImage image = map.GetResource(mapName, parameter, option);
     Assert.AreEqual(image.ImageUrl, "http://192.168.116.114:8090/iserver/output/resources/%E4%B8%96%E7%95%8C%E5%9C%B0%E5%9B%BE/SYMBOLMARKER/0_1160020228.png");
 }
Exemplo n.º 3
0
 public void GetResourceTest_MarkerIDError()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     string mapName = "世界地图";
     ResourceParameter parameter = new ResourceParameter();
     parameter.Style = new Style();
     parameter.Style.MarkerSymbolID = 200;
     parameter.Type = ResourceType.SYMBOLMARKER;
     ImageOutputOption option = new ImageOutputOption();
     option.ImageOutputFormat = ImageOutputFormat.BMP;
     option.ImageReturnType = ImageReturnType.URL;
     ResourceImage image = null;
     try
     {
         image = map.GetResource(mapName, parameter, option);
     }
     catch (ServiceException e)
     {
         Assert.AreEqual(e.Message, "获取资源图片的符号 ID 超出范围。");
     }
 }
Exemplo n.º 4
0
 public void GetResourceTest_BitMap()
 {
     Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
     string mapName = "世界地图";
     ResourceParameter parameter = new ResourceParameter();
     parameter.Type = ResourceType.SYMBOLFILL;
     ImageOutputOption option = new ImageOutputOption();
     option.ImageOutputFormat = ImageOutputFormat.PNG;
     option.ImageReturnType = ImageReturnType.BINARY;
     ResourceImage image = map.GetResource(mapName, parameter, option);
     Assert.AreEqual(image.ImageData[1], 80);
     Assert.AreEqual(image.ImageData[30], 105);
 }