}                                       //填充设计

        public HatchRectDesignClass(HatchRectItemModel hatchRectItemModel)
        {
            this.ItemConstructor(hatchRectItemModel.ID, hatchRectItemModel.ItemShowName
                                 , hatchRectItemModel.ItemOrder, hatchRectItemModel.ItemSubStyle
                                 , hatchRectItemModel.ItemShowNamePosition);
            this.Color_FromFiled      = StrUtil.GetNoNullStr(hatchRectItemModel.Color_FromField);
            this.ItemFromTable        = StrUtil.GetNoNullStr(hatchRectItemModel.ItemFromTable);
            this.Xfield               = StrUtil.GetNoNullStr(hatchRectItemModel.Xfield);
            this.Y_TopField           = StrUtil.GetNoNullStr(hatchRectItemModel.Y_TopField);
            this.Y_BottomField        = StrUtil.GetNoNullStr(hatchRectItemModel.Y_BottomField);
            this.ItemUnit             = StrUtil.GetNoNullStr(hatchRectItemModel.ItemUnit);
            this.UnitPosition         = EnumUtil.GetEnumByStr(hatchRectItemModel.UnitPosition, CJQXUnitPosition.RightPos);
            this.KDCIfShow            = BoolUtil.GetBoolByBindID(hatchRectItemModel.KDCIfShow, true);
            this.ShowNameVSKDCHeigh   = StrUtil.StrToDouble(hatchRectItemModel.ShowNameVSKDCHeigh, 5, "起始位置设计有误,为非数值型");
            this.ItemHeaderStartheigh = StrUtil.StrToDouble(hatchRectItemModel.ItemHeaderStartheigh, 3, "起始位置非数值型");
            ItemHatch = new LJJSHatch(hatchRectItemModel.FillMode
                                      , hatchRectItemModel.IsDrawBoundary
                                      , hatchRectItemModel.HatchPenColor
                                      , hatchRectItemModel.HatchPenWidth
                                      , hatchRectItemModel.FillBKColor
                                      , hatchRectItemModel.FillColor
                                      , hatchRectItemModel.HatchPattern
                                      , hatchRectItemModel.HatchScale
                                      , hatchRectItemModel.HatchBlk, "");
            hrItemSubStyle = EnumUtil.GetEnumByStr(this.ItemSubStyle, HatchRectItemSubStyle.DirectFill);
        }
Exemplo n.º 2
0
        public static void AddAreaHatch(vdDocument activeDocument, LJJSHatch ljjsHatch, Vertexes fillArea)
        {
            if (null == fillArea || fillArea.Count < 3)
            {
                return;
            }
            //We will create a vdPolyline object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdPolyline onepoly = new VectorDraw.Professional.vdFigures.vdPolyline();
            //We set the document where the polyline is going to be added.This is important for the vdPolyline in order to obtain initial properties with setDocumentDefaults.
            onepoly.SetUnRegisterDocument(activeDocument);
            onepoly.setDocumentDefaults();

            //The two previus steps are important if a vdFigure object is going to be added to a document.
            //Now we will change some properties of the polyline.
            onepoly.VertexList = fillArea;


            onepoly.Flag = VectorDraw.Professional.Constants.VdConstPlineFlag.PlFlagCLOSE;
            //  onepoly.SPlineFlag = VectorDraw.Professional.Constants.VdConstSplineFlag.SFlagQUADRATIC;

            onepoly.PenColor.SystemColor = Color.FromArgb(ljjsHatch.PenColor);
            //Now we will change the hacth properties of this polyline.Hatch propertis have all curve figures(circle,arc,ellipse,rect,polyline).
            //Initialize the hatch properties object.
            onepoly.HatchProperties = new VectorDraw.Professional.vdObjects.vdHatchProperties();
            //And change it's properties
            onepoly.HatchProperties.FillMode = ConvertToVDFillMode(ljjsHatch.FillMode);

            if (ljjsHatch.FillMode.Equals(LJJSFillMode.ModeHatchPattern))
            {
                if (!string.IsNullOrEmpty(ljjsHatch.HatchPattern))
                {
                    onepoly.HatchProperties.HatchPattern = activeDocument.HatchPatterns.FindName(ljjsHatch.HatchPattern);
                }
            }
            if (ljjsHatch.FillMode.Equals(LJJSFillMode.ModeHatchBlock))
            {
                if (!string.IsNullOrEmpty(ljjsHatch.HatchBlk))
                {
                    onepoly.HatchProperties.HatchBlock = activeDocument.Blocks.FindName(ljjsHatch.HatchBlk);
                }
            }

            onepoly.HatchProperties.FillColor.SystemColor   = Color.FromArgb(ljjsHatch.FillColor);
            onepoly.HatchProperties.FillBkColor.SystemColor = Color.FromArgb(ljjsHatch.FillBKColor);
            onepoly.HatchProperties.DrawBoundary            = ljjsHatch.IsDrawBoundary;
            onepoly.HatchProperties.HatchScale = ljjsHatch.HatchScale;
            onepoly.PenColor.SystemColor       = Color.FromArgb(ljjsHatch.PenColor);
            onepoly.PenWidth = ljjsHatch.PenWidth;


            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onepoly);
            //fc
            //gPoint g1 = new gPoint(0, 0);
            //gPoint g2 = new gPoint(0, 10);
            //activeDocument.ActiveLayOut.ZoomWindow(g1ff,g2 );
        }
