From 94ae08701bbd7585a0b7e5a92d1975965a503c03 Mon Sep 17 00:00:00 2001 From: Dennis Kao <ulysseskao@gmail.com> Date: Wed, 15 Jan 2014 11:28:52 +0800 Subject: [PATCH] Merge branch 'origin/2.1.x' --- xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java | 57 ++++++++++++++++++++------------------------------------- 1 files changed, 20 insertions(+), 37 deletions(-) diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java index 2996936..09694ab 100644 --- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java +++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java @@ -15,24 +15,20 @@ * * @author Ulysses * @version 0.1 - * @since 2006/5/18 �W�� 11:34:59 + * @since 2006/5/18 �W�� 11:34:59 */ -public class LineElement extends Element implements GeometryConverter -{ +public class LineElement extends Element implements GeometryConverter { private static final Logger logger = Logger.getLogger(LineElement.class); - public LineElement(byte[] raw) - { + LineElement(byte[] raw) { super(raw); } - public Coordinate getCentroid(double dTolerance) - { + public Coordinate getCentroid(double dTolerance) { return null; } - public Coordinate getEndPoint() - { + public Coordinate getEndPoint() { int endX = ((raw[22] << 16) & 0xffff0000) | (raw[23] & 0x0000ffff); int endY = ((raw[24] << 16) & 0xffff0000) | (raw[25] & 0x0000ffff); @@ -43,18 +39,15 @@ return new Coordinate(x, y); } - public Coordinate getNormal() - { + public Coordinate getNormal() { return null; } - public Coordinate getOrigin() - { + public Coordinate getOrigin() { return null; } - public Coordinate getStartPoint() - { + public Coordinate getStartPoint() { int startX = ((raw[18] << 16) & 0xffff0000); startX = startX + (raw[19] & 0x0000ffff); @@ -68,28 +61,24 @@ return new Coordinate(x, y); } - public Coordinate getVertex(int index) - { + public Coordinate getVertex(int index) { return (index == 0) - ? getStartPoint() - : getEndPoint(); + ? getStartPoint() + : getEndPoint(); } - public double getLength() - { + public double getLength() { Coordinate p1 = getStartPoint(); Coordinate p2 = getEndPoint(); return DgnUtility.getLength(p1.x, p1.y, p2.x, p2.y); } - public Coordinate pointAtDistance(double dDistance, double dTolerance) - { + public Coordinate pointAtDistance(double dDistance, double dTolerance) { return null; } - public Coordinate[] getVertices() - { + public Coordinate[] getVertices() { Coordinate[] result = new Coordinate[2]; result[0] = getStartPoint(); @@ -98,32 +87,26 @@ return result; } - public Geometry toGeometry(GeometryFactory factory) - { + public Geometry toGeometry(GeometryFactory factory) { return factory.createLineString(getVertices()); } - public static class ElementHandler extends Element.ElementHandler - { + public static class ElementHandler extends Element.ElementHandler { private static ElementHandler instance = null; - public ElementHandler() - { + public ElementHandler() { super(ElementType.LINE); } - public static IElementHandler getInstance() - { - if (instance == null) - { + public static IElementHandler getInstance() { + if (instance == null) { instance = new ElementHandler(); } return instance; } - protected Element createElement(byte[] raw) - { + protected Element createElement(byte[] raw) { return new LineElement(raw); } } -- Gitblit v0.0.0-SNAPSHOT