public DataGraph GetTotalSpaceUsed() { var dataGraph = new DataGraph(); List <int> serie = new List <int>(); serie.Add(12); dataGraph.Title = "Espacio usado"; serie.Add(100 - 12); serie.Add(100 - (12 + 20)); dataGraph.Data.Add(serie); dataGraph.Series.Add(new Serie() { FillColor = "#46BFBD" }); dataGraph.Series.Add(new Serie() { FillColor = "#FDB45C" }); dataGraph.Series.Add(new Serie() { FillColor = "#F7464A" }); dataGraph.DataLabels.Add("Usado"); dataGraph.DataLabels.Add("Libre"); dataGraph.DataLabels.Add("Reciclaje"); dataGraph.ChartType = ChartTypes.Pie; return(dataGraph); }
public void SetUp(DataSet dataSource) { if (dataSource is NorthwindDataSet) { Assert.Ignore("Northwind is buggy... because import in VC# is buggy"); } this.Admin.CreateDatabase(); dataSource.EnforceConstraints = true; this.graph = DataGraph.Create(dataSource); this.pop = new DatabasePopulator(); this.pop.Populate(dataSource); // add one row data per table foreach (DataTable table in this.graph.GetSortedTables()) { ITablePopulator tp = this.pop.Tables[table]; tp.Generate(); table.Rows.Add(tp.Row); table.AcceptChanges(); } this.gen = new SqlGenerator( this.ConnectionString, this.DatabaseName, dataSource ); }
static uint AddOperationToGraph(IOperation op, DataGraph <IOperation> graph, uint parentID) { if (op == null) { return(0); } // We link this node to parent (and potencially create it if it does not exist). uint id; if (!graph.Contains(op, out id)) { id = graph.AddNode(op); } // We add link only if parent exists and the link does not yet exist. if (parentID != uint.MaxValue && !graph.LinkExistsDirectional(parentID, id)) { graph.LinkDirectional(parentID, id); } // We do recursevelly for children. foreach (Pin p in op.Inputs) { AddOperationToGraph(p.Owner, graph, id); } // We return self id. return(id); }
/// <summary> /// Wählt eine neue Quellgruppe aus. /// </summary> /// <param name="location">Der Ursprung der Quellgruppe.</param> /// <param name="group">Die eigentliche Quellgruppe.</param> private void PrepareReceiver(TLocationType location, TSourceGroupType group) { // Create once if (Receiver != null) { return; } // Create receiver var receiver = new DataGraph(); try { // Load device data receiver.CaptureInformation = FindFilter(Aspect_CaptureName, Aspect_CaptureMoniker, false); receiver.TunerInformation = FindFilter(Aspect_TunerName, Aspect_TunerMoniker, true); receiver.DisableCIResetOnTuneFailure = m_disableEncryption; receiver.DVBType = DVBType; // Load optional data int value; if (int.TryParse(GetParameter(BDAEnvironment.MiniumPATCountName), out value)) { if (value >= 0) { receiver.Configuration.MinimumPATCount = value; } } if (int.TryParse(GetParameter(BDAEnvironment.MinimumPATCountWaitName), out value)) { if (value >= 0) { receiver.Configuration.MinimumPATCountWaitTime = value; } } // Configure pipeline foreach (var item in Pipeline) { item.CreateExtension <IPipelineExtension>().Install(receiver, Profile, item.SupportedOperations); } // Time to create the graph receiver.Create(location, group); // Activate it receiver.Start(); } catch { // Cleanup receiver.Dispose(); // Forward throw; } // Remember Receiver = receiver; }
public DataGraphAlgorithm(DataGraph visitedGraph) { if (visitedGraph == null) { throw new ArgumentNullException("visitedGraph"); } this.visitedGraph = visitedGraph; }
protected virtual void BuildGraph() { DataGraphPopulator gp = new DataGraphPopulator(); gp.DataSource = this.DataSet; gp.Populate(); this.graph = gp.Graph; }
public IEnumerable <DataEdge> Find(Maze map) { DataGraph graph = _mapConverter.ToGraph(map); var pathfindingAlgorithm = new ShortestPathsDijkstra <DataGraph, DataEdge>(); return(pathfindingAlgorithm.Find(graph)); }
/// <summary> /// Prepares graph area control for future use. /// </summary> /// <returns></returns> public static ReadyGraphArea Initialize(DataGraph graph) { var gg_Area = new ReadyGraphArea(); try { var logicCore = new LogicCore(); logicCore.DefaultLayoutAlgorithm = GraphX.LayoutAlgorithmTypeEnum.Tree; logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(GraphX.LayoutAlgorithmTypeEnum.Tree); ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).LayerGap = 100; ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).VertexGap = 100; ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).WidthPerHeight = 1000; ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).OptimizeWidthAndHeight = true; /************************************/ /*logicCore.DefaultLayoutAlgorithm = GraphX.LayoutAlgorithmTypeEnum.KK; * logicCore.DefaultLayoutAlgorithmParams = * logicCore.AlgorithmFactory.CreateLayoutParameters(GraphX.LayoutAlgorithmTypeEnum.KK); * ((KKLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).MaxIterations = 100;*/ /*************************************/ logicCore.DefaultOverlapRemovalAlgorithm = GraphX.OverlapRemovalAlgorithmTypeEnum.FSA; logicCore.DefaultOverlapRemovalAlgorithmParams = logicCore.AlgorithmFactory.CreateOverlapRemovalParameters(GraphX.OverlapRemovalAlgorithmTypeEnum.FSA); ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 100; ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).VerticalGap = 100; logicCore.DefaultEdgeRoutingAlgorithm = GraphX.EdgeRoutingAlgorithmTypeEnum.SimpleER; logicCore.EnableParallelEdges = true; logicCore.EdgeShowSelfLooped = true; logicCore.EdgeSelfLoopCircleOffset = new Point(0, 0); logicCore.AsyncAlgorithmCompute = false; logicCore.ParallelEdgeDistance = 50; logicCore.EdgeSelfLoopCircleRadius = 50; logicCore.EdgeCurvingEnabled = true; gg_Area.LogicCore = logicCore; gg_Area.EdgeDoubleClick += delegate(object sender, EdgeSelectedEventArgs args) { var backRef = ((DataEdge)(args.EdgeControl.Edge)).BackRef; GoToCodeEventHandler.ClickHandler(backRef, args); }; gg_Area.InitializeComponent(); gg_Area.GenerateGraph(graph, true, true, true); gg_Area.ShowAllEdgesLabels(true); gg_Area.AlignAllEdgesLabels(false); } catch (Exception e) { MessageBox.Show(e.Message); MessageBox.Show(e.StackTrace); } return(gg_Area); }
public void SetUp() { this.dataSource = new NullableAndNonNullableRelationDataSet(); this.graph = DataGraph.Create(dataSource); this.edgePredictate = new DataTableSortAlgorithm.NonNullableDataRelationEdgePredicate(); this.fgraph = new FilteredEdgeListGraph(this.graph, this.edgePredictate ); }
/// <summary> /// Prepares graph area control for future use. /// </summary> /// <returns></returns> public static ReadyGraphArea Initialize(DataGraph graph) { var gg_Area = new ReadyGraphArea(); try { var logicCore = new LogicCore(); logicCore.DefaultLayoutAlgorithm = GraphX.LayoutAlgorithmTypeEnum.Tree; logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(GraphX.LayoutAlgorithmTypeEnum.Tree); ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).LayerGap = 100; ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).VertexGap = 100; ((SimpleTreeLayoutParameters) logicCore.DefaultLayoutAlgorithmParams).WidthPerHeight = 1000; ((SimpleTreeLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).OptimizeWidthAndHeight = true; /************************************/ /*logicCore.DefaultLayoutAlgorithm = GraphX.LayoutAlgorithmTypeEnum.KK; logicCore.DefaultLayoutAlgorithmParams = logicCore.AlgorithmFactory.CreateLayoutParameters(GraphX.LayoutAlgorithmTypeEnum.KK); ((KKLayoutParameters)logicCore.DefaultLayoutAlgorithmParams).MaxIterations = 100;*/ /*************************************/ logicCore.DefaultOverlapRemovalAlgorithm = GraphX.OverlapRemovalAlgorithmTypeEnum.FSA; logicCore.DefaultOverlapRemovalAlgorithmParams = logicCore.AlgorithmFactory.CreateOverlapRemovalParameters(GraphX.OverlapRemovalAlgorithmTypeEnum.FSA); ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).HorizontalGap = 100; ((OverlapRemovalParameters)logicCore.DefaultOverlapRemovalAlgorithmParams).VerticalGap = 100; logicCore.DefaultEdgeRoutingAlgorithm = GraphX.EdgeRoutingAlgorithmTypeEnum.SimpleER; logicCore.EnableParallelEdges = true; logicCore.EdgeShowSelfLooped = true; logicCore.EdgeSelfLoopCircleOffset = new Point(0,0); logicCore.AsyncAlgorithmCompute = false; logicCore.ParallelEdgeDistance = 50; logicCore.EdgeSelfLoopCircleRadius = 50; logicCore.EdgeCurvingEnabled = true; gg_Area.LogicCore = logicCore; gg_Area.EdgeDoubleClick += delegate(object sender, EdgeSelectedEventArgs args) { var backRef = ((DataEdge) (args.EdgeControl.Edge)).BackRef; GoToCodeEventHandler.ClickHandler(backRef, args); }; gg_Area.InitializeComponent(); gg_Area.GenerateGraph(graph, true, true, true); gg_Area.ShowAllEdgesLabels(true); gg_Area.AlignAllEdgesLabels(false); } catch (Exception e) { MessageBox.Show(e.Message); MessageBox.Show(e.StackTrace); } return gg_Area; }
public void Can_access_child_property() { var data = new DataGraph { Readonly = { Id = 42, Name = "Everything" } }; var freezable = Freezer.AsFreezable(data); AssertSameValue(data, freezable); }
public void ClearData() { data = null; OnCreateDataNode = null; OnRemoveDataNode = null; OnCreateDataEdge = null; OnRemoveDataEdge = null; ClearCanvas(); }
public DataGraph <int> GetHistoryDataDefitition() { var dataGraph = new DataGraph <int>(); dataGraph.ChartType = ChartTypes.Historical; //var usersAddedYear = (new BR.DataGraphBR()).GetHistoricalAdded("m", 12, "secUser"); dataGraph.Title = "Egresos"; dataGraph.UrlData = VirtualPathUtility.ToAbsolute("~/") + "SFSServiceDesk/Dashboard/GetDataGraphJson/HistoricalData"; return(dataGraph); }
public ActionResult GetDataGraphJson(string id, DateTime?from, DateTime?to) { DataGraph <decimal> result = new DataGraph <decimal>(); if (id == "HistoricalData") { return(Json(GetHistoryData(from, to), JsonRequestBehavior.AllowGet)); } return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Aktiviert die Entschlüsselung einer Quelle. /// </summary> /// <param name="token">Informationen zur gewählten Quelle.</param> /// <exception cref="NotSupportedException">Aktuell kann immer nur eine Quelle entschlüsselt werden.</exception> private PipelineResult Decrypt(DataGraph.DecryptToken token) { // Load graph if (token != null) { m_DataGraph = token.Pipeline.Graph; } // Get unique call identifier var callIdentifier = Interlocked.Increment(ref m_ChangeCounter); // Check mode of operation var sources = (token == null) ? null : token.Sources; if ((sources == null) || (sources.Length < 1)) { // Shutdown if (sources == null) { lock (m_deviceAccess) Close(); } // Next return(PipelineResult.Continue); } // Check request if (sources.Length != 1) { throw new NotSupportedException(Properties.Resources.Exception_DecryptSingle); } // Wait for PMT token.WaitForPMTs((pmt, first) => { // See if we are still allowed to process and do so lock (m_deviceAccess) if (Thread.VolatileRead(ref m_ChangeCounter) == callIdentifier) { Decrypt(pmt); } else { return(false); } // Next return(true); }, sources); // Next return(PipelineResult.Continue); }
/// <summary> /// Entschlüsselt eine einzelne Quelle. /// </summary> /// <param name="service">Die Informationen zur Quelle.</param> /// <param name="graph">Der zu verwendende Graph.</param> public void Decrypt(ushort service, DataGraph graph) { // Check COM interface var controlPtr = ComIdentity.QueryInterface(graph.AdditionalFilters[m_filterIndex].Interface, typeof(KsControl.Interface)); if (controlPtr != IntPtr.Zero) { using (var control = new KsControl(controlPtr)) control.SetServices(service); } }
/// <summary> /// Aktiviert die Entschlüsselung einer Quelle. /// </summary> /// <param name="token">Informationen zur gewählten Quelle.</param> private PipelineResult Decrypt(DataGraph.DecryptToken token) { // Load graph if (token != null) { m_DataGraph = token.Pipeline.Graph; } // Get unique call identifier var callIdentifier = Interlocked.Increment(ref m_ChangeCounter); // Check mode of operation var sources = (token == null) ? null : token.Sources; var noSources = (sources == null) || (sources.Length < 1); if (noSources) { // Shutdown all if (m_DataGraph != null) { if (m_DataGraph.TunerFilter != null) { lock (m_deviceAccess) Decrypt(null, (token == null) || (sources == null)); } } // Next return(PipelineResult.Continue); } // Start processor token.WaitForPMTs( (pmt, first) => { // See if we are still allowed to process and do so lock (m_deviceAccess) if (Thread.VolatileRead(ref m_ChangeCounter) == callIdentifier) { Decrypt(pmt, false); } else { return(false); } // Next return(true); }, sources); // Next return(PipelineResult.Continue); }
private void OnEnable() { dataGraph = (DataGraph)target; assetPath = AssetDatabase.GetAssetPath(dataGraph); if (assetPath.Length > 0) { assetPath = Path.GetDirectoryName(assetPath); } OnNodeEditorDataChange(); }
private void AssertSameValue(DataGraph first, DataGraph next) { Assert.AreEqual(first.Readonly.Id, next.Readonly.Id); Assert.AreEqual(first.Readonly.Name, next.Readonly.Name); if (first.Settable == null) { Assert.IsNull(next.Settable); return; } Assert.AreEqual(first.Settable.Id, next.Settable.Id); Assert.AreEqual(first.Settable.Name, next.Settable.Name); }
/// <summary> /// Erzeugt eine neue Liste. /// </summary> /// <param name="graph">Der zugehörige DirectShow Graph.</param> /// <param name="name">Der Name der Liste.</param> /// <exception cref="ArgumentNullException">Es wurde kein Graph oder kein Name angegeben.</exception> internal ActionPipeline( DataGraph graph, string name ) { // Validate if (graph == null) throw new ArgumentNullException( "graph" ); if (string.IsNullOrEmpty( name )) throw new ArgumentNullException( "name" ); // Remember Graph = graph; Name = name; }
public DataJoinGraph(DataGraph dataGraph) : base( new DataTableJoinVertexProvider(), new DataRelationJoinEdgeProvider(), false ) { if (dataGraph == null) { throw new ArgumentNullException("dataGraph"); } this.dataGraph = dataGraph; }
public DataGraph ToGraph(Maze map) { var dataGraph = new DataGraph(); IEnumerable <DataVertex> vertices = CreateVertices(map); dataGraph.AddVertexRange(vertices); IEnumerable <DataEdge> dataEdges = CreateEdges(map, vertices); dataGraph.AddEdgeRange(dataEdges); return(dataGraph); }
private DataGraph Graph_Setup() { DataGraph graph = new DataGraph(); foreach (DataVertex station in stations) { graph.AddVertex(station); } foreach (var connection in connections) { graph.AddEdge(connection); } return(graph); }
public DataGraph GetDonutDataDemo() { var dataGraph = new DataGraph(); List <int> serie = new List <int>(); serie.Add(20); dataGraph.Title = "Demo de gráfica"; serie.Add(30); dataGraph.Data.Add(serie); //dataGraph.DataLabels.Add("Usado"); //dataGraph.DataLabels.Add("Libre"); dataGraph.ChartType = ChartTypes.Donut; return(dataGraph); }
public void SetData( ref DataGraph newData, OnCreateDataNodeAction OnCreateDataNode, Action <DataGraphNode> OnRemoveDataNode, Action <Connection> OnCreateDataEdge, Action <Connection> OnRemoveDataEdge ) { data = newData; GenerateNodesFromData(); this.OnCreateDataNode = OnCreateDataNode; this.OnRemoveDataNode = OnRemoveDataNode; this.OnCreateDataEdge = OnCreateDataEdge; this.OnRemoveDataEdge = OnRemoveDataEdge; }
public DataGraph TotalCountPayment() { if (SFSdotNet.Framework.Cache.Caching.ExistInCompany("dashboard-total-payment", "SFSServiceDesk", SFSdotNet.Framework.My.Context.CurrentContext.Company.GuidCompany)) { return((DataGraph)SFSdotNet.Framework.Cache.Caching.GetFromCompany("dashboard-total-payment", "SFSServiceDesk", SFSdotNet.Framework.My.Context.CurrentContext.Company.GuidCompany)); } else { var dataGraph = new DataGraph <int>(); dataGraph.Title = "Pagadas"; // dataGraph.Total = SFS.ServiceDesk.BR.accIncomeExpensesBR.Instance.GetCount(p => p.accReusableCatalogValue.ValueString == "money-out-request" && p.TotalPayment >= p.TotalChilds); SFSdotNet.Framework.Cache.Caching.SetToCompany(dataGraph, "dashboard-total-payment", "SFSServiceDesk", SFSdotNet.Framework.My.Context.CurrentContext.Company.GuidCompany, TimeSpan.FromMinutes(60)); return(dataGraph); } }
/// <summary> /// Erzeugt eine neue Liste. /// </summary> /// <param name="graph">Der zugehörige DirectShow Graph.</param> /// <param name="name">Der Name der Liste.</param> /// <exception cref="ArgumentNullException">Es wurde kein Graph oder kein Name angegeben.</exception> internal ActionPipeline(DataGraph graph, string name) { // Validate if (graph == null) { throw new ArgumentNullException("graph"); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } // Remember Graph = graph; Name = name; }
/// <summary> /// Aktualisiert die Aktionslisten des DVB Empfangs. /// </summary> /// <param name="graph">Der DirectShow Graph für den DVB Empfang.</param> /// <param name="profile">Das verwendete Geräteprofil.</param> /// <param name="types">Die gewünschte Aktivierung.</param> void IPipelineExtension.Install(DataGraph graph, Profile profile, PipelineTypes types) { // Validate if (graph == null) { throw new ArgumentNullException("graph"); } if (profile == null) { throw new ArgumentNullException("profile"); } // Check supported types if ((types & PipelineTypes.CICAM) != 0) { // Load static settings m_suppress = AdditionalFilterSelector.GetSuppression(PipelineTypes.CICAM, profile.Parameters); m_hasBeenReset = (m_suppress != SuppressionMode.None); // Analyse settings if (!bool.TryParse(profile.Parameters.GetParameter(PipelineTypes.CICAM, AdditionalFilterSelector.CancelEncryptionOnChangedStream), out m_disableOnChange)) { m_disableOnChange = false; } if (!int.TryParse(profile.Parameters.GetParameter(PipelineTypes.CICAM, AdditionalFilterSelector.DelayOnChangedStream), out m_changeDelay)) { m_changeDelay = 0; } // Register in pipeline graph.DecryptionPipeline.AddPostProcessing(Decrypt); // Check for additional filter var filterDisplayName = profile.Parameters.GetParameter(PipelineTypes.CICAM, AdditionalFilterSelector.FilterName); if (!string.IsNullOrEmpty(filterDisplayName)) { // Load moniker - if available var filterMoniker = profile.Parameters.GetParameter(PipelineTypes.CICAM, AdditionalFilterSelector.FilterMoniker); // Remember position of our extension m_filterIndex = graph.AdditionalFilterInformations.Count; // Register in graph graph.AdditionalFilterInformations.Add(DeviceAndFilterInformations.Cache.AllFilters.FindFilter(filterDisplayName, filterMoniker)); } } }
/// <summary> /// Obtains sorted operations (order is back to front). /// </summary> /// <returns>The list of all operations in ShaderCode:</returns> public static List <IOperation> GetSortedOperations(IOperation output) { // We build graph of all operations. DataGraph <IOperation> graph = new DataGraph <IOperation>(); uint outputID = AddOperationToGraph(output, graph, uint.MaxValue); // Now we have to list operations in correct order. List <uint> ordered = GraphAnalysis.ListNodesInOrder(outputID, graph); List <IOperation> result = new List <IOperation>(ordered.Count); // We simply "back copy" operations. for (int i = 0; i < ordered.Count; i++) { result.Add(graph[ordered[i]]); } return(result); }
/// <summary> /// Aktualisiert die Aktionslisten des DVB Empfangs. /// </summary> /// <param name="graph">Der DirectShow Graph für den DVB Empfang.</param> /// <param name="profile">Das verwendete Geräteprofil.</param> /// <param name="types">Die gewünschte Aktivierung.</param> void IPipelineExtension.Install(DataGraph graph, Profile profile, PipelineTypes types) { // Validate if (graph == null) { throw new ArgumentNullException("graph"); } if (profile == null) { throw new ArgumentNullException("profile"); } // Check supported types if ((types & PipelineTypes.SignalInformation) != 0) { graph.SignalPipeline.AddPostProcessing(TransformSignal); } }
/// <summary> /// Aktualisiert die Aktionslisten des DVB Empfangs. /// </summary> /// <param name="graph">Der DirectShow Graph für den DVB Empfang.</param> /// <param name="profile">Das verwendete Geräteprofil.</param> /// <param name="types">Die gewünschte Aktivierung.</param> void IPipelineExtension.Install(DataGraph graph, Profile profile, PipelineTypes types) { // Validate if (graph == null) { throw new ArgumentNullException("graph"); } if (profile == null) { throw new ArgumentNullException("profile"); } // Check supported types if ((types & PipelineTypes.CICAM) != 0) { graph.DecryptionPipeline.AddPostProcessing(Decrypt); } }
/// <summary> /// Aktualisiert die Aktionslisten des DVB Empfangs. /// </summary> /// <param name="graph">Der DirectShow Graph für den DVB Empfang.</param> /// <param name="profile">Das verwendete Geräteprofil.</param> /// <param name="types">Die gewünschte Aktivierung.</param> void IPipelineExtension.Install(DataGraph graph, Profile profile, PipelineTypes types) { // Validate if (graph == null) { throw new ArgumentNullException("graph"); } if (profile == null) { throw new ArgumentNullException("profile"); } // Check supported types if ((types & PipelineTypes.DiSEqC) != 0) { graph.TunePipeline.AddPreProcessing(ApplyDiSEqC); } }
public void Can_access_child_property() { var data = new DataGraph {Readonly = {Id = 42, Name = "Everything"}}; var freezable = Freezer.AsFreezable(data); AssertSameValue(data,freezable); }
public IGraphInfo GetGraphInfo(int projectId, string locatie, string root) { bool saf; bool sof; InitData.UniqueInstance.ProjectId = projectId; InitData.UniqueInstance.RootDirectory = root; using (DataClasses1DataContext context = new DataClasses1DataContext()) { var project = (from aProject in context.Projects where aProject.ProjectId == projectId select aProject).FirstOrDefault(); saf = project.GegevensSet.SafAanwezig; sof = project.GegevensSet.SofAanwezig; HandleBronPadenEnBestanden(projectId, root, sof, saf, false); } InitData.UniqueInstance.SetToetspeilenFileName(); string toetspeilPath = Bronpaden[3]; string toetspeilenFile = toetspeilPath + "\\" + InitData.UniqueInstance.ToetsPeilenName; InitData.UniqueInstance.ToetsPeilenDirectory = toetspeilPath ; Debug.Assert(File.Exists(toetspeilenFile)); InitData.UniqueInstance.GetToetspeilen(); string overschrijdingsFile = ProjectPath + "\\overschrijding_" + locatie + ".dat"; Debug.Assert(File.Exists(overschrijdingsFile), "Overschrijdingsfile is niet gevonden."); string prestatiePeilFile = ProjectPath + "\\prestatiepeil.dat" ; Debug.Assert(File.Exists(prestatiePeilFile), "prestatiePeilFile is niet gevonden."); Collection<string> fileRef= ReadFile(overschrijdingsFile); Collection<string> fileRefOverschrijdingsKansen = new Collection<string>(); RemoveHeader(fileRef, fileRefOverschrijdingsKansen); Collection<string> fileRefPrestatiePeil = new Collection<string>(); fileRef = ReadFile(prestatiePeilFile); RemoveHeader(fileRef, fileRefPrestatiePeil); DataGraph curve = new DataGraph(); DataPoint prestatiepeilPunt; DataPoint toetspeilPunt; try { foreach (string line in fileRefOverschrijdingsKansen) { //string locatieRemoved = Utility.Postfix(line, locatie); StringParser parsedLine = new StringParser(line, "\t"); double x = Convert.ToDouble(parsedLine.LineItems[1]); double y = Convert.ToDouble(parsedLine.LineItems[2]); curve.Add(new DataPoint(x, y)); } double prestatiepeil = 0d; foreach (string line in fileRefPrestatiePeil) { StringParser parsedLine = new StringParser(line, "\t"); if(parsedLine.LineItems[0].Equals(locatie)) { double.TryParse(parsedLine.LineItems[1],NumberStyles.Any, CultureInfo.InvariantCulture, out prestatiepeil); } } double y_waarde= curve[prestatiepeil].Y; prestatiepeilPunt = new DataPoint(prestatiepeil, y_waarde); int index = InitData.UniqueInstance.GetToetsPeilIndex(locatie); int toetspeil = Convert.ToInt32(InitData.UniqueInstance.Tpeilen[index]); toetspeilPunt = new DataPoint(toetspeil, y_waarde); } catch (Exception ex) { throw new CheckedException(ErrorType.ParseFailure, ex.Message); } ///NOTE: met GraphInfoSimple(curve, toetspeilPunt, prestatiepeilPunt) is loosely-coupling onmogelijk(assemblies scheiden). ///Gebruik minimaal een pattern. IGraphInfo result = new Factory<MyAccess>().CreateGraphInfo(); result.OverschrijdingsKansen = curve; result.PrestatiePeil = prestatiepeilPunt; result.ToetsPeil = toetspeilPunt; return result; }
private DataGraph Graph_Setup() { DataGraph graph = new DataGraph(); foreach (DataVertex station in stations) { graph.AddVertex(station); } foreach (var connection in connections) { graph.AddEdge(connection); } return graph; }
private void AssertSameValue(DataGraph first, DataGraph next) { Assert.AreEqual(first.Readonly.Id, next.Readonly.Id); Assert.AreEqual(first.Readonly.Name, next.Readonly.Name); if(first.Settable == null) { Assert.IsNull(next.Settable); return; } Assert.AreEqual(first.Settable.Id, next.Settable.Id); Assert.AreEqual(first.Settable.Name, next.Settable.Name); }
public IGraphInfo GetGraphInfo(int projectId, string locatie, string root) { DataGraph distribution = new DataGraph(); DataPoint prestatiepeilPunt; DataPoint toetspeilPunt; try { // Get a random number generator Random rand = new Random(); double x; double y; for (int i = 0; i < 1000; i++) { MathNet.Numerics.Distributions.NormalDistribution bin = new NormalDistribution(0, 1000); y = bin.CumulativeDistribution(i); distribution.Add(new DataPoint(i, y)); } x = rand.NextDouble() * 20.0 + 1; y = Math.Log(10.0 * (x - 1.0) + 1.0) * (rand.NextDouble() * 0.2 + 0.9); prestatiepeilPunt = new DataPoint(x, y); x = rand.NextDouble() * 20.0 + 1; y = Math.Log(10.0 * (x - 1.0) + 1.0) * (rand.NextDouble() * 0.2 + 0.9); toetspeilPunt = new DataPoint(x, y); } catch (Exception ex) { throw new CheckedException(ErrorType.ParseFailure, ex.Message); } ///NOTE: met GraphInfoSimple(distribution, toetspeilPunt, prestatiepeilPunt) is loosely-coupling onmogelijk ///(assemblies scheiden zonder interfaces te kopieren in de de bussiness layer). ///Gebruik minimaal een pattern. IGraphInfo result = new Factory<MyAccess>().CreateGraphInfo(); result.OverschrijdingsKansen = distribution; result.PrestatiePeil = prestatiepeilPunt; result.ToetsPeil = toetspeilPunt; return result; }