Exemplo n.º 3
0
        public void CurvesBuildExec(List <LJJSPoint> drawptcol, LJJSHatch itemHatch, List <LJJSPoint> boundaryLinePtList)
        {
            List <List <LJJSPoint> > hatchBoundary = new List <List <LJJSPoint> >();

            hatchBoundary.Add(boundaryLinePtList);
            hatchBoundary.Add(drawptcol);
            Layer.Layer_SetToCurrent(_keDuChiItem.KName);
            MyHatch.AddPolyHatch(DrawCommonData.activeDocument, hatchBoundary, itemHatch);
        }
Exemplo n.º 4
0
        public static void AddPolyHatch(vdDocument activeDocument, LJJSHatch ljjsHatch, List <vdCurves> curvesLst)
        {
            //  buthatch.Enabled = false;
            //We will create a vdPolyHatch object and add it to the Active Layout which is the basic Model Layout always existing in a Document.
            VectorDraw.Professional.vdFigures.vdPolyhatch onehatch = new VectorDraw.Professional.vdFigures.vdPolyhatch();
            //We set the document where the hatch is going to be added.This is important for the vdPolyhatch in order to obtain initial properties with setDocumentDefaults.
            onehatch.SetUnRegisterDocument(activeDocument);
            onehatch.setDocumentDefaults();
            if (null != curvesLst && curvesLst.Count > 0)
            {
                for (int i = 0; i < curvesLst.Count; i++)
                {
                    if (null != curvesLst[i] && curvesLst[i].Count > 2)
                    {
                        onehatch.PolyCurves.AddItem(curvesLst[i]);
                    }
                }
            }
            else
            {
                return;
            }
            if (onehatch.PolyCurves.Count < 1)
            {
                return;
            }
            onehatch.HatchProperties          = new VectorDraw.Professional.vdObjects.vdHatchProperties();
            onehatch.HatchProperties.FillMode = ConvertToVDFillMode(ljjsHatch.FillMode);
            if (ljjsHatch.FillMode.Equals(LJJSFillMode.ModeHatchPattern))
            {
                if (!string.IsNullOrEmpty(ljjsHatch.HatchPattern))
                {
                    onehatch.HatchProperties.HatchPattern = activeDocument.HatchPatterns.FindName(ljjsHatch.HatchPattern);
                }
            }
            if (ljjsHatch.FillMode.Equals(LJJSFillMode.ModeHatchBlock))
            {
                if (!string.IsNullOrEmpty(ljjsHatch.HatchBlk))
                {
                    onehatch.HatchProperties.HatchBlock = activeDocument.Blocks.FindName(ljjsHatch.HatchBlk);
                }
            }
            onehatch.HatchProperties.FillColor.SystemColor   = System.Drawing.Color.FromArgb(ljjsHatch.FillColor);
            onehatch.HatchProperties.FillBkColor.SystemColor = System.Drawing.Color.FromArgb(ljjsHatch.FillBKColor);
            onehatch.HatchProperties.DrawBoundary            = ljjsHatch.IsDrawBoundary;

            onehatch.HatchProperties.HatchScale = ljjsHatch.HatchScale;

            onehatch.PenColor.SystemColor = System.Drawing.Color.FromArgb(ljjsHatch.PenColor);
            onehatch.PenWidth             = ljjsHatch.PenWidth;


            //Now we will add this object to the Entities collection of the Model Layout(ActiveLayout).
            activeDocument.ActiveLayOut.Entities.AddItem(onehatch);
        }
        public NormalPuTuDesignClass(NormalPuTuItemModel nPTModel)
        {
            this.ItemConstructor(nPTModel.ID
                                 , nPTModel.ItemShowName, nPTModel.ItemOrder
                                 , nPTModel.ItemSubStyle, nPTModel.TitlePosition);
            this.Main_GWJSField        = StrUtil.GetNoNullStr(nPTModel.Main_GWJSField);
            this.Main_YYWZField        = StrUtil.GetNoNullStr(nPTModel.Main_YYWZField);
            this.Main_TableName        = StrUtil.GetNoNullStr(nPTModel.Main_TableName);
            this.ClosedArea_Table      = StrUtil.GetNoNullStr(nPTModel.ClosedArea_Table);
            this.ClosedArea_Field_X    = StrUtil.GetNoNullStr(nPTModel.ClosedArea_Field_X);
            this.ClosedArea_Feild_Y    = StrUtil.GetNoNullStr(nPTModel.ClosedArea_Feild_Y);
            this.ClosedArea_Field_YYWZ = StrUtil.GetNoNullStr(nPTModel.ClosedArea_Field_YYWZ);


            this.TitleUint         = StrUtil.GetNoNullStr(nPTModel.TitleUint);
            this.TitleUnitPosition = EnumUtil.GetEnumByStr(nPTModel.TitleUnitPosition, CJQXUnitPosition.MidBottomPos);

            this.ItemNameVSKDCHeigh = StrUtil.StrToDouble(nPTModel.ItemNameVSKDCHeigh, 5, "非数值型");
            this.FirstKDCStartHeigh = StrUtil.StrToDouble(nPTModel.FirstKDCStartHeigh, 3, "非数值型");
            FenJieValueDic          = new Dictionary <int, double>();
            if (!string.IsNullOrEmpty(nPTModel.FenJieValueSet))
            {
                string[] strarr = nPTModel.FenJieValueSet.Split(CommonDeignValue.FenJiValueSplitter);
                if (strarr.Length > 0)
                {
                    for (int i = 0; i < strarr.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(strarr[i]))
                        {
                            double fenji = StrUtil.StrToDouble(strarr[i], -1, "分级设计非数值");
                            FenJieValueDic.Add(i, fenji);
                        }
                    }
                }
            }
            HatchDic = new Dictionary <int, LJJSHatch>();
            if (!string.IsNullOrEmpty(nPTModel.HatchColorSet))
            {
                string[] strarr = nPTModel.HatchColorSet.Split(CommonDeignValue.HatchSplitter);
                if (strarr.Length > 0)
                {
                    for (int i = 0; i < strarr.Length; i++)
                    {
                        if (!string.IsNullOrEmpty(strarr[i]))
                        {
                            LJJSHatch hatch = new LJJSHatch(strarr[i], bool.TrueString);
                            HatchDic.Add(i, hatch);
                        }
                    }
                }
            }
        }
        private List <HatchRectDrawStrut> GetPerJDDrawStructLst(JDStruc jdStruc)
        {
            LJJSPoint lrptstart = ZuoBiaoOper.UpdateLRStartPt(drawkdc.KDir, jdStruc.JDPtStart, lineRoadEnvironment.LineRoadWidth);
            double    jdTop     = jdStruc.JDtop;
            double    jdBottom  = jdStruc.JDBottom;


            List <HatchRectDrawStrut> hrdsLst = new List <HatchRectDrawStrut>();

            if (null == itemDataTable || itemDataTable.Rows.Count < 1)
            {
                return(hrdsLst);
            }
            string sql = GetItemSqlTxt(jdTop.ToString(), jdBottom.ToString());

            DataRow[] drs = itemDataTable.Select(sql, itemDesignStruc.Y_TopField + " ASC");
            if (itemDesignStruc.hrItemSubStyle.Equals(HatchRectItemSubStyle.ColorField))
            {
                foreach (DataRow dr in drs)
                {
                    List <LJJSPoint> areaLst = GetFillAreaPtLst(lrptstart, jdTop, jdBottom, dr);
                    string           color   = dr[itemDesignStruc.Color_FromFiled].ToString();
                    if (colorDic.ContainsKey(color))
                    {
                        string             colorvalue = colorDic[color];
                        LJJSHatch          ljjsHatch  = new LJJSHatch(colorvalue, bool.FalseString);
                        HatchRectDrawStrut hrds       = new HatchRectDrawStrut(areaLst, ljjsHatch);
                        hrdsLst.Add(hrds);
                    }
                }
            }
            else
            {
                foreach (DataRow dr in drs)
                {
                    List <LJJSPoint> areaLst = GetFillAreaPtLst(lrptstart, jdTop, jdBottom, dr);

                    LJJSHatch          ljjsHatch = itemDesignStruc.ItemHatch;
                    HatchRectDrawStrut hrds      = new HatchRectDrawStrut(areaLst, ljjsHatch);
                    hrdsLst.Add(hrds);
                }
            }
            return(hrdsLst);
        }
