Пример #1
0
 private void OnVisualizationHasGeometryUpdate(AnalysisViz analysis)
 {
     // [TODO] check that this analysis is still active
     lock (UpdatePending) {
         UpdatePending.Add(analysis);
     }
 }
Пример #2
0
        void add_type <T>(Func <SceneObject, T> factoryF) where T : class, AnalysisViz
        {
            List <KeyValuePair <DMeshSO, AnalysisViz> > to_add = new List <KeyValuePair <DMeshSO, AnalysisViz> >();

            foreach (var pairs in SOToAnalysis)
            {
                if (pairs.Key is DMeshSO)
                {
                    DMeshSO            so    = pairs.Key as DMeshSO;
                    List <AnalysisViz> types = pairs.Value;
                    bool found = false;
                    for (int i = 0; i < types.Count; ++i)
                    {
                        if (types[i] is T)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (found == false)
                    {
                        AnalysisViz analysis = factoryF(so);
                        to_add.Add(new KeyValuePair <DMeshSO, AnalysisViz>(so, analysis));
                    }
                }
            }
            foreach (var pair in to_add)
            {
                add_new_so_analysis(pair.Key, pair.Value);
            }
        }
Пример #3
0
        /// <summary>
        /// **This may be called from background threads**
        /// </summary>
        private void OnVisualizationRequestedUpdate(AnalysisViz analysis)
        {
            // [TODO] check that this analysis is still active

            lock (ClearPending) {
                if (ClearPending.Contains(analysis) == false)
                {
                    ClearPending.Add(analysis);
                }
            }
            lock (DirtyList) {
                if (DirtyList.Contains(analysis) == false)
                {
                    DirtyList.Add(analysis);
                    processThreadEvent.Set();
                }
            }
        }
Пример #4
0
        void add_new_so_analysis(SceneObject so, AnalysisViz analysis)
        {
            lock (SOToAnalysis) {
                List <AnalysisViz> l;
                if (SOToAnalysis.TryGetValue(so, out l) == false)
                {
                    l = new List <AnalysisViz>();
                    SOToAnalysis[so] = l;
                }
                l.Add(analysis);
            }

            analysis.OnComputeUpdateRequired  += OnVisualizationRequestedUpdate;
            analysis.OnGeometryUpdateRequired += OnVisualizationHasGeometryUpdate;

            lock (DirtyList) {
                DirtyList.Add(analysis);
                processThreadEvent.Set();
            }
        }
Пример #5
0
 void disconnect_analysis(AnalysisViz analysis)
 {
     analysis.OnComputeUpdateRequired  -= OnVisualizationRequestedUpdate;
     analysis.OnGeometryUpdateRequired -= OnVisualizationHasGeometryUpdate;
     analysis.Disconnect();
 }