Esempio n. 1
0
 public void ToStream(System.IO.BinaryWriter bw)
 {
     bw.Write(this.Code);
     bw.Write(this.AcceptCode);
     bw.Write(ViewerUtils.ConvertStringToByteArray(this.ModelName, 30));
     bw.Write(ViewerUtils.ConvertStringToByteArray(this.StringName, 20));
 }
Esempio n. 2
0
        //const double r9 = 57.29577951;
        public bool WriteHIPFile(string strPath, CHalFile filedata)
        {
            bool         bSuccess = false;
            BinaryWriter bw       = new BinaryWriter(new FileStream(strPath, FileMode.Create), Encoding.Default);

            if (bw != null)
            {
                short sTotalHips = (short)filedata.ListHip.Count;
                bw.Write(filedata.Code);                                                  //Line code
                bw.Write(filedata.AcceptCode);                                            //Accept code
                bw.Write(ViewerUtils.ConvertStringToByteArray(filedata.ModelName, 30));   //Model name
                bw.Write(ViewerUtils.ConvertStringToByteArray(filedata.StringLevel, 20)); //String level

                bw.Write(sTotalHips);                                                     //Total HIPs
                bw.Write(filedata.StartChainage);                                         //Start Chain
                bw.Write(filedata.ChainageInterval);                                      //Chainage Interval

                for (short iIndex = 0; iIndex < sTotalHips; iIndex++)
                {
                    CHHipData hhipObj = filedata.ListHip[iIndex];

                    short sTotalHIP = (short)(iIndex + 1);
                    bw.Write(sTotalHIP);//Hip no
                    bw.Write(hhipObj.xvalue);
                    bw.Write(hhipObj.yvalue);
                    bw.Write(hhipObj.radius);
                    bw.Write(hhipObj.leadtrans);
                    bw.Write(hhipObj.trailtrans);
                }
                bw.Close();
                bSuccess = true;
            }
            return(bSuccess);
        }
Esempio n. 3
0
        private void btnOk__Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                CBox boundbox = this.hdapp.ActiveDocument.BoundingBox;
                if (boundbox != null)
                {
                    //Delete the existing
                    //ViewerUtils.DeleteEntitiesByLabel(this.hdapp.ActiveDocument, HeadsUtils.Constants.LABEL_CHAINAGE, false);

                    //CCfgtype cfg = this.hdapp.ConfigParam;
                    HeadsUtils.Chainage Chng = new HeadsUtils.Chainage();
                    double z = 0.0;
                    Chng.XMin             = boundbox.TopLeft.X;
                    Chng.YMin             = boundbox.TopLeft.Y;
                    z                     = boundbox.TopLeft.Z;
                    Chng.ModelName        = this.SelectedModelName;
                    Chng.StringName       = this.SelectedStringLabel;
                    Chng.TextSize         = this.tbTextSize_.Value;
                    Chng.ChainageInterval = this.tbChainageInterval_.Value;
                    Chng.Rotation         = 0;

                    BinaryWriter bw = new BinaryWriter(new FileStream(Path.Combine(this.hdapp.AppDataPath, "CHAIN1.TMP"), FileMode.Create), Encoding.Default);
                    bw.Write(ViewerUtils.ConvertStringToByteArray(Chng.ModelName, 30));
                    bw.Write(ViewerUtils.ConvertStringToByteArray(Chng.StringName, 20));
                    bw.Write(Chng.XMin);
                    bw.Write(Chng.YMin);
                    bw.Write(Chng.ChainageInterval);
                    bw.Write(Chng.TextSize);
                    bw.Write(Chng.Rotation);
                    bw.Close();

                    ViewerUtils.DeleteFileIfExists(Path.Combine(this.hdapp.AppDataPath, "CHAIN2.TMP"));

                    CChainageUtil util = new CChainageUtil();
                    util.Funcmain(this.hdapp.AppDataPath);

                    DrawingUtil.DrawChainage(this.hdapp, Path.Combine(this.hdapp.AppDataPath, "CHAIN2.TMP"), "CHAIN", true);

                    this.hdapp.ActiveDocument.RefreshDocument();
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }