Пример #1
0
 public GeometryDrawServerInputs CreateMerged(GeometryDrawServerInputs _other)
 {
     return(Merge(new List <GeometryDrawServerInputs>()
     {
         this, _other
     }));
 }
Пример #2
0
        public List <GeometryDrawServerInputs> SplitSelf()
        {
            int maxSize = 10000;
            //for each storage type, split stored geometry
            var nonTransMeshLists     = this.NonTransFaceBuffer.Meshes.DivideListMaxSize(maxSize);
            var transMeshLists        = this.TransFaceBuffer.Meshes.DivideListMaxSize(maxSize);
            var nonTransTriangleLists = this.NonTransTriangleBuffer.Triangles.DivideListMaxSize(maxSize);
            var transTriangleLists    = this.TransTriangleBuffer.Triangles.DivideListMaxSize(maxSize);
            var pointLists            = this.PointBuffer.Points.DivideListMaxSize(maxSize);
            var edgeLists             = this.EdgeBuffer.Edges.DivideListMaxSize(maxSize);

            var maxCount = new List <int>()
            {
                nonTransMeshLists.Count, transMeshLists.Count,
                nonTransTriangleLists.Count, transTriangleLists.Count,
                pointLists.Count, edgeLists.Count
            }
            .Max();

            var inputList = new List <GeometryDrawServerInputs>();

            for (int i = 0; i < maxCount; i++)
            {
                var nonTransMesh = i > nonTransMeshLists.Count - 1
                    ? new List <MeshInfo>()
                    : nonTransMeshLists[i];
                var transMesh = i > transMeshLists.Count - 1
                    ? new List <MeshInfo>()
                    : transMeshLists[i];
                var nonTransTriangle = i > nonTransTriangleLists.Count - 1
                    ? new List <TriangleInfo>()
                    : nonTransTriangleLists[i];
                var transTriangle = i > transTriangleLists.Count - 1
                    ? new List <TriangleInfo>()
                    : transTriangleLists[i];
                var pointList = i > pointLists.Count - 1
                    ? new List <PointInfo>()
                    : pointLists[i];
                var edgeList = i > edgeLists.Count - 1
                    ? new List <EdgeInfo>()
                    : edgeLists[i];

                var newInput = new GeometryDrawServerInputs(this.Outline, this.EnableFaceNormal);

                newInput.NonTransFaceBuffer     = new RenderingPassBufferStorage(nonTransMesh);
                newInput.TransFaceBuffer        = new RenderingPassBufferStorage(transMesh);
                newInput.NonTransTriangleBuffer = new RenderingPassBufferStorage(nonTransTriangle);
                newInput.TransTriangleBuffer    = new RenderingPassBufferStorage(transTriangle);
                newInput.PointBuffer            = new RenderingPassBufferStorage(pointList);
                newInput.EdgeBuffer             = new RenderingPassBufferStorage(edgeList);

                inputList.Add(newInput);
            }
            return(inputList);
        }
Пример #3
0
        public static GeometryDrawServerInputs Merge(IEnumerable <GeometryDrawServerInputs> _inputs)
        {
            var outlines = _inputs.Select(x => x.Outline.ToBoundingBox()).GetBoundingBox().ToOutLine();
            var input    = new GeometryDrawServerInputs(outlines, _inputs.First().EnableFaceNormal);

            input.NonTransFaceBuffer     = RenderingPassBufferStorage.Merge(_inputs.Select(x => x.NonTransFaceBuffer).ToList());
            input.TransFaceBuffer        = RenderingPassBufferStorage.Merge(_inputs.Select(x => x.TransFaceBuffer).ToList());
            input.NonTransTriangleBuffer = RenderingPassBufferStorage.Merge(_inputs.Select(x => x.NonTransTriangleBuffer).ToList());
            input.TransTriangleBuffer    = RenderingPassBufferStorage.Merge(_inputs.Select(x => x.TransTriangleBuffer).ToList());
            input.EdgeBuffer             = RenderingPassBufferStorage.Merge(_inputs.Select(x => x.EdgeBuffer).ToList());
            input.PointBuffer            = RenderingPassBufferStorage.Merge(_inputs.Select(x => x.PointBuffer).ToList());
            return(input);
        }
Пример #4
0
        /// <summary>
        /// Call this method to display geometry on screen.
        /// Call UIDocument.RefreshActiveView() to display geometry.
        /// The servers will be automaticly created and registered.
        /// </summary>
        /// <param name="_serverInputs"></param>
        /// <param name="_addinId"></param>
        public static void ShowGraphics
            (GeometryDrawServerInputs _serverInputs, string _addinId, bool _clearServerOfSameAddin = true)
        {
            if (_serverInputs == null || _addinId == null)
            {
                return;
            }

            //there is an un-documented limit on server buffer size.
            //need to split input into multiple ones, create one server for each,
            //to not to exceed that limit.
            var inputList = _serverInputs.SplitSelf();

            ShowGraphics(inputList, _addinId, _clearServerOfSameAddin);
        }
Пример #5
0
 public GeometryDrawServer(UIDocument _uiDoc, string _addinId, GeometryDrawServerInputs _inputs)
     : this(_uiDoc, _addinId)
 {
     this.Inputs = _inputs;
 }