糖果派对官方网站_可以赌钱的糖果游戏_手机版
第五章 绘图根基(BEZIE汉兰达)

第五章 绘图根基(BEZIE汉兰达)

作者:操作系统    来源:未知    发布时间:2020-01-03 06:47    浏览量:

bb电子糖果派对 1bb电子糖果派对 2

2017.10.19

上蓬蓬勃勃篇完结了demo的地图查询功效,本篇新添地图势态标绘模块,截图如下:

  1 /*-----------------------------
  2 BEZIER.C -- Bezier Splines Demo
  3 (c) Charles Petzold, 1998
  4 -----------------------------*/
  5 
  6 #include <Windows.h>
  7 
  8 LRESULT CALLBACK WndPorc(HWND, UINT, WPARAM, LPARAM);
  9 
 10 int WINAPI WinMain( __in HINSTANCE hInstance
 11                     , __in_opt HINSTANCE hPrevInstance
 12                     , __in LPSTR lpCmdLine
 13                     , __in int nShowCmd )
 14 {
 15     static TCHAR szAppName[] = TEXT("Bezier");
 16     HWND hwnd;
 17     MSG msg;
 18     WNDCLASS wndclass;
 19 
 20     wndclass.style = CS_HREDRAW | CS_VREDRAW;
 21     wndclass.lpfnWndProc = WndPorc;
 22     wndclass.cbClsExtra = 0;
 23     wndclass.cbWndExtra = 0;
 24     wndclass.hInstance = hInstance;
 25     wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
 26     wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
 27     wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
 28     wndclass.lpszMenuName = NULL;
 29     wndclass.lpszClassName = szAppName;
 30 
 31     if (!RegisterClass(&wndclass))
 32     {
 33         MessageBox(NULL, TEXT("Program requires Windows NT!")
 34             , szAppName, MB_ICONERROR);
 35         return 0;
 36     }
 37 
 38     hwnd = CreateWindow(szAppName, TEXT("Bezier Splines")
 39         , WS_OVERLAPPEDWINDOW
 40         , CW_USEDEFAULT, CW_USEDEFAULT
 41         , CW_USEDEFAULT, CW_USEDEFAULT
 42         , NULL, NULL, hInstance, NULL);
 43 
 44     ShowWindow(hwnd, nShowCmd);
 45     UpdateWindow(hwnd);
 46 
 47     while (GetMessage(&msg, NULL, 0, 0))
 48     {
 49         TranslateMessage(&msg);
 50         DispatchMessage(&msg);
 51     }
 52 
 53     return msg.wParam;
 54 }
 55 
 56 void DrawBezier(HDC hdc, POINT apt[])
 57 {
 58     PolyBezier(hdc, apt, 4);
 59 
 60     MoveToEx(hdc, apt[0].x, apt[0].y, NULL);
 61     LineTo(hdc, apt[1].x, apt[1].y);
 62 
 63     MoveToEx(hdc, apt[2].x, apt[2].y, NULL);
 64     LineTo(hdc, apt[3].x, apt[3].y);
 65 }
 66 
 67 LRESULT CALLBACK WndPorc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 68 {
 69     static POINT apt[4];
 70     HDC hdc;
 71     int cxClient, cyClient;
 72     PAINTSTRUCT ps;
 73 
 74     switch (message)
 75     {
 76     case WM_SIZE:
 77         cxClient = LOWORD(lParam);
 78         cyClient = HIWORD(lParam);
 79 
 80         apt[0].x = cxClient / 4;
 81         apt[0].y = cyClient / 2;
 82         
 83         apt[1].x = cxClient / 2;
 84         apt[1].y = cyClient / 4;
 85 
 86         apt[2].x = cxClient / 2;
 87         apt[2].y = 3 * cyClient / 4;
 88 
 89         apt[3].x = 3 * cxClient / 4;
 90         apt[3].y = cyClient / 2;
 91 
 92         return 0;
 93 
 94     case WM_LBUTTONDOWN:
 95     case WM_RBUTTONDOWN:
 96     case WM_MOUSEMOVE:
 97         if (wParam & MK_LBUTTON || wParam & MK_RBUTTON)
 98         {
 99             hdc = GetDC(hwnd);
100             SelectObject(hdc, GetStockObject(WHITE_PEN));
101 
102             DrawBezier(hdc, apt);
103 
104             if (wParam & MK_LBUTTON)
105             {
106                 apt[1].x = LOWORD(lParam);
107                 apt[1].y = HIWORD(lParam);
108             }
109 
110             if (wParam & MK_RBUTTON)
111             {
112                 apt[2].x = LOWORD(lParam);
113                 apt[2].y = HIWORD(lParam);
114             }
115 
116             SelectObject(hdc, GetStockObject(BLACK_PEN));
117 
118             DrawBezier(hdc, apt);
119 
120             ReleaseDC(hwnd, hdc);
121         }
122         return 0;
123 
124     case WM_PAINT:
125         InvalidateRect(hwnd, NULL, TRUE);
126         hdc = BeginPaint(hwnd, &ps);
127 
128         DrawBezier(hdc, apt);
129 
130         EndPaint(hwnd, &ps);
131         return 0;
132 
133     case WM_DESTROY:
134         PostQuitMessage(0);
135         return 0;
136     }
137 
138     return DefWindowProc(hwnd, message, wParam, lParam);
139 }

