WPF 實現扇形統計圖

扇形統計圖

原文作者:ArcherSong

博客地址:https://www.cnblogs.com/ganbei/

  • 繪制一個扇形原理也是基于Canvas進行繪制;

  • ArcSegment[1]繪制弧形;

  • 繪制指示線;

  • 繪制文本;

  • 鼠標移入動畫;

  • 顯示詳情Popup

  • 源碼Github[2]Gitee[3]

d98353b88539bcd0124950eb42a88472.png

1)SectorChart.cs代碼如下;

using?System;
using?System.Collections.Generic;
using?System.Collections.ObjectModel;
using?System.Linq;
using?System.Windows;
using?System.Windows.Controls;
using?System.Windows.Controls.Primitives;
using?System.Windows.Input;
using?System.Windows.Media;
using?System.Windows.Media.Animation;
using?System.Windows.Media.Effects;
using?System.Windows.Shapes;
using?WPFDevelopers.Charts.Models;namespace?WPFDevelopers.Charts.Controls
{[TemplatePart(Name?=?CanvasTemplateName,?Type?=?typeof(Canvas))][TemplatePart(Name?=?PopupTemplateName,?Type?=?typeof(Popup))]public?class?SectorChart?:?Control{const?string?CanvasTemplateName?=?"PART_Canvas";const?string?PopupTemplateName?=?"PART_Popup";private?Canvas?_canvas;private?Popup?_popup;private?double?centenrX,?centenrY,?radius,?offsetX,?offsetY;private?Point?minPoint;private?double?fontsize?=?12;private?bool?flg?=?false;public?Brush?Fill{get?{?return?(Brush)GetValue(FillProperty);?}set?{?SetValue(FillProperty,?value);?}}public?static?readonly?DependencyProperty?FillProperty?=DependencyProperty.Register("Fill",?typeof(Brush),?typeof(SectorChart),?new?PropertyMetadata(null));public?string?Text{get?{?return?(string)GetValue(TextProperty);?}set?{?SetValue(TextProperty,?value);?}}public?static?readonly?DependencyProperty?TextProperty?=DependencyProperty.Register("Text",?typeof(string),?typeof(SectorChart),?new?PropertyMetadata(null));public?ObservableCollection<PieSerise>?ItemsSource{get?{?return?(ObservableCollection<PieSerise>)GetValue(ItemsSourceProperty);?}set?{?SetValue(ItemsSourceProperty,?value);?}}public?static?readonly?DependencyProperty?ItemsSourceProperty?=DependencyProperty.Register("ItemsSource",?typeof(ObservableCollection<PieSerise>),?typeof(SectorChart),?new?PropertyMetadata(null,?new?PropertyChangedCallback(ItemsSourceChanged)));private?static?void?ItemsSourceChanged(DependencyObject?d,?DependencyPropertyChangedEventArgs?e){var?view?=?d?as?SectorChart;if?(e.NewValue?!=?null)view.DrawArc();}static?SectorChart(){DefaultStyleKeyProperty.OverrideMetadata(typeof(SectorChart),?new?FrameworkPropertyMetadata(typeof(SectorChart)));}public?override?void?OnApplyTemplate(){base.OnApplyTemplate();_canvas?=?GetTemplateChild(CanvasTemplateName)?as?Canvas;_popup?=?GetTemplateChild(PopupTemplateName)?as?Popup;}void?DrawArc(){if?(ItemsSource?is?null?||?!ItemsSource.Any()?||?_canvas?is?null)return;_canvas.Children.Clear();var?pieWidth?=?_canvas.ActualWidth?>?_canvas.ActualHeight???_canvas.ActualHeight?:?_canvas.ActualWidth;var?pieHeight?=?_canvas.ActualWidth?>?_canvas.ActualHeight???_canvas.ActualHeight?:?_canvas.ActualWidth;centenrX?=?pieWidth?/?2;centenrY?=?pieHeight?/?2;radius?=?this.ActualWidth?>?this.ActualHeight???this.ActualHeight?/?2?:?this.ActualWidth?/?2;double?angle?=?0;double?prevAngle?=?0;var?sum?=?ItemsSource.Select(ser?=>?ser.Percentage).Sum();foreach?(var?item?in?ItemsSource){var?line1X?=?radius?*?Math.Cos(angle?*?Math.PI?/?180)?+?centenrX;var?line1Y?=?radius?*?Math.Sin(angle?*?Math.PI?/?180)?+?centenrY;angle?=?item.Percentage?/?sum?*?360?+?prevAngle;double?arcX?=?0;double?arcY?=?0;if?(ItemsSource.Count()?==?1?&&?angle?==?360){arcX?=?centenrX?+?Math.Cos(359.99999?*?Math.PI?/?180)?*?radius;arcY?=?(radius?*?Math.Sin(359.99999?*?Math.PI?/?180))?+?centenrY;}else{arcX?=?centenrX?+?Math.Cos(angle?*?Math.PI?/?180)?*?radius;arcY?=?(radius?*?Math.Sin(angle?*?Math.PI?/?180))?+?centenrY;}var?line1Segment?=?new?LineSegment(new?Point(line1X,?line1Y),?false);bool?isLargeArc?=?item.Percentage?/?sum?>?0.5;var?arcWidth?=?radius;var?arcHeight?=?radius;var?arcSegment?=?new?ArcSegment();arcSegment.Size?=?new?Size(arcWidth,?arcHeight);arcSegment.Point?=?new?Point(arcX,?arcY);arcSegment.SweepDirection?=?SweepDirection.Clockwise;arcSegment.IsLargeArc?=?isLargeArc;var?line2Segment?=?new?LineSegment(new?Point(centenrX,?centenrY),?false);PieBase?piebase?=?new?PieBase();piebase.Title?=?item.Title;piebase.Percentage?=?item.Percentage;piebase.PieColor?=?item.PieColor;piebase.LineSegmentStar?=?line1Segment;piebase.ArcSegment?=?arcSegment;piebase.LineSegmentEnd?=?line2Segment;piebase.Angle?=?item.Percentage?/?sum?*?360;piebase.StarPoint?=?new?Point(line1X,?line1Y);piebase.EndPoint?=?new?Point(arcX,?arcY);var?pathFigure?=?new?PathFigure(new?Point(centenrX,?centenrY),?new?List<PathSegment>(){line1Segment,arcSegment,line2Segment,},?true);var?pathFigures?=?new?List<PathFigure>(){pathFigure,};var?pathGeometry?=?new?PathGeometry(pathFigures);var?path?=?new?Path()?{?Fill?=?item.PieColor,?Data?=?pathGeometry,?DataContext?=?piebase?};_canvas.Children.Add(path);prevAngle?=?angle;var?line3?=?DrawLine(path);if?(line3?!=?null)piebase.Line?=?line3;var?textPathGeo?=?DrawText(path);var?textpath?=?new?Path()?{?Fill?=?item.PieColor,?Data?=?textPathGeo?};piebase.TextPath?=?textpath;_canvas.Children.Add(textpath);path.MouseMove?+=?Path_MouseMove1;path.MouseLeave?+=?Path_MouseLeave;if?(ItemsSource.Count()?==?1?&&?angle?==?360){_canvas.Children.Add(line3);}else{var?outline1?=?new?Line(){X1?=?centenrX,Y1?=?centenrY,X2?=?line1Segment.Point.X,Y2?=?line1Segment.Point.Y,Stroke?=?Brushes.White,StrokeThickness?=?0.8,};var?outline2?=?new?Line(){X1?=?centenrX,Y1?=?centenrY,X2?=?arcSegment.Point.X,Y2?=?arcSegment.Point.Y,Stroke?=?Brushes.White,StrokeThickness?=?0.8,};_canvas.Children.Add(outline1);_canvas.Children.Add(outline2);_canvas.Children.Add(line3);}}}private?void?Path_MouseLeave(object?sender,?MouseEventArgs?e){_popup.IsOpen?=?false;var?path?=?sender?as?Path;var?dt?=?path.DataContext?as?PieBase;TranslateTransform?ttf?=?new?TranslateTransform();ttf.X?=?0;ttf.Y?=?0;path.RenderTransform?=?ttf;dt.Line.RenderTransform?=?new?TranslateTransform(){X?=?0,Y?=?0,};dt.TextPath.RenderTransform?=?new?TranslateTransform(){X?=?0,Y?=?0,};path.Effect?=?new?DropShadowEffect(){Color?=?(Color)ColorConverter.ConvertFromString("#FF949494"),BlurRadius?=?20,Opacity?=?0,ShadowDepth?=?0};flg?=?false;}private?void?Path_MouseMove1(object?sender,?MouseEventArgs?e){Path?path?=?sender?as?Path;//動畫if?(!flg){BegionOffsetAnimation(path);}ShowMousePopup(path,?e);}void?ShowMousePopup(Path?path,?MouseEventArgs?e){var?data?=?path.DataContext?as?PieBase;if?(!_popup.IsOpen)_popup.IsOpen?=?true;var?mousePosition?=?e.GetPosition((UIElement)_canvas.Parent);_popup.HorizontalOffset?=?mousePosition.X?+?20;_popup.VerticalOffset?=?mousePosition.Y?+?20;Text?=?(data.Title?+?"?:?"?+?data.Percentage);//顯示鼠標當前坐標點Fill?=?data.PieColor;}void?BegionOffsetAnimation(Path?path){NameScope.SetNameScope(this,?new?NameScope());var?pathDataContext?=?path.DataContext?as?PieBase;var?angle?=?pathDataContext.Angle;minPoint?=?new?Point(Math.Round(pathDataContext.StarPoint.X?+?pathDataContext.EndPoint.X)?/?2,?Math.Round(pathDataContext.StarPoint.Y?+?pathDataContext.EndPoint.Y)?/?2);var?v1?=?minPoint?-?new?Point(centenrX,?centenrY);var?v2?=?new?Point(2000,?0)?-?new?Point(0,?0);double?vAngle?=?0;if?(180?<?angle?&&?angle?<=?360?&&?pathDataContext.Percentage?/?ItemsSource.Select(p?=>?p.Percentage).Sum()?>=?0.5){vAngle?=?Math.Round(Vector.AngleBetween(v2,?-v1));}else{vAngle?=?Math.Round(Vector.AngleBetween(v2,?v1));}offsetX?=?10?*?Math.Cos(vAngle?*?Math.PI?/?180);offsetY?=?10?*?Math.Sin(vAngle?*?Math.PI?/?180);var?line3?=?pathDataContext.Line;var?textPath?=?pathDataContext.TextPath;TranslateTransform?LineAnimatedTranslateTransform?=new?TranslateTransform();this.RegisterName("LineAnimatedTranslateTransform",?LineAnimatedTranslateTransform);line3.RenderTransform?=?LineAnimatedTranslateTransform;TranslateTransform?animatedTranslateTransform?=new?TranslateTransform();this.RegisterName("AnimatedTranslateTransform",?animatedTranslateTransform);path.RenderTransform?=?animatedTranslateTransform;TranslateTransform?TextAnimatedTranslateTransform?=new?TranslateTransform();this.RegisterName("TextAnimatedTranslateTransform",?animatedTranslateTransform);textPath.RenderTransform?=?animatedTranslateTransform;DoubleAnimation?daX?=?new?DoubleAnimation();Storyboard.SetTargetProperty(daX,?new?PropertyPath(TranslateTransform.XProperty));daX.Duration?=?new?Duration(TimeSpan.FromSeconds(0.2));daX.From?=?0;daX.To?=?offsetX;DoubleAnimation?daY?=?new?DoubleAnimation();Storyboard.SetTargetName(daY,?nameof(animatedTranslateTransform));Storyboard.SetTargetProperty(daY,?new?PropertyPath(TranslateTransform.YProperty));daY.Duration?=?new?Duration(TimeSpan.FromSeconds(0.2));daY.From?=?0;daY.To?=?offsetY;path.Effect?=?new?DropShadowEffect(){Color?=?(Color)ColorConverter.ConvertFromString("#2E2E2E"),BlurRadius?=?33,Opacity?=?0.6,ShadowDepth?=?0};animatedTranslateTransform.BeginAnimation(TranslateTransform.XProperty,?daX);animatedTranslateTransform.BeginAnimation(TranslateTransform.YProperty,?daY);LineAnimatedTranslateTransform.BeginAnimation(TranslateTransform.XProperty,?daX);LineAnimatedTranslateTransform.BeginAnimation(TranslateTransform.YProperty,?daY);TextAnimatedTranslateTransform.BeginAnimation(TranslateTransform.XProperty,?daX);TextAnimatedTranslateTransform.BeginAnimation(TranslateTransform.YProperty,?daY);flg?=?true;}///?<summary>///?畫指示線///?</summary>///?<param?name="path"></param>///?<returns></returns>Polyline?DrawLine(Path?path){NameScope.SetNameScope(this,?new?NameScope());var?pathDataContext?=?path.DataContext?as?PieBase;var?angle?=?pathDataContext.Angle;pathDataContext.Line?=?null;minPoint?=?new?Point(Math.Round(pathDataContext.StarPoint.X?+?pathDataContext.EndPoint.X)?/?2,?Math.Round(pathDataContext.StarPoint.Y?+?pathDataContext.EndPoint.Y)?/?2);Vector?v1;if?(angle?>?180?&&?angle?<?360){v1?=?new?Point(centenrX,?centenrY)?-?minPoint;}else?if?(angle?==?180?||?angle?==?360){if?(Math.Round(pathDataContext.StarPoint.X)?==?Math.Round(pathDataContext.EndPoint.X)){v1?=?new?Point(radius?*?2,?radius)?-?new?Point(centenrX,?centenrY);}else{if?(Math.Round(pathDataContext.StarPoint.X)?-?Math.Round(pathDataContext.EndPoint.X)?==?2?*?radius){v1?=?new?Point(radius,?2?*?radius)?-?new?Point(centenrX,?centenrY);}else{v1?=?new?Point(radius,?0)?-?new?Point(centenrX,?centenrY);}}}else{v1?=?minPoint?-?new?Point(centenrX,?centenrY);}v1.Normalize();var?Vmin?=?v1?*?radius;var?RadiusToNodal?=?Vmin?+?new?Point(centenrX,?centenrY);var?v2?=?new?Point(2000,?0)?-?new?Point(0,?0);double?vAngle?=?0;vAngle?=?Math.Round(Vector.AngleBetween(v2,?v1));offsetX?=?10?*?Math.Cos(vAngle?*?Math.PI?/?180);offsetY?=?10?*?Math.Sin(vAngle?*?Math.PI?/?180);var?prolongPoint?=?new?Point(RadiusToNodal.X?+?offsetX?*?1,?RadiusToNodal.Y?+?offsetY?*?1);if?(RadiusToNodal.X?==?double.NaN?||?RadiusToNodal.Y?==?double.NaN?||?prolongPoint.X?==?double.NaN?||?prolongPoint.Y?==?double.NaN)return?null;var?point1?=?RadiusToNodal;var?point2?=?prolongPoint;Point?point3;if?(prolongPoint.X?>=?radius)point3?=?new?Point(prolongPoint.X?+?10,?prolongPoint.Y);elsepoint3?=?new?Point(prolongPoint.X?-?10,?prolongPoint.Y);PointCollection?polygonPoints?=?new?PointCollection();polygonPoints.Add(point1);polygonPoints.Add(point2);polygonPoints.Add(point3);var?line3?=?new?Polyline();line3.Points?=?polygonPoints;line3.Stroke?=?pathDataContext.PieColor;pathDataContext.PolylineEndPoint?=?point3;return?line3;}PathGeometry?DrawText(Path?path){NameScope.SetNameScope(this,?new?NameScope());var?pathDataContext?=?path.DataContext?as?PieBase;Typeface?typeface?=?new?Typeface(new?FontFamily("Microsoft?YaHei"),FontStyles.Normal,FontWeights.Normal,?FontStretches.Normal);FormattedText?text?=?new?FormattedText(pathDataContext.Title,new?System.Globalization.CultureInfo("zh-cn"),FlowDirection.LeftToRight,?typeface,?fontsize,?Brushes.RosyBrown);var?textWidth?=?text.Width;Geometry?geo?=?null;if?(pathDataContext.PolylineEndPoint.X?>?radius)geo?=?text.BuildGeometry(new?Point(pathDataContext.PolylineEndPoint.X?+?4,?pathDataContext.PolylineEndPoint.Y?-?fontsize?/?1.8));elsegeo?=?text.BuildGeometry(new?Point(pathDataContext.PolylineEndPoint.X?-?textWidth?-?4,?pathDataContext.PolylineEndPoint.Y?-?fontsize?/?1.8));PathGeometry?pathGeometry?=?geo.GetFlattenedPathGeometry();return?pathGeometry;}}
}

2)SectorChart.xaml 代碼如下;

<ResourceDictionary?xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:controls="clr-namespace:WPFDevelopers.Charts.Controls"><Style?TargetType="{x:Type?controls:SectorChart}"><Setter?Property="Width"?Value="300"/><Setter?Property="Height"?Value="300"/><Setter?Property="Template"><Setter.Value><ControlTemplate?TargetType="{x:Type?controls:SectorChart}"><Grid><Popup?x:Name="PART_Popup"?IsOpen="False"Placement="Relative"?AllowsTransparency="True"><Border?Background="White"?CornerRadius="5"?Padding="14"BorderThickness="0"BorderBrush="Transparent"><StackPanel?><Ellipse?Width="20"?Height="20"Fill="{TemplateBinding?Fill}"/><TextBlock?Background="White"?Padding="9,4,9,4"?TextWrapping="Wrap"?Text="{TemplateBinding?Text}"/></StackPanel></Border></Popup><Canvas?x:Name="PART_Canvas"??HorizontalAlignment="{TemplateBinding?HorizontalContentAlignment}"Width="{TemplateBinding?ActualWidth}"Height="{TemplateBinding?ActualHeight}"></Canvas></Grid></ControlTemplate></Setter.Value></Setter></Style>
</ResourceDictionary>

3) MainWindow.xaml使用如下;

