kopia lustrzana https://github.com/OpenDroneMap/WebODM
Botão IA
rodzic
4f5d8db473
commit
f9e2a6b792
|
@ -4,6 +4,7 @@ import Map from './components/Map';
|
||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { _, interpolate } from './classes/gettext';
|
import { _, interpolate } from './classes/gettext';
|
||||||
|
import update from 'immutability-helper';
|
||||||
|
|
||||||
class MapView extends React.Component {
|
class MapView extends React.Component {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -48,11 +49,13 @@ class MapView extends React.Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
selectedMapType,
|
selectedMapType,
|
||||||
tiles: this.getTilesByMapType(selectedMapType)
|
tiles: this.getTilesByMapType(selectedMapType),
|
||||||
|
AIEnabled: false
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getTilesByMapType = this.getTilesByMapType.bind(this);
|
this.getTilesByMapType = this.getTilesByMapType.bind(this);
|
||||||
this.handleMapTypeButton = this.handleMapTypeButton.bind(this);
|
this.handleMapTypeButton = this.handleMapTypeButton.bind(this);
|
||||||
|
this.handleAIBtnClick = this.handleAIBtnClick.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTilesByMapType(type){
|
getTilesByMapType(type){
|
||||||
|
@ -75,13 +78,23 @@ class MapView extends React.Component {
|
||||||
|
|
||||||
handleMapTypeButton(type){
|
handleMapTypeButton(type){
|
||||||
return () => {
|
return () => {
|
||||||
this.setState({
|
this.setState(update(this.state, {
|
||||||
selectedMapType: type,
|
$merge: {
|
||||||
tiles: this.getTilesByMapType(type)
|
selectedMapType: type,
|
||||||
});
|
tiles: this.getTilesByMapType(type)
|
||||||
|
}
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleAIBtnClick() {
|
||||||
|
this.setState(update(this.state, {
|
||||||
|
AIEnabled: {$set: !this.state.AIEnabled}
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
let mapTypeButtons = [
|
let mapTypeButtons = [
|
||||||
{
|
{
|
||||||
|
@ -118,6 +131,11 @@ class MapView extends React.Component {
|
||||||
onClick={this.handleMapTypeButton(mapType.type)}
|
onClick={this.handleMapTypeButton(mapType.type)}
|
||||||
className={"btn rounded-corners " + (mapType.type === this.state.selectedMapType ? "selected-button" : "default-button")}><i className={mapType.icon}></i> {mapType.label}</button>
|
className={"btn rounded-corners " + (mapType.type === this.state.selectedMapType ? "selected-button" : "default-button")}><i className={mapType.icon}></i> {mapType.label}</button>
|
||||||
)}
|
)}
|
||||||
|
<button
|
||||||
|
key={100}
|
||||||
|
onClick={this.handleAIBtnClick}
|
||||||
|
className={'btn rounded-corners AI-btn ' + (this.state.AIEnabled ? "selected-button" : "default-button")}
|
||||||
|
><i className='glyphicon glyphicon-screenshot'></i> AI</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{this.props.title ?
|
{this.props.title ?
|
||||||
|
|
|
@ -55,7 +55,7 @@ export function addTempLayer(file, cb) {
|
||||||
return {
|
return {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
fillOpacity: 0.7,
|
fillOpacity: 0.7,
|
||||||
color: getColor()
|
color: '#99ff99'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//for point layers
|
//for point layers
|
||||||
|
|
|
@ -133,6 +133,12 @@ class Map extends React.Component {
|
||||||
|
|
||||||
async.each(tiles, (tile, done) => {
|
async.each(tiles, (tile, done) => {
|
||||||
const { url, meta, type } = tile;
|
const { url, meta, type } = tile;
|
||||||
|
|
||||||
|
window.this_map_info = {
|
||||||
|
id: meta.task.id,
|
||||||
|
project: meta.task.project
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let metaUrl = url + "metadata";
|
let metaUrl = url + "metadata";
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,14 @@
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.AI-btn {
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
padding-right: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue