初始化

This commit is contained in:
hukekuan@163.com 2018-01-27 17:47:20 +08:00
parent 8505a79dd9
commit 3801f03f37
23 changed files with 300 additions and 620 deletions

View File

@ -1,12 +1,16 @@
package com.gis3c.common.json; package com.gis3c.common.json;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationConfig; import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.core.annotation.AnnotationUtils;
import java.io.OutputStream; import java.io.OutputStream;
/** /**
@ -28,25 +32,59 @@ public class JsonUtil {
public static String Stringify(Object object){ public static String Stringify(Object object){
try { try {
return objectMapper.writeValueAsString(object); return objectMapper.writeValueAsString(object);
} catch (JsonProcessingException e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
return null; return null;
} }
public static String Stringify(Object object, String... properties){ public static String Stringify(Object object, String... properties){
try {
return objectMapper
.writer(new SimpleFilterProvider().addFilter(
AnnotationUtils.getValue(
AnnotationUtils.findAnnotation(object.getClass(), JsonFilter.class)).toString(),
SimpleBeanPropertyFilter.filterOutAllExcept(properties)))
.writeValueAsString(object);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null; return null;
} }
public static void Stringify(OutputStream out, Object objec){ public static void Stringify(OutputStream out, Object objec){
try {
objectMapper.writeValue(out, objec);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
} }
public static void Stringify(OutputStream out, Object object, String... properties){ public static void Stringify(OutputStream out, Object object, String... properties){
try {
objectMapper
.writer(new SimpleFilterProvider().addFilter(
AnnotationUtils.getValue(
AnnotationUtils.findAnnotation(object.getClass(), JsonFilter.class)).toString(),
SimpleBeanPropertyFilter.filterOutAllExcept(properties)))
.writeValue(out, object);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
} }
public static <T> T Parse(String json, Class<T> clazz){ public static <T> T Parse(String json, Class<T> clazz){
if (json == null || json.length() == 0) {
return null;
}
try {
return objectMapper.readValue(json, clazz);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return null; return null;
} }
} }

View File

@ -1,23 +1,15 @@
package com.gis3c.ol.dao; package com.gis3c.ol.dao;
import com.gis3c.common.persistence.annotation.C3olDao; import com.gis3c.common.persistence.annotation.C3olDao;
import com.gis3c.ol.entity.layer.TileLayer; import com.gis3c.ol.entity.Layer;
import com.gis3c.ol.entity.layer.VectorLayer;
/** /**
* Created by hukekuan on 2017/12/15. * Created by hukekuan on 2017/12/15.
*/ */
@C3olDao @C3olDao
public interface LayerDao { public interface LayerDao {
public TileLayer findeTileLayerById(String layerId); public Layer findeLayerById(String layerId);
public TileLayer findeTileLayerByName(String layerName); public Layer findeLayerByName(String layerName);
public int insertTileLayer(TileLayer tileLayer); public Integer insertLayer(Layer layer);
public VectorLayer findeVectorLayerById(String layerId);
public VectorLayer findeVectorLayerByName(String layerName);
public int insertVectorLayer(VectorLayer vectorLayer);
} }

View File

@ -1,11 +1,14 @@
package com.gis3c.ol.dao; package com.gis3c.ol.dao;
import com.gis3c.common.persistence.annotation.C3olDao; import com.gis3c.common.persistence.annotation.C3olDao;
import com.gis3c.ol.entity.Source;
import com.gis3c.ol.entity.source.TileArcGISRest; import com.gis3c.ol.entity.source.TileArcGISRest;
import com.gis3c.ol.entity.source.TileSuperMapRest; import com.gis3c.ol.entity.source.TileSuperMapRest;
import com.gis3c.ol.entity.source.Vector; import com.gis3c.ol.entity.source.Vector;
import com.gis3c.ol.entity.source.Wmts; import com.gis3c.ol.entity.source.Wmts;
import java.util.List;
/** /**
* Created by hukekuan on 2017/12/15. * Created by hukekuan on 2017/12/15.
*/ */
@ -36,4 +39,7 @@ public interface SourceDao {
public Wmts findWmtsByName(String sourceName); public Wmts findWmtsByName(String sourceName);
public Integer insertWmts(Wmts wmts); public Integer insertWmts(Wmts wmts);
public List<Source> findAllSources();
public void insertSource(Source source);
} }

View File

