/// <summary> /// Initializes a new instance of the <see cref="GeoMap"/> class. /// </summary> public GeoMap() { InitializeComponent(); if (!LiveCharts.IsConfigured) { LiveCharts.Configure(LiveChartsSkiaSharp.DefaultPlatformBuilder); } _core = new GeoMap <SkiaSharpDrawingContext>(this); _shapesObserver = new CollectionDeepObserver <IMapElement>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); _seriesObserver = new CollectionDeepObserver <IGeoSeries>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); Background = new SolidColorBrush(new Color(0, 0, 0, 0)); PointerWheelChanged += OnPointerWheelChanged; PointerPressed += OnPointerPressed; PointerMoved += OnPointerMoved; PointerLeave += OnPointerLeave; //Shapes = Enumerable.Empty<MapShape<SkiaSharpDrawingContext>>(); ActiveMap = Maps.GetWorldMap <SkiaSharpDrawingContext>(); SyncContext = new object(); DetachedFromVisualTree += GeoMap_DetachedFromVisualTree; }
/// <summary> /// Initializes a new instance of the <see cref="GeoMap"/> class. /// </summary> public GeoMap() { InitializeComponent(); if (!LiveCharts.IsConfigured) { LiveCharts.Configure(LiveChartsSkiaSharp.DefaultPlatformBuilder); } _core = new GeoMap <SkiaSharpDrawingContext>(this); PointerPressed += OnPointerPressed; PointerMoved += OnPointerMoved; PointerReleased += OnPointerReleased; PointerWheelChanged += OnWheelChanged; PointerExited += OnPointerExited; SizeChanged += GeoMap_SizeChanged; _shapesObserver = new CollectionDeepObserver <IMapElement>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core.Update(), true); _seriesObserver = new CollectionDeepObserver <IGeoSeries>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core.Update(), true); SetValue(ShapesProperty, Enumerable.Empty <MapShape <SkiaSharpDrawingContext> >()); SetValue(SeriesProperty, Enumerable.Empty <IGeoSeries>()); SetValue(ActiveMapProperty, Maps.GetWorldMap <SkiaSharpDrawingContext>()); SetValue(SyncContextProperty, new object()); Unloaded += GeoMap_Unloaded; }
/// <summary> /// Initializes a new instance of the <see cref="GeoMap"/> class. /// </summary> public GeoMap() { InitializeComponent(); if (!LiveCharts.IsConfigured) { LiveCharts.Configure(LiveChartsSkiaSharp.DefaultPlatformBuilder); } _activeMap = Maps.GetWorldMap <SkiaSharpDrawingContext>(); _core = new GeoMap <SkiaSharpDrawingContext>(this); _shapesObserver = new CollectionDeepObserver <IMapElement>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); _seriesObserver = new CollectionDeepObserver <IGeoSeries>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); var c = Controls[0].Controls[0]; c.MouseDown += OnMouseDown; c.MouseMove += OnMouseMove; c.MouseUp += OnMouseUp; c.MouseLeave += OnMouseLeave; c.MouseWheel += OnMouseWheel; Resize += GeoMap_Resize; }
private void Initialize() { try { layersControl1.Map = mapControl1.Map; mapControl1.Action = Action.Pan; m_mapControlEagleEye.Map.ViewEntire(); m_mapControlEagleEye.MarginPanEnabled = false; m_mapControlEagleEye.IsWaitCursorEnabled = false; m_mapControlEagleEye.InteractionMode = InteractionMode.CustomAll; m_mapControlEagleEye.Cursor = Cursors.Arrow; workspaceControl1.WorkspaceTree.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(WorkspaceTree_NodeMouseDoubleClick); mapControl1.IsWaitCursorEnabled = false; mapControl1.TrackMode = TrackMode.Track; m_mapLayoutControl.TrackMode = TrackMode.Edit; m_mapLayoutControl.MapLayout.Zoom(4); elements = m_mapLayoutControl.MapLayout.Elements; geoMap = new GeoMap(); m_myAction = MeasureAction.None; mapControl1.MouseMove += new MouseEventHandler(MouseMoveHandler); mapControl1.Tracking += new TrackingEventHandler(TrackingHandler); mapControl1.Tracked += new TrackedEventHandler(TrackedHandler); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="GeoMap"/> class. /// </summary> public GeoMap() { InitializeComponent(); if (!LiveCharts.IsConfigured) { LiveCharts.Configure(LiveChartsSkiaSharp.DefaultPlatformBuilder); } _core = new GeoMap <SkiaSharpDrawingContext>(this); canvas.SkCanvasView.EnableTouchEvents = true; canvas.SkCanvasView.Touch += OnSkCanvasTouched; SizeChanged += GeoMap_SizeChanged; _shapesObserver = new CollectionDeepObserver <IMapElement>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); _seriesObserver = new CollectionDeepObserver <IGeoSeries>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); SetValue(ShapesProperty, Enumerable.Empty <IMapElement>()); SetValue(SeriesProperty, Enumerable.Empty <IGeoSeries>()); SetValue(ActiveMapProperty, Maps.GetWorldMap <SkiaSharpDrawingContext>()); SetValue(SyncContextProperty, new object()); }
public ViewModel(Map esriMap) { GeoMap = new GeoMap(esriMap); GeoMap.PanToChangedEvent += GeoMap_PanToChangedEvent; _geoMap.NavigateExtentDoneEvent += _geoMap_NavigateExtentDoneEvent; }
private void InitializeMap() { GeoMap = new GeoMap(); GeoMap.Source = WorldPath; // move, zoom in and zoom out GeoMap.EnableZoomingAndPanning = true; // show a value of heatmap on the Geomap. GeoMap.Hoverable = true; GeoMap.DefaultLandFill = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 242, 242)); GeoMap.Base.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(128, 128, 128)); mpnl_map.Controls.Add(GeoMap); GeoMap.Dock = DockStyle.Fill; GeoMap.LandStroke = new SolidColorBrush(Colors.Black); GeoMap.GradientStopCollection = new GradientStopCollection() { new GradientStop(System.Windows.Media.Color.FromRgb(250, 233, 233), 0.00), new GradientStop(System.Windows.Media.Color.FromRgb(234, 207, 207), 0.25), new GradientStop(System.Windows.Media.Color.FromRgb(191, 132, 132), 0.55), new GradientStop(System.Windows.Media.Color.FromRgb(158, 76, 76), 0.75), new GradientStop(System.Windows.Media.Color.FromRgb(113, 0, 0), 1.00), }; GeoMap.LandClick += GeoMap_LandClick; }
/// <summary> /// Initializes a new instance of <see cref="MapContext{TDrawingContext}"/> class. /// </summary> public MapContext( GeoMap <TDrawingContext> core, IGeoMapView <TDrawingContext> view, CoreMap <TDrawingContext> map, MapProjector projector) { CoreMap = core; MapFile = map; Projector = projector; View = view; }
private void InitializeLayout() { try { LayoutElements elements = mapLayoutControl1.MapLayout.Elements; // 构造GeoMap // Create the GeoMap object. GeoMap geoMap = new GeoMap(); geoMap.MapName = "地籍图"; // 设置GeoMap对象的外切矩形 // Set the exterior rectangle. Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D( 1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); // 构造指北针 // Initialize the GeoNorthArrow GeoNorthArrow northArrow = new GeoNorthArrow( NorthArrowStyleType.EightDirection, new Rectangle2D(new Point2D(1400, 2250), new Size2D(350, 350)), 0); northArrow.BindingGeoMapID = m_mapID; elements.AddNew(northArrow); // 构造比例尺 // Initialize the scale GeoMapScale scale = new GeoMapScale(m_mapID, new Point2D(125, 400), 50, 50); scale.LeftDivisionCount = 2; scale.ScaleUnit = Unit.Kilometer; scale.SegmentCount = 4; elements.AddNew(scale); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Called when the control renders. /// </summary> /// <param name="firstRender"></param> /// <returns></returns> /// <exception cref="Exception"></exception> protected override async Task OnAfterRenderAsync(bool firstRender) { if (!firstRender) { return; } _core = new GeoMap <SkiaSharpDrawingContext>(this); _shapesObserver = new CollectionDeepObserver <IMapElement>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); _seriesObserver = new CollectionDeepObserver <IGeoSeries>( (object?sender, NotifyCollectionChangedEventArgs e) => _core?.Update(), (object?sender, PropertyChangedEventArgs e) => _core?.Update(), true); // ToDo: Pointer events. //var c = Controls[0].Controls[0]; //c.MouseDown += OnMouseDown; //c.MouseMove += OnMouseMove; //c.MouseUp += OnMouseUp; //c.MouseLeave += OnMouseLeave; //c.MouseWheel += OnMouseWheel; //Resize += GeoMap_Resize; if (_dom is null) { _dom = new DomJsInterop(JS); } var canvasBounds = await _dom.GetBoundingClientRect(_canvasContainer); _canvasWidth = canvasBounds.Width; _canvasHeight = canvasBounds.Height; _core.Update(); if (_motionCanvas is null) { throw new Exception("MotionCanvas not found"); } _jsFlexibleContainer.Resized += OnResized; }
public View() { InitializeComponent(); Size = new System.Drawing.Size(90, 90); var viewModel = new ViewModel(); // Adding a cartesian chart to the UI... _cartesian = new CartesianChart { Series = viewModel.CatesianSeries, // out of livecharts properties... Location = new System.Drawing.Point(0, 0), Size = new System.Drawing.Size(400, 200) }; Controls.Add(_cartesian); // Adding a pie chart to the UI... _pie = new PieChart { Series = viewModel.PieSeries, // out of livecharts properties... Location = new System.Drawing.Point(0, 200), Size = new System.Drawing.Size(400, 200) }; Controls.Add(_pie); // Adding a map chart to the UI... _map = new GeoMap { Shapes = viewModel.MapShapes, // out of livecharts properties... Location = new System.Drawing.Point(0, 400), Size = new System.Drawing.Size(400, 200) }; Controls.Add(_map); // now lets create the images // mark CreateImageFromCartesianControl(); // mark CreateImageFromPieControl(); // mark CreateImageFromGeoControl(); // mark }
async void OnItemChanged(object newValue) { location = (string)newValue; try { string json = await fnDownloadString(strGeoCodingUrl + "?address=" + (string)newValue); if (json == "Exception") { return; } GeoMap objGeo = JsonConvert.DeserializeObject <GeoMap>(json); PositionChanged = new Position(objGeo.results[0].geometry.location.lat, objGeo.results[0].geometry.location.lng); } catch { await _contentPage.DisplayAlert("Warning", "Unable to process at this moment!!!", "OK"); } }
public View() { InitializeComponent(); Size = new System.Drawing.Size(50, 50); var viewModel = new ViewModel(); var chart = new GeoMap { Shapes = viewModel.Shapes, // out of livecharts properties... Location = new System.Drawing.Point(0, 0), Size = new System.Drawing.Size(50, 50), Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom }; Controls.Add(chart); }
public gk065() { InitializeComponent(); workspace1 = new SuperMap.Data.Workspace(); /* WorkspaceConnectionInfo workspaceConnectionInfo = new WorkspaceConnectionInfo(); * workspaceConnectionInfo.Type = WorkspaceType.Oracle; * workspaceConnectionInfo.Server = "ORCL"; * workspaceConnectionInfo.Database = ""; * workspaceConnectionInfo.Name = "workspace"; * workspaceConnectionInfo.User = "******"; * workspaceConnectionInfo.Password = "******"; * workspace1.Open(workspaceConnectionInfo);*/ workspace1.Open(gkfqd.Common.Tool.GetConnectionInfo()); mapLayoutControl1.MapLayout.Workspace = workspace1; mapLayoutControl1.IsHorizontalScrollbarVisible = true; mapLayoutControl1.IsVerticalScrollbarVisible = true; try { LayoutElements elements = mapLayoutControl1.MapLayout.Elements; //构造GeoMap GeoMap geoMap = new GeoMap(); geoMap.MapName = "temp"; //设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D( 1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } mapLayoutControl1.TrackMode = TrackMode.Edit; mapLayoutControl1.MapLayout.Zoom(4); }
public void InitializeLayout(string mapName) { try { LayoutElements elements = m_mapLayoutControl.MapLayout.Elements; // 构造GeoMap GeoMap geoMap = new GeoMap(); //设置地图名称,在工作空间内的地图 geoMap.MapName = mapName; // 设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(1000, 1300), new Size2D(1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
private void AddMap(string mapName) { try { LayoutElements elements = mapLayoutControl1.MapLayout.Elements; //构造GeoMap GeoMap geoMapUse = new GeoMap(); geoMapUse.MapName = mapName; // geoMapUse. = m_mapControl.Map; //设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D( 1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMapUse.Shape = geoRect; elements.AddNew(geoMapUse); m_mapID = elements.GetID(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
internal MyWorldMapChart(Object _worldMapChart) { this.worldMapChart = (GeoMap)_worldMapChart; }
public View() { InitializeComponent(); Size = new System.Drawing.Size(90, 90); var viewModel = new ViewModel(); // Adding a cartesian chart to the UI... _cartesian = new CartesianChart { Series = viewModel.CatesianSeries, // out of livecharts properties... Location = new System.Drawing.Point(0, 0), Size = new System.Drawing.Size(400, 200), //Anchor = AnchorStyles.Left | AnchorStyles.Right }; Controls.Add(_cartesian); // Adding a pie chart to the UI... _pie = new PieChart { Series = viewModel.PieSeries, // out of livecharts properties... Location = new System.Drawing.Point(0, 200), Size = new System.Drawing.Size(400, 200), //Anchor = AnchorStyles.Left | AnchorStyles.Right }; Controls.Add(_pie); // Adding a map chart to the UI... _map = new GeoMap { Shapes = viewModel.MapShapes, // out of livecharts properties... Location = new System.Drawing.Point(0, 400), Size = new System.Drawing.Size(400, 200), //Anchor = AnchorStyles.Left | AnchorStyles.Right }; Controls.Add(_map); // CARTESIAN CHART IMAGE // you can create an image of a chart from memory using the // SKCartesianChart, SKPieChart or SKGeoMap classes. // in the case of this sample // the image was generated at the root folder var cartesianChart = new SKCartesianChart { Width = 900, Height = 600, Series = viewModel.CatesianSeries }; // notice classes that implement ISkiaSharpChart (SKCartesianChart, SKPieChart and SKGeoMap classes) // do not require a UI you can use this objects installing only the // LiveChartsCore.SkiaSharpView package. // you can save the image to png (by default), or use the second argument to specify another format. cartesianChart.SaveImage("CartesianImageFromMemory.png"); // <- path where the image will be generated // alternatively you can get the image and do different operations: using var image = cartesianChart.GetImage(); using var data = image.Encode(); var base64 = Convert.ToBase64String(data.AsSpan()); // or you could also use a chart in the user interface to create an image CreateImageFromCartesianControl(); // PIE CHART IMAGE new SKPieChart { Width = 900, Height = 600, Series = viewModel.PieSeries }.SaveImage("PieImageFromMemory.png"); // or create it from a control in the UI CreateImageFromPieControl(); // GEO MAP CHART IMAGE new SKGeoMap { Width = 900, Height = 600, Shapes = viewModel.MapShapes }.SaveImage("MapImageFromMemory.png"); // or create it from a control in the UI CreateImageFromGeoControl(); }
private void 边框ToolStripMenuItem_Click(object sender, EventArgs e) { GeoMap geoMapUseLine = new GeoMap(); geoMapUseLine.MapName = "2000年各省人口数分段专题图"; //设置GeoMap对象的外切矩形 Rectangle2D rectangle2D = new Rectangle2D(new Point2D(850, 1250), new Size2D(1500, 1500)); GeoRectangle geoRectangle = new GeoRectangle(rectangle2D, 0); geoMapUseLine.Shape = geoRectangle; //设置GeoMap对象的MapBorder GeoMapBorder geoMapBorder = new GeoMapBorder(); geoMapBorder.BorderType = GeoMapBorderType.Complex; //设置MapBorder的内框 geoMapBorder.InFrameColor = Color.White; geoMapBorder.InFrameWidth = 0.5; geoMapBorder.InFrameInterval = 5; //设置MapBorder的内线 geoMapBorder.InLineColor = Color.FromArgb(115, 115, 115); geoMapBorder.InLineWidth = 0.5; geoMapBorder.InLineInterval = 5; //设置MapBorder的外线 geoMapBorder.OutLineColor = Color.White; geoMapBorder.OutLineWidth = 0.5; geoMapBorder.OutLineInterval = 30; //设置MapBorder的外框 geoMapBorder.OutFrameColor = Color.FromArgb(115, 115, 115); geoMapBorder.OutFrameWidth = 1; geoMapBorder.OutFrameInterval = 2; //设置填充文本的风格 TextStyle fillTextStyle = new TextStyle(); fillTextStyle.Shadow = true; fillTextStyle.Alignment = TextAlignment.TopCenter; fillTextStyle.BackColor = Color.White; fillTextStyle.ForeColor = Color.FromArgb(135, 171, 217); fillTextStyle.BackOpaque = true; fillTextStyle.Bold = false; fillTextStyle.FontName = "宋体"; fillTextStyle.FontHeight = 10.0; fillTextStyle.FontWidth = 10.0; fillTextStyle.IsSizeFixed = false; fillTextStyle.Weight = 100; //设置MapBorder的填充 geoMapBorder.FillType = GeoMapBorderFillType.Text; geoMapBorder.FillDirection = FillDirectionType.Inner; geoMapBorder.FillText = " * "; geoMapBorder.FillTextStyle = fillTextStyle; //设置MapBorder的转角填充 geoMapBorder.CornerFillType = GeoMapBorderFillType.Image; geoMapBorder.CornerFillImageFile = @"../../Resources/SceneBrowse/a18.bmp"; geoMapBorder.CornerFillStartMode = CornerFillStartMode.LeftBottom; geoMapUseLine.MapBorder = geoMapBorder; geoMapUseLine.IsBorderVisible = true; mapLayoutControl1.MapLayout.Elements.AddNew(geoMapUseLine); }
private void 图例ToolStripMenuItem_Click(object sender, EventArgs e) { LayoutElements layoutElements = mapLayoutControl1.MapLayout.Elements; layoutElements.SeekID(GetMapID()); GeoMap geoMapUse = (GeoMap)layoutElements.GetGeometry(); string geoMapName = geoMapUse.MapName; GeoLegend geoLegend = new GeoLegend(geoMapName, workspace1); geoLegend.Height = 175; geoLegend.Width = 350; geoLegend.Center = new Point2D(1375, 1855); GeoStyle geoLegendStyle = new GeoStyle(); geoLegendStyle.FillForeColor = Color.FromArgb(255, 235, 175); geoLegendStyle.FillOpaqueRate = 30; geoLegendStyle.LineWidth = 0.5; geoLegendStyle.LineColor = Color.FromArgb(65, 65, 65); geoLegend.BackGroundStyle = geoLegendStyle; geoLegend.ColumnCount = 3; //设置图例项和图例子项的说明文本的风格 TextStyle geoLegendtextStyle = new TextStyle(); geoLegendtextStyle.BackColor = Color.Yellow; geoLegendtextStyle.ForeColor = Color.Blue; geoLegendtextStyle.FontName = "宋体"; geoLegendtextStyle.FontHeight = 20.0; geoLegendtextStyle.FontWidth = 12.0; geoLegendtextStyle.IsSizeFixed = false; geoLegend.ItemTextStyle = geoLegendtextStyle; geoLegend.SubItemTextStyle = geoLegendtextStyle; //设置图例标题风格 TextStyle titleTextStyle = new TextStyle(); titleTextStyle.BackColor = Color.Yellow; titleTextStyle.ForeColor = Color.Blue; titleTextStyle.FontName = "宋体"; titleTextStyle.FontHeight = 40.0; titleTextStyle.FontWidth = 25.0; titleTextStyle.Italic = true; titleTextStyle.Bold = true; titleTextStyle.IsSizeFixed = false; titleTextStyle.Weight = 200; geoLegend.Title = "图例"; geoLegend.TitleStyle = titleTextStyle; //将图例添加到布局图层,而非屏幕图层。 geoLegend.Load(false); mapLayoutControl1.MapLayout.Elements.AddNew(geoLegend); }
private void 添加标题ToolStripMenuItem_Click(object sender, EventArgs e) { gk066 addTitle = new gk066(); addTitle.StartPosition = FormStartPosition.CenterScreen; //窗体居中 addTitle.ShowDialog(); #region 添加标文本题 //标题添加 TextStyle textStyle = new TextStyle(); textStyle.Alignment = TextAlignment.TopCenter; textStyle.BackColor = Color.FromArgb(65, 65, 65); textStyle.ForeColor = Color.FromArgb(174, 241, 176); textStyle.BackOpaque = false; textStyle.Bold = true; textStyle.FontName = "楷体"; textStyle.FontHeight = addTitle.FontHeight; textStyle.FontWidth = addTitle.FontWidth; textStyle.IsSizeFixed = false; textStyle.Italic = true; textStyle.Outline = true; textStyle.Weight = 500; //添加文本 TextPart textPart = new TextPart(addTitle.title, new Point2D(850, 2150), 0); geoText = new GeoText(textPart, textStyle); //先删除后添加实现刷新效果 if (ElementsId != -1) { ElementsIdS[0] = ElementsId; mapLayoutControl1.MapLayout.Elements.Delete(ElementsIdS); } //添加地图 mapLayoutControl1.MapLayout.Elements.AddNew(geoText); //取得id 下次设定时删除用 ElementsId = mapLayoutControl1.MapLayout.Elements.GetID(); mapLayoutControl1.MapLayout.Elements.Refresh(); #endregion #region 设定图层颜色 与显示比例尺 geoMapUse = mapLayoutControl1.MapLayout.Elements.GetGeometry() as GeoMap; Map map = new Map(); map.Workspace = workspace1; map.FromXML(workspace1.Maps.GetMapXML(geoMapUse.MapName)); LayerSettingVector setting = map.Layers[0].AdditionalSetting as LayerSettingVector; setting.Style.FillForeColor = addTitle.selectColor; map.Layers[0].AdditionalSetting = setting; workspace1.Maps.SetMapXML(geoMapUse.MapName, map.ToXML()); workspace1.Save(); geoMapUse = new GeoMap(); geoMapUse.MapName = "temp"; //设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D( 1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMapUse.Shape = geoRect; //动态设置缩放比例尺 geoMapUse.MapScale = addTitle.scaleNumerator / addTitle.scaleDenominato; mapLayoutControl1.MapLayout.Elements.AddNew(geoMapUse); //记录下mapid ElementsIdMap = mapLayoutControl1.MapLayout.Elements.GetID(); mapLayoutControl1.MapLayout.Elements.Refresh(); #endregion #region 添加地图比例标尺 //添加地图带比例标尺 geoMapScale = new GeoMapScale(ElementsIdMap, new Point2D(1050, 515), 550, 18); geoMapScale.ScaleUnit = Unit.Kilometer; geoMapScale.LeftDivisionCount = 2; geoMapScale.SegmentCount = 2; geoMapScale.ScaleType = GeoMapScaleType.Railway; ////先删除后添加实现刷新效果 if (ElementsIdScale != -1) { ElementsIdScaleArrar[0] = ElementsIdScale; mapLayoutControl1.MapLayout.Elements.Delete(ElementsIdScaleArrar); } //取得id 下次设定时删除用 mapLayoutControl1.MapLayout.Elements.AddNew(geoMapScale); ElementsIdScale = mapLayoutControl1.MapLayout.Elements.GetID(); mapLayoutControl1.MapLayout.Elements.Refresh(); #endregion addTitle.Close(); }
public View() { InitializeComponent(); Size = new System.Drawing.Size(90, 90); var viewModel = new ViewModel(); // Adding a cartesian chart to the UI... _cartesian = new CartesianChart { Series = viewModel.CaterianSeries, // out of livecharts properties... Location = new System.Drawing.Point(0, 0), Size = new System.Drawing.Size(400, 200), //Anchor = AnchorStyles.Left | AnchorStyles.Right }; Controls.Add(_cartesian); // Adding a pie chart to the UI... _pie = new PieChart { Series = viewModel.PieSeries, // out of livecharts properties... Location = new System.Drawing.Point(0, 200), Size = new System.Drawing.Size(400, 200), //Anchor = AnchorStyles.Left | AnchorStyles.Right }; Controls.Add(_pie); // Adding a map chart to the UI... _map = new GeoMap { Values = viewModel.MapValues, // out of livecharts properties... Location = new System.Drawing.Point(0, 400), Size = new System.Drawing.Size(400, 200), //Anchor = AnchorStyles.Left | AnchorStyles.Right }; Controls.Add(_map); // CARTESIAN CHART IMAGE // you can create a image of a chart from memory using the // SKCartesianChart, SKPieChart or SKGeoMap controls. // in the case of this sample // the image was generated at the root folder ( samples/AvaloniaSample/bin/Debug/{targetFramework}/ ) new SKCartesianChart { Width = 900, Height = 600, Series = viewModel.CaterianSeries }.SaveImage("CartesianImageFromMemory.png"); // <- path where the image will be generated // or you could also use a chart in the user interface to create an image CreateImageFromCartesianControl(); // PIE CHART IMAGE new SKPieChart { Width = 900, Height = 600, Series = viewModel.PieSeries }.SaveImage("PieImageFromMemory.png"); // or create it from a control in the UI CreateImageFromPieControl(); // GEO MAP CHART IMAGE new SKGeoMap { Width = 900, Height = 600, Values = viewModel.MapValues }.SaveImage("MapImageFromMemory.png"); // or create it from a control in the UI CreateImageFromGeoControl(); }
private GeoMapSet CreateExportFile() { var filtered = new GeoMapSet(); var checkedMaps = new Dictionary <string, List <string> >(); var x = myTreeView.Nodes.Cast <TreeNode>() .Sum(node => node.Nodes.Cast <TreeNode>().Count(child => child.Checked)); if (x == 0) { return(null); } foreach (TreeNode node in myTreeView.Nodes) { var key = node.Text; if (node.Checked) { checkedMaps.Add(key, new List <string>()); foreach (TreeNode child in node.Nodes) { if (child.Checked) { checkedMaps[key].Add(child.Tag.ToString()); } } } } var clone = mGeoMapSet.DeepClone(); foreach (var chk in checkedMaps) { filtered.BcgMenus.AddRange(clone.BcgMenus.Where(t => t.Name == chk.Key)); filtered.FilterMenus.AddRange(clone.FilterMenus.Where(t => t.Name == chk.Key)); var maps = clone.GeoMaps.Where(t => t.FilterMenuName == chk.Key); foreach (var map in maps) { var filteredMap = new GeoMap { Name = map.Name, BcgGroup = map.BcgGroup, BcgMenuName = map.BcgMenuName, FilterMenuName = map.FilterMenuName, LabelLine1 = map.LabelLine1, LabelLine2 = map.LabelLine2, Objects = new List <Vatsim.GeoMapObject>() }; foreach (var obj in map.Objects) { if (chk.Value.Contains(obj.Filter)) { var mapObj = new Vatsim.GeoMapObject() { Description = obj.Description, TdmOnly = obj.TdmOnly, }; if (obj.TextDefaults != null) { if (chk.Value.Contains(obj.TextDefaults.Filters.ToString())) { mapObj.TextDefaults = obj.TextDefaults; } } if (obj.SymbolDefaults != null) { if (chk.Value.Contains(obj.SymbolDefaults.Filters.ToString())) { mapObj.SymbolDefaults = obj.SymbolDefaults; } } if (obj.LineDefaults != null) { if (chk.Value.Contains(obj.LineDefaults.Filters.ToString())) { mapObj.LineDefaults = obj.LineDefaults; } } foreach (Element elem in obj.Elements) { if (mapObj.LineDefaults != null && elem is Line) { mapObj.Elements.Add(elem); } if (mapObj.TextDefaults != null && elem is Text) { mapObj.Elements.Add(elem); } if (mapObj.SymbolDefaults != null && elem is Symbol) { mapObj.Elements.Add(elem); } } filteredMap.Objects.Add(mapObj); } } if (filteredMap.Objects.Count > 0) { filtered.GeoMaps.Add(filteredMap); } } } foreach (var map in filtered.GeoMaps) { foreach (var obj in map.Objects) { if (obj.LineDefaults != null) { var newFilter = filtered.FilterMenus.Where(t => t.Name == map.FilterMenuName) .SelectMany(t => t.Items).FirstOrDefault(t => t.FilterGroup == obj.LineDefaults.Filters); if (newFilter != null) { obj.LineDefaults.Filters = newFilter.OurId; } var newBcgFilter = filtered.BcgMenus.Where(t => t.Name == map.BcgMenuName) .SelectMany(t => t.Items).FirstOrDefault(t => t.BcgGroups == obj.LineDefaults.BcgGroup); if (newBcgFilter != null) { obj.LineDefaults.BcgGroup = newBcgFilter.OurId; } } if (obj.SymbolDefaults != null) { var newFilter = filtered.FilterMenus.Where(t => t.Name == map.FilterMenuName) .SelectMany(t => t.Items).FirstOrDefault(t => t.FilterGroup == obj.SymbolDefaults.Filters); if (newFilter != null) { obj.SymbolDefaults.Filters = newFilter.OurId; } var newBcgFilter = filtered.BcgMenus.Where(t => t.Name == map.BcgMenuName) .SelectMany(t => t.Items).FirstOrDefault(t => t.BcgGroups == obj.SymbolDefaults.BcgGroup); if (newBcgFilter != null) { obj.SymbolDefaults.BcgGroup = newBcgFilter.OurId; } } if (obj.TextDefaults != null) { var newFilter = filtered.FilterMenus.Where(t => t.Name == map.FilterMenuName) .SelectMany(t => t.Items).FirstOrDefault(t => t.FilterGroup == obj.TextDefaults.Filters); if (newFilter != null) { obj.TextDefaults.Filters = newFilter.OurId; } var newBcgFilter = filtered.BcgMenus.Where(t => t.Name == map.BcgMenuName) .SelectMany(t => t.Items).FirstOrDefault(t => t.BcgGroups == obj.TextDefaults.BcgGroup); if (newBcgFilter != null) { obj.TextDefaults.BcgGroup = newBcgFilter.OurId; } } } } return(filtered); }
/// <summary> /// Initializes a new instance of the <see cref="SKGeoMap"/> class. /// </summary> public SKGeoMap() { _core = new GeoMap <SkiaSharpDrawingContext>(this); }