初始化

This commit is contained in:
hukekuan@163.com 2017-12-15 16:41:37 +08:00
parent fbe873e072
commit ab86b3058c
19 changed files with 450 additions and 30 deletions

View File

@ -1,9 +1,9 @@
package com.gis3c;
import com.gis3c.ol.service.MapService;
import com.gis3c.ol.service.impl.MapServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.gis3c.ol.entity.Map;
/**
* Created by hukekuan on 2017/12/14.
@ -14,7 +14,9 @@ public class App {
}
public static void main(String[] args) {
ApplicationContext context = ApplicationInit();
MapService mapService = (MapService) context.getBean(MapService.class);
System.out.println(mapService.findAllList());
MapService mapService = context.getBean(MapService.class);
Map map = mapService.findAllList().get(0);
String[][] controls = map.getControls();
System.out.println(controls);
}
}

View File

@ -0,0 +1,21 @@
package com.gis3c.ol.dao;
import com.gis3c.ol.entity.layer.TileLayer;
import com.gis3c.ol.entity.layer.VectorLayer;
/**
* Created by hukekuan on 2017/12/15.
*/
public interface LayerDao {
public TileLayer findeTileLayerById(String layerId);
public TileLayer findeTileLayerByName(String layerName);
public int insertTileLayer(TileLayer tileLayer);
public VectorLayer findeVectorLayerById(String layerId);
public VectorLayer findeVectorLayerByName(String layerName);
public int insertVectorLayer(VectorLayer vectorLayer);
}

View File

@ -1,9 +1,9 @@
package com.gis3c.ol.dao;
import com.gis3c.common.persistence.annotation.C3BatisDao;
import com.gis3c.ol.entity.Map;
import java.util.List;
import java.util.Map;
/**
* Created by hukekuan on 2017/12/14.

View File

@ -0,0 +1,37 @@
package com.gis3c.ol.dao;
import com.gis3c.ol.entity.source.TileArcGISRest;
import com.gis3c.ol.entity.source.TileSuperMapRest;
import com.gis3c.ol.entity.source.Vector;
import com.gis3c.ol.entity.source.Wmts;
/**
* Created by hukekuan on 2017/12/15.
*/
public interface SourceDao {
public TileArcGISRest findTileArcGISRestById(String sourceId);
public TileArcGISRest findTileArcGISRestByName(String sourceName);
public Integer insertTileArcGISRest(TileArcGISRest tileArcGISRest);
public TileSuperMapRest findTileTileSuperMapRestById(String sourceId);
public TileSuperMapRest findTileTileSuperMapRestByName(String sourceName);
public Integer insertTileSuperMapRest(TileSuperMapRest tileSuperMapRest);
public Vector findVectorById(String sourceId);
public Vector findVectorByName(String sourceName);
public Integer insertVector(Vector vector);
public Wmts findWmtsById(String sourceId);
public Wmts findWmtsByName(String sourceName);
public Integer insertWmts(Wmts wmts);
}

View File

@ -0,0 +1,13 @@
package com.gis3c.ol.dao;
import com.gis3c.ol.entity.View;
/**
* Created by hukekuan on 2017/12/15.
*/
public interface ViewDao {
public View findeViewById(String viewId);
public View findeViewByName(String viewName);
public Integer insertView(View view);
}

View File

