Esempio n. 1
0
 public void WriteGlyphTest()
 {
     nisanOrder order = new nisanOrder();
     order.name = "HJ ZAINUL BIN MUSTAFFA";
     order.jawi = "";
     order.death = "2010-08-31";
     order.deathm = "1431-08-01";
     //TODO: SvgWriter_Accessor target = new SvgWriter_Accessor(order, "nisan_normal_L.svg");
     //target.WriteGlyph("syaaban.svg");
     Assert.IsTrue(true);
 }
Esempio n. 2
0
        public void GetMuslimMonthSvgPathTest()
        {
            //string expected = "<path id=\"deathmonth\" d=\"m 16.139532,49.34254 c 3.53218,-0.77616 7.27633,-2.59343 9.07548,-4.30696 1.21172,-1.15486 7.01487,-10.60491 7.35807,-12.21596 0.10699,-0.50244 0.03275,-6.29796 -0.7444,-8.30521 -0.43407,-1.12235 -1.44657,-2.7459 -2.17248,-3.84451 l -0.81927,-1.23985 -1.49131,1.55481 c -0.30671,0.31871 -0.6183,0.65242 -0.88914,0.95613 -0.97663,1.09861 -1.66117,2.55593 -1.64767,3.50706 0.03525,2.48218 1.03187,7.41031 1.31196,9.83501 l 0.16298,1.40982 -1.27421,0.56868 c -1.1736,0.52368 -3.03262,1.23109 -4.44394,1.5898 -3.74978,0.95238 -10.6409104,-0.40745 -14.0049904,-2.70716 -6.24495995,-4.26821 -1.5868,-9.98874 -2.29233,-9.91875 -0.73991,0.0737 -1.90426,2.25846 -2.76766,4.11698 -1.68890995,3.63329 -2.01148995,9.84001 -0.66440995,12.80839 0.33770995,0.74365 0.66403995,1.35233 0.91400995,1.65354 0.36345,0.43619 0.75515,0.87614 1.10748,1.29484 2.14373,2.54467 8.7452804,4.23946 13.2818304,3.24334 z m 0.1751,-39.83624 -5.3177,5.31808 5.3187,5.31808 5.31771,-5.31683 -5.31871,-5.31933 z M 118.92696,0 l -5.31683,5.31808 5.31808,5.31808 5.31808,-5.31683 L 118.92696,0 z m 0,13.15085 -3.64329,-3.64455 -5.31808,5.31808 5.31808,5.31808 3.64454,-3.64329 3.64454,3.64329 5.31683,-5.31683 -5.31808,-5.31933 -3.64454,3.64455 z M 44.911282,25.14184 c -1.15985,-2.57218 -0.20372,-6.24797 -0.18623,-10.12748 0.03,-6.45544 -1.60729,-11.0936 -2.53343,-13.62203 L 41.681692,0 40.131882,1.6348 c -0.19872,0.20997 -0.39495,0.42994 -0.57118,0.64991 -3.59579,4.47319 -0.66491,10.35245 0.27122,15.69553 0.11624,0.66616 0.30371,14.02448 1.90101,16.01548 1.11236,1.38608 3.67079,2.39595 6.34295,3.07336 5.36683,1.36108 16.15297,1.28609 21.48105,-1.51606 0.21497,-0.11248 0.42494,-0.22997 0.63117,-0.35245 0,0 2.3222,-1.38608 2.3222,-1.38608 0,0 0.91739,0.62492 1.40733,0.95863 4.3232,2.94463 21.08359,4.16823 25.72551,1.79103 0.31246,-0.15998 1.846008,-0.94613 1.846008,-0.94613 l 2.99088,0.81364 c 1.02987,0.27997 2.29971,0.63742 4.09448,0.90989 2.021,0.30871 5.34433,-0.0225 7.1666,-0.7949 0.83489,-0.35371 1.63979,-0.85489 2.3622,-1.30234 l 2.05224,-1.26859 2.52718,1.09861 c 1.75853,0.76366 4.03699,1.82977 5.64179,2.26722 3.64204,0.99237 5.95675,-3.08836 8.06899,-7.32908 0.47869,-0.95863 0.93113,-2.09723 0.84614,-3.1571 -0.1,-1.25109 -0.67617,-2.97463 -0.67617,-2.97463 0,0 -1.25484,0.75491 -2.14473,1.33859 -0.93488,0.61492 -1.46856,1.04111 -2.02474,1.74353 -0.41245,0.51993 -2.29221,0.55368 -3.84327,0.0225 l -2.03224,-0.69491 0.63992,-4.09198 c 0.4087,-2.61093 -5.35058,6.05798 -10.02624,6.95662 -2.23347,0.42995 -4.87438,0.34496 -5.60929,-0.50994 -0.28247,-0.3287 -0.24872,-0.82614 -0.035,-1.5198 0.4337,-1.40733 1.11111,-2.85465 0.88989,-3.46207 0.0737,0.20248 -6.44794,5.09686 -10.38994,5.24684 -2.947128,0.11249 -18.007728,1.73228 -22.147208,-1.73103 -0.88989,-0.74491 -0.28996,-3.33708 0.50369,-5.46806 0.91863,-2.46594 0.22747,-3.00087 -2.09474,-4.46944 -0.62242,-0.3937 -1.18485,-0.76115 -1.81727,-1.06362 -0.95238,-0.45869 -6.44669,-0.71616 -7.1841,-0.33745 -1.34358,0.68991 -4.20947,4.91313 -4.97062,7.44406 -1.04987,3.49206 0.63742,2.54593 2.86964,3.9545 0.24872,0.15748 0.43369,0.35371 0.43619,0.51494 0.0025,0.20372 -0.3712,0.68491 -0.91738,1.11986 -4.81189,3.82576 -20.18121,-0.24497 -21.75476,-3.73203 z m 9.59504,13.8545 -5.31808,5.31683 5.31933,5.31933 5.31683,-5.31808 -5.31808,-5.31808 z\" style=\"fill:#000000;stroke:none\" />";
            string expected = "<path";
            expected += "\n" + "id=\"deathmonth\"";
            expected += "\n" + "d=\"m 16.139532,49.34254 c 3.53218,-0.77616 7.27633,-2.59343 9.07548,-4.30696 1.21172,-1.15486 7.01487,-10.60491 7.35807,-12.21596 0.10699,-0.50244 0.03275,-6.29796 -0.7444,-8.30521 -0.43407,-1.12235 -1.44657,-2.7459 -2.17248,-3.84451 l -0.81927,-1.23985 -1.49131,1.55481 c -0.30671,0.31871 -0.6183,0.65242 -0.88914,0.95613 -0.97663,1.09861 -1.66117,2.55593 -1.64767,3.50706 0.03525,2.48218 1.03187,7.41031 1.31196,9.83501 l 0.16298,1.40982 -1.27421,0.56868 c -1.1736,0.52368 -3.03262,1.23109 -4.44394,1.5898 -3.74978,0.95238 -10.6409104,-0.40745 -14.0049904,-2.70716 -6.24495995,-4.26821 -1.5868,-9.98874 -2.29233,-9.91875 -0.73991,0.0737 -1.90426,2.25846 -2.76766,4.11698 -1.68890995,3.63329 -2.01148995,9.84001 -0.66440995,12.80839 0.33770995,0.74365 0.66403995,1.35233 0.91400995,1.65354 0.36345,0.43619 0.75515,0.87614 1.10748,1.29484 2.14373,2.54467 8.7452804,4.23946 13.2818304,3.24334 z m 0.1751,-39.83624 -5.3177,5.31808 5.3187,5.31808 5.31771,-5.31683 -5.31871,-5.31933 z M 118.92696,0 l -5.31683,5.31808 5.31808,5.31808 5.31808,-5.31683 L 118.92696,0 z m 0,13.15085 -3.64329,-3.64455 -5.31808,5.31808 5.31808,5.31808 3.64454,-3.64329 3.64454,3.64329 5.31683,-5.31683 -5.31808,-5.31933 -3.64454,3.64455 z M 44.911282,25.14184 c -1.15985,-2.57218 -0.20372,-6.24797 -0.18623,-10.12748 0.03,-6.45544 -1.60729,-11.0936 -2.53343,-13.62203 L 41.681692,0 40.131882,1.6348 c -0.19872,0.20997 -0.39495,0.42994 -0.57118,0.64991 -3.59579,4.47319 -0.66491,10.35245 0.27122,15.69553 0.11624,0.66616 0.30371,14.02448 1.90101,16.01548 1.11236,1.38608 3.67079,2.39595 6.34295,3.07336 5.36683,1.36108 16.15297,1.28609 21.48105,-1.51606 0.21497,-0.11248 0.42494,-0.22997 0.63117,-0.35245 0,0 2.3222,-1.38608 2.3222,-1.38608 0,0 0.91739,0.62492 1.40733,0.95863 4.3232,2.94463 21.08359,4.16823 25.72551,1.79103 0.31246,-0.15998 1.846008,-0.94613 1.846008,-0.94613 l 2.99088,0.81364 c 1.02987,0.27997 2.29971,0.63742 4.09448,0.90989 2.021,0.30871 5.34433,-0.0225 7.1666,-0.7949 0.83489,-0.35371 1.63979,-0.85489 2.3622,-1.30234 l 2.05224,-1.26859 2.52718,1.09861 c 1.75853,0.76366 4.03699,1.82977 5.64179,2.26722 3.64204,0.99237 5.95675,-3.08836 8.06899,-7.32908 0.47869,-0.95863 0.93113,-2.09723 0.84614,-3.1571 -0.1,-1.25109 -0.67617,-2.97463 -0.67617,-2.97463 0,0 -1.25484,0.75491 -2.14473,1.33859 -0.93488,0.61492 -1.46856,1.04111 -2.02474,1.74353 -0.41245,0.51993 -2.29221,0.55368 -3.84327,0.0225 l -2.03224,-0.69491 0.63992,-4.09198 c 0.4087,-2.61093 -5.35058,6.05798 -10.02624,6.95662 -2.23347,0.42995 -4.87438,0.34496 -5.60929,-0.50994 -0.28247,-0.3287 -0.24872,-0.82614 -0.035,-1.5198 0.4337,-1.40733 1.11111,-2.85465 0.88989,-3.46207 0.0737,0.20248 -6.44794,5.09686 -10.38994,5.24684 -2.947128,0.11249 -18.007728,1.73228 -22.147208,-1.73103 -0.88989,-0.74491 -0.28996,-3.33708 0.50369,-5.46806 0.91863,-2.46594 0.22747,-3.00087 -2.09474,-4.46944 -0.62242,-0.3937 -1.18485,-0.76115 -1.81727,-1.06362 -0.95238,-0.45869 -6.44669,-0.71616 -7.1841,-0.33745 -1.34358,0.68991 -4.20947,4.91313 -4.97062,7.44406 -1.04987,3.49206 0.63742,2.54593 2.86964,3.9545 0.24872,0.15748 0.43369,0.35371 0.43619,0.51494 0.0025,0.20372 -0.3712,0.68491 -0.91738,1.11986 -4.81189,3.82576 -20.18121,-0.24497 -21.75476,-3.73203 z m 9.59504,13.8545 -5.31808,5.31683 5.31933,5.31933 5.31683,-5.31808 -5.31808,-5.31808 z\"";
            expected += "\n" + "style=\"fill:#000000;stroke:none\" />";
            string actual = string.Empty;

            nisanOrder order = new nisanOrder();
            order.name = "HJ ZAINUL BIN MUSTAFFA";
            order.jawi = "";
            order.death = "2010-08-31";
            order.deathm = "1431-08-01";

            //TODO: SvgWriter_Accessor target = new SvgWriter_Accessor(order, "nisan_normal_L.svg");
            //actual = target.GetMuslimMonthSvgPath("syaaban.svg");
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        /// <summary>
        /// Recommended constructor.
        /// </summary>
        /// <param name="order">Order.</param>
        /// <param name="templatePath">Lookup template file.</param>
        public SvgWriter(nisanOrder order, string templatePath)
        {
            this.order = order;
            this.templatePath = templatePath;
            this.action = Action.None;
            this.tolerance = new Point();

            //initialize position for new muslim month template suppose to located.
            this.relativeMonthCoordinates = new Dictionary<string, Point>();
            for (int i = 0; i < 12; i++)
                this.relativeMonthCoordinates.Add(muslimMonths[i], monthCoordinates[i]);

            /**
             * If only maintain death date use 'nisan_L.svg' (for male) or 'nisan_P.svg' (for female).
             * If maintain born use 'nisan_L2.svg'.
             * If maintain age as well use 'nisan_L3.svg'.
             */
            string file = string.Empty;
            if(!string.IsNullOrEmpty(order.death))
              	file = templatePath.Replace(".svg", "0.svg");
            else if(!string.IsNullOrEmpty(order.age) && !string.IsNullOrEmpty(order.born))
            {
               	//tolerance for born template
                file = templatePath.Replace(".svg", "4.svg");
                this.tolerance = new Point(0, -20.00);
            }
            if (!string.IsNullOrEmpty(order.age))
            {
            	//tolerance for age template
                file = templatePath.Replace(".svg", "3.svg");
                this.tolerance = new Point(0, -4.00);
            }
            else if (!string.IsNullOrEmpty(order.born))
            {
            	//tolerance for born template
                file = templatePath.Replace(".svg", "2.svg");
                this.tolerance = new Point(0, -20.00);
            }
            else
                file = templatePath;

            //this is a female template with need to move on top a little bit
            if (order.item.Contains("(P)")) this.tolerance = new Point(0, -20.00);

            this.sourceFile = this.outputLocation + System.IO.Path.DirectorySeparatorChar + order.name.ToLower() + ".svg";
            if (File.Exists(this.sourceFile))
            {
                fileExist = true;
            }
            else
            {
                if (File.Exists(file)) this.reader = new StreamReader(file);
                if (!Directory.Exists(outputLocation)) Directory.CreateDirectory(outputLocation);
                this.writer = new StreamWriter(sourceFile);
            }
        }
Esempio n. 4
0
        public SvgWriter(nisanOrder order, ref MemoryStream stream)
        {
            this.order = order;
            this.templatePath = ConfigurationManager.AppSettings[order.item].ToString();
            this.action = Action.None;
            this.tolerance = new Point();

            //initialize position for new muslim month template suppose to located.
            this.relativeMonthCoordinates = new Dictionary<string, Point>();
            for (int i = 0; i < 12; i++)
                this.relativeMonthCoordinates.Add(muslimMonths[i], monthCoordinates[i]);

            /**
             * If only maintain death date use 'nisan_L.svg' (for male) or 'nisan_P.svg' (for female).
             * If maintain born use 'nisan_L2.svg'.
             * If maintain age as well use 'nisan_L3.svg'.
             */
            string file = string.Empty;
            if (!string.IsNullOrEmpty(order.death))
                file = templatePath.Replace(".svg", "0.svg");
            else if (!string.IsNullOrEmpty(order.age) && !string.IsNullOrEmpty(order.born))
            {
                //tolerance for born template
                file = templatePath.Replace(".svg", "4.svg");
                this.tolerance = new Point(0, -20.00);
            }
            if (!string.IsNullOrEmpty(order.age))
            {
                //tolerance for age template
                file = templatePath.Replace(".svg", "3.svg");
                this.tolerance = new Point(0, -4.00);
            }
            else if (!string.IsNullOrEmpty(order.born))
            {
                //tolerance for born template
                file = templatePath.Replace(".svg", "2.svg");
                this.tolerance = new Point(0, -20.00);
            }
            else
                file = templatePath;

            //this is a female template with need to move on top a little bit
            if (order.item.Contains("(P)")) this.tolerance = new Point(0, -20.00);

            this.writer = new StreamWriter(stream);
        }
Esempio n. 5
0
        /// <summary>
        /// Clone nisanOrder to HLGranite.Jawi.nisanOrder.
        /// </summary>
        /// <remarks>
        /// TODO: Actually two classes are identical. Plan to unify these two.
        /// </remarks>
        /// <param name="source"></param>
        /// <returns></returns>
        private HLGranite.Jawi.nisanOrder CloneOrder(NisanWPF.BusinessLogic.nisanOrder source)
        {
            HLGranite.Jawi.nisanOrder target = new HLGranite.Jawi.nisanOrder();

            target.item = source.item;
            target.remarks = source.remarks;
            target.tags = source.tags;

            target.soldto = source.soldto;
            target.date = source.date;
            target.delivered = source.delivered;
            target.bill = source.bill;
            target.price = source.price;

            target.name = source.name;
            target.jawi = source.jawi;
            target.born = source.born;
            target.bornm = source.bornm;
            target.death = source.death;
            target.deathm = source.deathm;
            target.age = source.age;

            return target;
        }