Exemple #1
0
        public int GetPageCount(string hitstr)
        {
            int hitCount;

            hitCount = GetHitCount(hitstr);
            return(VB.fix((hitCount - 1) / hitsPerPage) + 1);
        }
        private User Findme()
        {
            User Item = new User();

            if (UserClassListUserID.ContainsKey(Environment.UserName.ToUpper()))
            {
                Item = UserClassListUserID[Environment.UserName.ToUpper()];
                if (Item.STA)
                {
                    Config.Visibility = Visibility.Visible;
                }
                else
                {
                    Config.Visibility = Visibility.Hidden;
                }
                if (Item.Name != VB.WHO())
                {
                    Data.sendin(new List <string>()
                    {
                        VB.WHO()
                    }, "Update Users Set [AdviserName] = @1 where [ID] = " + Item.ID);
                }
            }
            else
            {
                MessageBox.Show("You are not in the system");
            }
            return(Item);
        }
Exemple #3
0
 public static string EscapeVBKeyword(string argumentName)
 {
     if (VB.Contains(argumentName.ToLower()))
     {
         return($"[{argumentName}]");
     }
     return(argumentName);
 }
 private void UpdateGridSize(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
 {
     GoLV.GridHeight = SizeValue;
     GoLV.GridWidth  = 2 * SizeValue;
     GoLV.UpdateDimensions();
     VB.UpdateLayout();
     SizeLabel.Content = String.Format("Size: {0}x{1}", GoLV.GridWidth, GoLV.GridHeight);
 }
Exemple #5
0
 public void Dispose()
 {
     if (!Disposed)
     {
         VB.Dispose();
         IB.Dispose();
         m_Disposed = true;
     }
 }
Exemple #6
0
    void ModuleUpdatePerpendicular()
    {
        HLine    HLN1 = VA.GetComponent <HLine>(); //対象となる直線1
        HLine    HLN2 = VB.GetComponent <HLine>(); //対象となる直線2
        HypLine  HL1  = HLN1.HL;
        HypLine  HL2  = HLN2.HL;
        Vertex   V11  = HLN1.VA.GetComponent <Vertex>();
        Vertex   V12  = HLN1.VB.GetComponent <Vertex>();
        Vertex   V21  = HLN2.VA.GetComponent <Vertex>();
        Vertex   V22  = HLN2.VB.GetComponent <Vertex>();
        HypPoint P11  = new HypPoint(V11.XY);
        HypPoint P12  = new HypPoint(V12.XY);
        HypPoint P21  = new HypPoint(V21.XY);
        HypPoint P22  = new HypPoint(V22.XY);

        HypPoint C = HTransform.GetCrossingPointOfTwoHLines2(HL1, HL2);

        if (C != new HypPoint(1f, 1f, 0f))
        {
            //float angle = HTransform.GetAngleOfTwoLines(HL1, HL2, C);
            float angle = HTransform.GetAngleOfTwoLines(P11, P12, P21, P22, C);
            //Debug.Log("angle="+angle);
            float error = (Mathf.PI / 2f - angle) * 0.25f;
            if (angle < 0f)
            {
                error = (-Mathf.PI / 2f - angle) * 0.25f;
            }
            HypPoint P1m  = HTransform.GetMidPointOfTwoPoint(P11, P12);
            HypPoint P11T = HTransform.GetRotationOfPoint(P1m, -error, P11);
            HypPoint P12T = HTransform.GetRotationOfPoint(P1m, -error, P12);
            //HypLine L1T = HTransform.GetHLineThruTwoPoints(P11T, P12T);
            HypPoint P2m  = HTransform.GetMidPointOfTwoPoint(P21, P22);
            HypPoint P21T = HTransform.GetRotationOfPoint(P2m, error, P21);
            HypPoint P22T = HTransform.GetRotationOfPoint(P2m, error, P22);
            //HypLine L2T = HTransform.GetHLineThruTwoPoints(P21T, P22T);
            if (!V11.Fixed && P11T.InWorld())
            {
                V11.XY.x = P11T.GetX();
                V11.XY.y = P11T.GetY();
            }
            if (!V12.Fixed && P12T.InWorld())
            {
                V12.XY.x = P12T.GetX();
                V12.XY.y = P12T.GetY();
            }
            if (!V21.Fixed && P21T.InWorld())
            {
                V21.XY.x = P21T.GetX();
                V21.XY.y = P21T.GetY();
            }
            if (!V22.Fixed && P22T.InWorld())
            {
                V22.XY.x = P22T.GetX();
                V22.XY.y = P22T.GetY();
            }
        }
    }
Exemple #7
0
        /// <summary>
        /// Gets the correct BaseFile class by comparing the file with the known header signatures.
        /// </summary>
        /// <param name="filePath">Filepath</param>
        /// <returns></returns>
        public static BaseFile GetTypeFromFile(string filePath)
        {
            byte[] buffer;
            using (BinaryReader reader = new BinaryReader(new FileStream(filePath, FileMode.Open)))
            {
                if (reader.BaseStream.Length < 256)
                {
                    buffer = new byte[reader.BaseStream.Length];
                    reader.Read(buffer, 0, buffer.Length);
                }
                else
                {
                    buffer = new byte[256];
                    reader.Read(buffer, 0, 256);
                }
            }

            if (BG.Compare(buffer))
            {
                return(new BGFile(filePath));
            }
            if (LZB.Compare(buffer))
            {
                return(new LZBFile(filePath));
            }
            if (PACK.Compare(buffer))
            {
                return(new PBFile(filePath));
            }
            if (SEQ.Compare(buffer))
            {
                return(new SEQFile(filePath));
            }
            if (STR.Compare(filePath))
            {
                return(new STRFile(filePath));
            }
            if (TIM.Compare(buffer))
            {
                return(new TIMFile(filePath));
            }
            if (VB.Compare(buffer))
            {
                return(new VBFile(filePath));
            }
            if (VH.Compare(buffer))
            {
                return(new VHFile(filePath));
            }
            if (XA.Compare(filePath))
            {
                return(new XAFile(filePath));
            }
            return(new BaseFile(filePath));
        }
Exemple #8
0
        public string BuildAreaHitString(int searchAreaID, string sql, string[] keywords, string originalKeywords, int sortPosition)
        {
            //' returns hit string for a given search area
            string    hitstr;
            DataBlock rs;
            int       id;
            double    score;
            string    scorestr;
            int       maxFieldNum = 0;
            string    title;
            DateTime  itemDate;
            string    fulltext;

            hitstr = "";
            //'Response.Write("<font color=""red"" size=""1"" face=""sans-serif"">DEBUG: sql["& sql &"] </font><br><!-- -->"+VB.crlf)
            rs = db.execute(sql);
            if (!rs.eof())
            {
                maxFieldNum = rs.NumberOfColumns - 1;
            }

            if (rs.NumberOfColumns < 0)
            {
                Logging.eout("search: no columns");
            }
            while (!rs.eof())
            {
                id       = rs.GetValueInt(0);
                title    = rs.GetValue(1);
                itemDate = rs.GetValueDate(2);
                fulltext = "";
                for (int fieldNum = 3; fieldNum <= maxFieldNum; fieldNum++)
                {
                    fulltext = fulltext + rs.GetValue(fieldNum) + VB.crlf + VB.crlf;
                }
                score = CalculateScore(title, fulltext, itemDate, keywords, originalKeywords);
                if (score > 0)
                {
                    score = score + sortPosition;
                }
                scorestr = VB.right("00" + score, 3) + ":" + id + ":" + searchAreaID;                 //		 ' leading zeros to allow alphabetical sort

                //' append to results string
                if (score > 0)
                {
                    hitstr = hitstr + scorestr + " ";
                }

                rs.movenext();
            }            //loop
            //rs.close
            //set rs = nothing
            return(hitstr);
        }
Exemple #9
0
    //string MyDebug_Backup="";
    void ModuleUpdatePointToLine2()
    {
        Vertex VTX = VA.GetComponent <Vertex>(); //対象となる点
        HLine  HLN = VB.GetComponent <HLine>();  //対象となる直線

        if (VTX != null && HLN != null)
        {
            HypLine  L1    = HLN.HL;
            HypPoint P1    = new HypPoint(VTX.XY);
            HypLine  L2    = HTransform.GetHPerpendicularThruAPoint(L1, P1);
            HypPoint P2    = HTransform.GetCrossingPointOfTwoHLines(L1, L2);
            float    error = HTransform.GetHDistanceOfTwoPoints(P1, P2) * 0.2f;
            //Debug.Log(error);
            if (0.001f < error || error < -0.001f)
            {
                //string MyDebug = "";
                HypPoint P3 = HTransform.GetHMoveAlongTwoPoints(P2, P1, error);
                HypPoint P4 = HTransform.GetHMoveAlongTwoPoints(P1, P2, error);
                ////点を直線に寄せる
                if (!VTX.Fixed && P4.InWorld())
                {
                    //MyDebug += "P4:" + P4.GetX() + "," + P4.GetY();
                    VTX.XY.x = P4.GetX();
                    VTX.XY.y = P4.GetY();
                }
                //直線を円に寄せる
                Vertex   L1V1   = HLN.VA.GetComponent <Vertex>(); //動かすべき点1
                Vertex   L1V2   = HLN.VB.GetComponent <Vertex>(); //動かすべき点2
                HypPoint PL1    = new HypPoint(L1V1.XY);
                HypPoint PL2    = new HypPoint(L1V2.XY);
                HypPoint NewPL1 = HTransform.ParallelTransform(P2, P3, PL1);
                HypPoint NewPL2 = HTransform.ParallelTransform(P2, P3, PL2);
                //NewPL1.println("NewPL1");
                if (!L1V1.Fixed && NewPL1.InWorld())
                {
                    //MyDebug += "L1:" + NewPL1.GetX() + "," + NewPL1.GetY();
                    L1V1.XY.x = NewPL1.GetX();
                    L1V1.XY.y = NewPL1.GetY();
                }
                if (!L1V2.Fixed && NewPL2.InWorld())
                {
                    //MyDebug += "L2:" + NewPL2.GetX() + "," + NewPL2.GetY();
                    L1V2.XY.x = NewPL2.GetX();
                    L1V2.XY.y = NewPL2.GetY();
                }
                HLN.GetHLineFromTwoVertices();
                //if (MyDebug != MyDebug_Backup)
                //{
                //    Debug.Log(MyDebug);
                //    MyDebug_Backup = MyDebug;
                //}
            }
        }
    }
Exemple #10
0
        private string WriteHierarchyOptions(
            string tablename,
            string primaryKeyColName,
            string displayTextColName,
            string parentcolname,
            string SortColName,
            int parentID,
            int level,
            string fieldName,
            string fieldValue
            )
        {
            DataBlock rs;
            string    sql, optionValue, description, result = "";

            sql = "select * from " + tablename + "";
            if (parentID != 0)
            {
                sql = sql + " where " + parentcolname + "=" + parentID;
            }
            else
            {
                sql = sql + " where " + parentcolname + " is null or " + parentcolname + "=0";
            }

            sql = sql + " order by " + SortColName;

            rs = (new DataBlock(BewebData.GetConnectionString())).execute(sql);
            while (!rs.eof())
            {
                optionValue = rs[primaryKeyColName];
                description = rs[displayTextColName];

                for (int i = 1; i < level; i++)
                {
                    description = "" + VB.chr(183) + VB.chr(183) + description;
                }

                result += "<option ";
                if (fieldValue + "" == "" + optionValue && optionValue + "" != "0")
                {
                    result += "selected ";
                }
                result += "value=\"" + optionValue + "\">" + description + "</option>";

                result += WriteHierarchyOptions(tablename, primaryKeyColName, displayTextColName, parentcolname, SortColName, rs.GetValueInt(0), level + 1, fieldName, fieldValue);
                rs.movenext();
            }
            rs.close();
            return(result);
        }
Exemple #11
0
        private string WriteHitsPage(int pagenum, string hitstr)
        {
            //' display a page of the list of search hits
            //' note that hitNum is zero-based, but pageNum is one-based (ie first page is 1)
            string scorestr, result = "";
            double score;

            string[] hits;
            int      fromHitNum, pos, toHitNum, hitNum, id, source;

            if (pagenum == 0)
            {
                pagenum = 1;
                //throw new Exception("WriteHitsPage: pagenum cannot be zero");
            }

            fromHitNum = (pagenum - 1) * hitsPerPage;
            toHitNum   = fromHitNum + hitsPerPage;
            if (hitstr != "")
            {
                hits         = hitstr.Split(new Char[] { ' ' });
                NumberOfHits = hits.Length;                  // corrected this, was -1
                if (toHitNum > hits.Length)
                {
                    toHitNum = VB.ubound(hits);
                }

                for (int i = fromHitNum; i < toHitNum; i++)
                {
                    scorestr = hits[i];
                    score    = VB.cint(VB.left(scorestr, 3));
                    string idtext = VB.mid(scorestr, 5);
                    pos = VB.instr(idtext, ":");
                    if (pos > 0)
                    {
                        //id = Convert.ToInt32(idtext);
                        source = VB.cint(VB.mid(idtext, pos + 1));
                        if (source == 0)
                        {
                            throw new Exception("Failed to get source from idtext[" + idtext + "], scorestr[" + scorestr + "]");
                        }
                        idtext  = VB.left(idtext, pos - 1);
                        id      = VB.cint(idtext);
                        hitNum  = i + 1;
                        result += WriteHit(id, source, hitNum, score);
                    }
                }
            }
            return(result);
        }
Exemple #12
0
    void ModuleUpdateTangentCircleToLine()
    {
        HCircle hcircle = VA.GetComponent <HCircle>(); //対象となる円
        HLine   hline   = VB.GetComponent <HLine>();   //対象となる直線

        if (hcircle != null && hline != null)
        {
            HypCircle C1 = hcircle.GetHCR();
            HypLine   L1 = hline.GetHL();
            HypPoint  P1 = new HypPoint(hcircle.VA.GetComponent <Vertex>().XY);
            HypLine   L2 = HTransform.GetHPerpendicularThruAPoint(L1, P1);
            HypPoint  P2 = HTransform.GetCrossingPointOfTwoHLines(L1, L2);
            //P2.println("P2");
            float error = (HTransform.GetHDistanceOfTwoPoints(P1, P2) - C1.HR) * 0.1f;
            //Debug.Log(error);
            if (0.001f < error || error < -0.001f)
            {
                HypPoint P3 = HTransform.GetHMoveAlongTwoPoints(P2, P1, error);
                HypPoint P4 = HTransform.GetHMoveAlongTwoPoints(P1, P2, error);
                //円の半径を変える
                C1.HR += error;
                ////円を直線に寄せる
                Vertex C1V = hcircle.VA.GetComponent <Vertex>();
                if (!C1V.Fixed && P4.InWorld())
                {
                    C1V.XY.x = P4.GetX();
                    C1V.XY.y = P4.GetY();
                }
                //直線を円に寄せる
                Vertex   L1V1   = hline.VA.GetComponent <Vertex>(); //動かすべき点1
                Vertex   L1V2   = hline.VB.GetComponent <Vertex>(); //動かすべき点2
                HypPoint PL1    = new HypPoint(L1V1.XY);
                HypPoint PL2    = new HypPoint(L1V2.XY);
                HypPoint NewPL1 = HTransform.ParallelTransform(P2, P3, PL1);
                HypPoint NewPL2 = HTransform.ParallelTransform(P2, P3, PL2);
                //NewPL1.println("NewPL1");
                if (!L1V1.Fixed && NewPL1.InWorld())
                {
                    L1V1.XY.x = NewPL1.GetX();
                    L1V1.XY.y = NewPL1.GetY();
                }
                if (!L1V2.Fixed && NewPL2.InWorld())
                {
                    L1V2.XY.x = NewPL2.GetX();
                    L1V2.XY.y = NewPL2.GetY();
                }
                hline.GetHLineFromTwoVertices();
            }
        }
    }
        LynxPhotoViewControl selectedImage;//当前选择的

        private void buttonClose_Click(object sender, RoutedEventArgs e)
        {
            bl = null;
            //photoTestToolbar1 = null;
            ImageBrightCurve.Children.Clear();
            VB.Clear();
            HB.Clear();
            Panel p = this.Parent as Panel;

            if (p != null)
            {
                p.Children.Remove(this);
            }
        }
Exemple #14
0
 public void AddPhoto(WriteableBitmap photo)
 {
     if (selectedImage == null)
     {
         return;
     }
     if (selectedImage == HB)
     {
         HB.setPhoto(photo);
         bl[1] = photo;
     }
     if (selectedImage == VB)
     {
         VB.setPhoto(photo);
         bl[2] = photo;
     }
 }
Exemple #15
0
        public bool ContainsKeyword(string text, string keyword)
        {
            bool result = false;

            //' note: case behaviour is based on Altavista with slight modification:
            //' When you use lowercase text, the search service finds uppercase, lowercase and mixed case results.
            //' When you use mixed case text, it finds mixed case and uppercase results.
            //' When you use uppercase it finds only uppercase.
            //' Example: When you search for california, you'll find California, california, and CALIFORNIA in your results pages. However, when you search for California, you'll only see California and CALIFORNIA in the results pages.
            if (keyword == keyword.ToLower())
            {
                //' lower case keyword searches for any case
                result = VB.instr(VB.lcase(text), keyword) > 0;
            }
            else
            {
                //' keyword containing uppercase letters searches for exact case OR all caps
                result = VB.instr(text, keyword) > 0;
                if (!result)
                {
                    result = VB.instr(text, VB.ucase(keyword)) > 0;
                }
            }

            //' if the keyword ends in S, check the root word for a hit (eg text may contain "shaver" but you searched for "shavers")
            if (!result && VB.lcase(VB.right(keyword, 1)) == "s")
            {
                keyword = VB.left(keyword, VB.len(keyword) - 1);
                if (keyword == VB.lcase(keyword))
                {
                    //' lower case keyword searches for any case
                    result = VB.instr(VB.lcase(text), keyword) > 0;
                }
                else
                {
                    //' keyword containing uppercase letters searches for exact case
                    result = VB.instr(text, keyword) > 0;
                    if (!result)
                    {
                        result = VB.instr(text, VB.ucase(keyword)) > 0;
                    }
                }
            }
            return(result);
        }
Exemple #16
0
        public void CalculateMissingLLVoltageChannels()
        {
            Meter      meter;
            DataSeries missingSeries;

            // If all line voltages are already present or there are not
            // atleast 2 lines we will not perform line to line calculations
            if (DefinedLineVoltages == 3 || DefinedNeutralVoltages < 2)
            {
                return;
            }

            // Get the meter associated with the channels in this data group
            meter = (VA ?? VB ?? VC).SeriesInfo.Channel.Meter;

            if (m_vabIndex == -1 && VA != null && VB != null)
            {
                // Calculate VAB = VA - VB
                missingSeries            = VA.Add(VB.Negate());
                missingSeries.SeriesInfo = GetSeriesInfo(meter, m_dataGroup, "Voltage", "AB");
                missingSeries.Calculated = true;
                m_vabIndex = m_dataGroup.DataSeries.Count;
                m_dataGroup.Add(missingSeries);
            }

            if (m_vbcIndex == -1 && VB != null && VC != null)
            {
                // Calculate VBC = VB - VC
                missingSeries            = VB.Add(VC.Negate());
                missingSeries.SeriesInfo = GetSeriesInfo(meter, m_dataGroup, "Voltage", "BC");
                missingSeries.Calculated = true;
                m_vbcIndex = m_dataGroup.DataSeries.Count;
                m_dataGroup.Add(missingSeries);
            }

            if (m_vcaIndex == -1 && VC != null && VA != null)
            {
                // Calculate VCA = VC - VA
                missingSeries            = VC.Add(VA.Negate());
                missingSeries.SeriesInfo = GetSeriesInfo(meter, m_dataGroup, "Voltage", "CA");
                missingSeries.Calculated = true;
                m_vcaIndex = m_dataGroup.DataSeries.Count;
                m_dataGroup.Add(missingSeries);
            }
        }
Exemple #17
0
        /// <summary>
        /// Write a checkbox and hidden to handle processing of the checkbox
        /// </summary>
        /// <param name="fieldName"></param>
        /// <param name="initialValue"></param>
        /// <param name="label"></param>
        /// <returns></returns>
        public static string WriteCheckBox(string fieldName, string initialValue, string label)
        {
            string result = "";

            int    actualValue;
            string source = "" +
                            "<script language=\"JavaScript\">" +
                            "function CheckBoxClick" + checkBoxCounter + "(cb) " +
                            "{" +
                            "	var hfld = document.form["+ fieldName + "];" +
                            "	if (cb.checked)"+
                            "	{"+
                            "		hfld.value = \"1\";"+
                            "	} else"+
                            "	{"+
                            "		hfld.value = \"0\";"+
                            "	}"+
                            "}" +
                            "</script>" +
                            "" +
                            "";

            result += source;

            if (VB.cbool(initialValue) || VB.IsNull(initialValue))
            {
                actualValue = 0;
            }
            else
            {
                actualValue = 1;
            }

            result += "<input type=hidden name='" + fieldName + "' value=" + actualValue + ">" + VB.crlf;
            result += "<input type=checkbox name='chbox_" + fieldName + "' id='chbox_" + fieldName + "'";
            if (actualValue == 1)
            {
                result += " checked";
            }
            result += " onclick='CheckBoxClick" + checkBoxCounter + "(this)'>";
            result += "<label for='chbox_" + fieldName + "'>" + label + "</label>";
            checkBoxCounter++;
            return(result);
        }
Exemple #18
0
    public void GetHLineFromTwoVertices()
    {
        Vertex   PVA = VA.GetComponent <Vertex>();
        HypPoint P1  = new HypPoint(PVA.XY);
        Vertex   PVB = VB.GetComponent <Vertex>();
        HypPoint P2  = new HypPoint(PVB.XY);

        HL = HTransform.GetHLineThruTwoPoints(P1, P2);
        if (Clipped)
        {
            DrawClippedLine();
        }
        else
        {
            DrawAllLine();
        }
        LineRendererSetPosition();
        //print(HTransform.GetHDistanceOfTwoPoints(x1,y1,x2,y2));
    }
Exemple #19
0
        public void RemovePhoto(WriteableBitmap b)
        {
            if (selectedImage == null)
            {
                return;
            }
            int i = bl.IndexOf(b);

            if (i == 1)
            {
                bl.RemoveAt(1);
                HB.setPhoto(null);
            }
            if (i == 2)
            {
                bl.RemoveAt(2);
                VB.setPhoto(null);
            }
        }
Exemple #20
0
        public void Test(List <WriteableBitmap> b)
        {
            if (b.Count == 0 || b == null)
            {
                return;
            }
            bl = b;
            try
            {
                HB.setPhoto(b[1]);
                VB.setPhoto(b[2]);
                xt = new XMarkChart();
                decimal d = xt.getBrightChanges(b[0]);//原始
                textBoxBrightChanges.Text = d.ToString();
                textBoxBB.Text            = xt.ProcessInfor["BrightChanges_BorderBright"].ToString();
                textBoxCB.Text            = xt.ProcessInfor["BrightChanges_CBright"].ToString();
                LT.Text = xt.ProcessInfor["BrightChanges_LT"].ToString();
                LB.Text = xt.ProcessInfor["BrightChanges_LB"].ToString();
                RT.Text = xt.ProcessInfor["BrightChanges_RT"].ToString();
                RB.Text = xt.ProcessInfor["BrightChanges_RB"].ToString();

                List <int> hl, vl;
                DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
                hl           = pt.getImageGrayHLine(b[1], b[1].PixelHeight / 2);
                vl           = pt.getImageGrayVLine(b[2], b[2].PixelWidth / 2);
                dg.ForeColor = Colors.Blue;
                dg.DrawBrightLines(hl);
                dg.ForeColor = Colors.Red;
                dg.DrawBrightLines(vl);
            }
            catch (Exception xe)        //未知的异常
            {
                if (xe is LFCException) //已经是系统约定的错误类型,直接往上抛
                {
                    SilverlightLFC.common.Environment.ShowMessage(xe.Message);
                }
                else
                {
                    SilverlightLFC.common.Environment.ShowMessage("测试错误,请检查照片");
                }
            }
        }
Exemple #21
0
    void ModuleUpdateIsometry()
    {
        HLine    HLN1   = VA.GetComponent <HLine>(); //対象となる直線1
        HLine    HLN2   = VB.GetComponent <HLine>(); //対象となる直線2
        Vertex   V11    = HLN1.VA.GetComponent <Vertex>();
        Vertex   V12    = HLN1.VB.GetComponent <Vertex>();
        Vertex   V21    = HLN2.VA.GetComponent <Vertex>();
        Vertex   V22    = HLN2.VB.GetComponent <Vertex>();
        HypPoint P11    = new HypPoint(V11.XY);
        HypPoint P12    = new HypPoint(V12.XY);
        HypPoint P21    = new HypPoint(V21.XY);
        HypPoint P22    = new HypPoint(V22.XY);
        float    Dist1  = HTransform.GetHDistanceOfTwoPoints(P11, P12);
        float    Dist2  = HTransform.GetHDistanceOfTwoPoints(P21, P22);
        float    Error  = (Dist2 - Dist1) * 0.1f;
        HypPoint NewP11 = HTransform.GetHMoveAlongTwoPoints(P11, P12, -Error);
        HypPoint NewP12 = HTransform.GetHMoveAlongTwoPoints(P12, P11, -Error);
        HypPoint NewP21 = HTransform.GetHMoveAlongTwoPoints(P21, P22, Error);
        HypPoint NewP22 = HTransform.GetHMoveAlongTwoPoints(P22, P21, Error);

        if (NewP11.InWorld() && !V11.Fixed)
        {
            V11.XY.x = NewP11.GetX();
            V11.XY.y = NewP11.GetY();
        }
        if (NewP12.InWorld() && !V12.Fixed)
        {
            V12.XY.x = NewP12.GetX();
            V12.XY.y = NewP12.GetY();
        }
        if (NewP21.InWorld() && !V21.Fixed)
        {
            V21.XY.x = NewP21.GetX();
            V21.XY.y = NewP21.GetY();
        }
        if (NewP22.InWorld() && !V22.Fixed)
        {
            V22.XY.x = NewP22.GetX();
            V22.XY.y = NewP22.GetY();
        }
    }
Exemple #22
0
        string ParseLogon(string strLogon)
        {
            int FirstMatch  = 0;
            int SecondMatch = 0;

            FirstMatch = VB.instr(1, strLogon, @"\");
            do
            {
                SecondMatch = VB.instr(FirstMatch + 1, strLogon, @"\");
                if (SecondMatch >= 0)
                {
                    FirstMatch = SecondMatch;
                }
                else
                {
                    break;
                }
            }while(SecondMatch >= 0);

            return(VB.mid(strLogon, FirstMatch + 1));
        }
Exemple #23
0
        public static VanBanDTO LayVanBanTheoTieuDe(string BaiHoc_XML, string TieuDe)
        {
            VanBanDTO VanBan = new VanBanDTO();

            XmlDocument XmlD = new XmlDocument();

            XmlD.Load(BaiHoc_XML);

            XmlNodeList ListVanBan = XmlD.GetElementsByTagName("VANBAN");

            foreach (XmlElement VB in ListVanBan)
            {
                if (VB.GetAttribute("TieuDe") == TieuDe)
                {
                    VanBan = KhoiTao(VB);
                    break;
                }
            }

            return(VanBan);
        }
Exemple #24
0
        private void HB_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            LChartPhoto im = sender as LChartPhoto;

            selectedImage = im;

            HB.Active();
            VB.DeActive();
            photoTestToolbar1.setTarget(HB);
            WriteableBitmap b = im.getPhoto();

            if (b != null)
            {
                DCTestLibrary.PhotoTest pt = new DCTestLibrary.PhotoTest();
                Point?p = xt.PointToPix(b, im, e.GetCurrentPoint(im).Position, false);
                if (p == null)
                {
                    return;
                }
                dg.DrawBrightLines(pt.getImageGrayHLine(b, Convert.ToInt32(p.Value.Y)));
            }
        }
Exemple #25
0
    void ModuleUpdatePointToCircle()
    {
        Vector2 vtx     = VA.GetComponent <Vertex>().XY; //対象となる点
        HCircle hcircle = VB.GetComponent <HCircle>();   //対象となる円

        if (vtx != null && hcircle != null)
        {
            HypCircle cr   = hcircle.GetHCR();                                       //円の円データ
            HypPoint  HPcr = new HypPoint(cr.HX, cr.HY);                             //円の中心
            HypPoint  Pvtx = new HypPoint(vtx.x, vtx.y);                             //対象となる点
            float     dist = HTransform.GetHDistanceOfTwoPoints(HPcr, Pvtx) - cr.HR; //誤差
            //Debug.Log(HTransform.GetHDistanceOfTwoPoints(HPcr, Pvtx)+"->");
            if (Mathf.Abs(dist) > 0.0001f)
            {
                //円を点に寄せる
                HypPoint P1 = HTransform.GetHMoveAlongTwoPoints(HPcr, Pvtx, dist * 0.5f);
                //点を円に寄せる
                HypPoint P2 = HTransform.GetHMoveAlongTwoPoints(Pvtx, HPcr, dist * 0.5f);
                //Debug.Log("*:"+dist+" "+ X+" "+ Y);
                if (!VB.GetComponent <HCircle>().VA.GetComponent <Vertex>().Fixed&& P1.InWorld())
                {
                    VB.GetComponent <HCircle>().VA.GetComponent <Vertex>().XY.x = P1.GetX();
                    VB.GetComponent <HCircle>().VA.GetComponent <Vertex>().XY.y = P1.GetY();
                }
                if (!VA.GetComponent <Vertex>().Fixed&& P2.InWorld())
                {
                    VA.GetComponent <Vertex>().XY.x = P2.GetX();
                    VA.GetComponent <Vertex>().XY.y = P2.GetY();
                }
                //円の半径を調整する
                VB.GetComponent <HCircle>().HCR.HR += (dist * 0.1f);
                cr   = hcircle.HCR;                //円の円データ
                HPcr = new HypPoint(cr.HX, cr.HY); //円の中心
                Pvtx = new HypPoint(vtx.x, vtx.y); //対象となる点
            }
        }
    }
Exemple #26
0
    void ModuleUpdatePointToLine()
    {
        Vector2 vtx   = VA.GetComponent <Vertex>().XY; //対象となる点
        HLine   hline = VB.GetComponent <HLine>();     //対象となる直線

        if (vtx != null && hline != null)
        {
            HypLine ln        = hline.HL;                          //直線の円データ
            Vector2 hlnCenter = new Vector2(ln.GetX(), ln.GetY()); //直線の円データの中心座標
            Vector2 direction = vtx - hlnCenter;                   //円の中心から対象となる点の方向
            float   dist      = direction.magnitude - ln.R;        //誤差
            if (Mathf.Abs(dist) > 0.001f)
            {
                direction.Normalize();
                //Vector2 newVtx = hlnCenter + (ln.R + 0.75f * dist) * direction;//新しい点の座標
                Vector2  newVtx = vtx - (0.1f * dist) * direction;//新しい点の座標
                HypPoint newPt  = new HypPoint(newVtx);
                if (!VA.GetComponent <Vertex>().Fixed&& newPt.InWorld())
                {
                    VA.GetComponent <Vertex>().XY = newVtx;
                }
                Vector2 startPos    = vtx - dist * direction;           //平行移動スタート点
                Vector2 endPos      = vtx - (0.8f * dist) * direction;  //平行移動ゴール点
                Vertex  lineVertex1 = hline.VA.GetComponent <Vertex>(); //動かすべき点1
                Vertex  lineVertex2 = hline.VB.GetComponent <Vertex>(); //動かすべき点2
                //new HypPoint(lineVertex1.XY).Println("LV1");
                //new HypPoint(lineVertex2.XY).Println("LV2");
                Vector2 XY1 = lineVertex1.XY;
                Vector2 XY2 = lineVertex2.XY;
                if (!lineVertex1.Fixed)
                {
                    HypPoint HP1    = new HypPoint(XY1);
                    HypPoint HPnew1 = HTransform.ParallelTransform(startPos, endPos, HP1);//点1を平行移動する
                    if (HPnew1.InWorld())
                    {
                        lineVertex1.XY.x = HPnew1.GetX();
                        lineVertex1.XY.y = HPnew1.GetY();
                    }
                    else
                    {
                        Debug.Log("error occurs at module P2L - 1A:" + HPnew1.X + "," + HPnew1.Y + "," + HPnew1.Z);
                        HP1.Println("HP1");
                        HPnew1.Println("HPnew1");
                        Debug.Log("dist " + dist);
                        Debug.Log("ln.R " + ln.R);
                        Debug.Log("direction " + direction.x + "," + direction.y);
                        Debug.Log("hlnCenter " + hlnCenter.x + "," + hlnCenter.y);
                        Debug.Log("startPos" + startPos.x + "," + startPos.y);
                        Debug.Log("endPos" + endPos.x + "," + endPos.y);
                        Debug.Log(XY1);
                    }
                }
                if (!lineVertex2.Fixed)
                {
                    HypPoint HP2    = new HypPoint(XY2);
                    HypPoint HPnew2 = HTransform.ParallelTransform(startPos, endPos, HP2);//点2を平行移動する
                    if (HPnew2.InWorld())
                    {
                        lineVertex2.XY.x = HPnew2.GetX();
                        lineVertex2.XY.y = HPnew2.GetY();
                    }
                    else
                    {
                        Debug.Log("error occurs at module P2L - 2A:" + HPnew2.X + "," + HPnew2.Y + "," + HPnew2.Z);
                    }
                }
                hline.GetHLineFromTwoVertices();
            }
        }
    }
Exemple #27
0
    void ModuleUpdateAngle()
    {
        Vertex   VtxA       = VA.GetComponent <Vertex>();         // 対象となる点A
        Vertex   VtxB       = VB.GetComponent <Vertex>();         // 対象となる点B
        Vertex   VtxC       = VC.GetComponent <Vertex>();         // 対象となる点C
        float    FinalAngle = Mathf.Abs(ParaA * Mathf.PI / 180f); // 対象となる角
        HypPoint PA         = new HypPoint(VtxA.XY);
        HypPoint PB         = new HypPoint(VtxB.XY);
        HypPoint PC         = new HypPoint(VtxC.XY);
        HypPoint PO         = new HypPoint(0, 0);
        // Bを原点に移す写像を求める。
        HypLine  LA  = HTransform.GetHBisectorOfTwoPoints(PB, PO);
        HypPoint PAA = HTransform.GetInversionAlongHLine(LA, PA);
        HypPoint PCC = HTransform.GetInversionAlongHLine(LA, PC);
        //角ABCを求める
        float DeclineA = Mathf.Atan2(PAA.GetY(), PAA.GetX());
        float DeclineC = Mathf.Atan2(PCC.GetY(), PCC.GetX());
        float AngleAC  = DeclineC - DeclineA;

        if (AngleAC > Mathf.PI)
        {
            AngleAC -= (Mathf.PI * 2f);
        }
        if (AngleAC < -Mathf.PI)
        {
            AngleAC += (Mathf.PI * 2f);
        }
        // 修正する角度をもとめる。
        float error = (AngleAC - FinalAngle) * 0.1f;

        if (AngleAC < 0)
        {
            error = (AngleAC + FinalAngle) * 0.1f;
        }
        //今一度点の取り直し。
        {//線分ABのとりなおし
            PA = new HypPoint(VtxA.XY);
            PB = new HypPoint(VtxB.XY);
            HypPoint PM = HTransform.GetMidPointOfTwoPoint(PA, PB);
            LA = HTransform.GetHBisectorOfTwoPoints(PM, PO);
            HypPoint PPA    = HTransform.GetInversionAlongHLine(LA, PA);
            HypPoint PPB    = HTransform.GetInversionAlongHLine(LA, PB);
            HypPoint NewPPA = HTransform.GetRotationOfPoint(PO, error, PPA);
            HypPoint NewPPB = HTransform.GetRotationOfPoint(PO, error, PPB);
            HypPoint NewPA  = HTransform.GetInversionAlongHLine(LA, NewPPA);
            HypPoint NewPB  = HTransform.GetInversionAlongHLine(LA, NewPPB);
            if (!VtxA.Fixed && NewPA.InWorld())
            {
                VtxA.XY.x = NewPA.GetX();
                VtxA.XY.y = NewPA.GetY();
            }
            if (!VtxB.Fixed && NewPB.InWorld())
            {
                VtxB.XY.x = NewPB.GetX();
                VtxB.XY.y = NewPB.GetY();
            }
        }
        {//線分BCの取り直し
            PC = new HypPoint(VtxC.XY);
            PB = new HypPoint(VtxB.XY);
            HypPoint PM = HTransform.GetMidPointOfTwoPoint(PC, PB);
            LA = HTransform.GetHBisectorOfTwoPoints(PM, PO);
            HypPoint PPC    = HTransform.GetInversionAlongHLine(LA, PC);
            HypPoint PPB    = HTransform.GetInversionAlongHLine(LA, PB);
            HypPoint NewPPC = HTransform.GetRotationOfPoint(PO, -error, PPC);
            HypPoint NewPPB = HTransform.GetRotationOfPoint(PO, -error, PPB);
            HypPoint NewPC  = HTransform.GetInversionAlongHLine(LA, NewPPC);
            HypPoint NewPB  = HTransform.GetInversionAlongHLine(LA, NewPPB);
            if (!VtxC.Fixed && NewPC.InWorld())
            {
                VtxC.XY.x = NewPC.GetX();
                VtxC.XY.y = NewPC.GetY();
            }
            if (!VtxB.Fixed && NewPB.InWorld())
            {
                VtxB.XY.x = NewPB.GetX();
                VtxB.XY.y = NewPB.GetY();
            }
        }
    }
Exemple #28
0
 public void ModuleUpdate()
 {
     for (int repeat = 0; repeat < 10; repeat++)
     {
         if (Mode == MODE.ADD_MIDPOINT)
         {
             HypPoint V1    = new HypPoint(VA.GetComponent <Vertex>().XY);
             HypPoint V2    = new HypPoint(VB.GetComponent <Vertex>().XY);
             HypPoint V3    = new HypPoint(VC.GetComponent <Vertex>().XY);
             HypPoint W1    = HTransform.ParallelTransform(V2, V3, V3);
             HypPoint W2    = HTransform.ParallelTransform(V1, V3, V3);
             HypPoint W3    = HTransform.GetMidPointOfTwoPoint(V1, V2);
             float    dist1 = HTransform.GetHDistanceOfTwoPoints(V1, W1);
             float    dist2 = HTransform.GetHDistanceOfTwoPoints(V2, W2);
             float    dist3 = HTransform.GetHDistanceOfTwoPoints(V3, W3);
             HypPoint U1    = HTransform.GetHMoveAlongTwoPoints(V1, W1, dist1 * 0.1f);
             HypPoint U2    = HTransform.GetHMoveAlongTwoPoints(V2, W2, dist2 * 0.1f);
             HypPoint U3    = HTransform.GetHMoveAlongTwoPoints(V3, W3, dist3 * 0.1f);
             //if (!U1.InWorld() || !U2.InWorld() || !U3.InWorld())
             //{
             //    V1.Println("V1:");
             //    V2.Println("V2:");
             //    V3.Println("V3:");
             //    W1.Println("W1:");
             //    Debug.Log("dist1:" + dist1);
             //    U1.Println("U1:");
             //}
             if (U1.InWorld() && U2.InWorld() && U3.InWorld())
             {
                 if (!VA.GetComponent <Vertex>().Fixed)
                 {
                     VA.GetComponent <Vertex>().XY.x = U1.GetX();
                     VA.GetComponent <Vertex>().XY.y = U1.GetY();
                 }
                 if (!VB.GetComponent <Vertex>().Fixed)
                 {
                     VB.GetComponent <Vertex>().XY.x = U2.GetX();
                     VB.GetComponent <Vertex>().XY.y = U2.GetY();
                 }
                 if (!VC.GetComponent <Vertex>().Fixed)
                 {
                     VC.GetComponent <Vertex>().XY.x = U3.GetX();
                     VC.GetComponent <Vertex>().XY.y = U3.GetY();
                 }
             }
         }
         else if (Mode == MODE.POINT_TO_POINT)
         {
             if (VA != null && VB != null)
             {
                 Vector2 V1    = VA.GetComponent <Vertex>().XY;
                 Vector2 V2    = VB.GetComponent <Vertex>().XY;
                 Vector2 NewV1 = 0.75f * V1 + 0.25f * V2;
                 Vector2 NewV2 = 0.25f * V1 + 0.75f * V2;
                 if (!VA.GetComponent <Vertex>().Fixed)
                 {
                     VA.GetComponent <Vertex>().XY = NewV1;
                 }
                 if (!VB.GetComponent <Vertex>().Fixed)
                 {
                     VB.GetComponent <Vertex>().XY = NewV2;
                 }
             }
         }
         else if (Mode == MODE.POINT_TO_LINE)
         {
             if (VA != null && VB != null)
             {
                 ModuleUpdatePointToLine2();
             }
         }
         else if (Mode == MODE.POINT_TO_CIRCLE)
         {
             if (VA != null && VB != null)
             {
                 ModuleUpdatePointToCircle();
             }
         }
         else if (Mode == MODE.ISOMETRY)
         {
             if (VA != null && VB != null)
             {
                 ModuleUpdateIsometry();
             }
         }
         else if (Mode == MODE.PERPENDICULAR)
         {
             if (VA != null && VB != null)
             {
                 ModuleUpdatePerpendicular();
             }
         }
         else if (Mode == MODE.ANGLE)
         {
             if (VA != null && VB != null && VC != null)
             {
                 ModuleUpdateAngle();
             }
         }
         else if (Mode == MODE.TANGENT_C2L)
         {
             if (VA != null && VB != null)
             {
                 ModuleUpdateTangentCircleToLine();
             }
         }
         else if (Mode == MODE.TANGENT_C2C)
         {
             if (VA != null && VB != null)
             {
                 HCircle hcircle1 = VA.GetComponent <HCircle>(); //対象となる円1
                 HCircle hcircle2 = VB.GetComponent <HCircle>(); //対象となる円2
                 if (hcircle1 != null && hcircle2 != null)
                 {
                     HypCircle C1 = hcircle1.HCR;
                     HypCircle C2 = hcircle2.HCR;
                     HypPoint  P1 = new HypPoint(hcircle1.VA.GetComponent <Vertex>().XY);
                     HypPoint  P2 = new HypPoint(hcircle2.VA.GetComponent <Vertex>().XY);
                     //HypLine L1 = HTransform.GetHLineThruTwoPoints(P1,P2);
                     float dist     = HTransform.GetHDistanceOfTwoPoints(P1, P2);
                     float errorOut = dist - (C1.HR + C2.HR);
                     float errorIn  = dist - Mathf.Abs(C1.HR - C2.HR);
                     if (Mathf.Abs(errorOut) < Mathf.Abs(errorIn))
                     {// 外接と思われる
                         float error = errorOut * 0.1f;
                         //円C1を寄せる
                         HypPoint P3  = HTransform.GetHMoveAlongTwoPoints(P1, P2, error);
                         Vertex   C1V = hcircle1.VA.GetComponent <Vertex>();
                         if (!C1V.Fixed && P3.InWorld())
                         {
                             C1V.XY.x = P3.GetX();
                             C1V.XY.y = P3.GetY();
                         }
                         //円C1の半径を調節する。
                         C1.HR += error;
                         //円C2を寄せる
                         HypPoint P4  = HTransform.GetHMoveAlongTwoPoints(P2, P1, error);
                         Vertex   C2V = hcircle2.VA.GetComponent <Vertex>();
                         if (!C2V.Fixed && P4.InWorld())
                         {
                             C2V.XY.x = P4.GetX();
                             C2V.XY.y = P4.GetY();
                         }
                         //円C2の半径を調節する。
                         C2.HR += error;
                     }
                     else
                     {//内接と思われる
                         float error = errorIn * 0.1f;
                         bool  C1Out = false;
                         if (C1.HR > C2.HR)
                         {// C1が外側と思われる
                             C1Out = true;
                         }
                         //円C1を寄せる
                         HypPoint P3  = HTransform.GetHMoveAlongTwoPoints(P1, P2, error);
                         Vertex   C1V = hcircle1.VA.GetComponent <Vertex>();
                         if (!C1V.Fixed && P3.InWorld())
                         {
                             C1V.XY.x = P3.GetX();
                             C1V.XY.y = P3.GetY();
                         }
                         if (C1Out)
                         {
                             C1.HR += error;
                         }
                         else
                         {
                             C1.HR -= error;
                         }
                         //円C2を寄せる
                         HypPoint P4  = HTransform.GetHMoveAlongTwoPoints(P2, P1, error);
                         Vertex   C2V = hcircle2.VA.GetComponent <Vertex>();
                         if (!C2V.Fixed && P4.InWorld())
                         {
                             C2V.XY.x = P4.GetX();
                             C2V.XY.y = P4.GetY();
                         }
                         //円C2の半径を調節する。
                         if (C1Out)
                         {
                             C2.HR -= error;
                         }
                         else
                         {
                             C2.HR += error;
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #29
0
        private void GetVariablesToSearchIn()
        {
            ObservableList <VariableBase> SolutionVariables = App.UserProfile.Solution.Variables;

            foreach (VariableBase VB in SolutionVariables)
            {
                if (mFindAndReplaceUtils.ProcessingState == FindAndReplaceUtils.eProcessingState.Stopping)
                {
                    return;
                }
                string VariablePath = App.UserProfile.Solution.ItemName;
                if (mSubItemType == null || VB.GetType() == mSubItemType)
                {
                    mItemsToSearchIn.Add(new ItemToSearchIn(VB, VB, App.UserProfile.Solution, VariablePath, string.Empty));
                }
            }

            ObservableList <BusinessFlow> BFs = App.LocalRepository.GetSolutionBusinessFlows();

            foreach (BusinessFlow BF in BFs)
            {
                foreach (VariableBase VB in BF.Variables)
                {
                    if (mFindAndReplaceUtils.ProcessingState == FindAndReplaceUtils.eProcessingState.Stopping)
                    {
                        return;
                    }
                    string BFVariablePath = BF.ItemName;
                    if (mSubItemType == null || VB.GetType() == mSubItemType)
                    {
                        mItemsToSearchIn.Add(new ItemToSearchIn(VB, VB, BF, BFVariablePath, string.Empty));
                    }
                }
                foreach (Activity activitiy in BF.Activities)
                {
                    foreach (VariableBase VB in activitiy.Variables)
                    {
                        if (mFindAndReplaceUtils.ProcessingState == FindAndReplaceUtils.eProcessingState.Stopping)
                        {
                            return;
                        }
                        string ActivityVariablePath = BF.ItemName + @"\" + activitiy.ActivityName;
                        if (mSubItemType == null || VB.GetType() == mSubItemType)
                        {
                            mItemsToSearchIn.Add(new ItemToSearchIn(VB, VB, BF, ActivityVariablePath, string.Empty));
                        }
                    }
                }
            }

            ObservableList <Activity> RepoActivities = App.LocalRepository.GetSolutionRepoActivities();

            foreach (Activity activity in RepoActivities)
            {
                foreach (VariableBase VB in activity.Variables)
                {
                    string ActivityVariablePath = activity.ItemName;
                    if (mSubItemType == null || VB.GetType() == mSubItemType)
                    {
                        mItemsToSearchIn.Add(new ItemToSearchIn(VB, VB, activity, ActivityVariablePath, string.Empty));
                    }
                }
            }


            ObservableList <VariableBase> RepoVariables = App.LocalRepository.GetSolutionRepoVariables();

            foreach (VariableBase VB in RepoVariables)
            {
                if (mFindAndReplaceUtils.ProcessingState == FindAndReplaceUtils.eProcessingState.Stopping)
                {
                    return;
                }
                string path = @"SharedRepository\" + VB.ItemName;
                if (mSubItemType == null || VB.GetType() == mSubItemType)
                {
                    mItemsToSearchIn.Add(new ItemToSearchIn(VB, VB, VB, path, string.Empty));
                }
            }
        }
Exemple #30
0
 void DrawClippedLine()
 {
     if (HL.R > 300f || HL.Z == 0f)//まっすぐすぎるので直径を描く
     {
         Vertex P1 = VA.GetComponent <Vertex>();
         Vertex P2 = VB.GetComponent <Vertex>();
         float  x1 = P1.XY.x * World.Scale;
         float  y1 = P1.XY.y * World.Scale;
         float  x2 = (P2.XY.x - x1);
         float  y2 = (P2.XY.y - y1);
         for (int i = 0; i < PosLength; i++)
         {
             float xxx = x1 + x2 * i / (PosLength - 1);
             float yyy = y1 + y2 * i / (PosLength - 1);
             float dr  = 0.01f * (1f - xxx * xxx - yyy * yyy);
             Pos[i].x    = xxx * World.Scale;
             Pos[i].y    = yyy * World.Scale;
             Pos[i].z    = -1f;
             ks[i].value = dr * World.StrokeWeight * World.Scale;
         }
         anim.keys     = ks;
         LR.widthCurve = anim;
     }
     else// 普通に円弧を描く
     {
         Vertex P1 = VA.GetComponent <Vertex>();
         Vertex P2 = VB.GetComponent <Vertex>();
         float  hlx = HL.X / HL.Z;
         float  hly = HL.Y / HL.Z;
         float  T1 = Mathf.Atan2(P1.XY.y - hly, P1.XY.x - hlx);
         float  T2 = Mathf.Atan2(P2.XY.y - hly, P2.XY.x - hlx);
         float  StartT = 0f, WidT = 0f;
         if (T1 <= T2 && T2 < T1 + Mathf.PI)
         {
             StartT = T1;
             WidT   = T2 - T1;
         }
         else if (T1 + Mathf.PI <= T2 && T2 < T1 + 2f * Mathf.PI)
         {
             StartT = T2;
             WidT   = T1 - T2 + 2 * Mathf.PI;
         }
         else if (T1 - Mathf.PI <= T2 && T2 < T1)
         {
             StartT = T2;
             WidT   = T1 - T2;
         }
         else if (T1 - 2f * Mathf.PI <= T2 && T2 < T1 - Mathf.PI)
         {
             StartT = T1;
             WidT   = T2 - T1 + 2 * Mathf.PI;
         }
         for (int i = 0; i < PosLength; i++)
         {
             float t  = StartT + WidT * i / (PosLength - 1);
             float xx = hlx + HL.R * Mathf.Cos(t);
             float yy = hly + HL.R * Mathf.Sin(t);
             float dr = 0.01f * (1f - xx * xx - yy * yy);
             Pos[i].x    = WorldScale * xx;
             Pos[i].y    = WorldScale * yy;
             Pos[i].z    = -1f;
             ks[i].value = dr * World.StrokeWeight * World.Scale;
         }
         anim.keys     = ks;
         LR.widthCurve = anim;
     }
 }