Inheritance: IDisposable
コード例 #1
0
 public void Dispose()
 {
     if (_sites != null)
     {
         _sites.Dispose();
         _sites = null;
     }
     if (_triangles != null)
     {
         int count = _triangles.Count;
         for (int i = 0; i < count; i++)
         {
             _triangles[i].Dispose();
         }
         _triangles.Clear();
         _triangles = null;
     }
     if (_edges != null)
     {
         int count = _edges.Count;
         for (int i = 0; i < count; i++)
         {
             _edges[i].Dispose();
         }
         _edges.Clear();
         _edges = null;
     }
     _sitesIndexedByLocation = null;
 }
コード例 #2
0
ファイル: Voronoi.cs プロジェクト: VB6Hobbyst7/Delaunay-2
        public void Dispose()
        {
            int i, n;

            if (_sites != null)
            {
                _sites.Dispose();
                _sites = null;
            }
            if (_triangles != null)
            {
                n = _triangles.Count;
                for (i = 0; i < n; ++i)
                {
                    _triangles[i].Dispose();
                }
                _triangles.Clear();
                _triangles = null;
            }
            if (_edges != null)
            {
                n = _edges.Count;
                for (i = 0; i < n; ++i)
                {
                    _edges[i].Dispose();
                }
                _edges.Clear();
                _edges = null;
            }
            _plotBounds             = new RectangleF();
            _sitesIndexedByLocation = null;
        }
コード例 #3
0
ファイル: Voronoi.cs プロジェクト: WilliamChao/nmap
		public void Dispose ()
		{
			int i, n;
			if (_sites != null) {
				_sites.Dispose ();
				_sites = null;
			}
			if (_triangles != null) {
				n = _triangles.Count;
				for (i = 0; i < n; ++i) {
					_triangles [i].Dispose ();
				}
				_triangles.Clear ();
				_triangles = null;
			}
			if (_edges != null) {
				n = _edges.Count;
				for (i = 0; i < n; ++i) {
					_edges [i].Dispose ();
				}
				_edges.Clear ();
				_edges = null;
			}
//			_plotBounds = null;
			_sitesIndexedByLocation = null;
		}
コード例 #4
0
        public void Dispose()
        {
            int i, n;

            if (SitesList != null)
            {
                SitesList.Dispose();
                SitesList = null;
            }
            if (_triangles != null)
            {
                n = _triangles.Count;
                for (i = 0; i < n; ++i)
                {
                    _triangles [i].Dispose();
                }
                _triangles.Clear();
                _triangles = null;
            }
            if (_edges != null)
            {
                n = _edges.Count;
                for (i = 0; i < n; ++i)
                {
                    _edges [i].Dispose();
                }
                _edges.Clear();
                _edges = null;
            }
//			_plotBounds = null;
            _sitesIndexedByLocation = null;
        }
コード例 #5
0
ファイル: Voronoi.cs プロジェクト: VB6Hobbyst7/Delaunay-2
 public Voronoi(List <PointF> PointFs, List <uint> colors, RectangleF plotBounds)
 {
     _sites = new SiteList();
     _sitesIndexedByLocation = new Dictionary <PointF, Site>();
     AddSites(PointFs, colors);
     _plotBounds = plotBounds;
     _triangles  = new List <Triangle>();
     _edges      = new List <Edge>();
     FortunesAlgorithm();
 }
コード例 #6
0
ファイル: Voronoi.cs プロジェクト: WilliamChao/nmap
		public Voronoi (List<Vector2> points, List<uint> colors, Rect plotBounds)
		{
			_sites = new SiteList ();
			_sitesIndexedByLocation = new Dictionary <Vector2,Site> (); // XXX: Used to be Dictionary(true) -- weak refs. 
			AddSites (points, colors);
			_plotBounds = plotBounds;
			_triangles = new List<Triangle> ();
			_edges = new List<Edge> ();
			FortunesAlgorithm ();
		}
コード例 #7
0
 public Voronoi(List <Vector2> points, List <uint> colors, Rect plotBounds)
 {
     _sites = new SiteList();
     _sitesIndexedByLocation = new Dictionary <Vector2, Site> ();            // XXX: Used to be Dictionary(true) -- weak refs.
     AddSites(points, colors);
     _plotBounds = plotBounds;
     _triangles  = new List <Triangle> ();
     _edges      = new List <Edge> ();
     FortunesAlgorithm();
 }
コード例 #8
0
ファイル: Voronoi.cs プロジェクト: ngarside/UnityDelaunay
 public Voronoi(List<Vector2> Vector2s, List<uint> colors, Rect plotBounds)
 {
     _sites = new SiteList();
     _sitesIndexedByLocation = new Dictionary<Vector2, Site>();
     AddSites(Vector2s, colors);
     _plotBounds = plotBounds;
     _triangles = new List<Triangle>();
     _edges = new List<Edge>();
     FortunesAlgorithm();
 }