Exemplo n.º 7
0
 }                                        //三级填充颜色,最靠线道一侧的填充
 public MultiHatchCurveDesignClass(MultiHatchCurveItemModel mHatchItem)
 {
     this.ItemConstructor(mHatchItem.ID
                          , mHatchItem.ItemShowName, mHatchItem.ItemOrder
                          , "", mHatchItem.ItemShowNamePosition);
     this.ItemFromTable        = StrUtil.GetNoNullStr(mHatchItem.ItemFromTable);
     this.Xfield               = StrUtil.GetNoNullStr(mHatchItem.Xfield);
     this.Yfield               = StandardCurveItemBuilder.GetJSField(mHatchItem.Yfield);
     this.FenJieValueOne       = StrUtil.StrToDouble(mHatchItem.FenJieValueOne, -1, "分界值1为非数值型");
     this.FenJieValueTwo       = StrUtil.StrToDouble(mHatchItem.FenJieValueTwo, -1, "分界值2为非数值型");
     this.ItemUnit             = StrUtil.GetNoNullStr(mHatchItem.ItemUnit);
     this.UnitPosition         = EnumUtil.GetEnumByStr(mHatchItem.UnitPosition, CJQXUnitPosition.MidBottomPos);
     this.KDCIfShow            = BoolUtil.GetBoolByBindID(mHatchItem.KDCIfShow, true);
     this.ShowNameVSKDCHeigh   = StrUtil.StrToDouble(mHatchItem.ShowNameVSKDCHeigh, 5, "绘图项题目与刻度尺距离非数值型");
     this.ItemHeaderStartheigh = StrUtil.StrToDouble(mHatchItem.ItemHeaderStartheigh, 3, "非数值型");
     this.HatchCount           = StrUtil.StrToInt(mHatchItem.HatchCount, 1, "填充级数非数值型");
     this.HatchOne             = new LJJSHatch(mHatchItem.HatchColorOne, bool.FalseString);
     this.HatchTwo             = new LJJSHatch(mHatchItem.HatchColorTwo, bool.FalseString);
     this.HatchThree           = new LJJSHatch(mHatchItem.HatchColorThree, bool.FalseString);
 }
