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); //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); }