初始化
This commit is contained in:
parent
3e10221805
commit
79ea3f0c58
32
src/main/java/com/gis3c/ol/entity/LayerSource.java
Normal file
32
src/main/java/com/gis3c/ol/entity/LayerSource.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package com.gis3c.ol.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2018/2/24.
|
||||||
|
*/
|
||||||
|
public class LayerSource {
|
||||||
|
private Layer layer;
|
||||||
|
private Source source;
|
||||||
|
|
||||||
|
public LayerSource(){}
|
||||||
|
|
||||||
|
public LayerSource(Layer layer,Source source){
|
||||||
|
this.layer = layer;
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Layer getLayer() {
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayer(Layer layer) {
|
||||||
|
this.layer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Source getSource() {
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(Source source) {
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/main/java/com/gis3c/ol/entity/MapLayer.java
Normal file
31
src/main/java/com/gis3c/ol/entity/MapLayer.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package com.gis3c.ol.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2018/2/24.
|
||||||
|
*/
|
||||||
|
public class MapLayer {
|
||||||
|
private Layer layer;
|
||||||
|
private Boolean isBinded = Boolean.FALSE;
|
||||||
|
|
||||||
|
public MapLayer(){}
|
||||||
|
public MapLayer(Layer layer,Boolean isBinded){
|
||||||
|
this.layer = layer;
|
||||||
|
this.isBinded = isBinded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Layer getLayer() {
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayer(Layer layer) {
|
||||||
|
this.layer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getBinded() {
|
||||||
|
return isBinded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBinded(Boolean binded) {
|
||||||
|
isBinded = binded;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,8 @@ package com.gis3c.ol.service;
|
|||||||
|
|
||||||
|
|
||||||
import com.gis3c.ol.entity.Layer;
|
import com.gis3c.ol.entity.Layer;
|
||||||
|
import com.gis3c.ol.entity.LayerSource;
|
||||||
|
import com.gis3c.ol.entity.MapLayer;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -11,8 +13,14 @@ import java.util.Set;
|
|||||||
* Created by hukekuan on 2017/12/15.
|
* Created by hukekuan on 2017/12/15.
|
||||||
*/
|
*/
|
||||||
public interface LayerService {
|
public interface LayerService {
|
||||||
public List<Map<String,Object>> findLayerList();
|
public List<LayerSource> findLayerList();
|
||||||
public List<Layer> findSimpleLayerList();
|
|
||||||
|
/**
|
||||||
|
* 获取地图中需要设置的图层列表
|
||||||
|
* @param layerIdList 地图中已加入的图层编号
|
||||||
|
* @return 在图层列表基础上新增已添加标记
|
||||||
|
*/
|
||||||
|
public List<MapLayer> findSimpleLayerList(List<String> layerIdList);
|
||||||
public List<java.util.Map<String,Object>> findLayersByPage(Integer pageSize,Integer currentPage);
|
public List<java.util.Map<String,Object>> findLayersByPage(Integer pageSize,Integer currentPage);
|
||||||
|
|
||||||
public Layer findeLayerById(String layerId);
|
public Layer findeLayerById(String layerId);
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import com.gis3c.common.exception.BusinessException;
|
|||||||
import com.gis3c.ol.dao.LayerDao;
|
import com.gis3c.ol.dao.LayerDao;
|
||||||
import com.gis3c.ol.dao.SourceDao;
|
import com.gis3c.ol.dao.SourceDao;
|
||||||
import com.gis3c.ol.entity.Layer;
|
import com.gis3c.ol.entity.Layer;
|
||||||
|
import com.gis3c.ol.entity.LayerSource;
|
||||||
|
import com.gis3c.ol.entity.MapLayer;
|
||||||
import com.gis3c.ol.service.LayerService;
|
import com.gis3c.ol.service.LayerService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -22,17 +24,17 @@ public class LayerServiceImpl implements LayerService {
|
|||||||
private SourceDao sourceDao;
|
private SourceDao sourceDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> findLayerList() {
|
public List<LayerSource> findLayerList() {
|
||||||
List<Map<String, Object>> result = new ArrayList<>();
|
List<LayerSource> result = new ArrayList<>();
|
||||||
Map<String, Object> layerMap;
|
LayerSource layerMap;
|
||||||
String sourceId;
|
String sourceId;
|
||||||
List<Layer> layerList = layerDao.findLayerList();
|
List<Layer> layerList = layerDao.findLayerList();
|
||||||
for(int i = 0,len = layerList.size();i < len;i++){
|
for(int i = 0,len = layerList.size();i < len;i++){
|
||||||
layerMap = new HashMap<>();
|
layerMap = new LayerSource();
|
||||||
layerMap.put("layer",layerList.get(i));
|
layerMap.setLayer(layerList.get(i));
|
||||||
sourceId = layerList.get(i).getSource();
|
sourceId = layerList.get(i).getSource();
|
||||||
if(sourceId != null && !"".equals(sourceId)){
|
if(sourceId != null && !"".equals(sourceId)){
|
||||||
layerMap.put("source",sourceDao.findSourceById(sourceId));
|
layerMap.setSource(sourceDao.findSourceById(sourceId));
|
||||||
}
|
}
|
||||||
result.add(layerMap);
|
result.add(layerMap);
|
||||||
}
|
}
|
||||||
@ -40,8 +42,34 @@ public class LayerServiceImpl implements LayerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Layer> findSimpleLayerList() {
|
public List<MapLayer> findSimpleLayerList(List<String> layerIdList) {
|
||||||
return layerDao.findLayerList();
|
List<MapLayer> result = new ArrayList<>();
|
||||||
|
List<Layer> layerList = layerDao.findLayerList();
|
||||||
|
MapLayer mapLayer;
|
||||||
|
Layer queryLayer;
|
||||||
|
if(layerIdList != null && layerIdList.size() > 0){
|
||||||
|
for(String layerId : layerIdList){
|
||||||
|
mapLayer = new MapLayer();
|
||||||
|
queryLayer = layerList.stream()
|
||||||
|
.filter(layer -> layer.getLayerId().equals(layerId))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
if(queryLayer != null){
|
||||||
|
mapLayer.setLayer(queryLayer);
|
||||||
|
mapLayer.setBinded(true);
|
||||||
|
result.add(mapLayer);
|
||||||
|
|
||||||
|
layerList.remove(queryLayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(Layer layer : layerList){
|
||||||
|
mapLayer = new MapLayer();
|
||||||
|
mapLayer.setLayer(layer);
|
||||||
|
result.add(mapLayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
package com.gis3c.spatial;
|
package com.gis3c.spatial;
|
||||||
|
|
||||||
import com.gis3c.common.bean.BeanUtil;
|
import com.gis3c.common.bean.BeanUtil;
|
||||||
import com.gis3c.ol.entity.Layer;
|
import com.gis3c.ol.entity.*;
|
||||||
import com.gis3c.ol.entity.Map;
|
import com.gis3c.ol.entity.Map;
|
||||||
import com.gis3c.ol.entity.Source;
|
|
||||||
import com.gis3c.ol.service.LayerService;
|
import com.gis3c.ol.service.LayerService;
|
||||||
import com.gis3c.ol.service.MapService;
|
import com.gis3c.ol.service.MapService;
|
||||||
import com.gis3c.ol.service.SourceService;
|
import com.gis3c.ol.service.SourceService;
|
||||||
@ -30,8 +29,37 @@ public class App {
|
|||||||
TestService testService = context.getBean(TestService.class);
|
TestService testService = context.getBean(TestService.class);
|
||||||
|
|
||||||
|
|
||||||
List<Layer> layerList = layerService.findSimpleLayerList();
|
List<String> layerIdList = new ArrayList<>(Arrays.asList(new String[]{
|
||||||
System.out.println(layerList);
|
"a2d69fcd-fa4a-4fe5-8696-ae3e30042126",
|
||||||
|
"aabb842e-239e-491d-9c70-a2cec1f65886"
|
||||||
|
}));
|
||||||
|
List<MapLayer> result = layerService.findSimpleLayerList(layerIdList);
|
||||||
|
System.out.println(result.size());
|
||||||
|
System.out.println(result.get(0).getLayer().getLayerId());
|
||||||
|
System.out.println(result.get(1).getLayer().getLayerId());
|
||||||
|
|
||||||
|
|
||||||
|
// String result = testList.stream().filter(test-> "2".equals(test)).findFirst().orElse(null);
|
||||||
|
// System.out.println(result);
|
||||||
|
// System.out.println(testList);
|
||||||
|
// System.out.println(testList.get(0));
|
||||||
|
// testList.remove(0);
|
||||||
|
// System.out.println(testList);
|
||||||
|
// System.out.println(testList.get(0));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// List<LayerSource> layerSources = layerService.findLayerList();
|
||||||
|
// System.out.println(layerSources.get(0));
|
||||||
|
|
||||||
|
// List<MapLayer> layerList = layerService.findSimpleLayerList("e8819b8e-9397-4609-8b23-9f18c9588d6b");
|
||||||
|
// System.out.println(layerList.get(2).getBinded());
|
||||||
|
|
||||||
// java.util.Map<String,Object> layerOptions = new HashMap<>();
|
// java.util.Map<String,Object> layerOptions = new HashMap<>();
|
||||||
// layerOptions.put("a","aaaaaaaa");
|
// layerOptions.put("a","aaaaaaaa");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user