Example #1
0
        public void SetProperties(DataSetCollection WindDataCollection)
        {
            Element.SelectionMode = DataGridSelectionMode.Extended;
            Element.SelectionUnit = DataGridSelectionUnit.Cell;

            DataCollection = WindDataCollection;

            Table = new DataTable();
            DS    = new DataSet();

            DS.Tables.Add(Table);
            for (int i = 0; i < WindDataCollection.Sets.Count; i++)
            {
                if (WindDataCollection.Sets[i].Title == "")
                {
                    WindDataCollection.Sets[i].Title = ("Title " + i.ToString());
                }
                DataColumn col = new DataColumn(WindDataCollection.Sets[i].Title.ToString(), typeof(string));
                Table.Columns.Add(col);
            }

            for (int i = 0; i < WindDataCollection.Sets[0].Points.Count; i++)
            {
                System.Data.DataRow row = Table.NewRow();
                for (int j = 0; j < WindDataCollection.Count; j++)
                {
                    row[WindDataCollection.Sets[j].Title] = WindDataCollection.Sets[j].Points[i].Text;
                }
                Table.Rows.Add(row);
            }


            Element.DataContext = DS.Tables[0].DefaultView;
            Element.ItemsSource = DS.Tables[0].DefaultView;
        }
Example #2
0
        public void SetProperties(DataSetCollection WindDataCollection)
        {
            Data = WindDataCollection;

            TableView.ColumnCount = Data.Count;
            TableView.RowCount    = Data.Sets[0].Points.Count;


            for (int i = 0; i < Data.Sets.Count; i++)
            {
                if (WindDataCollection.Sets[i].Title == "")
                {
                    WindDataCollection.Sets[i].Title = ("Title " + i.ToString());
                }
                TableView.Columns[i].HeaderText = Data.Sets[i].Title;
                for (int j = 0; j < Data.Sets[i].Points.Count; j++)
                {
                    TableView.Rows[i].Cells[j].Value = Data.Sets[i].Points[j].Text;
                }
            }

            TableView.AutoSize            = false;
            TableView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            Host.Background           = Brushes.IndianRed;
            TableView.BackgroundColor = System.Drawing.Color.DarkCyan;
        }
        public void Execute(DataSetCollection dataSets)
        {
            var export = Wiki;

            var featPages = export.Pages
                // Toutes les pages ayant la catégorie "Don"
                .Where(p => p.Categories.Any(c => c.Name.Equals("Don", StringComparison.OrdinalIgnoreCase)))
                // Sauf celles explicitement exclues
                .Where(p => !IgnoredPages.Any(i => i.Equals(p.Title, StringComparison.OrdinalIgnoreCase)))
                .ToList();

            Log.Information("{0} Dons chargés", featPages.Count);

            var feats = ReadFeats(featPages);

            // Feats by source
            foreach (var sourceFeats in feats.GroupBy(s => s.Source.Id).Where(s => !string.IsNullOrEmpty(s.Key)))
            {
                var dataSet = dataSets.ResolveDataSet(sourceFeats.Key);
                dataSet.Sources.GetOrAdd(s => s.Id.Equals(sourceFeats.Key), () => new Source {Id = sourceFeats.Key});
                dataSet.Feats.AddRange(sourceFeats);
            }

            // Feats dataset
            //var ds = dataSets.ResolveDataSet("feats");
            //ds.Feats.AddRange(feats);
            //foreach (var source in feats.Select(s => s.Source.Id).Distinct().Where(s => !string.IsNullOrEmpty(s)))
            //{
            //    ds.Sources.Add(new Source { Id = source });
            //}
        }
Example #4
0
        public DataSetCollection GetDataSetCollection()
        {
            var c = new DataSetCollection();


            var datasetdic = new Dictionary <string, DataSetDefinition>();

            //var triplets = new Tuple<string, DataSetDefinition, List<int>>();

            foreach (Dataset dataset in Datasets)
            {
                var set = ExtractDataset(dataset);
                var d   = new DataSetDefinition();
                d.BitFields = set;
                var serial = d.Serialize();
                if (!datasetdic.ContainsKey(serial))
                {
                    datasetdic.Add(serial, d);
                }
            }


            foreach (var t in Telegrams)
            {
                var comid = t.Comid.ToString();
                var set   = Datasets.First(dataset => dataset.Datasetid == t.Datasetid);

                var dud = new DataSetDefinition()
                {
                    BitFields = ExtractDataset(set)
                };
                var serial = dud.Serialize();

                var datasetdef = datasetdic[serial];

                if (string.IsNullOrEmpty(datasetdef.Name))
                {
                    datasetdef.Name = t.Name;
                }
                else if (!datasetdef.Name.Contains(t.Name))
                {
                    datasetdef.Name += "," + t.Name;
                }

                if (!datasetdef.Identifiers.Contains(comid))
                {
                    datasetdef.Identifiers.Add(comid);
                }
            }

            var outlist = datasetdic.Values.ToList();

            outlist.RemoveAll(d => d.Identifiers.Count == 0);

            c.DataSets.AddRange(outlist);


            return(c);
        }
Example #5
0
        protected override Type CreateCollectionItemType()
        {
            // return the type of the elements in the list.
            // need to find the generic type of the collection.
            DataSetCollection dataSets = (DataSetCollection)this.Context.PropertyDescriptor.GetValue(this.Context.Instance);

            return(dataSets.CreateDataSet("").GetType());
        }
Example #6
0
        /// <summary>
        /// Get all the DataSets that are present in the DICOM messages.
        /// </summary>
        /// <returns></returns>
        public DataSetCollection GetDataSets()
        {
            DataSetCollection dataSets = new DataSetCollection();

            foreach (DicomMessage dicomMessage in this)
            {
                dataSets.Add(dicomMessage.DataSet);
            }

            return(dataSets);
        }
Example #7
0
        public void SetProperties(DataSetCollection PollenDataGrid, int ControlSize)
        {
            //Set unique properties of the control
            DataGrid = PollenDataGrid;

            Element.Width  = ControlSize;
            Element.Height = ControlSize;

            Element.Margin = new System.Windows.Thickness(10);

            Element.DisableAnimations = true;
        }
Example #8
0
        public pRadialChart(string InstanceName)
        {
            //Set Element info setup
            Element = new PieChart();
            Element.DisableAnimations = true;

            Element.Name = InstanceName;
            Element.Series.Clear();

            DataGrid = new DataSetCollection();

            //Set "Clear" appearance to all elements
        }
Example #9
0
        public void SetProperties(DataSetCollection PollenDataGrid)
        {
            //Set unique properties of the control
            DataGrid = PollenDataGrid;

            Element.MinWidth  = 300;
            Element.MinHeight = 300;

            Element.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            Element.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

            Element.Background = Brushes.Transparent;
        }
Example #10
0
        public pCartesianChart(string InstanceName)
        {
            //Set Element info setup
            Element = new CartesianChart();
            Element.DisableAnimations = true;

            Element.Name = InstanceName;

            DataGrid = new DataSetCollection();

            Element.Background = Brushes.Transparent;

            //Set "Clear" appearance to all elements
        }
Example #11
0
        public void SetProperties(DataSetCollection PollenDataGrid)
        {
            //Set unique properties of the control
            DataGrid = PollenDataGrid;


            Element.MinWidth  = 300;
            Element.MinHeight = 300;

            Element.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            Element.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

            SetToolTip();
        }
