Exemple #1
0
        public override void GetTableDependecies(vdLayers layers, vdBlocks blocks, vdDimstyles dimstyles, vdLineTypes linetypes, vdTextstyles textstyles, vdImages images, vdHatchPatterns hatchpatterns, object breakOnObject, ref bool breakObjectFound)
        {
            //Since there no extra dependencies the base call is enough.

            vdTableDependeciesArgs vd = new vdTableDependeciesArgs();

            //base.GetTableDependecies(layers, blocks, dimstyles, linetypes, textstyles, images, hatchpatterns, breakOnObject, ref breakObjectFound);
            base.GetTableDependecies(vd);
        }
Exemple #2
0
 public override void GetTableDependecies(vdLayers layers, vdBlocks blocks, vdDimstyles dimstyles, vdLineTypes linetypes, vdTextstyles textstyles, vdImages images, vdHatchPatterns hatchpatterns, object breakOnObject, ref bool breakObjectFound)
 {
     if (breakOnObject != null && breakObjectFound)
     {
         return;
     }
     if (Deleted)
     {
         return;
     }
     //base.GetTableDependecies(layers, blocks, dimstyles, linetypes, textstyles, images, hatchpatterns, breakOnObject, ref breakObjectFound);
     //if (this.mhatchprops != null)
     //{
     //    mhatchprops.GetTableDependecies(layers, blocks, dimstyles, linetypes, textstyles, images, hatchpatterns, breakOnObject, ref breakObjectFound);
     //}
 }
Exemple #3
0
        public override void GetTableDependecies(vdLayers layers, vdBlocks blocks, vdDimstyles dimstyles, vdLineTypes linetypes, vdTextstyles textstyles, vdImages images, vdHatchPatterns hatchpatterns, object breakOnObject, ref bool breakObjectFound)
        {
            if (breakOnObject != null && breakObjectFound)
            {
                return;
            }
            if (Deleted)
            {
                return;
            }
            //base.GetTableDependecies(layers, blocks, dimstyles, linetypes, textstyles, images, hatchpatterns, breakOnObject, ref breakObjectFound);


            vdTableDependeciesArgs vd = new vdTableDependeciesArgs();

            //base.GetTableDependecies(layers, blocks, dimstyles, linetypes, textstyles, images, hatchpatterns, breakOnObject, ref breakObjectFound);
            base.GetTableDependecies(vd);

            if (textstyles != null)
            {
                textstyles.AddItem(mTextStyle);
                if (breakOnObject != null && object.ReferenceEquals(breakOnObject, mTextStyle))
                {
                    breakObjectFound = true;
                    return;
                }
            }
            if (mTextStyle != null)
            {
                vdTableDependeciesArgs vt = new vdTableDependeciesArgs();
                //base.GetTableDependecies(layers, blocks, dimstyles, linetypes, textstyles, images, hatchpatterns, breakOnObject, ref breakObjectFound);

                base.GetTableDependecies(vt);

                //mTextStyle.GetTableDependecies(layers, blocks, dimstyles, linetypes, textstyles, images, hatchpatterns, breakOnObject, ref breakObjectFound);
            }
        }
