Example #1
0
        /// <inheritdoc />
        protected override bool WorldDraw(WorldDraw draw)
        {
            if (Pts.Count == 1)
            {
                return(draw.Geometry.WorldLine(Pts[0].Convert3d(), newPt.Convert3d()));
            }

            using (var pl = Pts.CreatePolyline())
            {
                pl.Closed        = true;
                pl.ColorIndex    = 7;
                pl.LinetypeId    = crossLineTypeId;
                pl.LineWeight    = LineWeight.LineWeight018;
                pl.LinetypeScale = 1;
                draw.Geometry.Draw(pl);
            }

            try
            {
                var pts = Pts.ToList();
                pts.Add(newPt);
                using (var hatch = pts.CreateHatch())
                {
                    hatch.SetHatchPattern(HatchPatternType.UserDefined, "SOLID");
                    hatch.Color        = hatchColor;
                    hatch.Transparency = hatchTransp;
                    return(draw.Geometry.Draw(hatch));
                }
            }
            catch
            {
                return(true);
            }
        }
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Flags.ToStream(output);
     Pts.ToStream(output);
     ToStream(output, Timeout, Flags, (int)ChannelDifferenceFlags.Timeout);
 }
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Pts.ToBytes(),
                Date.ToBytes(),
                Qts.ToBytes()));
 }
Example #4
0
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Pts.NullableToStream(output);
     Qts.NullableToStream(output);
     Date.NullableToStream(output);
     Seq.NullableToStream(output);
     UnreadCount.NullableToStream(output);
 }
Example #5
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Channel.ToBytes(),
                Filter.ToBytes(),
                Pts.ToBytes(),
                Limit.ToBytes()));
 }
Example #6
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Id.ToBytes(),
                Date.ToBytes(),
                Media.ToBytes(),
                Pts.ToBytes(),
                PtsCount.ToBytes()));
 }
Example #7
0
 public override byte[] ToBytes()
 {
     return(TLUtils.Combine(
                TLUtils.SignatureToBytes(Signature),
                Flags.ToBytes(),
                Pts.ToBytes(),
                ToBytes(PtsTotalLimit, Flags, (int)GetDifferenceFlags.PtsTotalLimit),
                Date.ToBytes(),
                Qts.ToBytes()));
 }
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Flags.ToStream(output);
     Pts.ToStream(output);
     ToStream(output, Timeout, Flags, (int)ChannelDifferenceFlags.Timeout);
     NewMessages.ToStream(output);
     OtherUpdates.ToStream(output);
     Chats.ToStream(output);
     Users.ToStream(output);
 }
        private List <Element> GetRects()
        {
            Pts.Clear();
            _rects.Clear();
            if (Pt1.Equals(Pt2))
            {
                int halfW = PointLineWidth / 2;
                int halfH = PointLineHeight / 2;
                for (int i = 0; i < DispersePointCount; i++)
                {
                    RectangleF rect = new RectangleF(Pt1.X - halfW, Pt1.Y - halfH, PointLineWidth, PointLineHeight);
                    _rects.Add(new RectLineElement(rect)
                    {
                        AutoChangeSize = false, BorderWidth = this.BorderWidth, ForeColor = this.ForeColor
                    });
                }
            }
            else
            {
                A = Pt2.Y - Pt1.Y;
                B = Pt1.X - Pt2.X;
                C = Pt2.X * Pt1.Y - Pt1.X * Pt2.Y;

                float offsetX = (Pt2.X - Pt1.X) / (DispersePointCount - 1);
                float offsetY = (Pt2.Y - Pt1.Y) / (DispersePointCount - 1);

                int halfW = PointLineWidth / 2;
                int halfH = PointLineHeight / 2;

                double aphla = Math.Atan((Pt2.Y - Pt1.Y) / (Pt2.X - Pt1.X));
                int    angle = (int)(aphla / Math.PI * 180);
                if ((Pt2.X - Pt1.X) < 0)
                {
                    angle = angle + 180;
                }
                Debug.WriteLine($"aphla={aphla} angle={angle}");

                for (int i = 0; i < DispersePointCount; i++)
                {
                    float x = Pt1.X + i * offsetX;
                    float y = B == 0 ? Pt1.Y + i * offsetY : -(A * x + C) / B;

                    Pts.Add(new PointF(x, y));

                    RectangleF rect = new RectangleF(x - halfW, y - halfH, PointLineWidth, PointLineHeight);
                    _rects.Add(new RectLineElement(rect, angle)
                    {
                        AutoChangeSize = false, BorderWidth = this.BorderWidth, ForeColor = this.ForeColor
                    });
                }
            }
            return(_rects);
        }