@ -1,22 +0,0 @@
package com.gis3c.ol.dao;
import com.gis3c.common.persistence.annotation.C3olDao;
import com.gis3c.ol.entity.View;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by hukekuan on 2017/12/15.
*/
@C3olDao
public interface ViewDao {
public List<View> findViewsByByPage(
@Param("pageSize") Integer pageSize,
@Param("currentPage") Integer currentPage);
public View findeViewById(String viewId);
public View findeViewByName(String viewName);
public Integer insertView(View view);
}

View File

@ -1,17 +1,24 @@
package com.gis3c.ol.entity.layer; package com.gis3c.ol.entity;
import java.util.*;
import java.util.Map;
/** /**
* Created by hukekuan on 2017/12/14. * Created by hukekuan on 2018/1/27.
*/ */
public abstract class BaseLayer { public class Layer {
private String layerId; private String layerId;
private String layerName; private String layerName;
private Double opacity; private String aliasName;
private Double opacity = 1.0;
private String source;
private Boolean visible = Boolean.TRUE; private Boolean visible = Boolean.TRUE;
private Double[] extent; private Double[] extent;
private Integer zIndex = 0;
private Double maxResolution; private Double maxResolution;
private Double minResolution; private Double minResolution;
private String type;
private java.util.Map<String,Object> options;
private String description; private String description;
public String getLayerId() { public String getLayerId() {
@ -30,6 +37,14 @@ public abstract class BaseLayer {
this.layerName = layerName; this.layerName = layerName;
} }
public String getAliasName() {
return aliasName;
}
public void setAliasName(String aliasName) {
this.aliasName = aliasName;
}
public Double getOpacity() { public Double getOpacity() {
return opacity; return opacity;
} }
@ -38,6 +53,14 @@ public abstract class BaseLayer {
this.opacity = opacity; this.opacity = opacity;
} }
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public Boolean getVisible() { public Boolean getVisible() {
return visible; return visible;
} }
@ -54,6 +77,14 @@ public abstract class BaseLayer {
this.extent = extent; this.extent = extent;
} }
public Integer getzIndex() {
return zIndex;
}
public void setzIndex(Integer zIndex) {
this.zIndex = zIndex;
}
public Double getMaxResolution() { public Double getMaxResolution() {
return maxResolution; return maxResolution;
} }
@ -70,6 +101,22 @@ public abstract class BaseLayer {
this.minResolution = minResolution; this.minResolution = minResolution;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Map<String, Object> getOptions() {
return options;
}
public void setOptions(Map<String, Object> options) {
this.options = options;
}
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -77,4 +124,6 @@ public abstract class BaseLayer {
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
} }

View File

@ -6,7 +6,7 @@ package com.gis3c.ol.entity;
public class Map { public class Map {
private String mapId; private String mapId;
private String mapName; private String mapName;
private String view; private java.util.Map<String,Object> view;
private String[][] controls; private String[][] controls;
private Integer pixelRatio; private Integer pixelRatio;
private String[][] interactions; private String[][] interactions;
@ -31,11 +31,11 @@ public class Map {
this.mapName = mapName; this.mapName = mapName;
} }
public String getView() { public java.util.Map<String,Object> getView() {
return view; return view;
} }
public void setView(String view) { public void setView(java.util.Map<String,Object> view) {
this.view = view; this.view = view;
} }

View File

@ -9,6 +9,7 @@ import java.util.Map;
public class Source { public class Source {
private String sourceId; private String sourceId;
private String sourceName; private String sourceName;
private String url;
private java.util.Map<String,Object> params; private java.util.Map<String,Object> params;
private String description; private String description;
@ -43,4 +44,12 @@ public class Source {
public void setDescription(String description) { public void setDescription(String description) {
this.description = description; this.description = description;
} }
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
} }

View File

@ -1,133 +0,0 @@
package com.gis3c.ol.entity;
/**
* Created by hukekuan on 2017/12/14.
*/
public class View {
private String viewId;
private String viewName;
private Double[] center;
private Double[] extent;
private String maxResolution;
private String minResolution;
private Integer maxZoom;
private Integer minZoom;
private Integer zoom;
private String projection;
private String resolution;
private String[] resolutions;
private Double rotation;
private String description;
public String getViewId() {
return viewId;
}
public void setViewId(String viewId) {
this.viewId = viewId;
}
public String getViewName() {
return viewName;
}
public void setViewName(String viewName) {
this.viewName = viewName;
}
public Double[] getCenter() {
return center;
}
public void setCenter(Double[] center) {
this.center = center;
}
public Double[] getExtent() {
return extent;
}
public void setExtent(Double[] extent) {
this.extent = extent;
}
public String getMaxResolution() {
return maxResolution;
}
public void setMaxResolution(String maxResolution) {
this.maxResolution = maxResolution;
}
public String getMinResolution() {
return minResolution;
}
public void setMinResolution(String minResolution) {
this.minResolution = minResolution;
}
public Integer getMaxZoom() {
return maxZoom;
}
public void setMaxZoom(Integer maxZoom) {
this.maxZoom = maxZoom;
}
public Integer getMinZoom() {
return minZoom;
}
public void setMinZoom(Integer minZoom) {
this.minZoom = minZoom;
}
public Integer getZoom() {
return zoom;
}
public void setZoom(Integer zoom) {
this.zoom = zoom;
}
public String getProjection() {
return projection;
}
public void setProjection(String projection) {
this.projection = projection;
}
public String getResolution() {
return resolution;
}
public void setResolution(String resolution) {
this.resolution = resolution;
}
public String[] getResolutions() {
return resolutions;
}
public void setResolutions(String[] resolutions) {
this.resolutions = resolutions;
}
public Double getRotation() {
return rotation;
}
public void setRotation(Double rotation) {
this.rotation = rotation;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

View File

@ -1,16 +0,0 @@
package com.gis3c.ol.entity.layer;
/**
* Created by hukekuan on 2017/12/14.
*/
public class TileLayer extends BaseLayer {
private String[] source;
public String[] getSource() {
return source;
}
public void setSource(String[] source) {
this.source = source;
}
}

View File

@ -1,43 +0,0 @@
package com.gis3c.ol.entity.layer;
/**
* Created by hukekuan on 2017/12/14.
*/
public class VectorLayer extends BaseLayer {
private String source;
private Integer zIndex;
private String styleType;
private String styleValue;
public String getStyleType() {
return styleType;
}
public void setStyleType(String styleType) {
this.styleType = styleType;
}
public String getStyleValue() {
return styleValue;
}
public void setStyleValue(String styleValue) {
this.styleValue = styleValue;
}
public Integer getzIndex() {
return zIndex;
}
public void setzIndex(Integer zIndex) {
this.zIndex = zIndex;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}

View File

@ -1,22 +1,14 @@
package com.gis3c.ol.service; package com.gis3c.ol.service;
import com.gis3c.ol.entity.layer.TileLayer; import com.gis3c.ol.entity.Layer;
import com.gis3c.ol.entity.layer.VectorLayer;
/** /**
* Created by hukekuan on 2017/12/15. * Created by hukekuan on 2017/12/15.
*/ */
public interface LayerService { public interface LayerService {
public TileLayer findeTileLayerById(String layerId); public Layer findeLayerById(String layerId);
public TileLayer findeTileLayerByName(String layerName); public Layer findeLayerByName(String layerName);
public Integer insertTileLayer(TileLayer tileLayer); public Integer insertLayer(Layer layer);
public VectorLayer findeVectorLayerById(String layerId);
public VectorLayer findeVectorLayerByName(String layerName);
public Integer insertVectorLayer(VectorLayer vectorLayer);
} }

View File

@ -1,10 +1,13 @@
package com.gis3c.ol.service; package com.gis3c.ol.service;
import com.gis3c.ol.entity.Source;
import com.gis3c.ol.entity.source.TileArcGISRest; import com.gis3c.ol.entity.source.TileArcGISRest;
import com.gis3c.ol.entity.source.TileSuperMapRest; import com.gis3c.ol.entity.source.TileSuperMapRest;
import com.gis3c.ol.entity.source.Vector; import com.gis3c.ol.entity.source.Vector;
import com.gis3c.ol.entity.source.Wmts; import com.gis3c.ol.entity.source.Wmts;
import java.util.List;
/** /**
* Created by hukekuan on 2017/12/15. * Created by hukekuan on 2017/12/15.
*/ */
@ -34,4 +37,8 @@ public interface SourceService {
public Wmts findWmtsByName(String sourceName); public Wmts findWmtsByName(String sourceName);
public Integer insertWmts(Wmts wmts); public Integer insertWmts(Wmts wmts);
public List<Source> findAllSources();
public void insertSource(Source source);
} }

View File

@ -1,17 +0,0 @@
package com.gis3c.ol.service;
import com.gis3c.ol.entity.View;
import java.util.List;
/**
* Created by hukekuan on 2017/12/14.
*/
public interface ViewService {
public List<View> findViewsByByPage(Integer pageSize,Integer currentPage);
public View findeViewById(String viewId);
public View findeViewByName(String viewName);
public Integer insertView(View view);
}

View File

@ -1,8 +1,7 @@
package com.gis3c.ol.service.impl; package com.gis3c.ol.service.impl;
import com.gis3c.ol.dao.LayerDao; import com.gis3c.ol.dao.LayerDao;
import com.gis3c.ol.entity.layer.TileLayer; import com.gis3c.ol.entity.Layer;
import com.gis3c.ol.entity.layer.VectorLayer;
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;
@ -16,32 +15,17 @@ public class LayerServiceImpl implements LayerService {
private LayerDao layerDao; private LayerDao layerDao;
@Override @Override
public TileLayer findeTileLayerById(String layerId) { public Layer findeLayerById(String layerId) {
return layerDao.findeTileLayerById(layerId); return layerDao.findeLayerById(layerId);
} }
@Override @Override
public TileLayer findeTileLayerByName(String layerName) { public Layer findeLayerByName(String layerName) {
return layerDao.findeTileLayerByName(layerName); return layerDao.findeLayerByName(layerName);
} }
@Override @Override
public Integer insertTileLayer(TileLayer tileLayer) { public Integer insertLayer(Layer layer) {
return layerDao.insertTileLayer(tileLayer); return layerDao.insertLayer(layer);
}
@Override
public VectorLayer findeVectorLayerById(String layerId) {
return layerDao.findeVectorLayerById(layerId);
}
@Override
public VectorLayer findeVectorLayerByName(String layerName) {
return layerDao.findeVectorLayerByName(layerName);
}
@Override
public Integer insertVectorLayer(VectorLayer vectorLayer) {
return layerDao.insertVectorLayer(vectorLayer);
} }
} }

View File

@ -1,6 +1,7 @@
package com.gis3c.ol.service.impl; package com.gis3c.ol.service.impl;
import com.gis3c.ol.dao.SourceDao; import com.gis3c.ol.dao.SourceDao;
import com.gis3c.ol.entity.Source;
import com.gis3c.ol.entity.source.TileArcGISRest; import com.gis3c.ol.entity.source.TileArcGISRest;
import com.gis3c.ol.entity.source.TileSuperMapRest; import com.gis3c.ol.entity.source.TileSuperMapRest;
import com.gis3c.ol.entity.source.Vector; import com.gis3c.ol.entity.source.Vector;
@ -9,6 +10,8 @@ import com.gis3c.ol.service.SourceService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* Created by hukekuan on 2017/12/15. * Created by hukekuan on 2017/12/15.
*/ */
@ -77,4 +80,13 @@ public class SourceServiceImpl implements SourceService {
return sourceDao.insertWmts(wmts); return sourceDao.insertWmts(wmts);
} }
@Override
public List<Source> findAllSources() {
return sourceDao.findAllSources();
}
@Override
public void insertSource(Source source) {
sourceDao.insertSource(source);
}
} }

View File

@ -1,38 +0,0 @@
package com.gis3c.ol.service.impl;
import com.gis3c.ol.dao.ViewDao;
import com.gis3c.ol.entity.View;
import com.gis3c.ol.service.ViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by hukekuan on 2017/12/14.
*/
@Service
public class ViewServiceImpl implements ViewService {
@Autowired
private ViewDao viewDao;
@Override
public List<View> findViewsByByPage(Integer pageSize, Integer currentPage) {
return viewDao.findViewsByByPage(pageSize,currentPage);
}
@Override
public View findeViewById(String viewId) {
return viewDao.findeViewById(viewId);
}
@Override
public View findeViewByName(String viewName) {
return viewDao.findeViewByName(viewName);
}
@Override
public Integer insertView(View view) {
return viewDao.insertView(view);
}
}

View File

@ -2,7 +2,8 @@
create table c3gis_ol_map( create table c3gis_ol_map(
mapid varchar(50) not null PRIMARY KEY, mapid varchar(50) not null PRIMARY KEY,
mapname varchar(50) not null, mapname varchar(50) not null,
view varchar(50) not null, --view varchar(50) not null,
view jsonb not null,
controls varchar(50) [2][], controls varchar(50) [2][],
pixelRatio integer, pixelRatio integer,
interactions varchar(50) [2][], interactions varchar(50) [2][],
@ -66,6 +67,24 @@ create table c3gis_ol_layer_tile(
description varchar(50) description varchar(50)
); );
--
create table c3gis_ol_layer(
layerId varchar(50) not null PRIMARY KEY,
layerName varchar(50) not null,
aliasName varchar(50),
opacity real,
source varchar(50),
visible boolean,
extent decimal ARRAY[4],
zIndex integer,
minResolution decimal,
maxResolution decimal,
type varchar(50),
options jsonb,
description varchar(50)
);
--ArcGIS切片服务 --ArcGIS切片服务
create table c3gis_ol_source_tilearcgisrest( create table c3gis_ol_source_tilearcgisrest(
sourceid varchar(50) not null PRIMARY KEY, sourceid varchar(50) not null PRIMARY KEY,

View File

@ -1,18 +1,15 @@
package com.gis3c.spatial; package com.gis3c.spatial;
import com.gis3c.ol.entity.Map; import com.gis3c.ol.entity.Layer;
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;
import com.gis3c.ol.service.ViewService;
import com.gis3c.spatial.common.FeatureUtilities;
import com.gis3c.spatial.entity.Test;
import com.gis3c.spatial.service.TestService; import com.gis3c.spatial.service.TestService;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.UUID;
/** /**
* Created by hukekuan on 2017/12/14. * Created by hukekuan on 2017/12/14.
@ -23,16 +20,34 @@ public class App {
} }
public static void main(String[] args) throws IllegalAccessException, IOException { public static void main(String[] args) throws IllegalAccessException, IOException {
ApplicationContext context = ApplicationInit(); ApplicationContext context = ApplicationInit();
ViewService viewService = context.getBean(ViewService.class);
SourceService sourceService = context.getBean(SourceService.class); SourceService sourceService = context.getBean(SourceService.class);
LayerService layerService = context.getBean(LayerService.class); LayerService layerService = context.getBean(LayerService.class);
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<Source> sources = sourceService.findAllSources();
// System.out.println(sources.get(0).getParams());
//
// Source newSource = new Source();
// newSource.setSourceId("44");
// newSource.setSourceName("44");
// newSource.setUrl("444");
// java.util.Map<String, Object> params = new HashMap<>();
// params.put("bar","444");
// params.put("active",true);
// params.put("balance",4.444);
// params.put("center",new Integer[]{1,2});
// newSource.setParams(params);
// newSource.setDescription("555");
//
// sourceService.insertSource(newSource);
// 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();
@ -49,7 +64,14 @@ public class App {
// Map map = new Map(); // Map map = new Map();
// map.setMapId(UUID.randomUUID().toString()); // map.setMapId(UUID.randomUUID().toString());
// map.setMapName("综合GIS系统"); // map.setMapName("综合GIS系统");
// map.setView("ee2f96a0-097a-4f0a-9767-f52b8dae28e0"); //
// java.util.Map<String,Object> view = new HashMap<>();
// view.put("center",new Double[]{117.089151,36.738693});
// view.put("projection","EPSG:4326");
// view.put("minZoom",8);
// view.put("maxZoom",18);
// view.put("zoom",9);
// map.setView(view);
// map.setLogo(false); // map.setLogo(false);
// map.setLayers(new String[][]{ // map.setLayers(new String[][]{
// {"TileLayer","182a8b18-d26f-43da-9b3a-6f90af4825ed"}, // {"TileLayer","182a8b18-d26f-43da-9b3a-6f90af4825ed"},
@ -61,12 +83,14 @@ public class App {
// System.out.println("插入成功"); // System.out.println("插入成功");
//图层接口 //图层接口
// TileLayer wmtsLayer = new TileLayer(); Layer wmtsLayer = new Layer();
// wmtsLayer.setLayerId(UUID.randomUUID().toString()); wmtsLayer.setLayerId(UUID.randomUUID().toString());
// wmtsLayer.setLayerName("全国行政区图层"); wmtsLayer.setLayerName("cva");
// wmtsLayer.setSource(new String[]{"Wmts","b2729474-5988-410c-b6a0-8834b19d5832"}); wmtsLayer.setAliasName("全国行政区图层");
// layerService.insertTileLayer(wmtsLayer); wmtsLayer.setSource("b2729474-5988-410c-b6a0-8834b19d5832");
// System.out.println("插入成功"); wmtsLayer.setType("ol.layer.Tile");
layerService.insertLayer(wmtsLayer);
System.out.println("插入成功");
//资源接口 //资源接口

View File

@ -1,154 +0,0 @@
--
create table c3gis_ol_map(
mapid varchar(50) not null PRIMARY KEY,
mapname varchar(50) not null,
view varchar(50) not null,
controls varchar(50) [2][],
pixelRatio integer,
interactions varchar(50) [2][],
layers varchar(50) [2][],
logo boolean,
overlays varchar(50) [2][],
description varchar(50)
);
--
create table c3gis_ol_view(
viewid varchar(50) not null PRIMARY KEY,
viewname varchar(50) not null,
center double precision ARRAY[2],
extent double precision ARRAY[4],
maxresolution varchar(50),
minresolution varchar(50),
maxzoom int,
minzoom int,
zoom int,
projection varchar(50),
resolution varchar(50),
resolutions varchar(50) ARRAY,
rotation NUMERIC(7,4),
description varchar(50)
);
--
CREATE TYPE c3gis_ol_vectorstyletype AS ENUM('entity', 'function');
--
create table c3gis_ol_layer_vector(
layerid varchar(50) not null PRIMARY KEY,
layername varchar(50) not null,
opacity real,
visible boolean,
extent decimal ARRAY[4],
zIndex integer,
minResolution decimal,
maxResolution decimal,
source varchar(50) not null,
styletype c3gis_ol_vectorstyletype not null,,
stylevalue varchar(50) not null,
description varchar(50)
);
--
create table c3gis_ol_layer_tile(
layerid varchar(50) not null PRIMARY KEY,
layername varchar(50) not null,
opacity real,
visible boolean,
extent decimal ARRAY[4],
minResolution decimal,
maxResolution decimal,
source varchar(50) ARRAY[2] not null,
description varchar(50)
);
--ArcGIS切片服务
create table c3gis_ol_source_tilearcgisrest(
sourceid varchar(50) not null PRIMARY KEY,
sourcename varchar(50) not null,
crossOrigin varchar(50),
projection varchar(20),
url varchar(100) not null,
wrapX boolean,
description varchar(50)
);
--SuperMap切片服务
create table c3gis_ol_source_tilesupermaprest(
sourceid varchar(50) not null PRIMARY KEY,
sourcename varchar(50) not null,
url varchar(100) not null,
wrapX boolean,
opaque boolean,
description varchar(50)
);
--
create table c3gis_ol_source_vector(
sourceid varchar(50) not null PRIMARY KEY,
sourcename varchar(50) not null,
logo boolean,
url varchar(50),
useSpatialIndex boolean,
wrapX boolean,
description varchar(50)
);
--wmts服务
create table c3gis_ol_source_wmts(
sourceid varchar(50) not null PRIMARY KEY,
sourcename varchar(50) not null,
url varchar(50) not null,
layer varchar(50) not null,
style varchar(50) not null,
format varchar(50) not null,
matrixSet varchar(50) not null,
description varchar(50)
);
--
create table c3gis_ol_style_style(
styleid varchar(50) not null,
stylename varchar(50) not null,
fill varchar(50),
image varchar(50),
stroke varchar(50),
text varchar(50),
description varchar(50)
);
--
create table c3gis_ol_style_fill(
styleid varchar(50) not null,
stylename varchar(50) not null,
color varchar(50) not null,
description varchar(50)
);
--
create table c3gis_ol_style_stroke(
styleid varchar(50) not null,
stylename varchar(50) not null,
color varchar(50) not null,
width integer,
lineCap varchar(50),
lineJoin varchar(50),
description varchar(50)
);
--
create table c3gis_ol_style_icon(
styleid varchar(50) not null,
stylename varchar(50) not null,
anchor real ARRAY,
anchorOrigin varchar(20),
anchorXUnits varchar(20),
anchorYUnits varchar(20),
color varchar(20),
crossOrigin real,
description varchar(50)
);

View File

@ -1,137 +1,81 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gis3c.ol.dao.LayerDao"> <mapper namespace="com.gis3c.ol.dao.LayerDao">
<resultMap id="tileLayerResult" type="com.gis3c.ol.entity.layer.TileLayer"> <resultMap id="layerResult" type="com.gis3c.ol.entity.Layer">
<result property="layerId" column="layerid" /> <result property="layerId" column="layerId" />
<result property="layerName" column="layername" /> <result property="layerName" column="layerName" />
<result property="opacity" column="opacity" /> <result property="aliasName" column="aliasName" />
<result property="visible" column="visible" />
<result property="extent" column="extent" javaType="ObjectArray"/>
<result property="maxResolution" column="minResolution" />
<result property="minResolution" column="maxResolution" />
<result property="source" column="source" javaType="ObjectArray"/>
<result property="description" column="description" />
</resultMap>
<resultMap id="vectorLayerResult" type="com.gis3c.ol.entity.layer.VectorLayer">
<result property="layerId" column="layerid" />
<result property="layerName" column="layername" />
<result property="opacity" column="opacity" /> <result property="opacity" column="opacity" />
<result property="source" column="source" />
<result property="visible" column="visible" /> <result property="visible" column="visible" />
<result property="extent" column="extent" javaType="ObjectArray"/> <result property="extent" column="extent" javaType="ObjectArray"/>
<result property="zIndex" column="zIndex" /> <result property="zIndex" column="zIndex" />
<result property="maxResolution" column="minResolution" /> <result property="maxResolution" column="minResolution" />
<result property="minResolution" column="maxResolution" /> <result property="minResolution" column="maxResolution" />
<result property="source" column="source" /> <result property="type" column="type" />
<result property="styleType" column="styletype" /> <result property="options" column="options" javaType="ObjectJSON"/>
<result property="styleValue" column="stylevalue" />
<result property="description" column="description" /> <result property="description" column="description" />
</resultMap> </resultMap>
<sql id="tileLayerColumns"> <sql id="layerColumns">
layerid layerId
, layername , layerName
, aliasName
, opacity , opacity
, source
, visible , visible
, extent , extent
, zIndex
, minResolution , minResolution
, maxResolution , maxResolution
, source , type
, options
, description , description
</sql> </sql>
<sql id="vectorLayerColumns">
layerid
, layername
, opacity
, visible
, extent
, zIndex
, minResolution
, maxResolution
, source
, styletype
, stylevalue
, description
</sql>
<select id="findeTileLayerById" resultMap="tileLayerResult">
<select id="findeLayerById" resultMap="layerResult">
SELECT SELECT
<include refid="tileLayerColumns"/> <include refid="layerColumns"/>
FROM c3gis_ol_layer_tile FROM c3gis_ol_layer
WHERE layerid = #{layerId, javaType=java.lang.String}; WHERE layerId = #{layerId, javaType=java.lang.String};
</select> </select>
<select id="findeTileLayerByName" resultMap="tileLayerResult"> <select id="findeLayerByName" resultMap="layerResult">
SELECT SELECT
<include refid="tileLayerColumns"/> <include refid="layerColumns"/>
FROM c3gis_ol_layer_tile FROM c3gis_ol_layer
WHERE layername = #{layerName, javaType=java.lang.String}; WHERE layerName = #{layerName, javaType=java.lang.String};
</select> </select>
<insert id="insertTileLayer" parameterType="com.gis3c.ol.entity.layer.TileLayer"> <insert id="insertLayer" parameterType="com.gis3c.ol.entity.Layer">
INSERT INTO c3gis_ol_layer_tile( INSERT INTO c3gis_ol_layer(layerId
layerid , layerName
, layername , aliasName
, opacity , opacity
, visible , source
, extent , visible
, minResolution , extent
, maxResolution , zIndex
, source , minResolution
, description , maxResolution
, type
, options
, description
) )
VALUES( VALUES(#{layerId}
#{layerId} , #{layerName}
, #{layerName} , #{aliasName}
, #{opacity} , #{opacity}
, #{visible} , #{source}
, #{extent, javaType=ObjectArray} , #{visible}
, #{maxResolution} , #{extent, javaType=ObjectArray}
, #{minResolution} , #{zIndex}
, #{source, javaType=ObjectArray} , #{maxResolution}
, #{description}); , #{minResolution}
</insert> , #{type}
, #{options, javaType=ObjectJSON}::jsonb
<select id="findeVectorLayerById" resultMap="vectorLayerResult"> , #{description}
SELECT );
<include refid="vectorLayerColumns"/>
FROM c3gis_ol_layer_vector
WHERE layerid = #{layerId, javaType=java.lang.String};
</select>
<select id="findeVectorLayerByName" resultMap="vectorLayerResult">
SELECT
<include refid="tileLayerColumns"/>
FROM c3gis_ol_layer_vector
WHERE layername = #{layerName, javaType=java.lang.String};
</select>
<insert id="insertVectorLayer" parameterType="com.gis3c.ol.entity.layer.VectorLayer">
INSERT INTO c3gis_ol_layer_tile(
layerid
, layername
, opacity
, visible
, extent
, zIndex
, minResolution
, maxResolution
, source
, styletype
, stylevalue
, description
)
VALUES(
#{layerId}
, #{layerName}
, #{opacity}
, #{visible}
, #{extent, javaType=ObjectArray}
, #{zIndex}
, #{maxResolution}
, #{minResolution}
, #{source}
, #{styleType}
, #{styleValue}
, #{description});
</insert> </insert>
</mapper> </mapper>

View File

@ -4,7 +4,7 @@
<resultMap id="mapResult" type="com.gis3c.ol.entity.Map"> <resultMap id="mapResult" type="com.gis3c.ol.entity.Map">
<result property="mapId" column="mapid" /> <result property="mapId" column="mapid" />
<result property="mapName" column="mapname" /> <result property="mapName" column="mapname" />
<result property="view" column="view" /> <result property="view" column="view" javaType="ObjectJSON"/>
<result property="controls" column="controls" javaType="ObjectArray"/> <result property="controls" column="controls" javaType="ObjectArray"/>
<result property="pixelRatio" column="pixelRatio" /> <result property="pixelRatio" column="pixelRatio" />
<result property="interactions" column="interactions" javaType="ObjectArray"/> <result property="interactions" column="interactions" javaType="ObjectArray"/>
@ -54,20 +54,19 @@
WHERE mapname = #{mapName, javaType=java.lang.String}; WHERE mapname = #{mapName, javaType=java.lang.String};
</select> </select>
<insert id="insertMap" parameterType="com.gis3c.ol.entity.Map"> <insert id="insertMap" parameterType="com.gis3c.ol.entity.Map">
INSERT INTO c3gis_ol_map( INSERT INTO c3gis_ol_map( mapid
mapid , mapname
, mapname , view
, view , controls
, controls , pixelRatio
, pixelRatio , interactions
, interactions , layers
, layers , logo
, logo , overlays
, overlays , description)
, description) VALUES ( VALUES ( #{mapId}
#{mapId}
, #{mapName} , #{mapName}
, #{view} , #{view, javaType=ObjectJSON}::jsonb
, #{controls, javaType=ObjectArray} , #{controls, javaType=ObjectArray}
, #{pixelRatio} , #{pixelRatio}
, #{interactions, javaType=ObjectArray} , #{interactions, javaType=ObjectArray}

View File

@ -37,6 +37,14 @@
<result property="opaque" column="opaque" /> <result property="opaque" column="opaque" />
<result property="description" column="description" /> <result property="description" column="description" />
</resultMap> </resultMap>
<resultMap id="sourceResult" type="com.gis3c.ol.entity.Source">
<result property="sourceId" column="sourceid" />
<result property="sourceName" column="sourcename" />
<result property="url" column="url" />
<result property="params" column="params" javaType="ObjectJSON"/>
<result property="description" column="description" />
</resultMap>
<sql id="wmtsColumns"> <sql id="wmtsColumns">
sourceid sourceid
@ -217,4 +225,24 @@
); );
</insert> </insert>
<select id="findAllSources" resultMap="sourceResult">
SELECT sourceid,sourcename,url,params,description
FROM c3gis_ol_source;
</select>
<insert id="insertSource" parameterType="com.gis3c.ol.entity.Source">
INSERT INTO c3gis_ol_source(
sourceid
, sourcename
, url
, params
, description
)
VALUES(
#{sourceId}
, #{sourceName}
, #{url}
, #{params, javaType=ObjectJSON}::jsonb
, #{description}
);
</insert>
</mapper> </mapper>

View File

@ -47,7 +47,7 @@
<typeAliases> <typeAliases>
<typeAlias type="com.vividsolutions.jts.geom.Geometry" alias="Geometry" /> <typeAlias type="com.vividsolutions.jts.geom.Geometry" alias="Geometry" />
<typeAlias type="java.lang.Object" alias="ObjectArray" /> <typeAlias type="java.lang.Object" alias="ObjectArray" />
<typeAlias type="java.lang.Object" alias="ObjectJSON" /> <typeAlias type="java.util.Map" alias="ObjectJSON" />
</typeAliases> </typeAliases>
<typeHandlers> <typeHandlers>
<typeHandler handler="com.gis3c.spatial.postgis.PostGISHandler" javaType="Geometry" /> <typeHandler handler="com.gis3c.spatial.postgis.PostGISHandler" javaType="Geometry" />