public void ClearAllAnchors() { if (anchorStore == null) { Debug.Log("Anchor store hasn't been loaded."); return; } string[] anchorIds = anchorStore.GetAllIds(); foreach (string id in anchorIds) { existingAnchors[id].OnDelete(); } if (graphInfo == null) { graphInfo = new GraphInfo(); } else { graphInfo.Reset(); } Debug.Log($"Anchor store is cleared. Anchor count: {anchorStore.anchorCount}."); }
private void OnAnchorStoreLoaded(WorldAnchorStore store) { anchorStore = store; if (clearAnchorOnStart) { anchorStore.Clear(); if (graphInfo == null) { graphInfo = new GraphInfo(); } else { graphInfo.Reset(); } Debug.Log("All anchors are cleared."); return; } string[] anchorIds = anchorStore.GetAllIds(); foreach (string id in anchorIds) { AnchorHandler anchorHandler = LoadAnchor(id); existingAnchors.Add(id, anchorHandler); anchorHandler.Anchor.OnTrackingChanged += OnAnchorTrackingChanged; Debug.Log($"Anchor {id} isLocated: {anchorHandler.Anchor.isLocated}"); } Debug.Log($"Anchor Store loaded. Current Ids: {string.Join(", ", anchorIds)}."); }
public void TestLoadRing() { var graph = GraphInfo.Load("../../../Data/ring.json"); Assert.Equal(10, graph.Nodes.Count); Assert.Equal(10, graph.Edges.Count); }
private void LoadGraphInfo() { if (!File.Exists(graphInfoFilePath)) { Debug.LogWarning("Graph info file not exists."); return; } GraphInfo graphInfo; try { using (Stream stream = new FileStream(graphInfoFilePath, FileMode.Open, FileAccess.Read)) { stream.Position = 0; IFormatter formatter = new BinaryFormatter(); graphInfo = (GraphInfo)formatter.Deserialize(stream); } this.graphInfo = graphInfo; } catch (Exception e) { Debug.LogError($"Fail to load graph. {e.Message}"); this.graphInfo = new GraphInfo { Nodes = new Dictionary <string, GraphNode>() }; } }
public void TestLoadSimple() { var graph = GraphInfo.Load("../../../Data/simple.json"); Assert.Equal(3, graph.Nodes.Count); Assert.Single(graph.Edges); }
static async Task <GraphInfo> GetCDAGraphInfo(HttpRequestMessage req, TraceWriter log) { GraphInfo cdaInfo = null; try { // Using the passed in token from the mobile app (which will authenticate against the MSFT corp AD) - call the MS Graph to get user info if (!req.Headers.Authorization.Scheme.Equals("bearer", StringComparison.OrdinalIgnoreCase) && !string.IsNullOrWhiteSpace(req.Headers.Authorization.Parameter)) { return(null); } var token = req.Headers.Authorization.Parameter; var graphReqMsg = new HttpRequestMessage(HttpMethod.Get, "https://graph.microsoft.com/v1.0/me"); graphReqMsg.Headers.Authorization = new AuthenticationHeaderValue("bearer", token); var graphResponse = await httpClient.SendAsync(graphReqMsg); cdaInfo = GraphInfo.FromJson(await graphResponse.Content.ReadAsStringAsync()); if (string.IsNullOrWhiteSpace(cdaInfo.UserPrincipalName)) { return(null); } log.Info(cdaInfo.ToString()); } catch (Exception ex) { log.Error("Graph HTTP call", ex); return(null); } return(cdaInfo); }
public static GraphInfo GetGraphInfo(this UIGraphData graph, BlobAssetReference <CompiledUISchema> schema, out NativeArray <NodeInfo> configLayout, Allocator allocator) { var offset = sizeof(ulong) + sizeof(int); configLayout = new NativeArray <NodeInfo>(graph.GetNodeCount(), allocator); var graphInfo = new GraphInfo(); for (int currentIndex = 0; currentIndex < graph.GetNodeCount(); currentIndex++) { //var size = UnsafeUtility.AsRef<int>((((IntPtr)graph.Value.initialConfiguration.GetUnsafePtr()) + offset).ToPointer()); var size = *(int *)(graph.value + offset).ToPointer(); var header = (HeaderConfig *)(graph.value + offset + sizeof(int)).ToPointer(); //var size = graph.GetNodeLength(currentIndex); if (header->IsDedicatedNode) { graphInfo.subMeshCount++; } offset += UnsafeUtility.SizeOf <int>(); NodeInfo info = new NodeInfo { configurationMask = header->configurationMask, nodeOffset = offset, childrenOffset = offset + UnsafeUtility.SizeOf <HeaderConfig>(), configOffset = offset + UnsafeUtility.SizeOf <HeaderConfig>() + (sizeof(int) * header->childCount), length = size, index = currentIndex }; var call = header->schemaIndex >= 0 ? schema.Value.elements[header->schemaIndex].renderBoxCounter : default; info.renderBoxCount = call.IsCreated ? call.Invoke(graph.value, (NodeInfo *)UnsafeUtility.AddressOf(ref info)) : 1; configLayout[currentIndex] = info; graphInfo.renderBoxCount += info.renderBoxCount; offset += size; } return(graphInfo); }
public IActionResult Calculation() { var graph = new OrientedGraph(new RelationsAdapter(Request.Query).Adapt()); var adjMatrix = graph.ToMatrix(); var graphInfo = new GraphInfo(graph); var taktsOfCreation = graphInfo.TactsOfCreation(); var taktsOfExtinction = graphInfo.TactsOfExtinction(); var taktsOfStore = graphInfo.TactsOfStore(); var inputs = graphInfo.Inputs; var outputs = graphInfo.Outputs; var power = graphInfo.Power; var powers = graphInfo.MatricesToZero; var bMatrix = new BMatrix(adjMatrix); var matrixAdapter = new MatrixAdapter(); var graphInfoAdapter = new GraphInfoAdapter(); return(Json(new { aMatrices = matrixAdapter.AdaptAdjacencyMatrixWithPowers(powers), graphInfo = graphInfoAdapter.AdaptGraphInfo(power, inputs, outputs), tactsTable = graphInfoAdapter.AdaptTacts(taktsOfCreation, taktsOfExtinction, taktsOfStore), bMatrix = matrixAdapter.AdaptBMatrix(bMatrix) })); }
// =================================================================== // CODE GENERATION FUNCTIONS // ------------------------------------------------------------------- /// Generate the enable block header code. /// /// @param indentSize The indentation needed for the class definition. /// @return The formatted header code for the if-statement. /// public override string GenerateHeader(int indentSize) { var indent = ToIndent(indentSize); var result = new StringBuilder(indent, 1024); result.Append("if("); var len = myEnablePorts.Length; for (int i = 0; i < len; ++i) { if (myEnableCode[i] != null) { result.Append(myEnableCode[i].GenerateBody(0)); } else { result.Append(GetNameFor(GraphInfo.GetProducerPort(myEnablePorts[i]))); } if (i < len - 1) { result.Append(" || "); } } result.Append(") {\n"); return(result.ToString()); }
private void UpdateGraphInfoOnCreation(string idCreated) { if (graphInfo == null) { graphInfo = new GraphInfo(); } RemoveOutdatedAnchorsFromGraph(); List <AnchorHandler> locatedAnchors = GetLocatedAnchors(); // The newly created anchor will always show isLocated = false, so we need to manually add it to the locatedAnchors list. AnchorHandler anchorHandler = existingAnchors[idCreated]; locatedAnchors.Add(anchorHandler); ResetLocatedNodes(locatedAnchors); UpdateOffsetList(locatedAnchors); updateNeighbourTask = UpdateNeighbourOnCreationAsync(anchorHandler); foreach (GraphNode node in graphInfo.Nodes.Values) { Debug.Log("Graph info updated:"); Debug.Log($"{node.AnchorId}: {node.OffsetList.Count}"); } SaveGraphInfo(); }
public FormZedGraphWithSingle(GraphInfo info) { InitializeComponent(); zedGraphControl1.GraphPane.Title.Text = info.Title; //设置标题内容 zedGraphControl1.GraphPane.XAxis.Title.Text = info.XTitle; //X轴标题 zedGraphControl1.GraphPane.YAxis.Title.Text = info.YTitle; PointPairList list1 = info.List; //数据 zedGraphControl1.GraphPane.Title.FontSpec.Size = 18; //设置标题大小 zedGraphControl1.GraphPane.XAxis.Title.FontSpec.Size = 14; //设置x轴标题大小 zedGraphControl1.GraphPane.YAxis.Title.FontSpec.Size = 14; //设置y轴标题大小 zedGraphControl1.GraphPane.CurveList.Clear(); LineItem mycurve = zedGraphControl1.GraphPane.AddCurve(info.YTitle + "-" + info.XTitle + "图线", list1, Color.Red, SymbolType.None);//绘制图表 if (info.hasY2) { zedGraphControl1.GraphPane.Y2Axis.Title.Text = info.Y2Title; PointPairList list2 = info.List2; zedGraphControl1.GraphPane.Y2Axis.Title.FontSpec.Size = 14;//设置y轴标题大小 LineItem mycurve2 = zedGraphControl1.GraphPane.AddCurve(info.Y2Title + "-" + info.XTitle + "图线", list2, Color.Blue, SymbolType.None); mycurve2.IsY2Axis = true; zedGraphControl1.GraphPane.Y2Axis.IsVisible = true; } //坐标轴范围、刻度调整后需要加上下面的语句才能刷新 zedGraphControl1.AxisChange(); zedGraphControl1.Refresh(); imageSavePath = info.imageSavePath; }
public void TestLoadFullyConnected() { var graph = GraphInfo.Load("../../../Data/fully_connected.json"); Assert.Equal(10, graph.Nodes.Count); Assert.Equal(10, graph.Edges.Count); }
// ------------------------------------------------------------------------- /// Returns list of nodes required for code generation /// /// @param node Root node from which the code will be generated. /// CodeBase[] GetFunctionBodyParts(iCS_EditorObject node) { var code = new List <CodeBase>(); node.ForEachChildRecursiveDepthFirst( vsObj => { if (Context.IsInError(vsObj.InstanceId)) { Debug.LogWarning("iCanScript: Code not generated for node in Error: " + VSObject.FullName); return; } if (IsFieldOrPropertyGet(vsObj)) { code.Add(new GetPropertyCallDefinition(vsObj, this)); } else if (IsFieldOrPropertySet(vsObj)) { code.Add(new SetPropertyCallDefinition(vsObj, this)); } else if (vsObj.IsKindOfFunction && !vsObj.IsConstructor) { code.Add(new FunctionCallDefinition(vsObj, this)); } else if (vsObj.IsConstructor && !AreAllInputsConstant(vsObj)) { code.Add(new ConstructorDefinition(vsObj, this)); } else if (vsObj.IsInlineCode) { code.Add(new InlineCodeDefinition(vsObj, this)); } else if (vsObj.IsTriggerPort) { if (ShouldGenerateTriggerCode(vsObj)) { var triggerSet = new TriggerSetDefinition(vsObj, this); var triggerVariable = new TriggerVariableDefinition(vsObj, this, triggerSet); code.Add(triggerVariable); code.Add(triggerSet); } } else if (vsObj.IsOutDataPort && vsObj.ParentNode == node) { var portVariable = Context.GetCodeFor(vsObj); if (portVariable != null) { var producerPort = GraphInfo.GetProducerPort(vsObj); if (producerPort != null) { var consumerCode = new VariableReferenceDefinition(vsObj, this); var producerCode = new VariableReferenceDefinition(producerPort, this); code.Add(new AssignmentDefinition(this, consumerCode, producerCode)); } } } } ); return(code.ToArray()); }
public void TestRingEccentricity() { var graph = GraphInfo.Load("../../../Data/ring.json"); var(distance, nodes) = Distance.CalcEccentricity(graph.BuildSparseIncedenceMatrix(), 0); Assert.Equal(9, distance); Assert.Single(nodes); }
public void TestFullyConnectedDiameter() { var graph = GraphInfo.Load("../../../Data/fully_connected.json"); var(diam, pairs) = Distance.CalcDiameter(graph.BuildSparseIncedenceMatrix()); Assert.Equal(1, diam); Assert.Equal(90, pairs.Count()); }
private void InitMeshData(ref MeshData meshData, GraphInfo graphInfo) { var parameters = UIVertexData.AllocateVertexDescriptor(Allocator.Temp); meshData.SetVertexBufferParams(graphInfo.renderBoxCount * 4, parameters); meshData.SetIndexBufferParams(graphInfo.renderBoxCount * 6, UnityEngine.Rendering.IndexFormat.UInt16); meshData.subMeshCount = graphInfo.MeshCount; }
public void TestRingDiameter() { var graph = GraphInfo.Load("../../../Data/ring.json"); var(diam, pairs) = Distance.CalcDiameter(graph.BuildSparseIncedenceMatrix()); Assert.Equal(9, diam); Assert.Equal(10, pairs.Count()); }
public void TestFullyConnectedEccentricity() { var graph = GraphInfo.Load("../../../Data/fully_connected.json"); var(distance, nodes) = Distance.CalcEccentricity(graph.BuildSparseIncedenceMatrix(), 0); Assert.Equal(1, distance); Assert.Equal(9, nodes.Count); }
// =================================================================== // COMMON INTERFACE FUNCTIONS // ------------------------------------------------------------------- /// Resolves any dependencies that this code has. public override void ResolveDependencies() { // Optimize input parameters to fields/properties for (int i = 0; i < myParameters.Length; ++i) { var code = myParameters[i]; var producerCode = OptimizeInputParameter(code, myParent); if (producerCode != null) { myParameters[i] = producerCode; producerCode.Parent = myParent; } myParameters[i].ResolveDependencies(); } // -- Optimize target port from get fields/properties. -- if (!IsStatic()) { var targetPort = GraphInfo.GetTargetPort(VSObject); if (targetPort != null) { var producerPort = GraphInfo.GetProducerPort(targetPort); var producerCode = Context.GetCodeFor(producerPort.ParentNode); if (producerCode is GetPropertyCallDefinition) { if (producerPort.ConsumerPorts.Length == 1) { myTargetCode = producerCode; producerCode.Parent.Remove(producerCode); producerCode.Parent = myParent; } } } } // Ask output objects to resolve their own child dependencies. foreach (var v in myOutputVariables) { v.ResolveDependencies(); } if (myReturnVariable != null) { myReturnVariable.ResolveDependencies(); // Return variable relocation var returnParent = GetProperParentForProducerPort(myReturnVariable); if (returnParent != null && returnParent != myParent) { var returnPort = myReturnVariable.VSObject; if (returnParent is ClassDefinition) { var v = new VariableDefinition(returnPort, returnParent, AccessSpecifier.Private, ScopeSpecifier.NonStatic); returnParent.AddVariable(v); myReturnVariable = null; v.ResolveDependencies(); } } } }
public GraphBehaviour(ByteBuffer byteBuffer) { this.byteBuffer = byteBuffer; GraphInfo graphInfo = GraphInfo.GetRootAsGraphInfo(byteBuffer); graphId = graphInfo.GraphId; InitCommonNodes(graphInfo); InitGraphVariables(graphInfo); runningSequenceList = new List <NodeSequence>(); allEntranceSequenceList = new List <NodeSequence>(); }
//経験値グラフの表示 public static void DrawExperienceGraph(System.Windows.Forms.DataVisualization.Charting.Chart chart, GraphInfo info) { if (chart.InvokeRequired) { CallBacks.SetChartCallBack d = new CallBacks.SetChartCallBack(DrawExperienceGraph); chart.Invoke(d, new object[] { chart, info }); } else { //初期化が必要な場合 if (HistoricalData.GraphInfoExperience != info) ExperienceGraphInit(chart, info, true); //そうでない場合 else { //古い値の消去 if (HistoricalData.GraphInfoExperience.Term != GraphInfoTerm.All) { DateTime mindate = HistoricalData.GraphInfoExperience.Term.GetMinDate(); //消去する必要がある場合 bool isdelete = DateTime.FromOADate(chart.Series[0].Points[0].XValue) < mindate; if (isdelete) { //消去 for (int i = 0; i < Math.Min(5, chart.Series[0].Points.Count); i++) { DateTime date = DateTime.FromOADate(chart.Series[0].Points[i].XValue); if (date >= mindate) break;//消す必要がなくなったら離脱 foreach (var x in chart.Series) x.Points.RemoveAt(i); } } } //最新の値の追加 if (info.Mode == 1) { ExpRecord latest = HistoricalData.LogExperience[HistoricalData.LogExperience.Count - 1]; chart.Series[0].Points.AddXY(latest.Date, latest.Value); } else if (info.Mode == 2) { SenkaRecord latest = HistoricalData.LogSenka[HistoricalData.LogSenka.Count - 1]; int[] display_rank = SenkaRecord.DisplayRank; //ボーダー for (int i = 0; i < display_rank.Length; i++) { int senkaval = latest.TopSenka[display_rank[i] - 1]; if (senkaval >= 0) chart.Series[i].Points.AddXY(latest.StartTime, senkaval); } //自分の戦果 int mysenka = latest.StartSenka; if (mysenka >= 0) chart.Series[display_rank.Length].Points.AddXY(latest.StartTime, mysenka); } } } }
private void IncrementalRender(GraphInfo info, double minX, double maxX) { // Render incremental changes to current graph. var p1 = info.GraphPane.GeneralTransform(minX, 0, CoordType.AxisXYScale); var p2 = info.GraphPane.GeneralTransform(maxX, 0, CoordType.AxisXYScale); int x = (int)p1.X - 1; int y = 0; int width = (int)(p2.X + PROGRESS_LINE_WIDTH) - x + 2; int height = (int)p1.Y + 2; StartRender(new Rectangle(x, y, width, height)); }
private void CalcWedgeIntensityDistribution() { ZArrayDescriptor arrayDescriptor1 = Form1.zArrayDescriptor[0]; ZArrayDescriptor arrayDescriptor2 = Form1.zArrayDescriptor[1]; Interval <double> intervalInt = new Interval <double>(0, 225); Interval <double> intervalM1 = new Interval <double>(0, WEDGE_M1); Interval <double> intervalM2 = new Interval <double>(0, WEDGE_M2); RealIntervalTransform intervalTransformM1 = new RealIntervalTransform(intervalInt, intervalM1); RealIntervalTransform intervalTransformM2 = new RealIntervalTransform(intervalInt, intervalM2); int width = arrayDescriptor1.width; int startY = 0; int height = 2; List <Point2D> pointsList = new List <Point2D>(); for (int x = 0; x < width - 1; x++) { for (int y = startY; y < height - 1; y++) { double intensity1 = arrayDescriptor1.array[x, y]; double intensity2 = arrayDescriptor2.array[x, y]; intensity1 = intervalTransformM1.TransformToFinishIntervalValue(intensity1); intensity2 = intervalTransformM2.TransformToFinishIntervalValue(intensity2); int b1 = Convert.ToInt32(intensity1); int b2 = Convert.ToInt32(intensity2); pointsList.Add(new Point2D(b1, b2)); } } RangeExtensionModelForm decisionTableForm = new RangeExtensionModelForm(); IList <Point2D> decisionTablePointsList = decisionTableForm.BuildTable(WEDGE_M1, WEDGE_M2, WEDGE_WIDTH); GraphInfo idealGraphInfo = new GraphInfo("Ideal graph", System.Windows.Media.Colors.Green, decisionTablePointsList.ToArray(), true, false); GraphInfo graph = new GraphInfo("Graphic", System.Windows.Media.Colors.Red, pointsList.ToArray(), false, true); IList <GraphInfo> graphCollection = new List <GraphInfo>() { idealGraphInfo, graph }; ShowGraphic(graphCollection); }
private void ProcessBinSRM( List <ChromatogramLoadingStatus.TransitionData.Peak> bin, GraphInfo info) { float retentionTime = bin[0].BinIndex * ChromatogramLoadingStatus.TIME_RESOLUTION; info.MaxX = Math.Max(info.MaxX, retentionTime + ChromatogramLoadingStatus.TIME_RESOLUTION); _renderMin = Math.Min(_renderMin, retentionTime - ChromatogramLoadingStatus.TIME_RESOLUTION); _renderMax = Math.Max(_renderMax, retentionTime + ChromatogramLoadingStatus.TIME_RESOLUTION); foreach (var peak in bin) { float intensity = peak.Intensity; info.MaxY = Math.Max(info.MaxY, intensity); // New peptide curve. if (info.LastCurve == null || !ReferenceEquals(peak.ModifiedSequence, info.LastCurve.ModifiedSequence)) { info.LastCurve = new CurveInfo(peak.ModifiedSequence, peak.Color, retentionTime, intensity); info.GraphPane.CurveList.Add(info.LastCurve.Curve); continue; } // Add intensity to existing peptide curve. for (int i = info.LastCurve.Curve.NPts - 1; i >= 0; i--) { int binIndex = ChromatogramLoadingStatus.GetBinIndex((float)info.LastCurve.Curve.Points[i].X); if (binIndex > peak.BinIndex) { if (i == 0) { info.LastCurve.InsertAt(0, retentionTime, intensity); info.LastCurve.CheckZeroes(0); } } else if (binIndex == peak.BinIndex) { info.LastCurve.Curve.Points[i].Y += intensity; info.MaxY = Math.Max(info.MaxY, (float)info.LastCurve.Curve.Points[i].Y); info.LastCurve.CheckZeroes(i); break; } else { info.LastCurve.InsertAt(i + 1, retentionTime, intensity); info.LastCurve.CheckZeroes(i + 1); break; } } } }
public void GraphChoose() { if (MainForm.test == 6) { 图片路径 = 路径 + "\\report\\pict\\动态油缸缓冲试验曲线" + DateTime.Now.ToString("yy-MM-dd hhmmss") + ".bmp"; testGraphInfo = new GraphInfo("缓冲试验报告图", "时间", "位移", 图片路径); } else if (MainForm.test == 8) { 图片路径 = 路径 + "\\report\\pict\\负载效率试验曲线" + DateTime.Now.ToString("yy-MM-dd hhmmss") + ".bmp"; // testGraphInfo = new GraphInfo("负载效率试验报告图", "压力", "负载效率", 图片路径); testGraphInfo = new GraphInfo("负载效率试验报告图", "压力", "负载效率", 图片路径); } }
public Graph(List <string> nodesList, List <string> edges, bool isSpain) { InitializeComponent(); this.Size = new Size(1200, 700); this.StartPosition = FormStartPosition.Manual; //this.Location = new Point(Form1.ActiveForm.Location.X + Form1.ActiveForm.Width, Form1.ActiveForm.Location.Y); this.FormBorderStyle = FormBorderStyle.FixedSingle; //this.Size = new Size(500, 450); gi = new GraphInfo(nodesList, edges, isSpain); trc = new TransClose(nodesList, gi.matrix); trc.Show(); }
/// <summary> /// Determine maximum values for x and y axes, possibly across all importing files. /// </summary> private void Rescale(GraphInfo info, out float maxX, out float maxY) { // Scale axis depending on whether the axes are locked between graphs. maxX = info.MaxX; maxY = info.MaxY; if (ScaleIsLocked) { foreach (var pair in _graphs) { maxX = Math.Max(maxX, pair.Value.MaxX); maxY = Math.Max(maxY, pair.Value.MaxY); } } }
/// <summary> /// Update status (main thread). /// </summary> public void UpdateStatus(ChromatogramLoadingStatus status) { if (!_backgroundInitialized) { _backgroundInitialized = true; BackgroundInitialize(); } // Create info for new file. var key = status.FilePath.GetFilePath(); var info = GetInfo(key); if (info == null) { info = _graphs[key] = new GraphInfo { GraphPane = _templatePane.Clone(), ActiveCurves = new List <CurveInfo>() }; info.GraphPane.Title.Text = status.FilePath.GetFileNameWithoutExtension(); } // Create curve information from the transition data. List <ChromatogramLoadingStatus.TransitionData.Peak> bin; while (status.Transitions.BinnedPeaks.TryDequeue(out bin)) { if (status.Transitions.Progressive) { ProcessBinProgressive(bin, info); } else { ProcessBinSRM(bin, info); } } if (status.Transitions.Progressive) { info.CurrentTime = status.Transitions.CurrentTime; info.MaxX = Math.Max(info.MaxX, status.Transitions.MaxRetentionTime); } else { info.CurrentTime = null; } status.Transitions.MaxIntensity = info.MaxY; }
private void IncrementalRender(GraphInfo info, double minX, double maxX) { // Render incremental changes to current graph. var p1 = info.GraphPane.GeneralTransform(minX, 0, CoordType.AxisXYScale); var p2 = info.GraphPane.GeneralTransform(maxX, 0, CoordType.AxisXYScale); int x = (int)p1.X - 1; int width = (int)(p2.X + PROGRESS_LINE_WIDTH) - x + 2; StartRender(new Rectangle(x, 0, width, Height)); // TODO(bspratt): there's still an issue with the clip rect in X - I don't // always see the grey "incomplete" bar on my system (the SVN 9985 version of // AgilentSpectrumMillIMSImportTest() is a reliable repro. It has to do with // adding that verticle bar after the clip region has been established. It would // be better to do the work of copying the display list here instead of later in // CopyState() so the end time stays synched. }
void InitCommonNodes(GraphInfo graphInfo) { commonNodeDictionary = new Dictionary <int, NodeBase>(); int nodeCount = graphInfo.CommonNodeIdsLength; for (int i = 0; i < nodeCount; i++) { int nodeId = graphInfo.CommonNodeIds(i); NodeBase node = DeserializeNode(nodeId); node.isCommonNode = true; node.SetGraphBehaviour(this); commonNodeDictionary.Add(nodeId, node); } }
private void UpdateGraphInfoOnRemoval(string idRemoved) { if (graphInfo == null) { graphInfo = new GraphInfo(); } if (graphInfo.Nodes.ContainsKey(idRemoved)) { graphInfo.Nodes.Remove(idRemoved); } RemoveOutdatedAnchorsFromGraph(); List <AnchorHandler> locatedAnchors = GetLocatedAnchors(); ResetLocatedNodes(locatedAnchors); foreach (GraphNode node in graphInfo.Nodes.Values) { if (node.NeighbourIds != null) { node.NeighbourIds.Remove(idRemoved); } if (node.OffsetList.Count == 0) { continue; } List <Tuple <string, SerializableVector3> > offsetListAfterRemoval = new List <Tuple <string, SerializableVector3> >(); foreach (var tuple in node.OffsetList) { if (tuple.Item1 != idRemoved) { offsetListAfterRemoval.Add(tuple); } } node.OffsetList = offsetListAfterRemoval; } UpdateOffsetList(locatedAnchors); SaveGraphInfo(); }
public static void Run() { // ExStart:RoundedCornerTable // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Tables(); Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table(); GraphInfo graph = new GraphInfo(); graph.Color = Aspose.Pdf.Color.Red; // Create a blank BorderInfo object BorderInfo bInfo = new BorderInfo(BorderSide.All, graph); // Set the border a rounder border where radius of round is 15 bInfo.RoundedBorderRadius = 15; // Set the table Corner style as Round. tab1.CornerStyle = Aspose.Pdf.BorderCornerStyle.Round; // Set the table border information tab1.Border = bInfo; // ExEnd:RoundedCornerTable }
//------------------------------------------------------------------------------------------------------------------------ public GenericRsp HandleGraphDeploymentReq(GraphDeploymentReq req, bool SupressSave) { lock (locker) { var res = new GenericRsp(); try { //get graphkey var graphkey = (GraphKey)req.GraphKey; if (graphkey.IsInvalid) { res.IsSuccess = false; res.Message = "Invalid GraphKey"; return res; } if (graphkey.NodeId != this.Node.NodeKey.NodeID) { res.IsSuccess = false; res.Message = "Invalid NodeID in GraphKey"; return res; } //collect sets var sets = Node.BeginActiveThingsUpdate(); //deploy or undeploy? if (req.IsDeployed) { //deserialize graph descriptor GraphDescriptor graphDescriptor; try { graphDescriptor = GraphBuilder.GetGraphDescriptorFromJson(req.GraphDescriptor, false); } catch (Exception ex) { DebugEx.Assert(ex, "Could not deserialize graph descriptor"); res.IsSuccess = false; res.Message = "Could not deserialize graph descriptor"; return res; } graphDescriptor.GraphKey = graphkey; //Build Graph Graph graph; try { graph = BuildGraph(graphDescriptor); } catch (Exception ex) { DebugEx.Assert(ex, "Could not build graph from graph descriptor (unhandled exception)"); res.IsSuccess = false; res.Message = "Could not build graph from graph descriptor (unhandled exception)"; return res; } if (graph == null) { DebugEx.Assert("Could not build graph from graph descriptor"); res.IsSuccess = false; res.Message = "Could not build graph from graph descriptor"; return res; } //set key graph.GraphKey = graphkey; //do i already have it? if (Graphs.ContainsKey(graphkey)) { //invalidate graph _GraphManager.InvalidateGraph(graphkey); //remove information Graphs.Remove(graphkey); } //try deploy graph try { Exception exception; var depres = graph.OnDeploy(true, null, out exception); if (!depres) { res.IsSuccess = false; res.Message = "Graph OnDeploy() failed. Message : " + (exception?.Message ?? "null"); return res; } } catch (Exception ex) { DebugEx.Assert(ex, "Graph OnDeploy() failed"); res.IsSuccess = false; res.Message = "Graph OnDeploy() failed. Message : " + ex.Message; return res; } //add to lookup var gi = new GraphInfo() { GraphKey = graphkey, GraphDescriptor = graphDescriptor, GraphDescriptorString = req.GraphDescriptor, Graph = graph, }; Graphs.Add(graphkey, gi); //save! if (IsInitialized && !SupressSave) Save(); //associate block keys foreach (var thingblock in graph.Blocks.OfType<BaseThings>()) { //Add to Thing2Block set { //find block key set var set = ThingKey2BlockKey.TryGetOrDefault(thingblock.ThingKey); if (set == null) { set = new HashSetTS<BlockKey>(); ThingKey2BlockKey.Add(thingblock.ThingKey, set); } //add to loockup set set.Add(thingblock.BlockKey); } //Add only for thingIn if (thingblock.IsThingIn) { //find block key set var set = ThingKey2ThingInBlockKey.TryGetOrDefault(thingblock.ThingKey); if (set == null) { set = new HashSetTS<BlockKey>(); ThingKey2ThingInBlockKey.Add(thingblock.ThingKey, set); } //add to loockup set set.Add(thingblock.BlockKey); } } //Handle Deploy res.IsSuccess = true; res.Message = "Graph Deployed Successfully"; } else { //Handle UnDeploy if (Graphs.ContainsKey(graphkey) == false) { res.IsSuccess = true; res.Message = "Graph Undeployed Successfully (was not deployed)"; } else { //get graph var gi = Graphs[graphkey]; var graph = gi.Graph; //inform graph Exception exception; try { if (graph.OnUndeploy(null, out exception) == false) DebugEx.Assert(exception, "Graph OnUndeploy failed"); } catch (Exception ex) { DebugEx.Assert(ex, "Graph OnUndeploy failed"); } //invalidate graph _GraphManager.InvalidateGraph(graphkey); //remove information Graphs.Remove(graphkey); //save! if (IsInitialized && !SupressSave) Save(); //disassociate block keys if (graph != null) foreach (var thingblock in gi.Graph.Blocks.OfType<BaseThings>()) { //remove from thing2block { var set = ThingKey2BlockKey.TryGetOrDefault(thingblock.ThingKey); if (set != null) set.Remove(thingblock.BlockKey); } //remove from thignIn2block if (thingblock.IsThingIn) { var set = ThingKey2ThingInBlockKey.TryGetOrDefault(thingblock.ThingKey); if (set != null) set.Remove(thingblock.BlockKey); } } //done res.IsSuccess = true; res.Message = "Graph Undeployed Successfully"; } } //finish update Node.EndActiveThingsUpdate(sets); } catch (Exception ex) { res.IsSuccess = false; res.Message = "Unhandled exception in GraphDeploymentReq(). Message=" + ex.Message; } finally { //begin activation state snapshot var sets = Node.BeginActiveThingsUpdate(); //update active ports/things var activeThings = ThingKey2BlockKey.Where(kv => kv.Value.Count > 0) .Select(kv => Node.Things.TryGetOrDefaultReadOnly(kv.Key)) .WhereNotNull().ToHashSetTS(); var activeThingKeys = activeThings.Select(t => (ThingKey)t.ThingKey).ToHashSetTS(); var activePorts = activeThings.SelectMany(t => t.Ports).ToHashSetTS(); var activePortsKeys = activePorts.Select(p => (PortKey)p.PortKey).ToHashSetTS(); //update sets Interlocked.Exchange(ref _ActiveThings, activeThings); Interlocked.Exchange(ref _ActivePorts, activePorts); Interlocked.Exchange(ref _ActiveThingKeys, activeThingKeys); Interlocked.Exchange(ref _ActivePortKeys, activePortsKeys); //trigger node thing activation update Node.EndActiveThingsUpdate(sets); } //return result msg return res; } }
//経験値のグラフの初期化 public static void ExperienceGraphInit(System.Windows.Forms.DataVisualization.Charting.Chart chart, GraphInfo info, bool infooverwrite) { chart.Series.Clear(); string[] ser_label = null; int[] display_rank = SenkaRecord.DisplayRank; int n = display_rank.Length; //系列の初期化 if (info.Mode == 1) { ser_label = new string[] { "提督経験値" }; chart.Series.Add(ser_label[0]); chart.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.FastLine; //x軸のスタイル chart.ChartAreas[0].AxisX.LabelStyle.Format = "\\\'d H:mm"; chart.Series[0].ToolTip = "#SERIESNAME \nX=#VALX{M/d H:mm} \nY=#VALY"; } else if (info.Mode == 2) { ser_label = new string[display_rank.Length + 1]; //ボーダー for (int i = 0; i < n; i++) { ser_label[i] = display_rank[i] + "位"; chart.Series.Add(ser_label[i]); chart.Series[i].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series[i].MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; chart.Series[i].BorderWidth = 2; chart.Series[i].ToolTip = "#SERIESNAME \nX=#VALX{M/d H:mm} \nY=#VALY"; } //自分の戦果 ser_label[n] = "自分"; chart.Series.Add(ser_label[n]); chart.Series[n].Color = System.Drawing.Color.FromArgb(250, 104, 0); chart.Series[n].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Area; chart.Series[n].BackHatchStyle = System.Windows.Forms.DataVisualization.Charting.ChartHatchStyle.Percent50; chart.Series[n].ToolTip = "#SERIESNAME \nX=#VALX{M/d H:mm} \nY=#VALY"; //x軸のスタイル chart.ChartAreas[0].AxisX.LabelStyle.Format = "M/d"; } //データ DateTime mindate = info.Term.GetMinDate(); //提督経験値の場合 if (info.Mode == 1) { var data = from p in HistoricalData.LogExperience where p.Date >= mindate select p; if (data.Count() == 0) return; //データのプロット foreach (var x in data) { chart.Series[0].Points.AddXY(x.Date, x.Value); } } else if (info.Mode == 2) { var data = from p in HistoricalData.LogSenka where p.StartTime >= mindate select p; if (data.Count() == 0) return; //プロット foreach (var x in data) { //ボーダー部分 for (int i = 0; i < display_rank.Length; i++) { int senkaval = x.TopSenka[display_rank[i] - 1]; if (senkaval >= 0) chart.Series[i].Points.AddXY(x.StartTime, senkaval); } //自分の戦果 int mysenka = x.StartSenka; if (mysenka >= 0) chart.Series[n].Points.AddXY(x.StartTime, mysenka); } } //Infoの更新 if (infooverwrite) HistoricalData.GraphInfoExperience = info; }