| | |
| | | package com.lf.server.helper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.lf.server.entity.all.BaseGeoEntity; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | | import com.lf.server.mapper.all.GeomBaseMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | | import org.apache.commons.logging.Log; |
| | |
| | | for (String key : map.keySet()) { |
| | | Layer layer = null; |
| | | try { |
| | | GeomBaseMapper baseMapper = ClassHelper.getGeoBaseMapper(key); |
| | | BasicMapper baseMapper = ClassHelper.getBasicMapper(key); |
| | | if (null == baseMapper) { |
| | | continue; |
| | | } |
| | |
| | | /** |
| | | * 创建图层 |
| | | */ |
| | | private static Layer createLayer(DataSource dataSource, GeomBaseMapper baseMapper ) { |
| | | private static Layer createLayer(DataSource dataSource, BasicMapper baseMapper ) { |
| | | String tab = BaseQueryService.getTabName(baseMapper); |
| | | if (StringHelper.isNull(tab)) { |
| | | return null; |
| | | } |
| | | |
| | | String geomType = baseMapper.selectGeometryType(tab); |
| | | if (StringHelper.isEmpty(geomType)) { |
| | | return null; |
| | | } |
| | | |
| | | Integer srid = baseMapper.selectSrid(tab); |
| | | String geomType = null; |
| | | SpatialReference sr = new SpatialReference(); |
| | | sr.ImportFromEPSG(null == srid ? 4490 : srid); |
| | | if (baseMapper instanceof GeomBaseMapper) { |
| | | GeomBaseMapper geomMapper = (GeomBaseMapper) baseMapper; |
| | | geomType = geomMapper.selectGeometryType(tab); |
| | | |
| | | Integer srid = geomMapper.selectSrid(tab); |
| | | sr.ImportFromEPSG(null == srid ? 4490 : srid); |
| | | } |
| | | |
| | | return dataSource.CreateLayer(tab, sr, getGeomType(geomType), null); |
| | | } |
| | |
| | | for (T t : list) { |
| | | Feature f = new Feature(layer.GetLayerDefn()); |
| | | |
| | | BaseGeoEntity geoEntity = (BaseGeoEntity) t; |
| | | Geometry geom = Geometry.CreateFromWkt(geoEntity.getGeom()); |
| | | f.SetGeometry(geom); |
| | | if (t instanceof BaseGeoEntity) { |
| | | BaseGeoEntity geoEntity = (BaseGeoEntity) t; |
| | | Geometry geom = Geometry.CreateFromWkt(geoEntity.getGeom()); |
| | | f.SetGeometry(geom); |
| | | } |
| | | |
| | | setFeatureData(f, fields, t); |
| | | layer.CreateFeature(f); |