Example #10
0
        /// <inheritdoc />
        protected override SamplerStatus Sampler(JigPrompts prompts)
        {
            var promptPt = new JigPromptPointOptions("\nСлед. точка:");

            if (Pts.Count > 1)
            {
                promptPt.Keywords.Add("Пред");
                promptPt.AppendKeywordsToMessage = true;
            }

            promptPt.BasePoint         = basePt.Convert3d();
            promptPt.UseBasePoint      = true;
            promptPt.UserInputControls =
                UserInputControls.UseBasePointElevation | UserInputControls.AcceptOtherInputString
                | UserInputControls.GovernedByOrthoMode;
            var res = prompts.AcquirePoint(promptPt);

            switch (res.Status)
            {
            case PromptStatus.OK:
                var pt = res.Value.Convert2d();
                if (pt.GetDistanceTo(basePt) < 0.01)
                {
                    return(SamplerStatus.NoChange);
                }
                newPt = pt;
                return(SamplerStatus.OK);

            case PromptStatus.Cancel:
                return(SamplerStatus.Cancel);

            case PromptStatus.None:
                return(SamplerStatus.Cancel);

            case PromptStatus.Error:
                return(SamplerStatus.Cancel);

            case PromptStatus.Keyword:
                Pts.RemoveAt(Pts.Count - 1);
                return(SamplerStatus.OK);

            case PromptStatus.Modeless:
                break;

            case PromptStatus.Other:
                return(SamplerStatus.Cancel);

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(SamplerStatus.NoChange);
        }
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Flags.ToStream(output);
     Pts.ToStream(output);
     ToStream(output, Timeout, Flags, (int)ChannelDifferenceFlags.Timeout);
     TopMessage.ToStream(output);
     ReadInboxMaxId.ToStream(output);
     ReadOutboxMaxId.ToStream(output);
     UnreadCount.ToStream(output);
     Messages.ToStream(output);
     Chats.ToStream(output);
     Users.ToStream(output);
 }
Example #12
0
        internal static void TestImportPts(string filename)
        {
            var chunks = Pts.Chunks(filename, ParseConfig.Default);

            Console.WriteLine(filename);
            var sw    = new Stopwatch();
            var count = 0L;

            sw.Start();
            foreach (var chunk in chunks)
            {
                Console.WriteLine($"    {chunk.Count}, {chunk.BoundingBox}");
                count += chunk.Count;
            }
            sw.Stop();
            Console.WriteLine($"    {count:N0} points");
            Console.WriteLine($"    {sw.Elapsed} ({(int)(count / sw.Elapsed.TotalSeconds):N0} points/s)");
        }
Example #13
0
        public PromptStatus DrawPolyline(Editor ed)
        {
            this.ed = ed;
            var ptOpt = new PromptPointOptions("\nПервая точка:");

            ptOpt.Keywords.Add("Полилиния");
            ptOpt.AppendKeywordsToMessage = true;
            var ptRes = ed.GetPoint(ptOpt);

            if (ptRes.Status == PromptStatus.Keyword)
            {
                return(SelectPolyline());
            }
            if (ptRes.Status == PromptStatus.OK)
            {
                DefineCrossDecor();
                basePt = ptRes.Value.TransformBy(ed.CurrentUserCoordinateSystem).Convert2d();
                Pts.Add(basePt);
                newPt = basePt;
                while (true)
                {
                    var res = ed.Drag(this);
                    if (res.Status == PromptStatus.Other)
                    {
                        break;
                    }
                    if (res.Status == PromptStatus.Cancel || res.Status == PromptStatus.Error)
                    {
                        throw new OperationCanceledException();
                    }
                    if (res.Status != PromptStatus.OK)
                    {
                        continue;
                    }
                    Pts.Add(newPt);
                    basePt = newPt;
                }

                return(PromptStatus.OK);
            }

            throw new OperationCanceledException();
        }
