Пример #1
0
 /// <summary>
 /// Find the Element at a pixel location
 /// </summary>
 /// <param name="PixelPosition"></param>
 /// <returns>Null - not found or out of range</returns>
 public override VisualisationElement GetElement(VectorInt PixelPosition)
 {
     VectorInt logical = PixelPosition.Subtract(RenderCanvas.TopLeft).Divide(cellSize);
     if (logical.X > GridSize.X) return null;
     if (logical.Y > GridSize.Y) return null;
     return this[PixelPosition.Subtract(RenderCanvas.TopLeft).Divide(cellSize)];
 }
 /// <summary>
 /// Find the Element at a pixel location
 /// </summary>
 /// <param name="PixelPosition"></param>
 /// <returns>Null - not found or out of range</returns>
 public override VisualisationElement GetElement(VectorInt PixelPosition)
 {
     VectorInt logical = PixelPosition.Subtract(windowRegion.TopLeft).Subtract(renderCanvas.TopLeft).Divide(cellSize);
     int idx = logical.X + logical.Y*maxCellWidth;
     if (idx < elements.Count) return elements[idx];
     return null;
 }
Пример #3
0
 /// <summary>
 /// From a pixel position find the relevant node element
 /// </summary>
 /// <param name="pixelPosition"></param>
 /// <returns></returns>
 public VisualisationElement GetNodeFromPixelPosition(VectorInt pixelPosition)
 {
     VectorInt logical = pixelPosition.Subtract(RenderRegion.TopLeft).Subtract(owner.summaryIndent, 0);
     int idx = (logical.X / owner.cellSize.Width) + (logical.Y / owner.cellSize.Height) * MaxRegionNodeWidth;
     if (idx < treeSegment.Count) return this[treeSegment.Nodes[idx]];
     return null; // Not found
 }