public int Compare(ImageInst img1, ImageInst img2)
 {
     if (img1.PointBase.Z > img2.PointBase.Z)
     {
         return(1);
     }
     else if (img1.PointBase.Z == img2.PointBase.Z)
     {
         if (Transf.transform(img1.PointBase).Z < Transf.transform(img2.PointBase).Z)
         {
             return(1);
         }
         else if (Transf.transform(img1.PointBase).Z == Transf.transform(img2.PointBase).Z)
         {
             return(0);
         }
         else
         {
             return(-1);
         }
     }
     else
     {
         return(-1);
     }
 }
Exemple #2
0
 public string DoSql(Transf tf, string s)
 {
     OpenConnectionMy(tf.connection, true);
     cmd_my.CommandText = s;// AdjustSql(s);
     cmd_my.ExecuteNonQuery();
     CloseConnectionMy();
     return(s);
 }
Exemple #3
0
        public static void UpdateTransf(Transf trn)
        {
            String connectionString = DataManager.OraConnString();
            string query            = " update pmis_transfer set order_no = '" + trn.OrderNo + "',trans_date= convert('" + trn.TransDate + "','dd/mm/rrrr'),trans_prom= '" + trn.TransProm + "', " +
                                      " branch_code= '" + trn.BranchCode + "', desig_code = '" + trn.DesigCode + "' where emp_no='" + trn.EmpNo + "' and order_no='" + trn.OrderNo + "'";

            DataManager.ExecuteNonQuery(connectionString, query);
        }
Exemple #4
0
        public static void CreateTransf(Transf trn)
        {
            String connectionString = DataManager.OraConnString();
            string query            = " insert into pmis_transfer (emp_no,order_no,trans_date,trans_prom,branch_code,desig_code) values (" +
                                      " " + " '" + trn.EmpNo + "'," + " '" + trn.OrderNo + "'," + " convert('" + trn.TransDate + "','dd/mm/rrrr')," + " '" + trn.TransProm + "', " +
                                      " " + " '" + trn.BranchCode + "'," + " '" + trn.DesigCode + "')";

            DataManager.ExecuteNonQuery(connectionString, query);
        }
Exemple #5
0
        //transform one line
        public string Transform1(Transf tf, string s)
        {
            int i, k;

            if (tf != null && tf.connection != "")
            {
                return(DoSql(tf, s));
            }

            if (tf == null || (tf.lstInt.Count == 0 && tf.regexp == null) || s == "")
            {
                return(s);
            }

            string q = "";

            if (tf.regexp == null)
            {   //simple change order
                string[] arr = s.Split(tf.sp_in);
                for (i = 0; i < tf.lstInt.Count; i++)
                {
                    if (i > 0)
                    {
                        q = q + tf.sp_out;
                    }
                    k = tf.lstInt[i];
                    if (k >= arr.Length)
                    {
                        continue;
                    }
                    q = q + arr[k];
                }
            }
            else
            {   //complex approach with Regex
                q = tf.regexp.Replace(s, tf.myEvaluator);
                if (tf.modifonly == 1 && q == s)
                {
                    q = "";
                }
            }
            return(q);
        }
Exemple #6
0
 public void UpdateChild(XmlNode node)
 {
     if (node is IGraph)
     {
         IGraph      graph1    = (IGraph)node;
         SvgDocument document1 = base.OwnerDocument;
         bool        flag1     = document1.AcceptChanges;
         document1.AcceptChanges = false;
         if (!this.RefMatrix.IsIdentity)
         {
             Matrix matrix1 = this.RefMatrix.Clone();
             matrix1.Invert();
             Transf transf1 = new Transf();
             transf1.setMatrix(matrix1);
             graph1.Transform = transf1;
         }
         document1.AcceptChanges = flag1;
     }
 }
