| | |
| | | |
| | | //~--- 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; |
| | | |
| | | /** |
| | | * LineElement |
| | |
| | | */ |
| | | public class LineElement extends Element implements GeometryConverter |
| | | { |
| | | private static final Logger logger = Logger.getLogger(LineElement.class); |
| | | |
| | | public LineElement(byte[] raw) |
| | | { |
| | | super(raw); |
| | |
| | | int endY = ((raw[24] << 16) & 0xffff0000) | (raw[25] & 0x0000ffff); |
| | | |
| | | |
| | | double x = Utility.converUnitToCoord(endX); |
| | | double y = Utility.converUnitToCoord(endY); |
| | | double x = DgnUtility.converUnitToCoord(endX); |
| | | double y = DgnUtility.converUnitToCoord(endY); |
| | | |
| | | return new Coordinate(x, y); |
| | | } |
| | |
| | | int startX = ((raw[18] << 16) & 0xffff0000); |
| | | startX = startX + (raw[19] & 0x0000ffff); |
| | | |
| | | double x = Utility.converUnitToCoord(startX); |
| | | double x = DgnUtility.converUnitToCoord(startX); |
| | | int startY = ((raw[20] << 16) & 0xffff0000); |
| | | |
| | | startY = startY + (raw[21] & 0x0000ffff); |
| | | |
| | | double y = Utility.converUnitToCoord(startY); |
| | | double y = DgnUtility.converUnitToCoord(startY); |
| | | |
| | | return new Coordinate(x, y); |
| | | } |
| | |
| | | Coordinate p1 = getStartPoint(); |
| | | Coordinate p2 = getEndPoint(); |
| | | |
| | | return Utility.getLength(p1.x, p1.y, p2.x, p2.y); |
| | | return DgnUtility.getLength(p1.x, p1.y, p2.x, p2.y); |
| | | } |
| | | |
| | | public Coordinate pointAtDistance(double dDistance, double dTolerance) |