コード例 #9
0
        private void Init(List <Vector2f> points, Rectf plotBounds)
        {
            sites = new SiteList();
            sitesIndexedByLocation = new Dictionary <Vector2f, Site>();
            AddSites(points);
            this.plotBounds = plotBounds;
            triangles       = new List <Triangle>();
            edges           = new List <Edge>();

            FortunesAlgorithm();
        }
コード例 #10
0
 private void Init(List <Vector2> points, Rect plotBounds, List <uint> colors = null)
 {
     SitesList = new SiteList();
     _sitesIndexedByLocation = new Dictionary <Vector2, Site> ();            // XXX: Used to be Dictionary(true) -- weak refs.
     AddSites(points, colors);
     _plotBounds = plotBounds;
     _triangles  = new List <Triangle> ();
     _edges      = new List <Edge> ();
     FortunesAlgorithm();
     Regions();
 }
コード例 #11
0
ファイル: Voronoi.cs プロジェクト: r2d2m/FantasyMapGenerator
        public Voronoi(List <PointF> PointFs, Extent extentPlotBounds)
        {
            var plotBounds = new RectangleF((float)extentPlotBounds.x, (float)extentPlotBounds.y, (float)extentPlotBounds.width, (float)extentPlotBounds.height);

            _sites = new SiteList();
            _sitesIndexedByLocation = new Dictionary <PointF, Site>();
            AddSites(PointFs, null);
            _plotBounds = plotBounds;
            _triangles  = new List <Triangle>();
            _edges      = new List <Edge>();
            FortunesAlgorithm();
        }
コード例 #12
0
 public Voronoi(List <Bubbles.Node> nodes, Rect plotBounds)         //jf
 {
     if (_sites == null)
     {
         _sites = new SiteList();                                 //thereafter maintain it in parallel with nodes
     }
     _sitesIndexedByLocation = new Dictionary <Vector2, Site> (); // XXX: Used to be Dictionary(true) -- weak refs.
     AddSites(nodes);                                             //jf
     _plotBounds = plotBounds;
     _triangles  = new List <Triangle> ();
     _edges      = new List <Edge> ();
     FortunesAlgorithm();
 }
コード例 #13
0
        private void Init(List <Vector2> points, Rect plotBounds)
        {
            _sites = new SiteList();
            _sitesIndexedByLocation = new Dictionary <Vector2, Site>();
            List <uint> colors = new List <uint>();

            for (int i = 0; i < points.Count; i++)
            {
                colors.Add(0);
            }
            AddSites(points, colors);
            this._plotBounds = plotBounds;
            _triangles       = new List <Triangle>();
            _edges           = new List <Edge>();

            FortunesAlgorithm();
        }
コード例 #14
0
        public Voronoi(List <Vector2> points, List <uint> colors, List <float> weights, Rect plotBounds)
        {
            _plotBounds             = plotBounds;
            min_weight              = 3.40282347E+38f;
            max_weight              = -3.40282347E+38f;
            _sites                  = new SiteList();
            _sitesIndexedByLocation = new Dictionary <Vector2, Site>();
            _triangles              = new List <Triangle>();
            _edges                  = new List <Edge>();
            AddSites(points, colors, weights);
            float num = max_weight - min_weight;

            if (num > 0f)
            {
                _sites.ScaleWeight(1f + num);
            }
            FortunesAlgorithm();
        }
コード例 #15
0
        public void Dispose()
        {
            sites.Dispose();
            sites = null;

            foreach (Triangle t in triangles)
            {
                t.Dispose();
            }
            triangles.Clear();

            foreach (Edge e in edges)
            {
                e.Dispose();
            }
            edges.Clear();

            plotBounds = Rectf.zero;
            sitesIndexedByLocation.Clear();
            sitesIndexedByLocation = null;
        }
コード例 #16
0
        //jfcomment: This is never called, so pools are not maintained. I tried calling it before every use of new Voronoi, but it only slowed things down.
        //Some of the _pools are used during voronoi computation, but the _sites._sites pool is only pushed into on _sites.Dispose.
        //_pools are statics. Since I now maintain pointers to sites in Engine.nodes, there is no need to pool sites, and calling _sites.Dispose
        //would fill up the _sites pool, and make a memory leak.
        //I think the coder of Voronoi made a mistake to abuse iDispose and dispose to frustrate the gc (keep pools), it's the exact opposite of their normal usage.
        //It would have been better to name them "recycle" or something.
        public void Dispose()
        {
            if (Debug.isDebugBuild)
            {
                Debug.Log("ERROR, Voronoi.Dispose!!");                             //jf
            }
            int i, n;

            if (_sites != null)
            {
                _sites.Dispose();
                _sites = null;
            }
            if (_triangles != null)
            {
                n = _triangles.Count;
                for (i = 0; i < n; ++i)
                {
                    _triangles [i].Dispose();
                }
                _triangles.Clear();
                _triangles = null;
            }
            if (_edges != null)
            {
                n = _edges.Count;
                for (i = 0; i < n; ++i)
                {
                    _edges [i].Dispose();
                }
                _edges.Clear();
                _edges = null;
            }
//			_plotBounds = null;
            _sitesIndexedByLocation = null;
        }