private void AddPointsRow(PointsLayer layer, SpatialDataTable pointsTable, IReportScriptContext sc) { bool markVisible = Maps.Util.GetBool(ParentReport.Evaluate(layer.MarkerVisibleExpr, sc), true); if (markVisible) { bool pointsOk; var loc = GetLocations(layer, sc, out pointsOk)[0]; // If we got a location, add it (tbd: report misses?): if (pointsOk) { var row = (PointsDataRow)pointsTable.NewRow(); // evaluate marker style var markerStyle = EvalStyleExpr <MarkerStyle>(layer.MarkerStyleExpr, MarkerStyles, ExternalMarkerStyle, layer.MarkerStyle, sc); row.Latitude = loc.Latitude; row.Longitude = loc.Longitude; row.Caption = Maps.Util.GetString(ParentReport.Evaluate(markerStyle.CaptionExpr, sc)); row.MarkerSize = Maps.Util.GetDouble(ParentReport.Evaluate(markerStyle.SizeExpr, sc), MarkerStyle.c_SizeValue); row.MarkerStroke = markerStyle.StrokeColor; row.MarkerFill = markerStyle.FillColor; row.MarkerShape = markerStyle.Shape; row.Font = markerStyle.Font; row.TextColor = markerStyle.TextColor; pointsTable.Add(row); } } }
private TStyle EvalStyleExpr <TStyle>( string styleExpr, MapOwnedCollectionBase <TStyle> styles, Func <string, TStyle> externalStyleGetter, TStyle defaultStyle, IReportScriptContext sc) where TStyle : MapStyleBase { TStyle style = null; int intIdx; var strIdx = Maps.Util.GetIndex(ParentReport.Evaluate(styleExpr, sc), out intIdx); if (!string.IsNullOrEmpty(strIdx)) { style = styles[strIdx]; if (style == null && externalStyleGetter != null) { style = externalStyleGetter(strIdx); } } if (style == null && intIdx >= 0 && intIdx < styles.Count) { style = styles[intIdx]; } if (style == null) { style = defaultStyle; } return(style); }
public PaymentEntry(String guardianID, ParentReport parentReport) { InitializeComponent(); this.guardianID = guardianID; this.callingWindow = parentReport; InitializeCurrentBalance(); this.txt_PaymentAmount.Focus(); }
public PaymentEntry(String guardianID, ParentReport parentReport, string type) { InitializeComponent(); this.type = type; this.guardianID = guardianID; this.callingWindow = parentReport; InitializeCurrentBalance(); this.txt_PaymentAmount.Focus(); this.MouseDown += WindowMouseDown; }
private DataTable MakeCustomData(string recordSource) { if (string.IsNullOrEmpty(recordSource)) { return(null); } DataTable dtCustom = new DataTable(); string conn = ParentReport.DataSource.ConnectionString; string sql = ParentReport.Evaluate(recordSource).ToString(); OleDbDataAdapter da = new OleDbDataAdapter(sql, conn); // <<B176>> da.Fill(dtCustom); return(dtCustom); }
/// <summary> /// Gets the geographical location of a point based on spatial data or location expression. /// If a data row is provided (not null), data (location expressions or spatial data) /// is assumed to be actual fields in that row, and is NOT evaluated. /// If the data row is null, data is evaluated against the ParentReport, so may /// constitute expressions. /// </summary> /// <param name="layer">The map layer for which location is retrieved.</param> /// <param name="source">The data row (of the layer's custom data source) or null.</param> /// <param name="allOk">OUT: true if all points have numeric coordinates, false if at least one is a NaN.</param> /// <returns>Location, in geographical coordinates (X is longitude, Y is latitude).</returns> private List <LonLat <double> > GetLocations(LayerBase layer, IReportScriptContext context, out bool allOk) { allOk = true; Func <LonLat <string>, List <string>, LonLat <double> > getLoc = (lonlat, locExpr) => { if (locExpr != null) { // Make address string: var sb = new StringBuilder(); for (int i = 0; i < locExpr.Count; ++i) { string s = ParentReport.Evaluate(locExpr[i], context) as string; if (!string.IsNullOrEmpty(s)) { sb.Append(s); if (i < locExpr.Count - 1) { sb.Append(", "); } } } return(_geocoder.GetLocation(sb.ToString())); } else { return(new LonLat <double>( Maps.Util.GetDouble(ParentReport.Evaluate(lonlat.Longitude, context)), Maps.Util.GetDouble(ParentReport.Evaluate(lonlat.Latitude, context)))); } }; var locExprs = layer.PointsLocationExpressions; var lonlats = layer.PointsLocations; var points = new List <LonLat <double> >(lonlats.Count); for (int i = 0; i < lonlats.Count; ++i) { LonLat <double> pt = getLoc(lonlats[i], locExprs[i]); points.Add(pt); if (allOk && (double.IsNaN(pt.Longitude) || double.IsNaN(pt.Latitude))) { allOk = false; } } return(points); }
private void AddLinesRow(LinesLayer layer, SpatialDataTable linesTable, IReportScriptContext sc) { bool pointsOk; var locs = GetLocations(layer, sc, out pointsOk); if (pointsOk) { var row = (LinesDataRow)linesTable.NewRow(); var lineStyle = EvalStyleExpr <LineStyle>(layer.LineStyleExpr, LineStyles, ExternalLineStyle, layer.LineStyle, sc); row.Longitude0 = locs[0].Longitude; row.Latitude0 = locs[0].Latitude; row.Longitude1 = locs[1].Longitude; row.Latitude1 = locs[1].Latitude; row.LineStroke = lineStyle.StrokeColor; row.DashStyle = lineStyle.DashStyle; row.LineThickness = Maps.Util.GetDouble(ParentReport.Evaluate(lineStyle.ThicknessExpr, sc), LineStyle.c_LineThickness); linesTable.Add(row); } }
private object[] GetGroupValues() { // get last group int lastGroup = ((int)Section - 5) / 2; if (lastGroup < 0) { lastGroup = -1; } object[] values = new object[lastGroup + 1]; // calculate values for (int i = 0; i < values.Length; i++) { string expr = ParentReport.Groups[i].GroupBy; values[i] = ParentReport.Evaluate(expr); } // return result return(values); }
internal void SetKml(KmlLayer kmlLayer, Stream kmlStream, string layerKey) { AddingKmlItemDelegate addingItemProc = null; if (_runtime) { // TODO: maybe allow non-custom (i.e. report's main) data source here too? var layerData = string.IsNullOrEmpty(kmlLayer.ItemFilterExpr) ? null : MakeCustomData(kmlLayer.RecordSource); try { addingItemProc = delegate(ref string itemName, out Color? stroke, out Color? fill, out bool trackCoords) { stroke = null; fill = null; trackCoords = false; DataRowReportScriptContext context = null; if (layerData != null) { try { // quote item name with ' doubling single quotes if any: var filter = s_kmlItemNameRegex.Replace(kmlLayer.ItemFilterExpr, string.Format(CultureInfo.InvariantCulture, "'{0}'", itemName.Replace("'", "''"))); DataRow[] res = layerData.Select(filter); if (res.Length > 0) { context = new DataRowReportScriptContext(res[0]); } else // provide empty (dbnull) context values so that expressions still evaluate to something reasonable: { context = new DataRowReportScriptContext(layerData.NewRow(), layerData.Columns); } } catch { // eat select errors } } if (context == null) { context = new DataRowReportScriptContext(null, null); } context.AddConstant(KmlLayer.varItemName, itemName); bool itemVisible = Maps.Util.GetBool(ParentReport.Evaluate(kmlLayer.ItemVisibleExpr, context), true); if (itemVisible) { var itemStyle = EvalStyleExpr <KmlItemStyle>(kmlLayer.ItemStyleExpr, KmlItemStyles, ExternalKmlItemStyle, kmlLayer.ItemStyle, context); stroke = Maps.Util.IsColorEmpty(itemStyle.StrokeColor) ? (Color?)null : itemStyle.StrokeColor; fill = Maps.Util.IsColorEmpty(itemStyle.FillColor) ? (Color?)null : itemStyle.FillColor; itemName = string.IsNullOrEmpty(itemStyle.ItemNameExpr) ? itemName : Maps.Util.GetString(ParentReport.Evaluate(itemStyle.ItemNameExpr, context)); trackCoords = Maps.Util.GetBool(ParentReport.Evaluate(kmlLayer.ItemTrackExpr, context), true); } return(itemVisible); }; } finally { if (layerData != null) { layerData.Dispose(); } } } InitMapper(); _c1mapper.UpdateKmlLayer(layerKey, kmlStream, addingItemProc); }