From 47055cc170b0b02b0296c220fd5bad4abe5a4a1a Mon Sep 17 00:00:00 2001 From: thkim Date: Tue, 17 Jun 2025 10:17:25 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B0=9C=EC=A3=BC=EA=B8=B0=EA=B4=80=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EB=B3=B4=EC=99=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.txt | 130 +- pom.xml | 204 +- .../drilling/home/DrillingHomeController.java | 31 - .../home/service/DrillingHomeMapper.java | 1 + .../home/service/DrillingHomeService.java | 2 + .../service/impl/DrillingHomeServiceImpl.java | 5 + .../geoinfo/main/login/LoginController.java | 24 + .../geoinfo/map/left/MapLeftController.java | 21 + src/main/java/geoinfo/map/myMap/AVList.java | 4 +- .../java/geoinfo/map/myMap/AWTLabelUtil.java | 506 ++- .../geoinfo/map/myMap/AbstractService.java | 30 + src/main/java/geoinfo/map/myMap/CRSMngr.java | 322 +- .../java/geoinfo/map/myMap/CacheFormat.java | 31 + .../java/geoinfo/map/myMap/CacheLevel.java | 70 + .../java/geoinfo/map/myMap/CacheLevelSet.java | 94 + .../map/myMap/CategorizeBinding110.java | 2 - src/main/java/geoinfo/map/myMap/ConnJDBC.java | 68 +- src/main/java/geoinfo/map/myMap/ConnMngr.java | 86 +- .../java/geoinfo/map/myMap/ConnOracle.java | 33 + .../map/myMap/ContentDataStoreRefinder.java | 238 ++ .../geoinfo/map/myMap/ExFeatureLayer.java | 20 + .../java/geoinfo/map/myMap/FeatureLayer.java | 749 ++--- .../java/geoinfo/map/myMap/FeatureMngr.java | 1359 ++++++++ .../java/geoinfo/map/myMap/FieldInfo.java | 61 + src/main/java/geoinfo/map/myMap/FieldSQL.java | 130 + .../geoinfo/map/myMap/GWVectorDriver.java | 5 - .../geoinfo/map/myMap/GWaveLayerInfo.java | 62 + .../geoinfo/map/myMap/GWaveStoreMngr.java | 11 +- .../geoinfo/map/myMap/GeoWaveDataStore.java | 154 +- .../map/myMap/GeoWaveFeatureReader.java | 104 + .../map/myMap/GeoWaveFeatureSource.java | 403 +++ .../java/geoinfo/map/myMap/GeometryMngr.java | 103 +- .../map/myMap/GetCapabilitiesRequest.java | 5 + .../map/myMap/GetFeatureInfoRequest.java | 95 + .../map/myMap/GetLegendGraphicRequest.java | 65 + .../java/geoinfo/map/myMap/GetMapRequest.java | 163 +- .../java/geoinfo/map/myMap/ImgCacheLayer.java | 75 + .../java/geoinfo/map/myMap/ImgCacheMngr.java | 264 ++ .../java/geoinfo/map/myMap/InsertParams.java | 16 + .../java/geoinfo/map/myMap/JdbcStoreMngr.java | 910 +++--- src/main/java/geoinfo/map/myMap/JsonUtil.java | 34 + .../java/geoinfo/map/myMap/KLISLabelUtil.java | 167 +- .../java/geoinfo/map/myMap/LabelCacheEx.java | 2861 +++++++---------- src/main/java/geoinfo/map/myMap/Layer.java | 284 +- .../java/geoinfo/map/myMap/LayerFactory.java | 89 +- src/main/java/geoinfo/map/myMap/LayerSet.java | 8 +- .../map/myMap/LegendGraphicBuilder.java | 667 ++++ .../java/geoinfo/map/myMap/LegendUtils.java | 248 ++ src/main/java/geoinfo/map/myMap/MapStyle.java | 115 +- .../java/geoinfo/map/myMap/MyStartServer.java | 44 + .../geoinfo/map/myMap/NonSpatialDialect.java | 737 +++++ .../map/myMap/NonSpatialFilterToSQL.java | 303 ++ .../java/geoinfo/map/myMap/O2CRSFactory.java | 817 +++-- .../map/myMap/O2CRSOverrideFactory.java | 423 +++ .../java/geoinfo/map/myMap/O2DSFactory.java | 463 ++- src/main/java/geoinfo/map/myMap/O2DSMngr.java | 329 +- .../geoinfo/map/myMap/O2DemLayerMngr.java | 183 ++ .../map/myMap/O2FeatureCollection.java | 170 + src/main/java/geoinfo/map/myMap/O2GML.java | 259 ++ .../geoinfo/map/myMap/O2ImgLayerMngr.java | 162 + .../java/geoinfo/map/myMap/O2LayerInfo.java | 128 + .../java/geoinfo/map/myMap/O2WpsLayerSet.java | 6 +- .../java/geoinfo/map/myMap/OWSConstants.java | 59 + .../map/myMap/OWSServiceException.java | 19 +- .../java/geoinfo/map/myMap/OracleDialect.java | 646 ++-- .../geoinfo/map/myMap/OracleFilterToSQL.java | 2 +- .../java/geoinfo/map/myMap/PluginUtil.java | 81 + .../java/geoinfo/map/myMap/QueryMngr.java | 241 ++ .../myMap/RefindInsertFeatureCollection.java | 199 ++ .../map/myMap/RenderFeatureCollection.java | 350 ++ .../map/myMap/RenderFeatureReader.java | 121 + .../map/myMap/RenderFeatureSource.java | 177 + .../java/geoinfo/map/myMap/RenderMngr.java | 668 +++- src/main/java/geoinfo/map/myMap/Request.java | 103 +- .../java/geoinfo/map/myMap/ScreenMap.java | 176 + .../map/myMap/ServerConfiguration.java | 896 +++--- .../java/geoinfo/map/myMap/ServerContext.java | 9 +- .../geoinfo/map/myMap/ServerInfoService.java | 422 +++ src/main/java/geoinfo/map/myMap/Service.java | 181 ++ .../java/geoinfo/map/myMap/ServiceMngr.java | 99 + .../geoinfo/map/myMap/ServicesService.java | 75 + .../java/geoinfo/map/myMap/ShpIndexMngr.java | 265 ++ .../java/geoinfo/map/myMap/ShpLayerInfo.java | 86 + .../java/geoinfo/map/myMap/ShpStoreMngr.java | 341 ++ .../java/geoinfo/map/myMap/SimpleDialect.java | 453 +++ .../geoinfo/map/myMap/SimpleFilterToSQL.java | 162 + .../java/geoinfo/map/myMap/StyleMngr.java | 568 ++-- src/main/java/geoinfo/map/myMap/TMSInfo.java | 63 + src/main/java/geoinfo/map/myMap/TMSMngr.java | 160 + .../java/geoinfo/map/myMap/TileMatrix.java | 112 + .../geoinfo/map/myMap/TileMatrixRule.java | 80 + .../java/geoinfo/map/myMap/TileMatrixSet.java | 159 + src/main/java/geoinfo/map/myMap/WCSLayer.java | 80 + .../geoinfo/map/myMap/WKBAttributeIO.java | 106 + .../java/geoinfo/map/myMap/WMSController.java | 57 + .../geoinfo/map/myMap/WMSGetCapabilities.java | 460 +++ .../geoinfo/map/myMap/WMSGetFeatureInfo.java | 249 ++ .../map/myMap/WMSGetLegendGraphic.java | 100 + .../java/geoinfo/map/myMap/WMSGetMap.java | 143 +- .../java/geoinfo/map/myMap/WMSParser.java | 912 ++++++ .../java/geoinfo/map/myMap/WMSService.java | 82 + .../java/geoinfo/map/myMap/WMTSLayer.java | 88 + src/main/java/geoinfo/map/myMap/WMTSMngr.java | 398 +++ .../geoinfo/map/myMap/WpsCovStoreMngr.java | 64 + .../geoinfo/map/myMap/WpsVecStoreMngr.java | 1209 +++---- src/main/java/geoinfo/map/myMap/XMLUtil.java | 172 + .../drilling/home/DrillingHomeMapper.xml | 28 + .../sqlmap/mapper/map/MapLeft_SQL.xml | 8 +- .../webapp/WEB-INF/lib/geowave-driver-0.9.jar | Bin 0 -> 204593 bytes src/main/webapp/WEB-INF/lib/tibero5-jdbc.jar | Bin 0 -> 1249540 bytes src/main/webapp/WEB-INF/lib/wms.jar | Bin 0 -> 232949 bytes src/main/webapp/WEB-INF/lib/xsd-2.6.0.jar | Bin 0 -> 992820 bytes .../WEB-INF/views/home/include/header.jsp | 4 +- src/main/webapp/WEB-INF/views/home/index.jsp | 4 +- .../WEB-INF/views/home/personalinfo.jsp | 36 +- src/main/webapp/WEB-INF/views/map/index.jsp | 8 +- src/main/webapp/WEB-INF/views/vote/main.jsp | 2 +- src/main/webapp/com/css/common.v2.0.css | 14 +- src/main/webapp/com/css/sass/common.v2.0.scss | 14 +- src/main/webapp/js/map/main/left/left.js | 13 + src/main/webapp/js/map/main/map.js | 8 +- 121 files changed, 20101 insertions(+), 6284 deletions(-) create mode 100644 src/main/java/geoinfo/map/myMap/AbstractService.java create mode 100644 src/main/java/geoinfo/map/myMap/CacheFormat.java create mode 100644 src/main/java/geoinfo/map/myMap/CacheLevel.java create mode 100644 src/main/java/geoinfo/map/myMap/CacheLevelSet.java create mode 100644 src/main/java/geoinfo/map/myMap/ConnOracle.java create mode 100644 src/main/java/geoinfo/map/myMap/ContentDataStoreRefinder.java create mode 100644 src/main/java/geoinfo/map/myMap/ExFeatureLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/FeatureMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/FieldInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/FieldSQL.java delete mode 100644 src/main/java/geoinfo/map/myMap/GWVectorDriver.java create mode 100644 src/main/java/geoinfo/map/myMap/GWaveLayerInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/GeoWaveFeatureReader.java create mode 100644 src/main/java/geoinfo/map/myMap/GeoWaveFeatureSource.java create mode 100644 src/main/java/geoinfo/map/myMap/GetCapabilitiesRequest.java create mode 100644 src/main/java/geoinfo/map/myMap/GetFeatureInfoRequest.java create mode 100644 src/main/java/geoinfo/map/myMap/GetLegendGraphicRequest.java create mode 100644 src/main/java/geoinfo/map/myMap/ImgCacheLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/ImgCacheMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/InsertParams.java create mode 100644 src/main/java/geoinfo/map/myMap/JsonUtil.java create mode 100644 src/main/java/geoinfo/map/myMap/LegendGraphicBuilder.java create mode 100644 src/main/java/geoinfo/map/myMap/LegendUtils.java create mode 100644 src/main/java/geoinfo/map/myMap/MyStartServer.java create mode 100644 src/main/java/geoinfo/map/myMap/NonSpatialDialect.java create mode 100644 src/main/java/geoinfo/map/myMap/NonSpatialFilterToSQL.java create mode 100644 src/main/java/geoinfo/map/myMap/O2CRSOverrideFactory.java create mode 100644 src/main/java/geoinfo/map/myMap/O2DemLayerMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/O2FeatureCollection.java create mode 100644 src/main/java/geoinfo/map/myMap/O2GML.java create mode 100644 src/main/java/geoinfo/map/myMap/O2ImgLayerMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/O2LayerInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/OWSConstants.java create mode 100644 src/main/java/geoinfo/map/myMap/PluginUtil.java create mode 100644 src/main/java/geoinfo/map/myMap/QueryMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/RefindInsertFeatureCollection.java create mode 100644 src/main/java/geoinfo/map/myMap/RenderFeatureCollection.java create mode 100644 src/main/java/geoinfo/map/myMap/RenderFeatureReader.java create mode 100644 src/main/java/geoinfo/map/myMap/RenderFeatureSource.java create mode 100644 src/main/java/geoinfo/map/myMap/ScreenMap.java create mode 100644 src/main/java/geoinfo/map/myMap/ServerInfoService.java create mode 100644 src/main/java/geoinfo/map/myMap/Service.java create mode 100644 src/main/java/geoinfo/map/myMap/ServiceMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/ServicesService.java create mode 100644 src/main/java/geoinfo/map/myMap/ShpIndexMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/ShpLayerInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/ShpStoreMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/SimpleDialect.java create mode 100644 src/main/java/geoinfo/map/myMap/SimpleFilterToSQL.java create mode 100644 src/main/java/geoinfo/map/myMap/TMSInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/TMSMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/TileMatrix.java create mode 100644 src/main/java/geoinfo/map/myMap/TileMatrixRule.java create mode 100644 src/main/java/geoinfo/map/myMap/TileMatrixSet.java create mode 100644 src/main/java/geoinfo/map/myMap/WCSLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/WKBAttributeIO.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSController.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSGetCapabilities.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSGetFeatureInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSGetLegendGraphic.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSParser.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSService.java create mode 100644 src/main/java/geoinfo/map/myMap/WMTSLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/WMTSMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/WpsCovStoreMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/XMLUtil.java create mode 100644 src/main/webapp/WEB-INF/lib/geowave-driver-0.9.jar create mode 100644 src/main/webapp/WEB-INF/lib/tibero5-jdbc.jar create mode 100644 src/main/webapp/WEB-INF/lib/wms.jar create mode 100644 src/main/webapp/WEB-INF/lib/xsd-2.6.0.jar diff --git a/list.txt b/list.txt index c1bcec6e..9c55ee4e 100644 --- a/list.txt +++ b/list.txt @@ -6,128 +6,10 @@ #src\main\webapp\com\css\common.v2.0.css.map #src\main\webapp\WEB-INF\views\web\manage\list_reg.jsp -src\main\webapp\js\map\main\map.js -src\main\webapp\WEB-INF\views\drilling\common\includeTopMenu.jsp -src\main\webapp\WEB-INF\views\drilling\home\drilling_index.jsp -src\main\webapp\com\css\common.v2.0.css -src\main\webapp\com\css\common.v2.0.css.map src\main\webapp\WEB-INF\views\drilling\inquiry\drilling_inquiry_project.jsp -src\main\java\geoinfo\drilling\home\DrillingHomeController.java -src\main\webapp\WEB-INF\views\drilling\inquiry\drilling_inquiry.jsp -src\main\java\geoinfo\map\myMap\AVList.java -src\main\java\geoinfo\map\myMap\AWTLabelUtil.java -src\main\java\geoinfo\map\myMap\AttributeList.java -src\main\java\geoinfo\map\myMap\CRSMngr.java -src\main\java\geoinfo\map\myMap\CategorizeBinding110.java -src\main\java\geoinfo\map\myMap\ConnJDBC.java -src\main\java\geoinfo\map\myMap\ConnMngr.java -src\main\java\geoinfo\map\myMap\CoordinateAccess.java -src\main\java\geoinfo\map\myMap\CoordinateAccessFactory.java -src\main\java\geoinfo\map\myMap\Coordinates.java -src\main\java\geoinfo\map\myMap\EncryptUtil.java -src\main\java\geoinfo\map\myMap\ExO2ImgLayer.java -src\main\java\geoinfo\map\myMap\ExWMSLayer.java -src\main\java\geoinfo\map\myMap\ExtractRasterStyleVisitor.java -src\main\java\geoinfo\map\myMap\FeatureLayer.java -src\main\java\geoinfo\map\myMap\FileComparator.java -src\main\java\geoinfo\map\myMap\GWVectorDriver.java -src\main\java\geoinfo\map\myMap\GWaveStoreMngr.java -src\main\java\geoinfo\map\myMap\GeoWaveDataStore.java -src\main\java\geoinfo\map\myMap\GeometryConverter.java -src\main\java\geoinfo\map\myMap\GeometryMngr.java -src\main\java\geoinfo\map\myMap\GetMapRequest.java -src\main\java\geoinfo\map\myMap\GroupLayer.java -src\main\java\geoinfo\map\myMap\InterpolateBinding110.java -src\main\java\geoinfo\map\myMap\JdbcStoreMngr.java -src\main\java\geoinfo\map\myMap\KLISLabelUtil.java -src\main\java\geoinfo\map\myMap\LabelCacheEx.java -src\main\java\geoinfo\map\myMap\LabelCacheItemEx.java -src\main\java\geoinfo\map\myMap\LabelInfo.java -src\main\java\geoinfo\map\myMap\LabelPainterEx.java -src\main\java\geoinfo\map\myMap\Layer.java -src\main\java\geoinfo\map\myMap\LayerFactory.java -src\main\java\geoinfo\map\myMap\LayerSet.java -src\main\java\geoinfo\map\myMap\LinkLayer.java -src\main\java\geoinfo\map\myMap\LogCacheManager.java -src\main\java\geoinfo\map\myMap\LogMngr.java -src\main\java\geoinfo\map\myMap\Map.java -src\main\java\geoinfo\map\myMap\MapStyle.java -src\main\java\geoinfo\map\myMap\O2CRSFactory.java -src\main\java\geoinfo\map\myMap\O2DSFactory.java -src\main\java\geoinfo\map\myMap\O2DSMngr.java -src\main\java\geoinfo\map\myMap\O2DSPrimaryKeyFinder.java -src\main\java\geoinfo\map\myMap\O2DemLayer.java -src\main\java\geoinfo\map\myMap\O2GeometryTypeMap.java -src\main\java\geoinfo\map\myMap\O2ImgLayer.java -src\main\java\geoinfo\map\myMap\O2LayerIndex.java -src\main\java\geoinfo\map\myMap\O2LayerLevel.java -src\main\java\geoinfo\map\myMap\O2LayerLevelSet.java -src\main\java\geoinfo\map\myMap\O2LayerUtil.java -src\main\java\geoinfo\map\myMap\O2PngWriter.java -src\main\java\geoinfo\map\myMap\O2SpatialIndexFeatureCollection.java -src\main\java\geoinfo\map\myMap\O2SqlDialect.java -src\main\java\geoinfo\map\myMap\O2StyleFactory.java -src\main\java\geoinfo\map\myMap\O2WpsLayerSet.java -src\main\java\geoinfo\map\myMap\OWSServiceException.java -src\main\java\geoinfo\map\myMap\OracleDialect.java -src\main\java\geoinfo\map\myMap\OracleFilterToSQL.java -src\main\java\geoinfo\map\myMap\OrdinateList.java -src\main\java\geoinfo\map\myMap\RefineRenderStyleVisitor.java -src\main\java\geoinfo\map\myMap\RefineStyleVisitor.java -src\main\java\geoinfo\map\myMap\RenderMngr.java -src\main\java\geoinfo\map\myMap\Request.java -src\main\java\geoinfo\map\myMap\SDO.java -src\main\java\geoinfo\map\myMap\SLDConfiguration110.java -src\main\java\geoinfo\map\myMap\SLDParser100.java -src\main\java\geoinfo\map\myMap\SLDTransformer110.java -src\main\java\geoinfo\map\myMap\ServerConfiguration.java -src\main\java\geoinfo\map\myMap\ServerContext.java -src\main\java\geoinfo\map\myMap\ServerInfo.java -src\main\java\geoinfo\map\myMap\ServerUtil.java -src\main\java\geoinfo\map\myMap\SimpleSql.java -src\main\java\geoinfo\map\myMap\StyleMngr.java -src\main\java\geoinfo\map\myMap\StyledLayerDescriptorBinding110.java -src\main\java\geoinfo\map\myMap\TextStyle2DEx.java -src\main\java\geoinfo\map\myMap\TransformedIconEx.java -src\main\java\geoinfo\map\myMap\WMSGetMap.java -src\main\java\geoinfo\map\myMap\WMSLayer.java -src\main\java\geoinfo\map\myMap\WpsVecStoreMngr.java -src\main\java\geoinfo\map\myMap\XSBooleanBinding110.java -src\main\webapp\WEB-INF\lib\gt-api-11.0.jar -src\main\webapp\WEB-INF\lib\gt-brewer-11.0.jar -src\main\webapp\WEB-INF\lib\gt-coverage-11.0.jar -src\main\webapp\WEB-INF\lib\gt-coverage-api-11.0.jar -src\main\webapp\WEB-INF\lib\gt-coveragetools-11.0.jar -src\main\webapp\WEB-INF\lib\gt-cql-11.0.jar -src\main\webapp\WEB-INF\lib\gt-data-11.0.jar -src\main\webapp\WEB-INF\lib\gt-epsg-wkt-11.0.jar -src\main\webapp\WEB-INF\lib\gt-geojson-11.0.jar -src\main\webapp\WEB-INF\lib\gt-geotiff-11.0.jar -src\main\webapp\WEB-INF\lib\gt-grid-11.0.jar -src\main\webapp\WEB-INF\lib\gt-jdbc-11.0.jar -src\main\webapp\WEB-INF\lib\gt-main-11.0.jar -src\main\webapp\WEB-INF\lib\gt-metadata-11.0.jar -src\main\webapp\WEB-INF\lib\gt-opengis-11.0.jar -src\main\webapp\WEB-INF\lib\gt-process-11.0.jar -src\main\webapp\WEB-INF\lib\gt-referencing-11.0.jar -src\main\webapp\WEB-INF\lib\gt-render-11.0.jar -src\main\webapp\WEB-INF\lib\gt-shapefile-11.0.jar -src\main\webapp\WEB-INF\lib\gt-wfs-11.0.jar -src\main\webapp\WEB-INF\lib\gt-wms-11.0.jar -src\main\webapp\WEB-INF\lib\gt-wps-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xml-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-core-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-fes-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-filter-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-gml2-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-gml3-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-ows-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-sld-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-wcs-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-wfs-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-wms-11.0.jar -src\main\webapp\WEB-INF\lib\gt-xsd-wps-11.0.jar -src\main\webapp\WEB-INF\lib\jdom-1.1.3.jar -src\main\webapp\WEB-INF\lib\picocontainer-1.2.jar -src\main\webapp\WEB-INF\lib\pngj-2.1.1.jar -src\main\webapp\js\map\main\map.js \ No newline at end of file +src\main\webapp\js\map\main\map.js +src\main\webapp\js\map\main\left\left.js +src\main\webapp\js\map\main\left\left_new.js +src\main\resources\egovframework\sqlmap\mapper\map\MapLeft_SQL.xml + +src\main\resources\egovframework\sqlmap\mapper\drilling\home\DrillingHomeMapper.xml diff --git a/pom.xml b/pom.xml index 50071da4..8832b7e9 100644 --- a/pom.xml +++ b/pom.xml @@ -28,23 +28,8 @@ - mesir-repo - http://mesir.googlecode.com/svn/trunk/mavenrepo - - - mvn2 - http://repo1.maven.org/maven2/ - - true - - - true - - - - - egovframe - http://www.egovframe.go.kr/maven/ + central + https://repo.maven.apache.org/maven2/ true @@ -54,9 +39,56 @@ - oracle - ORACLE JDBC Repository - http://mesir.googlecode.com/svn/trunk/mavenrepo + eclipse-oxygen-releases + Eclipse Oxygen Releases + https://repo.eclipse.org/content/repositories/oxygen-releases/ + + true + + + false + + + + eclipse-neon-releases + Eclipse Neon Releases + https://repo.eclipse.org/content/repositories/neon-releases/ + + true + + + false + + + + + osgeo + OSGeo Release Repository + https://repo.osgeo.org/repository/release/ + false + true + + + + jaspersoft-repo + https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/ + + true + + + false + + + + + egovframe + http://www.egovframe.go.kr/maven/ + + true + + + false + @@ -442,7 +474,6 @@ 1.1.1 - com.lowagie itext @@ -454,7 +485,136 @@ jjwt 0.9.1 - + + +     org.geotools +     gt-main +     11.0 + + +     org.geotools +     gt-opengis +     11.0 + + +     org.geotools +     gt-referencing +     11.0 + + +     org.geotools +     gt-epsg-hsql + 11.0 + + +     org.geotools +     gt-cql + 11.0 + + +     org.geotools +     gt-data +     11.0 + + +     org.geotools +     gt-api +     11.0 + + +     org.geotools +     gt-metadata +     11.0 + + +     org.geotools +     gt-xml + 11.0 + + +     org.geotools +     gt-swing + 11.0 + + +     org.geotools +     gt-render + 11.0 + + + org.geotools + gt-shapefile + 11.0 + + + org.geotools.xsd + gt-xsd-sld + 11.0 + + + org.geotools + gt-geojson + 11.0 + + + org.geotools + gt-process + 11.0 + + + org.geotools + gt-jdbc + 11.0 + + + org.geotools.jdbc + gt-jdbc-postgis 11.0 + + + org.geotools.jdbc + gt-jdbc-oracle 11.0 + + + org.geotools.jdbc + gt-jdbc-h2 11.0 + + + org.geotools.jdbc + gt-jdbc-mysql 11.0 + + + org.geotools.jdbc + gt-jdbc-db2 11.0 + + + org.geotools.jdbc + gt-jdbc-sqlserver 11.0 + + + com.vividsolutions + jts + 1.13 + + + + + org.eclipse.emf + org.eclipse.emf.ecore + 2.9.1-v20130827-0309 + + diff --git a/src/main/java/geoinfo/drilling/home/DrillingHomeController.java b/src/main/java/geoinfo/drilling/home/DrillingHomeController.java index 56b910d8..3b5a6603 100644 --- a/src/main/java/geoinfo/drilling/home/DrillingHomeController.java +++ b/src/main/java/geoinfo/drilling/home/DrillingHomeController.java @@ -1,64 +1,33 @@ package geoinfo.drilling.home; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import java.util.Enumeration; import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.jfree.util.Log; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import egovframework.rte.psl.dataaccess.util.EgovMap; import geoinfo.com.WebConfirm; import geoinfo.drilling.home.service.DrillingHomeService; -import geoinfo.drilling.input.service.DrillingInputService; import geoinfo.drilling.inquiry.service.DrillingInquiryService; import geoinfo.main.login.service.LoginService; import geoinfo.main.notice.service.NoticeService; -import geoinfo.map.mapControl.service.MapControlService; -import geoinfo.regi.selectClassInfo.service.SelectClassService; -import geoinfo.regi.status.service.RegiPageService; -import geoinfo.regi.util.exportGeotechnicalPointShp2; -import geoinfo.util.MobileCertificationUtil; import geoinfo.util.MyUtil; -import ictway.comm.util.parseData; -import ictway.comm.util.strUtil; -import ictway.comm.web.WebUtil; -import ictway.whois.whoisSMS; @Controller public class DrillingHomeController { diff --git a/src/main/java/geoinfo/drilling/home/service/DrillingHomeMapper.java b/src/main/java/geoinfo/drilling/home/service/DrillingHomeMapper.java index 42b33adf..ef816630 100644 --- a/src/main/java/geoinfo/drilling/home/service/DrillingHomeMapper.java +++ b/src/main/java/geoinfo/drilling/home/service/DrillingHomeMapper.java @@ -11,6 +11,7 @@ import egovframework.rte.psl.dataaccess.util.EgovMap; public interface DrillingHomeMapper { List drillingMapSearchHole(String comCode); List drillingMapSearchHoleWithMbr(HashMap params); + String projectCodesByProjectMasterCompanyCodeAsComma(HashMap params); } diff --git a/src/main/java/geoinfo/drilling/home/service/DrillingHomeService.java b/src/main/java/geoinfo/drilling/home/service/DrillingHomeService.java index 3711b073..b3c9e75d 100644 --- a/src/main/java/geoinfo/drilling/home/service/DrillingHomeService.java +++ b/src/main/java/geoinfo/drilling/home/service/DrillingHomeService.java @@ -9,4 +9,6 @@ import egovframework.rte.psl.dataaccess.util.EgovMap; public interface DrillingHomeService { public List drillingMapSearchHole(String projectCode); public List drillingMapSearchHoleWithMbr(HashMap params); + + public String projectCodesByProjectMasterCompanyCodeAsComma(HashMap params); } diff --git a/src/main/java/geoinfo/drilling/home/service/impl/DrillingHomeServiceImpl.java b/src/main/java/geoinfo/drilling/home/service/impl/DrillingHomeServiceImpl.java index 158f6f40..3110aaf1 100644 --- a/src/main/java/geoinfo/drilling/home/service/impl/DrillingHomeServiceImpl.java +++ b/src/main/java/geoinfo/drilling/home/service/impl/DrillingHomeServiceImpl.java @@ -42,6 +42,11 @@ public class DrillingHomeServiceImpl implements DrillingHomeService { public List drillingMapSearchHoleWithMbr(HashMap params) { return drillingHomeMapper.drillingMapSearchHoleWithMbr(params); } + + @Override + public String projectCodesByProjectMasterCompanyCodeAsComma(HashMap params) { + return drillingHomeMapper.projectCodesByProjectMasterCompanyCodeAsComma(params); + } } diff --git a/src/main/java/geoinfo/main/login/LoginController.java b/src/main/java/geoinfo/main/login/LoginController.java index 09daf0fa..0dda691a 100644 --- a/src/main/java/geoinfo/main/login/LoginController.java +++ b/src/main/java/geoinfo/main/login/LoginController.java @@ -2877,5 +2877,29 @@ public class LoginController { } return mv; } + + + // 패스워드 생성용 - 발주기관 계정 생성시 사용함. + @RequestMapping(value = "/makePassword.do", method = RequestMethod.GET) + public String drillingMapSearchHoleWithMbr(HttpServletRequest request, String companyCode, ModelMap model, @RequestParam("userId") String userId, @RequestParam("newPass") String newPass) throws Exception { + + MessageDigest md = MessageDigest.getInstance("SHA-256"); + md.reset(); + md.update(userId.getBytes()); + md.update(userId.getBytes()); + md.update(newPass.getBytes()); + md.update(userId.getBytes()); + md.update(userId.getBytes()); + + byte[] digest = md.digest(); + String shaHex = ""; + shaHex = DatatypeConverter.printHexBinary(digest); + newPass = GeoinfoCommon.parseData(newPass); + newPass = ScriptUtil.getSha256(newPass, "UTF-8").substring(0, 20); + + model.put("data", newPass); + + return "jsonView"; + } } \ No newline at end of file diff --git a/src/main/java/geoinfo/map/left/MapLeftController.java b/src/main/java/geoinfo/map/left/MapLeftController.java index 1825444e..6401e300 100644 --- a/src/main/java/geoinfo/map/left/MapLeftController.java +++ b/src/main/java/geoinfo/map/left/MapLeftController.java @@ -53,6 +53,7 @@ import geoinfo.com.GeoInfoSessionMgrListener; import geoinfo.com.GeoinfoCommon; import geoinfo.com.MultiLoginPreventor; import geoinfo.com.file.FileCmmn; +import geoinfo.drilling.home.service.DrillingHomeService; import geoinfo.main.login.service.LoginService; import geoinfo.map.left.service.MapLeftService; import geoinfo.map.mapControl.service.MapControlService; @@ -81,6 +82,11 @@ public class MapLeftController { @Resource(name = "headerService") private HeaderService headerService; + + + @Resource(name = "drillingHomeService") + private DrillingHomeService drillingHomeService; + private final static Logger logger = LoggerFactory.getLogger(GeoInfoSessionMgrListener.class); @@ -303,6 +309,21 @@ public class MapLeftController { String sidoSub = ""; String gugunSub = ""; String dongSub = ""; + + // 발주기관 프로젝트 코드만 조회 + String masterCompanyCode = null; + String masterCompanyProjectCodes = null; + if( params.get("masterCompanyCode") != null ) { + masterCompanyCode = GeoinfoCommon.parseData(params.get("masterCompanyCode").toString().trim()); + + HashMap paramsMasterCompanyCode = new HashMap(); + paramsMasterCompanyCode.put("COM_CODE", masterCompanyCode); + masterCompanyProjectCodes = drillingHomeService.projectCodesByProjectMasterCompanyCodeAsComma(paramsMasterCompanyCode); + + params.put("masterCompanyCode", masterCompanyCode); + params.put("masterCompanyProjectCodes", masterCompanyProjectCodes); + } + if (!(sido.equals("all"))) { sidoSub = sido.substring(0, 4); diff --git a/src/main/java/geoinfo/map/myMap/AVList.java b/src/main/java/geoinfo/map/myMap/AVList.java index 734c7a0c..c94d1c3d 100644 --- a/src/main/java/geoinfo/map/myMap/AVList.java +++ b/src/main/java/geoinfo/map/myMap/AVList.java @@ -54,8 +54,8 @@ public class AVList { throw new IllegalArgumentException("AVList :: AVList is NULL."); } - Set entries = list.getEntries(); - for (Map.Entry entry : entries) + Set> entries = list.getEntries(); + for (Entry entry : entries) { setValue((String)entry.getKey(), entry.getValue()); } diff --git a/src/main/java/geoinfo/map/myMap/AWTLabelUtil.java b/src/main/java/geoinfo/map/myMap/AWTLabelUtil.java index f0604002..de9a452c 100644 --- a/src/main/java/geoinfo/map/myMap/AWTLabelUtil.java +++ b/src/main/java/geoinfo/map/myMap/AWTLabelUtil.java @@ -1,5 +1,507 @@ package geoinfo.map.myMap; -public class AWTLabelUtil { +import java.awt.geom.AffineTransform; +import java.awt.geom.GeneralPath; +import java.awt.geom.Line2D; +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.util.Arrays; +import java.util.Vector; -} +public class AWTLabelUtil { + public static Point2D getLabelPositionMBR(LabelInfo labelInfo) { + Point2D mbrPoint = AWTLabelUtil.getCrossLineCenter(labelInfo.generalPath, new Point2D.Double(labelInfo.generalPath.getBounds().getCenterX(), labelInfo.generalPath.getBounds().getCenterY())); + if (mbrPoint == null) { + return new Point2D.Double(labelInfo.polygon.getCentroid().getX(), labelInfo.polygon.getCentroid().getY()); + } + return mbrPoint; + } + + public static Point2D getLabelPosition(LabelInfo labelInfo, Point2D point) { + Point2D labelPoint = AWTLabelUtil.getCrossLineCenter(labelInfo.generalPath, new Point2D.Double(point.getX(), point.getY())); + if (labelPoint == null) { + return point; + } + return labelPoint; + } + + public static boolean isContainLabel(LabelInfo labelInfo, Point2D center, double rotation) { + AffineTransform transform = AWTLabelUtil.getPolygonAlignTextTransform(labelInfo, center, rotation); + Rectangle2D labelBound = labelInfo.labelPainter.getFullLabelBounds(); + Point2D.Double UL = new Point2D.Double(labelBound.getMinX(), labelBound.getMinY()); + Point2D.Double UR = new Point2D.Double(labelBound.getMaxX(), labelBound.getMinY()); + Point2D.Double LL = new Point2D.Double(labelBound.getMinX(), labelBound.getMaxY()); + Point2D.Double LR = new Point2D.Double(labelBound.getMaxX(), labelBound.getMaxY()); + transform.transform(UL, UL); + transform.transform(UR, UR); + transform.transform(LL, LL); + transform.transform(LR, LR); + if (!labelInfo.generalPath.contains(UL)) { + return false; + } + if (!labelInfo.generalPath.contains(UR)) { + return false; + } + if (!labelInfo.generalPath.contains(LL)) { + return false; + } + return labelInfo.generalPath.contains(LR); + } + + public static boolean isContainLabel(LabelInfo labelInfo, AffineTransform transform) { + Rectangle2D labelBound = labelInfo.labelPainter.getFullLabelBounds(); + Point2D.Double UL = new Point2D.Double(labelBound.getMinX(), labelBound.getMinY()); + Point2D.Double UR = new Point2D.Double(labelBound.getMaxX(), labelBound.getMinY()); + Point2D.Double LL = new Point2D.Double(labelBound.getMinX(), labelBound.getMaxY()); + Point2D.Double LR = new Point2D.Double(labelBound.getMaxX(), labelBound.getMaxY()); + transform.transform(UL, UL); + transform.transform(UR, UR); + transform.transform(LL, LL); + transform.transform(LR, LR); + if (!labelInfo.generalPath.contains(UL)) { + return false; + } + if (!labelInfo.generalPath.contains(UR)) { + return false; + } + if (!labelInfo.generalPath.contains(LL)) { + return false; + } + return labelInfo.generalPath.contains(LR); + } + + public static boolean refineLabelPositionQuadrant(LabelInfo labelInfo, double rotation) { + double rectX = labelInfo.generalPath.getBounds2D().getX(); + double rectY = labelInfo.generalPath.getBounds2D().getY(); + double width = labelInfo.generalPath.getBounds2D().getWidth() / 4.0; + double height = labelInfo.generalPath.getBounds2D().getHeight() / 4.0; + Point2D[] rePoints = new Point2D[]{new Point2D.Double(rectX + width, rectY + height), new Point2D.Double(rectX + width * 3.0, rectY + height), new Point2D.Double(rectX + width, rectY + height * 3.0), new Point2D.Double(rectX + width * 3.0, rectY + height * 3.0)}; + int i = 0; + while (i < 4) { + rePoints[i] = AWTLabelUtil.getLabelPosition(labelInfo, rePoints[i]); + if (AWTLabelUtil.isContainLabel(labelInfo, rePoints[i], rotation)) { + labelInfo.center = rePoints[i]; + return true; + } + ++i; + } + return false; + } + + public static AffineTransform getPolygonAlignTextTransform(LabelInfo labelInfo, Point2D center, double rotation) { + AffineTransform transform = new AffineTransform(); + transform.translate(center.getX(), center.getY()); + if (Double.isNaN(rotation) || Double.isInfinite(rotation)) { + rotation = 0.0; + } + transform.rotate(rotation); + Rectangle2D textBounds = labelInfo.labelPainter.getLabelBounds(); + double displacementX = labelInfo.anchorX * -textBounds.getWidth() + labelInfo.displacementX; + double displacementY = labelInfo.anchorY * textBounds.getHeight() - labelInfo.displacementY - textBounds.getHeight() + labelInfo.labelPainter.getLineHeight(); + transform.translate(displacementX, displacementY); + return transform; + } + + public static void setLabelRotationORTHO(LabelInfo labelInfo) { + Vector hPoints = AWTLabelUtil.getIntersectPoints(labelInfo.generalPath, labelInfo.center, 0.0); + Vector vPoints = AWTLabelUtil.getIntersectPoints(labelInfo.generalPath, labelInfo.center, 1.5707963267948966); + Line2D hLine = AWTLabelUtil.getIntersectLineH(hPoints, labelInfo.center); + Line2D vLine = AWTLabelUtil.getIntersectLineV(vPoints, labelInfo.center); + if (hLine.getBounds().getWidth() > vLine.getBounds().getHeight()) { + labelInfo.rCenter = labelInfo.center; + labelInfo.rotation = 0.0; + } else { + labelInfo.rCenter = new Point2D.Double(vLine.getX1(), (vLine.getY1() + vLine.getY2()) / 2.0); + labelInfo.rotation = -1.5707963267948966; + } + } + + public static void setLabelRotationMBR(LabelInfo labelInfo) { + labelInfo.rotation = Math.toRadians(AWTLabelUtil.calcMainAngle(labelInfo.generalPath)); + KLISLabelUtil pUtil = new KLISLabelUtil(labelInfo.polygon); + if (pUtil.isConvex()) { + labelInfo.rCenter = AWTLabelUtil.getConvexCenter(labelInfo.generalPath, labelInfo.center, labelInfo.rotation); + } else { + Point2D rCenter = pUtil.GetMIC_ex(); + if (rCenter == null) { + labelInfo.rCenter = AWTLabelUtil.getOptimalCenter(labelInfo.generalPath, labelInfo.center); + } else if (pUtil.hasParabola() == 0) { + labelInfo.rCenter = AWTLabelUtil.getConvexCenter(labelInfo.generalPath, labelInfo.center, labelInfo.rotation); + } else { + Vector points = AWTLabelUtil.getIntersectPoints(labelInfo.generalPath, labelInfo.center, labelInfo.rotation); + double dist = Point2D.distance(points.get(0).getX(), points.get(0).getY(), points.get(1).getX(), points.get(1).getY()); + if (pUtil.getMaxRadius() * 10.0 < dist && pUtil.getMaxRadius() > labelInfo.labelPainter.getFullLabelBounds().getHeight() * 5.0) { + labelInfo.rCenter = AWTLabelUtil.getOptimalCenter(labelInfo.generalPath, labelInfo.center); + } else { + Vector rpoints = AWTLabelUtil.getIntersectPoints(labelInfo.generalPath, labelInfo.center, labelInfo.rotation + 1.5707963267948966); + Vector rpoints_v = AWTLabelUtil.getIntersectPoints(labelInfo.generalPath, rCenter, labelInfo.rotation + 1.5707963267948966); + Vector rpoints_h = AWTLabelUtil.getIntersectPoints(labelInfo.generalPath, rCenter, labelInfo.rotation); + if (rpoints_v.size() == 2 && rpoints.size() == 2 && rpoints_h.size() == 2) { + double diff; + double dist0 = Point2D.distance(rpoints.get(0).getX(), rpoints.get(0).getY(), rpoints.get(1).getX(), rpoints.get(1).getY()); + double dist_v = Point2D.distance(rpoints_v.get(0).getX(), rpoints_v.get(0).getY(), rpoints_v.get(1).getX(), rpoints_v.get(1).getY()); + double dist_h = Point2D.distance(rpoints_h.get(0).getX(), rpoints_h.get(0).getY(), rpoints_h.get(1).getX(), rpoints_h.get(1).getY()); + double d = diff = dist0 >= dist_v ? dist_v / dist0 : dist0 / dist_v; + if (diff > 0.8 && dist_v * 5.0 < dist_h && pUtil.edgeDiffCounts() % 2 != 1) { + rCenter = AWTLabelUtil.getConvexCenter(labelInfo.generalPath, labelInfo.center, labelInfo.rotation); + } + } + labelInfo.rCenter = rCenter; + } + } + } + } + + private static Point2D getConvexCenter(GeneralPath generalPath, Point2D center, double rotation) { + Vector points = AWTLabelUtil.getIntersectPoints(generalPath, center, rotation); + Line2D line = AWTLabelUtil.getIntersectLineHV(points, center); + if (line == null) { + return center; + } + return new Point2D.Double((line.getX1() + line.getX2()) / 2.0, (line.getY1() + line.getY2()) / 2.0); + } + + private static Point2D getOptimalCenter(GeneralPath generalPath, Point2D center) { + double dist; + Point2D endPt; + Point2D startPt; + Vector points; + double angle; + Point2D.Double rCenter = new Point2D.Double(center.getX(), center.getY()); + Point2D initStartPt = null; + Point2D initEndPt = null; + double maxDist = 0.0; + int i = -5; + while (i < 7) { + angle = Math.PI * (double)i / 12.0; + points = AWTLabelUtil.getIntersectPoints(generalPath, rCenter, angle); + int j = 0; + while (j < points.size() - 1) { + startPt = points.get(j); + endPt = points.get(j + 1); + if (!(startPt.getX() < ((Point2D)rCenter).getX() && ((Point2D)rCenter).getX() > endPt.getX() || startPt.getY() > ((Point2D)rCenter).getY() && ((Point2D)rCenter).getY() < endPt.getY() || !((dist = Point2D.distance(startPt.getX(), startPt.getY(), endPt.getX(), endPt.getY())) >= maxDist))) { + maxDist = dist; + if (initStartPt == null || initEndPt == null) { + initStartPt = new Point2D.Double(startPt.getX(), startPt.getY()); + initEndPt = new Point2D.Double(endPt.getX(), endPt.getY()); + } else { + initStartPt.setLocation(startPt); + initEndPt.setLocation(endPt); + } + } + ++j; + } + if (initStartPt == null || initEndPt == null) { + return center; + } + ((Point2D)rCenter).setLocation((initStartPt.getX() + initEndPt.getX()) / 2.0, (initStartPt.getY() + initEndPt.getY()) / 2.0); + ++i; + ++i; + } + angle = AWTLabelUtil.calcMainAngle(generalPath); + points = AWTLabelUtil.getIntersectPoints(generalPath, rCenter, Math.toRadians(angle)); + double minDist = Double.MAX_VALUE; + int j = 0; + while (j < points.size() - 1) { + startPt = points.get(j); + endPt = points.get(j + 1); + if (!(startPt.getX() < ((Point2D)rCenter).getX() && ((Point2D)rCenter).getX() > endPt.getX() || startPt.getY() > ((Point2D)rCenter).getY() && ((Point2D)rCenter).getY() < endPt.getY() || !((dist = Point2D.distance(startPt.getX(), startPt.getY(), endPt.getX(), endPt.getY())) < minDist))) { + minDist = dist; + initStartPt = new Point2D.Double(startPt.getX(), startPt.getY()); + initEndPt = new Point2D.Double(endPt.getX(), endPt.getY()); + } + ++j; + } + double d = generalPath.getBounds2D().getHeight() > generalPath.getBounds2D().getWidth() ? generalPath.getBounds2D().getHeight() : generalPath.getBounds2D().getWidth(); + if (maxDist * 10.0 < d) { + return center; + } + return new Point2D.Double((initStartPt.getX() + initEndPt.getX()) / 2.0, (initStartPt.getY() + initEndPt.getY()) / 2.0); + } + + private static Line2D getIntersectLineHV(Vector points, Point2D point) { + if (points.size() < 2) { + return null; + } + Line2D.Double maxLine = null; + double maxDist = 0.0; + int i = 0; + while (i < points.size() - 1) { + Point2D sp1 = points.get(i); + Point2D sp2 = points.get(i + 1); + if (Math.min(sp1.getX(), sp2.getX()) <= point.getX() && point.getX() <= Math.max(sp1.getX(), sp2.getX()) && Math.min(sp1.getY(), sp2.getY()) <= point.getY() && point.getY() <= Math.max(sp1.getY(), sp2.getY())) { + return new Line2D.Double(sp1, sp2); + } + double currentDist = sp1.distance(sp2); + if (maxDist < currentDist) { + maxDist = currentDist; + maxLine = new Line2D.Double(sp1, sp2); + } + ++i; + } + return null; + } + + private static double calcMainAngle(GeneralPath path) { + double[] lineLength = AWTLabelUtil.calcAngleFactor(path); + int maxIndex = 0; + double maxLength = lineLength[0]; + int i = 1; + while (i < lineLength.length) { + if (maxLength < lineLength[i]) { + maxIndex = i; + maxLength = lineLength[i]; + } + ++i; + } + int angle = maxIndex * 10; + if (angle > 90) { + return angle - 180; + } + return angle; + } + + private static double[] calcAngleFactor(GeneralPath path) { + double[] lineLength = new double[18]; + double[] startCoords = new double[6]; + double[] currentCoords = new double[6]; + int type = -1; + double subAngle = 0.0; + PathIterator pathIter = path.getPathIterator(new AffineTransform()); + while (!pathIter.isDone()) { + type = pathIter.currentSegment(currentCoords); + if (type != 0 && type == 1 && startCoords[0] != currentCoords[0] && startCoords[1] != currentCoords[1]) { + subAngle = AWTLabelUtil.getAbsoluteAngle(startCoords[0], startCoords[1], currentCoords[0], currentCoords[1]); + int index = (int)(subAngle >= 175.0 ? 0.0 : (subAngle + 5.0) / 10.0); + double dist = Point2D.distance(startCoords[0], startCoords[1], currentCoords[0], currentCoords[1]); + lineLength[index] = lineLength[index] + dist; + } + startCoords = Arrays.copyOf(currentCoords, currentCoords.length); + pathIter.next(); + } + return lineLength; + } + + private static Point2D getCrossLineCenter(GeneralPath path, Point2D point) { + Vector hPoints = AWTLabelUtil.getIntersectPoints(path, point, 0.0); + Vector vPoints = AWTLabelUtil.getIntersectPoints(path, point, 1.5707963267948966); + Vector hLines = AWTLabelUtil.getContainLines(path, hPoints); + Vector vLines = AWTLabelUtil.getContainLines(path, vPoints); + double maxHDist = 0.0; + Line2D maxHLine = null; + double dist = 0.0; + for (Line2D line : hLines) { + dist = Math.abs(line.getX1() - line.getX2()); + if (!(maxHDist < dist)) continue; + maxHDist = dist; + maxHLine = line; + } + double maxVDist = 0.0; + Line2D maxVLine = null; + for (Line2D line : vLines) { + point = new Point2D.Double(line.getX1(), (line.getY1() + line.getY2()) / 2.0); + hPoints = AWTLabelUtil.getIntersectPoints(path, point, 0.0); + if ((line = AWTLabelUtil.getIntersectLineH(hPoints, point)) == null || !(maxVDist < (dist = Math.abs(line.getX1() - line.getX2())))) continue; + maxVDist = dist; + maxVLine = line; + } + if (maxHLine == null && maxVLine == null) { + return null; + } + if (maxHLine == null) { + return AWTLabelUtil.refineLineCenterV(path, maxVLine); + } + if (maxVLine == null) { + return AWTLabelUtil.refineLineCenterH(path, maxHLine); + } + if (maxHDist > maxVDist) { + return AWTLabelUtil.refineLineCenterH(path, maxHLine); + } + return AWTLabelUtil.refineLineCenterV(path, maxVLine); + } + + private static Point2D refineLineCenterV(GeneralPath path, Line2D line) { + return new Point2D.Double((line.getX1() + line.getX2()) / 2.0, line.getY1()); + } + + private static Point2D refineLineCenterH(GeneralPath path, Line2D line) { + Point2D.Double center = new Point2D.Double((line.getX1() + line.getX2()) / 2.0, line.getY1()); + Vector vPoints = AWTLabelUtil.getIntersectPoints(path, center, 1.5707963267948966); + Line2D vLine = AWTLabelUtil.getIntersectLineV(vPoints, center); + if (vLine == null) { + return center; + } + return new Point2D.Double(vLine.getX1(), (vLine.getY1() + vLine.getY2()) / 2.0); + } + + private static Line2D getIntersectLineH(Vector points, Point2D point) { + if (points.size() < 2) { + return null; + } + int i = 0; + while (i < points.size() - 1) { + Point2D sp1 = points.get(i); + Point2D sp2 = points.get(i + 1); + if (Math.min(sp1.getX(), sp2.getX()) <= point.getX() && point.getX() <= Math.max(sp1.getX(), sp2.getX())) { + return new Line2D.Double(sp1, sp2); + } + ++i; + } + return null; + } + + private static Line2D getIntersectLineV(Vector points, Point2D point) { + if (points.size() < 2) { + return null; + } + int i = 0; + while (i < points.size() - 1) { + Point2D sp1 = points.get(i); + Point2D sp2 = points.get(i + 1); + if (Math.min(sp1.getY(), sp2.getY()) <= point.getY() && point.getY() <= Math.max(sp1.getY(), sp2.getY())) { + return new Line2D.Double(sp1, sp2); + } + ++i; + } + return null; + } + + private static Vector getContainLines(GeneralPath path, Vector points) { + if (points.size() < 2) { + return new Vector(); + } + Vector lines = new Vector(); + int i = 0; + while (i < points.size() - 1) { + double cy; + double cx; + Point2D sp1 = points.get(i); + Point2D sp2 = points.get(i + 1); + if (sp1.getX() == sp2.getX()) { + cx = sp1.getX(); + cy = (sp1.getY() + sp2.getY()) / 2.0; + } else { + cx = (sp1.getX() + sp2.getX()) / 2.0; + cy = sp1.getY(); + } + if (path.contains(cx, cy)) { + lines.add(new Line2D.Double(sp1, sp2)); + } + ++i; + } + return lines; + } + + private static Vector getIntersectPoints(GeneralPath path, Point2D point, double angle) { + Vector holder = new Vector(); + Line2D baseLine = AWTLabelUtil.getBoundCuttingLine(path.getBounds2D(), point, angle); + double a1 = Math.tan(angle); + double b1 = point.getY() - a1 * point.getX(); + double[] startCoords = new double[6]; + double[] currentCoords = new double[6]; + int type = -1; + double subAngle = 0.0; + PathIterator pathIter = path.getPathIterator(new AffineTransform()); + while (!pathIter.isDone()) { + type = pathIter.currentSegment(currentCoords); + if (type != 0 && type == 1 && startCoords[0] != currentCoords[0] && startCoords[1] != currentCoords[1] && angle != (subAngle = AWTLabelUtil.getAngle(startCoords[0], startCoords[1], currentCoords[0], currentCoords[1])) && baseLine.intersectsLine(startCoords[0], startCoords[1], currentCoords[0], currentCoords[1])) { + double y; + double x; + double a2 = Math.tan(subAngle); + double b2 = currentCoords[1] - a2 * currentCoords[0]; + if (angle == 1.5707963267948966) { + x = point.getX(); + y = a2 * x + b2; + } else if (subAngle == 1.5707963267948966) { + x = currentCoords[0]; + y = a1 * x + b1; + } else { + x = (b2 - b1) / (a1 - a2); + y = (a1 * b2 - a2 * b1) / (a1 - a2); + } + AWTLabelUtil.addPointBySort(holder, new Point2D.Double(x, y)); + } + startCoords = Arrays.copyOf(currentCoords, currentCoords.length); + pathIter.next(); + } + return holder; + } + + private static void addPointBySort(Vector holder, Point2D point) { + boolean inserted = false; + int i = 0; + while (i < holder.size()) { + Point2D current_point = holder.get(i); + if (point.getX() < current_point.getX()) { + holder.add(i, point); + inserted = true; + break; + } + if (point.getX() == current_point.getX() && point.getY() < current_point.getY()) { + holder.add(i, point); + inserted = true; + break; + } + ++i; + } + if (!inserted) { + holder.add(point); + } + } + + private static Line2D getBoundCuttingLine(Rectangle2D bound, Point2D point, double angle) { + double minx = bound.getMinX() - 10.0; + double miny = bound.getMinY() - 10.0; + double maxx = bound.getMaxX() + 10.0; + double maxy = bound.getMaxY() + 10.0; + Line2D.Double line = angle == 1.5707963267948966 ? new Line2D.Double(point.getX(), miny, point.getX(), maxy) : (angle == 0.0 ? new Line2D.Double(minx, point.getY(), maxx, point.getY()) : new Line2D.Double(minx, point.getY() - (point.getX() - minx) * Math.tan(angle), maxx, point.getY() + (maxx - point.getX()) * Math.tan(angle))); + return line; + } + + private static double getAngle(double x1, double y1, double x2, double y2) { + Point2D.Double pt = new Point2D.Double(x2 - x1, y2 - y1); + if (((Point2D)pt).getX() == 0.0 && ((Point2D)pt).getY() == 0.0) { + return 0.0; + } + if (((Point2D)pt).getY() == 0.0) { + if (((Point2D)pt).getX() > 0.0) { + return 0.0; + } + return Math.PI; + } + if (((Point2D)pt).getX() == 0.0) { + if (((Point2D)pt).getY() > 0.0) { + return 1.5707963267948966; + } + return 4.71238898038469; + } + if (((Point2D)pt).getX() > 0.0) { + if (((Point2D)pt).getY() > 0.0) { + return Math.atan(((Point2D)pt).getY() / ((Point2D)pt).getX()); + } + return Math.atan(((Point2D)pt).getY() / ((Point2D)pt).getX()) + Math.PI * 2; + } + return Math.atan(((Point2D)pt).getY() / ((Point2D)pt).getX()) + Math.PI; + } + + private static double getAbsoluteAngle(double x1, double y1, double x2, double y2) { + if (y1 == y2) { + return 0.0; + } + if (x1 == x2) { + return 90.0; + } + boolean excessRightAngle = false; + if (x1 > x2 && y1 < y2 || x1 < x2 && y1 > y2) { + excessRightAngle = true; + } + double base = Math.abs(x1 - x2); + double height = Math.abs(y1 - y2); + double r_angle = Math.atan(height / base); + if (excessRightAngle) { + return Math.toDegrees(Math.PI - r_angle); + } + return Math.toDegrees(r_angle); + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/AbstractService.java b/src/main/java/geoinfo/map/myMap/AbstractService.java new file mode 100644 index 00000000..74953258 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/AbstractService.java @@ -0,0 +1,30 @@ +package geoinfo.map.myMap; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class AbstractService +extends HttpServlet { + private static final long serialVersionUID = 2014061020172321L; + + public abstract Object parseQuery(HttpServletRequest var1) throws Exception; + + public abstract String doProcess(String var1); + + public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { + super.service(arg0, arg1); + } + + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + super.doGet(req, resp); + } + + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + super.doPost(req, resp); + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/CRSMngr.java b/src/main/java/geoinfo/map/myMap/CRSMngr.java index 90d61e22..55406e41 100644 --- a/src/main/java/geoinfo/map/myMap/CRSMngr.java +++ b/src/main/java/geoinfo/map/myMap/CRSMngr.java @@ -1,6 +1,5 @@ package geoinfo.map.myMap; -import java.util.ArrayList; import java.util.Iterator; import org.geotools.factory.GeoTools; import org.geotools.factory.Hints; @@ -10,40 +9,297 @@ import org.geotools.util.NameFactory; import org.opengis.referencing.NoSuchAuthorityCodeException; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.util.GenericName; -import org.opengis.util.NameSpace; -public class CRSMngr { - private static final O2CRSFactory crsFactory = new O2CRSFactory(); - - public static CoordinateReferenceSystem getLayerCRS(int srid, boolean useEPSG) - throws Exception - { - CoordinateReferenceSystem crs = null; - try - { - crs = crsFactory.getCRS(srid); +public class CRSMngr +{ + private static final O2CRSFactory crsFactory = new O2CRSFactory(); + private static final O2CRSOverrideFactory overrideFactory = new O2CRSOverrideFactory(); - return overrideFactory.createCoordinateReferenceSystem(CRS.toSRS(crs)); - } - catch (Exception e) - { - if (crs != null) { - return crs; - } + static + { + System.setProperty("org.geotools.referencing.forceXY", "true"); + Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.valueOf(true)); + GeoTools.fireConfigurationChanged(); - LogMngr.getInstance().logError("[CRS]", "SRID [" + srid + "] is not exist."); + ReferencingFactoryFinder.addAuthorityFactory(crsFactory); + ReferencingFactoryFinder.addAuthorityFactory(overrideFactory); + } - if (useEPSG) { - try - { - LogMngr.getInstance().logInfo("[CRS]", "Try to find SRID from EPSG [EPSG:" + srid + "]"); - return CRS.decode("EPSG:" + srid, true); - } catch (Exception e2) { - LogMngr.getInstance().logError("[CRS]", "SRID [EPSG:" + srid + "] is not exist."); - } - } - } + public static CoordinateReferenceSystem getCRS(Integer code) + { + return getCRS(String.valueOf(code), true); + } - throw new NoSuchAuthorityCodeException("Not exists authority or code", "LayerCRS", String.valueOf(srid)); - } -} + public static CoordinateReferenceSystem getCRS(String code) { + return getCRS(code, true); + } + + public static CoordinateReferenceSystem getCRS(String code, boolean useEPSG) + { + try { + code = code.trim(); + + GenericName name = NameFactory.create(code); + if ((name.scope().name() == null) && (useEPSG)) { + code = "EPSG:" + code; + } + + return CRS.decode(code, true); + } catch (Exception e) { + LogMngr.getInstance().logError("[CRS]", "CRS [" + code + "] is not exist."); + }return null; + } + + public static CoordinateReferenceSystem getLayerCRS(int srid, boolean useEPSG) + throws Exception + { + CoordinateReferenceSystem crs = null; + try + { + crs = crsFactory.getCRS(srid); + + return overrideFactory.createCoordinateReferenceSystem(CRS.toSRS(crs)); + } + catch (Exception e) + { + if (crs != null) { + return crs; + } + + LogMngr.getInstance().logError("[CRS]", "SRID [" + srid + "] is not exist."); + + if (useEPSG) { + try + { + LogMngr.getInstance().logInfo("[CRS]", "Try to find SRID from EPSG [EPSG:" + srid + "]"); + return CRS.decode("EPSG:" + srid, true); + } catch (Exception e2) { + LogMngr.getInstance().logError("[CRS]", "SRID [EPSG:" + srid + "] is not exist."); + } + } + } + + throw new NoSuchAuthorityCodeException("Not exists authority or code", "LayerCRS", String.valueOf(srid)); + } + + private static void updateLayerCRS() + throws Exception + { + Map map = ServerContext.getMap(); + synchronized (map) + { + Iterator iter = map.getAllLayers().iterator(); + while (iter.hasNext()) { + Layer layer = (Layer)iter.next(); + layer.updateCRS(); + } + } + } + + private static void updateLayerCRS(CoordinateReferenceSystem targetCRS) + throws Exception + { + Map map = ServerContext.getMap(); + synchronized (map) + { + Iterator iter = map.getAllLayers().iterator(); + while (iter.hasNext()) { + Layer layer = (Layer)iter.next(); + + if (CRS.toSRS(layer.getCRS()).equalsIgnoreCase(CRS.toSRS(targetCRS))) + layer.updateCRS(); + } + } + } + + private static void updateLayerCRS(String code) + throws Exception + { + Map map = ServerContext.getMap(); + synchronized (map) + { + Iterator iter = map.getAllLayers().iterator(); + while (iter.hasNext()) { + Layer layer = (Layer)iter.next(); + + if (CRS.toSRS(layer.getCRS()).equalsIgnoreCase(code)) + layer.updateCRS(); + } + } + } + + public static void insertBasicCRS(int srid, String auth, String code, String wkt) + throws Exception + { + insertBasicCRS(srid, auth, code, wkt, false); + } + + public static void insertBasicCRS(int srid, String auth, String code, String wkt, boolean write) + throws Exception + { + CoordinateReferenceSystem crs = null; + try { + crs = crsFactory.parseWKT(auth, code, wkt); + } catch (Exception e) { + throw new Exception("CoordinateReferenceSystem is not valid."); + } + + crsFactory.insertCRS(srid, auth, code, crs, write); + } + + public static void updateBasicCRS(int srid, String auth, String code, String wkt) throws Exception + { + updateBasicCRS(srid, auth, code, wkt, false); + } + + public static void updateBasicCRS(int srid, String auth, String code, String wkt, boolean write) + throws Exception + { + CoordinateReferenceSystem crs = null; + try { + crs = crsFactory.parseWKT(auth, code, wkt); + } catch (Exception e) { + throw new IllegalArgumentException("CoordinateReferenceSystem is not valid."); + } + + crsFactory.updateCRS(srid, auth, code, crs, write); + + updateLayerCRS(crs); + } + + public static void removeBasicCRS(int srid) throws Exception + { + removeBasicCRS(srid, false); + } + + public static void removeBasicCRS(int srid, boolean write) + throws Exception + { + CoordinateReferenceSystem crs = crsFactory.getCRS(srid); + + if (isUsedByLayer(crs)) { + throw new IllegalArgumentException("SRID [" + srid + "] is used by Layer."); + } + + crsFactory.removeCRS(srid, write); + } + + public static void insertOverrideCRS(String auth, String code, String wkt) + throws Exception + { + insertOverrideCRS(auth, code, wkt, false); + } + + public static void insertOverrideCRS(String auth, String code, String wkt, boolean write) + throws Exception + { + CoordinateReferenceSystem crs = null; + try { + crs = overrideFactory.parseWKT(auth, code, wkt); + } catch (Exception e) { + throw new Exception("CoordinateReferenceSystem is not valid."); + } + + overrideFactory.insertCRS(auth, code, crs, write); + } + + public static void updateOverrideCRS(String auth, String code, String wkt) throws Exception + { + updateOverrideCRS(auth, code, wkt, false); + } + + public static void updateOverrideCRS(String auth, String code, String wkt, boolean write) + throws Exception + { + CoordinateReferenceSystem crs = null; + try { + crs = overrideFactory.parseWKT(auth, code, wkt); + } catch (Exception e) { + throw new IllegalArgumentException("CoordinateReferenceSystem is not valid."); + } + + overrideFactory.updateCRS(auth, code, crs, write); + + String crsKey = auth.trim().toUpperCase() + ":" + code.trim().toUpperCase(); + updateLayerCRS(crsKey); + } + + public static void removeOverrideCRS(String auth, String code) + throws Exception + { + removeOverrideCRS(auth, code, false); + } + + public static void removeOverrideCRS(String auth, String code, boolean write) + throws Exception + { + CoordinateReferenceSystem crs = overrideFactory.getCRS(auth, code); + String crsKey = auth.trim().toUpperCase() + ":" + code.trim().toUpperCase(); + + if (isUsedByLayer(crs)) { + throw new IllegalArgumentException("CODE [Authority:" + auth + "] or [Code:" + code + "] is used by Layer."); + } + + overrideFactory.removeCRS(auth, code, write); + + updateLayerCRS(crsKey); + } + + private static boolean isUsedByLayer(String code) + throws Exception + { + try + { + Iterator iter = ServerContext.getMap().getAllLayers().iterator(); + while (iter.hasNext()) { + Layer layer = (Layer)iter.next(); + + if (CRS.toSRS(layer.getCRS()).equalsIgnoreCase(code)) + return true; + } + } + catch (Exception e) + { + LogMngr.getInstance().logError("[CRS]", "isUsedByLayer Fail [CODE:" + code + "] :: " + e); + throw e; + } + + return false; + } + + private static boolean isUsedByLayer(CoordinateReferenceSystem targetCRS) throws Exception + { + try + { + Iterator iter = ServerContext.getMap().getAllLayers().iterator(); + while (iter.hasNext()) { + Layer layer = (Layer)iter.next(); + + if (CRS.equalsIgnoreMetadata(layer.getCRS(), targetCRS)) + return true; + } + } + catch (Exception e) + { + LogMngr.getInstance().logError("[CRS]", "isUsedByLayer Fail [CODE:" + targetCRS + "] :: " + e); + throw e; + } + + return false; + } + + public static void reloadServiceCRS(boolean updateLayer) throws Exception + { + crsFactory.initCrsDefinitions(); + LogMngr.getInstance().logInfo("[CRS]", "Success to Reload BasicCRS"); + overrideFactory.initCrsDefinitions(); + LogMngr.getInstance().logInfo("[CRS]", "Success to Reload OverrideCRS"); + + if (updateLayer) + try { + updateLayerCRS(); + } catch (Exception e) { + LogMngr.getInstance().logError("[CRS]", "Fail to Update Layer CRS :: " + e.getMessage()); + } + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/CacheFormat.java b/src/main/java/geoinfo/map/myMap/CacheFormat.java new file mode 100644 index 00000000..9beabaa5 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/CacheFormat.java @@ -0,0 +1,31 @@ +package geoinfo.map.myMap; + +public class CacheFormat { + int width = 256; + int height = 256; + String format = "png"; + + public int getWidth() { + return this.width; + } + + public int getHeight() { + return this.height; + } + + public String getFormat() { + return this.format; + } + + public void setWidth(int width) { + this.width = width; + } + + public void setHeight(int height) { + this.height = height; + } + + public void setFormat(String format) { + this.format = format; + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/CacheLevel.java b/src/main/java/geoinfo/map/myMap/CacheLevel.java new file mode 100644 index 00000000..261bf99e --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/CacheLevel.java @@ -0,0 +1,70 @@ +package geoinfo.map.myMap; + +import java.io.File; +import javax.management.modelmbean.XMLParseException; +import org.geotools.geometry.jts.ReferencedEnvelope; + +public class CacheLevel { + private CacheLevelSet levelSet; + private final int level; + private Double resolution; + private Double scaleDenominator; + + public CacheLevel(Integer lv, Double res, Double scale) throws Exception { + this.level = lv; + this.resolution = res; + this.scaleDenominator = scale; + if (this.resolution == null && this.scaleDenominator == null) { + throw new XMLParseException(" Attribute value [RESOLUTION or SCALE] is null. LEVEL [" + this.level + "]"); + } + } + + public int getLevel() { + return this.level; + } + + public Double getResolution() { + return this.resolution; + } + + public Double getScale() { + return this.scaleDenominator; + } + + public ReferencedEnvelope getBBox() { + return this.levelSet.getBBox(); + } + + public int getCacheSizeW() { + return this.levelSet.getCacheSizeW(); + } + + public int getCacheSizeH() { + return this.levelSet.getCacheSizeH(); + } + + public File getCachePath() { + return new File(this.levelSet.getCacheDir(), "/" + this.level); + } + + public String getCacheFormat() { + return this.levelSet.getCacheFormat(); + } + + public String getLayerName() { + return this.levelSet.getLayerName(); + } + + public String getLayerStyle() { + return this.levelSet.getLayerStyle(); + } + + public void refineCacheLevel(CacheLevelSet lSet) throws Exception { + this.levelSet = lSet; + if (this.resolution == null) { + this.resolution = lSet.calResolution(this.scaleDenominator); + } else if (this.scaleDenominator == null) { + this.scaleDenominator = lSet.calScaleDenominator(this.resolution); + } + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/CacheLevelSet.java b/src/main/java/geoinfo/map/myMap/CacheLevelSet.java new file mode 100644 index 00000000..80be97c1 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/CacheLevelSet.java @@ -0,0 +1,94 @@ +package geoinfo.map.myMap; + +import java.io.File; +import java.util.TreeMap; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.opengis.referencing.crs.GeographicCRS; + +public class CacheLevelSet { + private final double dpi = 90.7142857142857; + private final double OGC_DEGREE_TO_METER = 111319.49079327358; + private final double OGC_INCH_TO_METER = 0.0254; + private final boolean isTopLeft = false; + private ImgCacheLayer cacheLayer; + private TreeMap levelSet = new TreeMap(); + + public CacheLevelSet copy() throws Exception { + CacheLevelSet copy = new CacheLevelSet(); + for (CacheLevel lvl : this.levelSet.values()) { + CacheLevel level = new CacheLevel(Integer.valueOf(lvl.getLevel()), lvl.getResolution(), lvl.getScale()); + copy.addLevel(level); + } + return copy; + } + + public void addLevel(CacheLevel lvl) { + this.levelSet.put(lvl.getLevel(), lvl); + } + + public CacheLevel getLevel(double res) { + CacheLevel level = null; + for (CacheLevel lvl : this.levelSet.values()) { + if (level == null) { + level = lvl; + continue; + } + if (!(Math.abs(level.getResolution() - res) > Math.abs(lvl.getResolution() - res))) continue; + level = lvl; + } + return level; + } + + public ReferencedEnvelope getBBox() { + return this.cacheLayer.getBBox(); + } + + public int getCacheSizeW() { + return this.cacheLayer.getCacheSizeW(); + } + + public int getCacheSizeH() { + return this.cacheLayer.getCacheSizeH(); + } + + public File getCacheDir() { + return this.cacheLayer.getCacheDir(); + } + + public String getCacheFormat() { + return this.cacheLayer.getCacheFormat(); + } + + public String getLayerName() { + return this.cacheLayer.getLayerName(); + } + + public String getLayerStyle() { + return this.cacheLayer.getLayerStyle(); + } + + public boolean isTopLeft() { + return false; + } + + public double calScaleDenominator(double res) { + if (this.cacheLayer.getBBox().getCoordinateReferenceSystem() instanceof GeographicCRS) { + return res * 111319.49079327358 / 2.8000000000000003E-4; + } + return res / 2.8000000000000003E-4; + } + + public double calResolution(double scale) { + if (this.cacheLayer.getBBox().getCoordinateReferenceSystem() instanceof GeographicCRS) { + return scale * 2.8000000000000003E-4 * 8.983152841195214E-6; + } + return scale * 2.8000000000000003E-4; + } + + public void refindCacheLevelSet(ImgCacheLayer clayer) throws Exception { + this.cacheLayer = clayer; + for (CacheLevel level : this.levelSet.values()) { + level.refineCacheLevel(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/CategorizeBinding110.java b/src/main/java/geoinfo/map/myMap/CategorizeBinding110.java index d4dfcbca..436de768 100644 --- a/src/main/java/geoinfo/map/myMap/CategorizeBinding110.java +++ b/src/main/java/geoinfo/map/myMap/CategorizeBinding110.java @@ -1,7 +1,5 @@ package geoinfo.map.myMap; - - import java.awt.Color; import java.util.List; import javax.xml.namespace.QName; diff --git a/src/main/java/geoinfo/map/myMap/ConnJDBC.java b/src/main/java/geoinfo/map/myMap/ConnJDBC.java index 07ba8dd7..358229f4 100644 --- a/src/main/java/geoinfo/map/myMap/ConnJDBC.java +++ b/src/main/java/geoinfo/map/myMap/ConnJDBC.java @@ -1,5 +1,69 @@ package geoinfo.map.myMap; -public class ConnJDBC { +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.HashMap; -} +public abstract class ConnJDBC { + protected Connection connection = null; + + public ConnJDBC() { + DriverManager.setLoginTimeout(5); + } + + public Connection openConn() throws Exception { + if (this.connection != null) { + return this.connection; + } + HashMap map = ServerConfiguration.getInstance().getConfMap(); + String sURL = this.getJDBCUrl(); + String user = (String)map.get("conf.xml.map.user"); + String passwd = (String)map.get("conf.xml.map.passwd"); + try { + Class.forName(this.getDriverClassName()); + } + catch (Exception e) { + LogMngr.getInstance().logError("[DB]", "Can't register JDBC Driver :: " + e.getMessage()); + throw new Exception("Can't register JDBC Driver :: " + e.getMessage()); + } + try { + LogMngr.getInstance().logDebug("[DB]", "Open Connection :: " + sURL + ", " + user + ", " + passwd); + this.connection = DriverManager.getConnection(sURL, user, passwd); + } + catch (SQLException e) { + LogMngr.getInstance().logError("[DB]", "Open Connection Fail :: " + e.getMessage()); + throw new SQLException("Open Connection Fail :: " + e.getMessage()); + } + return this.connection; + } + + public void closeConn() { + if (this.connection != null) { + try { + if (!this.connection.isClosed()) { + this.connection.close(); + } + this.connection = null; + } + catch (SQLException e) { + this.connection = null; + LogMngr.getInstance().logError("[DB]", "Close Connection Fail :: " + e.getMessage()); + } + } + } + + public String getJDBCUrl() throws Exception { + HashMap map = ServerConfiguration.getInstance().getConfMap(); + String host = (String)map.get("conf.xml.map.host"); + String port = (String)map.get("conf.xml.map.port"); + String database = (String)map.get("conf.xml.map.database"); + return this.getJDBCUrl(host, Integer.valueOf(port), database); + } + + public abstract String getDriverClassName(); + + public abstract String getJDBCUrl(String var1, Integer var2, String var3); + + public abstract FieldSQL getFieldSQL(); +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/ConnMngr.java b/src/main/java/geoinfo/map/myMap/ConnMngr.java index 7f1ba99e..23a634b8 100644 --- a/src/main/java/geoinfo/map/myMap/ConnMngr.java +++ b/src/main/java/geoinfo/map/myMap/ConnMngr.java @@ -1,5 +1,87 @@ package geoinfo.map.myMap; -public class ConnMngr { +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; -} +public class ConnMngr +{ + private static ConnMngr instance = null; + private ConnJDBC connJDBC = null; + + public static ConnMngr getInstance() + { + if (instance == null) { + instance = new ConnMngr(); + } + return instance; + } + + public ConnJDBC getConnObj(String dbType) throws Exception + { + if ((dbType != null) && (dbType.toLowerCase().equals("oracle"))) + return new ConnOracle(); + + LogMngr.getInstance().logError("[DB]", "Database type [" + dbType + "] is not support."); + throw new NullPointerException("Database type [" + dbType + "] is not support."); + } + + public ConnJDBC getConnObj(O2DSFactory.DBMSType dbType) + throws Exception + { + if ((dbType != null) && (dbType == O2DSFactory.DBMSType.ORACLE)) + return new ConnOracle(); + LogMngr.getInstance().logError("[DB]", "Database type [" + dbType + "] is not support."); + throw new NullPointerException("Database type [" + dbType + "] is not support."); + } + + public Connection openConn() + throws Exception + { + HashMap map = ServerConfiguration.getInstance().getConfMap(); + + String dbType = (String)map.get("conf.xml.map.dbtype"); + dbType = dbType.trim(); + + if ((dbType != null) && (dbType.toLowerCase().equals("oracle"))) { + this.connJDBC = new ConnOracle(); + } else { + LogMngr.getInstance().logError("[DB]", "Database type [" + dbType + "] is not support."); + throw new NullPointerException("Database type [" + dbType + "] is not support."); + } + + return this.connJDBC.openConn(); + } + + public void closeConn() { + if (this.connJDBC != null) + this.connJDBC.closeConn(); + } + + public void closeSafe(Statement st) + { + if (st == null) { + return; + } + try + { + st.close(); + } catch (SQLException localSQLException) { + } + } + + public void closeSafe(ResultSet rs) { + if (rs == null) { + return; + } + try + { + rs.close(); + } + catch (SQLException localSQLException) + { + } + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/ConnOracle.java b/src/main/java/geoinfo/map/myMap/ConnOracle.java new file mode 100644 index 00000000..39f1c998 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ConnOracle.java @@ -0,0 +1,33 @@ +package geoinfo.map.myMap; + +import java.util.HashMap; + +public class ConnOracle extends ConnJDBC +{ + public String getDriverClassName() + { + return "oracle.jdbc.driver.OracleDriver"; + } + + public String getJDBCUrl(String host, Integer port, String database) + { + String sURL = "jdbc:oracle:thin:@"; + sURL = sURL + host + ":" + port + ":" + database; + + return sURL; + } + + public FieldSQL getFieldSQL() + { + HashMap fields = new HashMap(); + fields.put(FieldSQL.FieldType.GEOMETRY, "SDO_GEOMETRY"); + fields.put(FieldSQL.FieldType.CHARACTER, "VARCHAR2"); + fields.put(FieldSQL.FieldType.NUMERIC, "NUMBER"); + fields.put(FieldSQL.FieldType.BOOLEAN, "CHAR(1)"); + fields.put(FieldSQL.FieldType.DATE, "DATE"); + fields.put(FieldSQL.FieldType.BLOB, "BLOB"); + fields.put(FieldSQL.FieldType.UNKNOWN, "VARCHAR2(100)"); + + return new FieldSQL(O2DSFactory.DBMSType.ORACLE, fields, false); + } +} diff --git a/src/main/java/geoinfo/map/myMap/ContentDataStoreRefinder.java b/src/main/java/geoinfo/map/myMap/ContentDataStoreRefinder.java new file mode 100644 index 00000000..622ba802 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ContentDataStoreRefinder.java @@ -0,0 +1,238 @@ +package geoinfo.map.myMap; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; // Map.Entry 대신 HashMap 사용을 명시 +import java.util.Map; + +import org.geotools.data.Transaction; +import org.geotools.data.shapefile.ShapefileDataStore; +import org.geotools.data.simple.SimpleFeatureSource; +import org.geotools.data.store.ContentDataStore; +import org.geotools.data.store.ContentEntry; // ContentEntry는 여전히 사용될 수 있습니다. +import org.geotools.data.store.ContentFeatureSource; +import org.geotools.data.store.ContentState; +import org.geotools.feature.AttributeTypeBuilder; +import org.geotools.feature.simple.SimpleFeatureTypeBuilder; +import org.geotools.jdbc.AutoGeneratedPrimaryKeyColumn; +import org.geotools.jdbc.JDBCDataStore; // JDBCDataStore로 캐스팅하여 더 명확하게 사용 +import org.geotools.jdbc.JDBCState; // JDBCState는 여전히 사용될 수 있습니다. +import org.geotools.jdbc.NonIncrementingPrimaryKeyColumn; +import org.geotools.jdbc.NullPrimaryKey; +import org.geotools.jdbc.PrimaryKey; +import org.geotools.jdbc.PrimaryKeyColumn; +import org.geotools.jdbc.SequencedPrimaryKeyColumn; +import org.opengis.feature.simple.SimpleFeatureType; +import org.opengis.feature.type.AttributeDescriptor; +import org.opengis.referencing.crs.CoordinateReferenceSystem; + +public class ContentDataStoreRefinder { + + /** + * JDBC DataStore의 FeatureType 스키마를 재구성합니다. + * 주의: 이 메서드는 GeoTools의 내부 구조에 깊이 의존하므로, + * GeoTools 버전 업데이트 시 호환성 문제가 발생할 수 있습니다. + * 가능한 경우, JDBCDataStore.createSchema()를 통해 새로운 스키마를 + * 생성하거나 기존 데이터를 새 스키마로 마이그레이션하는 것을 권장합니다. + * + * @param dataStore 재구성할 JDBC DataStore + * @param typeName 대상 FeatureType의 이름 + * @return 재구성된 ContentFeatureSource + * @throws IOException + */ + public static synchronized ContentFeatureSource refindJDBCFeatureSource(ContentDataStore dataStore, String typeName) throws IOException { + ContentFeatureSource cfs = dataStore.getFeatureSource(typeName); + SimpleFeatureType featureType = cfs.getSchema(); + + SimpleFeatureTypeBuilder tBuilder = new SimpleFeatureTypeBuilder(); + tBuilder.init(featureType); + tBuilder.setName(featureType.getTypeName().toUpperCase()); // 대문자로 FeatureType 이름 설정 + + AttributeTypeBuilder aBuilder = new AttributeTypeBuilder(); + for (AttributeDescriptor attr : featureType.getAttributeDescriptors()) { + tBuilder.remove(attr.getLocalName()); // 기존 속성 제거 (이름 변경을 위해) + + aBuilder.init(attr); // 기존 속성으로 초기화 + // 사용자 데이터 복사 (attr.getUserData()는 Map를 반환) + for (Map.Entry entry : attr.getUserData().entrySet()) { + aBuilder.addUserData(entry.getKey(), entry.getValue()); + } + // 속성 이름을 대문자로 변경하여 추가 + tBuilder.add(aBuilder.buildDescriptor(attr.getLocalName().toUpperCase())); + } + + SimpleFeatureType nFeatureType = tBuilder.buildFeatureType(); + nFeatureType.getUserData().putAll(featureType.getUserData()); // FeatureType의 사용자 데이터 복사 + + // --- JDBCDataStore의 내부 상태 직접 조작은 매우 위험하며, GeoTools 버전 업데이트 시 깨질 수 있습니다. --- + // JDBCState는 JDBCDataStore 내부에서 관리되는 상태 객체입니다. + // ContentEntry를 새로 생성하여 상태를 주입하는 방식은 GeoTools의 일반적인 사용 패턴이 아닙니다. + // 대신, JDBCDataStore가 스키마를 관리하는 방식을 따르는 것이 좋습니다. + + // 여기서는 기존 로직의 의도를 최대한 살리려고 노력하지만, + // 이 부분은 GeoTools 11.3에서 안전하게 작동하지 않을 수 있습니다. + // 이상적으로는 JDBCDataStore.createSchema(nFeatureType)를 호출하여 + // 새로운 스키마를 등록하는 것이 더 안전한 방법입니다. + + // 기존 로직의 문제점: ContentDataStore.entries 필드는 protected이거나 private일 수 있어 직접 접근 불가. + // ContentEntry 및 ContentState의 내부 조작 역시 권장되지 않음. + // PrimaryKey 관련 로직도 JDBCDataStore의 createSchema 시점에 함께 정의되는 것이 일반적. + + // 임시 해결책 (기존 로직의 의도 최대한 유지): + // ContentEntry를 다시 생성하는 대신, 기존 FeatureSource의 Entry를 가져와 상태를 업데이트하는 시도 + // 이 또한 GeoTools 내부 구현에 의존하므로 불안정할 수 있습니다. + ContentEntry existingEntry = cfs.getEntry(); + ContentState state = existingEntry.getState(Transaction.AUTO_COMMIT); // 기존 Entry의 상태 가져오기 + + if (state instanceof JDBCState) { + JDBCState jdbcState = (JDBCState) state; + jdbcState.setFeatureType(nFeatureType); // 새 FeatureType 설정 + + // PrimaryKey 로직: 기존의 PrimaryKey 정보를 가져와 새로운 FeatureType에 맞게 조정 + // 이 부분은 JDBCDataStore의 JDBCState가 PrimaryKey를 어떻게 관리하는지에 따라 달라집니다. + // GeoTools의 jdbc 모듈 소스 코드를 직접 확인하는 것이 가장 정확합니다. + PrimaryKey oldPK = jdbcState.getPrimaryKey(); // 이전 PrimaryKey 가져오기 + ArrayList nColumns = new ArrayList<>(); // PrimaryKeyColumn 타입으로 명시 + + if (oldPK != null) { + for (PrimaryKeyColumn column : oldPK.getColumns()) { + String newColumnName = column.getName().toUpperCase(); // 컬럼 이름도 대문자로 + + if (column instanceof AutoGeneratedPrimaryKeyColumn) { + nColumns.add(new AutoGeneratedPrimaryKeyColumn(newColumnName, column.getType())); + } else if (column instanceof SequencedPrimaryKeyColumn) { + nColumns.add(new SequencedPrimaryKeyColumn(newColumnName, column.getType(), ((SequencedPrimaryKeyColumn) column).getSequenceName())); + } else if (column instanceof NonIncrementingPrimaryKeyColumn) { + nColumns.add(new NonIncrementingPrimaryKeyColumn(newColumnName, column.getType())); + } + // 다른 PrimaryKeyColumn 타입이 있다면 여기에 추가 + } + } + + if (nColumns.isEmpty()) { + jdbcState.setPrimaryKey(new NullPrimaryKey(nFeatureType.getTypeName())); + } else { + jdbcState.setPrimaryKey(new PrimaryKey(nFeatureType.getTypeName(), nColumns)); + } + } else { + // JDBCState가 아닌 경우 (예: 다른 DataStore 구현체) + // 혹은 기존의 ContentEntry가 JDBCState를 반환하지 않는 경우 + // 이 부분은 JDBC DataStore에 특화된 로직입니다. + throw new IllegalArgumentException("Provided dataStore is not a JDBCDataStore or does not manage JDBCState correctly."); + } + + // dataStore.entries.put()와 같은 직접적인 필드 접근은 제거했습니다. + // 대신, 스키마 변경이 ContentDataStore에 반영되도록 노력해야 합니다. + // ContentDataStore는 FeatureType 변경을 내부적으로 처리하는 메커니즘을 가질 수 있습니다. + // 이 코드가 제대로 작동하려면 DataStore의 refresh 또는 reload 메커니즘을 찾아야 합니다. + // 아니면 새로운 DataStore 인스턴스를 생성해야 합니다. + + // 여기서는 변경된 스키마로 새로운 FeatureSource를 얻으려는 시도입니다. + // 하지만 기존 DataStore가 스키마 변경을 즉시 반영하지 않을 수 있습니다. + return (ContentFeatureSource) dataStore.getFeatureSource(nFeatureType.getName()); // 변경된 이름으로 FeatureSource 요청 + } + + /** + * ShapefileDataStore의 FeatureType 스키마를 재구성합니다. + * JDBCDataStore와 마찬가지로 내부 필드 접근은 피하고, + * 스키마 변경을 ShapefileDataStore가 처리할 수 있도록 해야 합니다. + * Shapefile의 특성상, 스키마 변경은 파일 자체의 변경을 의미하며, + * 이는 DataStore 레벨에서 간단히 `setFeatureType`으로 처리하기 어렵습니다. + * 일반적으로 Shapefile의 스키마 변경은 새 Shapefile을 생성하는 방식으로 이루어집니다. + * + * @param dataStore 재구성할 ShapefileDataStore + * @return 재구성된 ShapefileDataStore + * @throws IOException + */ + public static synchronized ShapefileDataStore refindShapefileDataStore(ShapefileDataStore dataStore) throws IOException { + // ShapefileDataStore는 ContentDataStore를 상속하지만, JDBC와는 다르게 스키마를 다룹니다. + // Shapefile은 파일 기반이므로, SimpleFeatureType 변경은 파일의 구조 변경을 의미합니다. + // DataStore의 내부 상태를 직접 변경하는 것은 Shapefile에서는 매우 위험하고 잘못된 접근입니다. + // 일반적으로 Shapefile의 스키마 변경은 새 Shapefile을 생성하고 데이터를 마이그레이션하는 방식으로 이루어집니다. + + // 따라서 이 메서드는 GeoTools의 ShapefileDataStore의 동작 방식과 맞지 않습니다. + // 만약 FeatureType의 속성 이름만 대문자로 바꾸는 것이 목적이라면, + // FeatureCollection을 읽어서 새로운 FeatureCollection을 만들 때 속성 이름을 변경하거나, + // ShapefileDataStore를 다시 로드하는 방식으로 접근해야 합니다. + + // 기존 로직의 의도를 최대한 살려 보지만, 실제 작동을 보장하기 어렵습니다. + SimpleFeatureSource cfs = dataStore.getFeatureSource(); // 기본 FeatureSource 가져오기 + SimpleFeatureType featureType = cfs.getSchema(); + + SimpleFeatureTypeBuilder tBuilder = new SimpleFeatureTypeBuilder(); + tBuilder.init(featureType); + tBuilder.setName(featureType.getTypeName().toUpperCase()); + + AttributeTypeBuilder aBuilder = new AttributeTypeBuilder(); + for (AttributeDescriptor attr : featureType.getAttributeDescriptors()) { + tBuilder.remove(attr.getLocalName()); + aBuilder.init(attr); + for (Map.Entry entry : attr.getUserData().entrySet()) { // Map.Entry 타입 명시 + aBuilder.addUserData(entry.getKey(), entry.getValue()); + } + tBuilder.add(aBuilder.buildDescriptor(attr.getLocalName().toUpperCase())); + } + + SimpleFeatureType nFeatureType = tBuilder.buildFeatureType(); + nFeatureType.getUserData().putAll(featureType.getUserData()); + + // --- ShapefileDataStore의 내부 상태 직접 조작도 매우 위험합니다. --- + // ShapefileDataStore는 ContentDataStore를 상속하지만, + // 그 내부 ContentEntry/ContentState를 직접 조작하는 것은 지원되지 않습니다. + // Shapefile은 read-only로 열려있을 경우 스키마를 변경할 수 없습니다. + // write-access로 열었을 경우에도 setFeatureType으로 스키마를 변경하는 것은 + // 파일 자체의 스키마를 바꾸는 것이므로 매우 복잡한 과정이 필요합니다. + + // 이 부분은 GeoTools의 `ShapefileDataStore`가 설계된 방식과 맞지 않으므로, + // 이 코드가 제대로 작동하기 어렵습니다. + // Shapefile의 스키마 변경은 일반적으로 새 Shapefile을 생성하고 데이터를 다시 쓰는 방식으로 이루어집니다. + + // 주석 처리: 이 부분은 GeoTools의 안정적인 API를 사용하지 않으므로, 작동하지 않을 수 있습니다. + /* + ContentEntry entry = new ContentEntry(dataStore, nFeatureType.getName()); + ContentState state = entry.getState(Transaction.AUTO_COMMIT); + state.setFeatureType(nFeatureType); + dataStore.entries.put(entry.getName(), entry); // 이 줄은 컴파일 에러 발생 가능 + dataStore.entries.put(cfs.getEntry().getName(), entry); // 이 줄은 컴파일 에러 발생 가능 + */ + + // 대신, 여기서는 새로운 FeatureType을 바탕으로 DataStore를 다시 로드하거나 + // 아예 새로운 Shapefile을 생성하는 것을 고려해야 합니다. + // 이 메서드는 기존 ShapefileDataStore의 스키마를 "재정의"하는 것이므로, + // 실제 Shapefile 파일의 스키마는 변경되지 않을 수 있습니다. + // ShapefileDataStore는 스키마를 변경하는 API를 직접적으로 제공하지 않습니다. + + System.err.println("Warning: refindShapefileDataStore attempts to modify internal state of ShapefileDataStore, which is generally not supported for schema changes. Consider creating a new Shapefile with the desired schema."); + return dataStore; // 원본 DataStore를 반환 (실제 스키마 변경이 이루어지지 않을 수 있음) + } + + /** + * SimpleFeatureSource의 CRS(좌표 참조 시스템)를 변경합니다. + * ContentFeatureSource인 경우에만 내부 상태를 업데이트합니다. + * + * @param featureSource CRS를 변경할 SimpleFeatureSource + * @param crs 새로운 CoordinateReferenceSystem + * @return CRS가 변경된 SimpleFeatureSource (원본 객체 또는 새로운 객체일 수 있음) + * @throws IOException + */ + public static synchronized SimpleFeatureSource changeCRSFeatureSource(SimpleFeatureSource featureSource, CoordinateReferenceSystem crs) throws IOException { + if (featureSource instanceof ContentFeatureSource) { + SimpleFeatureType currentType = featureSource.getSchema(); + // SimpleFeatureTypeBuilder.retype는 기존 FeatureType을 기반으로 새로운 CRS를 가진 FeatureType을 생성합니다. + SimpleFeatureType newType = SimpleFeatureTypeBuilder.retype(currentType, crs); + + // ContentFeatureSource의 Entry를 통해 내부 상태를 업데이트합니다. + // 이 방식은 ContentDataStore의 구현에 따라 작동하거나 작동하지 않을 수 있습니다. + // 특히 Shapefile의 경우, 파일 자체의 CRS가 변경되지 않는 이상 이 방식은 메타데이터만 변경할 수 있습니다. + // 실제 데이터의 CRS 변환은 FeatureCollection을 통해 TransforingFeatureSource를 사용해야 합니다. + ((ContentFeatureSource) featureSource).getEntry().getState(Transaction.AUTO_COMMIT).setFeatureType(newType); + } else { + // ContentFeatureSource가 아닌 다른 SimpleFeatureSource 구현체인 경우 + // (예: PostGISDataStore의 SimpleFeatureSource 등) + // 해당 DataStore의 특정 메서드를 통해 CRS를 변경해야 할 수 있습니다. + // 또는 TransformingFeatureSource를 사용하여 CRS 변환을 수행하는 것이 더 일반적입니다. + System.err.println("Warning: changeCRSFeatureSource is designed for ContentFeatureSource. For other types, consider using a TransformingFeatureSource or DataStore specific methods."); + } + return featureSource; + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/ExFeatureLayer.java b/src/main/java/geoinfo/map/myMap/ExFeatureLayer.java new file mode 100644 index 00000000..831b93b6 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ExFeatureLayer.java @@ -0,0 +1,20 @@ +package geoinfo.map.myMap; + +import org.geotools.data.FeatureSource; +import org.geotools.map.FeatureLayer; +import org.geotools.styling.Style; + +public class ExFeatureLayer +extends FeatureLayer { + public ExFeatureLayer(FeatureSource featureSource, Style style) { + super(featureSource, style); + } + + public boolean isWrapTileTextLayer() { + return ((MapStyle)this.getStyle()).isWrapTileTextStyle(); + } + + public double getWrapTileText() { + return ((MapStyle)this.getStyle()).getWrapTileText(); + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/FeatureLayer.java b/src/main/java/geoinfo/map/myMap/FeatureLayer.java index d9a2909a..9a44c7e6 100644 --- a/src/main/java/geoinfo/map/myMap/FeatureLayer.java +++ b/src/main/java/geoinfo/map/myMap/FeatureLayer.java @@ -1,9 +1,6 @@ package geoinfo.map.myMap; - import java.util.ArrayList; -import java.util.Collection; import java.util.Iterator; -import java.util.List; import java.util.concurrent.ConcurrentHashMap; import org.geotools.data.simple.SimpleFeatureSource; import org.geotools.geometry.jts.ReferencedEnvelope; @@ -11,481 +8,335 @@ import org.geotools.referencing.CRS; import org.geotools.styling.NamedLayer; import org.geotools.styling.NamedStyle; import org.geotools.styling.Style; -import org.geotools.styling.StyleFactory; +import org.geotools.styling.StyleVisitor; import org.geotools.styling.StyledLayer; import org.geotools.styling.StyledLayerDescriptor; import org.geotools.styling.UserLayer; import org.opengis.feature.simple.SimpleFeatureType; import org.opengis.filter.Filter; +import org.opengis.referencing.crs.CoordinateReferenceSystem; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import org.geotools.data.simple.SimpleFeatureSource; -import org.geotools.geometry.jts.ReferencedEnvelope; -import org.geotools.referencing.CRS; -import org.geotools.styling.NamedLayer; -import org.geotools.styling.NamedStyle; -import org.geotools.styling.Style; -import org.geotools.styling.StyleFactory; -import org.geotools.styling.StyledLayer; -import org.geotools.styling.StyledLayerDescriptor; -import org.geotools.styling.UserLayer; -import org.opengis.feature.simple.SimpleFeatureType; -import org.opengis.filter.Filter; +public class FeatureLayer +extends Layer { + private final String sourceName; + private ReferencedEnvelope bbox; + private ConcurrentHashMap styleStore = new ConcurrentHashMap(); + private Style currentStyle; + private ConcurrentHashMap renderStyles = new ConcurrentHashMap(); -public class FeatureLayer extends Layer -{ - private final String sourceName; - private ReferencedEnvelope bbox; - private ConcurrentHashMap styleStore = new ConcurrentHashMap(); - private Style currentStyle; - private ConcurrentHashMap renderStyles = new ConcurrentHashMap(); - - public FeatureLayer(AVList params) throws Exception { - super(params); - try - { - String sVal = params.getStringValue("conf.service.ref.source"); - sVal = sVal.trim().toUpperCase(); - this.sourceName = sVal; - - SimpleFeatureSource featureSource = O2DSMngr.getFeatureSource(getLayerType(), getServerName(), getSourceName()); - - this.bbox = featureSource.getBounds(); - } - catch (Exception e) { - throw e; - } - - if (params.getValue("conf.service.sld") == null) { - Style style = StyleMngr.getDefaultUserStyle(getLayerType(), getServerName(), getSourceName(), getName()); - setCurrentStyle(style); - - LogMngr.getInstance().logDebug("[LAYER]", - "Set Style Use Default :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + getName() + "]"); - } else { - StyledLayerDescriptor sld = (StyledLayerDescriptor)params.getValue("conf.service.sld"); - initServiceStyle(sld, false); - LogMngr.getInstance().logDebug("[LAYER]", - "Set Style From DB :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + getName() + "]"); - } - LogMngr.getInstance().logDebug("[LAYER]", - "Default Style Name Is [" + getCurrentStyle().getName() + "] :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + getName() + "]"); - - StyledLayerDescriptor sld = StyleMngr.readServiceSLD(getName()); - if (sld != null) { - initServiceStyle(sld, false); - LogMngr.getInstance().logDebug("[LAYER]", - "Override Style From SLD FILE :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + getName() + "]"); - LogMngr.getInstance().logDebug("[LAYER]", - "Default Style Name Is [" + getCurrentStyle().getName() + "] :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + getName() + "]"); - } - - try - { - if (isUseCache().booleanValue()) { - O2DSMngr.putMemoryFeatureSource(getLayerType(), getServerName(), getSourceName(), Filter.INCLUDE); - LogMngr.getInstance().logDebug("[LAYER]", - "Now use memery DataStore :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + getName() + "]"); - } - } - catch (Exception e) { - LogMngr.getInstance().logDebug("[LAYER]", - "Fail to make memery DataStore. Now use common DataStore :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + getName() + "]"); - } - } - - public synchronized void reloadServiceStyle() - { - StyledLayerDescriptor sld = StyleMngr.readServiceSLD(getName()); - if (sld != null) { - initServiceStyle(sld, false); - LogMngr.getInstance().logDebug("[LAYER]", - "Reload Style From SLD FILE :: [Map:" + getMapName() + "/Layer:" + getName() + "]"); - LogMngr.getInstance().logDebug("[LAYER]", - "Default Style Name Is [" + getCurrentStyle().getName() + "] :: [Map:" + getMapName() + "/Layer:" + getName() + "]"); - } - } - - public synchronized void initServiceStyle(StyledLayerDescriptor sld, boolean write) - { - Style defaultStyle = null; - ConcurrentHashMap tempStore = new ConcurrentHashMap(); - - Iterator iterLayer = sld.layers().iterator(); - Iterator iterStyle; - label233: for (; iterLayer.hasNext(); - iterStyle.hasNext()) - { - StyledLayer styledLayer = (StyledLayer)iterLayer.next(); - - if ((!ServerUtil.isNullString(styledLayer.getName())) && - (!styledLayer.getName().equalsIgnoreCase(getName()))) - { - break label233; - } - - iterStyle = getStyleIterator(styledLayer); - continue; - Style style = (Style)iterStyle.next(); - - if (!(style instanceof NamedStyle)) - { - if (ServerUtil.isNullString(style.getName())) - style.setName(getName()); - else { - style.setName(style.getName().trim().toUpperCase()); + public FeatureLayer(AVList params) throws Exception { + super(params); + StyledLayerDescriptor sld; + String sVal = params.getStringValue("conf.service.ref.source"); + this.sourceName = sVal = sVal.trim().toUpperCase(); + SimpleFeatureSource featureSource = O2DSMngr.getFeatureSource((LayerFactory.LayerType)this.getLayerType(), (String)this.getServerName(), (String)this.getSourceName()); + this.bbox = featureSource.getBounds(); + if (params.getValue("conf.service.sld") == null) { + Style style = StyleMngr.getDefaultUserStyle((LayerFactory.LayerType)this.getLayerType(), (String)this.getServerName(), (String)this.getSourceName(), (String)this.getName()); + this.setCurrentStyle(style); + LogMngr.getInstance().logDebug("[LAYER]", "Set Style Use Default :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + this.getName() + "]"); + } else { + sld = (StyledLayerDescriptor)params.getValue("conf.service.sld"); + this.initServiceStyle(sld, false); + LogMngr.getInstance().logDebug("[LAYER]", "Set Style From DB :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + this.getName() + "]"); } - - tempStore.put(style.getName(), style); - if ((defaultStyle != null) && - (defaultStyle.getName().equals(style.getName()))) { - defaultStyle = null; + LogMngr.getInstance().logDebug("[LAYER]", "Default Style Name Is [" + this.getCurrentStyle().getName() + "] :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + this.getName() + "]"); + sld = StyleMngr.readServiceSLD((String)this.getName()); + if (sld != null) { + this.initServiceStyle(sld, false); + LogMngr.getInstance().logDebug("[LAYER]", "Override Style From SLD FILE :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + this.getName() + "]"); + LogMngr.getInstance().logDebug("[LAYER]", "Default Style Name Is [" + this.getCurrentStyle().getName() + "] :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + this.getName() + "]"); } + try { + if (this.isUseCache().booleanValue()) { + O2DSMngr.putMemoryFeatureSource((LayerFactory.LayerType)this.getLayerType(), (String)this.getServerName(), (String)this.getSourceName(), (Filter)Filter.INCLUDE); + LogMngr.getInstance().logDebug("[LAYER]", "Now use memery DataStore :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + this.getName() + "]"); + } + } + catch (Exception e) { + LogMngr.getInstance().logDebug("[LAYER]", "Fail to make memery DataStore. Now use common DataStore :: [Map:" + ServerContext.getMap().getName() + "/Layer:" + this.getName() + "]"); + } + } - if (style.isDefault()) - { - if (defaultStyle == null) { - defaultStyle = style; - } else { + public synchronized void reloadServiceStyle() { + StyledLayerDescriptor sld = StyleMngr.readServiceSLD((String)this.getName()); + if (sld != null) { + this.initServiceStyle(sld, false); + LogMngr.getInstance().logDebug("[LAYER]", "Reload Style From SLD FILE :: [Map:" + this.getMapName() + "/Layer:" + this.getName() + "]"); + LogMngr.getInstance().logDebug("[LAYER]", "Default Style Name Is [" + this.getCurrentStyle().getName() + "] :: [Map:" + this.getMapName() + "/Layer:" + this.getName() + "]"); + } + } + + public synchronized void initServiceStyle(StyledLayerDescriptor sld, boolean write) { + Style defaultStyle = null; + ConcurrentHashMap tempStore = new ConcurrentHashMap(); + for (StyledLayer styledLayer : sld.layers()) { + if (!ServerUtil.isNullString((String)styledLayer.getName()) && !styledLayer.getName().equalsIgnoreCase(this.getName())) continue; + Iterator