Skip to content

Commit

Permalink
Rather than have Cartesian2.fromCartesian3 and Cartesian2.fromCartesi…
Browse files Browse the repository at this point in the history
…an4 call through to clone, just make them all the same exact function. Also needed to add a JSDoc tag to have them show up properly in the doc.

Finally, added a new external launch tool to build only documentation, since Release does a lot more now and takes twice as long.
  • Loading branch information
mramato committed Jul 12, 2012
1 parent b7b76a3 commit 899f513
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 24 deletions.
46 changes: 22 additions & 24 deletions Source/Core/Cartesian2.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,56 +32,54 @@ define([
};

/**
* Creates a Cartesian2 instance from an existing Cartesian3.
* Duplicates a Cartesian2 instance.
* @memberof Cartesian2
*
* @param {Cartesian3} cartesian The Cartesian3 instance to create a Cartesian2 instance from.
* @param {Cartesian2} cartesian The Cartesian to duplicate.
* @param {Cartesian2} [result] The object onto which to store the result.
* @return {Cartesian2} The modified result parameter or a new Cartesian2 instance if none was provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.fromCartesian3 = function(cartesian, result) {
return Cartesian2.clone(cartesian, result);
Cartesian2.clone = function(cartesian, result) {
if (typeof cartesian === 'undefined') {
throw new DeveloperError('cartesian is required');
}

if (typeof result === 'undefined') {
result = new Cartesian2();
}

result.x = cartesian.x;
result.y = cartesian.y;
return result;
};

/**
* Creates a Cartesian2 instance from an existing Cartesian4.
* Creates a Cartesian2 instance from an existing Cartesian3.
* @memberof Cartesian2
* @function
*
* @param {Cartesian4} cartesian The Cartesian4 instance to create a Cartesian2 instance from.
* @param {Cartesian3} cartesian The Cartesian3 instance to create a Cartesian2 instance from.
* @param {Cartesian2} [result] The object onto which to store the result.
* @return {Cartesian2} The modified result parameter or a new Cartesian2 instance if none was provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.fromCartesian4 = function(cartesian, result) {
return Cartesian2.clone(cartesian, result);
};
Cartesian2.fromCartesian3 = Cartesian2.clone;

/**
* Duplicates a Cartesian2 instance.
* Creates a Cartesian2 instance from an existing Cartesian4.
* @memberof Cartesian2
* @function
*
* @param {Cartesian2} cartesian The Cartesian to duplicate.
* @param {Cartesian4} cartesian The Cartesian4 instance to create a Cartesian2 instance from.
* @param {Cartesian2} [result] The object onto which to store the result.
* @return {Cartesian2} The modified result parameter or a new Cartesian2 instance if none was provided.
*
* @exception {DeveloperError} cartesian is required.
*/
Cartesian2.clone = function(cartesian, result) {
if (typeof cartesian === 'undefined') {
throw new DeveloperError('cartesian is required');
}

if (typeof result === 'undefined') {
result = new Cartesian2();
}

result.x = cartesian.x;
result.y = cartesian.y;
return result;
};
Cartesian2.fromCartesian4 = Cartesian2.clone;

/**
* Computes the provided Cartesian's squared magnitude.
Expand Down
19 changes: 19 additions & 0 deletions launches/documentation.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Cesium/build.xml"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Cesium"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_ANT_TARGETS" value="generateDocumentation,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Cesium/build.xml}"/>
<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
</launchConfiguration>

0 comments on commit 899f513

Please sign in to comment.