public override void SetPointByVal(int index, com.epl.geometry.Point src)
 {
     if (index < 0 || index >= m_pointCount)
     {
         throw new com.epl.geometry.GeometryException("index out of bounds");
     }
     com.epl.geometry.Point point = src;
     if (src.IsEmpty())
     {
         // can not assign an empty point to a multipoint
         // vertex
         throw new System.ArgumentException();
     }
     _verifyAllStreams();
     // verify all allocated streams are of necessary
     // size.
     com.epl.geometry.VertexDescription vdin = point.GetDescription();
     for (int attributeIndex = 0; attributeIndex < vdin.GetAttributeCount(); attributeIndex++)
     {
         int semantics = vdin._getSemanticsImpl(attributeIndex);
         int ncomp     = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
         for (int icomp = 0; icomp < ncomp; icomp++)
         {
             double v = point.GetAttributeAsDbl(semantics, icomp);
             SetAttribute(semantics, index, icomp, v);
         }
     }
 }
 /// <exception cref="java.io.ObjectStreamException"/>
 public virtual void SetGeometryByValue(com.epl.geometry.Point point)
 {
     try
     {
         attribs = null;
         if (point == null)
         {
             descriptionBitMask = 1;
         }
         com.epl.geometry.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     = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
             for (int ord = 0; ord < comps; ord++)
             {
                 attribs[index++] = point.GetAttributeAsDbl(semantics, ord);
             }
         }
     }
     catch (System.Exception)
     {
         throw new System.IO.InvalidDataException("Cannot serialize this geometry");
     }
 }
Beispiel #3
0
 /// <summary>Merges this envelope with the point.</summary>
 /// <remarks>
 /// Merges this envelope with the point. The boundary of the envelope is
 /// increased to include the point. If the envelope is empty, the coordinates
 /// of the point to merge are assigned. If the point is empty, the original
 /// envelope is unchanged.
 /// </remarks>
 /// <param name="point">The point to be merged.</param>
 public virtual void Merge(com.epl.geometry.Point point)
 {
     _touch();
     if (point.IsEmptyImpl())
     {
         return;
     }
     com.epl.geometry.VertexDescription pointVD = point.m_description;
     if (m_description != pointVD)
     {
         MergeVertexDescription(pointVD);
     }
     if (IsEmpty())
     {
         _setFromPoint(point);
         return;
     }
     m_envelope.Merge(point.GetXY());
     for (int iattrib = 1, nattrib = pointVD.GetAttributeCount(); iattrib < nattrib; iattrib++)
     {
         int semantics = pointVD._getSemanticsImpl(iattrib);
         int ncomps    = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
         for (int iord = 0; iord < ncomps; iord++)
         {
             double v = point.GetAttributeAsDbl(semantics, iord);
             com.epl.geometry.Envelope1D interval = QueryInterval(semantics, iord);
             interval.Merge(v);
             SetInterval(semantics, iord, interval);
         }
     }
 }
 public override void InsertAttributes(int start, com.epl.geometry.Point pt, int semantics, int validSize)
 {
     if (m_bReadonly)
     {
         throw new com.epl.geometry.GeometryException("invalid_call");
     }
     int comp = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
     System.Array.Copy(m_buffer, start, m_buffer, start + comp, validSize - start);
     for (int c = 0; c < comp; c++)
     {
         m_buffer[start + c] = (float)pt.GetAttributeAsDbl(semantics, c);
     }
 }
Beispiel #5
0
 internal virtual void _setFromPoint(com.epl.geometry.Point centerPoint)
 {
     m_envelope.SetCoords(centerPoint.m_attributes[0], centerPoint.m_attributes[1]);
     com.epl.geometry.VertexDescription pointVD = centerPoint.m_description;
     for (int iattrib = 1, nattrib = pointVD.GetAttributeCount(); iattrib < nattrib; iattrib++)
     {
         int semantics = pointVD._getSemanticsImpl(iattrib);
         int ncomps    = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
         for (int iord = 0; iord < ncomps; iord++)
         {
             double v = centerPoint.GetAttributeAsDbl(semantics, iord);
             SetInterval(semantics, iord, v, v);
         }
     }
 }
Beispiel #6
0
 private void _set(int endPoint, com.epl.geometry.Point src)
 {
     _touch();
     com.epl.geometry.Point point = src;
     if (src.IsEmptyImpl())
     {
         // can not assign an empty point
         throw new com.epl.geometry.GeometryException("empty_Geometry");
     }
     com.epl.geometry.VertexDescription vdin = point.GetDescription();
     for (int attributeIndex = 0, nattrib = vdin.GetAttributeCount(); attributeIndex < nattrib; attributeIndex++)
     {
         int semantics = vdin._getSemanticsImpl(attributeIndex);
         int ncomp     = com.epl.geometry.VertexDescription.GetComponentCount(semantics);
         for (int icomp = 0; icomp < ncomp; icomp++)
         {
             double v = point.GetAttributeAsDbl(semantics, icomp);
             _setAttribute(endPoint, semantics, icomp, v);
         }
     }
 }