Exemple #1
0
 /// <summary>
 /// Removes a layer from the child layer list
 /// </summary>
 /// <param name="layer">Layer to be removed.</param>
 public virtual void Remove(RenderableObject layer)
 {
     lock (this.m_children.SyncRoot) {
         this.m_children.Remove(layer);
         layer.Dispose();
         layer.ParentList = null;
     }
 }
Exemple #2
0
 public virtual void RemoveAll()
 {
     try {
         while (m_children.Count > 0)
         {
             RenderableObject ro = (RenderableObject)m_children[0];
             m_children.RemoveAt(0);
             ro.Dispose();
         }
     }
     catch {}
 }
 /// <summary>
 /// Removes a layer from the child layer list
 /// </summary>
 /// <param name="objectName">Name of object to remove</param>
 public virtual void Remove(string objectName)
 {
     lock (this.m_children.SyncRoot)
     {
         for (int i = 0; i < this.m_children.Count; i++)
         {
             RenderableObject ro = (RenderableObject)this.m_children[i];
             if (ro.Name.Equals(objectName))
             {
                 this.m_children.RemoveAt(i);
                 ro.Dispose();
                 ro.ParentList = null;
                 break;
             }
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// if ro is chart, then add it to list.
        /// </summary>
        /// <param name="ro"></param>
        public override void Add(RenderableObject ro)
        {
            MyChart c = ro as MyChart;

            if (c == null)
            {
                ro.Dispose();
                return;
            }
            c.ParentWorld = this.ParentWorld;
            base.m_children.Add(ro);
            // the first chart added to this layer
            if (base.Count == 1)
            {
                this.east  = c.Longitude;
                this.west  = c.Longitude;
                this.south = c.Latitude;
                this.north = c.Latitude;
            }
            else
            {
                if (this.east
                    < c.Longitude)
                {
                    this.east = c.Longitude;
                }
                if (this.west
                    > c.Longitude)
                {
                    this.west = c.Longitude;
                }
                if (this.north
                    < c.Latitude)
                {
                    this.north = c.Latitude;
                }
                if (this.south
                    > c.Latitude)
                {
                    this.south = c.Latitude;
                }
            }
            base.Inited = false;
        }
Exemple #5
0
 /// <summary>
 /// if ro is chart, then add it to list.
 /// </summary>
 /// <param name="ro"></param>
 public override void Add(RenderableObject ro)
 {
     MyChart c = ro as MyChart;
     if (c == null) {
         ro.Dispose();
         return;
     }
     c.ParentWorld = this.ParentWorld;
     base.m_children.Add(ro);
     // the first chart added to this layer
     if (base.Count == 1) {
         this.east = c.Longitude;
         this.west = c.Longitude;
         this.south = c.Latitude;
         this.north = c.Latitude;
     }
     else {
         if (this.east
             < c.Longitude) {
             this.east = c.Longitude;
         }
         if (this.west
             > c.Longitude) {
             this.west = c.Longitude;
         }
         if (this.north
             < c.Latitude) {
             this.north = c.Latitude;
         }
         if (this.south
             > c.Latitude) {
             this.south = c.Latitude;
         }
     }
     base.Inited = false;
 }
		/// <summary>
		/// Removes a layer from the child layer list
		/// </summary>
		/// <param name="layer">Layer to be removed.</param>
		public virtual void Remove(RenderableObject layer)
		{
			lock(this.m_children.SyncRoot)
			{
				this.m_children.Remove(layer);
				layer.Dispose();
				layer.ParentList = null;
			}
		}
Exemple #7
0
        /// <summary>
        /// Removes all deleted ROs.  Called only in Update (Worker thread)
        /// </summary>
        private void Remove()
        {
            // get the writer lock for the delList because we need to clear at the end.
            // if we just do a reader lock and upgrade you can get another
            // writer in there which means we'd clear the delList before
            // we remove new items for deletion from the child list.
            m_delRWLock.AcquireWriterLock(Timeout.Infinite);
            try
            {
                // if we need to clear everyone just do it.
                if (m_delAll)
                {
                    if (GetWriterLock(10))
                    {
                        try
                        {
                            while (m_children.Count > 0)
                            {
                                RenderableObject ro = (RenderableObject)m_children[0];
                                m_children.RemoveAt(0);
                                ro.Dispose();
                            }
                        }
                        finally
                        {
                            m_childrenRWLock.ReleaseWriterLock();
                        }
                        m_delAll = false;

                        // we can safely clear the list
                        m_delList.Clear();
                    }
                    else
                    {
                        // try next update cycle
                    }
                }
                else
                {
                    // get a writer lock so we can remove from the child list
                    if (GetWriterLock(10))
                    {
                        try
                        {
                            foreach (object data in m_delList)
                            {
                                RenderableObject rod = data as RenderableObject;
                                if (rod != null)
                                {
                                    this.m_children.Remove(rod);
                                    rod.ParentList = null;
                                    rod.Dispose();
                                }
                                string objectName = data as String;
                                if (objectName != null)
                                {
                                    for (int i = 0; i < this.m_children.Count; i++)
                                    {
                                        RenderableObject ro = (RenderableObject)this.m_children[i];
                                        if (ro.Name.Equals(objectName))
                                        {
                                            this.m_children.RemoveAt(i);
                                            ro.ParentList = null;
                                            ro.Dispose();
                                            break;
                                        }
                                    }
                                }
                            }

                            // we can safely clear the list
                            m_delList.Clear();
                        }
                        finally
                        {
                            m_childrenRWLock.ReleaseWriterLock();
                        }
                    }
                    else
                    {
                        // try next update cycle
                    }
                }
            }
            finally
            {
                m_delRWLock.ReleaseWriterLock();
            }
        }