private void FrmRightAngelDPS_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.m_mapPolyline = new MapClass(); ParameterInitialize.cboLayer = this.cboLayer; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); }
private void FrmDeletePointsWithSameCoordinates_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayer = this.cboLayer; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); }
private void FrmLookingForNeighboursDT_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayer = this.cboLayer; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); }
private void FrmCreatePointLayer_Load(object sender, EventArgs e) { var ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayerLt = new List <ComboBox>(); ParameterInitialize.cboLayerLt.Add(this.cboLayer); //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); ParameterInitialize.cboLayerLt[0].Items.Add("All visible layers"); ParameterInitialize.cboLayerLt[0].Text = "All visible layers"; }
public void btnMultiResults_Click(object sender, EventArgs e) { int intCount = 10; var pStopwatch = Stopwatch.StartNew(); for (int i = 1; i < intCount + 1; i++) { _dblProp = Convert.ToDouble(i) / intCount; _pBldgGrow.Output(_dblProp, this.cboSimplification.Text, this.cboBufferStyle.Text, Convert.ToDouble(this.txtMiterLimit.Text)); } CHelpFunc.DisplayRunTime(pStopwatch.ElapsedMilliseconds); }
private void FrmMatchAndMergePolygons_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayerLt = new List <ComboBox>(2); ParameterInitialize.cboLayerLt.Add(this.cboLargerScaleLayer); ParameterInitialize.cboLayerLt.Add(this.cboSmallerScaleLayer); //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); }
private void FrmLinear_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayerLt = new List <ComboBox>(2); ParameterInitialize.cboLayerLt.Add(this.cboLargerScaleLayer); ParameterInitialize.cboLayerLt.Add(this.cboSmallerScaleLayer); CConstants.strMethod = "Linear"; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); }
private void FrmVertexInsertion_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayer = this.cboLayer; CConstants.strMethod = "VertexInsertion"; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); }
public void UnionCpl(CPolyline other, ref bool isUnioned) { isUnioned = true; var fcptlt = this.CptLt; var ocptlt = other.CptLt; var newcptlt = new List <CPoint>(); if (CCmpMethods.CmpCptYX(fcptlt.Last(), ocptlt.First()) == 0) { newcptlt.AddRange(fcptlt); newcptlt.RemoveLastT(); newcptlt.AddRange(ocptlt); } else if (CCmpMethods.CmpCptYX(fcptlt.Last(), ocptlt.Last()) == 0) { newcptlt.AddRange(fcptlt); newcptlt.RemoveLastT(); var copiedreversedcptlt = CHelpFunc.CopyCptLt(ocptlt); copiedreversedcptlt.Reverse(); newcptlt.AddRange(copiedreversedcptlt); } else if (CCmpMethods.CmpCptYX(fcptlt.First(), ocptlt.First()) == 0) { var copiedreversedcptlt = CHelpFunc.CopyCptLt(ocptlt); copiedreversedcptlt.Reverse(); newcptlt.AddRange(copiedreversedcptlt); newcptlt.RemoveLastT(); newcptlt.AddRange(fcptlt); } else if (CCmpMethods.CmpCptYX(fcptlt.First(), ocptlt.Last()) == 0) { //CPolyline cplCopyOther = other.CopyCpl(); newcptlt.AddRange(ocptlt); newcptlt.RemoveLastT(); newcptlt.AddRange(fcptlt); } else { isUnioned = false; return; } for (int i = 0; i < newcptlt.Count; i++) { newcptlt[i].ID = i; } FormPolyBase(newcptlt); }
/// <summary> /// use a dynamic programming algorithm to compute correspondences between two polylines /// </summary> /// <param name="frcpl">the larger-scale polyline</param> /// <param name="tocpl">the smaller-scale polyline</param> /// <param name="intMaxBackKforI">look-back parameter for the larger-scale polyline</param> /// <param name="intMaxBackKforJ">look-back parameter for the smaller-scale polyline</param> /// <param name="StandardVectorCpt">if frcpl and tocpl are not in the same place, we use StandardVectorCpt to offset their distance</param> /// <returns>two dimensional table which we can traverse back to construct correspondences between the two polylines</returns> /// <remarks>to guarantee that there are the same number of points on the two polylines after interpolation, /// we only allow correspondences of one segment to one segment, or one segment to multi-segment; /// we do NOT allow a correspondence of one segment to a single point.</remarks> public virtual CTable CreatTableOptCorSimplified(List <CPoint> frcptlt, List <CPoint> tocptlt, int intMaxBackKforI, int intMaxBackKforJ) { int intFrPtNum = frcptlt.Count; int intToPtNum = tocptlt.Count; //if we used a relatively small intMaxBackKforJ, //then we check whether this intMaxBackKforJ would be enough to avoid point-segment correspondences AdjustMaxBackK(ref intMaxBackKforI, intMaxBackKforI, intFrPtNum, intToPtNum); AdjustMaxBackK(ref intMaxBackKforJ, intMaxBackKforI, intToPtNum, intFrPtNum); //T is the two dimensional table, which will be returned as the result. //T.aCell[i, j].dblEvaluation is actually the cost till the ends of i segments on polyline frcpl and j segments on polyline tocpl CTable Table = new CTable(intFrPtNum, intToPtNum); //we compute the first row and column of table Table here because we don't need to traverse back CalTFisrtRowCol(ref Table, frcptlt, tocptlt); //We do this to handle the case that the look-back parameter is not enough, then we will have to allow segment-point matching. //For example: if there are 25 segments on frcpl and 5 segments on tocpl, then we need intMaxBackKforI >= 5; //if our intMaxBackKforI == 3, then we can only build the correspondences between the last 15 segments of frcpl and the 5 segments of tocpl. //The first 10 segments of frcpl have to correspond to the first point of tocpl. for (int i = 1; i < intFrPtNum; i++) { Table.aCell[i, 0].dblCost = Table.aCell[i, 0].dblCost + CConstants.dblHalfDoubleMax; //CConstants.dblHalfDoubleMax is a very large number } for (int j = 1; j < intToPtNum; j++) { Table.aCell[0, j].dblCost = Table.aCell[0, j].dblCost + CConstants.dblHalfDoubleMax; //CConstants.dblHalfDoubleMax is a very large number } //compute other rows and columns of table Table for (int i = 1; i < intFrPtNum; i++) { int intBackKforI = Math.Min(i, intMaxBackKforI); //at some beginning steps, the number of traversed segments is smaller than the look-back parameter for (int j = 1; j < intToPtNum; j++) { int intBackKforJ = Math.Min(j, intMaxBackKforJ); //at some beginning steps, the number of traversed segments is smaller than the look-back parameter var minCCell = new CCell(0, 0, CConstants.dblHalfDoubleMax); minCCell = CHelpFunc.Min(TraverseBack(ref Table, i, j, frcptlt, tocptlt, 1, 1, 1, 1), minCCell, ccell => ccell.dblCost); //only including 1 segment to 1 segment minCCell = CHelpFunc.Min(TraverseBack(ref Table, i, j, frcptlt, tocptlt, 2, intBackKforI, 1, 1), minCCell, ccell => ccell.dblCost); //including 2 segments to 1 segment until intBackKforI segments to 1 segment minCCell = CHelpFunc.Min(TraverseBack(ref Table, i, j, frcptlt, tocptlt, 1, 1, 2, intBackKforJ), minCCell, ccell => ccell.dblCost); //including 1 segment to 2 segments until 1 segment to intBackKforJ segments Table.aCell[i, j] = minCCell; } } return(Table); }
public void btnRun_Click(object sender, EventArgs e) { string strSelectedLayer = this.cboLayer.Text; IFeatureLayer pFeatureLayer = null; CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; try { for (int i = 0; i < ParameterInitialize.m_mapFeature.LayerCount; i++) { if (strSelectedLayer == ParameterInitialize.m_mapFeature.get_Layer(i).Name) { pFeatureLayer = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(i); } } } catch (Exception) { MessageBox.Show("Please select a feature layer"); return; } //dialogue for saving SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); string strPath = SFD.FileName; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(strPath); double dblError = Convert.ToDouble(ParameterInitialize.txtError.Text); long lngStartTime = System.Environment.TickCount; //record the start time //读取线数据 List <CPolyline> CPolylineLt = CHelpFunc.GetCPlLtByFeatureLayer(pFeatureLayer); List <CPolyline> crtpllt = new List <CPolyline>(); for (int i = 0; i < CPolylineLt.Count; i++) { List <CPoint> cptlt = CPolylineLt[i].CptLt; CPolyline crtpl = GetBezierDetectedCpl(cptlt, dblError); crtpllt.Add(crtpl); } CHelpFunc.SaveCPlLt(crtpllt, "BezierDetectedPl", ParameterInitialize.pWorkspace, ParameterInitialize.m_mapControl); long lngEndTime = System.Environment.TickCount; //记录结束时间 _DataRecords.ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngEndTime - lngStartTime) + "ms"; //显示运行时 }
private static CptEdgeDis CalMinDisCptLtCEdgeLt(IEnumerable <CPoint> cptlt, IEnumerable <CEdge> cedgelt) { var PtEdgeDis = new CGeometry.CptEdgeDis(double.MaxValue); foreach (var cpt in cptlt) { foreach (var cedge in cedgelt) { PtEdgeDis = CHelpFunc.Min(PtEdgeDis, cpt.DistanceTo(cedge), ptedgedis => ptedgedis.dblDis); } } return(PtEdgeDis); }
public CHWPGRN(CParameterInitialize ParameterInitialize) { //获取当前选择的点要素图层 IFeatureLayer pFeatureLayer = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(ParameterInitialize.cboLayer.SelectedIndex); ParameterInitialize.pFeatureLayer = pFeatureLayer; ParameterInitialize.dblLevelExponent = Convert.ToDouble(ParameterInitialize.txtLevelExponent.Text); ParameterInitialize.dblOrderExponent = Convert.ToDouble(ParameterInitialize.txtOrderExponent.Text); _ParameterInitialize = ParameterInitialize; //获取线数组 _CPlLt = CHelpFunc.GetCPlLtByFeatureLayer(pFeatureLayer); }
private void btnReduce_Click(object sender, EventArgs e) { try { _dblProp = _dblProp - 0.02; pbScale.Value = Convert.ToInt16(100 * _dblProp); _RelativeInterpolationCpl = CHelpFunc.DisplayInterpolation(_DataRecords, _dblProp); } catch (Exception) { MessageBox.Show("不能再减小了!"); } }
private void btnSaveInterpolation_Click(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; List <CPolyline> cpllt = new List <CPolyline>(); for (int i = 0; i < _RelativeInterpolationCplLt.Count; i++) { cpllt.Add(_RelativeInterpolationCplLt[i]); } string strFileName = _dblProp.ToString(); CHelpFunc.SaveCPlLt(cpllt, strFileName, ParameterInitialize.pWorkspace, ParameterInitialize.m_mapControl); }
private void FrmBezierDetectPointfarthest_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayer = this.cboLayer; ParameterInitialize.txtError = this.txtError; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); }
public override void btnRun_Click(object sender, EventArgs e) { List <int> intSetoff = new List <int>(); for (int i = 0; i < _CPolylineLt.Count; i++) { if (_CPolylineLt[i].CptLt[0].Z > _CPolylineLt[i].CptLt[_CPolylineLt[i].CptLt.Count - 1].Z) { CHelpFunc.ViewPolyline(_DataRecords.ParameterInitialize.m_mapControl, _CPolylineLt[i]); } else { intSetoff.Add(_CPolylineLt[i].ID); } } CHelpFunc.ViewPolyline(_DataRecords.ParameterInitialize.m_mapControl, _CPolylineLt[intCount]); intCount += 1; int kk = 5; //以最后两个点为基点 //_CPolyline = _CPolylineLt[1]; for (int i = 0; i < _CPolylineLt.Count; i++) { if (_CPolylineLt[i].ID == 10) { _CPolyline = _CPolylineLt[i]; break; } } CPolyline cpl = _CPolyline; CHelpFunc.ViewPolyline(_DataRecords.ParameterInitialize.m_mapControl, cpl); int intPtCount = cpl.CptLt.Count; //计算长度初始值(全部计算) _adblLength0 = new double[intPtCount - 2]; for (int i = 0; i < intPtCount - 2; i++) { _adblLength0[i] = CGeoFunc.CalDis(cpl.CptLt[i], cpl.CptLt[i + 1]); } //计算角度初始值 _adblAngle0 = new double[intPtCount - 2]; for (int i = 0; i < intPtCount - 2; i++) { _adblAngle0[i] = CGeoFunc.CalAngle_Counterclockwise(cpl.CptLt[i], cpl.CptLt[i + 1], cpl.CptLt[i + 2]); } }
private void FrmBSBLGOptCorMMSimplified_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLargerScaleLayer = this.cboLargerScaleLayer; ParameterInitialize.cboSmallerScaleLayer = this.cboSmallerScaleLayer; ParameterInitialize.txtMaxBackK = this.txtMaxBackK; CConstants.strMethod = "BSBLGOptCorMMSimplified"; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); }
private CPolyline DisplayInterpolation(double dblProp, IMapControl4 m_mapControl) { CPolyline cpl = _pCAL.GetTargetcpl(dblProp); IGraphicsContainer pGra = m_mapControl.Map as IGraphicsContainer; pGra.DeleteAllElements(); CHelpFunc.ViewPolyline(m_mapControl, cpl); //CHelpFunc.ViewPolyline(m_mapControl, _DataRecords.ParameterResult.FromCpl); //CHelpFunc.ViewPolyline(m_mapControl, _DataRecords.ParameterResult.ToCpl); return(cpl); }
private void FrmMPBDP_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLargerScaleLayer = this.cboLargerScaleLayer; ParameterInitialize.cboSmallerScaleLayer = this.cboSmallerScaleLayer; ParameterInitialize.txtLengthBound = this.txtLengthBound; CConstants.strMethod = "MPBDP"; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); }
public override void btnRun_Click(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); if (SFD.FileName == null || SFD.FileName == "") { return; } ParameterInitialize.strSavePath = SFD.FileName; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(ParameterInitialize.strSavePath); _pCAL = new CPAL(_DataRecords); }
public void btnRun_Click(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); ParameterInitialize.strSavePath = SFD.FileName; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(ParameterInitialize.strSavePath); //CMPBDPBL pMPBDPBL = new CMPBDPBL(ParameterInitialize); //pMPBDPBL.MPBDPBLMorphing(); //_DataRecords.ParameterResult = pMPBDPBL.ParameterResult; }
public virtual void timerReduce_Tick(object sender, EventArgs e) { _dblProp = _dblProp - 0.01; if (_dblProp < 0) { this.timerReduce.Enabled = false; _dblProp = 0; pbScale.Value = Convert.ToInt16(100 * _dblProp); _RelativeInterpolationCpl = CHelpFunc.DisplayInterpolation(_DataRecords, _dblProp); return; } pbScale.Value = Convert.ToInt16(100 * _dblProp); _RelativeInterpolationCpl = CHelpFunc.DisplayInterpolation(_DataRecords, _dblProp); }
public void btnRun_Click(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); if (SFD.FileName == null || SFD.FileName == "") { return; } ParameterInitialize.strSavePath = SFD.FileName; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(ParameterInitialize.strSavePath); //SFD.FileName . long lngStartTime = System.Environment.TickCount; //Read Datasets try { _pMRL = new CMRL(ParameterInitialize); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } _pMRL.MRLMorphing(); //try //{ // _pMRL.CreateCDT(); // _pMRL.MRLMorphing(); //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message); // return; //} long lngEndTime = System.Environment.TickCount; long lngTime = lngEndTime - lngStartTime; ParameterInitialize.tsslTime.Text = "Running Time: " + Convert.ToString(lngTime) + "ms"; //显示运行时间 CParameterResult ParameterResult = _pMRL.ParameterResult; ParameterResult.lngTime = lngTime; _DataRecords.ParameterResult = ParameterResult; //CHelpFuncExcel.KillExcel(); }
private void FrmUnifyIndicesPolylines_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayerLt = new List <ComboBox>(2); ParameterInitialize.cboLayerLt.Add(this.cboLargerScaleLayer); ParameterInitialize.cboLayerLt.Add(this.cboSmallerScaleLayer); this.cboBuffer.SelectedIndex = 0; ParameterInitialize.cboBuffer = this.cboBuffer; ParameterInitialize.txtOverlapRatio = this.txtOverlapRatio; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); }
private void btnAdd_Click(object sender, EventArgs e) { if (_dblProp >= 0.98) { _dblProp = 1; pbScale.Value = Convert.ToInt16(100 * _dblProp); _RelativeInterpolationCpl = CHelpFunc.DisplayInterpolation(_DataRecords, _dblProp); } else { _dblProp = _dblProp + 0.02; pbScale.Value = Convert.ToInt16(100 * _dblProp); _RelativeInterpolationCpl = CHelpFunc.DisplayInterpolation(_DataRecords, _dblProp); } }
public override void btnRun_Click(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); if (SFD.FileName == null || SFD.FileName == "") { return; } ParameterInitialize.strSavePath = SFD.FileName; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(ParameterInitialize.strSavePath); _pApLL = new CApLL(_DataRecords); _RelativeInterpolationCpl = _DataRecords.ParameterResult.FromCpl; }
private void FrmToIpe_Load(object sender, EventArgs e) { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; ParameterInitialize.cboLayerLt = new List <ComboBox>(); ParameterInitialize.cboLayerLt.Add(this.cboLayer); this.cboSize.SelectedIndex = 0; tltCboSize.SetToolTip(this.cboSize, "0.05 Thin; 0.5 Normal; 0.8 Heavier; 1.2 Fat; 2 Ultrafat. 0.05 is too small for points!"); //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); }
public virtual CptEdgeDis CalMinDis(CPolyBase pGeo, bool blnCheckIntersect = true, bool blnTouchBothEnds = false, bool blnTouchEndEdge = false, bool blnOverlap = false) { if (blnCheckIntersect == true) { if (IsIntersectWith(pGeo, blnTouchBothEnds, blnTouchEndEdge, blnOverlap)) { throw new ArgumentOutOfRangeException("I haven't considered this case!"); } } return(CHelpFunc.Min( CalMinDisCptLtCEdgeLt(this.CptLt, pGeo.CEdgeLt), CalMinDisCptLtCEdgeLt(pGeo.CptLt, this.CEdgeLt), ptedgedis => ptedgedis.dblDis)); }
public FrmALAMulti(CDataRecords pDataRecords) { InitializeComponent(); CParameterInitialize ParameterInitialize = pDataRecords.ParameterInitialize; ParameterInitialize.cboLayer = this.cboLayer; ParameterInitialize.txtInterpolationNum = this.txtInterpolatedNum; CConstants.strMethod = "ALAMulti"; //Read all the layers CHelpFunc.FrmOperation(ref ParameterInitialize); throw new ArgumentException("improve loading layesr!"); _DataRecords = pDataRecords; }