http://www.cnblogs.com/chenyuming507950417/

Flex加载google地图、百度地图以及天地图作底图

 一  Flex加载Google地图作底图

  (1)帮助类GoogleLayer.as

/*
* 根据输入的地图类型加载Google地图(by chenyuming)
*/ package Layers
{ import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.TiledMapServiceLayer;
import com.esri.ags.layers.supportClasses.LOD;
import com.esri.ags.layers.supportClasses.TileInfo; import flash.net.URLRequest; public class GoogleLayer extends TiledMapServiceLayer
{
private var _tileInfo:TileInfo=new TileInfo();
private var _baseURL:String="";
private var MapStyle:String=""; public function GoogleLayer(mapStyle:String)
{
this.MapStyle=mapStyle;
super();
buildTileInfo();
setLoaded(true); } override public function get fullExtent():Extent
{
return new Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, new SpatialReference(102113));
} override public function get initialExtent():Extent
{
return new Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, new SpatialReference(102113));
} override public function get spatialReference():SpatialReference
{
return new SpatialReference(102113);
} override public function get tileInfo():com.esri.ags.layers.supportClasses.TileInfo
{
return _tileInfo;
} override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest
{
var s:String = "Galileo".substring(0, ((3 * col + row) % 8)); var url:String ="";
if (this.MapStyle == "Vector")//获取矢量地图
{
url = "http://mt" + (col % 4) + ".google.com/vt/lyrs=m@158000000&hl=zh-CN&gl=cn&" +
"x=" + col + "&" +
"y=" + row + "&" +
"z=" + level + "&" +
"s=" + s;
}
else if (this.MapStyle == "Terrain")//获取地形图
{
url = "http://mt" + (col % 4) + ".google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&" +
"x=" + col + "&" +
"y=" + row + "&" +
"z=" + level + "&" +
"s=" + s;
}
else if (this.MapStyle == "Image")//获取影像地图
{
url = "http://mt" + (col % 4) + ".google.com/vt/lyrs=s&hl=en&gl=en&" +
"x=" + col + "&" +
"y=" + row + "&" +
"z=" + level + "&" +
"s=" + s;
}
else if (this.MapStyle == "POI")//获取道路等POI,和影像地图配合使用
{
url = "http://mt" + (col % 4) + ".google.com/vt/imgtp=png32&lyrs=h@169000000&hl=zh-CN&gl=cn&" +
"x=" + col + "&" +
"y=" + row + "&" +
"z=" + level + "&" +
"s=" + s;
}
return new URLRequest(url);
}
public function set url(vals:String):void
{
this._baseURL = vals;
}
private function buildTileInfo():void
{
_tileInfo.height=256;
_tileInfo.width=256;
_tileInfo.origin=new MapPoint(-20037508.342787, 20037508.342787);
_tileInfo.spatialReference=new SpatialReference(102113);
_tileInfo.lods = [
new LOD(0, 156543.033928, 591657527.591555),
new LOD(1, 78271.5169639999, 295828763.795777),
new LOD(2, 39135.7584820001, 147914381.897889),
new LOD(3, 19567.8792409999, 73957190.948944),
new LOD(4, 9783.93962049996, 36978595.474472),
new LOD(5, 4891.96981024998, 18489297.737236),
new LOD(6, 2445.98490512499, 9244648.868618),
new LOD(7, 1222.99245256249, 4622324.434309),
new LOD(8, 611.49622628138, 2311162.217155),
new LOD(9, 305.748113140558, 1155581.108577),
new LOD(10, 152.874056570411, 577790.554289),
new LOD(11, 76.4370282850732, 288895.277144),
new LOD(12, 38.2185141425366, 144447.638572),
new LOD(13, 19.1092570712683, 72223.819286),
new LOD(14, 9.55462853563415, 36111.909643),
new LOD(15, 4.77731426794937, 18055.954822),
new LOD(16, 2.38865713397468, 9027.977411),
new LOD(17, 1.19432856685505, 4513.988705),
new LOD(18, 0.597164283559817, 2256.994353),
new LOD(19, 0.298582141647617, 1128.497176)
];
} public function lon2Mercator(px:int):int
{
var x:int = px * 20037508.34 / 180;
return x;
} public function lat2Mercator(py:int):int
{
var y:int;
y = Math.log(Math.tan((90 + py) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return y;
}
}
}

  (2)引用方法

