-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into query-bool
- Loading branch information
Showing
41 changed files
with
803 additions
and
203 deletions.
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,31 @@ | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const expect = require('expect'); | ||
const { | ||
toggle3d, | ||
updateLast2dMapType, | ||
TOGGLE_3D, | ||
UPDATE_LAST_2D_MAPTYPE | ||
} = require('../globeswitcher'); | ||
|
||
describe('Test correctness of the maptype actions', () => { | ||
|
||
it('toggle3d', () => { | ||
const retVal = toggle3d(true); | ||
expect(retVal).toExist(); | ||
expect(retVal.type).toBe(TOGGLE_3D); | ||
expect(retVal.enable).toBe(true); | ||
}); | ||
it('updateLast2dMapType', () => { | ||
const retVal = updateLast2dMapType("leaflet"); | ||
expect(retVal).toExist(); | ||
expect(retVal.type).toBe(UPDATE_LAST_2D_MAPTYPE); | ||
expect(retVal.mapType).toBe('leaflet'); | ||
}); | ||
}); |
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,23 @@ | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const expect = require('expect'); | ||
const { | ||
MAP_TYPE_CHANGED, | ||
changeMapType | ||
} = require('../maptype'); | ||
|
||
describe('Test correctness of the maptype actions', () => { | ||
|
||
it('changeMapType', () => { | ||
const retVal = changeMapType('maptype'); | ||
expect(retVal).toExist(); | ||
expect(retVal.type).toBe(MAP_TYPE_CHANGED); | ||
expect(retVal.mapType).toBe('maptype'); | ||
}); | ||
}); |
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,58 @@ | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
|
||
const TOGGLE_3D = "TOGGLE_3D"; | ||
const UPDATE_LAST_2D_MAPTYPE = "UPDATE_LAST_2D_MAPTYPE"; | ||
/** | ||
* Emitted when 3d map have to be toggled | ||
* @memberof actions.globeswitcher | ||
* @param {boolean} enable true for enable, false for disable | ||
* @return {action} the action of type `TOGGLE_FULLSCREEN` with enable flag and element selector. | ||
* ``` | ||
* { | ||
* type: TOGGLE_3D, | ||
* enable | ||
* } | ||
* ``` | ||
*/ | ||
function toggle3d(enable, originalMapType) { | ||
return { | ||
type: TOGGLE_3D, | ||
enable, | ||
originalMapType | ||
}; | ||
} | ||
/** | ||
* Saves the last 2d map | ||
* @memberof actions.globeswitcher | ||
* @param {string} mapType last maptype | ||
* @return {object} action | ||
* ``` | ||
* { | ||
* type: MAPTYPE_2D_SELECTED, | ||
* mapType | ||
* } | ||
* ``` | ||
*/ | ||
function updateLast2dMapType(mapType) { | ||
return { | ||
type: UPDATE_LAST_2D_MAPTYPE, | ||
mapType | ||
}; | ||
} | ||
/** | ||
* Actions for Globe Switcher Plugin. | ||
* @name actions.globeswitcher | ||
*/ | ||
module.exports = { | ||
toggle3d, | ||
updateLast2dMapType, | ||
UPDATE_LAST_2D_MAPTYPE, | ||
TOGGLE_3D | ||
}; |
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
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,89 @@ | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const React = require('react'); | ||
|
||
const ToggleButton = require('./ToggleButton'); | ||
const {Tooltip} = require('react-bootstrap'); | ||
const Message = require('../I18N/Message'); | ||
/** | ||
* Toggle button for 3d. Wraps {@link #components.buttons.ToggleButton} with some defaults | ||
* @memberof components.buttons | ||
* @class | ||
* @prop {string} [id] an id for the html component | ||
* @prop {object} [btnConfig] the configuration to pass to the bootstrap button | ||
* @prop {object} [options] the options to send when toggle is clicked | ||
* @prop {string|element} [text] the text to disaplay | ||
* @prop {string|element} [help] the help text | ||
* @prop {string} glyphicon the icon name | ||
* @prop {bool} active the status of the button | ||
* @prop {function} onClick. The method to call when clicked. the method will return as parameter the toggled `pressed` prop and the `options` object | ||
* @prop {node} [activeTooltip] the tooltip to use on mouse hover | ||
* @prop {node} [notActiveTooltip] the tooltip to use on mouse hover when the button is active | ||
* @prop {string} [tooltipPlace] positon of the tooltip, one of: 'top', 'right', 'bottom', 'left' | ||
* @prop {object} css style object for the component | ||
* @prop {btnType} [btnType] one of 'normal', 'image' | ||
* @prop {string} image if type is 'image', the src of the image | ||
* @prop {string} pressedStyle the bootstrap style for pressedStyle | ||
* @prop {string} defaultStyle the bootstrap style when not pressed | ||
* | ||
*/ | ||
const GlobeViewSwitcherButton = React.createClass({ | ||
propTypes: { | ||
id: React.PropTypes.string, | ||
btnConfig: React.PropTypes.object, | ||
options: React.PropTypes.object, | ||
text: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]), | ||
help: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]), | ||
glyphicon: React.PropTypes.string, | ||
active: React.PropTypes.bool, | ||
onClick: React.PropTypes.func, | ||
activeTooltip: React.PropTypes.string, | ||
notActiveTooltip: React.PropTypes.string, | ||
tooltipPlace: React.PropTypes.string, | ||
style: React.PropTypes.object, | ||
btnType: React.PropTypes.oneOf(['normal', 'image']), | ||
image: React.PropTypes.string, | ||
pressedStyle: React.PropTypes.string, | ||
defaultStyle: React.PropTypes.string | ||
}, | ||
getDefaultProps() { | ||
return { | ||
id: 'globeviewswitcher-btn', | ||
activeTooltip: 'globeswitcher.tooltipDeactivate', | ||
notActiveTooltip: 'globeswitcher.tooltipActivate', | ||
tooltipPlace: 'left', | ||
defaultStyle: 'primary', | ||
pressedStyle: 'success', | ||
glyphicon: 'globe', | ||
btnConfig: { | ||
className: "square-button" | ||
} | ||
}; | ||
}, | ||
getButtonProperties() { | ||
return ['id', | ||
'btnConfig', | ||
'options', | ||
'text', | ||
'glyphicon', | ||
'onClick', | ||
'tooltipPlace', | ||
'style', | ||
'btnType', | ||
'image', | ||
'pressedStyle', | ||
'defaultStyle' | ||
].reduce((result, key) => { result[key] = this.props[key]; return result; }, {}); | ||
}, | ||
render() { | ||
return <ToggleButton {...this.getButtonProperties()} pressed={this.props.active} tooltip={<Tooltip><Message msgId={this.props.active ? this.props.activeTooltip : this.props.notActiveTooltip}/></Tooltip>} />; | ||
} | ||
}); | ||
|
||
module.exports = GlobeViewSwitcherButton; |
Oops, something went wrong.