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/LineStringElement.java |   88 ++++++++++++++++---------------------------
 1 files changed, 33 insertions(+), 55 deletions(-)

diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java
index ce09145..7e82921 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java
@@ -15,61 +15,54 @@
  *
  * @author Ulysses
  * @version 0.1
- * @since 2006/5/18 �U�� 02:48:58
+ * @since 2006/5/18
  */
-public class LineStringElement extends Element implements GeometryConverter
-{
+public class LineStringElement extends Element implements GeometryConverter {
     private static final Logger logger = Logger.getLogger(LineStringElement.class);
 
-    public LineStringElement(byte[] raw)
-    {
+    LineStringElement(byte[] raw) {
         super(raw);
     }
 
-    public Coordinate getCentroid(double dTolerance)
-    {
+    public Coordinate getCentroid(double dTolerance) {
         return null;
     }
 
-    public Coordinate getEndPoint()
-    {
+    public Coordinate getEndPoint() {
         return new Coordinate(getX(getVerticeSize() - 1), getY(getVerticeSize() - 1));
     }
 
-    public Coordinate getNormal()
-    {
+    public Coordinate getNormal() {
         return null;
     }
 
-    public Coordinate getOrigin()
-    {
+    public Coordinate getOrigin() {
         return null;
     }
 
-    public Coordinate getStartPoint()
-    {
+    public Coordinate getStartPoint() {
         return new Coordinate(getX(0), getY(0));
     }
 
-    public Coordinate getVertex(int index)
-    {
+    public Coordinate getVertex(int index) {
         return (index == 0)
-                ? getStartPoint()
-                : getEndPoint();
+            ? getStartPoint()
+            : getEndPoint();
     }
 
-    public int getVerticeSize()
-    {
+    public int getVerticeSize() {
         return raw[18] & 0x0000ffff;
     }
 
-    public double getLength()
-    {
+    public void setVerticeSize(int size) {
+        raw[18] = (short) (size & 0x0000ffff);
+    }
+
+    public double getLength() {
         double result = 0.0;
         Coordinate[] vset = getVertices();
 
-        for (int i = 1; i < getVerticeSize(); i++)
-        {
+        for (int i = 1; i < getVerticeSize(); i++) {
             Coordinate p1 = vset[i - 1];
             Coordinate p2 = vset[i];
 
@@ -79,32 +72,26 @@
         return result;
     }
 
-    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[getVerticeSize()];
 
-        for (int i = 0; i < getVerticeSize(); i++)
-        {
+        for (int i = 0; i < getVerticeSize(); i++) {
             result[i] = new Coordinate(getX(i), getY(i));
         }
 
         return result;
     }
 
-    public Geometry toGeometry(GeometryFactory factory)
-    {
+    public Geometry toGeometry(GeometryFactory factory) {
         return factory.createLineString(getVertices());
     }
 
-    protected double getX(int index)
-    {
-        if ((index < 0) || (index > getVerticeSize()))
-        {
+    protected double getX(int index) {
+        if ((index < 0) || (index > getVerticeSize())) {
             return -1;
         }
 
@@ -115,18 +102,15 @@
         return DgnUtility.converUnitToCoord(x);
     }
 
-    protected void setX(int index, double dx)
-    {
+    protected void setX(int index, double dx) {
         int newVal = DgnUtility.converCoordToUnit(dx);
 
         raw[19 + (4 * index)] = (short) (newVal >> 16 & 0x0000ffff);
         raw[20 + (4 * index)] = (short) (newVal & 0x0000ffff);
     }
 
-    protected double getY(int index)
-    {
-        if ((index < 0) || (index > getVerticeSize()))
-        {
+    protected double getY(int index) {
+        if ((index < 0) || (index > getVerticeSize())) {
             return -1;
         }
 
@@ -136,35 +120,29 @@
         return DgnUtility.converUnitToCoord(y);
     }
 
-    protected void setY(int index, double dy)
-    {
+    protected void setY(int index, double dy) {
         int newVal = DgnUtility.converCoordToUnit(dy);
 
         raw[21 + (4 * index)] = (short) ((newVal >> 16) & 0x0000ffff);
         raw[22 + (4 * index)] = (short) (newVal & 0x0000ffff);
     }
 
-    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.LINESTRING);
         }
 
-        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 LineStringElement(raw);
         }
     }

--
Gitblit v0.0.0-SNAPSHOT