//加载google地图
var baseLayer:GoogleLayer = new GoogleLayer("Image")
baseMap.addLayer(baseLayer);

  二  Flex加载百度地图作底图

  (1)帮助类BaiduLayer.as

/*
* 根据输入的地图类型加载百度地图(by chenyuming)
*/ package Layers
{
import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.TiledMapServiceLayer;
import com.esri.ags.layers.supportClasses.LOD;
import com.esri.ags.layers.supportClasses.TileInfo; import flash.net.URLRequest; import flashx.textLayout.formats.Float; public class BaiduLayer extends TiledMapServiceLayer
{
//成员变量
private var _tileInfo:TileInfo = new TileInfo();
private var _wkid:int = 102100;
private var cornerCoordinate:Number = 20037508.3427892;
private var _mapStyle:String = "Image";
private var _initialExtent:Extent; public function BaiduLayer(mapStyle:String)
{
this._mapStyle = mapStyle; super();
buildTileInfo(); // to create our hardcoded tileInfo
setLoaded(true); // Map will only use loaded layers
} // 全屏范围
override public function get fullExtent():Extent
{
return new Extent(-cornerCoordinate, -cornerCoordinate, cornerCoordinate, cornerCoordinate, new SpatialReference(_wkid));
} // 初始化范围 (左下角坐标,右上角坐标)
override public function get initialExtent():Extent
{
return new Extent(5916776.8, 1877209.3, 19242502.6, 7620381.8, new SpatialReference(102100));
} // 空间参考系
override public function get spatialReference():SpatialReference
{
return new SpatialReference(_wkid);
} override public function get tileInfo():TileInfo
{
return _tileInfo;
} override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest
{
var zoom:int = level - 1;
var offsetX:int = Math.pow(2, zoom) as int;
var offsetY:int = offsetX - 1;
var numX:int = col - offsetX;
var numY:int = (-row) + offsetY; zoom = level + 1;
var num:int = (col + row) % 8 + 1; var url:String = null;
if (_mapStyle == "Vector") //获取矢量地图
{
url = "http://q"+num+".baidu.com/it/u=x="+numX+";y="+ numY + ";z=" + zoom + ";v=013;type=web&fm=44";
}
else if (_mapStyle == "Image") //影像地图
{
url = "http://q"+num+".baidu.com/it/u=x="+numX+";y="+numY+";z="+zoom+";v=009;type=sate&fm=46";
}
else if (_mapStyle == "POI") //获取道路等POI,和影像地图配合使用
{
url = "http://q"+num+".baidu.com/it/u=x="+numX+";y="+numY+";z="+zoom+";v=013;type=trans&fm=47";
}
return new URLRequest(url);
} // 自定义方法,定义地图缩放等级
private function buildTileInfo():void
{
_tileInfo.height=256;
_tileInfo.width=256;
_tileInfo.origin=new MapPoint(-cornerCoordinate, cornerCoordinate);
_tileInfo.spatialReference=new SpatialReference(_wkid);
_tileInfo.lods = [
new LOD(0, 156543.033928, 591657527.591555),
new LOD(1, 78271.5169639999, 295828763.795777),
new LOD(2, 39135.7584820001, 147914381.897889),
new LOD(3, 19567.8792409999, 73957190.948944),
new LOD(4, 9783.93962049996, 36978595.474472),
new LOD(5, 4891.96981024998, 18489297.737236),
new LOD(6, 2445.98490512499, 9244648.868618),
new LOD(7, 1222.99245256249, 4622324.434309),
new LOD(8, 611.49622628138, 2311162.217155),
new LOD(9, 305.748113140558, 1155581.108577),
new LOD(10, 152.874056570411, 577790.554289),
new LOD(11, 76.4370282850732, 288895.277144),
new LOD(12, 38.2185141425366, 144447.638572),
new LOD(13, 19.1092570712683, 72223.819286),
new LOD(14, 9.55462853563415, 36111.909643),
new LOD(15, 4.77731426794937, 18055.954822),
new LOD(16, 2.38865713397468, 9027.977411),
new LOD(17, 1.19432856685505, 4513.988705),
new LOD(18, 0.597164283559817, 2256.994353),
new LOD(19, 0.298582141647617, 1128.497176)
];
}
}
}

  (2)引用方法

