コード例 #1
0
 internal System.Collections.Generic.List <com.epl.geometry.Geometry> Collect_geometries_to_union(int dim)
 {
     System.Collections.Generic.List <com.epl.geometry.Geometry> batch_to_union = new System.Collections.Generic.List <com.epl.geometry.Geometry>();
     System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <int, com.epl.geometry.OperatorUnionCursor.Bin_type> > entriesToRemove = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <int, com.epl.geometry.OperatorUnionCursor.Bin_type> >();
     System.Collections.Generic.SortedDictionary <int, com.epl.geometry.OperatorUnionCursor.Bin_type> set = m_union_bins[dim];
     foreach (System.Collections.Generic.KeyValuePair <int, com.epl.geometry.OperatorUnionCursor.Bin_type> e in set)
     {
         //int level = e.getKey();
         com.epl.geometry.OperatorUnionCursor.Bin_type bin = e.Value;
         int binVertexThreshold = 10000;
         if (m_b_done || (bin.bin_vertex_count > binVertexThreshold && bin.Geom_count() > 1))
         {
             m_dim_geom_counts[dim] -= bin.Geom_count();
             m_added_geoms          -= bin.Geom_count();
             while (bin.geometries.Count > 0)
             {
                 // empty geometries will be unioned too.
                 batch_to_union.Add(bin.Back_pair().geom);
                 bin.Pop_pair();
             }
             entriesToRemove.Add(e);
         }
     }
     entriesToRemove.ForEach(e => set.Remove(e.Key));
     return(batch_to_union);
 }
コード例 #2
0
        private void Add_geom(int dimension, bool unioned, com.epl.geometry.Geometry geom)
        {
            com.epl.geometry.OperatorUnionCursor.Geom_pair pair = new com.epl.geometry.OperatorUnionCursor.Geom_pair();
            pair.Init();
            pair.geom = geom;
            int sz = Get_vertex_count_(geom);

            pair.vertex_count = sz;
            int level = Get_level_(sz);

            if (dimension + 1 > (int)m_union_bins.Count)
            {
                for (int i = 0, n = System.Math.Max(2, dimension + 1); i < n; i++)
                {
                    m_union_bins.Add(new System.Collections.Generic.SortedDictionary <int, com.epl.geometry.OperatorUnionCursor.Bin_type>());
                }
            }
            //com.epl.geometry.OperatorUnionCursor.Bin_type bin = m_union_bins[dimension][level];
            //return null if level is abscent
            com.epl.geometry.OperatorUnionCursor.Bin_type bin;
            if (!m_union_bins[dimension].TryGetValue(level, out bin))
            {
                bin = new com.epl.geometry.OperatorUnionCursor.Bin_type();
                m_union_bins[dimension][level] = bin;
            }
            pair.unioned = unioned;
            bin.Add_pair(pair);
            // Update global cursor state
            m_dim_geom_counts[dimension]++;
            m_added_geoms++;
            m_max_dimension = System.Math.Max(m_max_dimension, dimension);
        }
コード例 #3
0
        private com.epl.geometry.Geometry Get_result_geometry(int dim)
        {
            System.Diagnostics.Debug.Assert((m_dim_geom_counts[dim] > 0));
            System.Collections.Generic.SortedDictionary <int, com.epl.geometry.OperatorUnionCursor.Bin_type> map = m_union_bins[dim];
            System.Collections.Generic.KeyValuePair <int, com.epl.geometry.OperatorUnionCursor.Bin_type>     e   = map.First();
            com.epl.geometry.OperatorUnionCursor.Bin_type bin = e.Value;
            com.epl.geometry.Geometry resG;
            resG = bin.Back_pair().geom;
            bool unioned = bin.Back_pair().unioned;

            map.Remove(e.Key);
            if (unioned)
            {
                resG = com.epl.geometry.OperatorSimplify.Local().Execute(resG, m_spatial_reference, false, m_progress_tracker);
                if (dim == 0 && resG.GetType() == com.epl.geometry.Geometry.Type.Point)
                {
                    // must
                    // return
                    // multipoint
                    // for
                    // points
                    com.epl.geometry.MultiPoint mp = new com.epl.geometry.MultiPoint(resG.GetDescription());
                    if (!resG.IsEmpty())
                    {
                        mp.Add((com.epl.geometry.Point)resG);
                    }
                    resG = mp;
                }
            }
            return(resG);
        }