/// <summary> /// This method gets the map object out of the mapfactory with given mapalias and /// This method searches all features within a given point and a radius in all visible and selectable layers /// except the features picked up by the given point /// and then updates the default selection and streams the image back to client. /// </summary> /// <remarks>None</remarks> public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); System.Drawing.Point[] points = ExtractPoints(DataString); Map myMap = model.GetMapObj(MapAlias); RadiusSelection(myMap, points); MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); }
/// <summary> /// This method gets the map object out of the mapfactory with given mapalias /// and This method delete the pin point features added by AddPinPointCommand in a given point /// and then streams the image back to client. /// </summary> /// <remarks>None</remarks> public override void Process() { System.Drawing.Point[] points = ExtractPoints(DataString); MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); if (map == null) { return; } PointDeletion(map, points[0]); MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); //get map object from map model MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); FeatureLayer fLyr = map.Layers[ProjectConstants.ThemeLayerAlias] as FeatureLayer; fLyr.Modifiers.Clear(); map.Legends.Clear(); //create theme IndividualValueTheme iTheme = new IndividualValueTheme(fLyr, ProjectConstants.IndColumnName, ProjectConstants.ThemeAlias); fLyr.Modifiers.Insert(0, iTheme); //create legend based on the individual value theme Legend lg = map.Legends.CreateLegend(new Size(236, 282)); //create legend frame ThemeLegendFrame lgFrame = LegendFrameFactory.CreateThemeLegendFrame(iTheme); lg.Frames.Append(lgFrame); //modify legend frame style lgFrame.BackgroundBrush = new SolidBrush(Color.AliceBlue); lgFrame.Title = "World Country Legend"; lgFrame.SubTitle = " "; MapInfo.Styles.Font titleFont = new MapInfo.Styles.Font("Arial", 10); titleFont.ForeColor = Color.DarkBlue; titleFont.FontWeight = FontWeight.Bold; lgFrame.TitleStyle = titleFont; MapInfo.Styles.Font rowTextStyle = new Font("Arial", 8); rowTextStyle.FontWeight = FontWeight.Bold; lgFrame.RowTextStyle = rowTextStyle; //stream map image back to client MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); if (map == null) { return; } UserMap.ZoomAll(map); MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); return; }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); //get map object from map model MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); FeatureLayer fLyr = map.Layers[ProjectConstants.ThemeLayerAlias] as FeatureLayer; fLyr.Modifiers.Clear(); map.Legends.Clear(); MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); if (map == null) { return; } MapInfo.Geometry.Distance savezoom = map.Zoom; map.Zoom = new MapInfo.Geometry.Distance(savezoom.Value * 4, savezoom.Unit); if (ExportFormat == "undefined") { ExportFormat = "Gif"; } System.IO.MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); map.Zoom = savezoom; /* * MapControlModel model = MapControlModel.GetModelFromSession(); * Map oMap = model.GetMapObj(MapAlias); * if (oMap == null) * { * return; * } * * MapInfo.Geometry.Distance zoom = oMap.Zoom; * zoom = new MapInfo.Geometry.Distance(zoom.Value * 4, zoom.Unit ); * oMap.Zoom = zoom; * if (ExportFormat == "undefined" ) * { * ExportFormat = "Gif"; * } * System.IO.MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); * StreamImageToClient(ms); * zoom = new MapInfo.Geometry.Distance(zoom.Value / 4, zoom.Unit); * oMap.Zoom = zoom; */ }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); if (map == null) { return; } string strUID = HttpContext.Current.Request["uid"]; UserMap.DeleteFeature(map, Constants.TempLayerAlias, strUID); MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); return; }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); if (map == null) { return; } int wheelvalue = int.Parse(System.Convert.ToString(HttpContext.Current.Request["wheelvalue"])); try { double db; if (wheelvalue > 0) { db = map.Zoom.Value * 0.5; } else { db = map.Zoom.Value * 2; } if (db > Constants.MINZOOMVALUE) { db = Constants.MINZOOMVALUE; } else if (db < Constants.MAXZOOMVALUE) { db = Constants.MAXZOOMVALUE; } map.Zoom = new MapInfo.Geometry.Distance(db, map.Zoom.Unit); } finally { System.IO.MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); } }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); if (map == null) { return; } string strUID = HttpContext.Current.Request["uid"]; string strText = HttpContext.Current.Request["Name"]; System.Drawing.Point[] points = this.ExtractPoints(this.DataString); System.Drawing.Color clr = UserMap.stringToColor(HttpContext.Current.Request["Color"]); int lineWidth = Int32.Parse(HttpContext.Current.Request["LineWidth"]); if (lineWidth <= 0) { lineWidth = 2; } int cnt = 0; int len = points.Length; double x = 0; double y = 0; MapInfo.Geometry.DPoint[] dPoints = new MapInfo.Geometry.DPoint[len]; for (cnt = 0; cnt < len; cnt++) { x = (double)points[cnt].X / 10000; y = (double)points[cnt].Y / 10000; dPoints[cnt] = new MapInfo.Geometry.DPoint(x, y); } UserMap.DeleteFeature(map, Constants.TempLayerAlias, strUID); UserMap.AddLine(map, Constants.TempLayerAlias, strUID, strText, dPoints, clr, lineWidth); /* * FeatureLayer layer = map.Layers[Constants.TempLayerAlias] as FeatureLayer; * if (layer == null) * { * return; * } * * int cnt = 0; * int len = points.Length; * double x =0; * double y = 0; * * MapInfo.Geometry.DPoint[] dPoints = new MapInfo.Geometry.DPoint[len]; * * for (cnt = 0; cnt < len; cnt++) * { * x = points[cnt].X/10000; * y = points[cnt].Y/10000; * dPoints[cnt] = new MapInfo.Geometry.DPoint(x, y); * } * * * //创建线图元及其样式 * FeatureGeometry fg = new MultiCurve(layer.CoordSys, CurveSegmentType.Linear, dPoints); * CompositeStyle cs = new MapInfo.Styles.CompositeStyle( * new SimpleLineStyle(new LineWidth(linewidth, LineWidthUnit.Pixel), 2, Color.Red) * ); * * MapInfo.Data.Feature feature = new MapInfo.Data.Feature(layer.Table.TableInfo.Columns); * * feature.Geometry = fg; * feature.Style = cs; * feature["name"] = name; * * //将线图元加入图层 * layer.Table.InsertFeature(feature); */ MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); return; }
public override void Process() { MapControlModel model = MapControlModel.GetModelFromSession(); model.SetMapSize(MapAlias, MapWidth, MapHeight); MapInfo.Mapping.Map map = model.GetMapObj(MapAlias); if (map == null) { return; } string strUID = HttpContext.Current.Request["uid"]; string strText = HttpContext.Current.Request["Name"]; System.Drawing.Point[] points = this.ExtractPoints(this.DataString); System.Drawing.Color clr = UserMap.stringToColor(HttpContext.Current.Request["Color"]); double x = (double)points[0].X / 10000; double y = (double)points[0].Y / 10000; UserMap.DeleteFeature(map, Constants.TempLayerAlias, strUID); UserMap.AddMarker(map, Constants.TempLayerAlias, strUID, strText, new DPoint(x, y), Constants.BMPFILENAME, Constants.POINT_SIZE, clr); /* * //获取图层和表 * FeatureLayer layer = (FeatureLayer)map.Layers[Constants.TempLayerAlias]; * if (layer == null) * { * return; * } * * double x = points[0].X/10000; * double y = points[0].Y/10000; * * * //创建点图元及其样式 * FeatureGeometry fg = new MapInfo.Geometry.Point( map.GetDisplayCoordSys(), x, y); * CompositeStyle cs = new CompositeStyle( * new BitmapPointStyle(Constants.BMPFILENAME, BitmapStyles.None, Color.Red, Constants.POINT_SIZE) * ); * * * Feature feature = new Feature(layer.Table.TableInfo.Columns); * feature.Geometry = fg; * feature.Style = cs; * feature["name"] = name; * * //fg.GetGeometryEditor().Rotate(dPoint, 90); * //fg.EditingComplete(); * * * //MapInfo.Geometry.IGeometryEdit edit = feature.Geometry.GetGeometryEditor(); * //edit.OffsetByAngle(90, 500, MapInfo.Geometry.DistanceUnit.Meter, MapInfo.Geometry.DistanceType.Spherical); * //edit.Geometry.EditingComplete(); * * layer.Table.InsertFeature(feature);*/ MemoryStream ms = model.GetMap(MapAlias, MapWidth, MapHeight, ExportFormat); StreamImageToClient(ms); return; }