Exemplo n.º 1
0
        /// <summary>
        /// Set the spatial field values for the current spatial field primitive.  The two
        /// input sequences should be of the same length.
        /// </summary>
        /// <param name="pointLocations"></param>
        /// <param name="values"></param>
        /// <param name="data"></param>
        /// <param name="primitiveIds"></param>
        /// <param name="schemaName"></param>
        /// <param name="description"></param>
        /// <param name="unitType"></param>
        private void InternalSetSpatialFieldValues(IStructuredData <Point, double> data, ref List <int> primitiveIds, string schemaName, string description, Type unitType)
        {
            TransactionManager.Instance.EnsureInTransaction(Document);

            // We chunk here because the API has a limitation for the
            // number of points that can be sent in one run.

            var chunkSize = 1000;

            var dataLocations = data.ValueLocations.Select(l => l.ToXyz());
            var values        = data.Values.ToList();

            while (dataLocations.Any())
            {
                // Compute the chunks
                var pointLocationChunk = dataLocations.Take(chunkSize);
                var valuesChunk        = values.Take(chunkSize).ToList();

                // Create the ValueAtPoint objects
                var valList = valuesChunk.Select(n => new ValueAtPoint(new List <double> {
                    n
                }));

                // Create the field domain points and values
                var samplePts    = new FieldDomainPointsByXYZ(pointLocationChunk.ToList());
                var sampleValues = new FieldValues(valList.ToList());

                // Get the analysis results schema
                var schemaIndex = GetAnalysisResultSchemaIndex(schemaName, description, unitType);

                // Update the values
                var primitiveId = SpatialFieldManager.AddSpatialFieldPrimitive();
                primitiveIds.Add(primitiveId);
                SpatialFieldManager.UpdateSpatialFieldPrimitive(primitiveId, samplePts, sampleValues, schemaIndex);

                dataLocations = dataLocations.Skip(chunkSize);
                values        = values.Skip(chunkSize).ToList();
            }

            TransactionManager.Instance.TransactionTaskDone();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Starts a new structured data logical operation scope, typically output as additional structured properties.
 /// </summary>
 /// <param name="structuredData">The additional structured data to include</param>
 /// <returns>A scope object that ends the scope whem disposed.</returns>
 public IDisposable BeginScope(IStructuredData structuredData)
 {
     return(new StructuredDataScope(structuredData));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor.
        /// Encompases a logical operation with the specified structured data properties.
        /// </summary>
//        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands")]
        public StructuredDataScope(IStructuredData structuredData)
        {
            Trace.CorrelationManager.StartLogicalOperation(structuredData);
        }