| | |
| | | |
| | | //~--- non-JDK imports -------------------------------------------------------- |
| | | |
| | | import org.apache.log4j.Logger; |
| | | |
| | | import com.vividsolutions.jts.geom.Coordinate; |
| | | import com.vividsolutions.jts.geom.Geometry; |
| | | import com.vividsolutions.jts.geom.GeometryFactory; |
| | | |
| | | import com.ximple.util.DgnUtility; |
| | | |
| | | /** |
| | | * LineStringElement |
| | |
| | | */ |
| | | public class LineStringElement extends Element implements GeometryConverter |
| | | { |
| | | private static final Logger logger = Logger.getLogger(LineStringElement.class); |
| | | |
| | | public LineStringElement(byte[] raw) |
| | | { |
| | | super(raw); |
| | |
| | | Coordinate p1 = vset[i - 1]; |
| | | Coordinate p2 = vset[i]; |
| | | |
| | | result += Utility.getLength(p1.x, p1.y, p2.x, p2.y); |
| | | result += DgnUtility.getLength(p1.x, p1.y, p2.x, p2.y); |
| | | } |
| | | |
| | | return result; |
| | |
| | | |
| | | x += (int) (raw[20 + (4 * index)] & 0x0000ffff); |
| | | |
| | | return Utility.converUnitToCoord(x); |
| | | return DgnUtility.converUnitToCoord(x); |
| | | } |
| | | |
| | | protected void setX(int index, double dx) |
| | | { |
| | | int newVal = Utility.converCoordToUnit(dx); |
| | | int newVal = DgnUtility.converCoordToUnit(dx); |
| | | |
| | | raw[19 + (4 * index)] = (short) (newVal >> 16 & 0x0000ffff); |
| | | raw[20 + (4 * index)] = (short) (newVal & 0x0000ffff); |
| | |
| | | |
| | | y = y + (int) (raw[22 + (4 * index)] & 0x0000ffff); |
| | | |
| | | return Utility.converUnitToCoord(y); |
| | | return DgnUtility.converUnitToCoord(y); |
| | | } |
| | | |
| | | protected void setY(int index, double dy) |
| | | { |
| | | int newVal = Utility.converCoordToUnit(dy); |
| | | int newVal = DgnUtility.converCoordToUnit(dy); |
| | | |
| | | raw[21 + (4 * index)] = (short) ((newVal >> 16) & 0x0000ffff); |
| | | raw[22 + (4 * index)] = (short) (newVal & 0x0000ffff); |