Exemplo n.º 1
0
        bool ValidateData()
        {
            if (this.tbModelName_.Text.Trim() == "")
            {
                this.errorProvider.SetError(this.tbModelName_, Properties.Resources.ST_PROMPT_INVALID_INPUT);
                return(false);
            }
            if (this.tbStringlabel_.Text.Trim() == "")
            {
                this.errorProvider.SetError(this.tbStringlabel_, Properties.Resources.ST_PROMPT_INVALID_INPUT);
                return(false);
            }

            if (this.IsEditMode == false)
            {
                string        strValignFilFilePath = Path.Combine(this.app.AppDataPath, "VALIGN.FIL");
                CValignInfo[] infoarr = CValignUtil.ReadValigns(strValignFilFilePath);
                foreach (CValignInfo info in infoarr)
                {
                    if (info.ModelName.Trim().ToLower() == this.tbModelName_.Text.Trim().ToLower() &&
                        info.StringLabel.Trim().ToLower() == this.tbStringlabel_.Text.Trim().ToLower())
                    {
                        this.errorProvider.SetError(this.tbStringlabel_
                                                    , "Model Name and String Level already exists\nPlease specify unique Model Name and String Level");
                        this.tbStringlabel_.Focus();
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        private void btnFinish__Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;

            CValignUtil.SaveValign(this.app.AppDataPath);

            ViewerUtils.DeleteFileIfExists(Path.Combine(this.app.AppDataPath, "VALIGN.TMP"));
            this.Close();
        }
Exemplo n.º 3
0
        void ApplyValign()
        {
            if (this.ValidateData())
            {
                this.app.ActiveDocument.ConfigParam.XMetric = 1;
                this.app.ActiveDocument.ConfigParam.YMetric = 10;
                CCfgtype cfg = new CCfgtype();
                this.app.ActiveDocument.ConfigParam.CopyTo(cfg);

                IHdEntity entity = this.app.ActiveDocument.GetObjectById(this.LastAppliedPolyLineID);
                if (entity != null)
                {
                    entity.Erase();
                }

                //Erase the selected polyline on screen
                //this is because user may modify the X, Y
                //co-ordinates using this dialog
                entity = this.app.ActiveDocument.GetObjectById(this.MainPolyLineID);
                if (entity != null)
                {
                    entity.Erase();
                }

                List <VVIP>     listParams = GetParamData();
                List <CPoint3D> polypts    = new List <CPoint3D>();

                foreach (VVIP vdata in listParams)
                {
                    polypts.Add(new CPoint3D(vdata.chainx * cfg.XMetric, vdata.chainy * cfg.YMetric, 0));
                }

                this.MainPolyLineID = this.app.ActiveDocument.DrawPolyline3D(polypts).ObjectID;

                this.WriteDataFile();

                ViewerUtils.DeleteFileIfExists(Path.Combine(this.app.AppDataPath, "VAL2.TMP"));

                CValignUtil util = new CValignUtil();
                if (util.Funcmain(this.app.AppDataPath))
                {
                    DrawingUtil.DrawData(this.app, Path.Combine(this.app.AppDataPath, "VAL2.TMP"), "PVR", true);
                }

                this.app.ActiveDocument.RefreshDocument();
            }
        }
Exemplo n.º 4
0
        public static void SaveValign(string strWorkingDirPath)
        {
            StreamReader          readerSrc      = new StreamReader(Path.Combine(strWorkingDirPath, "VALIGN.TMP"));
            List <CValignFilData> listTempValign = new List <CValignFilData>();

            while (readerSrc.EndOfStream == false)
            {
                string         strlineSrc  = readerSrc.ReadLine();
                CValignFilData filDataTemp = CValignFilData.Parse(strlineSrc);
                if (filDataTemp != null)
                {
                    listTempValign.Add(filDataTemp);
                }
            }
            readerSrc.Close();

            //If any data present in temp file
            if (listTempValign.Count > 0)
            {
                string        strValignFilePath = Path.Combine(strWorkingDirPath, "VALIGN.FIL");
                CValignInfo[] infoarr           = CValignUtil.ReadValigns(strValignFilePath);
                StreamWriter  writerDesti       = new StreamWriter(strValignFilePath, false);
                foreach (CValignInfo info in infoarr)
                {
                    foreach (CValignFilData filData in info.DataList)
                    {
                        if (filData.modnam != listTempValign[0].modnam || filData.stglbl != listTempValign[0].stglbl)
                        {
                            writerDesti.WriteLine(filData.ToString());
                        }
                    }
                }

                //Now write the data from temp file
                foreach (CValignFilData filData in listTempValign)
                {
                    writerDesti.WriteLine(filData.ToString());
                }

                writerDesti.Close();
            }
        }
Exemplo n.º 5
0
        void PopulateSelectionTree()
        {
            TreeNode nodeRoot = this.treeViewModels_.Nodes[0];

            nodeRoot.Tag = null;
            nodeRoot.Expand();
            string strValignFilPath = Path.Combine(this.app.AppDataPath, "VALIGN.FIL");

            CValignInfo[] infoarr = CValignUtil.ReadValigns(strValignFilPath);
            foreach (CValignInfo info in infoarr)
            {
                TreeNode nodemodel = this.FindModelNode(info.ModelName);
                if (nodemodel == null)
                {
                    nodemodel = nodeRoot.Nodes.Add(info.ModelName);
                }

                TreeNode nodeLabel = nodemodel.Nodes.Add(info.StringLabel);
                nodeLabel.Tag = info;
            }
        }