初始化
This commit is contained in:
parent
d38d8a89d9
commit
e295e52e9f
1
pom.xml
1
pom.xml
@ -90,6 +90,7 @@
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<classifier>jdk15</classifier>
|
||||
<version>${json-lib.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.gis3c.common.persistence.annotation;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2017/12/14.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Documented
|
||||
@Component
|
||||
public @interface C3SpatialDao {
|
||||
/**
|
||||
* The value may indicate a suggestion for a logical component name,
|
||||
* to be turned into a Spring bean in case of an autodetected component.
|
||||
* @return the suggested component name, if any
|
||||
*/
|
||||
String value() default "";
|
||||
}
|
||||
@ -11,7 +11,7 @@ import java.lang.annotation.*;
|
||||
@Target(ElementType.TYPE)
|
||||
@Documented
|
||||
@Component
|
||||
public @interface C3BatisDao {
|
||||
public @interface C3olDao {
|
||||
/**
|
||||
* The value may indicate a suggestion for a logical component name,
|
||||
* to be turned into a Spring bean in case of an autodetected component.
|
||||
@ -1,13 +1,13 @@
|
||||
package com.gis3c.ol.dao;
|
||||
|
||||
import com.gis3c.common.persistence.annotation.C3BatisDao;
|
||||
import com.gis3c.common.persistence.annotation.C3olDao;
|
||||
import com.gis3c.ol.entity.layer.TileLayer;
|
||||
import com.gis3c.ol.entity.layer.VectorLayer;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2017/12/15.
|
||||
*/
|
||||
@C3BatisDao
|
||||
@C3olDao
|
||||
public interface LayerDao {
|
||||
public TileLayer findeTileLayerById(String layerId);
|
||||
public TileLayer findeTileLayerByName(String layerName);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package com.gis3c.ol.dao;
|
||||
|
||||
import com.gis3c.common.persistence.annotation.C3BatisDao;
|
||||
import com.gis3c.common.persistence.annotation.C3olDao;
|
||||
import com.gis3c.ol.entity.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2017/12/14.
|
||||
*/
|
||||
@C3BatisDao
|
||||
@C3olDao
|
||||
public interface MapDao {
|
||||
public List<Map> findAllList();
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.gis3c.ol.dao;
|
||||
|
||||
import com.gis3c.common.persistence.annotation.C3BatisDao;
|
||||
import com.gis3c.common.persistence.annotation.C3olDao;
|
||||
import com.gis3c.ol.entity.source.TileArcGISRest;
|
||||
import com.gis3c.ol.entity.source.TileSuperMapRest;
|
||||
import com.gis3c.ol.entity.source.Vector;
|
||||
@ -9,7 +9,7 @@ import com.gis3c.ol.entity.source.Wmts;
|
||||
/**
|
||||
* Created by hukekuan on 2017/12/15.
|
||||
*/
|
||||
@C3BatisDao
|
||||
@C3olDao
|
||||
public interface SourceDao {
|
||||
public TileArcGISRest findTileArcGISRestById(String sourceId);
|
||||
public TileArcGISRest findTileArcGISRestByName(String sourceName);
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package com.gis3c.ol.dao;
|
||||
|
||||
import com.gis3c.common.persistence.annotation.C3BatisDao;
|
||||
import com.gis3c.common.persistence.annotation.C3olDao;
|
||||
import com.gis3c.ol.entity.View;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2017/12/15.
|
||||
*/
|
||||
@C3BatisDao
|
||||
@C3olDao
|
||||
public interface ViewDao {
|
||||
public View findeViewById(String viewId);
|
||||
public View findeViewByName(String viewName);
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
package com.gis3c.spatial.entity;
|
||||
|
||||
import org.geotools.data.FeatureSource;
|
||||
import org.geotools.map.FeatureLayer;
|
||||
import org.geotools.styling.Style;
|
||||
|
||||
public class C3Layer extends FeatureLayer {
|
||||
public C3Layer(FeatureSource featureSource,Style style){
|
||||
super(featureSource,style);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
package com.gis3c.spatial.entity;
|
||||
|
||||
import com.sun.media.jai.codec.ImageCodec;
|
||||
import com.sun.media.jai.codec.ImageEncoder;
|
||||
import com.sun.media.jai.codec.PNGEncodeParam;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
import org.geotools.map.MapContent;
|
||||
import org.geotools.map.MapViewport;
|
||||
import org.geotools.renderer.GTRenderer;
|
||||
import org.geotools.renderer.lite.StreamingRenderer;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class C3Map extends MapContent {
|
||||
public C3Map(){
|
||||
super();
|
||||
}
|
||||
|
||||
public void ExportImg(double x1,double y1,double x2,double y2,int width,int height)
|
||||
throws IOException {
|
||||
//设置出图范围
|
||||
ReferencedEnvelope mapArea
|
||||
= new ReferencedEnvelope(x1,x2,y1,y2,this.getCoordinateReferenceSystem());
|
||||
|
||||
//初始化渲染器
|
||||
StreamingRenderer sr = new StreamingRenderer();
|
||||
sr.setMapContent(this);
|
||||
//初始化输出图像
|
||||
BufferedImage bi = new BufferedImage(width,height,BufferedImage.TYPE_INT_BGR);
|
||||
Graphics g = bi.getGraphics();
|
||||
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
Rectangle rect = new Rectangle(0,0,width,height);
|
||||
|
||||
//绘制地图
|
||||
sr.paint((Graphics2D) g,rect,mapArea);
|
||||
|
||||
//编码图像
|
||||
PNGEncodeParam encodeParam = PNGEncodeParam.getDefaultEncodeParam(bi);
|
||||
if(encodeParam instanceof PNGEncodeParam.Palette){
|
||||
PNGEncodeParam.Palette p = (PNGEncodeParam.Palette) encodeParam;
|
||||
byte[] b = new byte[]{-127};
|
||||
p.setPaletteTransparency(b);
|
||||
}
|
||||
|
||||
//输出图像
|
||||
ImageEncoder encode = ImageCodec.createImageEncoder("PNG",null,encodeParam);
|
||||
encode.encode(bi.getData(),bi.getColorModel());
|
||||
}
|
||||
|
||||
public void saveImage(final String file,final int imageWidth) throws IOException {
|
||||
GTRenderer renderer = new StreamingRenderer();
|
||||
renderer.setMapContent(this);
|
||||
MapViewport mapViewport = this.getViewport();
|
||||
ReferencedEnvelope mapBounds
|
||||
= new ReferencedEnvelope(
|
||||
118.02532161784,
|
||||
118.08394386082,
|
||||
36.846653667618,
|
||||
36.818458342844,
|
||||
this.getCoordinateReferenceSystem()
|
||||
);
|
||||
// = this.getMaxBounds();
|
||||
|
||||
mapViewport.setBounds(mapBounds);
|
||||
double heightToWidth = mapBounds.getSpan(1)/mapBounds.getSpan(0);
|
||||
Rectangle imageBounds
|
||||
// = new Rectangle(0,0,imageWidth, (int) Math.round(imageWidth*heightToWidth));
|
||||
= new Rectangle(0,0,256, 256);
|
||||
|
||||
BufferedImage image = new BufferedImage(imageBounds.width,imageBounds.height,BufferedImage.TYPE_INT_RGB);
|
||||
|
||||
Graphics2D gr = image.createGraphics();
|
||||
gr.setPaint(Color.WHITE);
|
||||
gr.fill(imageBounds);
|
||||
|
||||
renderer.paint(gr,imageBounds,mapBounds);
|
||||
File fileToSave = new File(file);
|
||||
ImageIO.write(image,"jpeg",fileToSave);
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
package com.gis3c.spatial.entity;
|
||||
|
||||
import com.gis3c.spatial.entity.feature.BaseFeature;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
public class GeoCity extends BaseFeature {
|
||||
private String code;
|
||||
private String name;
|
||||
private Geometry geometry;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
38
src/main/java/com/gis3c/spatial/entity/Test.java
Normal file
38
src/main/java/com/gis3c/spatial/entity/Test.java
Normal file
@ -0,0 +1,38 @@
|
||||
package com.gis3c.spatial.entity;
|
||||
|
||||
import com.gis3c.spatial.entity.feature.BaseFeature;
|
||||
import com.gis3c.spatial.entity.geometry.C3Point;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/1/16.
|
||||
*/
|
||||
public class Test extends BaseFeature {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String direction;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,7 @@ import java.util.List;
|
||||
* @Description 具有空间字段的基类
|
||||
* @date 2017-07-10 下午3:43
|
||||
*/
|
||||
public class BaseFeature {
|
||||
public class BaseFeature implements IFeature {
|
||||
private Geometry geometry;
|
||||
|
||||
public Geometry getGeometry() {
|
||||
@ -38,7 +38,8 @@ public class BaseFeature {
|
||||
/**
|
||||
* 获取所有字段信息
|
||||
*/
|
||||
private List<Field> AllFieldes(){
|
||||
@Override
|
||||
public List<Field> AllFieldes(){
|
||||
List<Field> fieldList = new ArrayList<>();
|
||||
|
||||
Class superClass = BaseFeature.class;
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
|
||||
import com.vividsolutions.jts.geom.CoordinateSequence;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
/**
|
||||
* @author hukekuan
|
||||
* @Description 折线数据
|
||||
* @date 2017-07-10 下午4:21
|
||||
*/
|
||||
public class C3LineString extends LineString implements ILineString {
|
||||
public C3LineString(CoordinateSequence points, GeometryFactory factory) {
|
||||
super(points, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoordinateReferenceSystem GetCRS() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
|
||||
import com.vividsolutions.jts.geom.CoordinateSequence;
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.Point;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
/**
|
||||
* @author hukekuan
|
||||
* @Description 自定义点数据
|
||||
* @date 2017-07-10 下午4:19
|
||||
*/
|
||||
public class C3Point extends Point implements IPoint {
|
||||
public C3Point(CoordinateSequence coordinates, GeometryFactory factory) {
|
||||
super(coordinates, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoordinateReferenceSystem GetCRS() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
|
||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.LinearRing;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
/**
|
||||
* @author hukekuan
|
||||
* @Description 单面数据
|
||||
* @date 2017-07-10 下午4:23
|
||||
*/
|
||||
public class C3Polygon extends Polygon implements IPolygon {
|
||||
public C3Polygon(LinearRing shell, LinearRing[] holes, GeometryFactory factory) {
|
||||
super(shell, holes, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoordinateReferenceSystem GetCRS() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;
|
||||
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface IGeometry {
|
||||
public CoordinateReferenceSystem GetCRS();
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface ILineString extends IGeometry {
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface IMultiLineString extends IGeometry {
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface IMultiPoint extends IGeometry {
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface IMultiPolygon extends IGeometry {
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface IPoint extends IGeometry {
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
package com.gis3c.spatial.entity.geometry;
|
||||
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 17-7-10.
|
||||
*/
|
||||
public interface IPolygon extends IGeometry {
|
||||
}
|
||||
@ -6,6 +6,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.gis3c.spatial.entity.geometry.C3Point;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
import org.apache.ibatis.type.TypeHandler;
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
|
||||
sys.driverClassName=org.postgresql.Driver
|
||||
sys.url=jdbc:postgresql:gisdata
|
||||
sys.username=gis
|
||||
sys.password=gis
|
||||
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:jee="http://www.springframework.org/schema/jee"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/tx
|
||||
http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/jee
|
||||
http://www.springframework.org/schema/jee/spring-jee.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/aop
|
||||
http://www.springframework.org/schema/aop/spring-aop.xsd" default-lazy-init="true">
|
||||
<bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||
<property name="fileEncoding" value="UTF-8" />
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>classpath:resources.properties</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
|
||||
<property name="properties" ref="configProperties" />
|
||||
</bean>
|
||||
<context:component-scan base-package="com.gis3c.*"/>
|
||||
|
||||
<!--生成数据源-->
|
||||
<bean id="dataSource_sys" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
|
||||
<property name="driverClassName" value="${sys.driverClassName}"/>
|
||||
<property name="url" value="${sys.url}"/>
|
||||
<property name="username" value="${sys.username}"/>
|
||||
<property name="password" value="${sys.password}"/>
|
||||
<property name="accessToUnderlyingConnectionAllowed" value="true"/>
|
||||
</bean>
|
||||
<bean id="sqlSessionFactory_sys" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource_sys"/>
|
||||
<property name="configLocation" value="classpath:sql-map-config-mybatis.xml"/>
|
||||
<property name="mapperLocations" value="classpath:mappings/ol/*.xml"/>
|
||||
</bean>
|
||||
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory_sys" />
|
||||
<property name="basePackage" value="com.gis3c"/>
|
||||
<property name="annotationClass" value="com.gis3c.common.persistence.annotation.C3BatisDao"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<settings>
|
||||
<!-- 使全局的映射器启用或禁用缓存。 -->
|
||||
<setting name="cacheEnabled" value="true"/>
|
||||
|
||||
<!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。 -->
|
||||
<setting name="lazyLoadingEnabled" value="true"/>
|
||||
|
||||
<!-- 当启用时,有延迟加载属性的对象在被调用时将会完全加载任意属性。否则,每种属性将会按需要加载。 -->
|
||||
<setting name="aggressiveLazyLoading" value="true"/>
|
||||
|
||||
<!-- 是否允许单条sql 返回多个数据集 (取决于驱动的兼容性) default:true -->
|
||||
<setting name="multipleResultSetsEnabled" value="true"/>
|
||||
|
||||
<!-- 是否可以使用列的别名 (取决于驱动的兼容性) default:true -->
|
||||
<setting name="useColumnLabel" value="true"/>
|
||||
|
||||
<!-- 允许JDBC 生成主键。需要驱动器支持。如果设为了true,这个设置将强制使用被生成的主键,有一些驱动器不兼容不过仍然可以执行。 default:false -->
|
||||
<setting name="useGeneratedKeys" value="false"/>
|
||||
|
||||
<!-- 指定 MyBatis 如何自动映射 数据基表的列 NONE:不隐射 PARTIAL:部分 FULL:全部 -->
|
||||
<setting name="autoMappingBehavior" value="PARTIAL"/>
|
||||
|
||||
<!-- 这是默认的执行类型 (SIMPLE: 简单; REUSE: 执行器可能重复使用prepared statements语句;BATCH: 执行器可以重复执行语句和批量更新) -->
|
||||
<setting name="defaultExecutorType" value="SIMPLE"/>
|
||||
|
||||
<!-- 使用驼峰命名法转换字段。 -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
|
||||
<!-- 设置本地缓存范围 session:就会有数据的共享 statement:语句范围 (这样就不会有数据的共享 ) defalut:session -->
|
||||
<setting name="localCacheScope" value="SESSION"/>
|
||||
|
||||
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 -->
|
||||
<setting name="jdbcTypeForNull" value="NULL"/>
|
||||
</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="ObjectArray" />
|
||||
</typeAliases>
|
||||
<typeHandlers>
|
||||
<typeHandler handler="com.gis3c.spatial.postgis.ArrayTypeHandler" javaType="ObjectArray" />
|
||||
</typeHandlers>
|
||||
</configuration>
|
||||
@ -1,7 +0,0 @@
|
||||
package com.c3gis.spatial;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("OK");
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,17 @@
|
||||
package com.gis3c;
|
||||
package com.gis3c.spatial;
|
||||
|
||||
import com.gis3c.ol.entity.View;
|
||||
import com.gis3c.ol.entity.layer.TileLayer;
|
||||
import com.gis3c.ol.entity.source.Wmts;
|
||||
import com.gis3c.ol.entity.Map;
|
||||
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 com.gis3c.spatial.entity.Test;
|
||||
import com.gis3c.spatial.entity.feature.IFeature;
|
||||
import com.gis3c.spatial.service.TestService;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import com.gis3c.ol.entity.Map;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2017/12/14.
|
||||
@ -27,10 +27,18 @@ public class App {
|
||||
LayerService layerService = context.getBean(LayerService.class);
|
||||
MapService mapService = context.getBean(MapService.class);
|
||||
|
||||
TestService testService = context.getBean(TestService.class);
|
||||
|
||||
|
||||
List<Test> result = testService.allList();
|
||||
Test test = result.get(0);
|
||||
|
||||
System.out.println(test.AllFieldes());
|
||||
|
||||
// //地图接口
|
||||
// Map map = mapService.findMapById("fc813a1f-6a31-4202-9419-8d125ba203c9");
|
||||
// System.out.println(map.getLayers()[0][1]);
|
||||
|
||||
//地图接口
|
||||
Map map = mapService.findMapById("fc813a1f-6a31-4202-9419-8d125ba203c9");
|
||||
System.out.println(map.getLayers()[0][1]);
|
||||
// Map map = new Map();
|
||||
// map.setMapId(UUID.randomUUID().toString());
|
||||
// map.setMapName("综合GIS系统");
|
||||
14
src/test/java/com/gis3c/spatial/dao/TestDao.java
Normal file
14
src/test/java/com/gis3c/spatial/dao/TestDao.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.gis3c.spatial.dao;
|
||||
|
||||
import com.gis3c.common.persistence.annotation.C3SpatialDao;
|
||||
import com.gis3c.spatial.entity.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/1/16.
|
||||
*/
|
||||
@C3SpatialDao
|
||||
public interface TestDao {
|
||||
public List<Test> allList();
|
||||
}
|
||||
12
src/test/java/com/gis3c/spatial/service/TestService.java
Normal file
12
src/test/java/com/gis3c/spatial/service/TestService.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.gis3c.spatial.service;
|
||||
|
||||
import com.gis3c.spatial.entity.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/1/16.
|
||||
*/
|
||||
public interface TestService {
|
||||
public List<Test> allList();
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.gis3c.spatial.service.impl;
|
||||
|
||||
import com.gis3c.spatial.dao.TestDao;
|
||||
import com.gis3c.spatial.entity.Test;
|
||||
import com.gis3c.spatial.service.TestService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by hukekuan on 2018/1/16.
|
||||
*/
|
||||
@Service
|
||||
public class TestServiceImpl implements TestService {
|
||||
@Autowired private TestDao testDao;
|
||||
|
||||
@Override
|
||||
public List<Test> allList() {
|
||||
return testDao.allList();
|
||||
}
|
||||
}
|
||||
154
src/test/resources/init.sql
Normal file
154
src/test/resources/init.sql
Normal file
@ -0,0 +1,154 @@
|
||||
--地图表
|
||||
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)
|
||||
);
|
||||
15
src/test/resources/mappings/spatial/TestDao.xml
Normal file
15
src/test/resources/mappings/spatial/TestDao.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?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.spatial.dao.TestDao">
|
||||
<resultMap id="mapResult" type="com.gis3c.spatial.entity.Test">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="direction" column="direction" />
|
||||
<result property="geometry" column="geom" javaType="Geometry"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="allList" resultMap="mapResult">
|
||||
SELECT id,name,direction,geom
|
||||
FROM roadpoint;
|
||||
</select>
|
||||
</mapper>
|
||||
@ -1,10 +1,10 @@
|
||||
gis.driverClassName=oracle.jdbc.driver.OracleDriver
|
||||
gis.url=jdbc:oracle:thin:@172.16.6.13:1521:orcl
|
||||
gis.username=spatial
|
||||
gis.password=spatial
|
||||
|
||||
sys.driverClassName=org.postgresql.Driver
|
||||
sys.url=jdbc:postgresql:gisdata
|
||||
sys.username=gis
|
||||
sys.password=gis
|
||||
|
||||
postgis.driverClassName=org.postgresql.Driver
|
||||
postgis.url=jdbc:postgresql://localhost:5432/gisdb
|
||||
postgis.username=postgres
|
||||
postgis.password=postgres
|
||||
spatial.driverClassName=org.postgresql.Driver
|
||||
spatial.url=jdbc:postgresql:postgis
|
||||
spatial.username=postgres
|
||||
spatial.password=postgres
|
||||
@ -28,15 +28,41 @@
|
||||
</bean>
|
||||
<context:component-scan base-package="com.gis3c.*"/>
|
||||
|
||||
<bean id="dataSource_GIS" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
||||
<property name="driverClassName" value="${postgis.driverClassName}"/>
|
||||
<property name="url" value="${postgis.url}"/>
|
||||
<property name="username" value="${postgis.username}"/>
|
||||
<property name="password" value="${postgis.password}"/>
|
||||
<!--生成数据源-->
|
||||
<bean id="dataSource_sys" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
|
||||
<property name="driverClassName" value="${sys.driverClassName}"/>
|
||||
<property name="url" value="${sys.url}"/>
|
||||
<property name="username" value="${sys.username}"/>
|
||||
<property name="password" value="${sys.password}"/>
|
||||
<property name="accessToUnderlyingConnectionAllowed" value="true"/>
|
||||
</bean>
|
||||
<bean id="sqlSessionFactory_GIS" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource_GIS"/>
|
||||
<bean id="dataSource_spatial" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
|
||||
<property name="driverClassName" value="${spatial.driverClassName}"/>
|
||||
<property name="url" value="${spatial.url}"/>
|
||||
<property name="username" value="${spatial.username}"/>
|
||||
<property name="password" value="${spatial.password}"/>
|
||||
<property name="accessToUnderlyingConnectionAllowed" value="true"/>
|
||||
</bean>
|
||||
|
||||
<bean id="sqlSessionFactory_sys" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource_sys"/>
|
||||
<property name="configLocation" value="classpath:sql-map-config-mybatis.xml"/>
|
||||
<property name="mapperLocations" value="classpath*:com/gis3c/sqlmaps/*.xml"/>
|
||||
<property name="mapperLocations" value="classpath:mappings/ol/*.xml"/>
|
||||
</bean>
|
||||
<bean id="sqlSessionFactory_spatial" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<property name="dataSource" ref="dataSource_spatial"/>
|
||||
<property name="configLocation" value="classpath:sql-map-config-mybatis.xml"/>
|
||||
<property name="mapperLocations" value="classpath:mappings/spatial/*.xml"/>
|
||||
</bean>
|
||||
|
||||
<bean id="mapperScannerConfigurer_sys" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory_sys" />
|
||||
<property name="basePackage" value="com.gis3c"/>
|
||||
<property name="annotationClass" value="com.gis3c.common.persistence.annotation.C3olDao"/>
|
||||
</bean>
|
||||
<bean id="mapperScannerConfigurer_spatial" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
|
||||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory_spatial" />
|
||||
<property name="basePackage" value="com.gis3c"/>
|
||||
<property name="annotationClass" value="com.gis3c.common.persistence.annotation.C3SpatialDao"/>
|
||||
</bean>
|
||||
</beans>
|
||||
@ -2,13 +2,54 @@
|
||||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<settings>
|
||||
<setting name="cacheEnabled" value="false"/>
|
||||
<settings>
|
||||
<!-- 使全局的映射器启用或禁用缓存。 -->
|
||||
<setting name="cacheEnabled" value="true"/>
|
||||
|
||||
<!-- 全局启用或禁用延迟加载。当禁用时,所有关联对象都会即时加载。 -->
|
||||
<setting name="lazyLoadingEnabled" value="true"/>
|
||||
|
||||
<!-- 当启用时,有延迟加载属性的对象在被调用时将会完全加载任意属性。否则,每种属性将会按需要加载。 -->
|
||||
<setting name="aggressiveLazyLoading" value="true"/>
|
||||
|
||||
<!-- 是否允许单条sql 返回多个数据集 (取决于驱动的兼容性) default:true -->
|
||||
<setting name="multipleResultSetsEnabled" value="true"/>
|
||||
|
||||
<!-- 是否可以使用列的别名 (取决于驱动的兼容性) default:true -->
|
||||
<setting name="useColumnLabel" value="true"/>
|
||||
|
||||
<!-- 允许JDBC 生成主键。需要驱动器支持。如果设为了true,这个设置将强制使用被生成的主键,有一些驱动器不兼容不过仍然可以执行。 default:false -->
|
||||
<setting name="useGeneratedKeys" value="false"/>
|
||||
|
||||
<!-- 指定 MyBatis 如何自动映射 数据基表的列 NONE:不隐射 PARTIAL:部分 FULL:全部 -->
|
||||
<setting name="autoMappingBehavior" value="PARTIAL"/>
|
||||
|
||||
<!-- 这是默认的执行类型 (SIMPLE: 简单; REUSE: 执行器可能重复使用prepared statements语句;BATCH: 执行器可以重复执行语句和批量更新) -->
|
||||
<setting name="defaultExecutorType" value="SIMPLE"/>
|
||||
|
||||
<!-- 使用驼峰命名法转换字段。 -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/>
|
||||
|
||||
<!-- 设置本地缓存范围 session:就会有数据的共享 statement:语句范围 (这样就不会有数据的共享 ) defalut:session -->
|
||||
<setting name="localCacheScope" value="SESSION"/>
|
||||
|
||||
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 -->
|
||||
<setting name="jdbcTypeForNull" value="NULL"/>
|
||||
</settings>
|
||||
|
||||
<!--
|
||||
<typeAliases>
|
||||
<typeAlias type="com.vividsolutions.jts.geom.Geometry" alias="Geometry" />
|
||||
<typeAlias type="com.vividsolutions.jts.geom.Geometry" alias="Geometry" />
|
||||
</typeAliases>
|
||||
<typeHandlers>
|
||||
<typeHandler handler="com.c3gis.spatial.postgis.PostGISHandler" javaType="Geometry" />
|
||||
<typeHandler handler="com.gis3c.common.OracleSpatialHandler" javaType="Geometry" />
|
||||
</typeHandlers>-->
|
||||
<typeAliases>
|
||||
<typeAlias type="com.vividsolutions.jts.geom.Geometry" alias="Geometry" />
|
||||
<typeAlias type="java.lang.Object" alias="ObjectArray" />
|
||||
</typeAliases>
|
||||
<typeHandlers>
|
||||
<typeHandler handler="com.gis3c.spatial.postgis.PostGISHandler" javaType="Geometry" />
|
||||
<typeHandler handler="com.gis3c.spatial.postgis.ArrayTypeHandler" javaType="ObjectArray" />
|
||||
</typeHandlers>
|
||||
</configuration>
|
||||
Loading…
Reference in New Issue
Block a user