Example #12
0
        public void SetProperties(DataSetCollection PollenDataGrid)
        {
            //Set unique properties of the control
            DataSet = PollenDataGrid;

            ChartsArea      = new ChartArea();
            ChartsArea.Name = Name;


            //Set Chart Area

            ChartObject.ChartAreas.Clear();
            ChartObject.ChartAreas.Add(ChartsArea);

            ChartsArea.BackColor = System.Drawing.Color.Transparent;
        }
Example #13
0
        public pHeatChart(string InstanceName)
        {
            //Set Element info setup
            Element = new CartesianChart();
            Element.DisableAnimations = true;

            DataGrid      = new DataSetCollection();
            ChartSeries   = new HeatSeries();
            SeriesCollect = new SeriesCollection();

            ChartSeries.Values     = new ChartValues <HeatPoint>();
            ChartSeries.DataLabels = true;

            Element.Series.Add(ChartSeries);

            Element.Name = InstanceName;
        }
        public void Execute(DataSetCollection dataSets)
        {
            Console.WriteLine("Liste des pages pointant vers la page de l'invocateur :");
            foreach (var page in Wiki.Pages.Where(p => p.OutLinks.Any(l => l.FullName == "Pathfinder-RPG.Conjurateur")))
            {
                Console.WriteLine("{0}", page.Title);
            }

            Console.WriteLine();
            Console.WriteLine("Liste des pages contenant le mot conjurateur :");
            foreach (var page in Wiki.Pages.Where(p => p.Body.IndexOf("conjurateur", StringComparison.OrdinalIgnoreCase) != -1))
            {
                Console.WriteLine("{0}", page.Title);
            }

            Console.ReadKey();
        }
Example #15
0
        public void SetProperties(DataSetCollection ChartDataSet, bool Horizontal, int Align)
        {
            DataSet = ChartDataSet;
            Element.Children.Clear();

            Element.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            Element.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

            if (Horizontal)
            {
                Element.Orientation = Orientation.Horizontal;
            }
            else
            {
                Element.Orientation = Orientation.Vertical;
            }
        }
        public void Execute(DataSetCollection dataSets)
        {
            var export = Wiki;

            // Pages des listes d'objets
            var objectLists = new[]
            {
                "pathfinder-rpg.objets merveilleux",
                "pathfinder-rpg.objets merveilleux apg"
            }.Select(pn => export.Pages[new WikiName(pn)]);

            // Liste des pages décrivant des objets magiques
            var objectPages = objectLists
                .SelectMany(p => p.OutLinks)
                .Distinct()
                .ToList();

            // Feats dataset
            //var ds = dataSets.ResolveDataSet("feats");
        }
Example #17
0
        /// <summary>
        /// Query the Information Model using the given query message.
        /// </summary>
        /// <param name="queryMessage">Message used to query the Information Model.</param>
        /// <returns>DicomMessageCollection - containing the query responses. The final query response (without a dataset) is also included.</returns>
        public DicomMessageCollection QueryInformationModel(DicomMessage queryMessage)
        {
            DicomMessageCollection responseMessages = new DicomMessageCollection();

            DvtkHighLevelInterface.Values values = queryMessage.CommandSet.GetAttributeValues("0x00000002");
            System.String sopClassUid            = values.GetString(1);

            DataSet           queryDataset   = queryMessage.DataSet;
            DataSetCollection queryResponses = _root.QueryInformationModel(queryDataset.DvtkDataDataSet);

            DvtkData.Dimse.DicomMessage dvtkDicomMessage = null;
            DvtkData.Dimse.CommandSet   dvtkCommand      = null;
            DicomMessage responseMessage = null;

            foreach (DvtkData.Dimse.DataSet dvtkDataset in queryResponses)
            {
                dvtkDicomMessage = new DvtkData.Dimse.DicomMessage();
                dvtkCommand      = new DvtkData.Dimse.CommandSet(DvtkData.Dimse.DimseCommand.CFINDRSP);
                dvtkCommand.AddAttribute(0x0000, 0x0002, DvtkData.Dimse.VR.UI, sopClassUid);
                dvtkCommand.AddAttribute(0x0000, 0x0900, DvtkData.Dimse.VR.US, 0xFF00);

                dvtkDicomMessage.Apply(dvtkCommand, dvtkDataset);
                responseMessage = new DicomMessage(dvtkDicomMessage);
                responseMessages.Add(responseMessage);
            }

            dvtkDicomMessage = new DvtkData.Dimse.DicomMessage();
            dvtkCommand      = new DvtkData.Dimse.CommandSet(DvtkData.Dimse.DimseCommand.CFINDRSP);
            dvtkCommand.AddAttribute(0x0000, 0x0002, DvtkData.Dimse.VR.UI, sopClassUid);
            dvtkCommand.AddAttribute(0x0000, 0x0900, DvtkData.Dimse.VR.US, 0x0000);

            dvtkDicomMessage.Apply(dvtkCommand);
            responseMessage = new DicomMessage(dvtkDicomMessage);
            responseMessages.Add(responseMessage);

            return(responseMessages);
        }
        public void Execute(DataSetCollection dataSets)
        {
            var spells = ReadSpells();

            AddSpellLists(spells);

            GenerateIds(spells);

            // Adding to dataset
            foreach (var sourceSpells in spells.GroupBy(s => s.Source.Id).Where(s => !string.IsNullOrEmpty(s.Key)))
            {
                var dataSet = dataSets.ResolveDataSet(sourceSpells.Key);
                dataSet.Sources.GetOrAdd(s => s.Id.Equals(sourceSpells.Key), () => new Source {Id = sourceSpells.Key});
                dataSet.Spells.AddRange(sourceSpells);
            }

            // Spells dataset
            //var ds = dataSets.ResolveDataSet("spells");
            //ds.Spells.AddRange(spells);
            //foreach (var source in spells.Select(s => s.Source.Id).Distinct().Where(s => !string.IsNullOrEmpty(s)))
            //{
            //    ds.Sources.Add(new Source { Id = source });
            //}
        }
Example #19
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            int     X       = 0;
            int     Y       = 0;
            int     Z       = 0;
            bool    D       = false;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref X))
            {
                return;
            }
            if (!DA.GetData(2, ref Y))
            {
                return;
            }
            if (!DA.GetData(3, ref Z))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);


            D = !((X == 0) & (Y == 0) & (Z == 0));

            p3D V = new p3D(X, Y, Z, D, (p3D.LightingMode)ModeLighting);

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;

                    tDataSet.SetThreeDView(D, V);

                    W.Element = tDataSet;
                    break;

                case "PointChart":
                    pElement E = (pElement)W.Element;
                    pChart   C = (pChart)E.PollenControl;

                    C.View = V;
                    C.SetThreeDView();

                    E.PollenControl = C;
                    W.Element       = E;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
        }