//加载百度地图
var baseLayer:BaiduLayer = new BaiduLayer("Image");
var POILayer:BaiduLayer = new BaiduLayer("POI");
baseMap.addLayer(baseLayer);
baseMap.addLayer(POILayer);

  三  Flex加载天地图作底图(经纬度投影)

  (1)帮助类TianDiTuLayer.as

/*
* 根据输入的地图类型加载天地图(by chenyuming)
* 注意:投影类型为经纬度
*/ package Layers
{
import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.layers.TiledMapServiceLayer;
import com.esri.ags.layers.supportClasses.LOD;
import com.esri.ags.layers.supportClasses.TileInfo; import flash.net.URLRequest;
import flash.sampler.Sample; public class TianDiTuLayer extends TiledMapServiceLayer
{
private var _tileInfo:TileInfo;
private var _baseURL:String;
private var _baseURLs:Array;
private var _initExtent:String;
private var _serviceMode:String;
private var _imageFormat:String;
private var _layerId:String;
private var _tileMatrixSetId:String;
private var _mapStyle:String=""; public function TianDiTuLayer(mapStyle:String,serviceMode:String = "KVP",imageFormat:String = "tiles")
{
this._mapStyle=mapStyle;//设置地图类型
this._serviceMode = serviceMode;
this._imageFormat = imageFormat; super();
this._tileInfo = new TileInfo();
this._initExtent = null;
this.buildTileInfo();
setLoaded(true);
} override public function get fullExtent() : Extent
{
return new Extent(-180, -90, 180, 90, new SpatialReference(4490));
} public function set initExtent(initextent:String):void
{
this._initExtent = initextent;
} override public function get initialExtent() :Extent
{
if (this._initExtent == null)
return new Extent(70.0, 15.0, 135.0, 55.0, new SpatialReference(4490));
var coors:Array = this._initExtent.split(",");
return new Extent(Number(coors[0]), Number(coors[1]), Number(coors[2]) ,Number(coors[3]), new SpatialReference(4490));
} override public function get spatialReference() : SpatialReference
{
return new SpatialReference(4490);
} override public function get tileInfo() : TileInfo
{
return this._tileInfo;
} //根据不同地图类型加载不同WMTS服务
override protected function getTileURL(level:Number, row:Number, col:Number) : URLRequest
{
if(this._mapStyle == "ImageBaseMap")//获取影像地图(底图)
{
_baseURL = "http://t0.tianditu.com/img_c/wmts";
_layerId = "img";
_tileMatrixSetId = "c";
}
else if(this._mapStyle == "ImageCNNote")//获取影像地图(中文注记)
{
_baseURL = "http://t0.tianditu.com/cia_c/wmts";
_layerId = "cia";
_tileMatrixSetId = "c";
}
else if(this._mapStyle == "ImageENNote")//获取影像地图(英文注记)
{
_baseURL = "http://t0.tianditu.com/eia_c/wmts";
_layerId = "eia";
_tileMatrixSetId = "c";
}
else if(this._mapStyle == "TerrainBaseMap")//获取地形图(底图)
{
_baseURL = "http://t0.tianditu.com/ter_c/wmts";
_layerId = "ter";
_tileMatrixSetId = "c";
}
else if(this._mapStyle == "TerrainCNNote")//获取地形图(中文注记)
{
_baseURL = "http://t0.tianditu.com/cta_c/wmts";
_layerId = "cta";
_tileMatrixSetId = "c";
}
else if(this._mapStyle == "TerrainENNote")//获取地形图(英文注记)
{
//暂无
}
else if(this._mapStyle == "VectorBaseMap")//获取矢量图(底图)
{
_baseURL = "http://t0.tianditu.com/vec_c/wmts";
_layerId = "vec";
_tileMatrixSetId = "c";
}
else if(this._mapStyle == "VectorCNNote")//获取矢量图(中文注记)
{
_baseURL = "http://t0.tianditu.com/cva_c/wmts";
_layerId = "cva";
_tileMatrixSetId = "c";
}
else if(this._mapStyle == "VectorENNote")//获取矢量图(英文注记)
{
_baseURL = "http://t0.tianditu.com/eva_c/wmts";
_layerId = "eva";
_tileMatrixSetId = "c";
} var urlRequest:String=_baseURL+ "/wmts?Service=WMTS&Request=GetTile&Version=1.0.0" +
"&Style=Default&Format="+_imageFormat+"&serviceMode="+_serviceMode+"&layer="+_layerId +
"&TileMatrixSet="+_tileMatrixSetId+"&TileMatrix=" + level + "&TileRow=" + row + "&TileCol=" + col; return new URLRequest(urlRequest);
} //切片信息
private function buildTileInfo() : void
{
this._tileInfo.height = 256;
this._tileInfo.width = 256;
this._tileInfo.origin = new MapPoint(-180, 90);
this._tileInfo.spatialReference = new SpatialReference(4490);
this._tileInfo.lods = new Array();
this._tileInfo.lods = [
new LOD(1 , 0.703125, 2.958293554545656E8),
new LOD(2 , 0.351563, 1.479146777272828E8),
new LOD(3 , 0.175781, 7.39573388636414E7),
new LOD(4 , 0.0878906, 3.69786694318207E7),
new LOD(5 , 0.0439453, 1.848933471591035E7),
new LOD(6 , 0.0219727, 9244667.357955175),
new LOD(7 , 0.0109863, 4622333.678977588),
new LOD(8 , 0.00549316, 2311166.839488794),
new LOD(9 , 0.00274658, 1155583.419744397),
new LOD(10, 0.00137329, 577791.7098721985),
new LOD(11, 0.000686646, 288895.85493609926),
new LOD(12, 0.000343323, 144447.92746804963),
new LOD(13, 0.000171661, 72223.96373402482),
new LOD(14, 8.58307e-005, 36111.98186701241),
new LOD(15, 4.29153e-005, 18055.990933506204),
new LOD(16, 2.14577e-005, 9027.995466753102),
new LOD(17, 1.07289e-005, 4513.997733376551),
new LOD(18, 5.36445e-006, 2256.998866688275)
];
}
}
}

  (2)引用方法

