示例#1
0
        public void addIconicVar(HWndMessage message)
        {
            HObjectEntry entry;

            if (message == null)
            {
                return;
            }

            entry = new HObjectEntry(message);

            if (HObjImageList.Count < 1)
            {
                return;
            }

            if (entry.Message != null)
            {
                //double zoom = 1.0 / xScale;
                double zoom    = entry.Message.coordSystem == "image" ? 1.0 / xScale : 1.0 / originScale;
                double sizeTmp = entry.Message.changeDisplayFontSize(viewPort.hvppleWindow, zoom, currentTextSize);
                currentTextSize = sizeTmp;

                if (isShowMessage)
                {
                    entry.Message.DispMessage(viewPort.hvppleWindow, entry.Message.coordSystem);
                }

                HObjImageList.Add(entry);

                if (HObjImageList.Count > MAXNUMOBJLIST)
                {
                    ((HObjectEntry)HObjImageList[1]).clear();
                    HObjImageList.RemoveAt(1);
                }
            }
        }
示例#2
0
        /********************************************************************/
        /*                      GRAPHICSSTACK                               */
        /********************************************************************/

        /// <summary>
        /// Adds an iconic object to the graphics stack similar to the way
        /// it is defined for the HDevelop graphics stack.
        /// </summary>
        /// <param name="obj">Iconic object</param>
        public void addIconicVar(HObject img)
        {
            //先把HObjImageList给全部释放了,源代码 会出现内存泄漏问题
            for (int i = 0; i < HObjImageList.Count; i++)
            {
                if (HObjImageList[i] != null)
                {
                    ((HObjectEntry)HObjImageList[i]).clear();
                }
            }
            HObjImageList.Clear();



            HObjectEntry entry;

            if (img == null)
            {
                return;
            }

            HTuple classValue = null;

            HOperatorSet.GetObjClass(img, out classValue);
            if (!classValue.S.Equals("image"))
            {
                return;
            }

            HImage obj = new HImage(img);

            if (obj is HImage)
            {
                double r, c;
                int    h, w, area;
                string s;

                area = ((HImage)obj).GetDomain().AreaCenter(out r, out c);
                ((HImage)obj).GetImagePointer1(out s, out w, out h);

                if (area == (w * h))
                {
                    clearList();

                    if ((h != imageHeight) || (w != imageWidth))
                    {
                        imageHeight = h;
                        imageWidth  = w;
                        setImagePart(0, 0, h, w);
                    }
                }        //if
            }            //if

            entry = new HObjectEntry(obj, mGC.copyContextList());

            HObjImageList.Add(entry);

            //每当传入背景图的时候 都清空HObjectList
            clearHRegionList();

            if (HObjImageList.Count > MAXNUMOBJLIST)
            {
                //需要自己手动释放
                ((HObjectEntry)HObjImageList[1]).clear();
                HObjImageList.RemoveAt(1);
            }
        }