// 栅格/TIN图层等值线 public static GeomLayer Value2Contour(ValueLayer layer, IEnumerable <double> targetSplits, string postFix = "") { List <GeomPoint> points = null; List <GeomArc> arcs = null; // 执行搜索算法 switch (layer) { case GridLayer layer1: Contour.GenContourGrid(layer1.data, targetSplits, out points, out arcs); break; case TINLayer layer1: Contour.GenContourTIN(layer1.edgeSides, layer1.values, targetSplits, out points, out arcs); break; default: return(null); } // 创建图层 var result = new GeomLayer(GeomType.Arc, layer.Name + "_等值线" + postFix) { points = points, arcs = arcs }; // 默认样式 result.colors["arc"] = ColorOps.Random(); result.SetPartVisible("point", false); return(result); }
public LayerSettingsGrid(ValueLayer layer) { InitializeComponent(); origin = layer; LayerSettings.BindTitle(layer, layerName, this); LayerSettings.BindColor(layer, button1, "low", splitContainer1.Panel1); LayerSettings.BindColor(layer, button2, "high", splitContainer2.Panel1); LayerSettings.BindColor(layer, button3, "grid", splitContainer3.Panel1); LayerSettings.BindSize(layer, numericUpDown1, "low"); LayerSettings.BindSize(layer, numericUpDown2, "high"); LayerSettings.BindSize(layer, numericUpDown3, "grid"); }
public void RunHeapAndExpressionAnalyses() { if (this.heap_analysis != null) { return; } this.heap_analysis = new HeapAnalysis.HeapAnalysis(StackLayer); StackLayer.CreateForward(this.heap_analysis) (this.heap_analysis.InitialValue()); ValueLayer = CodeLayerFactory.Create( this.heap_analysis.GetDecoder(StackLayer.ILDecoder), StackLayer.MetaDataProvider, StackLayer.ContractProvider, source => source.ToString(), dest => dest.ToString()); var expressionAnalysis = new ExpressionAnalysisFacade <SymbolicValue, IValueContextProvider <SymbolicValue>, IImmutableMap <SymbolicValue, LispList <SymbolicValue> > > (ValueLayer, this.heap_analysis.IsUnreachable); ValueLayer.CreateForward(expressionAnalysis.CreateExpressionAnalysis()) (expressionAnalysis.InitialValue(SymbolicValue.GetUniqueKey)); if (DebugOptions.Debug) { Console.WriteLine("------------Value based CFG-----------------"); ValueLayer.ILDecoder.ContextProvider.MethodContext.CFG.Print(Console.Out, ValueLayer.Printer, null, null); } IILDecoder <APC, LabeledSymbol <APC, SymbolicValue>, SymbolicValue, IExpressionContextProvider <LabeledSymbol <APC, SymbolicValue>, SymbolicValue>, IImmutableMap <SymbolicValue, LispList <SymbolicValue> > > decoder = expressionAnalysis.GetDecoder(ValueLayer.ILDecoder); this.expr2String = ExpressionPrinterFactory.Printer(decoder.ContextProvider, this); ExpressionLayer = CodeLayerFactory.Create(decoder, ValueLayer.MetaDataProvider, ValueLayer.ContractProvider, this.expr2String, ValueLayer.VariableToString); if (DebugOptions.Debug) { Console.WriteLine("------------Expression based CFG-------------"); ExpressionLayer.ILDecoder.ContextProvider.MethodContext.CFG.Print(Console.Out, ExpressionLayer.Printer, null, null); } HybridLayer = CodeLayerFactory.Create(ValueLayer.ILDecoder, ValueLayer.MetaDataProvider, ValueLayer.ContractProvider, ValueLayer.ExpressionToString, ValueLayer.VariableToString, ExpressionLayer.Printer); }
// 根据图层生成等分位置 public void CalcSplits(object sender, EventArgs e) { ValueLayer layer = comboLayer.SelectedItem as ValueLayer; if (layer == null) { return; } // 计算等分位置 double splitSize = (double)inputSplitSize.Value; double splitBase = (double)inputSplitBase.Value; int s1 = (int)Math.Ceiling((layer.Min - splitBase) / splitSize); int s2 = (int)Math.Floor((layer.Max - splitBase) / splitSize); N = Math.Max(s2 - s1 + 1, 0); targetSplits = Utils.Linear(splitBase, splitSize, s1, s2); double sMin = splitBase + splitSize * s1; double sMax = splitBase + splitSize * s2; // 更新文字 switch (N) { case 0: splitPreview.Text = "无"; break; case 1: splitPreview.Text = sMin.ToString(); break; case 2: case 3: splitPreview.Text = String.Join(", ", from i in targetSplits select sMax.SciString(3)); break; default: splitPreview.Text = String.Format("{0}, [{1}个元素], {2}", sMin.SciString(3), N - 2, sMax.SciString(3)); break; } }