Exemple #7
0
        //transform init
        public Transf TransformInit(string sectname)
        {
            int     i;
            IniSect scTransf = FindSect(sectname);

            if (scTransf != null && scTransf.lst.Count != 0)
            {
                Transf tf = new Transf();
                tf.lstInt = new List <int>();
                string ord = FindValue(scTransf, "order");
                if (ord != "")
                {
                    string[] arr = ord.Split(',');
                    for (i = 0; i < arr.Length; i++)
                    {
                        tf.lstInt.Add(int.Parse(arr[i]));
                    }
                }

                ord = FindValue(scTransf, "sp_in");
                if (ord != "")
                {
                    tf.sp_in = ord.ToCharArray()[0];
                }

                ord = FindValue(scTransf, "sp_out");
                if (ord != "")
                {
                    tf.sp_out = ord.ToCharArray()[0];
                }

                ord = FindValue(scTransf, "all");
                if (ord == "1")
                {
                    tf.all = 1;
                }

                ord = FindValue(scTransf, "regexp");
                if (ord != "")
                {
                    tf.regexp      = new Regex(ord, RegexOptions.Singleline);
                    tf.myEvaluator = new MatchEvaluator(tf.MyReplace);
                }

                ord = FindValue(scTransf, "regout");
                if (ord != "")
                {
                    tf.regout = ord;
                }

                ord = FindValue(scTransf, "modifonly");
                if (ord != "")
                {
                    int.TryParse(ord, out tf.modifonly);
                }

                ord = FindValue(scTransf, "file");
                if (ord != "")
                {
                    tf.file = ord;
                }

                ord = FindValue(scTransf, "enc");
                if (ord != "")
                {
                    tf.enc = ord;
                }

                ord = FindValue(scTransf, "dir");
                if (ord != "")
                {
                    tf.dir = ord;
                }

                ord = FindValue(scTransf, "regrep");
                if (ord != "")
                {
                    tf.regrep = ord;
                }

                ord = FindValue(scTransf, "ng");
                if (ord != "")
                {
                    int.TryParse(ord, out tf.ng);
                }

                ord = FindValue(scTransf, "connection");
                if (ord != "")
                {
                    tf.connection = ord;
                }
                return(tf);
            }
            return(null);
        }
        public void OnMouseUp(MouseEventArgs e)
        {
            if ((this.activeGraph == null) || (this.mouseAreaControl.Cursor == this.mouseAreaControl.DefaultCursor))
            {
                return;
            }
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            if (!(this.mouseAreaControl.SVGDocument.CurrentElement is ITransformBrush))
            {
                return;
            }
            ISvgBrush brush1 = (ISvgBrush)this.mouseAreaControl.SVGDocument.CurrentElement;

            if (brush1 is SolidColor)
            {
                return;
            }
            SizeF ef1     = this.mouseAreaControl.PicturePanel.GridSize;
            float single1 = ef1.Width;
            float single2 = ef1.Height;

            this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle);
            this.win32.W32SetROP2(6);
            this.win32.W32PolyDraw(this.reversePath);
            this.win32.ReleaseDC();
            float  single3 = this.mouseAreaControl.PicturePanel.ScaleUnit;
            PointF tf1     = this.mouseAreaControl.PicturePanel.PointToView(this.startPoint);
            PointF tf2     = this.mouseAreaControl.PicturePanel.PointToView(new PointF((float)e.X, (float)e.Y));

            if (this.mouseAreaControl.PicturePanel.SnapToGrid)
            {
                int num1 = (int)((tf1.X + (single1 / 2f)) / single1);
                int num2 = (int)((tf1.Y + (single2 / 2f)) / single2);
                tf1  = (PointF) new Point((int)(num1 * single1), (int)(num2 * single2));
                num1 = (int)((tf2.X + (single1 / 2f)) / single1);
                num2 = (int)((tf2.Y + (single2 / 2f)) / single2);
                tf2  = (PointF) new Point((int)(num1 * single1), (int)(single2 * num2));
            }
            tf1            = this.mouseAreaControl.PicturePanel.PointToSystem(tf1);
            tf2            = this.mouseAreaControl.PicturePanel.PointToSystem(tf2);
            this.win32.hdc = this.win32.W32GetDC(this.mouseAreaControl.Handle);
            this.win32.W32SetROP2(6);
            this.win32.W32PolyDraw(this.reversePath);
            this.win32.ReleaseDC();
            Transf transf1 = new Transf();

            transf1 = ((ITransformBrush)brush1).Transform;
            SvgElement      element1  = (SvgElement)brush1;
            ITransformBrush brush2    = (ITransformBrush)brush1;
            bool            flag1     = brush2.Units == Units.UserSpaceOnUse;
            SvgDocument     document1 = this.mouseAreaControl.SVGDocument;

            if (((((this.mouseAreaControl.Cursor == SpecialCursors.VScaleCursor) | (this.mouseAreaControl.Cursor == SpecialCursors.HScaleCursor)) | (this.mouseAreaControl.Cursor == SpecialCursors.TopRightScaleCursor)) | (this.mouseAreaControl.Cursor == SpecialCursors.EqualScaleCursor)) && (this.controlPoints.Length >= 6))
            {
                //string text11;
                PointF[] tfArray5 = new PointF[5] {
                    tf1, tf2, this.controlPoints[0], this.controlPoints[1], this.controlPoints[5]
                };
                PointF[] tfArray1 = tfArray5;
                Matrix   matrix1  = this.graphMatrix.Clone();
                matrix1.Multiply(this.gradientMatrix);
                matrix1.Invert();
                matrix1.TransformPoints(tfArray1);
                float single4 = 1f;
                if (tfArray1[3].X != tfArray1[2].X)
                {
                    single4 = 1f + ((tfArray1[1].X - tfArray1[0].X) / (tfArray1[3].X - tfArray1[2].X));
                }
                float single5 = 1f;
                if (tfArray1[4].Y != tfArray1[2].Y)
                {
                    single5 = 1f + ((tfArray1[1].Y - tfArray1[0].Y) / (tfArray1[4].Y - tfArray1[2].Y));
                }
                if (this.mouseAreaControl.Cursor == SpecialCursors.VScaleCursor)
                {
                    single5 = 1f;
                }
                else if (this.mouseAreaControl.Cursor == SpecialCursors.HScaleCursor)
                {
                    single4 = 1f;
                }
                else if (this.mouseAreaControl.Cursor == SpecialCursors.EqualScaleCursor)
                {
                    single5 = single4;
                }
                if ((element1.InfoList.Count == 1))
                {
                    if (flag1)
                    {
                        transf1.setTranslate(this.centerPoint.X, this.centerPoint.Y);
                    }
                    else
                    {
                        transf1.setTranslate(0.5f, 0.5f);
                    }
                    transf1.setScale(single4, single5);
                    if (flag1)
                    {
                        transf1.setTranslate(-this.centerPoint.X, -this.centerPoint.Y);
                    }
                    else
                    {
                        transf1.setTranslate(-0.5f, -0.5f);
                    }
                    string text1 = transf1.ToString();
                    string text2 = "gradientTransform";
                    if (brush2 is Pattern)
                    {
                        text2 = "patternTransform";
                    }
                    bool flag2 = document1.AcceptChanges;
                    document1.AcceptChanges          = true;
                    document1.NumberOfUndoOperations = 1;
                    AttributeFunc.SetAttributeValue(element1, text2, text1);
                    document1.AcceptChanges = flag2;
                    element1.pretime        = -1;
                    goto Label_1771;
                }
            }
            if ((this.mouseAreaControl.Cursor == SpecialCursors.SkewXCursor) || (this.mouseAreaControl.Cursor == SpecialCursors.SkewYCursor))
            {
                //string text16;
                PointF[] tfArray6 = new PointF[5] {
                    tf1, tf2, this.controlPoints[0], this.controlPoints[3], this.controlPoints[4]
                };
                PointF[] tfArray2 = tfArray6;
                Matrix   matrix2  = this.graphMatrix.Clone();
                matrix2.Multiply(this.gradientMatrix);
                matrix2.Invert();
                matrix2.TransformPoints(tfArray2);
                float single6 = 0f;
                if (tfArray2[3].Y != tfArray2[2].Y)
                {
                    single6 = ((tfArray2[1].X - tfArray2[0].X) / (tfArray2[3].Y - tfArray2[2].Y)) * 0.5f;
                }
                float single7 = 0f;
                if (tfArray2[4].X != tfArray2[2].X)
                {
                    single7 = ((tfArray2[1].Y - tfArray2[0].Y) / (tfArray2[4].X - tfArray2[2].X)) * 0.5f;
                }
                if (this.mouseAreaControl.Cursor == SpecialCursors.SkewXCursor)
                {
                    single7 = 0f;
                }
                else if (this.mouseAreaControl.Cursor == SpecialCursors.SkewYCursor)
                {
                    single6 = 0f;
                }
                if ((element1.InfoList.Count == 1))
                {
                    if (flag1)
                    {
                        transf1.setTranslate(this.centerPoint.X, this.centerPoint.Y);
                    }
                    else
                    {
                        transf1.setTranslate(0.5f, 0.5f);
                    }
                    transf1.Matrix.Shear(single6, single7);
                    if (flag1)
                    {
                        transf1.setTranslate(-this.centerPoint.X, -this.centerPoint.Y);
                    }
                    else
                    {
                        transf1.setTranslate(-0.5f, -0.5f);
                    }
                    string text3 = transf1.ToString();
                    string text4 = "gradientTransform";
                    if (brush2 is Pattern)
                    {
                        text4 = "patternTransform";
                    }
                    bool flag4 = document1.AcceptChanges;
                    document1.AcceptChanges          = true;
                    document1.NumberOfUndoOperations = 1;
                    AttributeFunc.SetAttributeValue(element1, text4, text3);
                    document1.AcceptChanges = flag4;
                    element1.pretime        = -1;
                    goto Label_1771;
                }
            }
            if (this.mouseAreaControl.Cursor == SpecialCursors.RotateCursor)
            {
                //string text19;
                PointF tf3      = this.controlPoints[0];
                float  single8  = (float)Math.Atan((double)((tf1.Y - tf3.Y) / (tf1.X - tf3.X)));
                float  single9  = (float)Math.Atan((double)((tf2.Y - tf3.Y) / (tf2.X - tf3.X)));
                float  single10 = ((float)(((double)(single9 - single8)) / 3.1415926535897931)) * 180f;
                if (((tf2.X - tf3.X) * (tf1.X - tf3.X)) < 0f)
                {
                    single10 += 180f;
                }
                if (single10 < 0f)
                {
                    single10 += 360f;
                }
                PointF[] tfArray7 = new PointF[1] {
                    new PointF(0.5f, 0.5f)
                };
                PointF[] tfArray3 = tfArray7;
                if (flag1)
                {
                    PointF[] tfArray8 = new PointF[1] {
                        this.centerPoint
                    };
                    tfArray3 = tfArray8;
                }
                this.gradientMatrix.TransformPoints(tfArray3);
                if ((element1.InfoList.Count == 1))
                {
                    transf1.Matrix.RotateAt(single10, tfArray3[0], MatrixOrder.Append);
                    string text5 = transf1.ToString();
                    string text6 = "gradientTransform";
                    if (brush2 is Pattern)
                    {
                        text6 = "patternTransform";
                    }
                    bool flag6 = document1.AcceptChanges;
                    document1.AcceptChanges = true;
                    AttributeFunc.SetAttributeValue(element1, text6, text5);
                    document1.AcceptChanges = flag6;
                    element1.pretime        = -1;
                    goto Label_1771;
                }
            }
            else if (this.mouseAreaControl.Cursor == SpecialCursors.GradientTranslateCursor)
            {
                PointF[] tfArray9 = new PointF[5] {
                    tf1, tf2, this.controlPoints[0], this.controlPoints[1], this.controlPoints[4]
                };
                PointF[] tfArray4 = tfArray9;
                Matrix   matrix3  = this.graphMatrix.Clone();
                matrix3.Multiply(this.gradientMatrix);
                matrix3.Invert();
                matrix3.TransformPoints(tfArray4);
                float single11 = tfArray4[1].X - tfArray4[0].X;
                if (!flag1)
                {
                    single11 /= (tfArray4[3].X - tfArray4[2].X);
                }
                else
                {
                    single11 *= 2f;
                }
                float single12 = tfArray4[1].Y - tfArray4[0].Y;
                if (!flag1)
                {
                    single12 /= (tfArray4[4].Y - tfArray4[2].Y);
                }
                else
                {
                    single12 *= 2f;
                }
                single11 /= 2f;
                single12 /= 2f;
                if (element1.InfoList.Count == 1)
                {
                    transf1.setTranslate(single11, single12);
                    string text7 = transf1.ToString();
                    string text8 = "gradientTransform";
                    if (brush2 is Pattern)
                    {
                        text8 = "patternTransform";
                    }
                    bool flag7 = document1.AcceptChanges;
                    document1.AcceptChanges = true;
                    AttributeFunc.SetAttributeValue(element1, text8, text7);
                    document1.AcceptChanges = flag7;
                    element1.pretime        = -1;
                }
            }
