Beispiel #1
0
        private void CleanSecondaryCategories()
        {
            SGTextBoxCollection txbxcoll =
                new SGTextBoxCollection(RecognizeSecondaryAxis().ToList <SGTextBox>());

            if (txbxcoll.NumberOfCategories != 0)
            {
                if (ca.PrimaryCategoryType != CategoryUnit.DIRTY && ca.PrimaryCategoryType != CategoryUnit.YEAR)
                {
                    log.Debug("Secondary category axis found. Attempting cleanup...");
                    log.Debug("Attempting to clean years...");
                    g.CategoryAxis.SecondaryCategoryType = CategoryUnit.YEAR;
                    CleanYearsAsBoxes(txbxcoll);
                }
                else
                {
                    log.Warn("Sorry, I see a secondary axis, but I can't fix it."
                             + " Primary categories should be fixed first.");
                    ca.SecondaryCategories = null;
                }
            }
            else
            {
                log.Debug("No secondary axis.");
                ca.SecondaryCategories = null;
            }
        }
Beispiel #2
0
        private SGTextBoxCollection GetJSONTextBoxes(Dictionary <string, object> file)
        {
            // STUBBED

            // return empty text box collection for now
            SGTextBoxCollection text_boxes = new SGTextBoxCollection();

            return(text_boxes);
        }
Beispiel #3
0
        public void Clean(StatisticalGraph graph)
        {
            log.Debug("Applying textbox cleaning algorithms.");

            g = graph;
            txtbox_collection = graph.Textboxes;
            removeEmpty(); //remove empty textboxes
            txtbox_collection.SortVertically();

            int ctr = 0;

            foreach (SGTextBox txtbx in txtbox_collection)
            {
                RecognizeFunction(txtbx, ctr);
                ctr++;
            }
        }
        /***************************************************************************
         * Text boxes are dealt with here
         **************************************************************************/
        private SGTextBoxCollection GetXLTextBoxes(Chart chart)
        {
            SGTextBoxCollection sg_textbox_collection = new SGTextBoxCollection();
            IEnumerator         text_box_enumerator   = ((TextBoxes)chart.TextBoxes
                                                             (Type.Missing)).GetEnumerator();
            int ctr = 0;

            if (chart.HasTitle)
            {
                ChartTitle ct    = chart.ChartTitle;
                SGTextBox  tibox = new SGTextBox();
                tibox.ID       = ctr;
                tibox.Geometry = new SGGeometry(0F, 0F, 0F, 0F);
                tibox.Text     = ct.Text;
                sg_textbox_collection.AddTextBox(tibox);
                ctr++;
            }

            while (text_box_enumerator.MoveNext())
            {
                SGTextBox sg_textbox = new SGTextBox();
                sg_textbox.ID = ctr;
                TextBox xl_textbox = (TextBox)text_box_enumerator.Current;

                // TextBox without text :)
                if (xl_textbox.Text.Length == 0)
                {
                    continue;
                }

                sg_textbox.Text    = xl_textbox.Text.Trim().Replace("\n", "");
                sg_textbox.BoxSize = new Size(xl_textbox.Width, xl_textbox.Height);
                SGGeometry txtbox_geom = new SGGeometry(xl_textbox.Left,
                                                        xl_textbox.Top, xl_textbox.Height, xl_textbox.Width);
                sg_textbox.Geometry = txtbox_geom;

                /**
                 * Excel constants for horizontal alignment are found at
                 * \latexonly
                 * \url{http://msdn.microsoft.com/en-us/library/aa221100(office.11).spx}
                 * \endlatexonly
                 */

                switch (xl_textbox.HorizontalAlignment.ToString())
                {
                case "-4131":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.LEFT;
                    break;

                case "-4108":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.CENTER;
                    break;

                case "-4152":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.RIGHT;
                    break;

                case "-4130":
                    sg_textbox.Justification = SGTextBox.HorizontalAlignment.JUSTIFIED;
                    break;
                }
                sg_textbox_collection.AddTextBox(sg_textbox);
                log.Debug(sg_textbox.ReturnAsString());
                ctr++;
            }
            log.Debug(ctr + " legal text box(es) found.");
            return(sg_textbox_collection);
        }