Skip to content

Commit

Permalink
修改和补充注释
Browse files Browse the repository at this point in the history
  • Loading branch information
radi-ac committed Oct 24, 2016
1 parent 6b53300 commit 287bdd6
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 72 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
new GeoBeans.Layer.TileLayer({
"name" : "label",
"source" : new GeoBeans.Source.Tile.MapWorld({
"url" : "/DataServer?",
"url" : "http://t4.tianditu.com/DataServer?",
"imageSet" : "cia",
"srs" : GeoBeans.Proj.WGS84,
}),
Expand Down
76 changes: 40 additions & 36 deletions src/GeoBeans/BaseTypes/Color.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ GeoBeans.Color = GeoBeans.Class({
});

/**
* [set description]
* @param {[type]} r [description]
* @param {[type]} g [description]
* @param {[type]} b [description]
* @param {[type]} a [description]
* 设置颜色的值
* @param {int} r Red
* @param {int} g Green
* @param {int} b Blue
* @param {int} a Alpha
* @public
*/
GeoBeans.Color.prototype.set = function(r,g,b,a){
this.r = r;
Expand All @@ -32,9 +33,9 @@ GeoBeans.Color.prototype.set = function(r,g,b,a){
}

/**
* [setByHex description]
* @param {[type]} hex [description]
* @param {[type]} a [description]
* 设置16进制格式表示的颜色的值
* @param {string} hex 16进制格式表示的颜色的值
* @param {float} a alpha
*/
GeoBeans.Color. prototype.setHex = function(hex,a){
if(hex != null){
Expand All @@ -54,43 +55,45 @@ GeoBeans.Color. prototype.setHex = function(hex,a){
}

/**
* [getRgb description]
* @return {[type]} [description]
* 获取RGB格式的颜色
* @return {GeoBeans.Color} 颜色
* @public
*/
GeoBeans.Color.prototype.getRgb = function(){
return "rgb(" + this.r + "," + this.g +
"," + this.b + ")";
}

/**
* [getRgba description]
* @return {[type]} [description]
* 获取RGBA格式的颜色
* @return {GeoBeans.Color} 颜色
* @public
*/
GeoBeans.Color.prototype.getRgba = function(){
return "rgba(" + this.r + "," + this.g
+ "," + this.b + "," + this.a + ")";
}

/**
* [getOpacity description]
* @return {[type]} [description]
* 获得不透明度
* @return {int} 不透明度
*/
GeoBeans.Color.prototype.getOpacity = function(){
return this.a;
}

/**
* [setOpacity description]
* @param {[type]} opacity [description]
* 设置不透明度
* @param {integer} opacity 不透明度
*/
GeoBeans.Color.prototype.setOpacity = function(opacity){
this.a = opacity;
}

/**
* [setRgb description]
* @param {[type]} rgb [description]
* @param {[type]} a [description]
* 设置颜色值(RGB)
* @param {string} rgb rgb
* @param {integer} a alpha
*/
GeoBeans.Color. prototype.setRgb = function(rgb,a){
if(rgb != null){
Expand All @@ -113,8 +116,9 @@ GeoBeans.Color. prototype.setRgb = function(rgb,a){
}

/**
* [getHex description]
* @return {[type]} [description]
* 获得16进制格式的颜色
* @return {string} 16进制格式的颜色
* @public
*/
GeoBeans.Color.prototype.getHex = function(){
var rgb = this.getRgb();
Expand All @@ -127,8 +131,8 @@ GeoBeans.Color.prototype.getHex = function(){
}

/**
* [clone description]
* @return {[type]} [description]
* 复制颜色
* @return {GeoBeans.Color} 颜色对象
*/
GeoBeans.Color.prototype.clone = function(){
var clone = new GeoBeans.Color();
Expand All @@ -140,11 +144,11 @@ GeoBeans.Color.prototype.clone = function(){
}

/**
* [setHsl description]
* @param {[type]} h [description]
* @param {[type]} s [description]
* @param {[type]} l [description]
* @param {[type]} a [description]
* 设置HSL格式颜色
* @param {integer} h h
* @param {integer} s s
* @param {integer} l l
* @param {integer} a a
*/
GeoBeans.Color. prototype.setHsl = function(h,s,l,a){
var r, g, b;
Expand Down Expand Up @@ -178,8 +182,8 @@ GeoBeans.Color. prototype.setHsl = function(h,s,l,a){
}

/**
* [getHsl description]
* @return {[type]} [description]
* 获取HSL格式颜色
* @return {GeoBeans.Color} HSL格式颜色
*/
GeoBeans.Color.prototype.getHsl = function(){
var r = this.r/255, g = this.g/255, b = this.b/255;
Expand Down Expand Up @@ -207,8 +211,8 @@ GeoBeans.Color.prototype.getHsl = function(){
}

/**
* [setAbgr description]
* @param {[type]} abgr [description]
* 设置ABGR格式颜色
* @param {integer} abgr 颜色值
*/
GeoBeans.Color. prototype.setAbgr = function(abgr){
if(abgr.length == 8){
Expand All @@ -222,11 +226,11 @@ GeoBeans.Color. prototype.setAbgr = function(abgr){
}

/**
* [zero_fill_hex description]
* 清空
* @private
* @param {[type]} num [description]
* @param {[type]} digits [description]
* @return {[type]} [description]
* @param {float} num num
* @param {float} digits digits
* @return {string} string
*/
GeoBeans.Color.prototype.zero_fill_hex = function(num, digits){
var s = num.toString(16);
Expand Down
5 changes: 2 additions & 3 deletions src/GeoBeans/Cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ GeoBeans.Cluster = GeoBeans.Class({

/**
* 获取聚类
* @return {[type]} [description]
*/
GeoBeans.Cluster.prototype.getClusters = function(){
if(!isValid(this.features) || !isValid(this.map)){
Expand Down Expand Up @@ -83,8 +82,8 @@ GeoBeans.Cluster.prototype.shouldCluster = function(cluster,geometry){
/**
* 添加到聚类
* @private
* @param {[type]} cluster [description]
* @param {[type]} feature [description]
* @param {int} cluster 聚类
* @param {GeoBeans.Feature} feature 要素
*/
GeoBeans.Cluster.prototype.addToCluster = function(cluster,feature){
cluster.features.push(feature);
Expand Down
9 changes: 4 additions & 5 deletions src/GeoBeans/Event/MapEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
* @class
* @extends {GeoBeans.Event}
*/
GeoBeans.Event.MapEvent = function(){
map : null,
type : ""
};

GeoBeans.Event.MapEvent = {
map = null,
type = ""
};
12 changes: 6 additions & 6 deletions src/GeoBeans/Event/MouseEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ GeoBeans.Event.MouseButton = {
* @class
* @extends {GeoBeans.Event}
*/
GeoBeans.Event.MouseEvent = function(){
GeoBeans.Event.MouseEvent = {
map : null,
type : "",
buttn : null;
X : null;
Y : null;
mapX : null;
mapY : null;
buttn : null,
X : null,
Y : null,
mapX : null,
mapY : null
};

9 changes: 3 additions & 6 deletions src/GeoBeans/Interaction/Rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ GeoBeans.Interaction.Rotate = GeoBeans.Class(GeoBeans.Interaction, {
});

/**
* [enable description]
* 启用/禁用Rotate
* @public
* @param {[type]} enabled [description]
* @return {[type]} [description]
* @param {boolean} enabled 启用/禁用
*/
GeoBeans.Interaction.Rotate.prototype.enable = function(enabled){
this._enabled = enabled;
Expand All @@ -60,7 +59,6 @@ GeoBeans.Interaction.Rotate.prototype.enable = function(enabled){
/**
* 开始交互
* @public
* @return {[type]} [description]
*/
GeoBeans.Interaction.Rotate.prototype.start = function(){
var that = this;
Expand Down Expand Up @@ -170,7 +168,6 @@ GeoBeans.Interaction.Rotate.prototype.start = function(){
/**
* [cleanup description]
* @private
* @return {[type]} [description]
*/
GeoBeans.Interaction.Rotate.prototype.stop = function(){
var mapContainer = this._map.getContainer();
Expand All @@ -185,7 +182,7 @@ GeoBeans.Interaction.Rotate.prototype.stop = function(){
/**
* 返回是否已经在交互的状态
* @private
* @return {bool} 交互状态
* @return {boolean} 交互状态
*/
GeoBeans.Interaction.Rotate.prototype.getRotateStatus = function(){
return this._rotating;
Expand Down
14 changes: 6 additions & 8 deletions src/GeoBeans/Interaction/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,7 @@ GeoBeans.Interaction.Select.prototype.cleanup = function(){
* function onchange(features){<br>
* }<br>
* @public
* @param {[type]} handler [description]
* @return {[type]} [description]
* @param {function} handler onchange事件响应函数
*/
GeoBeans.Interaction.Select.prototype.onchange = function(handler){
this._onchange = handler;
Expand All @@ -319,8 +318,8 @@ GeoBeans.Interaction.Select.prototype.onchange = function(handler){
/**
* 创建Spatial查询Filter
* @private
* @param {[type]} point [description]
* @return {[type]} [description]
* @param {GeoBeans.Geometry} g 几何对象
* @return {GeoBeans.Query} 查询条件对象
*/
GeoBeans.Interaction.Select.prototype.createSpatialQuery = function(g){
// Filter
Expand All @@ -341,8 +340,8 @@ GeoBeans.Interaction.Select.prototype.createSpatialQuery = function(g){
/**
* 创建BBox查询Filter
* @private
* @param {[type]} rect [description]
* @return {[type]} [description]
* @param {GeoBeans.Envelope} rect 矩形
* @return {GeoBeans.Query} 查询条件对象
*/
GeoBeans.Interaction.Select.prototype.createBBoxQuery = function(rect){
var source = this._layer.getSource();
Expand Down Expand Up @@ -378,8 +377,7 @@ GeoBeans.Interaction.Select.prototype.createDistanceBufferFilterQuery = function
* 查询结果回调函数,处理查询到的features。然后将features,设置为选择集合_selections,用于高亮显示。
* @deprecated [description]
* @private
* @param {[type]} features [description]
* @return {[type]} [description]
* @param {Array.<GeoBeans.Feature>} features Feature集合
*/
GeoBeans.Interaction.Select.prototype.setSelection = function(features){
this._selection = features;
Expand Down
2 changes: 1 addition & 1 deletion src/GeoBeans/Layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ GeoBeans.Layer.prototype.putSnap = function(x,y){
/**
* 指定位置和大小放置缩略图
* @private
* @param {int]} x x坐标
* @param {int} x x坐标
* @param {int} y y坐标
* @param {int} width 放置后的宽度
* @param {int} height 放置后的高度
Expand Down
3 changes: 0 additions & 3 deletions src/GeoBeans/Layer/FeatureLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ GeoBeans.Layer.FeatureLayer = GeoBeans.Class(GeoBeans.Layer, {
// },

/**
* [http description]
* @type {String}
* new GeoBeans.Layer.FeatureLayer({
* "name" : "layername",
* "geometryType" : GeoBeans.Geometry.Type.POINT,
Expand Down
2 changes: 1 addition & 1 deletion src/GeoBeans/Layer/FeatureLayer/HeatMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GeoBeans.Layer.HeatMapLayer2.prototype.refresh = function(){

/**
* 绘制热力图
* @return {[type]} [description]
* @private
*/
GeoBeans.Layer.HeatMapLayer2.prototype.drawHeatMap = function(){

Expand Down
1 change: 1 addition & 0 deletions src/GeoBeans/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
* }
* });
* </script>
*
*
* @class
* @param {object} options options
Expand Down
22 changes: 20 additions & 2 deletions src/GeoBeans/Viewer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
/**
* @classdesc
* 地图视图类
* 设置Map显示的分辨率、范围、旋转角等参数。
* 地图视图类,用于设置Map显示的分辨率、范围、旋转角等参数,实现地图显示方式的控制。
* Viewer类为Map的属性,通过map.getViewer()方法获取。
* Map的显示方式由以下4个参数控制:
* 1) zoom+center
* 设置地图的缩放级别和中心点。
* 仅在Map上添加并设置了baseLayer的情况下,zoom和center参数才起作用。
* 设置zoom和center后,Map会根据baseLayer的参数进行地图绘制。
* 2) extent
* 设置地图的视口范围。
* Map5会将地图缩放到extent范围内进行显示。
* 由于extent和zoom不一定完全对应,因此由extent反算得到的zoom不一定是整数。因此瓦片地图的显示级别有可能是小数。因此Map5支持无级缩放。
* 3) resolution
* 设置地图的显示分辨率。
* Map5会将地图以该分辨率进行显示。同上,resolution参数支持无级缩放。
* 4) rotation
* 设置地图旋转角度
* Map5以地图中心点为旋转点,以rotation为角度旋转地图。
* rotation的单位为“度”。 *
*
* @class
* @api stable
*/
GeoBeans.Viewer = GeoBeans.Class({

Expand Down

0 comments on commit 287bdd6

Please sign in to comment.