forked from geosolutions-it/MapStore2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added area editor (geosolutions-it#2891)
- Loading branch information
1 parent
4ca7bad
commit bf5ad67
Showing
36 changed files
with
1,184 additions
and
110 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
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,41 @@ | ||
/** | ||
* Copyright 2018, 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 enhancer = require("./enhancers/Map"); | ||
const autoMapType = require('../../map/enhancers/autoMapType'); | ||
const mapType = require('../../map/enhancers/mapType'); | ||
const autoResize = require('../../map/enhancers/autoResize'); | ||
const onMapViewChanges = require('../../map/enhancers/onMapViewChanges'); | ||
const withDraw = require("../../map/enhancers/withDraw"); | ||
const {compose} = require('recompose'); | ||
|
||
const MapWitDraw = compose( | ||
enhancer, | ||
onMapViewChanges, | ||
autoResize(0), | ||
autoMapType, | ||
mapType, | ||
withDraw() | ||
)(require('../../map/BaseMap')); | ||
|
||
const Portal = require('react-overlays').Portal; | ||
|
||
module.exports = ({layer, onMapReady = () => {}}) => { | ||
return ( | ||
<Portal container={document.querySelector('.rules-data-gird')}> | ||
<div className="rules-manager-map-modal" style={{position: "absolute", zIndex: 11, top: 0, bottom: 0, width: "100%"}}> | ||
<MapWitDraw | ||
onMapReady={onMapReady} | ||
options={{ style: { margin: 10, height: 'calc(100% - 20px)' }}} | ||
layer={layer} | ||
tools={["draw"]}/> | ||
</div> | ||
</Portal>); | ||
}; | ||
|
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,63 @@ | ||
/** | ||
* Copyright 2018, 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 PropTypes = require('prop-types'); | ||
const Button = require("../../misc/toolbar/ToolbarButton"); | ||
const ContainerDimensions = require('react-container-dimensions').default; | ||
const {Controlled: Codemirror} = require('react-codemirror2'); | ||
require('codemirror/lib/codemirror.css'); | ||
require('codemirror/mode/sql/sql'); | ||
const LocaleUtils = require('../../../utils/LocaleUtils'); | ||
|
||
|
||
class RoiCql extends React.Component { | ||
static propTypes = { | ||
wkt: PropTypes.string, | ||
onChangeFilter: PropTypes.func | ||
}; | ||
static contextTypes = { | ||
messages: PropTypes.object | ||
}; | ||
constructor(props) { | ||
super(props); | ||
this.state = {cql: props.wkt}; | ||
} | ||
componentWillReceiveProps({wkt: nw}) { | ||
if (nw !== this.props.wkt) { | ||
this.setState({cql: nw}); | ||
} | ||
} | ||
onChange = (editor, data, value) => { | ||
this.setState(() => ({cql: value})); | ||
} | ||
render() { | ||
return ( | ||
<ContainerDimensions> | ||
{({width}) => | ||
<div style={{width, display: "flex", flexDirection: "column"}}> | ||
<Codemirror | ||
value={this.state.cql} | ||
onBeforeChange={this.onChange} | ||
options={{ | ||
mode: {name: "sql"}, | ||
lineNumbers: true, | ||
lineWrapping: true | ||
}}/> | ||
<Button disabled={this.props.wkt === this.state.cql} text={LocaleUtils.getMessageById(this.context.messages, "rulesmanager.apply")} onClick={this.apply}/> | ||
</div>} | ||
</ContainerDimensions>); | ||
} | ||
apply = () => { | ||
if (this.props.onChangeFilter) { | ||
this.props.onChangeFilter(this.state.cql); | ||
} | ||
} | ||
} | ||
|
||
module.exports = RoiCql; |
Oops, something went wrong.