Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom geoJson description function #3140

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
8fdea8a
Add back the show/hide functionality.
kring Jun 5, 2014
97458bc
Make loadWithXhr work in busted old browsers, sort of.
kring Jun 5, 2014
3ae9ab7
Add getFeatureInfo method to WebMapServiceImageryProvider.
kring Jun 10, 2014
c4f083e
Merge branch 'constructWithDataSources' into nm
kring Jun 10, 2014
cc5b241
Merge branch 'nullGeoJsonFeatureName' into nm
kring Jun 11, 2014
835b091
Merge remote-tracking branch 'origin/master' into nm
kring Jun 11, 2014
34b1181
Merge remote-tracking branch 'origin/ie9' into nm
kring Jun 13, 2014
44daa4b
Merge remote-tracking branch 'origin/kml' into nm
kring Jun 21, 2014
7f8608f
Fix combine task in build.xml.
kring Jun 24, 2014
5094cee
Merge branch 'kml-fix-combine' into nm
kring Jun 24, 2014
f74dc51
Merge remote-tracking branch 'origin/kml' into nm
kring Jun 24, 2014
1d4efaf
Merge branch 'viewerDeletesDataSourceCollection' into nm
kring Jun 26, 2014
c087a51
Add support for authenticated XHR.
kring Jul 3, 2014
fa4a66a
If WMS GetFeatureInfo can't do GeoJSON, return XML.
kring Jul 3, 2014
93b23ce
Fix Cesium bug that caused imagery textures to be applied twice.
kring Jul 7, 2014
b91ff20
Remove WMS.getFeatureInfo.
kring Jul 11, 2014
1c52461
Add the ability to refresh GeoJson descriptions.
kring Jul 13, 2014
f50ed2c
Merge remote-tracking branch 'origin/kml' into nm-merge
kring Jul 22, 2014
6f40527
Merge remote-tracking branch 'origin/master' into nm-merge
kring Jul 22, 2014
c6354fc
Give workers names when calling createTaskProcessorWorker.
kring Jul 28, 2014
8cc408a
Allow worker bootstrapper URL to be specified.
kring Jul 28, 2014
41b79f5
Add Globe.pickTriangle.
kring Jul 29, 2014
99e0a19
Return information about the picked tile, too.
kring Jul 29, 2014
e4ae3bc
Make createGeometry worker work with Browserify.
kring Jul 30, 2014
02bcc23
Revert unneeded changes.
kring Jul 30, 2014
9886314
Don't bomb on browsers lacking XHR.overrideMimeType (like IE10).
kring Jul 30, 2014
4d83eb3
More IE9 compatibility.
kring Jul 31, 2014
0de16c3
Merge branch 'nm2' into nm
kring Jul 31, 2014
5d5c34d
Merge tag '1.0' into nm
kring Aug 4, 2014
b0221d5
Merge remote-tracking branch 'origin/kml' into nm
kring Aug 4, 2014
ea58bd1
Remove changes that we no longer need.
kring Aug 8, 2014
6c92342
Merge branch 'tweaksFromNationalMap' into nm
kring Aug 8, 2014
e9e4910
Merge branch 'kml' into nm
kring Aug 8, 2014
f7251b7
Support both AMD and CommonJS requires in createGeometry.
kring Aug 8, 2014
bdc7700
Merge remote-tracking branch 'origin/kml' into nm
kring Aug 8, 2014
d1d8755
Fix SceneTransforms.wgs84ToWindowCoordinates for SCENE2D.
emackey Aug 6, 2014
b528611
Add unit tests, fix scene.morphTo* to work with unit tests.
emackey Aug 6, 2014
75df067
Use PolylineCollection for time-dynamic polylines
mramato Aug 7, 2014
82ba2ce
Update README.md
mramato Aug 7, 2014
fd0152d
Changes after review
mramato Aug 7, 2014
26b437d
Fix misspelling.
Aug 8, 2014
a52d956
Fix Matrix2 doc example.
mramato Aug 9, 2014
867a21c
Remove ancient remnant of the JSLint eclipse plugin.
shunter Aug 11, 2014
ff02ee9
Fix crash when material source uses Windows line endings.
shunter Aug 11, 2014
e6b6551
Fixes to sample code for Matrix2 and Matrix3 classes.
Aug 11, 2014
aa8e4be
Async picking of rasterized features in imagery layers.
kring Aug 11, 2014
3c2973b
Fix a couple bugs in SceneTransforms.wgs84To*Coordinates that didn't …
bagnell Aug 11, 2014
946f4d1
Show position of selected feature.
kring Aug 11, 2014
eee1e66
Update CHANGES.md
mramato Aug 11, 2014
03bf94a
If feature position is not known, use pick location.
kring Aug 11, 2014
fe8a138
Pick the front of the ellipsoid even below its max radius.
kring Aug 11, 2014
abc56b5
Use > instead of >=.
kring Aug 11, 2014
d69184b
Add support for MapInfo GetFeatureInfo.
kring Aug 11, 2014
50bb52e
Add support for Esri WMS servers.
kring Aug 11, 2014
7bec54e
Add support for unknown GetFeatureInfo responses.
kring Aug 11, 2014
077a1f0
Give user control over GetFeatureInfo format.
kring Aug 12, 2014
4e3f332
Add pickFeatures as an optional function on ImageryProvider.
kring Aug 12, 2014
cb2e047
Simplify layer feature picking and improve doc.
kring Aug 12, 2014
7849b58
pickImageryLayerFeatures specs, and fix typo.
kring Aug 13, 2014
868ad96
Add specs for Globe.pickImageryLayerFeatures.
kring Aug 13, 2014
136f85e
Handle ServiceExceptions by reporting "No Features".
kring Aug 13, 2014
6e8e9f1
Update CHANGES.md.
kring Aug 13, 2014
1a354c9
Fix jshint warning.
kring Aug 13, 2014
88d94e3
Merge remote-tracking branch 'origin/master' into nm
kring Aug 14, 2014
7c5682d
Fix bad merge.
kring Aug 14, 2014
40a1fa5
Merge remote-tracking branch 'origin/wmsImprovements' into nm
kring Aug 14, 2014
681343c
Merge remote-tracking branch 'kgrochow/esri-wkid' into nm
kring Sep 2, 2014
ce372f7
Merge remote-tracking branch 'kgrochow/esri-wkid' into nm
kring Sep 2, 2014
c7e5c89
Merge branch 'forEachLoadedTile' into nm
kring Sep 26, 2014
7a56229
Merge remote-tracking branch 'origin/master' into nm
kring Oct 8, 2014
e9b0bae
Add the ability to change the number of requests per server.
kring Oct 13, 2014
fa34714
Merge FeatureDetection.js from detectFirefox branch.
kring Oct 21, 2014
25f08da
Add Clock.clone.
kring Oct 23, 2014
154e745
Add the ability to specify the clock to Viewer.
kring Oct 24, 2014
f843ec7
Merge remote-tracking branch 'origin/master' into nm
kring Oct 24, 2014
b322645
Pass stride in pickTriangle function, too.
kring Oct 24, 2014
8c95897
Fix bug in processGroundOverlay.
kring Oct 27, 2014
3a56434
Add the ability to specify an SVG's fill-rule.
kring Dec 18, 2014
bfe2503
Don't bomb if picked feature has null geometry.
kring Jan 15, 2015
ee6f8e3
On busted browsers, make sure loadText loads text.
kring Jan 19, 2015
fa2b206
Merge remote-tracking branch 'origin/master' into kml
kring Jan 22, 2015
89ed1df
Merge branch 'kml' into nm
kring Jan 22, 2015
3de8fc6
Merge remote-tracking branch 'origin/correctMouseCoordinates' into nm
kring Jan 22, 2015
0dccdf9
Don't cancel document-level mousemove events.
kring Jan 22, 2015
b5f3956
Merge remote-tracking branch 'origin/correctMouseCoordinates' into nm
kring Jan 23, 2015
49167e2
Make loadXML work in IE10.
kring Jan 27, 2015
ff706f3
Merge remote-tracking branch 'origin/master' into nm
kring Jan 29, 2015
9a13cc6
Merge remote-tracking branch 'origin/headingDownUnder' into nm
kring Jan 29, 2015
cfc32a7
Workaround issue in Firefox 35
mramato Jan 28, 2015
0c3c226
Add FeatureDetection.isWindows
mramato Jan 29, 2015
3fad138
Reverts changes from #2408 and #2417. Adds an option to ScreenSpaceEv…
bagnell Jan 29, 2015
5f98c2c
Update CHANGES.md.
bagnell Jan 29, 2015
e1361e0
Revert remaining changes.
bagnell Jan 29, 2015
1ff54cb
Merge remote-tracking branch 'origin/master' into nm
kring Jan 29, 2015
b063f8d
Merge remote-tracking branch 'origin/headingDownUnder' into nm
kring Feb 2, 2015
1052475
Handle XML parsing errors on old browsers.
kring Feb 2, 2015
d6095c2
Fix jshint warning.
kring Feb 2, 2015
75dbcfa
Pass through HTTP status info on tile request failures.
kring Feb 5, 2015
aed4427
Fix an imagery loading bug.
kring Feb 10, 2015
7419287
Merge remote-tracking branch 'origin/master' into nm
kring Feb 12, 2015
c7677a4
Merge remote-tracking branch 'origin/kml' into nm
kring Feb 24, 2015
a8a5205
Add ability to specify content type to WMS GetFeatureInfo.
kring Feb 26, 2015
6fac93a
Handle GML GetFeatureInfo responses.
kring Feb 26, 2015
8f0f567
Always use user-specified XML content type, not just sometimes.
kring Feb 26, 2015
7d72cd1
Remove duplicate pickFeatures function
kring Feb 26, 2015
f8293f4
Fix erroneous counting of tiles waiting for children.
kring Mar 2, 2015
2cadccf
Add ability to specific limited layers in a MapServer.
kring Mar 13, 2015
8fb9b49
Add ArcGIS MapServer picking support.
kring Mar 13, 2015
99786f0
Improve flexibility of MapServer provider.
kring Mar 13, 2015
8edf6de
Allow specify tile width/height to ArcGisMapServerImageryProvider.
kring Mar 18, 2015
bef4724
Include properties on ImageryLayerFeatureInfo.
kring Mar 19, 2015
d3ce97e
Handle web mercator points.
kring Mar 31, 2015
cc5ec1e
Merge tag '1.8' into nm
kring Apr 2, 2015
7337cd2
Remove redundant doc.
kring Apr 2, 2015
b040a3f
Remove unnecessary modifications.
kring Apr 2, 2015
da5ee9b
Add browserify deamdify transform.
kring Apr 9, 2015
6132dcf
Add ability to set maxLevel for ArcGisMapServerImageryProvider.
kring Apr 14, 2015
1218a66
Improve doc of maximumLevel property.
kring Apr 15, 2015
a765cb0
Remove Browserify transform from package.json.
kring Apr 15, 2015
a8444ed
Copy .gitignore to .npmignore and modify it.
kring Apr 16, 2015
041f715
Only pick features from the intended layers.
kring Apr 16, 2015
86375d9
Support KML documents using explicit namespacing.
kring Apr 17, 2015
b06bb40
Make Cesium into an npm module.
kring Apr 24, 2015
4d2d363
Bump to v0.0.4.
kring Apr 24, 2015
6a14160
Don't generateMipMaps if texture is NPOT.
kring Apr 24, 2015
f08c5d4
Bump version to 0.0.5.
kring Apr 24, 2015
0891ca5
Merge remote-tracking branch 'upstream/master' into cesiumUpgrade
kring Apr 27, 2015
0552de1
prepare-cesium in postinstall, if necessary.
kring Apr 28, 2015
4c8a5e0
Merge remote-tracking branch 'upstream/master' into cesiumUpgrade
kring Apr 28, 2015
4d1a4ab
Merge pull request #1 from TerriaJS/cesiumUpgrade
kring Apr 28, 2015
81f6c87
Bump to v1.8.1.
kring Apr 28, 2015
af553a9
Match Cesium's version number, plus some metadata.
kring Apr 28, 2015
0481757
Remove build metadata from version.
kring Apr 28, 2015
decc316
Minor improvements.
kring Apr 29, 2015
e8d6645
Make WMS 1.3.0 GetCapabilities work in busted IE9.
kring Apr 29, 2015
0e990d3
Prefix terriajs-cesium version numbers.
kring Apr 29, 2015
c77ad23
Bump version.
kring Apr 29, 2015
824ba8f
Merge remote-tracking branch 'upstream/nm' into terriajs
kring Apr 29, 2015
ce42b41
Bump version.
kring Apr 29, 2015
c1be1fe
Make npm scripts work on Windows.
kring Apr 29, 2015
a4986bb
Bump version.
kring Apr 29, 2015
7d4db64
Imagery picking improvements.
kring May 11, 2015
a3b8a03
Bump version.
kring May 11, 2015
88107db
Correctly handle getFeatureInfoFormats parameter.
kring May 11, 2015
e90cbd4
Improve handling of HTML GetFeatureInfo responses.
kring May 12, 2015
9d25a7d
Bump version.
kring May 12, 2015
fc6e0f0
Fix deprectation message.
kring May 13, 2015
bccc06b
Remove unnecessary code changes.
kring May 14, 2015
3bf997d
Bump version number.
kring May 15, 2015
0b38ed2
Don't fail completely in IE8.
kring May 28, 2015
bceb4b5
Bump version.
kring May 28, 2015
95c8136
Better algorithm for choosing rectangle center.
kring May 28, 2015
b852f2e
Bump version.
kring May 28, 2015
a49000a
Merge tag '1.10' of github.com:AnalyticalGraphicsInc/cesium into terr…
kring Jun 2, 2015
a950a46
Revert unnecessary changes.
kring Jun 2, 2015
3570407
Merge branch 'viewRectangle' into terriajs
kring Jun 3, 2015
f461dbe
Bump version number.
kring Jun 3, 2015
54b1a1b
Merge branch 'viewRectangle' into terriajs
kring Jun 3, 2015
a43f1d1
relaxed namespaceUri matching for wms servers
Jun 4, 2015
1164e00
Add timeout option to loadWithXhr.
kring Jun 4, 2015
b723765
remove namespace check for featureinfo
Jun 4, 2015
abb268b
Merge branch 'terriajs' of https://github.com/TerriaJS/cesium into te…
Jun 4, 2015
0dd7a63
Bump version.
kring Jun 4, 2015
6cf2291
Fix IE9 breakage.
kring Jun 5, 2015
86aa691
Add support for WMTS GetFeatureInfo.
kring Jun 9, 2015
8469b53
Bump version.
kring Jun 9, 2015
cb9a9b6
ArcGisMapServerImageryProvider improvements.
kring Jun 10, 2015
397b8cf
Bump version.
kring Jun 10, 2015
97107d6
Fix crash in Scene.destroy on IE11.
kring Jun 10, 2015
353e380
Bump version.
kring Jun 10, 2015
0bc1d9e
Don't crash at module load time in IE8.
kring Jun 23, 2015
c940452
Bump version.
kring Jun 23, 2015
3cf2c60
Take two at fixing IE8.
kring Jun 23, 2015
0c8a232
Bump version.
kring Jun 23, 2015
c695086
Merge tag '1.11' into terriajs
kring Jul 8, 2015
43e42b0
Support an array of subdomains to prepend to tiles, for performance.
stevage Jul 14, 2015
10cec10
Merge pull request #2 from TerriaJS/osm-subdomains
kring Jul 14, 2015
d0ceeb3
Bump version.
kring Jul 15, 2015
50f28cc
Sync with official Cesium 1.13.
kring Sep 21, 2015
e73b415
Upgrade to Cesium 1.14.
kring Oct 13, 2015
4789bce
image layer to feature
chloeleichen Oct 12, 2015
69f184b
fix test
chloeleichen Oct 12, 2015
c9753eb
add image layer
chloeleichen Oct 12, 2015
89908a5
Bump version.
kring Oct 14, 2015
61d653b
allow custom description of geojson properties
RacingTadpole Oct 28, 2015
3c4072f
use load options to specify geoJson describe function
RacingTadpole Oct 28, 2015
ab4ef37
improve jsdoc desc
RacingTadpole Oct 28, 2015
fd85cfc
add spec for geojson custom description
RacingTadpole Oct 28, 2015
c16b4af
add to contributors, changes
RacingTadpole Oct 28, 2015
04007eb
fix jshint
RacingTadpole Oct 28, 2015
8561ac6
Merge tag '1.15' into cesiumUpgrade-1.15
kring Nov 2, 2015
e1315aa
Fix merge conflicts.
kring Nov 2, 2015
d0856b4
Remove commented-out code.
kring Nov 2, 2015
f818342
Merge pull request #3 from TerriaJS/cesiumUpgrade-1.15
kring Nov 2, 2015
fdc47c3
use describeProperty instead of describe
RacingTadpole Nov 4, 2015
a1e9e58
update changes
RacingTadpole Nov 4, 2015
5be758a
use describe again
RacingTadpole Nov 4, 2015
a9ee5e0
improve jsdoc, add test
RacingTadpole Nov 4, 2015
b04e2f2
fix jsdoc so that properties is an Object
RacingTadpole Nov 4, 2015
056314c
remove old change desc
RacingTadpole Nov 4, 2015
804bedf
Merge pull request #5 from TerriaJS/upstream_geojson_description
kring Nov 5, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/wwwroot
/.metadata
/Build
/Instrumented
Expand Down
22 changes: 22 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/.metadata
/Apps
/Build
/Documentation
/Instrumented
/Specs
/Tools
/launches
/Cesium-*.zip
.DS_Store
Thumbs.db