//加载天地图(经纬度投影)
var baseLayer:TianDiTuLayer = new TianDiTuLayer("VectorBaseMap")//天地图底图
var CNNoteLayer:TianDiTuLayer = new TianDiTuLayer("VectorCNNote");//中文注记
baseMap.addLayer(baseLayer);
baseMap.addLayer(CNNoteLayer);

  四  Flex加载天地图作底图(球面墨卡托投影)

  (1)帮助类TianDiTuLayerMercator.as

/*
* 根据输入的地图类型加载天地图(by chenyuming)
* 注意:投影类型为球形墨卡托
*/ package Layers
{
import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.layers.TiledMapServiceLayer;
import com.esri.ags.layers.supportClasses.LOD;
import com.esri.ags.layers.supportClasses.TileInfo; import flash.net.URLRequest;
import flash.sampler.Sample; public class TianDiTuLayerMercator extends TiledMapServiceLayer
{
private var _tileInfo:TileInfo;
private var _baseURL:String;
private var _baseURLs:Array;
private var _initExtent:String;
private var _layerId:String;
private var _mapStyle:String=""; public function TianDiTuLayerMercator(mapStyle:String)
{
this._mapStyle=mapStyle;//设置地图类型 super();
this._tileInfo = new TileInfo();
this._initExtent = null;
this.buildTileInfo();
setLoaded(true);
} override public function get fullExtent() : Extent
{
return new Extent(-20037508.3427892,-20037508.3427892, 20037508.3427892,20037508.3427892, new SpatialReference(3857));
} public function set initExtent(initextent:String):void
{
this._initExtent = initextent;
} override public function get initialExtent() :Extent
{
if (this._initExtent == null)
return new Extent(8397502.3, 2660018.1, 15003861.0, 5509344.0, new SpatialReference(3857));
var coors:Array = this._initExtent.split(",");
return new Extent(Number(coors[0]), Number(coors[1]), Number(coors[2]) ,Number(coors[3]), new SpatialReference(3857));
} override public function get spatialReference() : SpatialReference
{
return new SpatialReference(3857);
} override public function get tileInfo() : TileInfo
{
return this._tileInfo;
} //根据不同地图类型加载不同WMTS服务
override protected function getTileURL(level:Number, row:Number, col:Number) : URLRequest
{
_baseURL = "http://t0.tianditu.com"; if(this._mapStyle == "ImageBaseMap")//获取影像地图(底图)
{
_layerId = "img_w";
}
else if(this._mapStyle == "ImageCNNote")//获取影像地图(中文注记)
{
_layerId = "cia_w";
}
else if(this._mapStyle == "ImageENNote")//获取影像地图(英文注记)
{
_layerId = "eia_w";
}
else if(this._mapStyle == "TerrainBaseMap")//获取地形图(底图)
{
_layerId = "ter_w";
}
else if(this._mapStyle == "TerrainCNNote")//获取地形图(中文注记)
{
_layerId = "cta_w";
}
else if(this._mapStyle == "TerrainENNote")//获取地形图(英文注记)
{
//暂无
}
else if(this._mapStyle == "VectorBaseMap")//获取矢量图(底图)
{
_layerId = "vec_w";
}
else if(this._mapStyle == "VectorCNNote")//获取矢量图(中文注记)
{
_layerId = "cva_w";
}
else if(this._mapStyle == "VectorENNote")//获取矢量图(英文注记)
{
_layerId = "eva_w";
} var urlRequest:String =_baseURL+"/DataServer?T="+_layerId+"&x="+col+"&y="+row+"&l="+level; return new URLRequest(urlRequest);
} //切片信息
private function buildTileInfo() : void
{
this._tileInfo.height = 256;
this._tileInfo.width = 256;
this._tileInfo.origin = new MapPoint(-20037508.3427892,20037508.3427892,new SpatialReference(3857));
this._tileInfo.spatialReference = new SpatialReference(3857);
this._tileInfo.lods = new Array();
this._tileInfo.lods = [
new LOD(1 ,77664.761018562790697674418604651, 2.958293554545656E8),
new LOD(2 ,38832.380509281395348837209302326, 1.479146777272828E8),
new LOD(3 ,19416.190254640697674418604651163, 7.39573388636414E7),
new LOD(4 ,9708.0951273203488372093023255814, 3.69786694318207E7),
new LOD(5 ,4854.0475636601744186046511627907, 1.848933471591035E7),
new LOD(6 ,2427.0237818300872093023255813953, 9244667.357955175),
new LOD(7 ,1213.5118909150436046511627906977, 4622333.678977588),
new LOD(8 ,606.75594545752180232558139534884, 2311166.839488794),
new LOD(9 ,303.37797272876090116279069767442, 1155583.419744397),
new LOD(10,151.68898636438045058139534883721, 577791.7098721985),
new LOD(11, 75.844493182190225290697674418605, 288895.85493609926),
new LOD(12, 37.922246591095112645348837209302, 144447.92746804963),
new LOD(13, 18.961123295547556322674418604651, 72223.96373402482),
new LOD(14, 9.4805616477737781613372093023256, 36111.98186701241),
new LOD(15, 4.7402808238868890806686046511628, 18055.990933506204),
new LOD(16, 2.3701404119434445403343023255814, 9027.995466753102),
new LOD(17, 1.1850702059717222701671511627907, 4513.997733376551),
new LOD(18, 0.59253510298586113508357558139535, 2256.998866688275)
];
}
}
}

  (2)引用方法