Label_1771:
            this.mouseAreaControl.Invalidate();
        }
Exemple #9
0
        public SvgElement AddElement(ISvgElement mypath)
        {
//			AttributeFunc.SetAttributeValue((XmlElement)mypath,"layer",SvgDocument.currentLayer);
            XmlNode node1   = OwnerDocument.RootElement;
            XmlNode newNode = null;

            Matrix matrix1 = new Matrix();
//				if (node1 is IGraph)
//				{
//					matrix1 = ((IGraph) node1).GraphTransform.Matrix.Clone();
//					Matrix matrix2 = this.coordTransform.Clone();
//					matrix2.Invert();
//					matrix1.Multiply(matrix2, MatrixOrder.Append);
//				}
//				matrix1.Invert();
//				matrix1 = TransformFunc.RoundMatrix(matrix1, 2);
            bool flag1 = OwnerDocument.AcceptChanges;

            //				OwnerDocument.AcceptChanges = false;
            OwnerDocument.AcceptChanges = true;
            if (mypath is IGraphPath)
            {
                ISvgBrush brush1 = ((IGraphPath)mypath).GraphBrush;
                if ((brush1 is ITransformBrush) && (((SvgElement)brush1).ParentNode == null))
                {
                    bool flag2 = OwnerDocument.AcceptChanges;
                    OwnerDocument.AcceptChanges = true;
                    OwnerDocument.NumberOfUndoOperations++;
                    XmlNode node2 = OwnerDocument.AddDefsElement((SvgElement)brush1);
                    OwnerDocument.AcceptChanges = false;
                    if (node2 is ITransformBrush)
                    {
                        string text1 = ((SvgElement)node2).ID;
                        AttributeFunc.SetAttributeValue((SvgElement)mypath, "fill", "url(#" + text1 + ")");
                    }
                    OwnerDocument.AcceptChanges = flag2;
                }
                brush1 = ((IGraphPath)mypath).GraphStroke.Brush;
                if ((brush1 is ITransformBrush) && (((SvgElement)brush1).ParentNode == null))
                {
                    bool flag3 = OwnerDocument.AcceptChanges;
                    OwnerDocument.AcceptChanges = true;
                    OwnerDocument.NumberOfUndoOperations++;
                    XmlNode node3 = OwnerDocument.AddDefsElement((SvgElement)brush1);
                    OwnerDocument.AcceptChanges = false;
                    if (node3 is ITransformBrush)
                    {
                        string text2 = ((SvgElement)node3).ID;
                        AttributeFunc.SetAttributeValue((SvgElement)mypath, "stroke", "url(#" + text2 + ")");
                    }
                    OwnerDocument.AcceptChanges = flag3;
                }
            }
            if (!matrix1.IsIdentity && (mypath is IGraph))
            {
                bool flag4 = OwnerDocument.AcceptChanges;
                OwnerDocument.AcceptChanges = false;
                Matrix matrix3 = ((IGraph)mypath).Transform.Matrix.Clone();
                matrix1.Multiply(matrix3);
                Transf transf1 = new Transf();
                transf1.setMatrix(matrix1);
                AttributeFunc.SetAttributeValue((SvgElement)mypath, "transform", transf1.ToString());
                OwnerDocument.AcceptChanges = flag4;
            }
            if (((SvgElement)mypath).ParentNode != node1)
            {
                if (((ContainerElement)node1).IsValidChild((SvgElement)mypath))
                {
                    //						node1.AppendChild((SvgElement) mypath);
                    SvgElement element1 = (SvgElement)mypath;                            //(SvgElement)OwnerDocument.ImportNode((SvgElement) mypath,true);
                    newNode = node1.AppendChild(element1);
                    OwnerDocument.Render(element1);
                }
            }
            OwnerDocument.AcceptChanges = flag1;

            return(newNode != null?newNode as SvgElement:null);
        }