public override void Check(IEnumerable <ObjectId> selectedObjectIds)
        {
            var watch = Stopwatch.StartNew();

            var database = Editor.Document.Database;

            using (var transaction = database.TransactionManager.StartTransaction())
            {
                // Search dangling vertices.
                //var danglingSearcher = new DanglingVertexSearcher(objIds, true, transaction);
                //danglingSearcher.SelectCurves = this.SelectCurvesAtPoint;
                //var danglingVertices = danglingSearcher.Search();

                var danglingSearcher = new KdTreeDanglingVertexSearcher(selectedObjectIds, true, transaction);
                var danglingVertices = danglingSearcher.Search();

                // Traverse all dangling vertices and search the apparent intersection.
                //_apparentIntersections = GetApparentIntersections(danglingVertices, transaction);
                _apparentIntersections = GetApparentIntersectionsKdTree(danglingVertices, transaction);

                transaction.Commit();
            }

            // the code that you want to measure comes here
            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;

            Editor.WriteMessage("\n查找外观交点花费时间{0}毫秒", elapsedMs);
        }
示例#2
0
        public override void Check(IEnumerable <ObjectId> selectedObjectIds)
        {
            var watch = Stopwatch.StartNew();

            if (selectedObjectIds == null || !selectedObjectIds.Any())
            {
                return;
            }

            var database = Editor.Document.Database;

            using (var transaction = database.TransactionManager.StartTransaction())
            {
                // Search dangling vertices first.
                var danglingSearcher = new KdTreeDanglingVertexSearcher(selectedObjectIds, forDrawing: true, transaction: transaction);
                var danglingVertices = danglingSearcher.Search();

                // Traverse all dangling vertices and search the cluster nodes.
                _clusterNodesInfos = GetClusterNodesKdTree(danglingVertices, transaction);

                transaction.Commit();
            }

            watch.Stop();
            var elapsedMS = watch.ElapsedMilliseconds;

            Editor.WriteMessage("\n花费时间{0}毫秒", elapsedMS);
        }
示例#3
0
        public override void Check(IEnumerable <ObjectId> selectedObjectIds)
        {
            var watch = Stopwatch.StartNew();

            var database = Editor.Document.Database;

            using (var transaction = database.TransactionManager.StartTransaction())
            {
                // Search dangling vertices.
                //var danglingSearcher = new DanglingVertexSearcher(objIds, true, transaction);
                //danglingSearcher.SelectCurves = this.SelectCurvesAtPoint;
                //var danglingVertices = danglingSearcher.Search();

                var danglingSearcher = new KdTreeDanglingVertexSearcher(selectedObjectIds, true, transaction);
                var danglingVertices = danglingSearcher.Search();

                // Traverse all dangling vertices and search undershoots
                //_underShootInfos = GetUnderShootIntersections(danglingVertices, transaction, _tolerance);
                _underShootInfos = GetUnderShootIntersections2(selectedObjectIds, danglingVertices, _tolerance, transaction);

                transaction.Commit();
            }

            // the code that you want to measure comes here
            //watch.Stop();
            //var elapsedMs = watch.ElapsedMilliseconds;
            //Editor.WriteMessage("\n查找未及点花费时间{0}毫秒", elapsedMs);
            //foreach (var intersectionInfo in _underShootInfos)
            //{
            //    Editor.WriteMessage("\n{0}\n", intersectionInfo.IntersectPoint.ToString());
            //}
        }