-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
GeoJSON support #890
Merged
GeoJSON support #890
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
885a6ec
Start messing around with GeoJSON support.
mramato d709321
Merge branch 'master' into geojson
mramato 5ef9066
Add drag and drop for .geojson files.
mramato a08508a
Merge branch 'master' into geojson
mramato 5bcd722
Apply default styles to all GeoJSON features.
mramato e11f9ec
Ongoing GeoJSON prototyping.
mramato ff0d14d
Merge branch 'master' into geojson
mramato 7c4dc49
Start of some specs, still a ton of work to do.
mramato bc36784
Ongoing GeoJSON work.
mramato db085c9
Merge branch 'master' into geojson
mramato 485985e
Ongoing GeoJSON work.
mramato 83fdd2f
Fix failing tests.
mramato b611ffd
Temporarily remove StaticProperty/StaticPosition property.
mramato ae572be
More cleanup before pull request.
mramato a0eb4e8
Doc cleanup.
mramato ddfacdc
Merge branch 'master' into geojson
mramato 08f5258
Update CHANGES
mramato 3e3188b
Merge branch 'master' into geojson
mramato 7eca3c8
Merge branch 'master' into geojson
mramato 67112b6
Changes after review.
mramato 14e48f1
More changes.
mramato 4b418a6
Minor tweak to ConstantProperty.
mramato 4d7d09f
Change from DeveloperError to RuntimeError for actual GeoJSON process…
mramato 54ae0ea
Cleanup promise usage.
mramato bb14a2b
Tweak to DynamicObject.merge.
mramato 5010369
Standardize casing.
mramato 490a8f2
More changes after review.
mramato File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*global define*/ | ||
define(function() { | ||
"use strict"; | ||
|
||
/** | ||
* Represents a single value which does not change with regard to simulation time. | ||
* | ||
* @alias ConstantProperty | ||
* @constructor | ||
* | ||
* @see DynamicProperty | ||
*/ | ||
var ConstantProperty = function(value) { | ||
this._value = value; | ||
}; | ||
|
||
/** | ||
* Returns the value of the property. | ||
* @memberof ConstantProperty | ||
* | ||
* @param {JulianDate} time The time for which to retrieve the value. This value is not used. | ||
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned. | ||
* @returns The modified result parameter or a new instance if the result parameter was not supplied. | ||
*/ | ||
ConstantProperty.prototype.getValue = function(time, result) { | ||
var value = this._value; | ||
if (typeof value !== 'undefined' && typeof value.clone === 'function') { | ||
return value.clone(result); | ||
} | ||
return value; | ||
}; | ||
|
||
return ConstantProperty; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,6 +192,25 @@ define([ | |
return availabilityValue; | ||
}; | ||
|
||
/** | ||
* Merge all of the properties of the supplied object onto this object. | ||
* Properties which are already defined are not overwritten. | ||
* @param other {DynamicObject} The object to merge. | ||
* @private | ||
*/ | ||
DynamicObject.prototype.merge = function(other) { | ||
if (typeof other === 'undefined') { | ||
throw new DeveloperError('other is required'); | ||
} | ||
for ( var property in other) { | ||
if (other.hasOwnProperty(property)) { | ||
if (this.hasOwnProperty(property) && (typeof this[property] === 'undefined')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably. I simplified it to:
|
||
this[property] = other[property]; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
/** | ||
* Processes a single CZML packet and merges its data into the provided DynamicObject's position | ||
* property. This method is not normally called directly, but is part of the array of CZML processing | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work even if
suffix
is longer thanstr
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The value of the second argument can be positive or negative and if suffix is longer it's impossible for this function to equal anything other than -1. However, your question brings up a good point, I don't need
str.length - suffix.length
because simply-suffix.length
will work exactly the same.