Example #20
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            bool    P       = false;
            double  R0      = 5;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref P))
            {
                return;
            }
            if (!DA.GetData(2, ref R0))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.PadRadius = P;
            G.Radius[0] = R0;
            G.Radius[1] = R0;
            G.Radius[2] = R0;
            G.Radius[3] = R0;

            W.Graphics = G;

            if (P)
            {
                W.Graphics.SetPaddingFromCorners();
            }
            else
            {
                W.Graphics.SetUniformPadding(0);
            }

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                C.SetCorners();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;

                    tDataPt.Graphics.Radius = G.Radius;
                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;

                    tDataSet.Graphics.Radius = G.Radius;
                    W.Element = tDataSet;
                    break;
                }
                break;

            case "Hoopoe":
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Example #21
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;

            List <System.Drawing.Color> Colors = new List <System.Drawing.Color>();
            List <double> Parameters           = new List <double>();
            double        GradientAngle        = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetDataList(1, Colors))
            {
                return;
            }
            if (!DA.GetDataList(2, Parameters))
            {
                return;
            }
            if (!DA.GetData(3, ref GradientAngle))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.FillType     = wGraphic.FillTypes.LinearGradient;
            G.CustomFills += 1;

            if (Parameters.Count < 1)
            {
                G.Gradient = new wGradient(Colors);
            }
            else
            {
                if (Parameters.Count < Colors.Count)
                {
                    for (int i = Parameters.Count; i < Colors.Count; i++)
                    {
                        Parameters.Add(Parameters[Parameters.Count - 1]);
                    }
                }

                G.Gradient = new wGradient(Colors, Parameters, GradientAngle, (wGradient.GradientSpace)GradientSpace);
            }

            G.WpfFill = new wFillGradient(G.Gradient, GradientType).GrdBrush;

            W.Graphics = G;

            if (Element != null)
            {
                switch (W.Type)
                {
                case "Parrot":
                    pElement E = (pElement)W.Element;
                    pControl C = (pControl)E.ParrotControl;
                    C.SetFill();

                    C.Graphics = G;
                    break;

                case "Pollen":
                    switch (W.SubType)
                    {
                    case "DataPoint":
                        DataPt tDataPt = (DataPt)W.Element;
                        tDataPt.Graphics = G;

                        tDataPt.Graphics.WpfFill    = G.WpfFill;
                        tDataPt.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataPt;
                        break;

                    case "DataSet":
                        DataSetCollection tDataSet = (DataSetCollection)W.Element;
                        tDataSet.Graphics = G;

                        tDataSet.Graphics.WpfFill    = G.WpfFill;
                        tDataSet.Graphics.WpfPattern = G.WpfPattern;

                        W.Element = tDataSet;
                        break;

                    case "Chart":
                    case "Table":

                        pElement pE = (pElement)W.Element;
                        pChart   pC = pE.PollenControl;
                        pC.Graphics = G;

                        pC.Graphics.WpfFill    = G.WpfFill;
                        pC.Graphics.WpfPattern = G.WpfPattern;

                        pC.SetGradientFill();

                        pE.PollenControl = pC;
                        W.Element        = pE;
                        break;
                    }
                    break;

                case "Hoopoe":
                    wShapeCollection Shapes = (wShapeCollection)W.Element;
                    Shapes.Graphics.FillType = wGraphic.FillTypes.LinearGradient;

                    wGradient GRD = new wGradient();

                    if (Parameters.Count < 1)
                    {
                        GRD = new wGradient(Colors, GradientAngle, (wGradient.GradientSpace)GradientSpace);
                    }
                    else
                    {
                        GRD = new wGradient(Colors, Parameters, GradientAngle, (wGradient.GradientSpace)GradientSpace);
                    }

                    Shapes.Graphics.Gradient = GRD;
                    Shapes.Graphics.WpfFill  = new wFillGradient(G.Gradient, GradientType).GrdBrush;



                    W.Element = Shapes;
                    break;
                }
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
        public void Execute(DataSetCollection dataSets)
        {
            var ignoredPages = EmbeddedResources.LoadString("Resources.MonsterIgnoredPages.txt").Split(new[] {Environment.NewLine}, StringSplitOptions.None);

            // Index d'après la page "Monstres"
            var indexPage = Wiki.Pages[WikiName.FromString("Pathfinder-RPG.Monstres")];
            var pages = indexPage
                .OutLinks
                .Where(p => !ignoredPages.Any(i => i.Equals(p.Name, StringComparison.OrdinalIgnoreCase)))
                .Where(p => !p.Name.EndsWith("archétype", StringComparison.OrdinalIgnoreCase))
                .ToDictionary(p => p.WikiName);
            Log.Information("{0} pages chargées depuis l'index", pages.Count);

            // Index d'après la page "Glossaire des monstres"
            indexPage = Wiki.Pages[WikiName.FromString("Pathfinder-RPG.Glossaire des monstres")];
            var glossaryOutPages = indexPage
                .OutLinks
                .Where(p => !ignoredPages.Any(i => i.Equals(p.Name, StringComparison.OrdinalIgnoreCase)))
                .Where(p => !p.Name.EndsWith("archétype", StringComparison.OrdinalIgnoreCase))
                .ToList();

            Log.Information("{0} pages chargées depuis le glossaire", glossaryOutPages.Count);

            var addedCount = 0;
            foreach (var glossaryOutPage in glossaryOutPages.Where(glossaryOutPage => !pages.ContainsKey(glossaryOutPage.WikiName)))
            {
                pages.Add(glossaryOutPage.WikiName, glossaryOutPage);
                addedCount++;
            }
            Log.Information("{0} monstres ajoutés depuis le glossaire", addedCount);

            var monsters = new List<Monster>(pages.Count);

            var parser = new MonsterParser(Log);
            foreach (var monsterPage in pages)
            {
                List<Monster> pageMonsters;
                if (TryParse(parser, monsterPage.Value, Wiki, out pageMonsters, Log))
                {
                    monsters.AddRange(pageMonsters);
                }
            }

            Log.Information("Nombre total de monstres lus : {0}", monsters.Count);

            Log.Information("Chargement du glossaire des monstres...");
            var glossaryPage = Wiki.Pages[WikiName.FromString("Pathfinder-RPG.Glossaire des monstres")];
            var glossaryParser = new MonsterGlossaryParser(Log);
            glossaryParser.ParseAll(glossaryPage, monsters);

            // Adding to dataset
            foreach (var source in monsters.GroupBy(s => s.Source.Id).Where(s => !string.IsNullOrEmpty(s.Key)))
            {
                var localSource = source;
                var dataSet = dataSets.ResolveDataSet(source.Key);
                dataSet.Sources.GetOrAdd(s => s.Id.Equals(localSource.Key), () => new Source {Id = localSource.Key});
                dataSet.Monsters.AddRange(source.OrderBy(m => m.Id));
            }

            // Monsters dataset
            //var ds = dataSets.ResolveDataSet("monsters");
            //ds.Monsters.AddRange(monsters);
            //foreach (var source in monsters.Select(s => s.Source.Id).Distinct().Where(s => !string.IsNullOrEmpty(s)))
            //{
            //    ds.Sources.Add(new Source { Id = source });
            //}

            parser.Flush();
        }
Example #23
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            int     X       = 0;
            int     P       = 0;
            double  A       = 0;
            bool    L       = true;

            System.Drawing.Color C = System.Drawing.Color.Transparent;
            System.Drawing.Color F = System.Drawing.Color.Transparent;
            double T = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref X))
            {
                return;
            }
            if (!DA.GetData(2, ref P))
            {
                return;
            }
            if (!DA.GetData(3, ref A))
            {
                return;
            }
            if (!DA.GetData(4, ref C))
            {
                return;
            }
            if (!DA.GetData(5, ref F))
            {
                return;
            }
            if (!DA.GetData(6, ref T))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);

            wLabel CustomLabel = new wLabel();

            wGraphic G = CustomLabel.Graphics;

            if (P == 0)
            {
                L = false;
            }

            CustomLabel.HasLeader = L;
            CustomLabel.Graphics  = new wGraphic(new wColor(C), G.Foreground, new wColor(F), T);
            CustomLabel.Position  = (wLabel.LabelPosition)P;
            CustomLabel.Alignment = (wLabel.LabelAlignment)X;

            CustomLabel.Graphics = G;

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt Pt = (DataPt)W.Element;

                    Pt.Graphics.FontObject.Angle = A;

                    Pt.Label.HasLeader = L;
                    Pt.Label.Graphics  = new wGraphic(new wColor(C), G.Foreground, new wColor(F), T);
                    Pt.Label.Position  = (wLabel.LabelPosition)P;
                    Pt.Label.Alignment = (wLabel.LabelAlignment)X;
                    Pt.CustomLabels   += 1;

                    W.Element = Pt;
                    break;

                case "DataSet":
                    DataSetCollection St = (DataSetCollection)W.Element;
                    St.SetUniformLabel(CustomLabel, A);

                    St.Graphics.FontObject.Angle = A;

                    St.Label.HasLeader = L;
                    St.Label.Graphics  = new wGraphic(new wColor(C), G.Foreground, new wColor(F), T);
                    St.Label.Position  = (wLabel.LabelPosition)P;
                    St.Label.Alignment = (wLabel.LabelAlignment)X;

                    W.Element = St;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, CustomLabel);
        }