Exemplo n.º 8
0
 public HatchRectDrawStrut(List <LJJSPoint> fillArea, LJJSHatch ljjsHatch)
 {
     this.FillArea  = fillArea;
     this.LjjsHatch = ljjsHatch;
 }
        //每次给两条线两次相交的交点之间涂色 , 两个交点之间line1在右边则为红色 line2在右边则为绿色
        public static void Gei_Qu_Xian_De_Jiao_Dian_Nei_Bu_Tu_Se_Quicker(Color line1_color, Color line2_color, List <LJJSPoint> line1, List <LJJSPoint> line2, LineItemStruct lineItemStruct, int index) //给曲线交点内部涂色
        {
            if (lineItemStruct.LiSubClass.Equals("wxcs2") || lineItemStruct.LiSubClass.Equals("jgl"))
            {        //物性指数交汇和进给量的数据有问题,其中一个在y值相同时有两个x值,另外一个比另一个多4个点 需要进行处理
                if (line1.Count != line2.Count)
                {
                    List <LJJSPoint> list = MsehAndMsevContainer.findLostPoints(line1, line2);//寻找多出的点
                    if (DrawPointContainer.list[index].JinGeiLiangList != null)
                    {
                        bool res1 = MsehAndMsevContainer.check_Multi_Same_YValue(line1);
                        bool res2 = MsehAndMsevContainer.check_Multi_Same_YValue(line2);
                        //若为true,则代表具有此list中有两个点的y值相同,x值不同,需要去掉


                        List <LJJSPoint> same_Y_list;
                        if (res1 == true)
                        {
                            same_Y_list = MsehAndMsevContainer.same_YValue_PointsList(line1);
                            if (same_Y_list.Count > 0)
                            {
                                for (int i = 0; i < same_Y_list.Count - 1; i++)
                                {
                                    line1.Remove(same_Y_list[i]);
                                }
                            }
                        }

                        if (res2 == true)
                        {
                            same_Y_list = MsehAndMsevContainer.same_YValue_PointsList(line2);
                            if (same_Y_list.Count > 0)
                            {
                                for (int i = 0; i < same_Y_list.Count - 1; i++)
                                {
                                    line2.Remove(same_Y_list[i]);
                                }
                            }
                        }

                        int jingeiliang1 = line1.Count;
                        int wxcs1        = line2.Count;

                        foreach (LJJSPoint point in list)
                        {
                            line2.Remove(point);   //去掉多出的点
                        }


                        bool rrr = MsehAndMsevContainer.checkSameYValue_orNot(line1, line2); //检测两个list中所有的点的y值能不能对应上
                        if (rrr == false)                                                    //对应不上,则直接返回
                        {
                            MessageBox.Show("两个曲线上的点的个数不同,错误");
                            MessageBox.Show(line1.Count.ToString());
                            MessageBox.Show(line2.Count.ToString());
                            return;
                        }
                    }

                    //StringBuilder sb = new StringBuilder();

                    /**if (list != null)
                     * {
                     *  foreach (LJJSPoint item in list)
                     *  {
                     *      sb.Append(string.Format("多出的点坐标:({0},{1})", item.XValue.ToString(), item.YValue.ToString()));
                     *      sb.Append("\r\n");
                     *  }
                     * }
                     * MessageBox.Show(sb.ToString());**/
                }
            }



            for (int i = 0; i < line1.Count; i++)
            {
                if (double.IsNaN(line1[i].XValue) == true || double.IsInfinity(line1[i].XValue) == true)
                {
                    MessageBox.Show(string.Format("值是NaN,第{0}个", i));
                }
                if (double.IsNaN(line2[i].XValue) == true || double.IsInfinity(line2[i].XValue) == true)
                {
                    MessageBox.Show(string.Format("值是NaN,第{0}个", i));
                }
                if (line1[i].YValue != line2[i].YValue)
                {
                    MessageBox.Show("两个曲线上的点的YValue不同,错误");
                    return;
                }
            }
            //MessageBox.Show("正确,可以涂色");

            vdDocument activeDOcu = DrawCommonData.activeDocument;

            //对两条线,每次在找到两条线的交点 后涂色
            int              j                   = 0;
            LJJSPoint        last_jiaoDian       = null;
            LJJSPoint        curr_jiaoDian       = null;
            List <LJJSPoint> part_left_list      = new List <LJJSPoint>();
            List <LJJSPoint> part_right_list     = new List <LJJSPoint>();
            bool             is_line1_bigger     = false;
            bool             curr_jiaodian_found = false;

            while (true)
            {
                part_left_list.Clear();
                part_right_list.Clear();

                //LJJSPoint jiaoDianPoint = null;
                if (j == line1.Count)
                {
                    break;
                }
                is_line1_bigger     = false;
                curr_jiaodian_found = false;
                LJJSPoint line1_point = null;
                LJJSPoint line2_point = null;
                #region

                //寻找两个曲线焦点之间的封闭区域
                for (; j < line1.Count; j++)
                {
                    line1_point = line1[j];
                    line2_point = line2[j];
                    if (line1_point.XValue > line2_point.XValue)
                    {
                        is_line1_bigger = true;

                        part_left_list.Add(line2_point);
                        part_right_list.Add(line1_point);
                    }
                    else if (line1_point.XValue < line2_point.XValue)
                    {
                        is_line1_bigger = false;
                        part_left_list.Add(line1_point);
                        part_right_list.Add(line2_point);
                    }
                    if (line1_point.XValue == line2_point.XValue && line1_point.YValue == line2_point.YValue)
                    {
                        //找到了焦点
                        curr_jiaoDian       = line1_point;
                        curr_jiaodian_found = true;
                        j++;
                        break;
                    }

                    if (j + 1 < line1.Count)
                    {
                        if ((line1_point.XValue < line2_point.XValue && line1[j + 1].XValue > line2[j + 1].XValue) || (line1_point.XValue > line2_point.XValue && line1[j + 1].XValue < line2[j + 1].XValue))
                        {  //用函数粗略找到交点坐标
                            curr_jiaoDian       = GetJiaoDIan.getjiaoDian(line1_point, line1[j + 1], line2_point, line2[j + 1]);
                            curr_jiaodian_found = true;
                            j++;
                            break;
                        }
                    }
                    //jiaodian_list.Add(line1_point);
                    //jiaodian_list.Add(line2_point);
                }
                #endregion

                Color fillColor = Color.Black;
                if (is_line1_bigger == true)
                {   //line1在右边,则填充色为 line1 线的颜色
                    fillColor = line1_color;
                }
                else
                {   //line1在左边,则填充色为 line2 线的颜色
                    fillColor = line2_color;
                }

                List <LJJSPoint> finalList = new List <LJJSPoint>();
                if (last_jiaoDian != null)
                {
                    finalList.Add(last_jiaoDian);
                }
                foreach (LJJSPoint point in part_left_list)
                {
                    finalList.Add(point);
                }
                if (curr_jiaoDian != null)
                {
                    finalList.Add(curr_jiaoDian);
                }



                if (curr_jiaodian_found == false)   //没有找到现在的焦点,构不成封闭区域
                {
                    double x = (line1[j - 1].XValue + line2[j - 1].XValue) / 2;
                    double y = line1[j - 1].YValue;
                    finalList.Add(new LJJSPoint(x, y));
                }

                for (int cc = part_right_list.Count - 1; cc >= 0; cc--)
                {
                    finalList.Add(part_right_list[cc]);
                }
                string    hatchColor = get_color_argb_by_color(fillColor).ToString();
                LJJSHatch ljjshatch  = new LJJSHatch(hatchColor, "true");
                //GAY
                MyHatch.AddAreaHatch(activeDOcu, finalList, ljjshatch);

                last_jiaoDian = curr_jiaoDian;
                curr_jiaoDian = null;
            }
        }