Mercurial > dive4elements > gnv-client
diff geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java @ 894:d674cef2ca0d
Using unix line endings only.
geo-backend/trunk@939 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 18 Apr 2010 09:22:38 +0000 |
parents | b757def3ff55 |
children | 02cd2935b5fa |
line wrap: on
line diff
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java Sat Apr 17 09:28:02 2010 +0000 +++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java Sun Apr 18 09:22:38 2010 +0000 @@ -1,84 +1,84 @@ -package de.intevation.gnv.geobackend.sde.datasources; - -import com.esri.sde.sdk.client.SDEPoint; -import com.esri.sde.sdk.client.SeError; -import com.esri.sde.sdk.client.SeException; - -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.Geometry; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.Point; -import com.vividsolutions.jts.geom.Polygon; - -import org.apache.log4j.Logger; - -/** - * The class <code>ArcSDEUtils</code> fulfills the following purposes: - * - * @author blume - * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> - */ -public class ArcSDEUtils { - - /** - * Default Logging instance - */ - private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class); - - /** - * Prints an SEEsception into the Logger of this Class - * @param exception - */ - public static void printError(SeException exception) { - - SeError error = exception.getSeError(); - - sLogger.debug("\n ArcSDE Error Number : " + error.getSdeError()); - sLogger.debug(" Error Description : " + error.getErrDesc()); - - int extError = error.getExtError(); - if (extError != 0) - sLogger.debug(" Extended Error Number : " + extError); - - String desc = error.getSdeErrMsg(); - if (desc != null && desc.length() != 0) - sLogger.debug(" Extended Error Description : " + desc); - - desc = error.getExtErrMsg(); - if (desc != null && desc.length() != 0) - sLogger.debug(" Extended Error Description : " + desc); - - sLogger.debug(exception); - - } - - /** - * Generate an SDEPoint-Array from a given Geometry. - * This Method did not put the Holes to the Array. - * @param g The Geometry which should be converted. - * @return an SDEPoint-Array from a given Ggeometry. - */ - public SDEPoint[] createPoints(Geometry g) { - sLogger.debug("createPoints()"); - Coordinate[] coords = null; - if (g instanceof Polygon) { - coords = ((Polygon) g).getCoordinates(); - }else if (g instanceof Point){ - coords = ((Point)g).getCoordinates(); - }else if (g instanceof LineString){ - coords = ((LineString)g).getCoordinates(); - }else{ - coords = g.getCoordinates(); - } - - if (coords != null){ - SDEPoint[] lSDEPoints = new SDEPoint[coords.length]; - for (int i = 0; i < coords.length; i++) { - lSDEPoints[i] = new SDEPoint(coords[i].x, coords[i].y); - } - return lSDEPoints; - }else{ - return null; - } - } -} +package de.intevation.gnv.geobackend.sde.datasources; + +import com.esri.sde.sdk.client.SDEPoint; +import com.esri.sde.sdk.client.SeError; +import com.esri.sde.sdk.client.SeException; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.geom.Polygon; + +import org.apache.log4j.Logger; + +/** + * The class <code>ArcSDEUtils</code> fulfills the following purposes: + * + * @author blume + * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> + */ +public class ArcSDEUtils { + + /** + * Default Logging instance + */ + private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class); + + /** + * Prints an SEEsception into the Logger of this Class + * @param exception + */ + public static void printError(SeException exception) { + + SeError error = exception.getSeError(); + + sLogger.debug("\n ArcSDE Error Number : " + error.getSdeError()); + sLogger.debug(" Error Description : " + error.getErrDesc()); + + int extError = error.getExtError(); + if (extError != 0) + sLogger.debug(" Extended Error Number : " + extError); + + String desc = error.getSdeErrMsg(); + if (desc != null && desc.length() != 0) + sLogger.debug(" Extended Error Description : " + desc); + + desc = error.getExtErrMsg(); + if (desc != null && desc.length() != 0) + sLogger.debug(" Extended Error Description : " + desc); + + sLogger.debug(exception); + + } + + /** + * Generate an SDEPoint-Array from a given Geometry. + * This Method did not put the Holes to the Array. + * @param g The Geometry which should be converted. + * @return an SDEPoint-Array from a given Ggeometry. + */ + public SDEPoint[] createPoints(Geometry g) { + sLogger.debug("createPoints()"); + Coordinate[] coords = null; + if (g instanceof Polygon) { + coords = ((Polygon) g).getCoordinates(); + }else if (g instanceof Point){ + coords = ((Point)g).getCoordinates(); + }else if (g instanceof LineString){ + coords = ((LineString)g).getCoordinates(); + }else{ + coords = g.getCoordinates(); + } + + if (coords != null){ + SDEPoint[] lSDEPoints = new SDEPoint[coords.length]; + for (int i = 0; i < coords.length; i++) { + lSDEPoints[i] = new SDEPoint(coords[i].x, coords[i].y); + } + return lSDEPoints; + }else{ + return null; + } + } +}