xmlns:wsCharts="https://github.com/WPFDevelopersOrg.WPFDevelopers.Charts"<wsCharts:SectorChart??ItemsSource="{Binding?ItemsSource,RelativeSource={RelativeSource?AncestorType=local:MainWindow}}"Margin="30"?/>

4) MainWindow.xaml.cs代碼如下;

using?System.Collections.ObjectModel;
using?System.Windows;
using?System.Windows.Media;
using?WPFDevelopers.Charts.Models;namespace?WPFDevelopers.Charts.Samples
{///?<summary>///?MainWindow.xaml?的交互邏輯///?</summary>public?partial?class?MainWindow?{public?ObservableCollection<PieSerise>?ItemsSource{get?{?return?(ObservableCollection<PieSerise>)GetValue(ItemsSourceProperty);?}set?{?SetValue(ItemsSourceProperty,?value);?}}public?static?readonly?DependencyProperty?ItemsSourceProperty?=DependencyProperty.Register("ItemsSource",?typeof(ObservableCollection<PieSerise>),?typeof(MainWindow),?new?PropertyMetadata(null));public?MainWindow(){InitializeComponent();Loaded?+=?MainWindow_Loaded;}private?void?MainWindow_Loaded(object?sender,?RoutedEventArgs?e){ItemsSource?=?new?ObservableCollection<PieSerise>();var?collection1?=?new?ObservableCollection<PieSerise>();collection1.Add(new?PieSerise{Title?=?"2012",Percentage?=?30,PieColor?=?new?SolidColorBrush((Color)ColorConverter.ConvertFromString("#5B9BD5")),});collection1.Add(new?PieSerise{Title?=?"2013",Percentage?=?140,PieColor?=?new?SolidColorBrush((Color)ColorConverter.ConvertFromString("#4472C4")),});collection1.Add(new?PieSerise{Title?=?"2014",Percentage?=?49,PieColor?=?new?SolidColorBrush((Color)ColorConverter.ConvertFromString("#007fff")),});collection1.Add(new?PieSerise{Title?=?"2015",Percentage?=?50,PieColor?=?new?SolidColorBrush((Color)ColorConverter.ConvertFromString("#ED7D31")),});collection1.Add(new?PieSerise{Title?=?"2016",Percentage?=?30,PieColor?=?new?SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFC000")),});collection1.Add(new?PieSerise{Title?=?"2017",Percentage?=?30,PieColor?=?new?SolidColorBrush((Color)ColorConverter.ConvertFromString("#ff033e")),});ItemsSource?=?collection1;}}
}