Example #24
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            int    C    = this.RunCount;

            wObject  WindObject = new wObject();
            pElement Element    = new pElement();
            bool     Active     = Elements.ContainsKey(C);

            var pControl = new pDataTableA(name);

            if (Elements.ContainsKey(C))
            {
                Active = true;
            }

            //Check if control already exists
            if (Active)
            {
                if (Elements[C] != null)
                {
                    WindObject = Elements[C];
                    Element    = (pElement)WindObject.Element;
                    pControl   = (pDataTableA)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;

            if (!DA.GetData(0, ref D))
            {
                return;
            }

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            List <pPointSeries> PointSeriesList = new List <pPointSeries>();

            for (int i = 0; i < DC.Sets.Count; i++)
            {
                pPointSeries pSeriesSet = new pPointSeries(Convert.ToString(name + i));
                pSeriesSet.SetProperties(DC.Sets[i]);
                pSeriesSet.SetChartLabels(DC.Label);
                pSeriesSet.SetNumericData(1);
                PointSeriesList.Add(pSeriesSet);
            }

            pControl.SetProperties(DC);
            //pControl.SetFormatting();

            //Set Parrot Element and Wind Object properties
            if (!Active)
            {
                Element = new pElement(pControl.Element, pControl, pControl.Type);
            }
            WindObject          = new wObject(Element, "Pollen", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
Example #25
0
        /// <summary>
        /// Query the Information Model using the given Query Dataset.
        /// </summary>
        /// <param name="queryDataset">Query Dataset.</param>
        /// <returns>A collection of zero or more query reponse datasets.</returns>
        public override DataSetCollection QueryInformationModel(DataSet queryDataset)
        {
            DataSetCollection queryResponses = new DataSetCollection();;

            // get the query/retrieve level
            String queryRetrieveLevel = "UNKNOWN";

            DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = queryDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL);
            if (queryRetrieveLevelAttribute != null)
            {
                CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue;
                if (codeString.Values.Count == 1)
                {
                    queryRetrieveLevel = codeString.Values[0].Trim();
                }
            }

            // query at the STUDY level
            if (queryRetrieveLevel == "STUDY")
            {
                TagTypeList queryTagTypeList  = new TagTypeList();
                TagTypeList returnTagTypeList = new TagTypeList();
                foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                {
                    if (attribute.ValueRepresentation == VR.SQ)
                    {
                        foreach (SequenceItem s in ((SequenceOfItems)attribute.DicomValue).Sequence)
                        {
                            if (IsSequenceHavingValue(s))
                            {
                                queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                            }
                        }
                    }

                    else if ((attribute.Length != 0) &&
                             (attribute.Tag.ElementNumber != 0x0000))
                    {
                        queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                    }
                    if (attribute.Tag != Tag.SPECIFIC_CHARACTER_SET)
                    {
                        returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                    }
                }

                foreach (PatientStudyInformationEntity patientStudyInformationEntity in Root)
                {
                    if (patientStudyInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                    {
                        // STUDY level matches
                        DataSet queryResponse = new DataSet();

                        // if the specific character set attribute has been stored in the patient/study IE - return it in the query response
                        DvtkData.Dimse.Attribute specificCharacterSetAttribute = patientStudyInformationEntity.GetSpecificCharacterSet();
                        if (specificCharacterSetAttribute != null)
                        {
                            queryResponse.Add(specificCharacterSetAttribute);
                        }

                        patientStudyInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                        queryResponses.Add(queryResponse);
                    }
                }
            }
            else
            {
                // find the matching STUDY
                PatientStudyInformationEntity patientStudyInformationEntity = null;
                foreach (PatientStudyInformationEntity lPatientStudyInformationEntity in Root)
                {
                    if (lPatientStudyInformationEntity.IsUniqueTagFoundIn(queryDataset))
                    {
                        patientStudyInformationEntity = lPatientStudyInformationEntity;
                        break;
                    }
                }

                if (patientStudyInformationEntity != null)
                {
                    // query at the SERIES level
                    if (queryRetrieveLevel == "SERIES")
                    {
                        TagTypeList queryTagTypeList  = new TagTypeList();
                        TagTypeList returnTagTypeList = new TagTypeList();
                        foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                        {
                            // do not add higher level tags
                            if (attribute.Tag == Tag.STUDY_INSTANCE_UID)
                            {
                                continue;
                            }

                            if (attribute.ValueRepresentation == VR.SQ)
                            {
                                foreach (SequenceItem s in ((SequenceOfItems)attribute.DicomValue).Sequence)
                                {
                                    if (IsSequenceHavingValue(s))
                                    {
                                        queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                                    }
                                }
                            }

                            else if ((attribute.Length != 0) &&
                                     (attribute.Tag.ElementNumber != 0x0000))
                            {
                                queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                            }
                            returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                        }

                        foreach (SeriesInformationEntity seriesInformationEntity in patientStudyInformationEntity.Children)
                        {
                            if (seriesInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                            {
                                // SERIES level matches
                                DataSet queryResponse = new DataSet();

                                // if the specific character set attribute has been stored in the series IE - return it in the query response
                                DvtkData.Dimse.Attribute specificCharacterSetAttribute = seriesInformationEntity.GetSpecificCharacterSet();
                                if (specificCharacterSetAttribute != null)
                                {
                                    queryResponse.Add(specificCharacterSetAttribute);
                                }

                                patientStudyInformationEntity.CopyUniqueTagTo(queryResponse);
                                seriesInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                                queryResponses.Add(queryResponse);
                            }
                        }
                    }
                    else
                    {
                        // find the matching SERIES
                        SeriesInformationEntity seriesInformationEntity = null;
                        foreach (SeriesInformationEntity lSeriesInformationEntity in patientStudyInformationEntity.Children)
                        {
                            if (lSeriesInformationEntity.IsUniqueTagFoundIn(queryDataset))
                            {
                                seriesInformationEntity = lSeriesInformationEntity;
                                break;
                            }
                        }

                        if (seriesInformationEntity != null)
                        {
                            // query at the IMAGE level
                            if (queryRetrieveLevel == "IMAGE")
                            {
                                TagTypeList queryTagTypeList  = new TagTypeList();
                                TagTypeList returnTagTypeList = new TagTypeList();
                                foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                                {
                                    // do not add higher level tags
                                    if ((attribute.Tag == Tag.STUDY_INSTANCE_UID) ||
                                        (attribute.Tag == Tag.SERIES_INSTANCE_UID))
                                    {
                                        continue;
                                    }

                                    if (attribute.ValueRepresentation == VR.SQ)
                                    {
                                        foreach (SequenceItem s in ((SequenceOfItems)attribute.DicomValue).Sequence)
                                        {
                                            if (IsSequenceHavingValue(s))
                                            {
                                                queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                                            }
                                        }
                                    }
                                    else if ((attribute.Length != 0) &&
                                             (attribute.Tag.ElementNumber != 0x0000))
                                    {
                                        queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                                    }
                                    returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                                }

                                foreach (InstanceInformationEntity instanceInformationEntity in seriesInformationEntity.Children)
                                {
                                    if (instanceInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                                    {
                                        // IMAGE level matches
                                        DataSet queryResponse = new DataSet();

                                        // if the specific character set attribute has been stored in the instance IE - return it in the query response
                                        DvtkData.Dimse.Attribute specificCharacterSetAttribute = instanceInformationEntity.GetSpecificCharacterSet();
                                        if (specificCharacterSetAttribute != null)
                                        {
                                            queryResponse.Add(specificCharacterSetAttribute);
                                        }

                                        patientStudyInformationEntity.CopyUniqueTagTo(queryResponse);
                                        seriesInformationEntity.CopyUniqueTagTo(queryResponse);
                                        instanceInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                                        queryResponses.Add(queryResponse);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(queryResponses);
        }
Example #26
0
        /// <summary>
        /// Get all the DataSets that are present in the DICOM messages.
        /// </summary>
        /// <returns></returns>
        public DataSetCollection GetDataSets()
        {
            DataSetCollection dataSets = new DataSetCollection();

            foreach(DicomMessage dicomMessage in this)
            {
                dataSets.Add(dicomMessage.DataSet);
            }

            return(dataSets);
        }
Example #27
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            int    C    = this.RunCount;

            wObject  WindObject = new wObject();
            pElement Element    = new pElement();
            bool     Active     = Elements.ContainsKey(C);

            var pControl = new pRadialChart(name);

            if (Elements.ContainsKey(C))
            {
                Active = true;
            }

            //Check if control already exists
            if (Active)
            {
                if (Elements[C] != null)
                {
                    WindObject = Elements[C];
                    Element    = (pElement)WindObject.Element;
                    pControl   = (pRadialChart)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            double  R = 0;

            if (!DA.GetData(0, ref D))
            {
                return;
            }
            if (!DA.GetData(1, ref R))
            {
                return;
            }

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(Wind.Presets.wGradients.Metro, false, false);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.OffWhiteSolid);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.ChartPoint);
            }
            if (DC.TotalCustomMarker == 0)
            {
                DC.SetDefaultMarkers(wGradients.Metro, wMarker.MarkerType.Circle, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomLabel == 0)
            {
                DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
            }

            if (DC.TotalCustomTitles == 0)
            {
                DC.Graphics.FontObject = wFonts.AxisLabel;
            }

            List <pRadialSeries> RadialSeriesList = new List <pRadialSeries>();

            pControl.SetProperties(DC, R);
            pControl.SetPollenSeries(name);
            pControl.ForceRefresh();

            /*
             * for (int i = 0; i < DC.Sets.Count; i++)
             * {
             *  pRadialSeries pSeriesSet = new pRadialSeries(Convert.ToString(name + i));
             *  pSeriesSet.SetRadialSeries(DC.Sets[i]);
             *  RadialSeriesList.Add(pSeriesSet);
             * }
             */

            //pControl.SetSeries(RadialSeriesList);
            //pControl.SetAxisAppearance();

            //Set Parrot Element and Wind Object properties
            if (!Active)
            {
                Element = new pElement(pControl.Element, pControl, pControl.Type);
            }
            WindObject          = new wObject(Element, "Pollen", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
Example #28
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            int    C    = this.RunCount;

            wObject  WindObject = new wObject();
            pElement Element    = new pElement();
            bool     Active     = Elements.ContainsKey(C);

            var pControl = new pCartesianChart(name);

            if (Elements.ContainsKey(C))
            {
                Active = true;
            }

            //Check if control already exists
            if (Active)
            {
                if (Elements[C] != null)
                {
                    WindObject = Elements[C];
                    Element    = (pElement)WindObject.Element;
                    pControl   = (pCartesianChart)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            int     M = 0;

            if (!DA.GetData(0, ref D))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.Metro, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.Transparent);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.ChartPoint);
            }
            if (DC.TotalCustomMarker == 0)
            {
                DC.SetDefaultMarkers(wGradients.SolidTransparent, wMarker.MarkerType.None, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomLabel == 0)
            {
                if ((M == 0) || (M == 3))
                {
                    DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
                }
                else
                {
                    DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Top, wLabel.LabelAlignment.Perp, new wGraphic(wColors.Transparent)));
                }
            }

            List <pCartesianSeries> PointSeriesList = new List <pCartesianSeries>();

            pControl.SetProperties(DC);
            switch (M)
            {
            case 0:
                pControl.SetAdjacentBarChart();
                break;

            case 1:
                pControl.SetStackBarChart(false);
                break;

            case 2:
                pControl.SetStackBarChart(true);
                break;

            case 3:
                pControl.SetAdjacentColumnChart();
                break;

            case 4:
                pControl.SetStackColumnChart(false);
                break;

            case 5:
                pControl.SetStackColumnChart(true);
                break;
            }
            pControl.ForceRefresh();
            pControl.SetAxisAppearance();

            //Set Parrot Element and Wind Object properties
            if (!Active)
            {
                Element = new pElement(pControl.Element, pControl, pControl.Type);
            }
            WindObject          = new wObject(Element, "Pollen", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
Example #29
0
        /// <summary>
        /// Query the Information Model using the given Query Dataset.
        /// </summary>
        /// <param name="queryDataset">Query Dataset.</param>
        /// <returns>A collection of zero or more query reponse datasets.</returns>
        public override DataSetCollection QueryInformationModel(DataSet queryDataset)
        {
            DataSetCollection queryResponses = null;

            // get the query/retrieve level
            String queryRetrieveLevel = "UNKNOWN";

            DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = queryDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL);
            if (queryRetrieveLevelAttribute != null)
            {
                CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue;
                if (codeString.Values.Count == 1)
                {
                    queryRetrieveLevel = codeString.Values[0].Trim();
                }
            }

            // query at the PATIENT level
            if (queryRetrieveLevel == "PATIENT")
            {
                TagTypeList queryTagTypeList  = new TagTypeList();
                TagTypeList returnTagTypeList = new TagTypeList();
                foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                {
                    if (attribute.Length != 0)
                    {
                        queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                    }
                    returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                }

                foreach (PatientInformationEntity patientInformationEntity in Root)
                {
                    if (patientInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                    {
                        // PATIENT level matches
                        DataSet queryResponse = new DataSet();
                        patientInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                        queryResponses.Add(queryResponse);
                    }
                }
            }
            else
            {
                // find the matching PATIENT
                PatientInformationEntity patientInformationEntity = null;
                foreach (PatientInformationEntity lPatientInformationEntity in Root)
                {
                    if (lPatientInformationEntity.IsUniqueTagFoundIn(queryDataset))
                    {
                        patientInformationEntity = lPatientInformationEntity;
                        break;
                    }
                }
                if (patientInformationEntity != null)
                {
                    // query at the STUDY level
                    if (queryRetrieveLevel == "STUDY")
                    {
                        TagTypeList queryTagTypeList  = new TagTypeList();
                        TagTypeList returnTagTypeList = new TagTypeList();
                        foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                        {
                            // do not add higher level tag
                            if (attribute.Tag == Tag.PATIENT_ID)
                            {
                                continue;
                            }

                            if (attribute.Length != 0)
                            {
                                queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                            }
                            returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                        }

                        foreach (StudyInformationEntity studyInformationEntity in patientInformationEntity.Children)
                        {
                            if (studyInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                            {
                                // STUDY level matches
                                DataSet queryResponse = new DataSet();
                                patientInformationEntity.CopyUniqueTagTo(queryResponse);
                                studyInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                                queryResponses.Add(queryResponse);
                            }
                        }
                    }
                }
            }

            return(queryResponses);
        }
        /// <summary>
        /// Query the Information Model using the given Query Dataset.
        /// </summary>
        /// <param name="queryDataset">Query Dataset.</param>
        /// <returns>A collection of zero or more query reponse datasets.</returns>
        public override DataSetCollection QueryInformationModel(DataSet queryDataset)
        {
            DataSetCollection queryResponses = null;

            // get the query/retrieve level
            String queryRetrieveLevel = "UNKNOWN";

            DvtkData.Dimse.Attribute queryRetrieveLevelAttribute = queryDataset.GetAttribute(Tag.QUERY_RETRIEVE_LEVEL);
            if (queryRetrieveLevelAttribute != null)
            {
                CodeString codeString = (CodeString)queryRetrieveLevelAttribute.DicomValue;
                if (codeString.Values.Count == 1)
                {
                    queryRetrieveLevel = codeString.Values[0].Trim();
                }
            }

            // query at the STUDY level
            if (queryRetrieveLevel == "STUDY")
            {
                TagTypeList queryTagTypeList  = new TagTypeList();
                TagTypeList returnTagTypeList = new TagTypeList();
                foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                {
                    if (attribute.Length != 0)
                    {
                        queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                    }
                    returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                }


                foreach (StudyInformationEntity studyInformationEntity in Root)
                {
                    if (studyInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                    {
                        // STUDY level matches
                        DataSet queryResponse = new DataSet();
                        studyInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                        queryResponses.Add(queryResponse);
                    }
                }
            }
            else
            {
                // find the matching STUDY
                StudyInformationEntity studyInformationEntity = null;
                foreach (StudyInformationEntity lStudyInformationEntity in Root)
                {
                    if (lStudyInformationEntity.IsUniqueTagFoundIn(queryDataset))
                    {
                        studyInformationEntity = lStudyInformationEntity;
                        break;
                    }
                }

                if (studyInformationEntity != null)
                {
                    // query at the SERIES level
                    if (queryRetrieveLevel == "SERIES")
                    {
                        TagTypeList queryTagTypeList  = new TagTypeList();
                        TagTypeList returnTagTypeList = new TagTypeList();
                        foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                        {
                            // do not add higher level tags
                            if (attribute.Tag == Tag.STUDY_INSTANCE_UID)
                            {
                                continue;
                            }

                            if (attribute.Length != 0)
                            {
                                queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                            }
                            returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                        }

                        foreach (SeriesInformationEntity seriesInformationEntity in studyInformationEntity.Children)
                        {
                            if (seriesInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                            {
                                // SERIES level matches
                                DataSet queryResponse = new DataSet();
                                studyInformationEntity.CopyUniqueTagTo(queryResponse);
                                seriesInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                                queryResponses.Add(queryResponse);
                            }
                        }
                    }
                    else
                    {
                        // find the matching SERIES
                        SeriesInformationEntity seriesInformationEntity = null;
                        foreach (SeriesInformationEntity lSeriesInformationEntity in studyInformationEntity.Children)
                        {
                            if (lSeriesInformationEntity.IsUniqueTagFoundIn(queryDataset))
                            {
                                seriesInformationEntity = lSeriesInformationEntity;
                                break;
                            }
                        }

                        if (seriesInformationEntity != null)
                        {
                            // query at the IMAGE level
                            if (queryRetrieveLevel == "IMAGE")
                            {
                                TagTypeList queryTagTypeList  = new TagTypeList();
                                TagTypeList returnTagTypeList = new TagTypeList();
                                foreach (DvtkData.Dimse.Attribute attribute in queryDataset)
                                {
                                    // do not add higher level tags
                                    if ((attribute.Tag == Tag.STUDY_INSTANCE_UID) ||
                                        (attribute.Tag == Tag.SERIES_INSTANCE_UID))
                                    {
                                        continue;
                                    }

                                    if (attribute.Length != 0)
                                    {
                                        queryTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagRequired));
                                    }
                                    returnTagTypeList.Add(new TagType(attribute.Tag, TagTypeEnum.TagOptional));
                                }

                                foreach (InstanceInformationEntity instanceInformationEntity in seriesInformationEntity.Children)
                                {
                                    if (instanceInformationEntity.IsFoundIn(queryTagTypeList, queryDataset))
                                    {
                                        // IMAGE level matches
                                        DataSet queryResponse = new DataSet();
                                        studyInformationEntity.CopyUniqueTagTo(queryResponse);
                                        seriesInformationEntity.CopyUniqueTagTo(queryResponse);
                                        instanceInformationEntity.CopyTo(returnTagTypeList, queryResponse);
                                        queryResponses.Add(queryResponse);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(queryResponses);
        }
Example #31
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            int    C    = this.RunCount;

            wObject  WindObject = new wObject();
            pElement Element    = new pElement();
            bool     Active     = Elements.ContainsKey(C);

            var pControl = new pGaugeChartSeries(name);

            if (Elements.ContainsKey(C))
            {
                Active = true;
            }

            //Check if control already exists
            if (Active)
            {
                if (Elements[C] != null)
                {
                    WindObject = Elements[C];
                    Element    = (pElement)WindObject.Element;
                    pControl   = (pGaugeChartSeries)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;
            int     M = 0;
            bool    B = true;
            int     S = 100;

            if (!DA.GetData(0, ref D))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }
            if (!DA.GetData(2, ref B))
            {
                return;
            }
            if (!DA.GetData(3, ref S))
            {
                return;
            }

            wObject W = new wObject();

            D.CastTo(out W);

            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.Metro, false, false);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.Transparent);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.ChartGauge);
            }
            if (DC.TotalCustomMarker == 0)
            {
                DC.SetDefaultMarkers(wGradients.SolidTransparent, wMarker.MarkerType.None, false, false);
            }
            if (DC.TotalCustomLabel == 0)
            {
                DC.SetDefaultLabels(new wLabel(wLabel.LabelPosition.Center, wLabel.LabelAlignment.Center, new wGraphic(wColors.Transparent)));
            }

            pControl.SetProperties(DC, B, 0);
            pControl.SetCharts(S, M, modeStatus);

            if (DC.TotalCustomFont > 0)
            {
                pControl.SetFont();
            }

            //Set Parrot Element and Wind Object properties
            if (!Active)
            {
                Element = new pElement(pControl.Element, pControl, pControl.Type);
            }
            WindObject          = new wObject(Element, "Pollen", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
Example #32
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string ID   = this.Attributes.InstanceGuid.ToString();
            string name = new GUIDtoAlpha(Convert.ToString(ID + Convert.ToString(this.RunCount)), false).Text;
            int    C    = this.RunCount;

            wObject  WindObject = new wObject();
            pElement Element    = new pElement();
            bool     Active     = Elements.ContainsKey(C);

            var pCtrl = new pDataGrid(name);

            if (Elements.ContainsKey(C))
            {
                Active = true;
            }

            //Check if control already exists
            if (Active)
            {
                if (Elements[C] != null)
                {
                    WindObject = Elements[C];
                    Element    = (pElement)WindObject.Element;
                    pCtrl      = (pDataGrid)Element.PollenControl;
                }
            }
            else
            {
                Elements.Add(C, WindObject);
            }

            //Set Unique Control Properties

            IGH_Goo D = null;

            if (!DA.GetData(0, ref D))
            {
                return;
            }

            wObject W = new wObject();

            D.CastTo(out W);
            DataSetCollection DC = (DataSetCollection)W.Element;

            if (DC.TotalCustomFill == 0)
            {
                DC.SetDefaultPallet(wGradients.SolidLightGray, false, DC.Sets.Count > 1);
            }
            if (DC.TotalCustomFont == 0)
            {
                DC.SetDefaultFonts(wFonts.DataGrid);
            }
            if (DC.TotalCustomStroke == 0)
            {
                DC.SetDefaultStrokes(wStrokes.StrokeTypes.OffWhiteSolid);
            }

            if (DC.TotalCustomTitles == 0)
            {
                DC.Graphics.FontObject = wFonts.DataGridTitle;
            }

            pCtrl.SetProperties(DC, HasTitle);

            //Set Parrot Element and Wind Object properties
            if (!Active)
            {
                Element = new pElement(pCtrl.Element, pCtrl, pCtrl.Type);
            }
            WindObject          = new wObject(Element, "Pollen", Element.Type);
            WindObject.GUID     = this.InstanceGuid;
            WindObject.Instance = C;

            Elements[this.RunCount] = WindObject;

            DA.SetData(0, WindObject);
        }
Example #33
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            DataSetCollection DataTrees = new DataSetCollection();

            if (modeStatus)
            {
                TreeToArray            TtA = new TreeToArray();
                List <string>          Tb  = new List <string>();
                GH_Structure <IGH_Goo> Db;

                // Access the input parameters
                if (!DA.GetDataTree(0, out Db))
                {
                    return;
                }
                if (!DA.GetDataList(1, Tb))
                {
                    return;
                }

                //Output the formatting Object
                DataTrees = new DataSetCollection(Tb, TtA.FromObject(Db));
            }
            else
            {
                ListToArray    TlA = new ListToArray();
                string         Ta  = null;
                List <IGH_Goo> Da  = new List <IGH_Goo>();

                // Access the input parameters
                if (!DA.GetDataList(0, Da))
                {
                    return;
                }
                if (!DA.GetData(1, ref Ta))
                {
                    return;
                }

                //Output the formatting Object
                DataTrees = new DataSetCollection(Ta, TlA.FromObject(Da));
            }

            DataTrees.Graphics.Background = wColors.OffWhite;

            DataTrees.Graphics.FontObject.FontColor = wColors.Gray;
            DataTrees.Graphics.FontObject.Justify   = wFontBase.Justification.BottomCenter;
            DataTrees.Graphics.FontObject.IsBold    = true;

            DataTrees.Graphics.StrokeColor = wColors.VeryLightGray;
            DataTrees.Graphics.SetUniformStrokeWeight(1);
            DataTrees.Graphics.SetUniformPadding(2);

            DataTrees.SetSeriesScales();

            // Assign the class to the output parameter.
            wObject WindObject = new wObject(DataTrees, "Pollen", "DataSet");

            WindObject.Graphics = DataTrees.Graphics;


            DA.SetData(0, WindObject);
        }
        /// <summary>
        /// 원하는 Chart를 빌드합니다.
        /// </summary>
        public override IChart BuildFusionChart() {
            var factoryId = Request["FactoryId"].AsInt(1);
            var lineDual = Request["LineDual"].AsInt(0);
            var numVisiblePlot = Request["numVisiblePlot"].AsInt(12);

            var chart = new MultiSeriesStackedChart
                        {
                            Caption = "Factory 정보",
                            SubCaption = "일일 생산량",
                            Palette = rnd.Next(1, 5),
                            RotateLabels = true,
                            // PlaceValuesInside = true,
                            // RotateValues = true,
                            SlantLabels = true,
                            XAxisName = "Day",
                            YAxisName = "Units",
                            NumVisiblePlot = numVisiblePlot,
                            BaseFontAttr = { Font = "맑은 고딕" },
                            BorderAttr = { Show = true },
                            BackgroundAttr = { BgColor = Color.White, BgAlpha = 100 }
                        };

            chart.ShowShadow = true;

            var outputs = FactoryRepository.FindAllFactoryOutputByFactoryId(factoryId);
            foreach(var output in outputs) {
                chart.AddCategory(output.DatePro.Value.ToMonthDayString(), true);
                //var category = new CategoryElement
                //               {
                //                   Label = output.DatePro.Value.ToMonthDayString()
                //               };
                //chart.Categories.CategoryElements.Add(category);
            }


            for(int d = 0; d < 2; d++) {
                var datasetCollection = new DataSetCollection();

                for(int i = 1; i < 4; i++) {
                    var dataSet = new DataSetElement
                                  {
                                      SeriesName = "Factory " + i,
                                      ShowValues = false
                                  };

                    if(lineDual == 1 && i == 3) {
                        dataSet.RenderAs = GraphKind.Line;
                        dataSet.ParentYAxis = YAxisKind.S;
                    }

                    FillData(dataSet, i);
                    datasetCollection.Add(dataSet);
                }
                chart.DataSetCollections.Add(datasetCollection);
            }

            // add LineSet
            chart.LineSet.SeriesName = "Cost as % of Revenue";

            foreach(var output in outputs) {
                chart.LineSet.SetElements.Add(new ValueSetElement { Value = rnd.Next(40, 100) });
            }

            return chart;
        }
        public void Execute(DataSetCollection dataSets)
        {
            var spells = ReadSpells();

            AddSpellLists(spells);

            GenerateIds(spells);

            // Génération page format wiki
            using (var writer = new StreamWriter("SpellGlossary.txt"))
            {
                writer.WriteLine("{s:SortTable}{s:MenuGlossaires}");
                writer.WriteLine();
                writer.WriteLine();
                writer.WriteLine("''Cliquez sur un titre de colonnes pour trier le tableau. Pour faire un tri par catégorie puis, à l'intérieur de chaque catégorie, selon un autre critère, triez d'abord selon cet autre critère (par ordre alphabétique par exemple) puis cliquez sur le titre de la colonne des catégories.");
                writer.WriteLine();
                writer.WriteLine("En cliquant sur un des noms anglais, vous serez redirigés vers le PRD officiel en anglais, sur le site de Paizo.''");
                writer.WriteLine();
                writer.WriteLine("{| CLASS=\"tablo sortable\" ID=\"tabsort\"");
                writer.WriteLine("|+ Glossaire des sorts");
                writer.WriteLine("! Anglais !! Français !! École !! Mag !! Prê !! Dru !! Rôd !! Bar !! Pal !! Alc !! Con !! Sor !! Inq !! Ora !! Apal !! Source");

                foreach (var spell in spells.OrderBy(s => AsSourceOrderKey(s.Source.Id)).ThenBy(s => s.Name))
                {
                    // Nom anglais
                    var englishName = GetLocalizedEntry(spell, "en-US", "name", "?");
                    writer.WriteLine("|-");
                    writer.Write("| class=\"gauche\" | ");
                    writer.Write(englishName);
                    var prdSource = spell.Source.References.FirstOrDefault(s => s.Name == References.PaizoPrd);
                    if (prdSource != null)
                    {
                        // Lien présent
                        writer.Write(' ');
                        writer.Write("[[{0}|PRD]]", prdSource.Href.ToString().Replace("ultimageMagic", "ultimateMagic"));
                    }
                    else if (englishName != "?")
                    {
                        // Génération nom
                        writer.Write(' ');
                        writer.Write("[[{0}|PRD]]", PrdUtils.GenerateSpellPrdUrl(englishName, spell.Source.Id));
                    }
                    writer.WriteLine();

                    // Nom français
                    var frenchName = spell.Name;
                    writer.Write("| class=\"gauche\" | ");
                    writer.Write(frenchName);
                    var wikiUrl = spell.Source.References.First(r => r.Name == References.PathfinderFrWiki).HrefString;
                    writer.Write(" [[{0}|(lien)]]", wikiUrl.Substring(WikiUrlPrefix.Length, wikiUrl.Length - WikiUrlPrefix.Length - WikiUrlSuffix.Length));
                    writer.WriteLine();
                    writer.WriteLine("| {0}", AsSchoolLabel(spell.School));

                    // Niveaux
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.SorcererWizard));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Cleric));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Druid));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Ranger));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Bard));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Paladin));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Alchemist));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Summoner));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Witch));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Inquisitor));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.Oracle));
                    writer.Write("| {0} |", GetSpellListLevel(spell, SpellList.Ids.AntiPaladin));

                    // Source
                    writer.WriteLine("| {0}", AsSourceLabel(spell));
                }

                writer.WriteLine("|}");
            }
        }
