这是上大学的时候熬了几个通宵写出来的课程设计,放在旧电脑里面很久很久了,觉得不能浪费了,想着整理整理放在这,为曾经奋斗过的夜留个纪念。可能对于大佬们来说这个很简单。我记得我们这个课设分成了论文类题目(6题)、制作工具类题目(9题)和应用系统类题目(2题),工具类和应用系统类要求提交源程序和打印的报告,好死不死我正好抽中了应用系统类题目。具体的某个细节想不起来了,只记得是deadline当天写完的,结果去演示的时候老师没看几眼就全部打回让我重做,差点哭死我。又熬了一晚上终于完成。

- public staticBitmap RGB2Gray(Bitmap srcBitmap)
- 提取像素法
- {
-
- Color srcColor;
-
- int wide = srcBitmap.Width;
-
- int height = srcBitmap.Height;
-
- for (int y = 0; y < height; y++)
-
- for (int x = 0; x < wide; x++)
-
- {
-
- //获取像素的RGB颜色值
-
- srcColor = srcBitmap.GetPixel(x, y);
-
- byte temp = (byte)(srcColor.R * .299 + srcColor.G * .587 + srcColor.B * .114);
-
- //设置像素的RGB颜色值
-
- srcBitmap.SetPixel(x, y, Color.FromArgb(temp, temp, temp));
-
- }
-
- return srcBitmap ;
-
- }
- (2) 内存法
- if (curBitmap != null)
-
- {
-
- int width = curBitmap.Width;
-
- int height = curBitmap.Height;
-
- int length = height * 3 * width;
-
- RGB = new byte[length];
-
- BitmapData data = curBitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
- 三、对图片进行缩放
- System.Drawing.Image drawimage = System.Drawing.Image.FromFile(photopath);
- Bitmap imgOutput = new Bitmap(drawimage,60,30);
- imgOutput.Save(newphotppath, System.Drawing.Imaging.ImageFormat.Jpeg);
- imgOutput.Dispose();
- Response.End();
- System.IntPtr Scan0 = data.Scan0;
-
- System.Runtime.InteropServices.Marshal.Copy(Scan0, RGB, 0, length);
-
- double gray = 0;
-
- for (int i = 0; i < RGB.Length; i=i+3)
-
- {
-
- gray = RGB[i + 2] * 0.3 + RGB[i + 1] * 0.59 + RGB[i] * 0.11;
-
- RGB[i + 2] = RGB[i + 1] = RGB[i] = (byte)gray;
-
- }
-
- System.Runtime.InteropServices.Marshal.Copy(RGB, 0, Scan0, length);
-
- curBitmap.UnlockBits(data);
-
- }
-
-
-
-
- private void pictureBox1_Paint(object sender, PaintEventArgs e)
- {
- if (b == false) return;
- Graphics g = e.Graphics;
- Pen p = new Pen(Color.Red, 2);
- g.DrawLine(p, 0, 0, 100, 100);
- /* Bitmap bmp = new Bitmap("test1.bmp");
- pictureBox1.Image = bmp;
- Color pixelColor = bmp.GetPixel(50, 50);
- SolidBrush pixelBrush = new SolidBrush(pixelColor);
- e.Graphics.FillRectangle(pixelBrush, 0, 0, 100, 100);*/
- }
-
- //地图制图
- 1.添加图名、比例尺、指北针等地图元素
- MapSurrround对象:Legend图例、ScaleBar比例尺、MapTitle图名
-
- 2.打印地图
-
-
-
- Map
- Layer文件或数据库读取到的地理数据
- FeatureLayer:矢量数据
- PasterLayer:栅格数据
- Element
- 往地图上添加图形
- 框架元素
-
- //修改其他设置
- IMapSurround pMapSurround = pMapSurrroundFrame.MapSurround;
- /* ILegend pLegend = pMapSurround as ILegend;
- pLegend.Title = "图例";*/
- //修改不同类型的Mapsurround的样式,要强制转化成该类型
- IScaleBar markerScalerBar = pMapSurround as IScaleBar;
-
- ///
- IEnvelope pEnvelop = new EnvelopeClass();
- ITextSymbol pTextSybol = new TextSymbolClass();
-
-
- MarkerNorthArrow markerNorthArrow = pMapSurround as IMarkerNorthArrow;
-
- //IStyleGalleryItem pStyleGalleryItem = SymbolUtilty.GetItemFromServerStyle("Scale Texts", "Absolute Scale");
-
- //弹出窗体的Symbolform
- //pMapSurrroundFrame.MapSurround = (IMapSurround)styleGalleryItem.Item;
-
- IElement pElement = pMapSurrroundFrame as IElement;
- // pElement.Geometry = pEnvelope;
- //pGraphicsContainer.AddElement(pElement,0); //地图元素的位置
-
-
-
-
- 添加地图元素到PageLayoutControl中
- IGraphicsContainer pGraphicsContainer = pPageLayout as IGraphicsContainer;
- IMap pMap = axPageLayout1.ActivieView.FocusMap;
- IFrameElement pFrameElement = pGraphicsContainer.FindFrame(pMap);
- IMapFrame pMapFrame = pFrameElement as IMapFrame;
- IMapSurrroundFrame pMapSurrroundFrame = MapSurrroundFrame CreateSurroundFrame(pID,null);
- pMapSurrroundFrame.MapSurrround = (IMapSurrround)styleGalleryItem.Item;
- IElement pElement = pMapSurrroundFrame as IElement;
- pElement.Geometry =
-
-
- // if (fileExtendName.ToUpper() == "JPG")
- //{
- // pExport = new ExportJPEGClass();
- //}
- //else if (fileExtendName.ToUpper() == "BMP")
- //{
- // pExport = new ExportBMPClass();
- //}
-
-
-
- private void button2_Click(object sender, EventArgs e)
- {
- //设置输出的缓冲图层
- SaveFileDialog saveDlg = new SaveFileDialog();
- saveDlg.CheckPathExists = true;
- saveDlg.Filter = "Shapefile (*.shp)|*.shp";
- saveDlg.OverwritePrompt = true;
- saveDlg.Title = "保存数据";
- saveDlg.RestoreDirectory = true;
- saveDlg.FileName = (string)comboBox1.SelectedItem + "_buffer.shp";
-
- DialogResult dr = saveDlg.ShowDialog();
- if (dr == DialogResult.OK)
- textBox2.Text = saveDlg.FileName;
- }
-
-
-
- //查询人口数量大于2500的区域
- string WhereClause = "pop > 2500";
- RgbColor pColor = setSelectionColor(153, 0, 0);
- SelectLayersFeatures(count, WhereClause, pColor);
-
- private void SelectLayersFeatures(int i, string WhereClause, RgbColor pColor)
- {//条件查询图层属性字段
- ILayer pLayer = axMapControl1.get_Layer(i);
- IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
- IFeatureSelection pFeatureSelection = pFeatureLayer as IFeatureSelection;
- if (pFeatureSelection != null)
- {
- IQueryFilter pQueryFilter = new QueryFilterClass();
- pQueryFilter.WhereClause = WhereClause;
- pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
- }
-
- pFeatureSelection.SelectionColor = pColor;//将选择集添上颜色
- axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);//控件局部刷新
- }
-
- private RgbColor setSelectionColor(int red, int green, int blue)
- {//设置选择集颜色
- RgbColor pColor = new RgbColor();
- pColor.Red = red;
- pColor.Green = green;
- pColor.Blue = blue;
- return pColor;
- }
1、程序启动的时候加载朝阳区的街道数据
2、了解、分析POI数据:POI代表的是城市里的各种设施,如:商店、酒店、学校等,用之前实验中做的打开属性表功能,打开POI数据的属性属性,分析它的type属性(有3级type)
3、在界面上提供菜单、或工具、或按钮用于加载POI数据,加载后不在mapcontrol中显示POI点数据,而是在程序界面上提供POI三级type的树状图(控件treeView)
4、点击树状图中的每个节点时,在mapcontrol中显示具有相应属性值的POI数据,注意去除前一视图中的POI数据
5、在树状图中点击鼠标右键时弹出菜单,菜单上具有城市基础设施空间分布分析的功能,这些功能是以街区为单位,统计每个街区内的各类设施的数量,根据这个数量设计专题图;此外,还可以计算出各街区内、各种基础设施统计数据的方差,用这些方差值做一个曲线图,看看哪种基础设施的方差最小(表示其分布最为均匀)
以每一个街区为单位输出,全称2010或以FTD进行叠加查询
叠加分析是将有关主题层组成的数据层面,进行叠加产生一个新数据层面的操作,其结果综合了原来 两层或多层要素所具有的属性,从已有的数据中提取空间隐含的信息。
本次开发的系统将为用户提供一个简洁明了、易于操作的工作界面,使用户能够轻松便捷的获取到**市**区的基础设施空间分布的关系和地图数据,在原数据的基础上进行基本的操作、查询和分析。任何软件的最终受用群体是人这个自然体,所以不管是什么样的软件,必须要考虑用户在使用中的感受,无论是控件使用,提示信息措辞,还是颜色、窗口布局风格,遵循统一的标准,做到真正的一致。





具体的代码和相关报告压缩放在