@ -6,12 +6,13 @@ package com.gis3c.ol.entity;
public class Map {
private String mapId;
private String mapName;
private String[] controls;
private Integer pixelRatio;
private String[] interactions;
private String view;
private String[] layers;
private String[][] controls;
private Integer pixelRatio;
private String[][] interactions;
private String[][] layers;
private Boolean logo = Boolean.FALSE;
private String[][] overlays;
private String description;
public String getMapId() {
@ -30,14 +31,6 @@ public class Map {
this.mapName = mapName;
}
public String[] getControls() {
return controls;
}
public void setControls(String[] controls) {
this.controls = controls;
}
public Integer getPixelRatio() {
return pixelRatio;
}
@ -46,11 +39,11 @@ public class Map {
this.pixelRatio = pixelRatio;
}
public String[] getInteractions() {
public String[][] getInteractions() {
return interactions;
}
public void setInteractions(String[] interactions) {
public void setInteractions(String[][] interactions) {
this.interactions = interactions;
}
@ -62,11 +55,11 @@ public class Map {
this.view = view;
}
public String[] getLayers() {
public String[][] getLayers() {
return layers;
}
public void setLayers(String[] layers) {
public void setLayers(String[][] layers) {
this.layers = layers;
}
@ -85,4 +78,20 @@ public class Map {
public void setDescription(String description) {
this.description = description;
}
public String[][] getControls() {
return controls;
}
public void setControls(String[][] controls) {
this.controls = controls;
}
public String[][] getOverlays() {
return overlays;
}
public void setOverlays(String[][] overlays) {
this.overlays = overlays;
}
}

View File

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

View File

@ -1,7 +1,8 @@
package com.gis3c.ol.service;
import com.gis3c.ol.entity.Map;
import java.util.List;
import java.util.Map;
/**
* Created by hukekuan on 2017/12/14.

View File

@ -0,0 +1,37 @@
package com.gis3c.ol.service;
import com.gis3c.ol.entity.source.TileArcGISRest;
import com.gis3c.ol.entity.source.TileSuperMapRest;
import com.gis3c.ol.entity.source.Vector;
import com.gis3c.ol.entity.source.Wmts;
/**
* Created by hukekuan on 2017/12/15.
*/
public interface SourceService {
public TileArcGISRest findTileArcGISRestById(String sourceId);
public TileArcGISRest findTileArcGISRestByName(String sourceName);
public Integer insertTileArcGISRest(TileArcGISRest tileArcGISRest);
public TileSuperMapRest findTileTileSuperMapRestById(String sourceId);
public TileSuperMapRest findTileTileSuperMapRestByName(String sourceName);
public Integer insertTileSuperMapRest(TileSuperMapRest tileSuperMapRest);
public Vector findVectorById(String sourceId);
public Vector findVectorByName(String sourceName);
public Integer insertVector(Vector vector);
public Wmts findWmtsById(String sourceId);
public Wmts findWmtsByName(String sourceName);
public Integer insertWmts(Wmts wmts);
}

View File

@ -1,7 +1,13 @@
package com.gis3c.ol.service;
import com.gis3c.ol.entity.View;
/**
* Created by hukekuan on 2017/12/14.
*/
public interface ViewService {
public View findeViewById(String viewId);
public View findeViewByName(String viewName);
public Integer insertView(View view);
}

View File

@ -0,0 +1,45 @@
package com.gis3c.ol.service.impl;
import com.gis3c.ol.dao.LayerDao;
import com.gis3c.ol.entity.layer.TileLayer;
import com.gis3c.ol.entity.layer.VectorLayer;
import com.gis3c.ol.service.LayerService;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Created by hukekuan on 2017/12/15.
*/
public class LayerServiceImpl implements LayerService {
@Autowired
private LayerDao layerDao;
@Override
public TileLayer findeTileLayerById(String layerId) {
return layerDao.findeTileLayerById(layerId);
}
@Override
public TileLayer findeTileLayerByName(String layerName) {
return layerDao.findeTileLayerByName(layerName);
}
@Override
public Integer insertTileLayer(TileLayer tileLayer) {
return layerDao.insertTileLayer(tileLayer);
}
@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,12 +1,12 @@
package com.gis3c.ol.service.impl;
import com.gis3c.ol.dao.MapDao;
import com.gis3c.ol.entity.Map;
import com.gis3c.ol.service.MapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Created by hukekuan on 2017/12/14.

View File

@ -0,0 +1,78 @@
package com.gis3c.ol.service.impl;
import com.gis3c.ol.dao.SourceDao;
import com.gis3c.ol.entity.source.TileArcGISRest;
import com.gis3c.ol.entity.source.TileSuperMapRest;
import com.gis3c.ol.entity.source.Vector;
import com.gis3c.ol.entity.source.Wmts;
import com.gis3c.ol.service.SourceService;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Created by hukekuan on 2017/12/15.
*/
public class SourceServiceImpl implements SourceService {
@Autowired
private SourceDao sourceDao;
@Override
public TileArcGISRest findTileArcGISRestById(String sourceId) {
return sourceDao.findTileArcGISRestById(sourceId);
}
@Override
public TileArcGISRest findTileArcGISRestByName(String sourceName) {
return sourceDao.findTileArcGISRestByName(sourceName);
}
@Override
public Integer insertTileArcGISRest(TileArcGISRest tileArcGISRest) {
return sourceDao.insertTileArcGISRest(tileArcGISRest);
}
@Override
public TileSuperMapRest findTileTileSuperMapRestById(String sourceId) {
return sourceDao.findTileTileSuperMapRestById(sourceId);
}
@Override
public TileSuperMapRest findTileTileSuperMapRestByName(String sourceName) {
return sourceDao.findTileTileSuperMapRestByName(sourceName);
}
@Override
public Integer insertTileSuperMapRest(TileSuperMapRest tileSuperMapRest) {
return sourceDao.insertTileSuperMapRest(tileSuperMapRest);
}
@Override
public Vector findVectorById(String sourceId) {
return sourceDao.findVectorById(sourceId);
}
@Override
public Vector findVectorByName(String sourceName) {
return sourceDao.findVectorByName(sourceName);
}
@Override
public Integer insertVector(Vector vector) {
return sourceDao.insertVector(vector);
}
@Override
public Wmts findWmtsById(String sourceId) {
return sourceDao.findWmtsById(sourceId);
}
@Override
public Wmts findWmtsByName(String sourceName) {
return sourceDao.findWmtsByName(sourceName);
}
@Override
public Integer insertWmts(Wmts wmts) {
return sourceDao.insertWmts(wmts);
}
}

View File

@ -1,9 +1,29 @@
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;
/**
* Created by hukekuan on 2017/12/14.
*/
public class ViewServiceImpl implements ViewService {
@Autowired
private ViewDao viewDao;
@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

@ -0,0 +1,65 @@
package com.gis3c.spatial.postgis;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.TypeException;
import java.sql.*;
/**
* Created by hukekuan on 2017/12/15.
*/
public class ArrayTypeHandler extends BaseTypeHandler<Object[]> {
private static final String TYPE_NAME_VARCHAR = "varchar";
private static final String TYPE_NAME_BOOLEAN = "boolean";
private static final String TYPE_NAME_INTEGER = "integer";
private static final String TYPE_NAME_NUMERIC = "numeric";
@Override
public void setNonNullParameter(PreparedStatement ps, int i, Object[] parameter, JdbcType jdbcType) throws SQLException {
String typeName = null;
if (parameter instanceof Integer[]) {
typeName = TYPE_NAME_INTEGER;
} else if (parameter instanceof String[]) {
typeName = TYPE_NAME_VARCHAR;
} else if (parameter instanceof Boolean[]) {
typeName = TYPE_NAME_BOOLEAN;
} else if (parameter instanceof Double[]) {
typeName = TYPE_NAME_NUMERIC;
}
if (typeName == null) {
throw new TypeException("ArrayTypeHandler parameter typeName error, your type is " + parameter.getClass().getName());
}
Array array = ps.getConnection().createArrayOf(typeName, parameter);
ps.setArray(i, array);
}
@Override
public Object[] getNullableResult(ResultSet rs, String columnName) throws SQLException {
return getArray(rs.getArray(columnName));
}
@Override
public Object[] getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
return getArray(rs.getArray(columnIndex));
}
@Override
public Object[] getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
return getArray(cs.getArray(columnIndex));
}
private Object[] getArray(Array array) {
if (array == null) {
return null;
}
try {
return (Object[]) array.getArray();
} catch (Exception e) {
}
return null;
}
}

View File

@ -0,0 +1,34 @@
package com.gis3c.spatial.postgis;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by hukekuan on 2017/12/15.
*/
public class JsonTypeHandler extends BaseTypeHandler<Object> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
}
@Override
public Object getNullableResult(ResultSet rs, String columnName) throws SQLException {
return null;
}
@Override
public Object getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
return null;
}
@Override
public Object getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
return null;
}
}

View File

@ -3,12 +3,12 @@ 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) ARRAY,
controls varchar(50) [2][],
pixelRatio integer,
interactions varchar(50) ARRAY,
layers varchar(50) ARRAY,
interactions varchar(50) [2][],
layers varchar(50) [2][],
logo boolean,
overlays varchar(50) ARRAY,
overlays varchar(50) [2][],
description varchar(50)
);