/Apps/CesiumViewer/Gallery/gallery-index.js

/Apps/Sandcastle/jsHintOptions.js
/Apps/Sandcastle/gallery/gallery-index.js

/Source/Cesium.js

/Specs/SpecList.js

/node_modules
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
==========

### 1.16 - 2015-12-01

* `GeoJsonDataSource.load` now takes an optional `describeProperty` function for generating feature description properties. [#3140](https://github.com/AnalyticalGraphicsInc/cesium/pull/3140)

### 1.15 - 2015-11-02

* Breaking changes
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Kevin Ring](https://github.com/kring)
* [Keith Grochow](https://github.com/kgrochow)
* [Chloe Chen](https://github.com/chloeleichen)
* [Arthur Street](https://github.com/RacingTadpole)
* [EU Edge](http://euedge.com/)
* [Ákos Maróy](https://github.com/akosmaroy)
* [Raytheon Intelligence and Information Systems](http://www.raytheon.com/)
Expand Down
26 changes: 26 additions & 0 deletions Source/Core/Clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,31 @@ define([
return currentTime;
};

/**
* Makes a copy of this instance.
* @param {Clock} [result] The instance to which to copy this object. If this is undefined, a new {@link Clock} is created.
* @return {Clock} The {@link Clock} to which this instance was copied.
*/
Clock.clone = function(clock, result) {
if (!defined(clock)) {
return undefined;
}

if (!defined(result)) {
result = new Clock();
}

result.startTime = clock.startTime;
result.stopTime = clock.stopTime;
result.currentTime = clock.currentTime;
result.multiplier = clock.multiplier;
result.clockStep = clock.clockStep;
result.clockRange = clock.clockRange;
result.canAnimate = clock.canAnimate;
result.shouldAnimate = clock.shouldAnimate;

return result;
};

return Clock;
});
3 changes: 2 additions & 1 deletion Source/Core/loadText.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ define([
var loadText = function(url, headers) {
return loadWithXhr({
url : url,
headers : headers
headers : headers,
preferText : true
});
};

Expand Down
67 changes: 57 additions & 10 deletions Source/Core/loadWithXhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ define([
* @param {String} [options.data] The data to send with the request, if any.
* @param {Object} [options.headers] HTTP headers to send with the request, if any.
* @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server.
* @param {Number} [options.timeout] The timeout of the request, in milliseconds. If the request does not complete
* within this timeout, it is aborted and the promise is rejected with a RequestErrorEvent with the
* isTimeout property set to true. If this property is undefined, no client-side timeout applies.
*
* @returns {Promise.<Object>} a promise that will resolve to the requested data when loaded.
*
* @see loadArrayBuffer
Expand Down Expand Up @@ -64,11 +68,13 @@ define([
var data = options.data;
var headers = options.headers;
var overrideMimeType = options.overrideMimeType;
var preferText = options.preferText;
var timeout = options.timeout;

return when(options.url, function(url) {
var deferred = when.defer();

loadWithXhr.load(url, responseType, method, data, headers, deferred, overrideMimeType);
loadWithXhr.load(url, responseType, method, data, headers, deferred, overrideMimeType, preferText, timeout);

return deferred.promise;
});
Expand Down Expand Up @@ -122,7 +128,7 @@ define([
}

// This is broken out into a separate function so that it can be mocked for testing purposes.
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType, preferText, timeout) {
var dataUriRegexResult = dataUriRegex.exec(url);
if (dataUriRegexResult !== null) {
deferred.resolve(decodeDataUri(dataUriRegexResult, responseType));
Expand All @@ -131,8 +137,19 @@ define([

var xhr = new XMLHttpRequest();

if (defined(overrideMimeType) && defined(xhr.overrideMimeType)) {
xhr.overrideMimeType(overrideMimeType);
var weWantXml = false;

if (defined(overrideMimeType)) {
if (defined(xhr.overrideMimeType)) {
xhr.overrideMimeType(overrideMimeType);
} else if (overrideMimeType === 'text/xml' && responseType === 'document') {
// This is an old browser without support for overrideMimeType, and we're asking for XML.
// Many XML documents are returned without the 'text/xml' MIME type, such as OGC servers,
// so our request will fail if we set the responseType without having a way to override the MIME
// type. So request text instead and then parse out the XML from the text.
weWantXml = true;
responseType = 'text';
}
}

xhr.open(method, url, true);
Expand All @@ -149,18 +166,42 @@ define([
xhr.responseType = responseType;
}

if (defined(timeout)) {
xhr.timeout = timeout;
}

xhr.onload = function() {
if (xhr.status === 200) {
var parser;

if (defined(xhr.response)) {
deferred.resolve(xhr.response);
if (weWantXml) {
try {
parser = new DOMParser();
deferred.resolve(parser.parseFromString(xhr.response, 'text/xml'));
} catch (ex) {
deferred.reject(ex);
}
} else {
deferred.resolve(xhr.response);
}
} else {
// busted old browsers.
if (defined(xhr.responseXML) && xhr.responseXML.hasChildNodes()) {
deferred.resolve(xhr.responseXML);
} else if (defined(xhr.responseText)) {
deferred.resolve(xhr.responseText);
if (weWantXml) {
try {
parser = new DOMParser();
deferred.resolve(parser.parseFromString(xhr.responseText, 'text/xml'));
} catch (ex) {
deferred.reject(ex);
}
} else {
deferred.reject(new RuntimeError('unknown XMLHttpRequest response type.'));
if (!defaultValue(preferText, false) && defined(xhr.responseXML) && xhr.responseXML.hasChildNodes()) {
deferred.resolve(xhr.responseXML);
} else if (defined(xhr.responseText)) {
deferred.resolve(xhr.responseText);
} else {
deferred.reject(new RuntimeError('unknown XMLHttpRequest response type.'));
}
}
}
} else {
Expand All @@ -172,6 +213,12 @@ define([
deferred.reject(new RequestErrorEvent());
};

xhr.ontimeout = function(e) {
var timeout = new RequestErrorEvent();
timeout.isTimeout = true;
deferred.reject(timeout);
};

xhr.send(data);
};

Expand Down
2 changes: 2 additions & 0 deletions Source/Core/throttleRequestByServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ define([
});
};

throttleRequestByServer.maximumRequestsPerServer = 6;

/**
* Specifies the maximum number of requests that can be simultaneously open to a single server. If this value is higher than
* the number of requests per server actually allowed by the web browser, Cesium's ability to prioritize requests will be adversely
Expand Down
32 changes: 23 additions & 9 deletions Source/DataSources/GeoJsonDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ define([

var stringifyScratch = new Array(4);

function describe(properties, nameProperty) {
function defaultDescribe(properties, nameProperty) {
var html = '';
for ( var key in properties) {
if (properties.hasOwnProperty(key)) {
Expand All @@ -99,7 +99,7 @@ define([
var value = properties[key];
if (definedNotNull(value)) {
if (typeof value === 'object') {
html += '<tr><th>' + key + '</th><td>' + describe(value) + '</td></tr>';
html += '<tr><th>' + key + '</th><td>' + defaultDescribe(value) + '</td></tr>';
} else {
html += '<tr><th>' + key + '</th><td>' + value + '</td></tr>';
}
Expand All @@ -114,7 +114,7 @@ define([
return html;
}

function createDescriptionCallback(properties, nameProperty) {
function createDescriptionCallback(describe, properties, nameProperty) {
var description;
return function(time, result) {
if (!defined(description)) {
Expand All @@ -124,10 +124,14 @@ define([
};
}

function defaultDescribeProperty(properties, nameProperty) {
return new CallbackProperty(createDescriptionCallback(defaultDescribe, properties, nameProperty), true);
}

//GeoJSON specifies only the Feature object has a usable id property
//But since "multi" geometries create multiple entity,
//we can't use it for them either.
function createObject(geoJson, entityCollection) {
function createObject(geoJson, entityCollection, describe) {
var id = geoJson.id;
if (!definedNotNull(id) || geoJson.type !== 'Feature') {
id = createGuid();
Expand Down Expand Up @@ -189,7 +193,7 @@ define([

var description = properties.description;
if (!defined(description)) {
entity.description = new CallbackProperty(createDescriptionCallback(properties, nameProperty), true);
entity.description = describe(properties, nameProperty);
} else if (description !== null) {
entity.description = new ConstantProperty(description);
}
Expand All @@ -213,7 +217,7 @@ define([

if (feature.geometry === null) {
//Null geometry is allowed, so just create an empty entity instance for it.
createObject(feature, dataSource._entityCollection);
createObject(feature, dataSource._entityCollection, options.describe);
} else {
var geometryType = feature.geometry.type;
var geometryHandler = geometryTypes[geometryType];
Expand Down Expand Up @@ -284,7 +288,7 @@ define([
billboard.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
billboard.image = new ConstantProperty(dataUrl);

var entity = createObject(geoJson, dataSource._entityCollection);
var entity = createObject(geoJson, dataSource._entityCollection, options.describe);
entity.billboard = billboard;
entity.position = new ConstantPositionProperty(crsFunction(coordinates));
}));
Expand Down Expand Up @@ -334,7 +338,7 @@ define([
polyline.width = widthProperty;
polyline.positions = new ConstantProperty(coordinatesArrayToCartesianArray(coordinates, crsFunction));

var entity = createObject(geoJson, dataSource._entityCollection);
var entity = createObject(geoJson, dataSource._entityCollection, options.describe);
entity.polyline = polyline;
}

Expand Down Expand Up @@ -417,7 +421,7 @@ define([
polygon.perPositionHeight = new ConstantProperty(true);
}

var entity = createObject(geoJson, dataSource._entityCollection);
var entity = createObject(geoJson, dataSource._entityCollection, options.describe);
entity.polygon = polygon;
}

Expand Down Expand Up @@ -732,6 +736,8 @@ define([
* @param {String|Object} data A url, GeoJSON object, or TopoJSON object to be loaded.
* @param {Object} [options] An object with the following properties:
* @param {String} [options.sourceUri] Overrides the url to use for resolving relative links.
* @param {GeoJsonDataSource~describe} [options.describe=GeoJsonDataSource.defaultDescribeProperty] A function which returns a Property object (or just a string),
* which converts the properties into an html description.
* @param {Number} [options.markerSize=GeoJsonDataSource.markerSize] The default size of the map pin created for each point, in pixels.
* @param {String} [options.markerSymbol=GeoJsonDataSource.markerSymbol] The default symbol of the map pin created for each point.
* @param {Color} [options.markerColor=GeoJsonDataSource.markerColor] The default color of the map pin created for each point.
Expand Down Expand Up @@ -761,6 +767,7 @@ define([
}

options = {
describe: defaultValue(options.describe, defaultDescribeProperty),
markerSize : defaultValue(options.markerSize, defaultMarkerSize),
markerSymbol : defaultValue(options.markerSymbol, defaultMarkerSymbol),
markerColor : defaultValue(options.markerColor, defaultMarkerColor),
Expand Down Expand Up @@ -846,5 +853,12 @@ define([
});
}

/**
* This callback is displayed as part of the GeoJsonDataSource class.
* @callback GeoJsonDataSource~describe
* @param {Object} properties The properties of the feature.
* @param {String} nameProperty The property key that Cesium estimates to have the name of the feature.
*/

return GeoJsonDataSource;
});
13 changes: 10 additions & 3 deletions Source/Scene/ArcGisMapServerImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ define([
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Ellipsoid',
'../Core/Event',
'../Core/GeographicProjection',
'../Core/GeographicTilingScheme',
Expand All @@ -31,6 +32,7 @@ define([
defined,
defineProperties,
DeveloperError,
Ellipsoid,
Event,
GeographicProjection,
GeographicTilingScheme,
Expand Down Expand Up @@ -90,6 +92,8 @@ define([
* @param {Number} [options.tileHeight=256] The height of each tile in pixels. This parameter is ignored when accessing a tiled server.
* @param {Number} [options.maximumLevel] The maximum tile level to request, or undefined if there is no maximum. This parameter is ignored when accessing
* a tiled server.
* @param {Object} [options.mapServerData] This MapServer's metadata. This can be supplied to prevent the imagery provider from making an extraneous
* request when the application already has the metadata.
*
* @see BingMapsImageryProvider
* @see GoogleEarthImageryProvider
Expand Down Expand Up @@ -166,8 +170,9 @@ define([
data.fullExtent.spatialReference.wkid === 102113) {

var projection = new WebMercatorProjection();
var sw = projection.unproject(new Cartesian2(data.fullExtent.xmin, data.fullExtent.ymin));
var ne = projection.unproject(new Cartesian2(data.fullExtent.xmax, data.fullExtent.ymax));
var extent = data.fullExtent;
var sw = projection.unproject(new Cartesian3(Math.max(extent.xmin, -Ellipsoid.WGS84.maximumRadius * Math.PI), Math.max(extent.ymin, -Ellipsoid.WGS84.maximumRadius * Math.PI), 0.0));
var ne = projection.unproject(new Cartesian3(Math.min(extent.xmax, Ellipsoid.WGS84.maximumRadius * Math.PI), Math.min(extent.ymax, Ellipsoid.WGS84.maximumRadius * Math.PI), 0.0));
that._rectangle = new Rectangle(sw.longitude, sw.latitude, ne.longitude, ne.latitude);
} else if (data.fullExtent.spatialReference.wkid === 4326) {
that._rectangle = Rectangle.fromDegrees(data.fullExtent.xmin, data.fullExtent.ymin, data.fullExtent.xmax, data.fullExtent.ymax);
Expand Down Expand Up @@ -222,7 +227,9 @@ define([
when(metadata, metadataSuccess, metadataFailure);
}

if (this._useTiles) {
if (defined(options.mapServerData)) {
metadataSuccess(options.mapServerData);
} else if (this._useTiles) {
requestMetadata();
} else {
this._ready = true;
Expand Down
Loading