mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
v2.16
This commit is contained in:
parent
f5c0cbf8fa
commit
6a0c802a04
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,5 +1,15 @@
|
||||
# offline-editor-js - Changelog
|
||||
|
||||
## Version 2.16 - Oct. 29, 2015
|
||||
|
||||
No breaking changes. Recommended update.
|
||||
|
||||
**Enhancements**
|
||||
* Closes #418 - Updated How To Use Edit Library doc to show a recursive coding pattern for loading multiple feature layers.
|
||||
|
||||
**Bug Fix**
|
||||
* Closes #419 - OfflineFeaturesManager now works correctly when extending multiple feature layers.
|
||||
|
||||
## Version 2.15 - Sep. 29, 2015
|
||||
|
||||
No breaking changes.
|
||||
|
||||
6
dist/offline-edit-min.js
vendored
6
dist/offline-edit-min.js
vendored
File diff suppressed because one or more lines are too long
86
dist/offline-edit-src.js
vendored
86
dist/offline-edit-src.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! esri-offline-maps - v2.15.0 - 2015-09-29
|
||||
/*! esri-offline-maps - v2.16.0 - 2015-10-29
|
||||
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
|
||||
* Apache License*/
|
||||
/*jshint -W030 */
|
||||
@ -388,7 +388,6 @@ define([
|
||||
layer.applyEdits = function (adds, updates, deletes, callback, errback) {
|
||||
// inside this method, 'this' will be the FeatureLayer
|
||||
// and 'self' will be the offlineFeatureLayer object
|
||||
|
||||
var promises = [];
|
||||
|
||||
if (self.getOnlineStatus() === self.ONLINE) {
|
||||
@ -405,8 +404,8 @@ define([
|
||||
var results = {addResults: [], updateResults: [], deleteResults: []};
|
||||
var updatesMap = {};
|
||||
|
||||
adds = adds || [];
|
||||
adds.forEach(function (addEdit) {
|
||||
var _adds = adds || [];
|
||||
_adds.forEach(function (addEdit) {
|
||||
var deferred = new Deferred();
|
||||
|
||||
var objectId = this._getNextTempId();
|
||||
@ -503,19 +502,35 @@ define([
|
||||
|
||||
all(promises).then(function (r) {
|
||||
// Make sure all edits were successful. If not throw an error.
|
||||
var success = true;
|
||||
var promisesSuccess = true;
|
||||
for (var v = 0; v < r.length; v++) {
|
||||
if (r[v] === false) {
|
||||
success = false;
|
||||
promisesSuccess = false;
|
||||
}
|
||||
}
|
||||
|
||||
layer._pushFeatureCollections();
|
||||
layer._pushFeatureCollections(function(success){
|
||||
console.log("All edits done");
|
||||
|
||||
// we already pushed the edits into the database, now we let the FeatureLayer to do the local updating of the layer graphics
|
||||
if(success && promisesSuccess){
|
||||
self.emit(self.events.EDITS_ENQUEUED, results);
|
||||
}
|
||||
else {
|
||||
if(!success){
|
||||
console.log("applyEdits() there was a problem with _pushFeatureCollections.");
|
||||
}
|
||||
self.emit(self.events.EDITS_ENQUEUED_ERROR, results);
|
||||
}
|
||||
|
||||
//promisesSuccess === true ? self.emit(self.events.EDITS_ENQUEUED, results) : self.emit(self.events.EDITS_ENQUEUED_ERROR, results);
|
||||
|
||||
// we already pushed the edits into the database, now we let the FeatureLayer to do the local updating of the layer graphics
|
||||
this._editHandler(results, _adds, updatesMap, callback, errback, deferred1);
|
||||
}.bind(this));
|
||||
|
||||
//success === true ? self.emit(self.events.EDITS_ENQUEUED, results) : self.emit(self.events.EDITS_ENQUEUED_ERROR, results);
|
||||
// EDITS_ENQUEUED = callback(true, edit), and EDITS_ENQUEUED_ERROR = callback(false, /*String */ error)
|
||||
this._editHandler(results, adds, updatesMap, callback, errback, deferred1);
|
||||
success === true ? self.emit(self.events.EDITS_ENQUEUED, results) : self.emit(self.events.EDITS_ENQUEUED_ERROR, results);
|
||||
//this._editHandler(results, _adds, updatesMap, callback, errback, deferred1);
|
||||
}.bind(this));
|
||||
|
||||
return deferred1;
|
||||
@ -765,10 +780,10 @@ define([
|
||||
* to reconstitute a featureLayer and then redisplay all the associated features.
|
||||
*
|
||||
* To retrieve use OfflineFeaturesManager.getFeatureCollections().
|
||||
*
|
||||
* @param callback (boolean)
|
||||
* @private
|
||||
*/
|
||||
layer._pushFeatureCollections = function(){
|
||||
layer._pushFeatureCollections = function(callback){
|
||||
|
||||
// First let's see if any collections exists
|
||||
self._editStore._getFeatureCollections(function(success, result) {
|
||||
@ -827,8 +842,12 @@ define([
|
||||
self._editStore._pushFeatureCollections(result, function(success, error) {
|
||||
if(!success){
|
||||
console.error("There was a problem creating the featureCollectionObject: " + error);
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
else {
|
||||
callback(true);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
};
|
||||
|
||||
@ -1159,9 +1178,18 @@ define([
|
||||
if(r.length === 0 && url){
|
||||
// Initialize the internal featureLayerCollectionObject
|
||||
if(this.ENABLE_FEATURECOLLECTION) {
|
||||
layer._pushFeatureCollections();
|
||||
layer._pushFeatureCollections(function(success){
|
||||
if(success){
|
||||
callback(true, null);
|
||||
}
|
||||
else {
|
||||
callback(false, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
callback(true, null);
|
||||
}
|
||||
callback(true, null);
|
||||
}
|
||||
else if(r[0].success && !url){
|
||||
|
||||
@ -1175,9 +1203,18 @@ define([
|
||||
|
||||
// Initialize the internal featureLayerCollectionObject
|
||||
if(this.ENABLE_FEATURECOLLECTION) {
|
||||
layer._pushFeatureCollections();
|
||||
layer._pushFeatureCollections(function(success){
|
||||
if(success){
|
||||
callback(true, null);
|
||||
}
|
||||
else {
|
||||
callback(false, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
callback(true, null);
|
||||
}
|
||||
callback(true, null);
|
||||
}
|
||||
else {
|
||||
// NOTE: We have to have a valid feature layer URL in order to initialize the featureLayerCollectionObject
|
||||
@ -1188,12 +1225,19 @@ define([
|
||||
}
|
||||
else if(r[0].success){
|
||||
|
||||
// Initialize the internal featureLayerCollectionObject
|
||||
if(this.ENABLE_FEATURECOLLECTION) {
|
||||
layer._pushFeatureCollections();
|
||||
layer._pushFeatureCollections(function(success){
|
||||
if(success){
|
||||
callback(true, null);
|
||||
}
|
||||
else {
|
||||
callback(false, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
callback(true, null);
|
||||
}
|
||||
|
||||
callback(true, null);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
|
||||
2
dist/offline-tiles-advanced-min.js
vendored
2
dist/offline-tiles-advanced-min.js
vendored
File diff suppressed because one or more lines are too long
7
dist/offline-tiles-advanced-src.js
vendored
7
dist/offline-tiles-advanced-src.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! esri-offline-maps - v2.15.0 - 2015-09-29
|
||||
/*! esri-offline-maps - v2.16.0 - 2015-10-29
|
||||
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
|
||||
* Apache License*/
|
||||
define([
|
||||
@ -449,7 +449,7 @@ define([
|
||||
},
|
||||
|
||||
/**
|
||||
* Assign various properties to the layer
|
||||
* Assign various properties to the layer and then load tiles
|
||||
* @param result
|
||||
* @param context
|
||||
* @param callback
|
||||
@ -544,10 +544,9 @@ define([
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Now it's okay to parse the response
|
||||
self._parseTileInfo(staticResponse, self, callback);
|
||||
}
|
||||
|
||||
//callback(this.response);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
2
dist/offline-tiles-basic-min.js
vendored
2
dist/offline-tiles-basic-min.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! esri-offline-maps - v2.15.0 - 2015-09-29
|
||||
/*! esri-offline-maps - v2.16.0 - 2015-10-29
|
||||
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
|
||||
* Apache License*/
|
||||
define(["dojo/query","dojo/request","esri/geometry/Polygon","dojo/_base/declare"],function(a,b,c,d){"use strict";return d("O.esri.Tiles.OfflineTilesEnabler",[],{getBasemapLayer:function(a){var b=a.layerIds[0];return a.getLayer(b)},extend:function(c,d,e,f){c._tilesCore=new O.esri.Tiles.TilesCore,c._lastTileUrl="",c._imageType="",c._minZoom=null,c._maxZoom=null,void 0===f||null===f?(c.DB_NAME="offline_tile_store",c.DB_OBJECTSTORE_NAME="tilepath"):(c.DB_NAME=f.dbName,c.DB_OBJECTSTORE_NAME=f.objectStoreName),c._getTileUrl=c.getTileUrl;var g=!0;return"undefined"!=typeof e&&(g=e),c.showBlankTiles=!0,c.offline={online:g,store:new O.esri.Tiles.TilesStore,proxyPath:null},c.offline.store.isSupported()?(c.offline.store.dbName=c.DB_NAME,c.offline.store.objectStoreName=c.DB_OBJECTSTORE_NAME,c.offline.store.init(function(b){b&&(c.resampling=!1,c.getTileUrl=function(b,d,e){var f=this._getTileUrl(b,d,e);if(this.offline.online)return""===c._imageType&&(c._imageType=this.tileInfo.format.toLowerCase()),c._lastTileUrl=f,f;f=f.split("?")[0];var g="void:/"+b+"/"+d+"/"+e,h=null;return c._tilesCore._getTiles(h,this._imageType,f,g,this.offline.store,a,c.showBlankTiles),g},d&&d(!0))}.bind(this)),c.getLevelEstimation=function(a,b,c){var d=new O.esri.Tiles.TilingScheme(this),e=d.getAllCellIdsInExtent(a,b),f={level:b,tileCount:e.length,sizeBytes:e.length*c};return f},c.prepareForOffline=function(a,b,d,e){c._tilesCore._createCellsForOffline(this,a,b,d,function(a){this._doNextTile(0,a,e)}.bind(this))},c.goOffline=function(){this.offline.online=!1},c.goOnline=function(){this.offline.online=!0,this.refresh()},c.isOnline=function(){return this.offline.online},c.deleteAllTiles=function(a){var b=this.offline.store;b.deleteAll(a)},c.getOfflineUsage=function(a){var b=this.offline.store;b.usedSpace(a)},c.getTilePolygons=function(a){c._tilesCore._getTilePolygons(this.offline.store,c.url,this,a)},c.saveToFile=function(a,b){c._tilesCore._saveToFile(a,this.offline.store,b)},c.loadFromFile=function(a,b){c._tilesCore._loadFromFile(a,this.offline.store,b)},c.getMaxZoom=function(a){null==this._maxZoom&&(this._maxZoom=c.tileInfo.lods[c.tileInfo.lods.length-1].level),a(this._maxZoom)},c.getMinZoom=function(a){null==this._minZoom&&(this._minZoom=c.tileInfo.lods[0].level),a(this._minZoom)},c.getMinMaxLOD=function(a,b){var d={},e=c.getMap(),f=e.getLevel()-Math.abs(a),g=e.getLevel()+b;return null!=this._maxZoom&&null!=this._minZoom?(d.max=Math.min(this._maxZoom,g),d.min=Math.max(this._minZoom,f)):(c.getMinZoom(function(a){d.min=Math.max(a,f)}),c.getMaxZoom(function(a){d.max=Math.min(a,g)})),d},c.estimateTileSize=function(a){c._tilesCore._estimateTileSize(b,this._lastTileUrl,this.offline.proxyPath,a)},c.getExtentBuffer=function(a,b){return b.xmin-=a,b.ymin-=a,b.xmax+=a,b.ymax+=a,b},c.getTileUrlsByExtent=function(a,b){var d=new O.esri.Tiles.TilingScheme(c),e=d.getAllCellIdsInExtent(a,b),f=[];return e.forEach(function(a){f.push(c.url+"/"+b+"/"+a[1]+"/"+a[0])}.bind(this)),f},void(c._doNextTile=function(a,b,d){var e=b[a],f=this._getTileUrl(e.level,e.row,e.col);c._tilesCore._storeTile(f,this.offline.proxyPath,this.offline.store,function(c,f){c||(f={cell:e,msg:f});var g=d({countNow:a,countMax:b.length,cell:e,error:f,finishedDownloading:!1});g||a===b.length-1?d({finishedDownloading:!0,cancelRequested:g}):this._doNextTile(a+1,b,d)}.bind(this))})):d(!1,"indexedDB not supported")}})}),"undefined"!=typeof O?O.esri.Tiles={}:(O={},O.esri={Tiles:{}}),O.esri.Tiles.Base64Utils={},O.esri.Tiles.Base64Utils.outputTypes={Base64:0,Hex:1,String:2,Raw:3},O.esri.Tiles.Base64Utils.addWords=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c},O.esri.Tiles.Base64Utils.stringToWord=function(a){for(var b=8,c=(1<<b)-1,d=[],e=0,f=a.length*b;f>e;e+=b)d[e>>5]|=(a.charCodeAt(e/b)&c)<<e%32;return d},O.esri.Tiles.Base64Utils.wordToString=function(a){for(var b=8,c=(1<<b)-1,d=[],e=0,f=32*a.length;f>e;e+=b)d.push(String.fromCharCode(a[e>>5]>>>e%32&c));return d.join("")},O.esri.Tiles.Base64Utils.wordToHex=function(a){for(var b="0123456789abcdef",c=[],d=0,e=4*a.length;e>d;d++)c.push(b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15));return c.join("")},O.esri.Tiles.Base64Utils.wordToBase64=function(a){for(var b="=",c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=[],e=0,f=4*a.length;f>e;e+=3)for(var g=(a[e>>2]>>8*(e%4)&255)<<16|(a[e+1>>2]>>8*((e+1)%4)&255)<<8|a[e+2>>2]>>8*((e+2)%4)&255,h=0;4>h;h++)8*e+6*h>32*a.length?d.push(b):d.push(c.charAt(g>>6*(3-h)&63));return d.join("")},/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
|
||||
2
dist/offline-tiles-basic-src.js
vendored
2
dist/offline-tiles-basic-src.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! esri-offline-maps - v2.15.0 - 2015-09-29
|
||||
/*! esri-offline-maps - v2.16.0 - 2015-10-29
|
||||
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
|
||||
* Apache License*/
|
||||
define([
|
||||
|
||||
2
dist/offline-tpk-min.js
vendored
2
dist/offline-tpk-min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/offline-tpk-src.js
vendored
2
dist/offline-tpk-src.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! esri-offline-maps - v2.15.0 - 2015-09-29
|
||||
/*! esri-offline-maps - v2.16.0 - 2015-10-29
|
||||
* Copyright (c) 2015 Environmental Systems Research Institute, Inc.
|
||||
* Apache License*/
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "esri-offline-maps",
|
||||
"version": "2.15.0",
|
||||
"version": "2.16.0",
|
||||
"description": "Lightweight set of libraries for working offline with map tiles and editing with ArcGIS feature services",
|
||||
"author": "Andy Gup <agup@esri.com> (http://blog.andygup.net)",
|
||||
"license": "Apache 2.0",
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
"appHomePage": "appcache-tiles.html",
|
||||
"optimizedApiURL": "../samples/jsolib",
|
||||
"arcGISBaseURL": "http://js.arcgis.com/3.14",
|
||||
"version": "2.15.0",
|
||||
"version": "2.16.0",
|
||||
"private": true,
|
||||
"description": "manifest generator project",
|
||||
"repository": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user