public static void GetEffectiveAnalysis(BaseContent p, ref AnalysisMetaInfo a) { if (p.PoiType != null) GetEffectiveAnalysis(p.PoiType, ref a); if (p.Style != null && p.Style.Analysis != null) a.Highlights.AddRange(p.Style.Analysis.Highlights); if (p.RuntimeHighlights.Any()) a.Highlights.AddRange(p.RuntimeHighlights); }
/// <summary> /// Recalculate analysis style based on filters. Also resets the effective style. /// </summary> /// <returns></returns> public bool UpdateAnalysisStyle() { // get effective highlights var a = new AnalysisMetaInfo { Highlights = new List<Highlight>() }; GetEffectiveAnalysis(this, ref a); //var a = (PoiType != null && PoiType.Style != null && PoiType.Style.Analysis != null) // ? PoiType.Style.Analysis // : (Style!=null && Style.Analysis!=null) ? Style.Analysis : null; if (a == null || !a.Highlights.Any()) return false; NAnalysisStyle = new PoIStyle(); foreach (var hl in a.Highlights.Where(k => k.IsActive).OrderBy(k => k.Priority)) hl.CalculateResult(this); nEffectiveStyle = null; NotifyOfPropertyChange(() => NEffectiveStyle); return true; }
public void FromXml(XElement res, string directoryName, bool catchException) { try { Folder = directoryName; BaseStyle = res.GetString("BaseStyle"); FillColor = res.GetNullColor("FillColor"); StrokeColor = res.GetNullColor("StrokeColor"); var dm = res.GetString("DrawingMode"); if (!string.IsNullOrEmpty(dm)) DrawingMode = (DrawingModes) Enum.Parse(typeof (DrawingModes), dm); strokeWidth = res.GetNullDouble("StrokeWidth"); IconWidth = res.GetNullDouble("IconWidth"); IconHeight = res.GetNullDouble("IconHeight"); Icon = res.GetString("IconUri"); Category = res.GetString("Category"); CallOutFillColor = res.GetNullColor("CallOutFillColor"); CallOutForeground = res.GetNullColor("CallOutForeground"); var tm = res.GetString("TapMode"); if (tm!=null) TapMode = (TapMode) Enum.Parse(typeof (TapMode), tm); var ttm = res.GetString("TitleMode"); if (ttm != null) TitleMode = (TitleModes) Enum.Parse(typeof (TitleModes), ttm); MinResolution = res.GetNullDouble("MinResolution"); MaxResolution = res.GetNullDouble("MaxResolution"); NameLabel = res.GetString("NameLabel"); AutoCallOutLabels = res.GetNullBool("AutoCallOutLabels"); StrokeOpacity = res.GetNullDouble("StrokeOpacity"); FillOpacity = res.GetNullDouble("FillOpacity"); Visible = res.GetNullBool("Visible"); Name = res.GetString("Name"); CanRotate = res.GetNullBool("CanRotate"); CanMove = res.GetNullBool("CanMove"); CanEdit = res.GetNullBool("CanEdit"); CanDelete = res.GetNullBool("CanDelete"); CallOutTimeOut = res.GetNullInt("CallOutTimeOut"); ShowOnTimeline = res.GetString("ShowOnTimeline"); MaxTitleResolution = res.GetNullDouble("MaxTitleResolution"); CallOutMaxWidth = res.GetNullDouble("CallOutMaxWidth"); CallOutMinHeight = res.GetNullDouble("CallOutMinHeight"); InnerTextLabel = res.GetString("InnerTextLabel"); InnerTextColor = res.GetNullColor("InnerTextColor"); Cluster = res.GetBool("Cluster"); ScalePoi = res.GetNullBool("ScalePoi"); ScaleStartResolution = res.GetNullDouble("ScaleStartResolution"); ScaleUnits = res.GetNullDouble("ScaleUnits"); MaxScale = res.GetNullDouble("MaxScale"); SubTitles = res.GetString("SubTitles"); var am = res.GetString("AddMode"); if (am!=null) AddMode = (AddModes) Enum.Parse(typeof (AddModes), am); var coo = res.GetString("CallOutOrientation"); if (coo!=null) CallOutOrientation = (CallOutOrientation)Enum.Parse(typeof (CallOutOrientation),coo); var tb = res.GetString("TimelineBehaviour"); if (tb != null) TimelineBehaviour = (TimelineBehaviours) Enum.Parse(typeof (TimelineBehaviours), tb); var ami = res.Element("AnalysisMetaInfo"); if (ami == null) return; Analysis = new AnalysisMetaInfo(); var hlx = ami.Element("Highlights"); if (hlx == null) return; Analysis.Highlights = new List<Highlight>(); foreach (var hx in hlx.Elements()) { var h = new Highlight(); h.FromXml(hx); h.Style = this; Analysis.Highlights.Add(h); } } catch (Exception e) { if (!catchException) { throw e; } Logger.Log("Poi Parser", "Error parsing style", e.Message, Logger.Level.Warning); } }