private void btnSaveLengthandAngles_Click(object sender, EventArgs e) { try { CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; List <CPolyline> cpllt = _DataRecords.ParameterResult.CResultPlLt; List <List <double> > dbllengthltlt = new List <List <double> >(); List <List <double> > dblangleltlt = new List <List <double> >(); for (int i = 0; i < cpllt.Count; i++) { dbllengthltlt.Add(CGeoFunc.RecordLengths(cpllt[i])); dblangleltlt.Add(CGeoFunc.RecordAngles(cpllt[i])); } CHelpFuncExcel.ExportDataltltToExcel(dbllengthltlt, "lengthltlt", ParameterInitialize.strSavePath); CHelpFuncExcel.ExportDataltltToExcel(dblangleltlt, "angleltlt", ParameterInitialize.strSavePath); } catch { MessageBox.Show("No data or other errors! (Have you already implemented timerAdd_Tick?)"); } }
private void btnRunMulti_Click(object sender, EventArgs e) { double dblThreshold = Convert.ToDouble(this.txtThreshold.Text); CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; //dialogue for saving SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); string strPath = SFD.FileName; ParameterInitialize.strSavePath = strPath; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(strPath); int intLayerCount = ParameterInitialize.m_mapFeature.LayerCount; List <List <double> > OutPutLtLt = new List <List <double> >(intLayerCount); //some stupid codes :-) IFeatureLayer pFeatureLayerLast = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(intLayerCount - 1); List <CPoint> CptLtLast = CHelpFunc.GetCPtLtFromPointFeatureLayer(pFeatureLayerLast); int intPtNumLast = CptLtLast.Count; long lngTime = 0; long lngStartMemory = 0; long lngMemory = 0; int intOutPut = 0; IFeatureLayer pFeatureLayer = null; for (int i = 0; i < intLayerCount; i++) { List <double> OutPutLt = new List <double>(18); lngStartMemory = GC.GetTotalMemory(true); pFeatureLayer = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(i); List <CPoint> CptLt = CHelpFunc.GetCPtLtFromPointFeatureLayer(pFeatureLayer); //for (int j = 0; j < CptLt.Count; j++) //{ // CptLt[j].GID = j; // //CptLt[j].intTS = new TreeSet<int>(); //} //long lngMemory1 = GC.GetTotalMemory(true); double dblThreshold2 = dblThreshold * Math.Pow(Convert.ToDouble(intPtNumLast) / Convert.ToDouble(CptLt.Count), 0.5);//---------------dblThreshold------------------------------------------------// //------------------------------------------------Start------------------------------------------------// //long lngStartTime = System.Environment.TickCount; //record the start time //----------------------------------------SweepLineTwoCopiesTreeSet----------------------------------------// lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; SweepLineTwoCopiesTreeSet(ref CptLt, dblThreshold, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; SweepLineTwoCopiesTreeSet(ref CptLt, dblThreshold2, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); //----------------------------------------SortedSet----------------------------------------// lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; SweepLineTwoCopiesSortedSet(ref CptLt, dblThreshold, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; SweepLineTwoCopiesSortedSet(ref CptLt, dblThreshold2, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); //----------------------------------------TwoCopiesSortedDictionary----------------------------------------// lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; SweepLineTwoCopiesWithoutC5(ref CptLt, dblThreshold, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; SweepLineTwoCopiesWithoutC5(ref CptLt, dblThreshold2, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); OutPutLtLt.Add(OutPutLt); ParameterInitialize.tspbMain.Value = (i + 1) * 100 / intLayerCount; pFeatureLayer = null; CptLt = null; OutPutLt = null; } CHelpFuncExcel.ExportDataltltToExcel(OutPutLtLt, "Time&Output", ParameterInitialize.strSavePath); //dblTimeLt = new List<double>(intLayerCount); //dblOutPutLt = new List<double>(intLayerCount); //lngMemoryLt = new List<double>(intLayerCount); //OutPutLtLt = new List<List<double>>(3); ////for (int i = 0; i < intLayerCount; i++) //for (int i = 0; i < intLayerCount; i++) //{ // long lngMemory = GC.GetTotalMemory(true); // pFeatureLayer = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(intLayerCount - 1 - i); // List<CPoint> CptLt = CHelpFunc.GetCPtLtByFeatureLayer(pFeatureLayer); // for (int j = 0; j < CptLt.Count; j++) // { // CptLt[j].GID = j; // //CptLt[j].intTS = new TreeSet<int>(); // } // //long lngMemory1 = GC.GetTotalMemory(true); // dblThreshold = Math.Pow(1.8 / Convert.ToDouble(CptLt.Count), 0.5);//---------------dblThreshold------------------------------------------------// // //------------------------------------------------Start------------------------------------------------// // int intOutPut = 0; // long lngStartTime = System.Environment.TickCount; //record the start time // if (cboFunction.Text == "Two Copies") // { // SweepLineTwoCopiesTreeSet(ref CptLt, dblThreshold, ref lngMemory, ref intOutPut); // } // else if (cboFunction.Text == "Two Copies Without C5") // { // SweepLineTwoCopiesWithoutC5(ref CptLt, dblThreshold, ref lngMemory, ref intOutPut); // } // else if (cboFunction.Text == "Two Sweep Lines") // { // SweepLineTwoSweepLines(ref CptLt, dblThreshold); // } // dblTimeLt.Add(System.Environment.TickCount - lngStartTime); // lngMemoryLt.Add(Convert.ToDouble(lngMemory) / 1048576); // dblOutPutLt.Add(intOutPut); // //int intOutPut = 0; // //for (int j = 0; j < CptLt.Count; j++) // //{ // // intOutPut += CptLt[j].intTS.Count; // //} // //dblOutPutLt.Add(intOutPut / 2); // //for (int j = 0; j < CptLt.Count; j++) // //{ // // CptLt[j].intTS.Dispose(); // // CptLt[j].SetEmpty2(); // //} // ParameterInitialize.tspbMain.Value = (i + 1) * 100 / intLayerCount; // pFeatureLayer = null; // CptLt = null; //} //OutPutLtLt.Add(dblTimeLt); //OutPutLtLt.Add(lngMemoryLt); //OutPutLtLt.Add(dblOutPutLt); //CHelpFuncExcel.ExportColDataltltToExcel(OutPutLtLt, "Time&Output_ChangeThreshold", ParameterInitialize.strSavePath); MessageBox.Show("Done!"); }
private void btnRunMulti_Click(object sender, EventArgs e) { double dblThreshold = Convert.ToDouble(this.txtThreshold.Text); IFeatureLayer pFeatureLayer = null; CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; //dialogue for saving SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); string strPath = SFD.FileName; ParameterInitialize.strSavePath = strPath; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(strPath); string strTINPath = strPath + "\\TIN"; string strTINPath2 = strPath + "\\TIN2"; System.IO.Directory.CreateDirectory(strTINPath); System.IO.Directory.CreateDirectory(strTINPath2); int intLayerCount = ParameterInitialize.m_mapFeature.LayerCount; List <List <double> > OutPutLtLt = new List <List <double> >(intLayerCount); //some stupid codes :-) IFeatureLayer pFeatureLayerLast = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(intLayerCount - 1); List <CPoint> CptLtLast = CHelpFunc.GetCPtLtFromPointFeatureLayer(pFeatureLayerLast); int intPtNumLast = CptLtLast.Count; long lngMemory = 0; long lngMemoryDT = 0; long lngMemoryDTProcess = 0; int intOutPut = 0; long lngTimeForSearching = 0; long lngTimeForDT = 0; List <CPoint> CptLt = new List <CPoint>(); OutPutLtLt = new List <List <double> >(6); for (int i = 0; i < intLayerCount; i++) //for (int i = 0; i < 2; i++) { List <double> OutPutLt = new List <double>(8); //double ss = intPtNumLast / Convert.ToDouble(159); //double kk = Math.Pow(intPtNumLast / Convert.ToDouble(CptLt.Count), 0.5); //double dblThreshold2 = dblThreshold * Math.Pow(intPtNumLast / Convert.ToDouble(CptLt.Count), 0.5); //---------------dblThreshold------------------------------------------------// pFeatureLayer = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(i); //long lngMemory2 = GC.GetTotalMemory(true); lngMemoryDT = 0; lngMemoryDTProcess = 0; intOutPut = 0; lngTimeForSearching = 0; lngTimeForDT = 0; //------------------------------------Action------------------------------------// CptLt = LookingForNeighboursDT(pFeatureLayer, dblThreshold, -1, ref lngTimeForSearching, ref lngTimeForDT, ref lngMemory, ref lngMemoryDT, ref lngMemoryDTProcess, ref intOutPut, strTINPath); //long lngMemory3 = GC.GetTotalMemory(true); OutPutLt.Add(Convert.ToDouble(lngTimeForSearching + lngTimeForDT) / 1000); OutPutLt.Add(Convert.ToDouble(lngTimeForDT) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(lngMemoryDT) / 1048576); OutPutLt.Add(Convert.ToDouble(lngMemoryDTProcess) / 1048576); //int intOutPut = 0; //for (int j = 0; j < CptLt.Count; j++) //{ // intOutPut += CptLt[j].intTS.Count; //} OutPutLt.Add(Convert.ToDouble(intOutPut) / 2 / 1000); //long lngMemory2 = GC.GetTotalMemory(true); lngMemoryDT = 0; lngMemoryDTProcess = 0; intOutPut = 0; lngTimeForSearching = 0; lngTimeForDT = 0; CptLt = LookingForNeighboursDT(pFeatureLayer, dblThreshold, intPtNumLast, ref lngTimeForSearching, ref lngTimeForDT, ref lngMemory, ref lngMemoryDT, ref lngMemoryDTProcess, ref intOutPut, strTINPath2); //*******************Action*******************// //long lngMemory3 = GC.GetTotalMemory(true); OutPutLt.Add(Convert.ToDouble(lngTimeForSearching) / 1000); OutPutLt.Add(Convert.ToDouble(lngTimeForDT) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(lngMemoryDT) / 1048576); OutPutLt.Add(Convert.ToDouble(lngMemoryDTProcess) / 1048576); //int intOutPut = 0; //for (int j = 0; j < CptLt.Count; j++) //{ // intOutPut += CptLt[j].intTS.Count; //} OutPutLt.Add(Convert.ToDouble(intOutPut) / 2 / 1000); OutPutLtLt.Add(OutPutLt); CHelpFunc.Displaytspb(i + 1, intLayerCount); pFeatureLayer = null; CptLt = null; OutPutLt = null; } CHelpFuncExcel.ExportDataltltToExcel(OutPutLtLt, "Time&Output_ChangeThreshold", ParameterInitialize.strSavePath); MessageBox.Show("Done!"); }
private void btnRunMulti_Click(object sender, EventArgs e) { double dblThreshold = Convert.ToDouble(this.txtThreshold.Text); double dblGridSize = Convert.ToDouble(this.txtGridSize.Text); IFeatureLayer pFeatureLayer = null; CParameterInitialize ParameterInitialize = _DataRecords.ParameterInitialize; //dialogue for saving SaveFileDialog SFD = new SaveFileDialog(); SFD.ShowDialog(); string strPath = SFD.FileName; ParameterInitialize.strSavePath = strPath; ParameterInitialize.pWorkspace = CHelpFunc.OpenWorkspace(strPath); int intLayerCount = ParameterInitialize.m_mapFeature.LayerCount; List <List <double> > OutPutLtLt = new List <List <double> >(intLayerCount); //some stupid codes :-) IFeatureLayer pFeatureLayerLast = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(intLayerCount - 1); List <CPoint> CptLtLast = CHelpFunc.GetCPtLtFromPointFeatureLayer(pFeatureLayerLast); int intPtNumLast = CptLtLast.Count; long lngTime = 0; long lngStartMemory = 0; long lngMemory = 0; int intOutPut = 0; for (int i = 9; i < intLayerCount; i++) { List <double> OutPutLt = new List <double>(6); lngStartMemory = GC.GetTotalMemory(true); //long lngMemory1 = GC.GetTotalMemory(true); pFeatureLayer = (IFeatureLayer)ParameterInitialize.m_mapFeature.get_Layer(i); List <CPoint> CptLt = CHelpFunc.GetCPtLtFromPointFeatureLayer(pFeatureLayer); //GC.GetTotalMemory(true); //long lngMemory2 = GC.GetTotalMemory(true); //for (int j = 0; j < CptLt.Count; j++) //{ // CptLt[j].GID = j; // //CptLt[j].intTS = new TreeSet<int>(); //} //long lngMemory3 = GC.GetTotalMemory(true); //dblThreshold = Math.Pow(1.8 / Convert.ToDouble(CptLt.Count), 0.5);//---------------dblThreshold------------------------------------------------// //222222222222222222 lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; double dblThreshold2 = dblThreshold; double dblGridSize2 = dblGridSize * Math.Pow(Convert.ToDouble(intPtNumLast) / Convert.ToDouble(CptLt.Count), 0.5); Grids(ref CptLt, dblThreshold2, dblGridSize2, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); //3333333333333333 lngTime = 0; lngMemory = lngStartMemory; intOutPut = 0; double dblThreshold3 = dblThreshold * Math.Pow(Convert.ToDouble(intPtNumLast) / Convert.ToDouble(CptLt.Count), 0.5); double dblGridSize3 = dblGridSize * Math.Pow(Convert.ToDouble(intPtNumLast) / Convert.ToDouble(CptLt.Count), 0.5); Grids(ref CptLt, dblThreshold3, dblGridSize3, ref lngTime, ref lngMemory, ref intOutPut); OutPutLt.Add(Convert.ToDouble(lngTime) / 1000); OutPutLt.Add(Convert.ToDouble(lngMemory) / 1048576); OutPutLt.Add(Convert.ToDouble(intOutPut) / 1000); //dblTimeLt.Add(lngTime); //lngMemoryLt.Add(Convert.ToDouble(lngMemory) / 1048576); ////lngStartMemoryLt.Add(lngStartMemory); ////int intOutPut = 0; ////for (int j = 0; j < CptLt.Count; j++) ////{ //// intOutPut += CptLt[j].intTS.Count; ////} //dblOutPutLt.Add(intOutPut); OutPutLtLt.Add(OutPutLt); ParameterInitialize.tspbMain.Value = (i + 1) * 100 / intLayerCount; pFeatureLayer = null; CptLt = null; OutPutLt = null; } CHelpFuncExcel.ExportDataltltToExcel(OutPutLtLt, "Time&Memory&Output", ParameterInitialize.strSavePath); MessageBox.Show("Done!"); }