private LabelProperties GenerateLabelProperties(LabelListSetting listSetting) { LabelProperties labels = new LabelProperties(); if (listSetting != null) { listSetting.RelatedLabelProperties = labels; foreach (var setting in listSetting.LabelSettings) { var labelClass = new AttributeLabelClass { TextExpression = setting.TextExpression, LabelPlacement = setting.Placement, LabelPosition = setting.Position, IsVisible = setting.IsVisible, Symbol = new TextSymbol { Color = setting.LabelColor }, WhereClause = setting.WhereClause }; labels.LabelClasses.Add(labelClass); setting.RelatedAttributeLabelClass = labelClass; } } return(labels); }
private LabelProperties GenerateLabelProperties(LabelListSetting listSetting) { LabelProperties labels = new LabelProperties(); if (listSetting != null) { listSetting.RelatedLabelProperties = labels; foreach (var setting in listSetting.LabelSettings) { var labelClass = new AttributeLabelClass { TextExpression = setting.TextExpression, LabelPlacement = setting.Placement, LabelPosition = setting.Position, IsVisible = setting.IsVisible, Symbol = new TextSymbol { Color = setting.LabelColor } }; labelClass.Symbol.Font.FontFamily = "微软雅黑"; labelClass.Symbol.Font.FontSize = 14; //12 default labels.LabelClasses.Add(labelClass); setting.RelatedAttributeLabelClass = labelClass; } } return(labels); }
public Axis3D(Axes3D axes, Axis3DCollection axisCollection) { axisLabels = new List <TextBlock>(); labelProperties = new LabelProperties(axisCollection.TickLabels); model3D = new LinesModel3D(); this.axes = axes; this.axisCollection = axisCollection; this.axes.Children.Add(model3D); }
private SPLabel BuildLabel(object data, BuildContext bc) { LabelProperties properties = DataNodeWrapper.GetNodeAttributes(data).To <LabelProperties>(); SPLabel fslb = new SPLabel(Root, properties.Id, properties); return(fslb); }
public Axes3D() : base() { labelProperties = new LabelProperties(); xAxisCollection.TickLabels.SetParent(labelProperties); yAxisCollection.TickLabels.SetParent(labelProperties); zAxisCollection.TickLabels.SetParent(labelProperties); xAxisCollection.AxisLabels.Text = "X"; yAxisCollection.AxisLabels.Text = "Y"; zAxisCollection.AxisLabels.Text = "Z"; sides = new LinesModel3D[6]; MinusX = new LinesModel3D(); sides[(int)GraphSides.MinusX] = MinusX; MinusY = new LinesModel3D(); sides[(int)GraphSides.MinusY] = MinusY; MinusZ = new LinesModel3D(); sides[(int)GraphSides.MinusZ] = MinusZ; PlusX = new LinesModel3D(); sides[(int)GraphSides.PlusX] = PlusX; PlusY = new LinesModel3D(); sides[(int)GraphSides.PlusY] = PlusY; PlusZ = new LinesModel3D(); sides[(int)GraphSides.PlusZ] = PlusZ; this.Children.Add(MinusX); this.Children.Add(PlusX); this.Children.Add(MinusY); this.Children.Add(PlusY); this.Children.Add(MinusZ); this.Children.Add(PlusZ); xAxes = new XAxis3D[2]; yAxes = new YAxis3D[2]; zAxes = new ZAxis3D[4]; // X Axes xAxes[(int)XAxisType.MinusY] = new XAxis3D(this, xAxisCollection, XAxisType.MinusY); xAxes[(int)XAxisType.PlusY] = new XAxis3D(this, xAxisCollection, XAxisType.PlusY); xAxisCollection.AddAxis(xAxes[(int)XAxisType.MinusY]); xAxisCollection.AddAxis(xAxes[(int)XAxisType.PlusY]); // Y Axes yAxes[(int)YAxisType.MinusX] = new YAxis3D(this, yAxisCollection, YAxisType.MinusX); yAxes[(int)YAxisType.PlusX] = new YAxis3D(this, yAxisCollection, YAxisType.PlusX); yAxisCollection.AddAxis(yAxes[(int)YAxisType.MinusX]); yAxisCollection.AddAxis(yAxes[(int)YAxisType.PlusX]); // Z Axes zAxes[(int)ZAxisType.MinusXMinusY] = new ZAxis3D(this, zAxisCollection, ZAxisType.MinusXMinusY); zAxes[(int)ZAxisType.MinusXPlusY] = new ZAxis3D(this, zAxisCollection, ZAxisType.MinusXPlusY); zAxes[(int)ZAxisType.PlusXMinusY] = new ZAxis3D(this, zAxisCollection, ZAxisType.PlusXMinusY); zAxes[(int)ZAxisType.PlusXPlusY] = new ZAxis3D(this, zAxisCollection, ZAxisType.PlusXPlusY); zAxisCollection.AddAxis(zAxes[(int)ZAxisType.MinusXMinusY]); zAxisCollection.AddAxis(zAxes[(int)ZAxisType.MinusXPlusY]); zAxisCollection.AddAxis(zAxes[(int)ZAxisType.PlusXMinusY]); zAxisCollection.AddAxis(zAxes[(int)ZAxisType.PlusXPlusY]); Base = new LinesModel3D(); this.Children.Add(Base); // Add base last so that this can overwrite other lines. PlusZ.IsVisible = false; // Note axes are already added as Children Generate(); }
private LabelProperties loadLabelProperties(string prefix, string suffix) { LabelProperties lp = new LabelProperties(); lp.text = getIniValue(prefix + "-" + suffix, "text");//.Replace("\\", @"\"); if (lp.text == "0") lp.text = ""; else lp.text = System.Text.RegularExpressions.Regex.Unescape(lp.text); lp.fontSize = Int32.Parse(getIniValue(prefix + "-" + suffix, "fontsize")); if (lp.fontSize == 0) lp.fontSize = 12; lp.left = Int32.Parse(getIniValue(prefix + "-" + suffix, "left")); lp.top = Int32.Parse(getIniValue(prefix + "-" + suffix, "top")); lp.width = Int32.Parse(getIniValue(prefix + "-" + suffix, "width")); lp.height = Int32.Parse(getIniValue(prefix + "-" + suffix, "height")); if(lp.height == 0) lp.height = (int)((double)Int32.Parse(getIniValue(prefix + "-" + suffix, "fontsize")) * 1.5); lp.padding = new int[4] {0, 0, 0, 0}; lp.padding[0] = Int32.Parse(getIniValue(prefix + "-" + suffix, "padding-left")); lp.padding[1] = Int32.Parse(getIniValue(prefix + "-" + suffix, "padding-top")); lp.padding[2] = Int32.Parse(getIniValue(prefix + "-" + suffix, "padding-right")); lp.padding[3] = Int32.Parse(getIniValue(prefix + "-" + suffix, "padding-bottom")); if (getIniValue(prefix + "-" + suffix, "font") == "0") lp.font = fontCache.Get(defaultFont); else lp.font = fontCache.Get(getIniValue(prefix + "-" + suffix, "font")); // new System.Windows.Media.FontFamily(new Uri(Directory.GetCurrentDirectory() + "\\" + path + "\\"), "./#" + getIniValue(prefix + "-" + suffix, "font") + ", " + getIniValue(prefix + "-" + suffix, "font") + ", Arial"); if(getIniValue(prefix + "-" + suffix, "fontcolor") == "0") lp.fontColor = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black); else lp.fontColor = (System.Windows.Media.SolidColorBrush)new System.Windows.Media.BrushConverter().ConvertFromString(getIniValue(prefix + "-" + suffix, "fontcolor")); if (getIniValue(prefix + "-" + suffix, "fontbold") == "true") lp.fontBold = System.Windows.FontWeights.Bold; else lp.fontBold = System.Windows.FontWeights.Normal; if (getIniValue(prefix + "-" + suffix, "fontitalic") == "true") lp.fontItalic = System.Windows.FontStyles.Italic; else lp.fontItalic = System.Windows.FontStyles.Normal; switch (getIniValue(prefix + "-" + suffix, "align")) { case "center": lp.textAlign = System.Windows.HorizontalAlignment.Center; break; case "right": lp.textAlign = System.Windows.HorizontalAlignment.Right; break; default: lp.textAlign = System.Windows.HorizontalAlignment.Left; break; } if (getIniValue(prefix + "-" + suffix, "uppercase") == "true") lp.uppercase = true; else lp.uppercase = false; lp.offset = Int32.Parse(getIniValue(prefix + "-" + suffix, "offset")); lp.session = (SessionTypes)Enum.Parse(typeof(SessionTypes), getIniValue(prefix + "-" + suffix, "session")); if (getIniValue(prefix + "-" + suffix, "background") == "0") lp.backgroundImage = null; else lp.backgroundImage = getIniValue(prefix + "-" + suffix, "background"); if (getIniValue(prefix + "-" + suffix, "bgcolor") == "0") { Color bgcolor = Color.FromArgb(0, 0, 0, 0); lp.backgroundColor = new System.Windows.Media.SolidColorBrush(bgcolor); } else lp.backgroundColor = (System.Windows.Media.SolidColorBrush)new System.Windows.Media.BrushConverter().ConvertFromString(getIniValue(prefix + "-" + suffix, "bgcolor")); if (getIniValue(prefix + "-" + suffix, "defaultbackground") == "0") lp.defaultBackgroundImage = null; else lp.defaultBackgroundImage = getIniValue(prefix + "-" + suffix, "defaultbackground"); if (getIniValue(prefix + "-" + suffix, "dynamic") == "true") lp.dynamic = true; else lp.dynamic = false; lp.rounding = Int32.Parse(getIniValueWithDefault(prefix + "-" + suffix, "rounding", getIniValue("prefix", "rounding"))); if (lp.rounding <= 0) lp.rounding = 0; else if (lp.rounding >= 3) lp.rounding = 3; return lp; }
public static LabelProperties setLabelPosition(ObjectProperties obj, LabelProperties lp, int i) { switch (obj.direction) { case direction.down: lp.top += i * obj.itemSize; break; case direction.left: lp.left -= i * obj.itemSize; break; case direction.right: lp.left += i * obj.itemSize; break; case direction.up: lp.top -= i * obj.itemSize; break; } return lp; }
public string formatSessionstateText(LabelProperties label, int session) { string[] cache; Dictionary<string, int> formatMap = new Dictionary<string, int>() { {"lapstotal", 0}, {"lapsremaining", 1}, {"timetotal", 2}, {"timeremaining", 3}, {"lapscompleted", 4}, {"timepassed", 5}, {"lapcounter", 6}, {"trackname", 7}, {"tracklen_mi", 8}, {"tracklen_km", 9}, {"cautions", 10}, {"cautionlaps", 11}, {"leadchanges", 12}, {"sessiontype", 13}, {"currentlap", 14}, {"turns", 15}, {"city", 16}, {"country", 17}, {"altitude_m", 18}, {"sky", 19}, {"tracktemp_c", 20}, {"airtemp_c", 21}, {"humidity", 22}, {"fog", 23}, {"airpressure_hg", 24}, {"windspeed_ms", 25}, {"winddir_deg", 26}, {"altitude_ft", 27}, {"tracktemp_f", 28}, {"airtemp_f", 29}, {"airpressure_hpa", 30}, {"windspeed_kt", 31}, {"windspeed_kph", 32}, }; int start, end; StringBuilder t = new StringBuilder(label.text); foreach (KeyValuePair<string, int> pair in formatMap) { t.Replace("{" + pair.Key + "}", "{" + pair.Value + "}"); } // run scripts if (label.text.Contains("{script:")) { String[] scripts = SharedData.scripting.Scripts; foreach (String script in scripts) { String text = t.ToString(); do { start = text.IndexOf("{script:" + script + ":", 0); // if script name found if (start >= 0) { end = text.IndexOf('}', start) + 1; // if ending found if (end > start) { String method = text.Substring(start + script.Length + 9, end - start - script.Length - 10); String result = SharedData.scripting.getSessionInfo(script, method, SharedData.Sessions.SessionList[session], label.rounding); t.Replace("{script:" + script + ":" + method + "}", result ); } } text = t.ToString(); } while (t.ToString().Contains("{script:" + script + ":")); } } // remove leftovers string format = t.ToString(); do { start = format.IndexOf("{script", 0); if (start >= 0) { end = format.IndexOf('}', start) + 1; logger.Warn("Script Call not found: {0} ", format.Substring(start, end - start)); format = format.Remove(start, end - start); } } while (start >= 0); if (!SharedData.themeSessionStateCache.ContainsKey(label.rounding) || ( SharedData.themeSessionStateCache[label.rounding].Length != formatMap.Count)) { cache = getSessionstateFormats(SharedData.Sessions.SessionList[session], label.rounding); SharedData.themeSessionStateCache[label.rounding] = cache; SharedData.cacheMiss++; } else { cache = SharedData.themeSessionStateCache[label.rounding]; SharedData.cacheHit++; } if (label.uppercase) return String.Format(format, cache).ToUpper().Replace("\\n", System.Environment.NewLine); else return String.Format(format, cache).Replace("\\n", System.Environment.NewLine); }
public string formatFollowedText(LabelProperties label, StandingsItem standing, SessionInfo session) { string output = ""; Dictionary<string, int> formatMap = new Dictionary<string, int>() { {"fullname", 0}, {"shortname", 1}, {"initials", 2}, {"license", 3}, {"club", 4}, {"car", 5}, {"class", 6}, {"carnum", 7}, {"fastlap", 8}, {"prevlap", 9}, {"curlap", 10}, {"lapnum", 11}, {"speedfast_mph", 12}, {"speedprev_mph", 13}, {"speedfast_kph", 14}, {"speedprev_kph", 15}, {"position", 16}, {"position_ord", 17}, {"gap", 18}, {"lapsled", 19}, {"driverid", 20}, {"interval", 21}, {"interval_time", 22}, {"livegap", 23}, {"liveinterval", 24}, {"livespeed_kph", 25}, {"livespeed_mph", 26}, {"sector1", 27}, {"sector2", 28}, {"sector3", 29}, {"pitstops", 30}, {"pitstoptime", 31}, {"sector1_speed_kph", 32}, {"sector2_speed_kph", 33}, {"sector3_speed_kph", 34}, {"sector1_speed_mph", 35}, {"sector2_speed_mph", 36}, {"sector3_speed_mph", 37}, {"positiongain", 38}, {"classposition", 39}, {"classposition_ord", 40}, {"classpositiongain", 41}, {"classgap", 42}, {"classlivegap", 43}, {"classinterval", 44}, {"classliveinterval", 45}, {"classlapsled", 46}, {"startposition", 47}, {"classstartposition", 48}, {"classstartposition_ord", 49}, {"startposition_ord", 50}, {"highestposition", 51}, {"highestposition_ord", 52}, {"lowestposition", 53}, {"lowestposition_ord", 54}, {"classhighestposition", 55}, {"classhighestposition_ord", 56}, {"classlowestposition", 57}, {"classlowestposition_ord", 58}, {"points", 59}, {"points_pos", 60}, {"points_pos_ord", 61}, {"liveposition", 62}, {"liveposition_ord", 63}, {"classliveposition", 64}, {"classliveposition_ord", 65}, {"irating", 66}, {"liveintervalfollowed", 67}, {"inpit",68}, {"teamid",69}, // KJ: new text property {"teamname",70}, // KJ: new text property }; int start, end, end2; StringBuilder t = new StringBuilder(label.text); // replace strings with numbers foreach (KeyValuePair<string, int> pair in formatMap) { t.Replace("{" + pair.Key + "}", "{" + pair.Value + "}"); // KJ: there could be a dependent text property usage t.Replace("|" + pair.Key + "}", "|" + pair.Value + "}"); } // replace external strings with numbers int maxExternelData = 0; if (SharedData.externalData.ContainsKey(standing.Driver.UserId)) { for (int i = 0; i < SharedData.externalData[standing.Driver.UserId].Length; i++) { t.Replace("{external:" + i + "}", "{" + (formatMap.Keys.Count + i) + "}"); // KJ: there could be a dependent text property usage foreach ( KeyValuePair<string, int> pair in formatMap ) { t.Replace("{external:" + i + "|" + pair.Value + "}", "{" + (formatMap.Keys.Count + i) + "}"); } } maxExternelData = Math.Max(maxExternelData, SharedData.externalData[standing.Driver.UserId].Length); } // remove leftovers string format = t.ToString(); do { start = format.IndexOf("{external", 0); if (start >= 0) { end = format.IndexOf('}', start) + 1; end2 = format.IndexOf('|', start) + 1; if (end2 < end && end2 > start) { start++; end = end2; } format = format.Remove(start, end - start); } } while (start >= 0); t = new StringBuilder(format); // run scripts if (label.text.Contains("{script:")) { String[] scripts = SharedData.scripting.Scripts; foreach(String script in scripts) { String text = t.ToString(); do { start = text.IndexOf("{script:" + script + ":", 0); // if script name found if (start >= 0) { end = text.IndexOf('}', start) + 1; // if ending found if (end > start) { String method = text.Substring(start + script.Length + 9, end - start - script.Length - 10); String result = SharedData.scripting.getDriverInfo(script, method, standing, session, label.rounding); t.Replace("{script:" + script + ":" + method + "}",result ); } } text = t.ToString(); } while (t.ToString().Contains("{script:" + script + ":")); } } // remove leftovers format = t.ToString(); do { start = format.IndexOf("{script", 0); if (start >= 0) { end = format.IndexOf('}', start) + 1; logger.Warn("Script Call not found: {0} ", format.Substring(start,end-start)); format = format.Remove(start, end - start); } } while (start >= 0); if (standing.Driver.CarIdx < 0) { output = String.Format(format, getFollowedFormats(standing, session, label.rounding)); } else if (SharedData.themeDriverCache[standing.Driver.CarIdx][label.rounding] == null) { string[] cache = getFollowedFormats(standing, session, label.rounding); SharedData.themeDriverCache[standing.Driver.CarIdx][label.rounding] = cache; try { output = String.Format(format, cache); } catch (FormatException) { output = "[invalid]"; } SharedData.cacheMiss++; } else { try { output = String.Format(format, SharedData.themeDriverCache[standing.Driver.CarIdx][label.rounding]); } catch (FormatException) { output = "[invalid]"; } SharedData.cacheHit++; } output = output.Replace("\\n", System.Environment.NewLine); if (label.uppercase) return output.ToUpper(); else return output; }
private LabelProperties GenerateLabelProperties(LabelListSetting listSetting) { LabelProperties labels = new LabelProperties(); if (listSetting != null) { listSetting.RelatedLabelProperties = labels; foreach (var setting in listSetting.LabelSettings) { var labelClass = new AttributeLabelClass { TextExpression = setting.TextExpression, LabelPlacement = setting.Placement, LabelPosition = setting.Position, IsVisible = setting.IsVisible, Symbol = new TextSymbol { Color = setting.LabelColor } }; labels.LabelClasses.Add(labelClass); setting.RelatedAttributeLabelClass = labelClass; } } //AttributeLabelClass label = new AttributeLabelClass //{ // TextExpression = $"[{Diamond2Attributes.Temperature}]", // LabelPlacement = LabelPlacement.PointAboveLeft, // Symbol = new TextSymbol // { // Color = Colors.Red // }, // LabelPosition = LabelPosition.FixedPositionWithOverlaps, //}; //labels.LabelClasses.Add(label); //label = new AttributeLabelClass //{ // TextExpression = $"[{Diamond2Attributes.TemperatureDiff}]", // LabelPlacement = LabelPlacement.PointCenterLeft, // Symbol = new TextSymbol // { // Color = Colors.Blue // }, // LabelPosition = LabelPosition.FixedPositionWithOverlaps, // IsVisible = false //}; //labels.LabelClasses.Add(label); //label = new AttributeLabelClass //{ // TextExpression = $"[{Diamond2Attributes.DewPoint}]", // LabelPlacement = LabelPlacement.PointBelowLeft, // Symbol = new TextSymbol // { // Color = Colors.Blue // }, // LabelPosition = LabelPosition.FixedPositionWithOverlaps, // IsVisible = false //}; //labels.LabelClasses.Add(label); //label = new AttributeLabelClass //{ // TextExpression = $"[{Diamond2Attributes.WindSpeed}]", // LabelPlacement = LabelPlacement.PointAboveRight, // Symbol = new TextSymbol // { // Color = Colors.Blue // }, // LabelPosition = LabelPosition.FixedPositionWithOverlaps //}; //labels.LabelClasses.Add(label); //label = new AttributeLabelClass //{ // TextExpression = $"[{Diamond2Attributes.Height}]", // LabelPlacement = LabelPlacement.PointCenterRight, // Symbol = new TextSymbol // { // Color = Colors.Blue // }, // LabelPosition = LabelPosition.FixedPositionWithOverlaps, // IsVisible = false //}; //labels.LabelClasses.Add(label); //label = new AttributeLabelClass //{ // TextExpression = $"[{Diamond2Attributes.StationNumber}]", // LabelPlacement = LabelPlacement.PointBelowRight, // Symbol = new TextSymbol // { // Color = Colors.Blue // }, // LabelPosition = LabelPosition.FixedPositionWithOverlaps, // IsVisible = false //}; //labels.LabelClasses.Add(label); return(labels); }
public ReportLabelControl(int id, int posX, int posY, int width, int height) : base(id, posX, posY, width, height) { Properties = new LabelProperties(this); }