From 470274def3657f1d8009ce31c6fae90a764f94e0 Mon Sep 17 00:00:00 2001 From: "hukekuan@163.com" Date: Mon, 18 Dec 2017 18:34:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/gis3c/App.java | 40 +++- .../com/gis3c/ol/entity/layer/BaseLayer.java | 10 +- .../com/gis3c/ol/entity/layer/TileLayer.java | 6 +- .../gis3c/ol/entity/layer/VectorLayer.java | 25 +- src/main/resources/init.sql | 2 +- src/main/resources/mappings/ol/LayerDao.xml | 137 +++++++++++ src/main/resources/mappings/ol/MapDao.xml | 8 +- src/main/resources/mappings/ol/SourceDao.xml | 220 ++++++++++++++++++ 8 files changed, 421 insertions(+), 27 deletions(-) create mode 100644 src/main/resources/mappings/ol/LayerDao.xml create mode 100644 src/main/resources/mappings/ol/SourceDao.xml diff --git a/src/main/java/com/gis3c/App.java b/src/main/java/com/gis3c/App.java index 3c70a84..042c487 100644 --- a/src/main/java/com/gis3c/App.java +++ b/src/main/java/com/gis3c/App.java @@ -1,7 +1,11 @@ package com.gis3c; import com.gis3c.ol.entity.View; +import com.gis3c.ol.entity.layer.TileLayer; +import com.gis3c.ol.entity.source.Wmts; +import com.gis3c.ol.service.LayerService; import com.gis3c.ol.service.MapService; +import com.gis3c.ol.service.SourceService; import com.gis3c.ol.service.ViewService; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -19,11 +23,43 @@ public class App { public static void main(String[] args) { ApplicationContext context = ApplicationInit(); ViewService viewService = context.getBean(ViewService.class); + SourceService sourceService = context.getBean(SourceService.class); + LayerService layerService = context.getBean(LayerService.class); + MapService mapService = context.getBean(MapService.class); - View view = viewService.findeViewById("a20d41b4-208d-47da-8c02-e7023fc4e9f4"); - System.out.println("["+ ((Double[])view.getCenter())[0] + ", " + ((Double[])view.getCenter())[1] + "]"); + //图层接口 +// TileLayer wmtsLayer = new TileLayer(); +// wmtsLayer.setLayerId(UUID.randomUUID().toString()); +// wmtsLayer.setLayerName("全国行政区图层"); +// wmtsLayer.setSource(new String[]{"Wmts","b2729474-5988-410c-b6a0-8834b19d5832"}); +// layerService.insertTileLayer(wmtsLayer); +// System.out.println("插入成功"); + + +//资源接口 +// Wmts wmts = new Wmts(); +// wmts.setSourceId(UUID.randomUUID().toString()); +// wmts.setSourceName("山东省行政区图"); +// wmts.setUrl("http://www.sdmap.gov.cn/tileservice/SDPubMap"); +// wmts.setLayer("0"); +// wmts.setFormat("image/png"); +// wmts.setMatrixSet("tianditu2013"); +// wmts.setStyle("default"); +// +// sourceService.insertWmts(wmts); +// System.out.println("插入成功"); + +// Wmts wmts = sourceService.findWmtsById("b2729474-5988-410c-b6a0-8834b19d5832"); +// 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] + "]"); + // View view = new View(); // String id = UUID.randomUUID().toString(); // diff --git a/src/main/java/com/gis3c/ol/entity/layer/BaseLayer.java b/src/main/java/com/gis3c/ol/entity/layer/BaseLayer.java index a4781fe..b5740c3 100644 --- a/src/main/java/com/gis3c/ol/entity/layer/BaseLayer.java +++ b/src/main/java/com/gis3c/ol/entity/layer/BaseLayer.java @@ -9,9 +9,9 @@ public abstract class BaseLayer { private Double opacity; private Boolean visible = Boolean.TRUE; private Double[] extent; - private Integer zIndex; private Double maxResolution; private Double minResolution; + private String description; public String getLayerId() { @@ -54,14 +54,6 @@ public abstract class BaseLayer { this.extent = extent; } - public Integer getzIndex() { - return zIndex; - } - - public void setzIndex(Integer zIndex) { - this.zIndex = zIndex; - } - public Double getMaxResolution() { return maxResolution; } diff --git a/src/main/java/com/gis3c/ol/entity/layer/TileLayer.java b/src/main/java/com/gis3c/ol/entity/layer/TileLayer.java index fbe004e..f7691b5 100644 --- a/src/main/java/com/gis3c/ol/entity/layer/TileLayer.java +++ b/src/main/java/com/gis3c/ol/entity/layer/TileLayer.java @@ -4,13 +4,13 @@ package com.gis3c.ol.entity.layer; * Created by hukekuan on 2017/12/14. */ public class TileLayer extends BaseLayer { - private String source; + private String[] source; - public String getSource() { + public String[] getSource() { return source; } - public void setSource(String source) { + public void setSource(String[] source) { this.source = source; } } diff --git a/src/main/java/com/gis3c/ol/entity/layer/VectorLayer.java b/src/main/java/com/gis3c/ol/entity/layer/VectorLayer.java index c70854d..d3ab077 100644 --- a/src/main/java/com/gis3c/ol/entity/layer/VectorLayer.java +++ b/src/main/java/com/gis3c/ol/entity/layer/VectorLayer.java @@ -5,17 +5,10 @@ package com.gis3c.ol.entity.layer; */ public class VectorLayer extends BaseLayer { private String source; + private Integer zIndex; private String styleType; private String styleValue; - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - public String getStyleType() { return styleType; } @@ -31,4 +24,20 @@ public class VectorLayer extends BaseLayer { 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; + } } diff --git a/src/main/resources/init.sql b/src/main/resources/init.sql index c06cfb0..540414a 100644 --- a/src/main/resources/init.sql +++ b/src/main/resources/init.sql @@ -62,7 +62,7 @@ create table c3gis_ol_layer_tile( extent decimal ARRAY[4], minResolution decimal, maxResolution decimal, - source varchar(50) not null, + source varchar(50) ARRAY[2] not null, description varchar(50) ); diff --git a/src/main/resources/mappings/ol/LayerDao.xml b/src/main/resources/mappings/ol/LayerDao.xml new file mode 100644 index 0000000..28294e2 --- /dev/null +++ b/src/main/resources/mappings/ol/LayerDao.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + layerid + , layername + , opacity + , visible + , extent + , minResolution + , maxResolution + , source + , description + + + layerid + , layername + , opacity + , visible + , extent + , zIndex + , minResolution + , maxResolution + , source + , styletype + , stylevalue + , description + + + + + + + + INSERT INTO c3gis_ol_layer_tile( + layerid + , layername + , opacity + , visible + , extent + , minResolution + , maxResolution + , source + , description + ) + VALUES( + #{layerId} + , #{layerName} + , #{opacity} + , #{visible} + , #{extent, javaType=ObjectArray} + , #{maxResolution} + , #{minResolution} + , #{source, javaType=ObjectArray} + , #{description}); + + + + + + + + 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}); + + \ No newline at end of file diff --git a/src/main/resources/mappings/ol/MapDao.xml b/src/main/resources/mappings/ol/MapDao.xml index ca9fd58..750db93 100644 --- a/src/main/resources/mappings/ol/MapDao.xml +++ b/src/main/resources/mappings/ol/MapDao.xml @@ -5,12 +5,12 @@ - + - - + + - + diff --git a/src/main/resources/mappings/ol/SourceDao.xml b/src/main/resources/mappings/ol/SourceDao.xml new file mode 100644 index 0000000..98dc687 --- /dev/null +++ b/src/main/resources/mappings/ol/SourceDao.xml @@ -0,0 +1,220 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sourceid + , sourcename + , url + , layer + , style + , format + , matrixSet + , description + + + sourceid + , sourcename + , url + , logo + , useSpatialIndex + , wrapX + , description + + + sourceid + , sourcename + , url + , crossOrigin + , projection + , wrapX + , description + + + sourceid + , sourcename + , url + , wrapX + , opaque + , description + + + + + + + + + INSERT INTO c3gis_ol_source_tilearcgisrest( + sourceid + , sourcename + , url + , crossOrigin + , projection + , wrapX + , description + ) + VALUES( + #{sourceId} + , #{sourceName} + , #{url} + , #{crossOrigin} + , #{projection} + , #{wrapX} + , #{description}); + + + + + + + + + INSERT INTO c3gis_ol_source_tilesupermaprest( + sourceid + , sourcename + , url + , wrapX + , opaque + , description + ) + VALUES( + #{sourceId} + , #{sourceName} + , #{url} + , #{wrapX} + , #{opaque} + , #{description}); + + + + + + + + + INSERT INTO c3gis_ol_source_vector( + sourceid + , sourcename + , url + , logo + , useSpatialIndex + , wrapX + , description + ) + VALUES( + #{sourceId} + , #{sourceName} + , #{url} + , #{logo} + , #{useSpatialIndex} + , #{wrapX} + , #{description}); + + + + + + + + + + INSERT INTO c3gis_ol_source_wmts( + sourceid + , sourcename + , url + , layer + , style + , format + , matrixSet + , description + ) + VALUES( + #{sourceId} + , #{sourceName} + , #{url} + , #{layer} + , #{style} + , #{format} + , #{matrixSet} + , #{description} + ); + + + \ No newline at end of file