// Checked vs. Jan 11, 2011 /// <summary>Sets the envelope of the Geometry.</summary> /// <remarks> /// Sets the envelope of the Geometry. The Envelope description must match /// that of the Geometry. /// </remarks> public virtual void SetEnvelope(com.epl.geometry.Envelope env) { if (!m_description.Equals(env.GetDescription())) { throw new System.ArgumentException(); } // m_envelope = (Envelope) env.clone(); m_envelope = (com.epl.geometry.Envelope)env.CreateInstance(); env.CopyTo(m_envelope); _setDirtyFlag(com.epl.geometry.MultiVertexGeometryImpl.DirtyFlags.DirtyIntervals, false); }
private com.epl.geometry.Geometry DensifyEnvelope(com.epl.geometry.Envelope geom) { com.epl.geometry.Polygon polygon = new com.epl.geometry.Polygon(geom.GetDescription()); polygon.AddEnvelope(geom, false); com.epl.geometry.Envelope2D env2D = new com.epl.geometry.Envelope2D(); geom.QueryEnvelope2D(env2D); double w = env2D.GetWidth(); double h = env2D.GetHeight(); if (w <= m_maxLength && h <= m_maxLength) { return((com.epl.geometry.Geometry)polygon); } return(DensifyMultiPath((com.epl.geometry.MultiPath)polygon)); }
/// <exception cref="java.io.ObjectStreamException"/> public virtual void SetGeometryByValue(com.epl.geometry.Envelope env) { try { attribs = null; if (env == null) { descriptionBitMask = -1; } com.epl.geometry.VertexDescription vd = env.GetDescription(); descriptionBitMask = vd.m_semanticsBitArray; if (env.IsEmpty()) { return; } attribs = new double[vd.GetTotalComponentCount() * 2]; attribs[0] = env.GetXMin(); attribs[1] = env.GetYMin(); attribs[2] = env.GetXMax(); attribs[3] = env.GetYMax(); int index = 4; 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++) { com.epl.geometry.Envelope1D e = env.QueryInterval(semantics, ord); attribs[index++] = e.vmin; attribs[index++] = e.vmax; } } } catch (System.Exception) { throw new System.IO.InvalidDataException("Cannot serialize this geometry"); } }