mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
jshint files. Some still need some work but I didn't want to break anything.
This commit is contained in:
parent
64bdc37386
commit
a44157ffeb
98
.jshintrc
Normal file
98
.jshintrc
Normal file
@ -0,0 +1,98 @@
|
||||
{
|
||||
// JSHint Configuration, esri jsapi
|
||||
// Modified from [jshint web defaults][1].
|
||||
// Differences between the default and our file are noted
|
||||
// Options that are commented out completely are uneccesary or problematic for our codebase
|
||||
// [1] : https://github.com/jshint/jshint/blob/2.x/examples/.jshintrc
|
||||
// See http://jshint.com/docs/ for more details
|
||||
|
||||
"maxerr" : 5000, // {int} Maximum error before stopping ** Get ALL the errors **
|
||||
|
||||
// Enforcing - true = enforce this rule, false = don't enforce this rule
|
||||
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
|
||||
"camelcase" : false, // true: Identifiers must be in camelCase
|
||||
"curly" : true, // true: Require {} for every new block or scope
|
||||
"eqeqeq" : false, // true: Require triple equals (===) for comparison ** Just use triples with undefined, null, false, 0 and 1 **
|
||||
"forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() ** Still needed until IE8 support is dropped **
|
||||
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` ** Avoids confusion and minification errors **
|
||||
"latedef" : false, // true: Require variables/functions to be defined before being used
|
||||
"newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` ** Coding style enforcement **
|
||||
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
|
||||
"noempty" : true, // true: Prohibit use of empty blocks
|
||||
"nonew" : true, // true: Prohibit use of constructors for side-effects (without assignment) ** Coding style enforcement **
|
||||
"plusplus" : false, // true: Prohibit use of `++` & `--`
|
||||
"quotmark" : true, // Quotation mark consistency: ** Use the same style. Doubles should be used it most cases **
|
||||
// false : do nothing (default)
|
||||
// true : ensure whatever is used is consistent
|
||||
// "single" : require single quotes
|
||||
// "double" : require double quotes
|
||||
"undef" : true, // true: Require all non-global variables to be declared (prevents global leaks)
|
||||
"unused" : "vars", // true: Require all defined variables be used
|
||||
"strict" : false, // true: Requires all functions run in ES5 Strict Mode ** Dojo style and existing codebase conflicts **
|
||||
"trailing" : false, // true: Prohibit trailing whitespaces
|
||||
//"indent" : 4, // {int} Number of spaces to use for indentation
|
||||
//"maxparams" : false, // {int} Max number of formal params allowed per function
|
||||
//"maxdepth" : false, // {int} Max depth of nested blocks (within functions)
|
||||
//"maxstatements" : false, // {int} Max number statements per function
|
||||
//"maxcomplexity" : false, // {int} Max cyclomatic complexity per function
|
||||
//"maxlen" : false, // {int} Max number of characters per line
|
||||
|
||||
// Relaxing - false = continue to enforce this rule, true = don't enforce this rule (relax it)
|
||||
"asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons)
|
||||
"boss" : false, // true: Tolerate assignments where comparisons would be expected
|
||||
"debug" : false, // true: Allow debugger statements e.g. browser breakpoints.
|
||||
"eqnull" : true, // true: Tolerate use of `== null`
|
||||
"es5" : false, // true: Allow ES5 syntax (ex: getters and setters)
|
||||
"esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`)
|
||||
"moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features)
|
||||
// (ex: `for each`, multiple try/catch, function expression…)
|
||||
"evil" : false, // true: Tolerate use of `eval` and `new Function()`
|
||||
"expr" : false, // true: Tolerate `ExpressionStatement` as Programs
|
||||
"funcscope" : true, // true: Tolerate defining variables inside control statements ** Other variable checks keep use from abusing this **
|
||||
"globalstrict" : false, // true: Allow global "use strict" (also enables 'strict')
|
||||
"iterator" : false, // true: Tolerate using the `__iterator__` property
|
||||
"lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block
|
||||
"laxbreak" : false, // true: Tolerate possibly unsafe line breakings
|
||||
"laxcomma" : false, // true: Tolerate comma-first style coding
|
||||
"loopfunc" : true, // true: Tolerate functions being defined in loops ** Almost required in some callback & promise style code **
|
||||
"multistr" : false, // true: Tolerate multi-line strings
|
||||
"proto" : false, // true: Tolerate using the `__proto__` property
|
||||
"scripturl" : true, // true: Tolerate script-targeted URLs ** If this is being used, there is probably a good reason **
|
||||
"smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment
|
||||
"shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
|
||||
"sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation
|
||||
"supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;`
|
||||
"validthis" : true, // true: Tolerate using this in a non-constructor function ** We don't run in `strict mode` & coding style conflicts **
|
||||
|
||||
// Environments
|
||||
"browser" : true, // Web Browser (window, document, etc)
|
||||
"devel" : true, // Development/debugging (alert, confirm, etc)
|
||||
"couch" : false, // CouchDB
|
||||
"dojo" : false, // Dojo Toolkit ** Don't use global dojo objects. Use AMD style coding **
|
||||
"jquery" : false, // jQuery
|
||||
"mootools" : false, // MooTools
|
||||
"node" : false, // Node.js
|
||||
"nonstandard" : false, // Widely adopted globals (escape, unescape, etc)
|
||||
"prototypejs" : false, // Prototype and Scriptaculous
|
||||
"rhino" : false, // Rhino
|
||||
"worker" : false, // Web Workers ** Make a jshint comment when this is `true` **
|
||||
"wsh" : false, // Windows Scripting Host
|
||||
"yui" : false, // Yahoo User Interface
|
||||
|
||||
// Legacy ** According to jshint docs, these options are NOT to be used or relied on. Removing them.
|
||||
//"nomen" : false, // true: Prohibit dangling `_` in variables
|
||||
//"onevar" : false, // true: Allow only one `var` statement per function
|
||||
//"passfail" : false, // true: Stop on first error
|
||||
//"white" : false, // true: Check against strict whitespace and indentation rules
|
||||
|
||||
// Custom Globals - additional predefined global variables
|
||||
// Using both `predef` and `globals` to support tools with older jshint parsers
|
||||
"predef" : [
|
||||
"define",
|
||||
"require"
|
||||
],
|
||||
"globals" : { // ** `false` = don't allow variable to be redefined locally
|
||||
"define": false,
|
||||
"require": false
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
/*global IDBKeyRange,indexedDB */
|
||||
define([], function()
|
||||
{
|
||||
"use strict";
|
||||
var AttachmentsStore = function()
|
||||
{
|
||||
this._db = null;
|
||||
@ -322,7 +322,7 @@ define([], function()
|
||||
|
||||
this._createLocalURL = function(attachmentFile)
|
||||
{
|
||||
return window.URL.createObjectURL(attachmentFile)
|
||||
return window.URL.createObjectURL(attachmentFile);
|
||||
};
|
||||
|
||||
this._revokeLocalURL = function(attachment)
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define(["esri/graphic"], function(Graphic)
|
||||
{
|
||||
"use strict";
|
||||
/* private consts */
|
||||
var EDITS_QUEUE_KEY = "esriEditsQueue";
|
||||
var SEPARATOR = "|@|";
|
||||
@ -24,15 +23,15 @@ define(["esri/graphic"], function(Graphic)
|
||||
isSupported: function()
|
||||
{
|
||||
// http://stackoverflow.com/questions/11214404/how-to-detect-if-browser-supports-html5-local-storage
|
||||
var mod = 'esriLocalStorageTest';
|
||||
var mod = "esriLocalStorageTest";
|
||||
try {
|
||||
window.localStorage.setItem(mod, mod);
|
||||
window.localStorage.removeItem(mod);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
pushEdit: function(operation,layer,graphic)
|
||||
{
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
define([
|
||||
"edit/editsStore",
|
||||
@ -12,7 +11,7 @@ define([
|
||||
"dojo/dom-attr",
|
||||
"dojo/dom-style",
|
||||
"dojo/query",
|
||||
|
||||
"esri/config",
|
||||
"esri/layers/GraphicsLayer",
|
||||
"esri/graphic",
|
||||
"esri/symbols/SimpleMarkerSymbol",
|
||||
@ -21,24 +20,25 @@ define([
|
||||
"esri/urlUtils"],
|
||||
function(editsStore, AttachmentsStore,
|
||||
Evented,Deferred,all,declare,array,domAttr,domStyle,query,
|
||||
GraphicsLayer,Graphic,SimpleMarkerSymbol,SimpleLineSymbol,SimpleFillSymbol,urlUtils)
|
||||
esriConfig,GraphicsLayer,Graphic,SimpleMarkerSymbol,SimpleLineSymbol,SimpleFillSymbol,urlUtils)
|
||||
{
|
||||
"use strict";
|
||||
return declare([Evented],
|
||||
{
|
||||
_onlineStatus: "online",
|
||||
_featureLayers: {},
|
||||
|
||||
ONLINE: "online", // all edits will directly go to the server
|
||||
OFFLINE: "offline", // edits will be enqueued
|
||||
RECONNECTING: "reconnecting", // sending stored edits to the server
|
||||
OFFLINE: "offline", // edits will be enqueued
|
||||
RECONNECTING: "reconnecting", // sending stored edits to the server
|
||||
|
||||
// manager emits event when...
|
||||
events: {
|
||||
EDITS_SENT: 'edits-sent', // ...whenever any edit is actually sent to the server
|
||||
EDITS_ENQUEUED: 'edits-enqueued', // ...when an edit is enqueued (and not sent to the server)
|
||||
ALL_EDITS_SENT: 'all-edits-sent', // ...after going online and there are no pending edits in the queue
|
||||
ATTACHMENT_ENQUEUED: 'attachment-enqueued',
|
||||
ATTACHMENTS_SENT: 'attachments-sent'
|
||||
EDITS_SENT: "edits-sent", // ...whenever any edit is actually sent to the server
|
||||
EDITS_ENQUEUED: "edits-enqueued", // ...when an edit is enqueued (and not sent to the server)
|
||||
ALL_EDITS_SENT: "all-edits-sent", // ...after going online and there are no pending edits in the queue
|
||||
ATTACHMENT_ENQUEUED: "attachment-enqueued",
|
||||
ATTACHMENTS_SENT: "attachments-sent"
|
||||
},
|
||||
|
||||
/**
|
||||
@ -101,7 +101,7 @@ define([
|
||||
}
|
||||
return true;
|
||||
}
|
||||
alert('The File APIs are not fully supported in this browser.');
|
||||
alert("The File APIs are not fully supported in this browser.");
|
||||
return false;
|
||||
},
|
||||
|
||||
@ -487,7 +487,7 @@ define([
|
||||
*/
|
||||
goOffline: function()
|
||||
{
|
||||
console.log('going offline');
|
||||
console.log("going offline");
|
||||
this._onlineStatus = this.OFFLINE;
|
||||
},
|
||||
|
||||
@ -498,7 +498,7 @@ define([
|
||||
*/
|
||||
goOnline: function(callback)
|
||||
{
|
||||
console.log('going online');
|
||||
console.log("going online");
|
||||
this._onlineStatus = this.RECONNECTING;
|
||||
this._replayStoredEdits(function(success,responses)
|
||||
{
|
||||
@ -540,7 +540,7 @@ define([
|
||||
var layer = this._featureLayers[ edit.layer ];
|
||||
var graphic = editsStore._deserialize(edit.graphic);
|
||||
var readableGraphic = graphic.geometry.type;
|
||||
var layerId = edit.layer.substring(edit.layer.lastIndexOf('/')+1);
|
||||
var layerId = edit.layer.substring(edit.layer.lastIndexOf("/")+1);
|
||||
if(layer)
|
||||
{
|
||||
readableGraphic += " [id=" + graphic.attributes[layer.objectIdField] + "]";
|
||||
@ -563,55 +563,55 @@ define([
|
||||
var color = [0,255,0,255];
|
||||
var width = 1.5;
|
||||
|
||||
this._phantomSymbols['point'] = [];
|
||||
this._phantomSymbols['point'][editsStore.ADD] = new SimpleMarkerSymbol({
|
||||
this._phantomSymbols.point = [];
|
||||
this._phantomSymbols.point[editsStore.ADD] = new SimpleMarkerSymbol({
|
||||
"type": "esriSMS", "style": "esriSMSCross",
|
||||
"xoffset": 10, "yoffset": 10,
|
||||
"color": [255,255,255,0], "size": 15,
|
||||
"outline": { "color": color, "width": width, "type": "esriSLS", "style": "esriSLSSolid" }
|
||||
});
|
||||
this._phantomSymbols['point'][editsStore.UPDATE] = new SimpleMarkerSymbol({
|
||||
this._phantomSymbols.point[editsStore.UPDATE] = new SimpleMarkerSymbol({
|
||||
"type": "esriSMS", "style": "esriSMSCircle",
|
||||
"xoffset": 0, "yoffset": 0,
|
||||
"color": [255,255,255,0], "size": 15,
|
||||
"outline": { "color": color, "width": width, "type": "esriSLS", "style": "esriSLSSolid" }
|
||||
});
|
||||
this._phantomSymbols['point'][editsStore.DELETE] = new SimpleMarkerSymbol({
|
||||
this._phantomSymbols.point[editsStore.DELETE] = new SimpleMarkerSymbol({
|
||||
"type": "esriSMS", "style": "esriSMSX",
|
||||
"xoffset": 0, "yoffset": 0,
|
||||
"color": [255,255,255,0], "size": 15,
|
||||
"outline": { "color": color, "width": width, "type": "esriSLS", "style": "esriSLSSolid" }
|
||||
});
|
||||
this._phantomSymbols['multipoint'] = null;
|
||||
this._phantomSymbols.multipoint = null;
|
||||
|
||||
this._phantomSymbols['polyline'] = [];
|
||||
this._phantomSymbols['polyline'][editsStore.ADD] = new SimpleLineSymbol({
|
||||
this._phantomSymbols.polyline = [];
|
||||
this._phantomSymbols.polyline[editsStore.ADD] = new SimpleLineSymbol({
|
||||
"type": "esriSLS", "style": "esriSLSSolid",
|
||||
"color": color,"width": width
|
||||
});
|
||||
this._phantomSymbols['polyline'][editsStore.UPDATE] = new SimpleLineSymbol({
|
||||
this._phantomSymbols.polyline[editsStore.UPDATE] = new SimpleLineSymbol({
|
||||
"type": "esriSLS", "style": "esriSLSSolid",
|
||||
"color": color,"width": width
|
||||
});
|
||||
this._phantomSymbols['polyline'][editsStore.DELETE] = new SimpleLineSymbol({
|
||||
this._phantomSymbols.polyline[editsStore.DELETE] = new SimpleLineSymbol({
|
||||
"type": "esriSLS", "style": "esriSLSSolid",
|
||||
"color": color,"width": width
|
||||
});
|
||||
|
||||
this._phantomSymbols['polygon'] = [];
|
||||
this._phantomSymbols['polygon'][editsStore.ADD] = new SimpleFillSymbol({
|
||||
this._phantomSymbols.polygon = [];
|
||||
this._phantomSymbols.polygon[editsStore.ADD] = new SimpleFillSymbol({
|
||||
"type": "esriSFS",
|
||||
"style": "esriSFSSolid",
|
||||
"color": [255,255,255,0],
|
||||
"outline": { "type": "esriSLS", "style": "esriSLSSolid", "color": color, "width": width }
|
||||
});
|
||||
this._phantomSymbols['polygon'][editsStore.UPDATE] = new SimpleFillSymbol({
|
||||
this._phantomSymbols.polygon[editsStore.UPDATE] = new SimpleFillSymbol({
|
||||
"type": "esriSFS",
|
||||
"style": "esriSFSSolid",
|
||||
"color": [255,255,255,0],
|
||||
"outline": { "type": "esriSLS", "style": "esriSLSDash", "color": color, "width": width }
|
||||
});
|
||||
this._phantomSymbols['polygon'][editsStore.DELETE] = new SimpleFillSymbol({
|
||||
this._phantomSymbols.polygon[editsStore.DELETE] = new SimpleFillSymbol({
|
||||
"type": "esriSFS",
|
||||
"style": "esriSFSSolid",
|
||||
"color": [255,255,255,0],
|
||||
@ -664,8 +664,9 @@ define([
|
||||
dfd.reject(err);
|
||||
};
|
||||
var proxy = esriConfig.defaults.io.proxyUrl || "";
|
||||
if(proxy !== "")
|
||||
proxy += "?"
|
||||
if(proxy !== ""){
|
||||
proxy += "?";
|
||||
}
|
||||
console.log("proxy:", proxy);
|
||||
oAjaxReq.open("post", proxy + attachment.featureId + "/addAttachment", true);
|
||||
var sBoundary = "---------------------------" + Date.now().toString(16);
|
||||
@ -777,7 +778,6 @@ define([
|
||||
case editsStore.ADD:
|
||||
/* impossible!! */
|
||||
throw("can't add the same feature twice!");
|
||||
break;
|
||||
case editsStore.UPDATE:
|
||||
layerEdits[ objectId ].graphic = edit.graphic;
|
||||
break;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
/*global indexedDB */
|
||||
/**
|
||||
* Library for handling the storing of map tiles in IndexedDB.
|
||||
*
|
||||
@ -8,6 +8,7 @@
|
||||
*/
|
||||
define([],function()
|
||||
{
|
||||
"use strict";
|
||||
var TilesStore = function()
|
||||
{
|
||||
/**
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
define([],function()
|
||||
{
|
||||
"use strict";
|
||||
var Base64Utils={};
|
||||
Base64Utils.outputTypes={
|
||||
// summary:
|
||||
@ -43,7 +42,7 @@ define([],function()
|
||||
s.push(String.fromCharCode((wa[i>>5]>>>(i%32))&mask));
|
||||
}
|
||||
return s.join(""); // string
|
||||
}
|
||||
};
|
||||
Base64Utils.wordToHex=function(/* word[] */wa){
|
||||
// summary:
|
||||
// convert an array of words to a hex tab
|
||||
@ -52,7 +51,7 @@ define([],function()
|
||||
s.push(h.charAt((wa[i>>2]>>((i%4)*8+4))&0xF)+h.charAt((wa[i>>2]>>((i%4)*8))&0xF));
|
||||
}
|
||||
return s.join(""); // string
|
||||
}
|
||||
};
|
||||
Base64Utils.wordToBase64=function(/* word[] */wa){
|
||||
// summary:
|
||||
// convert an array of words to base64 encoding, should be more efficient
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
define([
|
||||
"dojo/query",
|
||||
"dojo/request",
|
||||
@ -11,6 +9,7 @@ define([
|
||||
"tiles/FileSaver"
|
||||
], function(query, request, declare, geometry,Base64Utils,TilesStore,TilingScheme,FileSaver)
|
||||
{
|
||||
"use strict";
|
||||
return declare([],{
|
||||
/**
|
||||
* Utility method to get the basemap layer reference
|
||||
@ -83,7 +82,7 @@ define([
|
||||
return url;
|
||||
}
|
||||
|
||||
url = url.split('?')[0];
|
||||
url = url.split("?")[0];
|
||||
|
||||
/* temporary URL returned immediately, as we haven't retrieved the image from the indexeddb yet */
|
||||
var tileid = "void:/"+level+"/"+row+"/"+col;
|
||||
@ -334,7 +333,7 @@ define([
|
||||
|
||||
for(i=1; i<tiles.length; i++)
|
||||
{
|
||||
pair = tiles[i].split(',');
|
||||
pair = tiles[i].split(",");
|
||||
tile = {
|
||||
url: pair[0],
|
||||
img: pair[1]
|
||||
@ -362,7 +361,7 @@ define([
|
||||
}
|
||||
else
|
||||
{
|
||||
callback(false, 'The File APIs are not fully supported in this browser.');
|
||||
callback(false, "The File APIs are not fully supported in this browser.");
|
||||
}
|
||||
};
|
||||
|
||||
@ -458,7 +457,7 @@ define([
|
||||
{
|
||||
var store = this.offline.store;
|
||||
var url = this._getTileUrl(level,row,col);
|
||||
url = url.split('?')[0];
|
||||
url = url.split("?")[0];
|
||||
|
||||
/* download the tile */
|
||||
var imgurl = this.offline.proxyPath? this.offline.proxyPath + "?" + url : url;
|
||||
|
||||
@ -1,70 +1,60 @@
|
||||
"use strict";
|
||||
|
||||
define([
|
||||
"esri/geometry"
|
||||
], function(geometry)
|
||||
{
|
||||
"esri/geometry"
|
||||
], function (geometry) {
|
||||
"use strict";
|
||||
var TilingScheme = function (layer) {
|
||||
this.tileInfo = layer.tileInfo;
|
||||
};
|
||||
|
||||
var TilingScheme = function(layer)
|
||||
{
|
||||
this.tileInfo = layer.tileInfo;
|
||||
};
|
||||
TilingScheme.prototype = {
|
||||
getCellIdFromXy: function (x, y, level) {
|
||||
var col = Math.floor((x - this.tileInfo.origin.x) / (this.tileInfo.cols * this.tileInfo.lods[level].resolution));
|
||||
var row = Math.floor((this.tileInfo.origin.y - y) / (this.tileInfo.rows * this.tileInfo.lods[level].resolution));
|
||||
return [col, row];
|
||||
},
|
||||
|
||||
TilingScheme.prototype =
|
||||
{
|
||||
getCellIdFromXy: function(x,y,level)
|
||||
{
|
||||
var col = Math.floor((x-this.tileInfo.origin.x) / (this.tileInfo.cols*this.tileInfo.lods[level].resolution));
|
||||
var row = Math.floor((this.tileInfo.origin.y-y) / (this.tileInfo.rows*this.tileInfo.lods[level].resolution));
|
||||
return [col,row];
|
||||
},
|
||||
getCellPolygonFromCellId: function (cellId, level) {
|
||||
var col1 = cellId[0];
|
||||
var row1 = cellId[1];
|
||||
var col2 = col1 + 1;
|
||||
var row2 = row1 + 1;
|
||||
|
||||
getCellPolygonFromCellId: function(cellId,level)
|
||||
{
|
||||
var col1 = cellId[0];
|
||||
var row1 = cellId[1];
|
||||
var col2 = col1+1;
|
||||
var row2 = row1+1;
|
||||
var x1 = this.tileInfo.origin.x + (col1 * this.tileInfo.cols * this.tileInfo.lods[level].resolution);
|
||||
var y1 = this.tileInfo.origin.y - (row1 * this.tileInfo.rows * this.tileInfo.lods[level].resolution);
|
||||
var x2 = this.tileInfo.origin.x + (col2 * this.tileInfo.cols * this.tileInfo.lods[level].resolution);
|
||||
var y2 = this.tileInfo.origin.y - (row2 * this.tileInfo.rows * this.tileInfo.lods[level].resolution);
|
||||
|
||||
var x1 = this.tileInfo.origin.x + (col1 * this.tileInfo.cols * this.tileInfo.lods[level].resolution);
|
||||
var y1 = this.tileInfo.origin.y - (row1 * this.tileInfo.rows * this.tileInfo.lods[level].resolution);
|
||||
var x2 = this.tileInfo.origin.x + (col2 * this.tileInfo.cols * this.tileInfo.lods[level].resolution);
|
||||
var y2 = this.tileInfo.origin.y - (row2 * this.tileInfo.rows * this.tileInfo.lods[level].resolution);
|
||||
var polygon = new geometry.Polygon(this.tileInfo.spatialReference);
|
||||
polygon.addRing([
|
||||
[x1, y1], // clockwise
|
||||
[x2, y1],
|
||||
[x2, y2],
|
||||
[x1, y2],
|
||||
[x1, y1]
|
||||
]);
|
||||
return polygon;
|
||||
},
|
||||
|
||||
var polygon = new geometry.Polygon(this.tileInfo.spatialReference);
|
||||
polygon.addRing([
|
||||
[x1,y1], // clockwise
|
||||
[x2,y1],
|
||||
[x2,y2],
|
||||
[x1,y2],
|
||||
[x1,y1]
|
||||
]);
|
||||
return polygon;
|
||||
},
|
||||
getAllCellIdsInExtent: function (extent, gridLevel) {
|
||||
var cellId0 = this.getCellIdFromXy(extent.xmin, extent.ymin, gridLevel);
|
||||
var cellId1 = this.getCellIdFromXy(extent.xmax, extent.ymax, gridLevel);
|
||||
|
||||
getAllCellIdsInExtent : function(extent, gridLevel)
|
||||
{
|
||||
var cellId0 = this.getCellIdFromXy(extent.xmin, extent.ymin, gridLevel);
|
||||
var cellId1 = this.getCellIdFromXy(extent.xmax, extent.ymax, gridLevel);
|
||||
var i, j;
|
||||
var i0 = Math.max(Math.min(cellId0[0], cellId1[0]), this.tileInfo.lods[gridLevel].startTileCol);
|
||||
var i1 = Math.min(Math.max(cellId0[0], cellId1[0]), this.tileInfo.lods[gridLevel].endTileCol);
|
||||
var j0 = Math.max(Math.min(cellId0[1], cellId1[1]), this.tileInfo.lods[gridLevel].startTileRow);
|
||||
var j1 = Math.min(Math.max(cellId0[1], cellId1[1]), this.tileInfo.lods[gridLevel].endTileRow);
|
||||
|
||||
var i,j;
|
||||
var i0 = Math.max(Math.min(cellId0[0], cellId1[0]), this.tileInfo.lods[gridLevel].startTileCol);
|
||||
var i1 = Math.min(Math.max(cellId0[0], cellId1[0]), this.tileInfo.lods[gridLevel].endTileCol);
|
||||
var j0 = Math.max(Math.min(cellId0[1], cellId1[1]), this.tileInfo.lods[gridLevel].startTileRow);
|
||||
var j1 = Math.min(Math.max(cellId0[1], cellId1[1]), this.tileInfo.lods[gridLevel].endTileRow);
|
||||
var cellIds = [];
|
||||
|
||||
var cellIds = [];
|
||||
for (i = i0; i <= i1; i++) {
|
||||
for (j = j0; j <= j1; j++) {
|
||||
cellIds.push([i, j]);
|
||||
}
|
||||
}
|
||||
return cellIds;
|
||||
}
|
||||
};
|
||||
|
||||
for(i=i0; i<=i1; i++)
|
||||
{
|
||||
for(j=j0; j<=j1; j++)
|
||||
{
|
||||
cellIds.push([i,j]);
|
||||
}
|
||||
}
|
||||
return cellIds;
|
||||
}
|
||||
};
|
||||
|
||||
return TilingScheme;
|
||||
return TilingScheme;
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user