初始化
This commit is contained in:
parent
4212cfa194
commit
cb65181306
@ -20,7 +20,7 @@ public interface LayerDao {
|
||||
public Layer findeLayerById(String layerId);
|
||||
public Layer findeLayerByName(String layerName);
|
||||
public List<Layer> findLayerByIds(String[] layerIds);
|
||||
|
||||
public Integer findLayerCount();
|
||||
public Integer insertLayer(Layer layer);
|
||||
|
||||
public Integer bindSource(
|
||||
|
||||
@ -19,6 +19,7 @@ public interface MapDao {
|
||||
|
||||
public Map findMapById(String mapId);
|
||||
public Map findMapByName(String mapName);
|
||||
public Integer findMapCount();
|
||||
public Integer insertMap(Map map);
|
||||
|
||||
public Integer deleteMapsById(Set<String> mapIds);
|
||||
|
||||
@ -22,6 +22,7 @@ public interface SourceDao {
|
||||
public List<Source> findSourceByType(
|
||||
@Param("sourceTypes") String[] sourceTypes,
|
||||
@Param("projection") String projection);
|
||||
public Integer findSourceCount();
|
||||
public Integer insertSource(Source source);
|
||||
|
||||
public Integer deleteSourcesById(Set<String> sourceIds);
|
||||
|
||||
@ -25,7 +25,7 @@ public interface LayerService {
|
||||
public Layer findeLayerById(String layerId);
|
||||
public Layer findeLayerByName(String layerName);
|
||||
public List<LayerSource> findLayerByIds(String[] layerIds);
|
||||
|
||||
public Integer findLayerCount();
|
||||
public Integer insertLayer(Layer layer);
|
||||
public Integer bindSource(String layerId,String sourceId,java.util.Map<String,Object> options);
|
||||
public Integer deleteLayersById(Set<String> layerIds);
|
||||
|
||||
@ -14,6 +14,7 @@ public interface MapService {
|
||||
|
||||
public Map findMapById(String mapId);
|
||||
public Map findMapByName(String mapName);
|
||||
public Integer findMapCount();
|
||||
public Integer insertMap(Map map);
|
||||
|
||||
public Integer deleteMapsById(Set<String> mapIds);
|
||||
|
||||
@ -15,7 +15,7 @@ public interface SourceService {
|
||||
public Source findSourceById(String sourceId);
|
||||
public Source findSourceByName(String sourceName);
|
||||
public List<Source> findSourceByType(String[] sourceTypes,String projection);
|
||||
|
||||
public Integer findSourceCount();
|
||||
|
||||
public Integer insertSource(Source source);
|
||||
|
||||
|
||||
@ -98,6 +98,11 @@ public class LayerServiceImpl implements LayerService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findLayerCount() {
|
||||
return layerDao.findLayerCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer insertLayer(Layer layer) {
|
||||
layer.setLayerId(UUID.randomUUID().toString());
|
||||
|
||||
@ -47,6 +47,11 @@ public class MapServiceImpl implements MapService {
|
||||
return mapDao.findMapByName(mapName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findMapCount() {
|
||||
return mapDao.findMapCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer insertMap(Map map) {
|
||||
map.setMapId(UUID.randomUUID().toString());
|
||||
|
||||
@ -52,6 +52,11 @@ public class SourceServiceImpl implements SourceService {
|
||||
return sourceDao.findSourceByType(sourceTypes,projection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer findSourceCount() {
|
||||
return sourceDao.findSourceCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer insertSource(Source source) {
|
||||
source.setSourceId(UUID.randomUUID().toString());
|
||||
|
||||
17
src/main/java/com/gis3c/spatial/dao/RegionDao.java
Normal file
17
src/main/java/com/gis3c/spatial/dao/RegionDao.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.gis3c.spatial.dao;
|
||||
|
||||
import com.gis3c.spatial.entity.Region;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/3/9.
|
||||
*/
|
||||
public interface RegionDao {
|
||||
public Region findRegionByCode(String reginType, String reginCode);
|
||||
public String findRgionCenterByCode(String reginType, String reginCode);
|
||||
public List<Region> findAroundRegions(String reginType, String reginCode);
|
||||
public List<Region> findRegionsByParentCode(String parentCode);
|
||||
public List<Map<String,String>> findRegionCentersByParentCode(String parentCode);
|
||||
}
|
||||
@ -1,19 +1,13 @@
|
||||
package com.gis3c.spatial.entity.feature;
|
||||
package com.gis3c.spatial.entity;
|
||||
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.geotools.data.DataUtilities;
|
||||
import org.geotools.data.simple.SimpleFeatureCollection;
|
||||
import org.geotools.feature.simple.SimpleFeatureBuilder;
|
||||
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
|
||||
import org.geotools.geojson.feature.FeatureJSON;
|
||||
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
||||
import org.opengis.feature.simple.SimpleFeature;
|
||||
import org.opengis.feature.simple.SimpleFeatureType;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -24,7 +18,7 @@ import java.util.List;
|
||||
* @Description 具有空间字段的基类
|
||||
* @date 2017-07-10 下午3:43
|
||||
*/
|
||||
public class BaseFeature implements IFeature {
|
||||
public class BaseFeature {
|
||||
private Geometry geometry;
|
||||
|
||||
public Geometry getGeometry() {
|
||||
@ -38,8 +32,7 @@ public class BaseFeature implements IFeature {
|
||||
/**
|
||||
* 获取所有字段信息
|
||||
*/
|
||||
@Override
|
||||
public List<Field> AllFieldes(){
|
||||
public List<Field> AllFieldes(){
|
||||
List<Field> fieldList = new ArrayList<>();
|
||||
|
||||
Class superClass = BaseFeature.class;
|
||||
@ -68,7 +61,7 @@ public class BaseFeature implements IFeature {
|
||||
if(!geometryChecked()){
|
||||
throw new NullPointerException("空间字段为空");
|
||||
}
|
||||
//CoordinateReferenceSystem crs = this.geometry..GetCRS();
|
||||
|
||||
CoordinateReferenceSystem crs = null;
|
||||
build.setCRS(crs !=null? crs:DefaultGeographicCRS.WGS84);
|
||||
build.setName(this.getClass().getSimpleName());
|
||||
@ -111,7 +104,7 @@ public class BaseFeature implements IFeature {
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************************/
|
||||
/***************************************************************************************************/
|
||||
|
||||
/**
|
||||
* @author hukekuan
|
||||
34
src/main/java/com/gis3c/spatial/entity/Region.java
Normal file
34
src/main/java/com/gis3c/spatial/entity/Region.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.gis3c.spatial.entity;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/3/9.
|
||||
*/
|
||||
public class Region extends BaseFeature {
|
||||
private String reginCode;
|
||||
private String regionName;
|
||||
private String style;
|
||||
|
||||
public String getReginCode() {
|
||||
return reginCode;
|
||||
}
|
||||
|
||||
public void setReginCode(String reginCode) {
|
||||
this.reginCode = reginCode;
|
||||
}
|
||||
|
||||
public String getRegionName() {
|
||||
return regionName;
|
||||
}
|
||||
|
||||
public void setRegionName(String regionName) {
|
||||
this.regionName = regionName;
|
||||
}
|
||||
|
||||
public String getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
public void setStyle(String style) {
|
||||
this.style = style;
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package com.gis3c.spatial.entity.feature;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface IFeature {
|
||||
/**
|
||||
* @author hukekuan
|
||||
* @Description 获取所有的Field,前提是要有Geometry属性
|
||||
* @date 2017-07-10 下午4:36
|
||||
* @return 返回所有的Field
|
||||
*/
|
||||
public List<Field> AllFieldes();
|
||||
}
|
||||
48
src/main/java/com/gis3c/spatial/service/RegionService.java
Normal file
48
src/main/java/com/gis3c/spatial/service/RegionService.java
Normal file
@ -0,0 +1,48 @@
|
||||
package com.gis3c.spatial.service;
|
||||
|
||||
import com.gis3c.spatial.entity.Region;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/3/9.
|
||||
*/
|
||||
public interface RegionService {
|
||||
/**
|
||||
* 获取区域实体
|
||||
* @param reginType
|
||||
* @param reginCode
|
||||
*/
|
||||
public Region findRegionByCode(String reginType, String reginCode);
|
||||
|
||||
/**
|
||||
* 获取区域中心点
|
||||
* @param reginType
|
||||
* @param reginCode
|
||||
* @return 中心点wkt字符串
|
||||
*/
|
||||
public String findRgionCenterByCode(String reginType, String reginCode);
|
||||
|
||||
/**
|
||||
* 获取区域周边区域
|
||||
* @param reginType
|
||||
* @param reginCode
|
||||
* @return
|
||||
*/
|
||||
public List<Region> findAroundRegions(String reginType, String reginCode);
|
||||
|
||||
/**
|
||||
* 获取区域内部的所有子区域
|
||||
* @param parentCode
|
||||
* @return
|
||||
*/
|
||||
public List<Region> findRegionsByParentCode(String parentCode);
|
||||
|
||||
/**
|
||||
* 获取子区域内部的所有子区域的中心点
|
||||
* @param parentCode
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String,String>> findRegionCentersByParentCode(String parentCode);
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.gis3c.spatial.service.impl;
|
||||
|
||||
import com.gis3c.spatial.entity.Region;
|
||||
import com.gis3c.spatial.service.RegionService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/3/9.
|
||||
*/
|
||||
public class RegionServiceImpl implements RegionService {
|
||||
@Override
|
||||
public Region findRegionByCode(String reginType, String reginCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findRgionCenterByCode(String reginType, String reginCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Region> findAroundRegions(String reginType, String reginCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Region> findRegionsByParentCode(String parentCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> findRegionCentersByParentCode(String parentCode) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -30,11 +30,19 @@ public class App {
|
||||
MapService mapService = context.getBean(MapService.class);
|
||||
TestService testService = context.getBean(TestService.class);
|
||||
|
||||
List<LayerSource> layerSources
|
||||
= layerService.findLayerByIds(new String[]{"aabb842e-239e-491d-9c70-a2cec1f65886"});
|
||||
|
||||
System.out.println(layerSources);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// List<LayerSource> layerSources
|
||||
// = layerService.findLayerByIds(new String[]{"aabb842e-239e-491d-9c70-a2cec1f65886"});
|
||||
// List<String> layerIdList = new ArrayList<>(Arrays.asList(new String[]{
|
||||
// "a2d69fcd-fa4a-4fe5-8696-ae3e30042126",
|
||||
// "aabb842e-239e-491d-9c70-a2cec1f65886"
|
||||
@ -54,13 +62,6 @@ public class App {
|
||||
// System.out.println(testList.get(0));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// List<LayerSource> layerSources = layerService.findLayerList();
|
||||
// System.out.println(layerSources.get(0));
|
||||
|
||||
@ -97,8 +98,6 @@ public class App {
|
||||
// System.out.println("".equals(source));
|
||||
|
||||
|
||||
|
||||
|
||||
// Layer layer = layerService.findeLayerById("d804360f-eb5f-4e29-94ab-fdafbf224e02");
|
||||
// System.out.println(layer.getExtent());
|
||||
|
||||
@ -117,12 +116,10 @@ public class App {
|
||||
// sourceService.insertSource(newSource);
|
||||
// System.out.println("插入成功");
|
||||
|
||||
|
||||
// List<Map> mapList = mapService.findMapsByByPage(10,0);
|
||||
// Map map = mapService.findMapById("fc813a1f-6a31-4202-9419-8d125ba203c9");
|
||||
// System.out.println(map);
|
||||
|
||||
|
||||
// List<Test> result = testService.allList();
|
||||
// Test test = result.get(0);
|
||||
// SimpleFeatureType type = test.createFeatureType();
|
||||
@ -196,7 +193,6 @@ public class App {
|
||||
// System.out.println(wmts.getUrl());
|
||||
|
||||
|
||||
|
||||
// 视图接口
|
||||
// View view = viewService.findeViewById("ee2f96a0-097a-4f0a-9767-f52b8dae28e0");
|
||||
// System.out.println("["+ ((Double[])view.getCenter())[0] + ", " + ((Double[])view.getCenter())[1] + "]");
|
||||
|
||||
@ -66,6 +66,10 @@
|
||||
;
|
||||
</select>
|
||||
|
||||
<select id="findLayerCount" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1) FROM c3gis_ol_layer;
|
||||
</select>
|
||||
|
||||
<select id="findeLayerByName" resultMap="layerResult">
|
||||
SELECT
|
||||
<include refid="layerColumns"/>
|
||||
|
||||
@ -53,6 +53,9 @@
|
||||
FROM c3gis_ol_map
|
||||
WHERE mapname = #{mapName, javaType=java.lang.String};
|
||||
</select>
|
||||
<select id="findMapCount" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1) FROM c3gis_ol_map;
|
||||
</select>
|
||||
<insert id="insertMap" parameterType="com.gis3c.ol.entity.Map">
|
||||
INSERT INTO c3gis_ol_map( mapid
|
||||
, mapname
|
||||
|
||||
@ -55,7 +55,9 @@
|
||||
and projection = #{projection, javaType=java.lang.String}
|
||||
ORDER BY sourceName;
|
||||
</select>
|
||||
|
||||
<select id="findSourceCount" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1) FROM c3gis_ol_source;
|
||||
</select>
|
||||
<insert id="insertSource" parameterType="com.gis3c.ol.entity.Source">
|
||||
INSERT INTO c3gis_ol_source(sourceId
|
||||
, sourceName
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
sys.driverClassName=org.postgresql.Driver
|
||||
sys.url=jdbc:postgresql:gisdata
|
||||
sys.url=jdbc:postgresql://172.16.6.13:5432/gisdata
|
||||
sys.username=gis
|
||||
sys.password=gis
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user