參考資料

[1]

ArcSegment: https://docs.microsoft.com/zh-cn/dotnet/api/system.windows.media.arcsegment?view=windowsdesktop-6.0

[2]

Github: https://github.com/WPFDevelopersOrg/WPFDevelopers.Charts

[3]

Gitee: https://gitee.com/WPFDevelopersOrg/WPFDevelopers.Charts

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/287024.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/287024.shtml
英文地址,請注明出處:http://en.pswp.cn/news/287024.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Codeforces Round #359 div2

Problem_A(CodeForces 686A): 題意&#xff1a;\[ 有n個輸入&#xff0c; \space d_i代表冰淇淋數目增加d_i個&#xff0c; -\space d_i表示某個孩紙需要d_i個&#xff0c; 如果你現在手里沒有\space d_i個冰淇淋&#xff0c; 那么這個孩紙就會失望的離開。\] 你初始有x個冰淇淋…

Flutter之測試Http和HttpClient

1 測試Http和HttpClient 導入包&#xff1a;在pubspec.yaml里面導入 http: ^0.12.2 main.dart里面導入 import package:http/http.dart as http; import dart:convert; import dart:io; 2 代碼實現 import package:flutter/material.dart; import package:url_launcher/url_lau…

基于zookeeper的solrCloud集群搭建