Exemple #4
0
        /// <summary>
        /// 替换字体
        /// </summary>
        /// <param name="vdbs"></param>
        private void ReplaceText(vdBlocks vdbs, vdDocument doc, double width, double height, string PropName)
        {
            //doc.Purge();
            Dictionary <string, string> BlksMap    = new Dictionary <string, string>();
            Dictionary <string, string> BlksMapTmp = new Dictionary <string, string>();

            //删除车位编号
            foreach (vdFigure vdf in doc.ActiveLayOut.Entities)
            {
                if (vdf is vdInsert)
                {
                    vdInsert    vdi = vdf as vdInsert;
                    vdXProperty vdx = vdi.XProperties.FindName(PropName);
                    if (vdx != null)
                    {
                        string  strName = vdx.PropValue.ToString();
                        vdBlock vdb     = vdi.Block;
                        Box     box     = vdb.BoundingBox();

                        Box textbox            = new Box(new gPoint(box.MidPoint.x - width / 2.0, box.Min.y), new gPoint(box.MidPoint.x + width / 2.0, box.Min.y + height));
                        vdArray <vdFigure> vda = new vdArray <vdFigure>();
                        foreach (vdFigure vdff in vdb.Entities)
                        {
                            if (vdff is vdPolyface)
                            {
                                if (vdff.BoundingBox.BoxInBox(textbox))
                                {
                                    vda.AddItem(vdff);
                                }
                            }
                        }

                        Box b = new Box();
                        foreach (vdFigure vdf1 in vda)
                        {
                            b.AddBox(vdf1.BoundingBox);
                            vdb.Entities.RemoveItem(vdf1);
                        }

                        //文字样式
                        vdTextstyle vdts = doc.TextStyles.FindName("车位编号");
                        if (vdts == null)
                        {
                            vdts        = new vdTextstyle(doc);
                            vdts.Name   = "车位编号";
                            vdts.Height = b.Height;
                            //MessageBox.Show(b.Height.ToString());
                            doc.TextStyles.Add(vdts);
                        }

                        //文字
                        vdText vdt = new vdText(doc);
                        vdt.Style          = vdts;
                        vdt.TextString     = vdx.PropValue.ToString();
                        vdt.HorJustify     = VectorDraw.Professional.Constants.VdConstHorJust.VdTextHorCenter;
                        vdt.VerJustify     = VectorDraw.Professional.Constants.VdConstVerJust.VdTextVerCen;
                        vdt.InsertionPoint = b.MidPoint;
                        vdb.Entities.AddItem(vdt);

                        vdf.Invalidate();
                        vdf.Update();
                        string ssss = GetBlkMd5(vdi.Block);

                        if (!BlksMap.ContainsKey(vdi.Block.Name))
                        {
                            BlksMap.Add(vdi.Block.Name, ssss);
                        }
                        else
                        {
                            MessageBox.Show("可能存在重复编号的车位,请仔细查看!");
                        }
                    }
                }
            }

            //查找md5的计数

            Dictionary <string, int> md5count = new Dictionary <string, int>();

            foreach (KeyValuePair <string, string> kv in BlksMap)
            {
                if (!md5count.ContainsKey(kv.Value))
                {
                    md5count.Add(kv.Value, 1);
                }
                else
                {
                    md5count[kv.Value]++;
                }
            }

            foreach (KeyValuePair <string, string> kv in BlksMap)
            {
                if (md5count[kv.Value] > 1)
                {
                    vdBlock vdb2 = doc.Blocks.FindName(kv.Value);
                    vdBlock vdb  = doc.Blocks.FindName(kv.Key);
                    if (vdb2 == null)  //md5码的块不存在的话
                    {
                        if (vdb != null)
                        {
                            vdBlock vdb1 = vdb.Clone(doc) as vdBlock;
                            for (int i = vdb1.Entities.Count - 1; i >= 0; i--)
                            {
                                if (vdb1.Entities[i] is vdText)
                                {
                                    vdb1.Entities.RemoveItem(vdb1.Entities[i]);
                                }
                            }
                            vdb1.Name = kv.Value;
                            doc.Blocks.Add(vdb1);
                        }
                    }
                    //原来的内容作为一个块,加进去

                    for (int i = vdb.Entities.Count - 1; i >= 0; i--)
                    {
                        if (!(vdb.Entities[i] is vdText))
                        {
                            vdb.Entities.RemoveItem(vdb.Entities[i]);
                        }
                    }

                    //vdb.Entities.RemoveAll();
                    vdInsert vdi = new vdInsert(doc);
                    vdi.Block = doc.Blocks.FindName(kv.Value);  //
                    vdb.Entities.Add(vdi);

                    //将字体加上去

                    vdb.Update();
                }
            }

            //ProCarNum(doc, PropName, width, height);  //处理车位编号
        }