//加载天地图(球面墨卡托投影)
var baseLayer:TianDiTuLayerMercator = new TianDiTuLayerMercator("ImageBaseMap")//天地图底图
var CNNoteLayer:TianDiTuLayerMercator = new TianDiTuLayerMercator("ImageCNNote");//中文注记
baseMap.addLayer(baseLayer);
baseMap.addLayer(CNNoteLayer);

  五  天地图WMTS服务

  服务资源。

作者:助你软件工作室
出处:http://www.cnblogs.com/chenyuming507950417/

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

ARCGIS FLEX API加载google地图、百度地图、天地图(转)的更多相关文章

  1. ArcGIS Flex API加载大量数据

    1.关于大量数据的加载: 直接将所要展示的数据在服务器端发布成一个MapService,在客户端通过ArcGISDynamicMapServiceLayer来加载.这样的话客户端需要展示的仅仅是一张图 ...

  2. ArcGIS Javascript API 加载高德在线地图扩展

    利用ArcGIS JavaScript API加载高德在线地图的扩展 /** * Created by WanderGIS on 2015/7/15. */ define(["dojo/_b ...

  3. Flex加载google地图、百度地图以及天地图作底图

    一  Flex加载Google地图作底图 (1)帮助类GoogleLayer.as /* * 根据输入的地图类型加载Google地图(by chenyuming) */ package Layers ...

  4. ArcGIS API for Silverlight 加载google地图

    原文:ArcGIS API for Silverlight 加载google地图 using System; using System.Net; using System.Windows; using ...

  5. ArcGIS API for Silverlight加载google地图(后续篇)

    原文:ArcGIS API for Silverlight加载google地图(后续篇) 之前在博客中(http://blog.csdn.net/taomanman/article/details/8 ...

  6. Arcgis for js加载百度地图

    看转:https://blog.csdn.net/qq_41046162/article/details/80248281 通过学习了一段时间的arcgis for js,让我来讲一下如何在arcgi ...

  7. ArcGIS API for Silverlight中加载Google地形图(瓦片图)

    原文:ArcGIS API for Silverlight中加载Google地形图(瓦片图) 在做水利.气象.土地等行业中,若能使用到Google的地形图那是再合适不过了,下面就介绍如何在ArcGIS ...

  8. (转) Arcgis for js加载百度地图

    http://blog.csdn.net/gisshixisheng/article/details/44853709 概述: 在前面的文章里提到了Arcgis for js加载天地图,在本节,继续讲 ...

  9. 《ArcGIS Runtime SDK for Android开发笔记》——(13)、图层扩展方式加载Google地图

    1.前言 http://mt2.google.cn/vt/lyrs=m@225000000&hl=zh-CN&gl=cn&x=420&y=193&z=9& ...

随机推荐

  1. 【bzoj1270】[BeijingWc2008]雷涛的小猫 dp

    题目描述   输入 输出 样例输入 样例输出 8 题解 dp 设f[i][j]表示在第i棵树的j高度时最多吃到的柿子数. 那么只有两种可能能够到达这个位置:滑下来.跳下来. 滑下来直接用f[i][j+ ...

  2. FreeBSD NTP 简单使用

    FreeBSD NTP 简单使用 来源 https://blog.csdn.net/stevexk/article/details/1349506 1.ntptrace xxx.xxx.xxx.xxx ...

  3. 如何进入百度、阿里,一个6年Android老司机的面经

    花絮 也许会有人感叹某些人的运气比较好,但是他们不曾知道对方吃过多少苦,受过多少委屈.某些时候就是需要我们用心去发现突破点,然后顺势而上,抓住机遇,那么你将会走向另外一条大道,成就另外一个全新的自我. ...

  4. HDU5187 zhx's contest

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission ...

  5. 转载:GCC 提供的原子操作

    转载自:GCC 提供的原子操作 GCC 提供的原子操作 gcc从4.1.2提供了__sync_*系列的built-in函数,用于提供加减和逻辑运算的原子操作. 其声明如下: type __sync_f ...

  6. Hoof, Paper, Scissors(USACO)

    题目大意: 一种游戏(类似于石头剪刀布):两个人分别给出一个字母,然后比较:H>S,S>P,P>H,我们已知对手的字母顺序,求在前n局中我们最多能赢多少次. 由于出字母的人非常懒,所 ...

  7. POCO C++ SOCKET

    // client program #include "Poco/Net/DatagramSocket.h" #include "Poco/Net/SocketAddre ...

  8. Centos 查看硬盘空间

    df -h du -ah --max-depth=1 目录深度为1 -h:以人类可读的方式显示 -a:显示目录占用的磁盘空间大小,还要显示其下目录和文件占用磁盘空间的大小 -s:显示目录占用的磁盘空间 ...

  9. WPF+MVVM数据绑定问题集锦

    1.  数据绑定的问题 在使用数据绑定时,一般使用 ObservableCollection<T> 类,不使用list列表集合,因为list数据发生变化时,UI界面不更新,而Observa ...

  10. BZOJ1588 [HNOI2002]营业额统计 splay模板

    1588: [HNOI2002]营业额统计 Time Limit: 5 Sec  Memory Limit: 162 MB Submit: 16189  Solved: 6482 [Submit][S ...