1.安裝及搭建相關環境 1.1環境準備 centos7,jdk1.8,tomcat8,zookeeper3.4.X,solr4.10.X 鏈接: https://pan.baidu.com/s/1i47IuKd 密碼: emqt 2.zookeeper集群搭建 2.1復制zookeeper [rootMiWiFi-R3-srv ~]# mkdir /usr/local/solr-cloud [rootMiWiFi-R3-srv ~]# cp -r zookee…

【小白必懂】C語言求完全數

注意&#xff1a;學生黨如果存在付費問題可以加我好友&#xff0c;我可以開單篇短時間的免費喲~ 私聊我就好~ 情景再現 &#x1f478;小媛&#xff1a;小C&#xff0c;你知道什么是完全數嗎&#xff1f; &#x1f430;小C&#xff1a;知道呀&#xff0c;難道是今天老師又出題…

【三維激光掃描】第四章:點云數據處理

第一節 點云數據處理流程 由于外業獲取點云數據時的多種因素影響,點云數據質量直接影響到三維建模等方面的應用,點云數據處理環節非常重要。本章主要介紹數據處理流程,數據的配準:濾波、縮減、分割、分類,最后介紹點云數據應用。 5.1 數據處理流程 5.1.1 數據處理軟件 …

臺式計算機硬件輸入設備,臺式電腦硬件配置有哪些

