public void Insert(int recordIndex, QTNodeHelper helper, System.IO.Stream shapeFileStream) { if (helper.IsPointData()) { rootNode.Insert(recordIndex, helper, shapeFileStream); } else { RectangleF recBounds = helper.GetRecordBounds(recordIndex, shapeFileStream); rootNode.Insert(recordIndex, helper, ref recBounds, shapeFileStream); } }
internal void Insert(int recordIndex, QTNodeHelper helper, ref RectangleD recBounds, System.IO.Stream shapeFileStream) { if (Level == MaxLevels) { indexList.Add(recordIndex); } else { if (helper.IsPointData()) { } else { //RectangleF recBounds = helper.GetRecordBounds(recordIndex, shapeFileStream); if (children == null) { CreateChildren(); } int c = 0; if (children[TL].Bounds.IntersectsWith(recBounds)) { c++; children[TL].Insert(recordIndex, helper, ref recBounds, shapeFileStream); } if (children[TR].Bounds.IntersectsWith(recBounds)) { c++; children[TR].Insert(recordIndex, helper, ref recBounds, shapeFileStream); } if (children[BL].Bounds.IntersectsWith(recBounds)) { c++; children[BL].Insert(recordIndex, helper, ref recBounds, shapeFileStream); } if (children[BR].Bounds.IntersectsWith(recBounds)) { c++; children[BR].Insert(recordIndex, helper, ref recBounds, shapeFileStream); } } } }
public void Insert(int recordIndex, QTNodeHelper helper, System.IO.Stream shapeFileStream) { if (helper.IsPointData()) { rootNode.Insert(recordIndex, helper, shapeFileStream); } else { RectangleD recBounds = helper.GetRecordBoundsD(recordIndex, shapeFileStream); //check for zero width or height to avoid issue when checking rectangle intersection //if width/height is zero if (recBounds.Width < 0.0000001) { recBounds.Width = 0.0000001; } if (recBounds.Height < 0.0000001) { recBounds.Height = 0.0000001; } rootNode.Insert(recordIndex, helper, ref recBounds, shapeFileStream); } }
public void Insert(int recordIndex, QTNodeHelper helper, System.IO.Stream shapeFileStream) { if (Level == MaxLevels) { indexList.Add(recordIndex); } else { if (helper.IsPointData()) { PointD pt = helper.GetRecordPoint(recordIndex, shapeFileStream); if (children == null) { CreateChildren(); } if (children[TL].Bounds.Contains(pt)) { children[TL].Insert(recordIndex, helper, shapeFileStream); } if (children[TR].Bounds.Contains(pt)) { children[TR].Insert(recordIndex, helper, shapeFileStream); } if (children[BL].Bounds.Contains(pt)) { children[BL].Insert(recordIndex, helper, shapeFileStream); } if (children[BR].Bounds.Contains(pt)) { children[BR].Insert(recordIndex, helper, shapeFileStream); } //else //{ // throw new InvalidOperationException("point " + pt + " is not contained in children bounds"); //} } else { RectangleD recBounds = helper.GetRecordBoundsD(recordIndex, shapeFileStream); if (children == null) { CreateChildren(); } int c = 0; if (children[TL].Bounds.IntersectsWith(recBounds)) { c++; children[TL].Insert(recordIndex, helper, shapeFileStream); } if (children[TR].Bounds.IntersectsWith(recBounds)) { c++; children[TR].Insert(recordIndex, helper, shapeFileStream); } if (children[BL].Bounds.IntersectsWith(recBounds)) { c++; children[BL].Insert(recordIndex, helper, shapeFileStream); } if (children[BR].Bounds.IntersectsWith(recBounds)) { c++; children[BR].Insert(recordIndex, helper, shapeFileStream); } } } }
internal void Insert(int recordIndex, QTNodeHelper helper, ref RectangleF recBounds, System.IO.Stream shapeFileStream) { if (Level == MaxLevels) { indexList.Add(recordIndex); } else { if (helper.IsPointData()) { } else { //RectangleF recBounds = helper.GetRecordBounds(recordIndex, shapeFileStream); if (children == null) { CreateChildren(); } int c = 0; if (children[TL].Bounds.IntersectsWith(recBounds)) { c++; children[TL].Insert(recordIndex, helper, ref recBounds, shapeFileStream); } if (children[TR].Bounds.IntersectsWith(recBounds)) { c++; children[TR].Insert(recordIndex, helper,ref recBounds, shapeFileStream); } if (children[BL].Bounds.IntersectsWith(recBounds)) { c++; children[BL].Insert(recordIndex, helper,ref recBounds, shapeFileStream); } if (children[BR].Bounds.IntersectsWith(recBounds)) { c++; children[BR].Insert(recordIndex, helper,ref recBounds, shapeFileStream); } } } }
public void Insert(int recordIndex, QTNodeHelper helper, System.IO.Stream shapeFileStream) { if (Level == MaxLevels) { indexList.Add(recordIndex); } else { if(helper.IsPointData()) { PointF pt = helper.GetRecordPoint(recordIndex, shapeFileStream); if(children == null) { CreateChildren(); } if (children[TL].Bounds.Contains(pt)) { children[TL].Insert(recordIndex, helper, shapeFileStream); } else if (children[TR].Bounds.Contains(pt)) { children[TR].Insert(recordIndex, helper, shapeFileStream); } else if (children[BL].Bounds.Contains(pt)) { children[BL].Insert(recordIndex, helper, shapeFileStream); } else if (children[BR].Bounds.Contains(pt)) { children[BR].Insert(recordIndex, helper, shapeFileStream); } else { throw new InvalidOperationException("point " + pt + " is not contained in children bounds"); } } else { RectangleF recBounds = helper.GetRecordBounds(recordIndex, shapeFileStream); if (children == null) { CreateChildren(); } int c = 0; if (children[TL].Bounds.IntersectsWith(recBounds)) { c++; children[TL].Insert(recordIndex, helper, shapeFileStream); } if (children[TR].Bounds.IntersectsWith(recBounds)) { c++; children[TR].Insert(recordIndex, helper, shapeFileStream); } if (children[BL].Bounds.IntersectsWith(recBounds)) { c++; children[BL].Insert(recordIndex, helper, shapeFileStream); } if (children[BR].Bounds.IntersectsWith(recBounds)) { c++; children[BR].Insert(recordIndex, helper, shapeFileStream); } } } }