public static byte[] PrepareData(byte[] data, DataMarker marker) { byte[] output = new byte[data.Length + 1]; output[0] = (byte)marker; Array.Copy(data, 0, output, 1, data.Length); return(output); }
public void TestFormulaCache() { IWorkbook wb = new XSSFWorkbook(); ISheet sheet = new SheetBuilder(wb, plotData).Build(); IDrawing Drawing = sheet.CreateDrawingPatriarch(); IClientAnchor anchor = Drawing.CreateAnchor(0, 0, 0, 0, 1, 1, 10, 30); IChart chart = Drawing.CreateChart(anchor); IChartAxis bottomAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Bottom); IChartAxis leftAxis = chart.ChartAxisFactory.CreateValueAxis(AxisPosition.Left); IScatterChartData scatterChartData = chart.ChartDataFactory.CreateScatterChartData(); DataMarker xMarker = new DataMarker(sheet, CellRangeAddress.ValueOf("A1:E1")); DataMarker yMarker = new DataMarker(sheet, CellRangeAddress.ValueOf("A2:E2")); IScatterChartSerie serie = scatterChartData.AddSerie(xMarker, yMarker); chart.Plot(scatterChartData, bottomAxis, leftAxis); XSSFScatterChartData.Serie xssfScatterSerie = (XSSFScatterChartData.Serie)serie; XSSFNumberCache yCache = xssfScatterSerie.LastCalculatedYCache; Assert.AreEqual(5, yCache.PointCount); Assert.AreEqual(4.0, yCache.GetValueAt(3), 0.00001); Assert.AreEqual(16.0, yCache.GetValueAt(5), 0.00001); }
public void OnNotify(Playable origin, INotification notification, object context) { if (notification is DataMarker) { DataMarker data = notification as DataMarker; data.action.Execute(user); } }
public MarkerEditor(DataMarker marker, HexView hexview) { InitializeComponent(); this.marker = marker; this.hexview = hexview; markerAtTextBox.Text = DataType.AddressToString(marker.Address); noteTextBox.Text = marker.Note; dataTypeComboBox.Items.AddRange(DataType.GetKnownDataTypes().ToArray()); dataTypeComboBox.SelectedIndex = dataTypeComboBox.FindString(marker.Type.Name); sizeNumericUpDown.Value = marker.NumBytes; sizeNumericUpDown.Enabled = marker.Type.VariableNumBytes; valueTextBox.Text = marker.Type.DecodeToString(hexview.GetDataAt(marker.Address)); }
public MarkerEditor(DataMarker marker, HexView hexview) { this.InitializeComponent(); this.marker = marker; this.hexview = hexview; this.markerAtTextBox.Text = DataType.AddressToString(marker.Address); this.noteTextBox.Text = marker.Note; this.dataTypeComboBox.Items.AddRange(DataType.GetKnownDataTypes().ToArray()); this.dataTypeComboBox.SelectedIndex = this.dataTypeComboBox.FindString(marker.Type.Name); this.sizeNumericUpDown.Value = marker.NumBytes; this.sizeNumericUpDown.Enabled = marker.Type.VariableNumBytes; this.valueTextBox.Text = marker.Type.DecodeToString(hexview.GetDataAt(marker.Address)); }
/** * Builds new numeric cache Container. * @param marker data marker to use for cache Evaluation * @param ctNumRef parent number reference * @return numeric cache instance */ internal static XSSFNumberCache BuildCache(DataMarker marker, CT_NumRef ctNumRef) { CellRangeAddress range = marker.Range; int numOfPoints = range.NumberOfCells; if (numOfPoints == 0) { // Nothing to do. return(null); } XSSFNumberCache cache = new XSSFNumberCache(ctNumRef.AddNewNumCache()); cache.SetPointCount(numOfPoints); IWorkbook wb = marker.Sheet.Workbook; IFormulaEvaluator Evaluator = wb.GetCreationHelper().CreateFormulaEvaluator(); CellWalk cellWalk = new CellWalk(marker); NumCacheCellHandler numCacheHandler = new NumCacheCellHandler(Evaluator, cache.ctNumData); cellWalk.Traverse(numCacheHandler); return(cache); }
public CellWalk(DataMarker dm) : this(dm.Sheet, dm.Range) { }
private Bitmap DrawMarker(DataMarker marker, int address) { // draw marker to offscreen surface Point origin = new Point(0, 0); int mWidth = ColumnWidth * marker.NumBytes; Bitmap markerBmp = new Bitmap(mWidth, LineHeight); var mg = Graphics.FromImage(markerBmp); var markerRect = new Rectangle(origin, new Size(mWidth, LineHeight)); // highlighting and selection if(address == hoverAddress) mg.FillRectangle(Brushes.DarkBlue, markerRect); if(address == selectedAddress) mg.FillRectangle(Brushes.DarkRed, markerRect); // strings StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Near; mg.DrawString(marker.Type.DecodeToString(new DataFragment(address, fileBytes, address / 8, marker.NumBytes)), vFont, Brushes.White, markerRect, sf); origin.Y += 11; mg.DrawString(marker.Type.ShortName, tFont, Brushes.Orange, origin); // draw line var measure = mg.MeasureString(marker.Type.ShortName, tFont); origin.X += (int)measure.Width + hSpacing; origin.Y = LineHeight - 3; var point2 = new PointF(mWidth, origin.Y); mg.DrawLine(new Pen(Brushes.DarkOrange), origin, point2); return markerBmp; }