臺式電腦硬件配置你知道有哪些?電腦的配置一般是指電腦的硬件配件的高檔程度、性價比等&#xff0c;電腦的性能好壞主要決定于以下主要硬件配置。一起來看看臺式電腦硬件配置有哪些&#xff0c;歡迎查閱!組裝臺式電腦配置1、實用性機型建議&#xff1a;首選1&#xff1a;intel…

mysql 如何用一條SQL將一張表里的數據插入到另一張表 3個例子

1. 表結構完全一樣 insert into 表1select * from 表2 2. 表結構不一樣&#xff08;這種情況下得指定列名&#xff09; insert into 表1 (列名1,列名2,列名3)select 列1,列2,列3 from 表2 3、只從另外一個表取部分值 insert into 表1 (列名1,列名2,列名3) values(列1,列2,(sel…

Android WebView和JavaScript交互

JavaScript在現在的網頁設計中用得很多&#xff0c;Android 的WebView可以載入網頁&#xff0c;WebView也設計了與JavaScript通信的橋梁。這篇主要介紹一下WebViewk控件如何和JavaScript進行交互。 WebView: WebView和網頁相關的主要有一下幾個方法&#xff1a;  setWebViewCl…

Microsoft Dev Box 帶來全新云上開發體驗

在 5 月 24 日, 微軟的產品經理 Anthony Cangialosi 在 Azure 社區發布了一篇博客(Introducing Microsoft Dev Box)&#xff0c; 宣布推出 Microsoft Dev Box !這是一種新的云服務&#xff0c;托管在 Microsoft Azure 中&#xff0c;提供了一個開箱即用的開發工作站&#xff0c…

