From 396b300848830461ab5bacbeab6cf66271a980e0 Mon Sep 17 00:00:00 2001 From: thkim Date: Thu, 12 Jun 2025 08:15:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B0=9C=EC=A3=BC=EA=B8=B0=EA=B4=80=20?= =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=97=90=20=EC=A0=84=EC=B2=B4=20=EC=8B=9C?= =?UTF-8?q?=EC=B6=94=EA=B3=B5=20=EB=82=98=EC=98=A4=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.txt | 5 +- .../drilling/home/DrillingHomeController.java | 12 +- src/main/java/geoinfo/map/myMap/AVList.java | 304 +++ .../java/geoinfo/map/myMap/AWTLabelUtil.java | 5 + .../java/geoinfo/map/myMap/AttributeList.java | 83 + src/main/java/geoinfo/map/myMap/CRSMngr.java | 49 + .../map/myMap/CategorizeBinding110.java | 82 + src/main/java/geoinfo/map/myMap/ConnJDBC.java | 5 + src/main/java/geoinfo/map/myMap/ConnMngr.java | 5 + .../geoinfo/map/myMap/CoordinateAccess.java | 34 + .../map/myMap/CoordinateAccessFactory.java | 12 + .../java/geoinfo/map/myMap/Coordinates.java | 255 ++ .../java/geoinfo/map/myMap/EncryptUtil.java | 68 + .../java/geoinfo/map/myMap/ExO2ImgLayer.java | 52 + .../java/geoinfo/map/myMap/ExWMSLayer.java | 152 ++ .../map/myMap/ExtractRasterStyleVisitor.java | 56 + .../java/geoinfo/map/myMap/FeatureLayer.java | 491 ++++ .../geoinfo/map/myMap/FileComparator.java | 16 + .../geoinfo/map/myMap/GWVectorDriver.java | 5 + .../geoinfo/map/myMap/GWaveStoreMngr.java | 476 ++++ .../geoinfo/map/myMap/GeoWaveDataStore.java | 5 + .../geoinfo/map/myMap/GeometryConverter.java | 335 +++ .../java/geoinfo/map/myMap/GeometryMngr.java | 5 + .../java/geoinfo/map/myMap/GetMapRequest.java | 89 + .../java/geoinfo/map/myMap/GroupLayer.java | 94 + .../map/myMap/InterpolateBinding110.java | 60 + .../java/geoinfo/map/myMap/JdbcStoreMngr.java | 533 ++++ .../java/geoinfo/map/myMap/KLISLabelUtil.java | 5 + .../java/geoinfo/map/myMap/LabelCacheEx.java | 1752 +++++++++++++ .../geoinfo/map/myMap/LabelCacheItemEx.java | 67 + .../java/geoinfo/map/myMap/LabelInfo.java | 111 + .../geoinfo/map/myMap/LabelPainterEx.java | 588 +++++ src/main/java/geoinfo/map/myMap/Layer.java | 192 ++ .../java/geoinfo/map/myMap/LayerFactory.java | 43 + src/main/java/geoinfo/map/myMap/LayerSet.java | 163 ++ .../java/geoinfo/map/myMap/LinkLayer.java | 42 + .../geoinfo/map/myMap/LogCacheManager.java | 219 ++ src/main/java/geoinfo/map/myMap/LogMngr.java | 223 ++ src/main/java/geoinfo/map/myMap/Map.java | 108 + src/main/java/geoinfo/map/myMap/MapStyle.java | 76 + .../java/geoinfo/map/myMap/O2CRSFactory.java | 517 ++++ .../java/geoinfo/map/myMap/O2DSFactory.java | 280 ++ src/main/java/geoinfo/map/myMap/O2DSMngr.java | 290 +++ .../map/myMap/O2DSPrimaryKeyFinder.java | 173 ++ .../java/geoinfo/map/myMap/O2DemLayer.java | 225 ++ .../geoinfo/map/myMap/O2GeometryTypeMap.java | 34 + .../java/geoinfo/map/myMap/O2ImgLayer.java | 42 + .../java/geoinfo/map/myMap/O2LayerIndex.java | 47 + .../java/geoinfo/map/myMap/O2LayerLevel.java | 164 ++ .../geoinfo/map/myMap/O2LayerLevelSet.java | 98 + .../java/geoinfo/map/myMap/O2LayerUtil.java | 644 +++++ .../java/geoinfo/map/myMap/O2PngWriter.java | 178 ++ .../O2SpatialIndexFeatureCollection.java | 45 + .../java/geoinfo/map/myMap/O2SqlDialect.java | 13 + .../geoinfo/map/myMap/O2StyleFactory.java | 272 ++ .../java/geoinfo/map/myMap/O2WpsLayerSet.java | 439 ++++ .../map/myMap/OWSServiceException.java | 101 + .../java/geoinfo/map/myMap/OracleDialect.java | 720 ++++++ .../geoinfo/map/myMap/OracleFilterToSQL.java | 175 ++ .../java/geoinfo/map/myMap/OrdinateList.java | 60 + .../map/myMap/RefineRenderStyleVisitor.java | 192 ++ .../geoinfo/map/myMap/RefineStyleVisitor.java | 173 ++ .../java/geoinfo/map/myMap/RenderMngr.java | 165 ++ src/main/java/geoinfo/map/myMap/Request.java | 55 + src/main/java/geoinfo/map/myMap/SDO.java | 1607 ++++++++++++ .../map/myMap/SLDConfiguration110.java | 50 + .../java/geoinfo/map/myMap/SLDParser100.java | 2280 +++++++++++++++++ .../geoinfo/map/myMap/SLDTransformer110.java | 1484 +++++++++++ .../map/myMap/ServerConfiguration.java | 547 ++++ .../java/geoinfo/map/myMap/ServerContext.java | 575 +++++ .../java/geoinfo/map/myMap/ServerInfo.java | 34 + .../java/geoinfo/map/myMap/ServerUtil.java | 396 +++ .../java/geoinfo/map/myMap/SimpleSql.java | 80 + .../java/geoinfo/map/myMap/StyleMngr.java | 516 ++++ .../StyledLayerDescriptorBinding110.java | 46 + .../java/geoinfo/map/myMap/TextStyle2DEx.java | 80 + .../geoinfo/map/myMap/TransformedIconEx.java | 58 + .../java/geoinfo/map/myMap/WMSGetMap.java | 97 + src/main/java/geoinfo/map/myMap/WMSLayer.java | 100 + .../geoinfo/map/myMap/WpsVecStoreMngr.java | 704 +++++ .../map/myMap/XSBooleanBinding110.java | 19 + src/main/webapp/WEB-INF/lib/gt-api-11.0.jar | Bin 0 -> 162875 bytes .../webapp/WEB-INF/lib/gt-brewer-11.0.jar | Bin 0 -> 135375 bytes .../webapp/WEB-INF/lib/gt-coverage-11.0.jar | Bin 0 -> 450326 bytes .../WEB-INF/lib/gt-coverage-api-11.0.jar | Bin 0 -> 104054 bytes .../WEB-INF/lib/gt-coveragetools-11.0.jar | Bin 0 -> 81026 bytes src/main/webapp/WEB-INF/lib/gt-cql-11.0.jar | Bin 0 -> 193574 bytes src/main/webapp/WEB-INF/lib/gt-data-11.0.jar | Bin 0 -> 71301 bytes .../webapp/WEB-INF/lib/gt-epsg-wkt-11.0.jar | Bin 0 -> 186031 bytes .../webapp/WEB-INF/lib/gt-geojson-11.0.jar | Bin 0 -> 103438 bytes .../webapp/WEB-INF/lib/gt-geotiff-11.0.jar | Bin 0 -> 28585 bytes src/main/webapp/WEB-INF/lib/gt-grid-11.0.jar | Bin 0 -> 35064 bytes src/main/webapp/WEB-INF/lib/gt-jdbc-11.0.jar | Bin 0 -> 201280 bytes src/main/webapp/WEB-INF/lib/gt-main-11.0.jar | Bin 0 -> 1677754 bytes .../webapp/WEB-INF/lib/gt-metadata-11.0.jar | Bin 0 -> 505716 bytes .../webapp/WEB-INF/lib/gt-opengis-11.0.jar | Bin 0 -> 345667 bytes .../webapp/WEB-INF/lib/gt-process-11.0.jar | Bin 0 -> 55918 bytes .../WEB-INF/lib/gt-referencing-11.0.jar | Bin 0 -> 1142841 bytes .../webapp/WEB-INF/lib/gt-render-11.0.jar | Bin 0 -> 446337 bytes .../webapp/WEB-INF/lib/gt-shapefile-11.0.jar | Bin 0 -> 202174 bytes src/main/webapp/WEB-INF/lib/gt-wfs-11.0.jar | Bin 0 -> 323908 bytes src/main/webapp/WEB-INF/lib/gt-wms-11.0.jar | Bin 0 -> 223941 bytes src/main/webapp/WEB-INF/lib/gt-wps-11.0.jar | Bin 0 -> 40904 bytes src/main/webapp/WEB-INF/lib/gt-xml-11.0.jar | Bin 0 -> 640672 bytes .../webapp/WEB-INF/lib/gt-xsd-core-11.0.jar | Bin 0 -> 302851 bytes .../webapp/WEB-INF/lib/gt-xsd-fes-11.0.jar | Bin 0 -> 56183 bytes .../webapp/WEB-INF/lib/gt-xsd-filter-11.0.jar | Bin 0 -> 105575 bytes .../webapp/WEB-INF/lib/gt-xsd-gml2-11.0.jar | Bin 0 -> 82531 bytes .../webapp/WEB-INF/lib/gt-xsd-gml3-11.0.jar | Bin 0 -> 1522488 bytes .../webapp/WEB-INF/lib/gt-xsd-ows-11.0.jar | Bin 0 -> 119996 bytes .../webapp/WEB-INF/lib/gt-xsd-sld-11.0.jar | Bin 0 -> 173268 bytes .../webapp/WEB-INF/lib/gt-xsd-wcs-11.0.jar | Bin 0 -> 148121 bytes .../webapp/WEB-INF/lib/gt-xsd-wfs-11.0.jar | Bin 0 -> 124340 bytes .../webapp/WEB-INF/lib/gt-xsd-wms-11.0.jar | Bin 0 -> 11105 bytes .../webapp/WEB-INF/lib/gt-xsd-wps-11.0.jar | Bin 0 -> 39790 bytes src/main/webapp/WEB-INF/lib/jdom-1.1.3.jar | Bin 0 -> 151304 bytes .../webapp/WEB-INF/lib/picocontainer-1.2.jar | Bin 0 -> 112635 bytes src/main/webapp/WEB-INF/lib/pngj-2.1.1.jar | Bin 0 -> 173228 bytes .../views/drilling/common/includeTopMenu.jsp | 4 +- .../views/drilling/home/drilling_index.jsp | 18 +- src/main/webapp/js/map/main/map.js | 81 +- 121 files changed, 20721 insertions(+), 34 deletions(-) create mode 100644 src/main/java/geoinfo/map/myMap/AVList.java create mode 100644 src/main/java/geoinfo/map/myMap/AWTLabelUtil.java create mode 100644 src/main/java/geoinfo/map/myMap/AttributeList.java create mode 100644 src/main/java/geoinfo/map/myMap/CRSMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/CategorizeBinding110.java create mode 100644 src/main/java/geoinfo/map/myMap/ConnJDBC.java create mode 100644 src/main/java/geoinfo/map/myMap/ConnMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/CoordinateAccess.java create mode 100644 src/main/java/geoinfo/map/myMap/CoordinateAccessFactory.java create mode 100644 src/main/java/geoinfo/map/myMap/Coordinates.java create mode 100644 src/main/java/geoinfo/map/myMap/EncryptUtil.java create mode 100644 src/main/java/geoinfo/map/myMap/ExO2ImgLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/ExWMSLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/ExtractRasterStyleVisitor.java create mode 100644 src/main/java/geoinfo/map/myMap/FeatureLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/FileComparator.java create mode 100644 src/main/java/geoinfo/map/myMap/GWVectorDriver.java create mode 100644 src/main/java/geoinfo/map/myMap/GWaveStoreMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/GeoWaveDataStore.java create mode 100644 src/main/java/geoinfo/map/myMap/GeometryConverter.java create mode 100644 src/main/java/geoinfo/map/myMap/GeometryMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/GetMapRequest.java create mode 100644 src/main/java/geoinfo/map/myMap/GroupLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/InterpolateBinding110.java create mode 100644 src/main/java/geoinfo/map/myMap/JdbcStoreMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/KLISLabelUtil.java create mode 100644 src/main/java/geoinfo/map/myMap/LabelCacheEx.java create mode 100644 src/main/java/geoinfo/map/myMap/LabelCacheItemEx.java create mode 100644 src/main/java/geoinfo/map/myMap/LabelInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/LabelPainterEx.java create mode 100644 src/main/java/geoinfo/map/myMap/Layer.java create mode 100644 src/main/java/geoinfo/map/myMap/LayerFactory.java create mode 100644 src/main/java/geoinfo/map/myMap/LayerSet.java create mode 100644 src/main/java/geoinfo/map/myMap/LinkLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/LogCacheManager.java create mode 100644 src/main/java/geoinfo/map/myMap/LogMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/Map.java create mode 100644 src/main/java/geoinfo/map/myMap/MapStyle.java create mode 100644 src/main/java/geoinfo/map/myMap/O2CRSFactory.java create mode 100644 src/main/java/geoinfo/map/myMap/O2DSFactory.java create mode 100644 src/main/java/geoinfo/map/myMap/O2DSMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/O2DSPrimaryKeyFinder.java create mode 100644 src/main/java/geoinfo/map/myMap/O2DemLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/O2GeometryTypeMap.java create mode 100644 src/main/java/geoinfo/map/myMap/O2ImgLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/O2LayerIndex.java create mode 100644 src/main/java/geoinfo/map/myMap/O2LayerLevel.java create mode 100644 src/main/java/geoinfo/map/myMap/O2LayerLevelSet.java create mode 100644 src/main/java/geoinfo/map/myMap/O2LayerUtil.java create mode 100644 src/main/java/geoinfo/map/myMap/O2PngWriter.java create mode 100644 src/main/java/geoinfo/map/myMap/O2SpatialIndexFeatureCollection.java create mode 100644 src/main/java/geoinfo/map/myMap/O2SqlDialect.java create mode 100644 src/main/java/geoinfo/map/myMap/O2StyleFactory.java create mode 100644 src/main/java/geoinfo/map/myMap/O2WpsLayerSet.java create mode 100644 src/main/java/geoinfo/map/myMap/OWSServiceException.java create mode 100644 src/main/java/geoinfo/map/myMap/OracleDialect.java create mode 100644 src/main/java/geoinfo/map/myMap/OracleFilterToSQL.java create mode 100644 src/main/java/geoinfo/map/myMap/OrdinateList.java create mode 100644 src/main/java/geoinfo/map/myMap/RefineRenderStyleVisitor.java create mode 100644 src/main/java/geoinfo/map/myMap/RefineStyleVisitor.java create mode 100644 src/main/java/geoinfo/map/myMap/RenderMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/Request.java create mode 100644 src/main/java/geoinfo/map/myMap/SDO.java create mode 100644 src/main/java/geoinfo/map/myMap/SLDConfiguration110.java create mode 100644 src/main/java/geoinfo/map/myMap/SLDParser100.java create mode 100644 src/main/java/geoinfo/map/myMap/SLDTransformer110.java create mode 100644 src/main/java/geoinfo/map/myMap/ServerConfiguration.java create mode 100644 src/main/java/geoinfo/map/myMap/ServerContext.java create mode 100644 src/main/java/geoinfo/map/myMap/ServerInfo.java create mode 100644 src/main/java/geoinfo/map/myMap/ServerUtil.java create mode 100644 src/main/java/geoinfo/map/myMap/SimpleSql.java create mode 100644 src/main/java/geoinfo/map/myMap/StyleMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/StyledLayerDescriptorBinding110.java create mode 100644 src/main/java/geoinfo/map/myMap/TextStyle2DEx.java create mode 100644 src/main/java/geoinfo/map/myMap/TransformedIconEx.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSGetMap.java create mode 100644 src/main/java/geoinfo/map/myMap/WMSLayer.java create mode 100644 src/main/java/geoinfo/map/myMap/WpsVecStoreMngr.java create mode 100644 src/main/java/geoinfo/map/myMap/XSBooleanBinding110.java create mode 100644 src/main/webapp/WEB-INF/lib/gt-api-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-brewer-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-coverage-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-coverage-api-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-coveragetools-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-cql-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-data-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-epsg-wkt-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-geojson-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-geotiff-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-grid-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-jdbc-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-main-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-metadata-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-opengis-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-process-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-referencing-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-render-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-shapefile-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-wfs-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-wms-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-wps-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xml-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-core-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-fes-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-filter-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-gml2-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-gml3-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-ows-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-sld-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-wcs-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-wfs-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-wms-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/gt-xsd-wps-11.0.jar create mode 100644 src/main/webapp/WEB-INF/lib/jdom-1.1.3.jar create mode 100644 src/main/webapp/WEB-INF/lib/picocontainer-1.2.jar create mode 100644 src/main/webapp/WEB-INF/lib/pngj-2.1.1.jar diff --git a/list.txt b/list.txt index b8ae4a11..893b7878 100644 --- a/list.txt +++ b/list.txt @@ -11,7 +11,6 @@ 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\com\img\drilling\maps\dokdo_active_alone.svg -src\main\webapp\com\img\drilling\maps\uleungdo_active_alone.svg src\main\webapp\WEB-INF\views\drilling\inquiry\drilling_inquiry_project.jsp -src\main\webapp\WEB-INF\views\drilling\home\drilling_index.jsp \ No newline at end of file +src\main\webapp\WEB-INF\views\drilling\home\drilling_index.jsp +src\main\java\geoinfo\drilling\home\DrillingHomeController.java \ No newline at end of file diff --git a/src/main/java/geoinfo/drilling/home/DrillingHomeController.java b/src/main/java/geoinfo/drilling/home/DrillingHomeController.java index 2b9782c3..34fc9ebb 100644 --- a/src/main/java/geoinfo/drilling/home/DrillingHomeController.java +++ b/src/main/java/geoinfo/drilling/home/DrillingHomeController.java @@ -143,11 +143,13 @@ public class DrillingHomeController { EgovMap mbr = drillingInquiryService.getTblMasterCompanyMbrByComCode(request, params, String.valueOf(request.getSession().getAttribute("USERID"))); model.addAttribute("mbr", mbr); - double nOffsetKm = 2.0f; // 2Km 밖 까지 허용한다. - params.put("MIN_X", MyUtil.getDoubleFromObject( mbr.get("minX") ) - nOffsetKm*1000); - params.put("MIN_Y", MyUtil.getDoubleFromObject( mbr.get("minY") ) - nOffsetKm*1000); - params.put("MAX_X", MyUtil.getDoubleFromObject( mbr.get("maxX") ) + nOffsetKm*1000); - params.put("MAX_Y", MyUtil.getDoubleFromObject( mbr.get("maxY") ) + nOffsetKm*1000); + if( mbr != null ) { + double nOffsetKm = 2.0f; // 2Km 밖 까지 허용한다. + params.put("MIN_X", MyUtil.getDoubleFromObject( mbr.get("minX") ) - nOffsetKm*1000); + params.put("MIN_Y", MyUtil.getDoubleFromObject( mbr.get("minY") ) - nOffsetKm*1000); + params.put("MAX_X", MyUtil.getDoubleFromObject( mbr.get("maxX") ) + nOffsetKm*1000); + params.put("MAX_Y", MyUtil.getDoubleFromObject( mbr.get("maxY") ) + nOffsetKm*1000); + } model.put("data", drillingHomeService.drillingMapSearchHoleWithMbr(params)); diff --git a/src/main/java/geoinfo/map/myMap/AVList.java b/src/main/java/geoinfo/map/myMap/AVList.java new file mode 100644 index 00000000..734c7a0c --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/AVList.java @@ -0,0 +1,304 @@ +package geoinfo.map.myMap; + +import java.awt.Color; +import java.net.URL; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +public class AVList { + private HashMap avList; + + public AVList() + { + this.avList = new HashMap(); + } + + public synchronized Object getValue(String key) + { + if ((key == null) || (key.trim().equals(""))) + { + throw new IllegalArgumentException("AVList :: Key is NULL."); + } + + return this.avList.get(key); + } + + public synchronized Collection getValues() + { + return this.avList.values(); + } + + public synchronized Set> getEntries() + { + return this.avList.entrySet(); + } + + public synchronized Object setValue(String key, Object value) + { + if ((key == null) || (key.trim().equals(""))) + { + throw new IllegalArgumentException("AVList :: Key is NULL."); + } + + return this.avList.put(key, value); + } + + public synchronized AVList setValues(AVList list) + { + if (list == null) + { + throw new IllegalArgumentException("AVList :: AVList is NULL."); + } + + Set entries = list.getEntries(); + for (Map.Entry entry : entries) + { + setValue((String)entry.getKey(), entry.getValue()); + } + + return this; + } + + public synchronized boolean hasKey(String key) + { + if ((key == null) || (key.trim().equals(""))) + { + throw new IllegalArgumentException("AVList :: Key is NULL."); + } + + return this.avList.containsKey(key); + } + + public synchronized Object removeKey(String key) + { + if ((key == null) || (key.trim().equals(""))) + { + throw new IllegalArgumentException("AVList :: Key is NULL."); + } + + return hasKey(key) ? this.avList.remove(key) : null; + } + + public synchronized AVList copy() + { + AVList clone = new AVList(); + + if (this.avList != null) + { + clone.avList.putAll(this.avList); + } + + return clone; + } + + public synchronized AVList clearList() + { + this.avList.clear(); + return this; + } + + public synchronized String getStringValue(String key, String defaultValue) + { + String v = getStringValue(key); + return v != null ? v : defaultValue; + } + + public synchronized String getStringValue(String key) + { + try + { + return getValue(key).toString(); } catch (Exception e) { + } + return null; + } + + public synchronized Integer getIntegerValue(String key, Integer defaultValue) + { + Integer v = getIntegerValue(key); + return v != null ? v : defaultValue; + } + + public synchronized Integer getIntegerValue(String key) + { + try + { + Object o = getValue(key); + if (o == null) { + return null; + } + if ((o instanceof Integer)) { + return (Integer)o; + } + String v = getStringValue(key); + if (v == null) { + return null; + } + Double d = Double.valueOf(Double.parseDouble(v)); + return Integer.valueOf(d.intValue()); + } catch (Exception e) { + } + return null; + } + + public synchronized Long getLongValue(String key, Long defaultValue) + { + Long v = getLongValue(key); + return v != null ? v : defaultValue; + } + + public synchronized Long getLongValue(String key) + { + try { + Object o = getValue(key); + if (o == null) { + return null; + } + if ((o instanceof Long)) { + return (Long)o; + } + String v = getStringValue(key); + if (v == null) { + return null; + } + Double d = Double.valueOf(Double.parseDouble(v)); + return Long.valueOf(d.longValue()); + } + catch (Exception e) { + e.printStackTrace(); + }return null; + } + + public synchronized Double getDoubleValue(String key, Double defaultValue) + { + Double v = getDoubleValue(key); + return v != null ? v : defaultValue; + } + + public synchronized Double getDoubleValue(String key) + { + try + { + Object o = getValue(key); + if (o == null) { + return null; + } + if ((o instanceof Double)) { + return (Double)o; + } + String v = getStringValue(key); + if (v == null) { + return null; + } + return Double.valueOf(Double.parseDouble(v)); + } catch (Exception e) { + } + return null; + } + + public synchronized Boolean getBooleanValue(String key, Boolean defaultValue) + { + Boolean v = getBooleanValue(key); + return v != null ? v : defaultValue; + } + + public synchronized Boolean getBooleanValue(String key) + { + try { + Object o = getValue(key); + if (o == null) { + return null; + } + if ((o instanceof Boolean)) { + return (Boolean)o; + } + String v = getStringValue(key); + if (v == null) { + return null; + } + return Boolean.valueOf(Boolean.parseBoolean(v)); + } catch (Exception e) { + } + return null; + } + + public synchronized Date getDateValue(String key, Date defaultValue) + { + Date v = getDateValue(key); + return v != null ? v : defaultValue; + } + + public synchronized Date getDateValue(String key) { + try { + Object o = getValue(key); + if (o == null) { + return null; + } + if ((o instanceof Date)) { + return (Date)o; + } + Long v = getLongValue(key); + if (v == null) { + return null; + } + return new Date(v.longValue()); + } catch (Exception e) { + } + return null; + } + + public synchronized URL getURLValue(String key) + { + try + { + Object o = getValue(key); + if (o == null) { + return null; + } + if ((o instanceof URL)) { + return (URL)o; + } + String v = getStringValue(key); + if (v == null) { + return null; + } + if (v.length() != v.lastIndexOf("/") + 1) { + v = v.concat("/"); + } + + return new URL(v); + } catch (Exception e) { + } + return null; + } + + public synchronized Color getColorValue(String key) + { + try + { + Object o = getValue(key); + if (o == null) { + return null; + } + if ((o instanceof Color)) { + return (Color)o; + } + String v = getStringValue(key); + if (v == null) { + return null; + } + return Color.decode(v); + } catch (Exception e) { + } + return null; + } + + public synchronized Color getColorValue(String key, Color defaultValue) + { + Color v = getColorValue(key); + return v != null ? v : defaultValue; + } +} diff --git a/src/main/java/geoinfo/map/myMap/AWTLabelUtil.java b/src/main/java/geoinfo/map/myMap/AWTLabelUtil.java new file mode 100644 index 00000000..f0604002 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/AWTLabelUtil.java @@ -0,0 +1,5 @@ +package geoinfo.map.myMap; + +public class AWTLabelUtil { + +} diff --git a/src/main/java/geoinfo/map/myMap/AttributeList.java b/src/main/java/geoinfo/map/myMap/AttributeList.java new file mode 100644 index 00000000..05b654ca --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/AttributeList.java @@ -0,0 +1,83 @@ +package geoinfo.map.myMap; + +import java.lang.reflect.Array; +import java.util.AbstractList; + +public class AttributeList extends AbstractList +{ + final Object ARRAY; + final int OFFSET; + final int LEN; + final int SIZE; + final int START; + final int END; + final int STEP; + + public AttributeList(Object array) + { + this(array, 0, 1); + } + + public AttributeList(Object array, int offset, int len) { + this(array, offset, len, 0, Array.getLength(array)); + } + + public AttributeList(Object array, int offset, int len, int start, int end) { + this.START = start; + this.END = end; + this.ARRAY = array; + this.OFFSET = offset; + this.LEN = len; + this.SIZE = (Math.abs(this.START - this.END) / this.LEN); + this.STEP = (this.START < this.END ? this.LEN : -this.LEN); + + if (!this.ARRAY.getClass().isArray()) { + throw new IllegalArgumentException("Provided argument was not an array"); + } + if (Array.getLength(this.ARRAY) % this.LEN != 0) + throw new IllegalArgumentException( + "You have requested Coordiantes of " + this.LEN + " ordinates. " + + "This is inconsistent with an array of length " + Array.getLength(this.ARRAY)); + } + + public Object get(int index) + { + rangeCheck(index); + return Array.get(this.ARRAY, this.START + this.STEP * index + this.OFFSET); + } + + public double getDouble(int index) { + rangeCheck(index); + return Array.getDouble(this.ARRAY, this.START + this.STEP * index + this.OFFSET); + } + public String getString(int index) { + rangeCheck(index); + return Array.get(this.ARRAY, this.START + this.STEP * index + this.OFFSET).toString(); + } + public double[] toDoubleArray() { + double[] array = new double[size()]; + for (int i = 0; i < size(); i++) { + array[i] = getDouble(i); + } + return array; + } + public Object[] toObjectArray() { + Object[] array = new Object[size()]; + for (int i = 0; i < size(); i++) { + array[i] = get(i); + } + return array; + } + + private void rangeCheck(int index) + { + if (index >= this.SIZE) + throw new IndexOutOfBoundsException( + "Index: " + index + ", Size: " + this.SIZE); + } + + public int size() + { + return this.SIZE; + } +} \ 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 new file mode 100644 index 00000000..90d61e22 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/CRSMngr.java @@ -0,0 +1,49 @@ +package geoinfo.map.myMap; + +import java.util.ArrayList; +import java.util.Iterator; +import org.geotools.factory.GeoTools; +import org.geotools.factory.Hints; +import org.geotools.referencing.CRS; +import org.geotools.referencing.ReferencingFactoryFinder; +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); + + 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)); + } +} diff --git a/src/main/java/geoinfo/map/myMap/CategorizeBinding110.java b/src/main/java/geoinfo/map/myMap/CategorizeBinding110.java new file mode 100644 index 00000000..d4dfcbca --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/CategorizeBinding110.java @@ -0,0 +1,82 @@ +package geoinfo.map.myMap; + + + +import java.awt.Color; +import java.util.List; +import javax.xml.namespace.QName; +import org.geotools.se.v1_1.SE; +import org.geotools.styling.ColorMap; +import org.geotools.styling.ColorMapEntry; +import org.geotools.styling.StyleFactory; +import org.geotools.xml.AbstractComplexBinding; +import org.geotools.xml.ElementInstance; +import org.geotools.xml.InstanceComponent; +import org.geotools.xml.Node; +import org.opengis.filter.FilterFactory; + +public class CategorizeBinding110 extends AbstractComplexBinding +{ + StyleFactory styleFactory; + FilterFactory filterFactory; + + public CategorizeBinding110(StyleFactory styleFactory, FilterFactory filterFactory) + { + this.styleFactory = styleFactory; + this.filterFactory = filterFactory; + } + + public QName getTarget() + { + return SE.Categorize; + } + + public Class getType() + { + return ColorMap.class; + } + + public Object parse(ElementInstance instance, Node node, Object value) + throws Exception + { + ColorMap map = this.styleFactory.createColorMap(); + + String type = (String)node.getAttributeValue("type"); + if ((type == null) || (type.equalsIgnoreCase("intervals"))) + map.setType(2); + else { + map.setType(3); + } + + List children = node.getChildren(); + int i = 0; + while (!"Threshold".equals(((Node)children.get(i)).getComponent().getName())) { + i++; + } + + while (i < children.size()) { + ColorMapEntry entry = this.styleFactory.createColorMapEntry(); + + double quantity = Double.parseDouble(((Node)children.get(i)).getValue().toString()); + entry.setQuantity(this.filterFactory.literal(quantity)); + + if (i + 1 >= children.size()) { + throw new IllegalArgumentException("Incorrectly specified color map Threshold/Value pair"); + } + + String colorStr = ((Node)children.get(i + 1)).getValue().toString(); + Color color = ServerUtil.getColorFromHex(colorStr); + + double opacity = color.getAlpha() / 255.0D; + + entry.setOpacity(this.filterFactory.literal(String.format("%.2f", new Object[] { Double.valueOf(opacity) }))); + entry.setColor(this.filterFactory.literal(ServerUtil.getHexFromColor(color))); + + map.addColorMapEntry(entry); + + i += 2; + } + + return map; + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/ConnJDBC.java b/src/main/java/geoinfo/map/myMap/ConnJDBC.java new file mode 100644 index 00000000..07ba8dd7 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ConnJDBC.java @@ -0,0 +1,5 @@ +package geoinfo.map.myMap; + +public class ConnJDBC { + +} diff --git a/src/main/java/geoinfo/map/myMap/ConnMngr.java b/src/main/java/geoinfo/map/myMap/ConnMngr.java new file mode 100644 index 00000000..7f1ba99e --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ConnMngr.java @@ -0,0 +1,5 @@ +package geoinfo.map.myMap; + +public class ConnMngr { + +} diff --git a/src/main/java/geoinfo/map/myMap/CoordinateAccess.java b/src/main/java/geoinfo/map/myMap/CoordinateAccess.java new file mode 100644 index 00000000..3f8a01c1 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/CoordinateAccess.java @@ -0,0 +1,34 @@ +package geoinfo.map.myMap; + +import com.vividsolutions.jts.geom.CoordinateSequence; + +public abstract interface CoordinateAccess extends CoordinateSequence +{ + public abstract int getDimension(); + + public abstract int getNumAttributes(); + + public abstract double getOrdinate(int paramInt1, int paramInt2); + + public abstract Object getAttribute(int paramInt1, int paramInt2); + + public abstract void setOrdinate(int paramInt1, int paramInt2, double paramDouble); + + public abstract void setAttribute(int paramInt1, int paramInt2, Object paramObject); + + public abstract double[] toOrdinateArray(int paramInt); + + public abstract Object[] toAttributeArray(int paramInt); + + public abstract void setOrdinateArray(int paramInt, double[] paramArrayOfDouble); + + public abstract void setAttributeArray(int paramInt, Object paramObject); + + public abstract double[][] toOrdinateArrays(); + + public abstract Object[] toAttributeArrays(); + + public abstract void setCoordinateArrays(double[][] paramArrayOfDouble, Object[] paramArrayOfObject); + + public abstract void setAt(int paramInt, double[] paramArrayOfDouble, Object[] paramArrayOfObject); +} diff --git a/src/main/java/geoinfo/map/myMap/CoordinateAccessFactory.java b/src/main/java/geoinfo/map/myMap/CoordinateAccessFactory.java new file mode 100644 index 00000000..690b9ff5 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/CoordinateAccessFactory.java @@ -0,0 +1,12 @@ +package geoinfo.map.myMap; + +import com.vividsolutions.jts.geom.CoordinateSequenceFactory; + +public abstract interface CoordinateAccessFactory extends CoordinateSequenceFactory +{ + public abstract CoordinateAccess create(double[][] paramArrayOfDouble, Object[] paramArrayOfObject); + + public abstract int getDimension(); + + public abstract int getNumAttributes(); +} diff --git a/src/main/java/geoinfo/map/myMap/Coordinates.java b/src/main/java/geoinfo/map/myMap/Coordinates.java new file mode 100644 index 00000000..7b63f38d --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/Coordinates.java @@ -0,0 +1,255 @@ +package geoinfo.map.myMap; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.CoordinateSequenceFactory; +import com.vividsolutions.jts.geom.CoordinateSequences; +import com.vividsolutions.jts.geom.PrecisionModel; +import java.io.PrintStream; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.util.List; + +public class Coordinates +{ + public static CoordinateSequence subList(CoordinateSequenceFactory factory, CoordinateSequence sequence, int fromIndex, int toIndex) + { + if ((fromIndex == 0) && (toIndex == sequence.size())) { + return sequence; + } + + if ((sequence instanceof List)) { + List sublist = ((List)sequence).subList(fromIndex, toIndex); + + if ((sublist instanceof CoordinateSequence)) { + return (CoordinateSequence)sublist; + } + } + + if ((sequence instanceof CoordinateAccess)) { + CoordinateAccess access = (CoordinateAccess)sequence; + double[][] coordArray = access.toOrdinateArrays(); + Object[] attributeArray = access.toAttributeArrays(); + + double[][] subCoordArray = new double[access.getDimension()][]; + Object[][] subAttributeArray = new Object[access.getNumAttributes()][]; + + for (int i = 0; i < access.getDimension(); i++) { + subCoordArray[i] = new OrdinateList(coordArray[i], 0, 1, + fromIndex, toIndex).toDoubleArray(); + } + + for (int i = 0; i < access.getNumAttributes(); i++) { + subAttributeArray[i] = new AttributeList(attributeArray[i], 0, + 1, fromIndex, toIndex).toObjectArray(); + } + + System.out.println("subCoordArray.length = " + subCoordArray.length); + System.out.println("subCoordArray: "); + System.out.print("X "); + + for (int p = 0; p < subCoordArray[0].length; p++) { + System.out.print(subCoordArray[0][p] + " "); + } + System.out.print("\nY "); + + for (int p = 0; p < subCoordArray[1].length; p++) { + System.out.print(subCoordArray[1][p] + " "); + } + System.out.println(""); + + System.out.println("subAttributeArray.length = " + + subAttributeArray.length); + System.out.println("subAttributeArray: "); + System.out.print("Z "); + + for (int p = 0; p < subAttributeArray[0].length; p++) { + System.out.print(subAttributeArray[0][p] + " "); + } + System.out.print("\nT "); + + for (int p = 0; p < subAttributeArray[1].length; p++) { + System.out.print(subAttributeArray[1][p] + " "); + } + System.out.println(""); + + CoordinateAccess c = ((CoordinateAccessFactory)factory) + .create(subCoordArray, subAttributeArray); + + return c; + } + + int size = toIndex - fromIndex; + CoordinateSequence newSeq = factory.create(size, sequence.getDimension()); + //CoordinateSequences.copy(sequence, fromIndex, newSeq, 0, size); + System.out.println("에러: CoordinateSequences.copy(sequence, fromIndex, newSeq, 0, size);"); + return newSeq; + } + + public static CoordinateSequence reverse(CoordinateSequenceFactory factory, CoordinateSequence sequence) + { + if ((sequence instanceof CoordinateAccess)) { + CoordinateAccess access = (CoordinateAccess)sequence; + double[][] coordArray = access.toOrdinateArrays(); + Object[] attributeArray = access.toAttributeArrays(); + + double[][] subCoordArray = new double[access.getDimension()][]; + Object[][] subAttributeArray = new Object[access.getNumAttributes()][]; + + for (int i = 0; i < access.getDimension(); i++) { + subCoordArray[i] = new OrdinateList(coordArray[i], 0, 1, + access.size() - 1, -1).toDoubleArray(); + } + + for (int i = 0; i < access.getNumAttributes(); i++) { + subAttributeArray[i] = new AttributeList(attributeArray[i], 0, + 1, access.size() - 1, -1).toObjectArray(); + } + + CoordinateAccess c = ((CoordinateAccessFactory)factory) + .create(subCoordArray, subAttributeArray); + + return c; + } + + CoordinateSequence revSeq = factory.create(sequence); + CoordinateSequences.reverse(revSeq); + return revSeq; + } + + public static String toString(CoordinateSequence cs, int coordinate, NumberFormat nf) + { + StringBuffer buf = new StringBuffer(); + append(buf, cs, coordinate, nf); + + return buf.toString(); + } + + public static void append(StringBuffer buf, CoordinateSequence cs, int coordinate, NumberFormat nf) + { + if ((cs instanceof CoordinateAccess)) { + CoordinateAccess ca = (CoordinateAccess)cs; + append(buf, ca, coordinate, LEN(ca), nf); + } else { + append(buf, cs, coordinate, LEN(cs), nf); + } + } + + public static void append(StringBuffer buf, CoordinateSequence cs, int coordinate, int LEN, NumberFormat nf) + { + Coordinate c = cs.getCoordinate(coordinate); + buf.append(nf.format(c.x)); + buf.append(" "); + buf.append(nf.format(c.y)); + + if (LEN == 3) { + buf.append(" "); + buf.append(nf.format(c.z)); + } + } + + public static void append(StringBuffer buf, CoordinateAccess ca, int coordinate, int LEN, NumberFormat nf) + { + buf.append(nf.format(ca.getOrdinate(coordinate, 0))); + + for (int i = 1; i < LEN; i++) { + buf.append(" "); + buf.append(nf.format(ca.getOrdinate(coordinate, i))); + } + } + + public static int LEN(CoordinateSequence cs) { + return D(cs) + L(cs); + } + + public static int D(CoordinateSequence cs) { + if ((cs instanceof CoordinateAccess)) { + return ((CoordinateAccess)cs).getDimension(); + } + + if (cs.size() > 0) { + return Double.isNaN(cs.getCoordinate(0).z) ? 2 : 3; + } + + return 3; + } + + public static int L(CoordinateSequence cs) { + if ((cs instanceof CoordinateAccess)) { + return ((CoordinateAccess)cs).getNumAttributes(); + } + + return 0; + } + + public static NumberFormat format(PrecisionModel pm) { + DecimalFormatSymbols symbols = new DecimalFormatSymbols(); + symbols.setNaN("NaN"); + + DecimalFormat f = new DecimalFormat(); + f.setDecimalFormatSymbols(symbols); + + if (pm == null) { + f.setMaximumFractionDigits(0); + + return f; + } + + f.setMinimumFractionDigits(0); + f.setMaximumFractionDigits(pm.getMaximumSignificantDigits()); + + return f; + } + + public static String toString(CoordinateSequence cs, PrecisionModel pm) { + StringBuffer buf = new StringBuffer(); + append(buf, cs, format(pm)); + + return buf.toString(); + } + + public static void append(StringBuffer buf, CoordinateSequence cs, NumberFormat nf) + { + if ((cs instanceof CoordinateAccess)) { + append(buf, (CoordinateAccess)cs, nf); + } else { + int LEN = LEN(cs); + + if (cs.size() == 0) { + return; + } + + append(buf, cs, 0, LEN, nf); + + if (cs.size() == 1) { + return; + } + + for (int i = 1; i < cs.size(); i++) { + buf.append(", "); + append(buf, cs, i, LEN, nf); + } + } + } + + public static void append(StringBuffer buf, CoordinateAccess ca, NumberFormat nf) + { + int LEN = LEN(ca); + + if (ca.size() == 0) { + return; + } + + append(buf, ca, 0, LEN, nf); + + if (ca.size() == 1) { + return; + } + + for (int i = 1; i < ca.size(); i++) { + buf.append(", "); + append(buf, ca, i, LEN, nf); + } + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/EncryptUtil.java b/src/main/java/geoinfo/map/myMap/EncryptUtil.java new file mode 100644 index 00000000..172a9402 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/EncryptUtil.java @@ -0,0 +1,68 @@ +package geoinfo.map.myMap; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.security.GeneralSecurityException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.KeyException; +import java.security.NoSuchAlgorithmException; +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import org.geotools.data.Base64; + +public class EncryptUtil +{ + private static final String characterEncoding = "UTF-8"; + private static final String cipherTransformation = "AES/CBC/PKCS5Padding"; + private static final String aesEncryptionAlgorithm = "AES"; + public static final String ENCRYPTIONKEY = "wldhxn"; + + private static byte[] decrypt(byte[] cipherText, byte[] key, byte[] initialVector) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException + { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec secretKeySpecy = new SecretKeySpec(key, "AES"); + IvParameterSpec ivParameterSpec = new IvParameterSpec(initialVector); + cipher.init(2, secretKeySpecy, ivParameterSpec); + cipherText = cipher.doFinal(cipherText); + return cipherText; + } + + private static byte[] encrypt(byte[] plainText, byte[] key, byte[] initialVector) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException + { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES"); + IvParameterSpec ivParameterSpec = new IvParameterSpec(initialVector); + cipher.init(1, secretKeySpec, ivParameterSpec); + plainText = cipher.doFinal(plainText); + return plainText; + } + + private static byte[] getKeyBytes(String key) throws UnsupportedEncodingException { + byte[] keyBytes = new byte[16]; + byte[] parameterKeyBytes = key.getBytes("UTF-8"); + System.arraycopy(parameterKeyBytes, 0, keyBytes, 0, Math.min(parameterKeyBytes.length, keyBytes.length)); + return keyBytes; + } + + public static String encrypt(String plainText, String key) + throws UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException + { + byte[] plainTextbytes = plainText.getBytes("UTF-8"); + byte[] keyBytes = getKeyBytes(key); + return Base64.encodeBytes(encrypt(plainTextbytes, keyBytes, keyBytes)); + } + + public static String decrypt(String encryptedText, String key) + throws KeyException, GeneralSecurityException, GeneralSecurityException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, IOException + { + byte[] cipheredBytes = Base64.decode(encryptedText); + byte[] keyBytes = getKeyBytes(key); + return new String(decrypt(cipheredBytes, keyBytes, keyBytes), "UTF-8"); + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/ExO2ImgLayer.java b/src/main/java/geoinfo/map/myMap/ExO2ImgLayer.java new file mode 100644 index 00000000..ef1b32e2 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ExO2ImgLayer.java @@ -0,0 +1,52 @@ +package geoinfo.map.myMap; + +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.map.DirectLayer; +import org.geotools.map.MapContent; +import org.geotools.map.MapViewport; +import org.geotools.referencing.CRS; + +public class ExO2ImgLayer extends DirectLayer +{ + private O2ImgLayer imgLayer; + private ReferencedEnvelope WMS_BBOX; + private int WMS_WIDTH; + private int WMS_HEIGHT; + + public ExO2ImgLayer(O2ImgLayer layer, AVList params) + throws Exception + { + this.imgLayer = layer; + + this.WMS_BBOX = ((ReferencedEnvelope)params.getValue("request.wms.bbox")); + + if (!CRS.equalsIgnoreMetadata( + layer.getCRS(), + this.WMS_BBOX.getCoordinateReferenceSystem())) { + this.WMS_BBOX = this.WMS_BBOX.transform(layer.getCRS(), true); + } + + this.WMS_WIDTH = params.getIntegerValue("request.wms.width").intValue(); + this.WMS_HEIGHT = params.getIntegerValue("request.wms.height").intValue(); + } + + public ReferencedEnvelope getBounds() + { + return this.imgLayer.getBBox(); + } + + public void draw(Graphics2D graphics, MapContent map, MapViewport viewport) + { + try + { + BufferedImage img = O2LayerUtil.getMap(this.imgLayer.getLevelSet(), this.WMS_BBOX, this.WMS_WIDTH, this.WMS_HEIGHT); + graphics.drawImage(img, null, 0, 0); + } + catch (Exception e) + { + LogMngr.getInstance().logError("[RENDER]", "Fail to render O2ImgLayer :: " + e); + } + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/ExWMSLayer.java b/src/main/java/geoinfo/map/myMap/ExWMSLayer.java new file mode 100644 index 00000000..adee63bc --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ExWMSLayer.java @@ -0,0 +1,152 @@ +package geoinfo.map.myMap; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.net.MalformedURLException; +import java.net.URL; +import javax.imageio.ImageIO; +import org.geotools.data.ows.HTTPResponse; +import org.geotools.data.ows.SimpleHttpClient; +import org.geotools.geometry.jts.ReferencedEnvelope; +import org.geotools.map.DirectLayer; +import org.geotools.map.MapContent; +import org.geotools.map.MapViewport; +import org.geotools.referencing.CRS; +import org.geotools.styling.StyledLayerDescriptor; + +public class ExWMSLayer extends DirectLayer +{ + final String WMS_LAYERS; + ReferencedEnvelope WMS_BBOX; + int WMS_WIDTH; + int WMS_HEIGHT; + final String WMS_FORMAT; + final String WMS_SERVICE; + final String WMS_VERSION; + final String WMS_REQUEST; + final boolean WMS_TRANSPARENT; + final Color WMS_BGCOLOR; + final String WMS_STYLES; + final StyledLayerDescriptor WMS_SLD; + private final URL layerURL; + private final ReferencedEnvelope layerBounds; + + public ExWMSLayer(LinkLayer layer, AVList params) + throws Exception + { + if ((layer == null) || (params == null)) { + throw new IllegalArgumentException("WMS request parameter is null."); + } + + this.layerBounds = layer.getBBox(); + this.layerURL = layer.getServiceURL(); + this.WMS_LAYERS = layer.getServiceLayerNames(); + + this.WMS_BBOX = ((ReferencedEnvelope)params.getValue("request.wms.bbox")); + + if (!CRS.equalsIgnoreMetadata(this.layerBounds.getCoordinateReferenceSystem(), + this.WMS_BBOX.getCoordinateReferenceSystem())) { + this.WMS_BBOX = this.WMS_BBOX.transform(this.layerBounds.getCoordinateReferenceSystem(), true); + } + this.WMS_WIDTH = params.getIntegerValue("request.wms.width").intValue(); + this.WMS_HEIGHT = params.getIntegerValue("request.wms.height").intValue(); + + this.WMS_SERVICE = params.getStringValue("request.wms.service", "WMS"); + this.WMS_FORMAT = params.getStringValue("request.wms.format", "image/jpeg"); + this.WMS_VERSION = params.getStringValue("request.wms.version", "1.3.0"); + this.WMS_REQUEST = params.getStringValue("request.wms.request", "GetMap"); + this.WMS_TRANSPARENT = params.getBooleanValue("request.wms.transparent", Boolean.valueOf(false)).booleanValue(); + this.WMS_BGCOLOR = params.getColorValue("request.wms.bgcolor", Color.WHITE); + + if (ServerUtil.isNullString(params.getStringValue("request.wms.styles"))) + { + String[] layerNames = this.WMS_LAYERS.split(","); + if (layerNames.length == 1) { + this.WMS_STYLES = ""; + } else { + String styles = ""; + for (int i = 1; i < layerNames.length; i++) { + styles = styles.concat(","); + } + this.WMS_STYLES = styles; + } + } + else + { + String styleStr = params.getStringValue("request.wms.styles"); + + String[] layerNames = this.WMS_LAYERS.split(","); + if (layerNames.length == 1) { + this.WMS_STYLES = styleStr; + } else { + String styles = styleStr; + for (int i = 1; i < layerNames.length; i++) { + styles = styles.concat(","); + styles = styles.concat(styleStr); + } + this.WMS_STYLES = styles; + } + + } + + this.WMS_SLD = ((StyledLayerDescriptor)params.getValue("request.wms.sld")); + } + + private URL getRequest() throws MalformedURLException + { + StringBuffer sb = new StringBuffer(); + + sb.append("?"); + sb.append("SERVICE=").append(this.WMS_SERVICE).append("&"); + sb.append("VERSION=").append(this.WMS_VERSION).append("&"); + sb.append("REQUEST=").append(this.WMS_REQUEST).append("&"); + + sb.append("LAYERS=").append(this.WMS_LAYERS).append("&"); + sb.append("STYLES=").append(this.WMS_STYLES).append("&"); + + if (this.WMS_VERSION.compareTo("1.3.0") >= 0) + sb.append("CRS=").append(this.WMS_BBOX.getCoordinateReferenceSystem().getIdentifiers().toArray()[0]).append("&"); + else { + sb.append("SRS=").append(this.WMS_BBOX.getCoordinateReferenceSystem().getIdentifiers().toArray()[0]).append("&"); + } + + sb.append("BBOX=").append(this.WMS_BBOX.getMinX()).append(",").append(this.WMS_BBOX.getMinY()).append(",") + .append(this.WMS_BBOX.getMaxX()).append(",").append(this.WMS_BBOX.getMaxY()).append("&"); + + sb.append("WIDTH=").append(this.WMS_WIDTH).append("&"); + sb.append("HEIGHT=").append(this.WMS_HEIGHT).append("&"); + + sb.append("FORMAT=").append(this.WMS_FORMAT).append("&"); + sb.append("TRANSPARENT=").append(this.WMS_TRANSPARENT).append("&"); + + sb.append("BGCOLOR=").append(ServerUtil.getHexFromColor(this.WMS_BGCOLOR)); + + return new URL(this.layerURL, sb.toString()); + } + + public void draw(Graphics2D graphics, MapContent map, MapViewport viewport) + { + try + { + URL url = getRequest(); + + SimpleHttpClient client = new SimpleHttpClient(); + HTTPResponse reponse = client.get(url); + + BufferedImage image = ImageIO.read(reponse.getResponseStream()); + + graphics.drawImage(image, 0, 0, null); + } + catch (Exception e) + { + LogMngr.getInstance().logError("[RENDER]", + "Fail to render WMSLayer :: " + e); + } + } + + public ReferencedEnvelope getBounds() + { + return this.layerBounds; + } +} \ No newline at end of file diff --git a/src/main/java/geoinfo/map/myMap/ExtractRasterStyleVisitor.java b/src/main/java/geoinfo/map/myMap/ExtractRasterStyleVisitor.java new file mode 100644 index 00000000..31f9caa8 --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/ExtractRasterStyleVisitor.java @@ -0,0 +1,56 @@ +package geoinfo.map.myMap; + +import java.util.List; +import java.util.Stack; +import org.geotools.styling.RasterSymbolizerImpl; +import org.geotools.styling.Rule; +import org.geotools.styling.StyleFactory; +import org.geotools.styling.Symbolizer; +import org.geotools.styling.visitor.DuplicatingStyleVisitor; +import org.opengis.filter.Filter; +import org.opengis.style.Description; +import org.opengis.style.GraphicLegend; + +public class ExtractRasterStyleVisitor extends DuplicatingStyleVisitor +{ + public void visit(Rule rule) + { + Rule copy = this.sf.createRule(); + + Symbolizer[] symsCopy = rule.getSymbolizers(); + for (int i = 0; i < symsCopy.length; i++) + { + if ((symsCopy[i] instanceof RasterSymbolizerImpl)) { + copy.symbolizers().add(copy(symsCopy[i])); + } + + } + + Filter filterCopy = null; + if (rule.getFilter() != null) { + Filter filter = rule.getFilter(); + filterCopy = copy(filter); + } + copy.setFilter(filterCopy); + + copy.setElseFilter(rule.isElseFilter()); + + copy.setMaxScaleDenominator(rule.getMaxScaleDenominator()); + copy.setMinScaleDenominator(rule.getMinScaleDenominator()); + + GraphicLegend legendCopy = rule.getLegend(); + if (legendCopy != null) { + copy.setLegend(legendCopy); + } + + Description descCopy = rule.getDescription(); + copy.setDescription(copy(descCopy)); + + copy.setName(rule.getName()); + + if ((this.STRICT) && (!copy.equals(rule))) { + throw new IllegalStateException("Was unable to duplicate provided Rule:" + rule); + } + this.pages.push(copy); + } +} \ 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 new file mode 100644 index 00000000..d9a2909a --- /dev/null +++ b/src/main/java/geoinfo/map/myMap/FeatureLayer.java @@ -0,0 +1,491 @@ +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; +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; + +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 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()); + } + + tempStore.put(style.getName(), style); + if ((defaultStyle != null) && + (defaultStyle.getName().equals(style.getName()))) { + defaultStyle = null; + } + + if (style.isDefault()) + { + if (defaultStyle == null) { + defaultStyle = style; + } else { + defaultStyle.setDefault(false); + defaultStyle = style; + } + + } + + } + + } + + if (defaultStyle == null) + { + if (getCurrentStyle() == null) + { + if (tempStore.isEmpty()) { + defaultStyle = StyleMngr.getDefaultUserStyle(getLayerType(), getServerName(), getSourceName(), getName()); + } else { + defaultStyle = (Style)tempStore.get(getName()); + if (defaultStyle == null) + defaultStyle = (Style)tempStore.values().iterator().next(); + } + } + else + { + defaultStyle = (Style)tempStore.get(getCurrentStyle().getName()); + if (defaultStyle == null) { + defaultStyle = getCurrentStyle(); + } + } + } + + setCurrentStyle(defaultStyle); + + this.styleStore.putAll(tempStore); + + if (write) + StyleMngr.writeServiceSLD110(getStyleSLD()); + } + + public synchronized void initServiceStyle(StyledLayer styledLayer, boolean write) + { + Style defaultStyle = null; + ConcurrentHashMap tempStore = new ConcurrentHashMap(); + + if ((!ServerUtil.isNullString(styledLayer.getName())) && + (!styledLayer.getName().equalsIgnoreCase(getName()))) { + return; + } + + Iterator iterStyle = getStyleIterator(styledLayer); + while (iterStyle.hasNext()) { + Style style = (Style)iterStyle.next(); + + if (!(style instanceof NamedStyle)) + { + if (ServerUtil.isNullString(style.getName())) + style.setName(getName()); + else { + style.setName(style.getName().trim().toUpperCase()); + } + + tempStore.put(style.getName(), style); + + if ((defaultStyle != null) && + (defaultStyle.getName().equals(style.getName()))) { + defaultStyle = null; + } + + if (style.isDefault()) + { + if (defaultStyle == null) { + defaultStyle = style; + } else { + defaultStyle.setDefault(false); + defaultStyle = style; + } + + } + + } + + } + + if (defaultStyle == null) + { + if (getCurrentStyle() == null) + { + if (tempStore.isEmpty()) { + defaultStyle = StyleMngr.getDefaultUserStyle(getLayerType(), getServerName(), getSourceName(), getName()); + } else { + defaultStyle = (Style)tempStore.get(getName()); + if (defaultStyle == null) + defaultStyle = (Style)tempStore.values().iterator().next(); + } + } + else + { + defaultStyle = (Style)tempStore.get(getCurrentStyle().getName()); + if (defaultStyle == null) { + defaultStyle = getCurrentStyle(); + } + } + } + + setCurrentStyle(defaultStyle); + + this.styleStore.putAll(tempStore); + + if (write) + StyleMngr.writeServiceSLD110(getStyleSLD()); + } + + public synchronized void initServiceStyle(Style style, boolean write) + { + if ((style == null) || ((style instanceof NamedStyle))) { + return; + } + + if (ServerUtil.isNullString(style.getName())) + style.setName(getName()); + else { + style.setName(style.getName().trim().toUpperCase()); + } + + this.styleStore.put(style.getName(), style); + + if ((style.isDefault()) || (style.getName().equalsIgnoreCase(getCurrentStyle().getName()))) { + setCurrentStyle(style); + } + + if (write) + StyleMngr.writeServiceSLD110(getStyleSLD()); + } + + private Iterator