Example #14
0
        public override void ToStream(Stream output)
        {
            try
            {
                output.Write(TLUtils.SignatureToBytes(Signature));

                output.Write(Flags.ToBytes());
                output.Write(Id.ToBytes());
                output.Write(AccessHash.ToBytes());
                output.Write(Title.ToBytes());
                if (IsSet(Flags, (int)ChannelFlags.Public))
                {
                    UserName.ToStream(output);
                }
                Photo.ToStream(output);
                Date.ToStream(output);
                Version.ToStream(output);

                CustomFlags.NullableToStream(output);

                ParticipantIds.NullableToStream(output);
                About.NullableToStream(output);
                ParticipantsCount.NullableToStream(output);
                AdminsCount.NullableToStream(output);
                KickedCount.NullableToStream(output);
                ReadInboxMaxId.NullableToStream(output);
                Pts.NullableToStream(output);
                Participants.NullableToStream(output);
                NotifySettings.NullableToStream(output);

                if (IsSet(CustomFlags, (int)ChannelCustomFlags.MigratedFromChatId))
                {
                    _migratedFromChatId.ToStream(output);
                }
                if (IsSet(CustomFlags, (int)ChannelCustomFlags.MigratedFromMaxId))
                {
                    _migratedFromMaxId.ToStream(output);
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #15
0
        internal static void PerfTestJuly2019()
        {
            var filename = @"T:\Vgm\Data\2017-10-20_09-44-27_1mm_shade_norm_5pp - Cloud.pts";
            //var filename = @"T:\Vgm\Data\JBs_Haus.pts";

            var config = ImportConfig.Default
                         .WithInMemoryStore()
                         .WithRandomKey()
                         .WithVerbose(true)
                         .WithMaxDegreeOfParallelism(0)
                         .WithMinDist(0.01)
                         .WithNormalizePointDensityGlobal(true)
            ;

            Report.BeginTimed("total");

            var chunks = Pts.Chunks(filename, config.ParseConfig);
            var pc     = PointCloud.Chunks(chunks, config);

            Report.EndTimed();

            Report.Line($"count -> {pc.PointCount}");
        }
Example #16
0
        private void btn_ShowClassementDetaille2_Click(object sender, EventArgs e)
        {
            // Liste des joueurs
            List <Joueur> Participants;
            List <Joueur> Classement;
            // Element pour l'affichage et les calculs
            int   Ronde, Adv, Pos;
            int   i, j, TeteDeSerie;
            float Pts, Buchh, SoBerg;
            // Prend le nombre de joueur
            int NbParticipants;

            // Vider le tableau
            dataGridView1.Rows.Clear();
            // Prise de la liste de depart
            Participants = Tournoi.ChargerListe();
            // Prise du nombre de joueur
            NbParticipants = Tournoi.Joueurs_Totaux();
            // Effectuer le calcul du Buchholtz et de la somme de Buchholtz de tous les joueurs dans la gestion du classement
            // parce que ceux-ci évolue selon le tournoi des joueurs adverses
            // Prend le nombre de rondes
            Ronde = Tournoi.Ronde_Jouee();
            // On retrie par n° de départ pour prendre les positions finales de chaque joueur
            TriParNdeDepart(Participants, NbParticipants);
            // Prendre les adversaires selon leurs classements
            for (i = 0; i < (NbParticipants); i++)
            {
                // Prise de la valeur de chaque adversaire / chaque couleur et chaque resultat pour chaque ronde
                for (j = 1; j <= Ronde; j++)
                {
                    // Prise de l'adversaire (son n° indice)
                    Adv = (Participants[i].Adv_To_Return(j)) - 1;
                    // Remplacer la valeur de l'adversaire ==> l'indice devient son classement final
                    Pos = Participants[Adv].RangFinal();
                    Participants[i].MAJ_n_adversaire(Pos, j);
                }
            }
            // Copie de la liste des participants dans la zone prévue pour l'affichage du classement
            Classement = Participants;
            // On retrie selon la position
            TriParPosition(Classement, NbParticipants);
            // Génération du tableau
            for (i = 0; i < (NbParticipants); i++)
            {
                // Prise de la valeur de chaque adversaire / chaque couleur et chaque resultat pour chaque ronde
                for (j = 1; j <= Ronde; j++)
                {
                    // Prise de l'adversaire (son n° de classement FINAL)
                    Adv = (Participants[i].Adv_To_Return(j)) - 1;
                    nbAdversaire[j - 1] = Participants[Adv].RangFinal();
                    // Prise de la couleur
                    if ((Participants[i].Couleur_To_Return(j) == 0))
                    {
                        // 0 = noir ==> mise de S (Schwarz)
                        nbCouleur[j - 1] = 'S';
                    }
                    else
                    {
                        // 1 = blanc ==> mise de W (Weiss)
                        nbCouleur[j - 1] = 'W';
                    }
                    // Prise du résultat
                    nbResultat[j - 1] = Participants[i].Resultat_To_Return(j);
                    // Mettre tout ça dans un string
                    Ronde_Texte[i, j - 1] = nbAdversaire[j - 1].ToString() + nbCouleur[j - 1].ToString() + nbResultat[j - 1].ToString();
                }
                // Pour les rondes non jouées (pour y mettre des cases 'X' pour indiqué une ronde non jouée
                for (j = (Ronde + 1); j <= 11; j++)
                {
                    Ronde_Texte[i, j - 1] = "X";
                }
                // Elements à afficher
                TeteDeSerie = Classement[i].n_Depart_Du_JoueurLoad();
                Pts         = Classement[i].PointsJoueur();
                Buchh       = Classement[i].BuchhJoueur();
                SoBerg      = Classement[i].SoBergJoueur();
                // Création des lignes pour le classement
                string[] row = new string[] { (i + 1).ToString(), TeteDeSerie.ToString(), Classement[i].nom + " " + Classement[i].prenom, Classement[i].club, Classement[i].ELO.ToString(), Classement[i].Titre, Ronde_Texte[i, 0], Ronde_Texte[i, 1], Ronde_Texte[i, 2], Ronde_Texte[i, 3], Ronde_Texte[i, 4], Ronde_Texte[i, 5], Ronde_Texte[i, 6], Ronde_Texte[i, 7], Ronde_Texte[i, 8], Ronde_Texte[i, 9], Ronde_Texte[i, 10], Pts.ToString(), Buchh.ToString(), SoBerg.ToString() };
                dataGridView1.Rows.Add(row);
            }
            // Faire disparaitre le bouton pour afficher le classement détaillé (pour éviter un bug de remise de valeur incompréhensible)
            btn_ShowClassementDetaille2.Hide();
            // Faire apparaitre le bouton pour extraire sur csv
            btn_csv2.Show();
        }
Example #17
0
        /// 找到所有的边界线及所有的区域
        private static List <int>[] Find_BdsRims(ref WEntity2D[] WBs, ref WEntity2D[] Ws, ref GLCommon GLC, ref WEntity2D[] Bds, WMesh2D_Mesh Mesh)
        {
            int             N = 0;  /////记录节点编号
            List <WPoint2D> Pts;    /////辅助点集
            int             Q, Q2;
            /////找到每条边界线与夹丝线的交点
            WCurve2D C;

            for (int i = 0; i < WBs.Length; i++)
            {
                C = (WCurve2D)(WBs[i]);
                if (C.Meshed_Check == true)
                {
                    Geos2D_Other.Merge_Points(ref C.Nodes);  /////去掉多余节点
                    Pts = C.Nodes;
                    if (WMFuncs2D.Length_P2P(C.StartPoint, Pts[0]) > WMFuncs2D.Length_P2P(C.EndPoint, Pts[0]))
                    {
                        WMFuncs2D.Points_Reverse(ref Pts, true);
                    }
                    if (WMFuncs2D.Near_Check(Pts[0], C.StartPoint) == false)
                    {
                        Pts.Insert(0, C.StartPoint);
                    }
                    if (WMFuncs2D.Near_Check(Pts[Pts.Count - 1], C.EndPoint) == false)
                    {
                        Pts.Add(C.EndPoint);
                    }
                    C.Nodes = Pts;
                    /////
                    Divide_Ps(Pts, ref N, ref Bds, -1, Mesh, true, GLC.Mesh_Length);    /////分割点集为线段集合
                }
                else
                {
                    Pts = Geos2D_Intersection.Intersection_Cv2Ls(WBs[i], ref Ws); /////找与上下边线的交点作为划分的边界
                    if (Pts.Count < 2)
                    {
                        Array.Resize <WEntity2D>(ref Bds, Bds.Length + 1);
                        Bds[Bds.Length - 1] = WBs[i];
                        ((WCurve2D)Bds[Bds.Length - 1]).Trace = -1;
                        WMFuncs2D.Mesh_Curve(Bds[Bds.Length - 1], GLC.Mesh_Length);
                        ((WCurve2D)Bds[Bds.Length - 1]).Nodes_num = Get_NodeNums(((WCurve2D)Bds[Bds.Length - 1]).Nodes, Mesh, ref N);
                        continue;
                    }
                    else
                    {
                        Geos2D_Other.Merge_Points(ref Pts);  /////去掉多余节点
                    }
                    if (WMFuncs2D.Length_P2P(C.StartPoint, Pts[0]) > WMFuncs2D.Length_P2P(C.EndPoint, Pts[0]))
                    {
                        WMFuncs2D.Points_Reverse(ref Pts, true);
                    }
                    if (WMFuncs2D.Near_Check(Pts[0], C.StartPoint) == false)
                    {
                        Pts.Insert(0, C.StartPoint);
                    }
                    if (WMFuncs2D.Near_Check(Pts[Pts.Count - 1], C.EndPoint) == false)
                    {
                        Pts.Add(C.EndPoint);
                    }
                    /////
                    Divide_Ps(Pts, ref N, ref Bds, i, Mesh, false, GLC.Mesh_Length);    /////分割点集为线段集合
                }
            }
            Mesh.Q_FreeNs = N;
            /////找到所有夹丝线的交点,形成新的直线加入
            for (int i = 0; i < Ws.Length; i++)
            {
                Pts = Geos2D_Intersection.Intersection_L2Cvs((WLine2D)Ws[i], ref WBs); /////找与上下边线的交点作为划分的边界
                if (Pts.Count == 0)
                {
                    continue;                                                          /////夹丝线与上下边界不一定会有交点
                }
                Geos2D_Other.Merge_Points(ref Pts);                                    /////去掉多余节点
                if (Pts.Count == 1)
                {
                    continue;
                }
                /////
                Array.Resize <WEntity2D>(ref Bds, Bds.Length + 1);
                Q            = Bds.Length - 1;
                Bds[Q]       = new WLine2D(Pts[0], Pts[1]);
                Bds[Q].Trace = -2;
                WMFuncs2D.Mesh_Curve(Bds[Q], GLC.Mesh_Length);                                                    /////生成该线的节点
                N = WMFuncs2D.NsID_App(ref ((WCurve2D)Bds[Q]).Nodes, ref ((WCurve2D)Bds[Q]).Nodes_num, false, N); /////Mesh该线,注意头尾不要
                Mesh.Add_Ns(ref ((WCurve2D)Bds[Q]).Nodes, ref ((WCurve2D)Bds[Q]).Nodes_num, true, false);         /////将节点编号输入至Mesh中,注意头尾不要
                ((WCurve2D)Bds[Q]).Nodes_num[0] = Get_NodeNum(((WCurve2D)Bds[Q]).Nodes[0], Mesh, ref N);
                Q2 = ((WCurve2D)Bds[Q]).Nodes_num.Count - 1;
                ((WCurve2D)Bds[Q]).Nodes_num[Q2] = Get_NodeNum(((WCurve2D)Bds[Q]).Nodes[Q2], Mesh, ref N);
            }

            return(Geo2D_CurvesRims.Get_Rims(ref Bds, 1));
        }