internal NtxImport(string fileName, ITranslate t) : base(fileName) { m_Translator = t; m_Result = new List<Feature>(1000); m_Index = new SpatialIndex(); m_KeyIndex = new Dictionary<string, ForeignId>(1000); }
/// <summary> /// Checks whether this window overlaps a position /// </summary> /// <param name="p">The position to examine</param> /// <returns>True if the position overlaps this window (may be exactly /// coincident with the perimeter)</returns> internal bool IsOverlap(IPointGeometry p) { ulong val = SpatialIndex.ToUnsigned(p.Easting.Microns); if (val < m_X.Min || val > m_X.Max) { return(false); } val = SpatialIndex.ToUnsigned(p.Northing.Microns); return(val >= m_Y.Min && val <= m_Y.Max); }
/// <summary> /// Initializes a new instance of the <see cref="CadastralFile"/> class. /// </summary> /// <param name="name">The name of the xml file</param> /// <param name="data">The data that was deserialized</param> internal CadastralFile(string name, GeoSurveyPacketData data) { m_Name = Path.GetFileName(name); m_Data = data; m_Extent = new Window(m_Data.points); m_Points = new Dictionary<int, IPoint>(m_Data.points.Length); IEditSpatialIndex index = new SpatialIndex(); foreach (Point p in m_Data.points) { index.Add(p); m_Points.Add(p.pointNo, p); } foreach (Plan plan in m_Data.plans) { foreach (Parcel parcel in plan.parcels) { // Relate the parcel to it's plan parcel.Plan = plan; foreach (Line line in parcel.lines) { Debug.Assert(line.From == null && line.To == null); // Relate the line to the parcel that it is part of line.Parcel = parcel; line.From = m_Points[line.fromPoint]; line.To = m_Points[line.toPoint]; if (line.centerPointSpecified) line.Center = m_Points[line.centerPoint]; index.Add(line); } /* foreach (LinePoint lp in parcel.linePoints) { // Relate to the parcel it's referenced by // Relate the associated point } */ } } m_Index = index; }
public ShapeFile(string fileName) { if (String.IsNullOrEmpty(fileName)) throw new ArgumentNullException(); m_MapName = fileName; IEditSpatialIndex index = new SpatialIndex(); ShapefileDataReader sfdr = Shapefile.CreateDataReader(fileName, new GeometryFactory()); ShapefileHeader hdr = sfdr.ShapeHeader; Envelope ex = hdr.Bounds; m_Extent = new Window(ex.MinX, ex.MinY, ex.MaxX, ex.MaxY); foreach (object o in sfdr) { // You get back an instance of GisSharpBlog.NetTopologySuite.IO.RowStructure, but // that's internal, so cast to the interface it implements (we'll attach this to // the geometry we wrap). //ICustomTypeDescriptor row = (ICustomTypeDescriptor)o; AdhocPropertyList row = CreatePropertyList(sfdr); NTS.Geometry geom = sfdr.Geometry; geom.UserData = row; List<NTS.Geometry> geoms = GetBasicGeometries(geom); foreach (NTS.Geometry g in geoms) { g.UserData = row; if (g is NTS.Point) index.Add(new PointWrapper((NTS.Point)g)); else index.Add(new GeometryWrapper(g)); } } // Don't permit any further additions m_Index = index; }
/// <summary> /// Creates a new <c>EditingIndex</c> with nothing in it. /// </summary> internal EditingIndex() { m_ExtraData = new SpatialIndex(); }
/// <summary> /// Creates a new <c>Range</c>, converting the supplied values into unsigned space. /// </summary> /// <param name="d">The positional dimension the range refers to</param> /// <param name="a">One end of the range (either the min or the max)</param> /// <param name="b">The other end of the range (either the min or the max)</param> internal RangeValue(Dimension d, long a, long b) : this(d, SpatialIndex.ToUnsigned(a), SpatialIndex.ToUnsigned(b)) { }