Example #36
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            double  T0      = 1;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref T0))
            {
                return;
            }

            wObject W = new wObject();

            if (Element != null)
            {
                Element.CastTo(out W);
            }
            wGraphic G = W.Graphics;

            G.Margin[0] = T0;
            G.Margin[1] = T0;
            G.Margin[2] = T0;
            G.Margin[3] = T0;

            W.Graphics = G;

            switch (W.Type)
            {
            case "Parrot":
                pElement E = (pElement)W.Element;
                pControl C = (pControl)E.ParrotControl;
                C.Graphics = G;

                C.SetMargin();

                break;

            case "Pollen":
                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt tDataPt = (DataPt)W.Element;
                    tDataPt.Graphics = G;

                    W.Element = tDataPt;
                    break;

                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Graphics = G;

                    W.Element = tDataSet;
                    break;

                case "Chart":
                case "Table":

                    pElement pE = (pElement)W.Element;
                    pChart   pC = pE.PollenControl;
                    pC.Graphics = G;

                    pC.SetMargin();

                    pE.PollenControl = pC;
                    W.Element        = pE;
                    break;
                }
                break;

            case "Hoopoe":
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, G);
        }
Example #37
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo  Element = null;
            int      S       = 1;
            bool     L       = true;
            double   A       = 0;
            Interval B       = new Interval(0, 0);

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref S))
            {
                return;
            }
            if (!DA.GetData(2, ref L))
            {
                return;
            }
            if (!DA.GetData(3, ref A))
            {
                return;
            }
            if (!DA.GetData(4, ref B))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);

            double B0 = B.T0;
            double B1 = B.T1;

            if (B0 == B1)
            {
                B1 = B0 + 1;
            }

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataSet":
                    DataSetCollection tDataSet = (DataSetCollection)W.Element;
                    tDataSet.Axes.Enabled = true;
                    switch (modeStatus)
                    {
                    default:
                        tDataSet.Axes.AxisX.SetAxisProperties(S, new wDomain(B0, B1), L, A);
                        tDataSet.Axes.AxisY.SetAxisProperties(S, new wDomain(B0, B1), L, A);
                        break;

                    case 1:
                        tDataSet.Axes.AxisX.SetAxisProperties(S, new wDomain(B0, B1), L, A);
                        break;

                    case 2:
                        tDataSet.Axes.AxisY.SetAxisProperties(S, new wDomain(B0, B1), L, A);
                        break;
                    }

                    W.Element = tDataSet;
                    break;
                }
                break;
            }


            DA.SetData(0, W);
        }