游戲開發如此簡單?我直接創建了一個游戲場景【python 游戲實戰 02】

前言 本系列文章將會以通俗易懂的對話方式進行教學&#xff0c;對話中將涵蓋了新手在學習中的一般問題。此系列將會持續更新&#xff0c;包括別的語言以及實戰都將使用對話的方式進行教學&#xff0c;基礎編程語言教學適用于零基礎小白&#xff0c;之后實戰課程也將會逐步更新…

【三維激光掃描】第五章:基于點云數據的三維建模

第一節 繪制立面圖 1. 打開CAD 2014,新建一個文件,模板選擇acadiso.dwt,如下圖。 2. 點擊插入→創建點云。

Flutter之基本數據類型測試

1、Flutter的數據基本類型 Dart語言里一切皆為對象&#xff0c;所以如果沒有將變初始化,那么它的默認值為null Number(int、doubkle)StringBoolean(bool) List Map2、測試代碼 void testData() {//Number包含了int和doubleint a 4;int b 8;print(a b);int a1;if (a null)…

清北·NOIP2017濟南考前沖刺班 DAY1 morning

立方數(cubic) Time Limit:1000ms Memory Limit:128MB 題目描述 LYK定義了一個數叫“立方數”&#xff0c;若一個數可以被寫作是一個正整數的3次方&#xff0c;則這個數就是立方數&#xff0c;例如1,8,27就是最小的3個立方數。 現在給定一個數P&#xff0c;LYK想要知道這個數…

