/** * Creates a polyline with one line segment. */ public Polyline(Point start, Point end) { m_impl = new MultiPathImpl(false, start.getDescription()); startPath(start); lineTo(end); }
public void startPath(Point3D point) { _initPathStartPoint(); m_moveToPoint.setXYZ(point); assignVertexDescription(m_moveToPoint.getDescription()); m_bPathStarted = true; }
public void startPath(Point point) { if (point.isEmpty()) throw new IllegalArgumentException();// throw new // IllegalArgumentException(); mergeVertexDescription(point.getDescription()); _initPathStartPoint(); point.copyTo(m_moveToPoint); // TODO check MultiPathImpl.cpp comment // "//the description will be merged later" // assignVertexDescription(m_moveToPoint.getDescription()); m_bPathStarted = true; }
/** * Creates a polyline with one line segment. */ public Polyline(Point start, Point end) { m_impl = new MultiPathImpl(false, start.getDescription()); startPath(start); lineTo(end); }
public void startPath(Point point) { if (point.isEmpty()) throw new IllegalArgumentException();// throw new // IllegalArgumentException(); mergeVertexDescription(point.getDescription()); _initPathStartPoint(); point.copyTo(m_moveToPoint); // TODO check MultiPathImpl.cpp comment // "//the description will be merged later" // assignVertexDescription(m_moveToPoint.getDescription()); m_bPathStarted = true; }
public void startPath(Point3D point) { _initPathStartPoint(); m_moveToPoint.setXYZ(point); assignVertexDescription(m_moveToPoint.getDescription()); m_bPathStarted = true; }
private Geometry bufferPoint_(Point point) { assert (m_distance > 0); Polygon resultPolygon = new Polygon(point.getDescription()); addCircle_((MultiPathImpl) resultPolygon._getImpl(), point); return setStrongSimple_(resultPolygon); }
private Geometry bufferPoint_(Point point) { assert (m_distance > 0); Polygon resultPolygon = new Polygon(point.getDescription()); addCircle_((MultiPathImpl) resultPolygon._getImpl(), point); return setStrongSimple_(resultPolygon); }
static Geometry pointSymDiffPoint_(Point point_a, Point point_b, double tolerance, ProgressTracker progress_tracker) { double tolerance_cluster = tolerance * Math.sqrt(2.0) * 1.00001; double tolerance_cluster_sq = tolerance_cluster * tolerance_cluster; Point2D pt_a = point_a.getXY(); Point2D pt_b = point_b.getXY(); MultiPoint multi_point = new MultiPoint(point_a.getDescription()); if (Point2D.sqrDistance(pt_a, pt_b) > tolerance_cluster_sq) { multi_point.add(point_a); multi_point.add(point_b); } return multi_point; }
static Geometry pointSymDiffPoint_(Point point_a, Point point_b, double tolerance, ProgressTracker progress_tracker) { double tolerance_cluster = tolerance * Math.sqrt(2.0) * 1.00001; double tolerance_cluster_sq = tolerance_cluster * tolerance_cluster; Point2D pt_a = point_a.getXY(); Point2D pt_b = point_b.getXY(); MultiPoint multi_point = new MultiPoint(point_a.getDescription()); if (Point2D.sqrDistance(pt_a, pt_b) > tolerance_cluster_sq) { multi_point.add(point_a); multi_point.add(point_b); } return multi_point; }
@Override public void setPoint(int index, Point src) { if (index < 0 || index >= m_pointCount) throw new IndexOutOfBoundsException(); Point point = src; if (src.isEmpty())// can not assign an empty point to a multipoint // vertex throw new IllegalArgumentException(); _verifyAllStreams();// verify all allocated streams are of necessary // size. VertexDescription vdin = point.getDescription(); for (int attributeIndex = 0; attributeIndex < vdin.getAttributeCount(); attributeIndex++) { int semantics = vdin.getSemantics(attributeIndex); int ncomp = VertexDescription.getComponentCount(semantics); for (int icomp = 0; icomp < ncomp; icomp++) { double v = point.getAttributeAsDbl(semantics, icomp); setAttribute(semantics, index, icomp, v); } } }
@Override public void setPoint(int index, Point src) { if (index < 0 || index >= m_pointCount) throw new IndexOutOfBoundsException(); Point point = src; if (src.isEmpty())// can not assign an empty point to a multipoint // vertex throw new IllegalArgumentException(); _verifyAllStreams();// verify all allocated streams are of necessary // size. VertexDescription vdin = point.getDescription(); for (int attributeIndex = 0; attributeIndex < vdin.getAttributeCount(); attributeIndex++) { int semantics = vdin.getSemantics(attributeIndex); int ncomp = VertexDescription.getComponentCount(semantics); for (int icomp = 0; icomp < ncomp; icomp++) { double v = point.getAttributeAsDbl(semantics, icomp); setAttribute(semantics, index, icomp, v); } } }
@Override public void setPointByVal(int index, Point src) { if (index < 0 || index >= m_pointCount) throw new GeometryException("index out of bounds"); Point point = src; if (src.isEmpty())// can not assign an empty point to a multipoint // vertex throw new IllegalArgumentException(); _verifyAllStreams();// verify all allocated streams are of necessary // size. VertexDescription vdin = point.getDescription(); for (int attributeIndex = 0; attributeIndex < vdin.getAttributeCount(); attributeIndex++) { int semantics = vdin._getSemanticsImpl(attributeIndex); int ncomp = VertexDescription.getComponentCount(semantics); for (int icomp = 0; icomp < ncomp; icomp++) { double v = point.getAttributeAsDbl(semantics, icomp); setAttribute(semantics, index, icomp, v); } } }
@Override public void setPointByVal(int index, Point src) { if (index < 0 || index >= m_pointCount) throw new GeometryException("index out of bounds"); Point point = src; if (src.isEmpty())// can not assign an empty point to a multipoint // vertex throw new IllegalArgumentException(); _verifyAllStreams();// verify all allocated streams are of necessary // size. VertexDescription vdin = point.getDescription(); for (int attributeIndex = 0; attributeIndex < vdin.getAttributeCount(); attributeIndex++) { int semantics = vdin._getSemanticsImpl(attributeIndex); int ncomp = VertexDescription.getComponentCount(semantics); for (int icomp = 0; icomp < ncomp; icomp++) { double v = point.getAttributeAsDbl(semantics, icomp); setAttribute(semantics, index, icomp, v); } } }
public void setGeometryByValue(Point point) throws ObjectStreamException { try { attribs = null; if (point == null) { descriptionBitMask = 1; } VertexDescription vd = point.getDescription(); descriptionBitMask = vd.m_semanticsBitArray; if (point.isEmpty()) { return; } attribs = new double[vd.getTotalComponentCount()]; attribs[0] = point.getX(); attribs[1] = point.getY(); int index = 2; for (int i = 1, n = vd.getAttributeCount(); i < n; i++) { int semantics = vd.getSemantics(i); int comps = VertexDescription.getComponentCount(semantics); for (int ord = 0; ord < comps; ord++) { attribs[index++] = point.getAttributeAsDbl(semantics, ord); } } } catch (Exception ex) { throw new InvalidObjectException("Cannot serialize this geometry"); } } }
public void setGeometryByValue(Point point) throws ObjectStreamException { try { attribs = null; if (point == null) { descriptionBitMask = 1; } VertexDescription vd = point.getDescription(); descriptionBitMask = vd.m_semanticsBitArray; if (point.isEmpty()) { return; } attribs = new double[vd.getTotalComponentCount()]; attribs[0] = point.getX(); attribs[1] = point.getY(); int index = 2; for (int i = 1, n = vd.getAttributeCount(); i < n; i++) { int semantics = vd.getSemantics(i); int comps = VertexDescription.getComponentCount(semantics); for (int ord = 0; ord < comps; ord++) { attribs[index++] = point.getAttributeAsDbl(semantics, ord); } } } catch (Exception ex) { throw new InvalidObjectException("Cannot serialize this geometry"); } } }
private void _set(int endPoint, Point src) { _touch(); Point point = src; if (src.isEmptyImpl())// can not assign an empty point throw new GeometryException("empty_Geometry"); VertexDescription vdin = point.getDescription(); for (int attributeIndex = 0, nattrib = vdin.getAttributeCount(); attributeIndex < nattrib; attributeIndex++) { int semantics = vdin._getSemanticsImpl(attributeIndex); int ncomp = VertexDescription.getComponentCount(semantics); for (int icomp = 0; icomp < ncomp; icomp++) { double v = point.getAttributeAsDbl(semantics, icomp); _setAttribute(endPoint, semantics, icomp, v); } } }
private void _set(int endPoint, Point src) { _touch(); Point point = src; if (src.isEmptyImpl())// can not assign an empty point throw new GeometryException("empty_Geometry"); VertexDescription vdin = point.getDescription(); for (int attributeIndex = 0, nattrib = vdin.getAttributeCount(); attributeIndex < nattrib; attributeIndex++) { int semantics = vdin._getSemanticsImpl(attributeIndex); int ncomp = VertexDescription.getComponentCount(semantics); for (int icomp = 0; icomp < ncomp; icomp++) { double v = point.getAttributeAsDbl(semantics, icomp); _setAttribute(endPoint, semantics, icomp, v); } } }
public void insertPoint(int beforePointIndex, Point pt) { if (beforePointIndex > getPointCount()) throw new GeometryException("index out of bounds"); if (beforePointIndex < 0) beforePointIndex = getPointCount(); mergeVertexDescription(pt.getDescription()); int oldPointCount = m_pointCount; _resizeImpl(m_pointCount + 1); _verifyAllStreams(); for (int iattr = 0, nattr = m_description.getAttributeCount(); iattr < nattr; iattr++) { int semantics = m_description._getSemanticsImpl(iattr); int comp = VertexDescription.getComponentCount(semantics); AttributeStreamBase stream = AttributeStreamBase .createAttributeStreamWithSemantics(semantics, 1); if (pt.hasAttribute(semantics)) { m_vertexAttributes[iattr] .insertAttributes(comp * beforePointIndex, pt, semantics, comp * oldPointCount); } else { // Need to make room for the attribute, so we copy a default // value in double v = VertexDescription.getDefaultValue(semantics); m_vertexAttributes[iattr].insertRange(comp * beforePointIndex, v, comp, comp * oldPointCount); } } notifyModified(DirtyFlags.DirtyCoordinates); }
public void insertPoint(int beforePointIndex, Point pt) { if (beforePointIndex > getPointCount()) throw new GeometryException("index out of bounds"); if (beforePointIndex < 0) beforePointIndex = getPointCount(); mergeVertexDescription(pt.getDescription()); int oldPointCount = m_pointCount; _resizeImpl(m_pointCount + 1); _verifyAllStreams(); for (int iattr = 0, nattr = m_description.getAttributeCount(); iattr < nattr; iattr++) { int semantics = m_description._getSemanticsImpl(iattr); int comp = VertexDescription.getComponentCount(semantics); AttributeStreamBase stream = AttributeStreamBase .createAttributeStreamWithSemantics(semantics, 1); if (pt.hasAttribute(semantics)) { m_vertexAttributes[iattr] .insertAttributes(comp * beforePointIndex, pt, semantics, comp * oldPointCount); } else { // Need to make room for the attribute, so we copy a default // value in double v = VertexDescription.getDefaultValue(semantics); m_vertexAttributes[iattr].insertRange(comp * beforePointIndex, v, comp, comp * oldPointCount); } } notifyModified(DirtyFlags.DirtyCoordinates); }