Example #38
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IGH_Goo Element = null;
            int     M       = 0;
            int     R       = 10;

            System.Drawing.Color F = System.Drawing.Color.DarkGray;
            System.Drawing.Color S = System.Drawing.Color.Transparent;
            double T = 0;

            if (!DA.GetData(0, ref Element))
            {
                return;
            }
            if (!DA.GetData(1, ref M))
            {
                return;
            }
            if (!DA.GetData(2, ref R))
            {
                return;
            }
            if (!DA.GetData(3, ref F))
            {
                return;
            }
            if (!DA.GetData(4, ref S))
            {
                return;
            }
            if (!DA.GetData(5, ref T))
            {
                return;
            }

            wObject W;

            Element.CastTo(out W);

            wGraphic G = new wGraphic();

            G.Background  = new wColor(F);
            G.StrokeColor = new wColor(S);
            G.SetUniformStrokeWeight(T);

            wMarker CustomMarker = new wMarker((wMarker.MarkerType)M, (int)R, G);

            switch (W.Type)
            {
            case "Pollen":

                switch (W.SubType)
                {
                case "DataPoint":
                    DataPt Pt = (DataPt)W.Element;
                    Pt.SetMarker(CustomMarker);

                    W.Element = Pt;
                    break;

                case "DataSet":
                    DataSetCollection St = (DataSetCollection)W.Element;
                    St.SetUniformMarkers(CustomMarker);

                    W.Element = St;
                    break;
                }
                break;
            }

            DA.SetData(0, W);
            DA.SetData(1, CustomMarker);
        }