初始化
This commit is contained in:
parent
4212cfa194
commit
cb65181306
@ -20,7 +20,7 @@ public interface LayerDao {
|
|||||||
public Layer findeLayerById(String layerId);
|
public Layer findeLayerById(String layerId);
|
||||||
public Layer findeLayerByName(String layerName);
|
public Layer findeLayerByName(String layerName);
|
||||||
public List<Layer> findLayerByIds(String[] layerIds);
|
public List<Layer> findLayerByIds(String[] layerIds);
|
||||||
|
public Integer findLayerCount();
|
||||||
public Integer insertLayer(Layer layer);
|
public Integer insertLayer(Layer layer);
|
||||||
|
|
||||||
public Integer bindSource(
|
public Integer bindSource(
|
||||||
|
|||||||
@ -19,6 +19,7 @@ public interface MapDao {
|
|||||||
|
|
||||||
public Map findMapById(String mapId);
|
public Map findMapById(String mapId);
|
||||||
public Map findMapByName(String mapName);
|
public Map findMapByName(String mapName);
|
||||||
|
public Integer findMapCount();
|
||||||
public Integer insertMap(Map map);
|
public Integer insertMap(Map map);
|
||||||
|
|
||||||
public Integer deleteMapsById(Set<String> mapIds);
|
public Integer deleteMapsById(Set<String> mapIds);
|
||||||
|
|||||||
@ -22,6 +22,7 @@ public interface SourceDao {
|
|||||||
public List<Source> findSourceByType(
|
public List<Source> findSourceByType(
|
||||||
@Param("sourceTypes") String[] sourceTypes,
|
@Param("sourceTypes") String[] sourceTypes,
|
||||||
@Param("projection") String projection);
|
@Param("projection") String projection);
|
||||||
|
public Integer findSourceCount();
|
||||||
public Integer insertSource(Source source);
|
public Integer insertSource(Source source);
|
||||||
|
|
||||||
public Integer deleteSourcesById(Set<String> sourceIds);
|
public Integer deleteSourcesById(Set<String> sourceIds);
|
||||||
|
|||||||
@ -25,7 +25,7 @@ public interface LayerService {
|
|||||||
public Layer findeLayerById(String layerId);
|
public Layer findeLayerById(String layerId);
|
||||||
public Layer findeLayerByName(String layerName);
|
public Layer findeLayerByName(String layerName);
|
||||||
public List<LayerSource> findLayerByIds(String[] layerIds);
|
public List<LayerSource> findLayerByIds(String[] layerIds);
|
||||||
|
public Integer findLayerCount();
|
||||||
public Integer insertLayer(Layer layer);
|
public Integer insertLayer(Layer layer);
|
||||||
public Integer bindSource(String layerId,String sourceId,java.util.Map<String,Object> options);
|
public Integer bindSource(String layerId,String sourceId,java.util.Map<String,Object> options);
|
||||||
public Integer deleteLayersById(Set<String> layerIds);
|
public Integer deleteLayersById(Set<String> layerIds);
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public interface MapService {
|
|||||||
|
|
||||||
public Map findMapById(String mapId);
|
public Map findMapById(String mapId);
|
||||||
public Map findMapByName(String mapName);
|
public Map findMapByName(String mapName);
|
||||||
|
public Integer findMapCount();
|
||||||
public Integer insertMap(Map map);
|
public Integer insertMap(Map map);
|
||||||
|
|
||||||
public Integer deleteMapsById(Set<String> mapIds);
|
public Integer deleteMapsById(Set<String> mapIds);
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public interface SourceService {
|
|||||||
public Source findSourceById(String sourceId);
|
public Source findSourceById(String sourceId);
|
||||||
public Source findSourceByName(String sourceName);
|
public Source findSourceByName(String sourceName);
|
||||||
public List<Source> findSourceByType(String[] sourceTypes,String projection);
|
public List<Source> findSourceByType(String[] sourceTypes,String projection);
|
||||||
|
public Integer findSourceCount();
|
||||||
|
|
||||||
public Integer insertSource(Source source);
|
public Integer insertSource(Source source);
|
||||||
|
|
||||||
|
|||||||
@ -98,6 +98,11 @@ public class LayerServiceImpl implements LayerService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findLayerCount() {
|
||||||
|
return layerDao.findLayerCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer insertLayer(Layer layer) {
|
public Integer insertLayer(Layer layer) {
|
||||||
layer.setLayerId(UUID.randomUUID().toString());
|
layer.setLayerId(UUID.randomUUID().toString());
|
||||||
|
|||||||
@ -47,6 +47,11 @@ public class MapServiceImpl implements MapService {
|
|||||||
return mapDao.findMapByName(mapName);
|
return mapDao.findMapByName(mapName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findMapCount() {
|
||||||
|
return mapDao.findMapCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer insertMap(Map map) {
|
public Integer insertMap(Map map) {
|
||||||
map.setMapId(UUID.randomUUID().toString());
|
map.setMapId(UUID.randomUUID().toString());
|
||||||
|
|||||||
@ -52,6 +52,11 @@ public class SourceServiceImpl implements SourceService {
|
|||||||
return sourceDao.findSourceByType(sourceTypes,projection);
|
return sourceDao.findSourceByType(sourceTypes,projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer findSourceCount() {
|
||||||
|
return sourceDao.findSourceCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer insertSource(Source source) {
|
public Integer insertSource(Source source) {
|
||||||
source.setSourceId(UUID.randomUUID().toString());
|
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 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.SimpleFeatureBuilder;
|
||||||
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
|
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
|
||||||
import org.geotools.geojson.feature.FeatureJSON;
|
|
||||||
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
||||||
import org.opengis.feature.simple.SimpleFeature;
|
import org.opengis.feature.simple.SimpleFeature;
|
||||||
import org.opengis.feature.simple.SimpleFeatureType;
|
import org.opengis.feature.simple.SimpleFeatureType;
|
||||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
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.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -24,7 +18,7 @@ import java.util.List;
|
|||||||
* @Description 具有空间字段的基类
|
* @Description 具有空间字段的基类
|
||||||
* @date 2017-07-10 下午3:43
|
* @date 2017-07-10 下午3:43
|
||||||
*/
|
*/
|
||||||
public class BaseFeature implements IFeature {
|
public class BaseFeature {
|
||||||
private Geometry geometry;
|
private Geometry geometry;
|
||||||
|
|
||||||
public Geometry getGeometry() {
|
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<>();
|
List<Field> fieldList = new ArrayList<>();
|
||||||
|
|
||||||
Class superClass = BaseFeature.class;
|
Class superClass = BaseFeature.class;
|
||||||
@ -68,7 +61,7 @@ public class BaseFeature implements IFeature {
|
|||||||
if(!geometryChecked()){
|
if(!geometryChecked()){
|
||||||
throw new NullPointerException("空间字段为空");
|
throw new NullPointerException("空间字段为空");
|
||||||
}
|
}
|
||||||
//CoordinateReferenceSystem crs = this.geometry..GetCRS();
|
|
||||||
CoordinateReferenceSystem crs = null;
|
CoordinateReferenceSystem crs = null;
|
||||||
build.setCRS(crs !=null? crs:DefaultGeographicCRS.WGS84);
|
build.setCRS(crs !=null? crs:DefaultGeographicCRS.WGS84);
|
||||||
build.setName(this.getClass().getSimpleName());
|
build.setName(this.getClass().getSimpleName());
|
||||||
@ -111,7 +104,7 @@ public class BaseFeature implements IFeature {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************/
|
/***************************************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hukekuan
|
* @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);
|
MapService mapService = context.getBean(MapService.class);
|
||||||
TestService testService = context.getBean(TestService.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[]{
|
// List<String> layerIdList = new ArrayList<>(Arrays.asList(new String[]{
|
||||||
// "a2d69fcd-fa4a-4fe5-8696-ae3e30042126",
|
// "a2d69fcd-fa4a-4fe5-8696-ae3e30042126",
|
||||||
// "aabb842e-239e-491d-9c70-a2cec1f65886"
|
// "aabb842e-239e-491d-9c70-a2cec1f65886"
|
||||||
@ -54,13 +62,6 @@ public class App {
|
|||||||
// System.out.println(testList.get(0));
|
// System.out.println(testList.get(0));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// List<LayerSource> layerSources = layerService.findLayerList();
|
// List<LayerSource> layerSources = layerService.findLayerList();
|
||||||
// System.out.println(layerSources.get(0));
|
// System.out.println(layerSources.get(0));
|
||||||
|
|
||||||
@ -97,8 +98,6 @@ public class App {
|
|||||||
// System.out.println("".equals(source));
|
// System.out.println("".equals(source));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Layer layer = layerService.findeLayerById("d804360f-eb5f-4e29-94ab-fdafbf224e02");
|
// Layer layer = layerService.findeLayerById("d804360f-eb5f-4e29-94ab-fdafbf224e02");
|
||||||
// System.out.println(layer.getExtent());
|
// System.out.println(layer.getExtent());
|
||||||
|
|
||||||
@ -117,12 +116,10 @@ public class App {
|
|||||||
// sourceService.insertSource(newSource);
|
// sourceService.insertSource(newSource);
|
||||||
// System.out.println("插入成功");
|
// System.out.println("插入成功");
|
||||||
|
|
||||||
|
|
||||||
// List<Map> mapList = mapService.findMapsByByPage(10,0);
|
// List<Map> mapList = mapService.findMapsByByPage(10,0);
|
||||||
// Map map = mapService.findMapById("fc813a1f-6a31-4202-9419-8d125ba203c9");
|
// Map map = mapService.findMapById("fc813a1f-6a31-4202-9419-8d125ba203c9");
|
||||||
// System.out.println(map);
|
// System.out.println(map);
|
||||||
|
|
||||||
|
|
||||||
// List<Test> result = testService.allList();
|
// List<Test> result = testService.allList();
|
||||||
// Test test = result.get(0);
|
// Test test = result.get(0);
|
||||||
// SimpleFeatureType type = test.createFeatureType();
|
// SimpleFeatureType type = test.createFeatureType();
|
||||||
@ -196,7 +193,6 @@ public class App {
|
|||||||
// System.out.println(wmts.getUrl());
|
// System.out.println(wmts.getUrl());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 视图接口
|
// 视图接口
|
||||||
// View view = viewService.findeViewById("ee2f96a0-097a-4f0a-9767-f52b8dae28e0");
|
// View view = viewService.findeViewById("ee2f96a0-097a-4f0a-9767-f52b8dae28e0");
|
||||||
// System.out.println("["+ ((Double[])view.getCenter())[0] + ", " + ((Double[])view.getCenter())[1] + "]");
|
// System.out.println("["+ ((Double[])view.getCenter())[0] + ", " + ((Double[])view.getCenter())[1] + "]");
|
||||||
|
|||||||
@ -66,6 +66,10 @@
|
|||||||
;
|
;
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findLayerCount" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(1) FROM c3gis_ol_layer;
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="findeLayerByName" resultMap="layerResult">
|
<select id="findeLayerByName" resultMap="layerResult">
|
||||||
SELECT
|
SELECT
|
||||||
<include refid="layerColumns"/>
|
<include refid="layerColumns"/>
|
||||||
|
|||||||
@ -53,6 +53,9 @@
|
|||||||
FROM c3gis_ol_map
|
FROM c3gis_ol_map
|
||||||
WHERE mapname = #{mapName, javaType=java.lang.String};
|
WHERE mapname = #{mapName, javaType=java.lang.String};
|
||||||
</select>
|
</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 id="insertMap" parameterType="com.gis3c.ol.entity.Map">
|
||||||
INSERT INTO c3gis_ol_map( mapid
|
INSERT INTO c3gis_ol_map( mapid
|
||||||
, mapname
|
, mapname
|
||||||
|
|||||||
@ -55,7 +55,9 @@
|
|||||||
and projection = #{projection, javaType=java.lang.String}
|
and projection = #{projection, javaType=java.lang.String}
|
||||||
ORDER BY sourceName;
|
ORDER BY sourceName;
|
||||||
</select>
|
</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 id="insertSource" parameterType="com.gis3c.ol.entity.Source">
|
||||||
INSERT INTO c3gis_ol_source(sourceId
|
INSERT INTO c3gis_ol_source(sourceId
|
||||||
, sourceName
|
, sourceName
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
sys.driverClassName=org.postgresql.Driver
|
sys.driverClassName=org.postgresql.Driver
|
||||||
sys.url=jdbc:postgresql:gisdata
|
sys.url=jdbc:postgresql://172.16.6.13:5432/gisdata
|
||||||
sys.username=gis
|
sys.username=gis
|
||||||
sys.password=gis
|
sys.password=gis
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user