效果

本篇大旨的在于调用API的Draw工具:第五章 绘图根基(BEZIE汉兰达)。https://developers.arcgis.com/javascript/3/jsapi/draw-amd.html
<pre>
require(["esri/toolbars/draw"], function(Draw) { /* code goes here */ });
</pre>
构造函数:
<pre>
new Draw(map, options?)
</pre>
诚如的话,传参map对象进来就能够,别的参数可选的,用暗中认可的就可以,除非您想特别设置;
默许的可绘制图形类型常量Constants:
<pre>
ARROW Draws an arrow.箭头
CIRCLE Draws a circle.圆形
DOWN_ARROW Draws an arrow that points down.下箭头
ELLIPSE Draws an ellipse.椭圆
EXTENT Draws an extent box.矩形
FREEHAND_POLYGON Draws a freehand polygon.手绘多边形
FREEHAND_POLYLINE Draws a freehand polyline.手绘线
LEFT_ARROW Draws an arrow that points left.左箭头
LINE Draws a line.线
MULTI_POINT Draws a Multipoint.多点
POINT Draws a point.点
POLYGON Draws a polygon.多边形
POLYLINE Draws a polyline.折线
RECTANGLE Draws a rectangle.矩形
RIGHT_ARROW Draws an arrow that points right.右键头
TRIANGLE Draws a triangle.三角形
UP_ARROW Draws an arrow that points up.上箭头
</pre>
能够设置绘制的标志样式:

BEZIER.C

可以加上多条折线,动态的得到加载数据。

中间,activate函数能够激活触发绘制的行为,绘制甘休以往在绘制停止事件之中获取geometry:
<pre>
activate(geometryType, options?)
</pre>

BEZIE纳瓦拉程序的呈现结果

bb电子糖果派对 3

地图势态标绘完结的笔触:利用API的Draw工具完成日常的点线面绘制,不过对于燕尾箭头、群集地、弧线、曲线、轻松箭头等特殊的武力势态供给自定义来绘制了,所以必要举行Draw工具本领达成,也是本篇的精华所在。
豆蔻梢头、上边谈谈怎么在类型引用拓宽Draw类js文件:

bb电子糖果派对 4

//画图纸工具MPAndroidChart