View File

@ -1,14 +1,30 @@
<?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">
<mapper namespace="com.gis3c.ol.dao.MapDao">
<resultMap id="mapResult" type="Map">
<resultMap id="mapResult" type="com.gis3c.ol.entity.Map">
<id property="mapId" column="mapid" />
<result property="" column="mapname" />
<result property="mapName" column="mapname" />
<result property="view" column="view" />
<result property="controls" column="controls" javaType="Object"/>
<result property="pixelRatio" column="pixelRatio" />
<result property="interactions" column="interactions" javaType="Object"/>
<result property="layers" column="layers" javaType="Object"/>
<result property="logo" column="logo" />
<result property="overlays" column="overlays" javaType="Object"/>
<result property="description" column="description" />
</resultMap>
<sql id="mapColumns">
mapid,
mapname
mapid
, mapname
, view
, controls
, pixelRatio
, interactions
, layers
, logo
, overlays
, description
</sql>
<select id="findAllList" resultMap="mapResult">

View File

@ -5,4 +5,18 @@
<settings>
<setting name="cacheEnabled" value="true"/>
</settings>
<!--
<typeAliases>
<typeAlias type="com.vividsolutions.jts.geom.Geometry" alias="Geometry" />
</typeAliases>
<typeHandlers>
<typeHandler handler="com.gis3c.common.OracleSpatialHandler" javaType="Geometry" />
</typeHandlers>-->
<typeAliases>
<typeAlias type="java.lang.Object" alias="Object" />
</typeAliases>
<typeHandlers>
<typeHandler handler="com.gis3c.spatial.postgis.ArrayTypeHandler" javaType="Object" />
</typeHandlers>
</configuration>