2020美國紐約大學計算機科學排名,2020美國紐約大學排名第幾

紐約大學在2020年《美國新聞與世界報道》美國全國性大學排名中排名第29名&#xff0c;在2020年QS世界大學排名中排名第39名。紐約大學專業排名QS世界大學生命科學與醫學專業排名 2020年 第40名QS世界大學醫學專業排名 2020年 第34名QS世界大學牙科專業排名 2020年 第14名QS世界…

saltstack 安裝nginx

1. 目錄結構[rootqing salt]# tree /srv/salt/nginx//srv/salt/nginx/-- config.sls-- files| -- nginx| -- nginx-1.0.15.tar.gz| -- nginx.conf| -- nginx_log_cut.sh| -- nginx-upstream-jvm-route-0.1.tar.gz-- init.sls-- install.sls1 directory, 8 files2. [r…

ArcGIS實驗教程——實驗三十一:ArcGIS構建泰森多邊形(Thiessen Polygon)實例精解

泰森多邊形是進行快速插值和分析地理實體影響區域的常用工具。例如,用離散點的性質描述多邊形區域的性質,用離散點的數據計算泰森多邊形區域的數據。泰森多邊形可用于定性分析、統計分析和臨近分析等。 ArcGIS實驗視頻教程合集:《ArcGIS實驗教程從入門到精通》(附配套實驗…

Python的魔法方法 .

基本行為和屬性 __init__(self[,....])構造函數 . 在實例化對象的時候會自動運行 __del__(self)析構函數 . 在對象被回收機制回收的時候會被調用 __str__(self)輸出函數 . 在實例對象請求輸出的時候會被調用. __repr__(self). 當直接調用實例對象的時候會被調用 __new__(cls,[,…

游戲角色開始動起來了,真帥!【python 游戲實戰 03】

前言 本系列文章將會以通俗易懂的對話方式進行教學&#xff0c;對話中將涵蓋了新手在學習中的一般問題。此系列將會持續更新&#xff0c;包括別的語言以及實戰都將使用對話的方式進行教學&#xff0c;基礎編程語言教學適用于零基礎小白&#xff0c;之后實戰課程也將會逐步更新…

如何讓 ASP.NET Core 支持綁定查詢字符串中的數組

前言有網友在交流群中詢問&#xff0c;如何讓 ASP.NET Core 支持綁定查詢字符串中的數組&#xff1a;據說&#xff0c;在 .NET 7 中已經支持了&#xff1a;但是&#xff0c;在這之前的 .NET 版本能實現相同功能嗎&#xff1f;ByteArrayModelBinder這時&#xff0c;群里的網友提…

Docker Storm開發環境搭建

2019獨角獸企業重金招聘Python工程師標準>>> 1. compose文件 storm-stack.yml version: 3.1services:zookeeper:image: zookeepercontainer_name: zookeeperrestart: alwaysports:- 2181:2181nimbus:image: stormcontainer_name: nimbuscommand: storm nimbusdepend…