1是持续拓宽Draw的文件目录;2是落实势态标绘模块的js文件。
率先,供给在map.html页面援引进来:
<pre>
<script type="text/javascript">
//配置arcgis拓宽深入深入分析天地图服务类引用的门道
dojoConfig = {
parseOnLoad: true,
packages: [{
name: 'tdlib',
location: this.location.pathname.replace(//[^/]+$/, "") + "/js/tdlib"
}],
paths: {
Extension: location.pathname.replace(//[^/]+$/, "") + "/js/main/drawExtension/Extension",
ExtensionDraw: location.pathname.replace(//[^/]+$/, "") + "/js/main/drawExtension/plotDraw"
}
};
bb电子糖果派对,</script>
</pre>
里面,paths代表须求援引的不二秘技。
<pre>
<script type="text/javascript" src="js/main/map.plot.js"></script>
</pre>
附带,在map.js文件的早先化里面援引扩充的js文件DrawEx以至DrawExt:
<pre>
(function () { dojo.require("Extension.DrawEx"); dojo.require("ExtensionDraw.DrawExt");})();
</pre>
终极,在工具栏菜单的神态标绘菜单响应事件之中调用plot.js就可以:
<pre>
//势态标绘
$("#bPlot").click(function () {
//早先化军势标绘接口
if (!DCI.Plot.isload)
DCI.Plot.Init(map);
if (DCI.Plot.dialog)
DCI.Plot.dialog.close();
DCI.Plot.dialog = jDialog.dialog({
title: '态势标绘',
width: 370,
height: 200,
left: 450,
top: 200,
modal: false, // 非模态,即不出示遮罩层
content: DCI.Plot.Html
});
DCI.Plot.InitEvent();

compile'com.github.PhilJay:MPAndroidChart:v3.0.1'

    });

1.在app的build.gradle中添加

</pre>
二、谈谈Draw工具调用的思绪,不管调用arcgis api原生态的Draw,依然实行Draw的,都以先创立贰个Draw对象,然后监听Draw的draw-end绘制截止的回调函数,获取绘制的图纸叠合在地图展现;Draw工具的activate函数会触发draw-end回调函数;
先是,初步化Draw工具对象以至默许的暗号样式symbol:
<pre>
//定义暗中同意点 线 面符号
DCI.Plot.markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 8, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 69, 0]), 2), new dojo.Color([255, 255, 255, 1]));
DCI.Plot.lineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 160, 122]), 2);
DCI.Plot.fillSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 160, 122]), 2), new dojo.Color([255, 255, 255, 0.5]));
//初步化拓宽Draw
DCI.Plot.toolbar = new Extension.DrawEx(map);
DCI.Plot.toolbar.on("draw-end", DCI.Plot.addToMap);
DCI.Plot.toolbar1 = new ExtensionDraw.DrawExt(map);
DCI.Plot.toolbar1.on("draw-end", DCI.Plot.addToMap);
//arcgis api自带的Draw
DCI.Plot.drawToolbar = new esri.toolbars.Draw(map);
DCI.Plot.drawToolbar.markerSymbol = DCI.Plot.markerSymbol;
DCI.Plot.drawToolbar.lineSymbol = DCI.Plot.lineSymbol;
DCI.Plot.drawToolbar.fillSymbol = DCI.Plot.fillSymbol;
DCI.Plot.drawToolbar.on("draw-end", DCI.Plot.drawEnd);
</pre>
附带,触发调用Draw绘制:
<pre>
case 0://plot_freehandline
DCI.Plot.drawFreeHandPolyline(null, function (geometry) {
symbol = DCI.Plot.lineSymbol;
DCI.Plot.drawEndPlot(geometry, symbol);
});
break;
case 1://plot_line
DCI.Plot.drawPolyline(null, function (geometry) {
symbol = DCI.Plot.lineSymbol;
DCI.Plot.drawEndPlot(geometry, symbol);
});
break;
case 2://emergency_freehand
DCI.Plot.drawFreeHandPolygon(null, function (geometry) {
symbol = DCI.Plot.fillSymbol;
DCI.Plot.drawEndPlot(geometry, symbol);
});
break;
case 3://plot_polygon
DCI.Plot.drawPolygon(null, function (geometry) {
symbol = DCI.Plot.fillSymbol;
DCI.Plot.drawEndPlot(geometry, symbol);
});
break;
case 4://plot_extent
DCI.Plot.drawExtent(null, function (geometry) {
symbol = DCI.Plot.fillSymbol;
DCI.Plot.drawEndPlot(geometry, symbol);
});
break;
case 5://emergency_freehand
DCI.Plot.drawCircle(null, function (geometry) {
symbol = DCI.Plot.fillSymbol;
DCI.Plot.drawEndPlot(geometry, symbol);
});
break;
case 6://直角箭头
DCI.Plot.drawStraightArrow(null, function (geometry) {
symbol = DCI.Plot.fillSymbol;
DCI.Plot.drawEndPlot(geometry, symbol);
});
break;
case 7://简单箭头
DCI.Plot.toolbar.activate(Extension.DrawEx.FREEHAND_ARROW);
break;
case 8://燕尾箭头
DCI.Plot.toolbar1.fillSymbol = DCI.Plot.fillSymbol;
DCI.Plot.toolbar1.activate("tailedsquadcombat");
break;
case 9://集结地
DCI.Plot.toolbar.activate(Extension.DrawEx.BEZIER_POLYGON);
break;
case 10://弧线
DCI.Plot.toolbar.activate(Extension.DrawEx.CURVE);
break;
case 11://曲线
DCI.Plot.toolbar.activate(Extension.DrawEx.BEZIER_CURVE);
break;
</pre>
<pre>
//画点
drawPoint: function (symbol, onDrawEnd) {
DCI.Plot.onDrawEnd = onDrawEnd;
if (symbol) {
DCI.Plot.drawToolbar.markerSymbol = symbol;
}
DCI.Plot.drawToolbar.activate(esri.toolbars.Draw.POINT);
DCI.Plot.disablePan();
},
//画折线
drawPolyline: function (symbol, onDrawEnd) {
this.onDrawEnd = onDrawEnd;
if (symbol) {
this.drawToolbar.lineSymbol = symbol;
}
this.drawToolbar.activate(esri.toolbars.Draw.POLYLINE);
this.disablePan();
},
//自由线
drawFreeHandPolyline: function (symbol, onDrawEnd) {
this.onDrawEnd = onDrawEnd;
if (symbol) {
this.drawToolbar.lineSymbol = symbol;
}
this.drawToolbar.activate(esri.toolbars.Draw.FREEHAND_POLYLINE);
this.disablePan();
},
//画多边形
drawPolygon: function (symbol, onDrawEnd) {
this.onDrawEnd = onDrawEnd;
if (symbol) {
this.drawToolbar.fillSymbol = symbol;
}
this.drawToolbar.activate(esri.toolbars.Draw.POLYGON);
this.disablePan();
},
//手绘多边形
drawFreeHandPolygon: function (symbol, onDrawEnd) {
this.onDrawEnd = onDrawEnd;
if (symbol) {
this.drawToolbar.fillSymbol = symbol;
}
this.drawToolbar.activate(esri.toolbars.Draw.FREEHAND_POLYGON);
this.disablePan();
},
//画圆形
drawCircle: function (symbol, onDrawEnd) {
this.onDrawEnd = onDrawEnd;
if (symbol) {
this.drawToolbar.fillSymbol = symbol;
}
this.drawToolbar.activate(esri.toolbars.Draw.CIRCLE);
this.disablePan();
},
//画矩形
drawExtent: function (symbol, onDrawEnd) {
this.onDrawEnd = onDrawEnd;
if (symbol) {
this.drawToolbar.fillSymbol = symbol;
}
this.drawToolbar.activate(esri.toolbars.Draw.EXTENT);
this.disablePan();
},
//直角箭头
drawStraightArrow: function (symbol, onDrawEnd) {
this.onDrawEnd = onDrawEnd;
if (symbol) {
this.drawToolbar.fillSymbol = symbol;
}
this.drawToolbar.activate(esri.toolbars.Draw.ARROW);
this.disablePan();
},
</pre>
终极,加多绘制图形在地图上突显:
<pre>
/**
* 绘制完结调用的函数
/
drawEndPlot: function (geometry,symbol) {
var title = "标题";
var htmlCon = "测验内容测量试验内容";
var attr = { "title": title, "content": htmlCon};
var graphic = new esri.Graphic(geometry, symbol, attr);
DCI.Plot.graphicslayer.add(graphic);
DCI.Plot.deactivateDraw();
DCI.Plot.map.setMapCursor('auto');//设置鼠标的光标
},
</pre>
<pre>
/
*
* 扩充Draw绘制落成调用的函数
*/
addToMap: function (evt) {
DCI.Plot.map.setMapCursor('auto'卡塔尔;//设置鼠标的光标
var symbol;
DCI.Plot.toolbar.deactivate();
DCI.Plot.toolbar1.deactivate();
switch (evt.geometry.type)
{
case "point":
case "multipoint":
symbol = DCI.Plot.markerSymbol;
break;
case "polyline":
symbol = DCI.Plot.lineSymbol;
break;
default:
symbol = DCI.Plot.fillSymbol;
break;
}
var title = "标题";
var htmlCon = "测验内容测验内容";
var attr = { "title": title, "content": htmlCon};
var graphic = new esri.Graphic(evt.geometry, symbol, attr);
DCI.Plot.graphicslayer.add(graphic);
},
</pre>

bb电子糖果派对 5

GIS之家文章:https://shop116521643.taobao.com/shop/view_shop.htm
GIS之家兴趣部落:http://buluo.qq.com/p/barindex.html?bid=327395
GIS项目交换群:238339408
GIS之家调换群风姿罗曼蒂克:432512093

bb电子糖果派对 6

2.依据互连网的素材写了一个DynamicLineChartManager


importcom.github.mikephil.charting.charts.LineChart;

importcom.github.mikephil.charting.components.AxisBase;

importcom.github.mikephil.charting.components.Description;

importcom.github.mikephil.charting.components.Legend;

importcom.github.mikephil.charting.components.LimitLine;

importcom.github.mikephil.charting.components.XAxis;

importcom.github.mikephil.charting.components.YAxis;

importcom.github.mikephil.charting.data.Entry;

importcom.github.mikephil.charting.data.LineData;

importcom.github.mikephil.charting.data.LineDataSet;

importcom.github.mikephil.charting.formatter.IAxisValueFormatter;

importcom.github.mikephil.charting.interfaces.datasets.ILineDataSet;

importjava.text.SimpleDateFormat;

importjava.util.ArrayList;

importjava.util.List;

/**

* Created by dengyangkang on 2017/10/16.

*/

public classDynamicLineChartManager {

privateLineChartlineChart;

privateYAxisleftAxis;

privateYAxisrightAxis;

privateXAxisxAxis;

privateLineDatalineData;

privateLineDataSetlineDataSet;

privateListlineDataSets=newArrayList<>();

privateSimpleDateFormatdf=newSimpleDateFormat("HH:mm:ss"卡塔尔(قطر‎;//设置日期格式

privateListtimeList=newArrayList<>(State of Qatar;//存款和储蓄x轴的时间

//一条曲线

publicDynamicLineChartManager(LineChart mLineChart, String name,intcolor) {

this.lineChart= mLineChart;

leftAxis=lineChart.getAxisLeft();

rightAxis=lineChart.getAxisRight();

xAxis=lineChart.getXAxis();

initLineChart();

initLineDataSet(name, color);

}

//多条曲线

publicDynamicLineChartManager(LineChart mLineChart, List names, List colors) {

this.lineChart= mLineChart;

leftAxis=lineChart.getAxisLeft();

rightAxis=lineChart.getAxisRight();

xAxis=lineChart.getXAxis();

initLineChart();

initLineDataSet(names, colors);

}

/**

* 初始化LineChar

*/

private voidinitLineChart() {

lineChart.setDrawGridBackground(false);

//彰显边界

lineChart.setDrawBorders(true);

//折线图例 标签 设置

Legend legend =lineChart.getLegend();

legend.setForm(Legend.LegendForm.LINE);

legend.setTextSize(11f);

//呈现地方

legend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);

legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);

legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);

legend.setDrawInside(false);

//X轴设置展现地方在尾部

xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);

xAxis.setGranularity(1f);

xAxis.setLabelCount(10);

xAxis.setValueFormatter(newIAxisValueFormatter() {

@Override

publicString getFormattedValue(floatvalue, AxisBase axis) {

returntimeList.get((int) value %timeList.size());

}

});

//保险Y轴从0开首,不然会发展一点

leftAxis.setAxisMinimum(0f);

rightAxis.setAxisMinimum(0f);

}

/**

* 开端化折线(一条线卡塔尔国

*

*@paramname

*@paramcolor

*/

private voidinitLineDataSet(String name,intcolor) {

lineDataSet=newLineDataSet(null, name);

lineDataSet.setLineWidth(1.5f);

lineDataSet.setCircleRadius(1.5f);

lineDataSet.setColor(color);

lineDataSet.setCircleColor(color);

友情链接: 网站地图
Copyright © 2015-2019 http://www.tk-web.com. bb电子糖果派对有限公司 版权所有