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