kopia lustrzana https://github.com/OpenDroneMap/WebODM
Thermal as a first class citizen
rodzic
a51a839623
commit
42e94b1744
|
@ -33,6 +33,7 @@ class MapView extends React.Component {
|
|||
// and preference order (below)
|
||||
if (props.selectedMapType === "auto"){
|
||||
let preferredTypes = ['orthophoto', 'dsm', 'dtm'];
|
||||
if (this.isThermalMap()) preferredTypes = ['plant'].concat(preferredTypes);
|
||||
|
||||
for (let i = 0; i < this.props.mapItems.length; i++){
|
||||
let mapItem = this.props.mapItems[i];
|
||||
|
@ -57,6 +58,19 @@ class MapView extends React.Component {
|
|||
this.handleMapTypeButton = this.handleMapTypeButton.bind(this);
|
||||
}
|
||||
|
||||
isThermalMap = () => {
|
||||
let thermalCount = 0;
|
||||
for (let item of this.props.mapItems){
|
||||
if (item.meta && item.meta.task && item.meta.task.orthophoto_bands){
|
||||
if (item.meta.task.orthophoto_bands.length === 2 && item.meta.task.orthophoto_bands && item.meta.task.orthophoto_bands[0].description.toLowerCase() === "lwir"){
|
||||
thermalCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return thermalCount === this.props.mapItems.length;
|
||||
}
|
||||
|
||||
getTilesByMapType(type){
|
||||
// Go through the list of map items and return
|
||||
// only those that match a particular type (in tile format)
|
||||
|
@ -85,6 +99,8 @@ class MapView extends React.Component {
|
|||
}
|
||||
|
||||
render(){
|
||||
const isThermal = this.isThermalMap();
|
||||
|
||||
let mapTypeButtons = [
|
||||
{
|
||||
label: _("Orthophoto"),
|
||||
|
@ -92,9 +108,9 @@ class MapView extends React.Component {
|
|||
icon: "far fa-image"
|
||||
},
|
||||
{
|
||||
label: _("Plant Health"),
|
||||
label: isThermal ? _("Thermal") : _("Plant Health"),
|
||||
type: "plant",
|
||||
icon: "fa fa-seedling"
|
||||
icon: isThermal ? "fa fa-thermometer-half" : "fa fa-seedling"
|
||||
},
|
||||
{
|
||||
label: _("Surface Model"),
|
||||
|
@ -123,7 +139,7 @@ class MapView extends React.Component {
|
|||
key={mapType.type}
|
||||
onClick={this.handleMapTypeButton(mapType.type)}
|
||||
title={mapType.label}
|
||||
className={"btn btn-sm " + (mapType.type === this.state.selectedMapType ? "btn-primary" : "btn-default")}><i className={mapType.icon}></i><span className="hidden-sm hidden-xs"> {mapType.label}</span></button>
|
||||
className={"btn btn-sm " + (mapType.type === this.state.selectedMapType ? "btn-primary" : "btn-default")}><i className={mapType.icon + " fa-fw"}></i><span className="hidden-sm hidden-xs"> {mapType.label}</span></button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -136,6 +152,7 @@ class MapView extends React.Component {
|
|||
public={this.props.public}
|
||||
shareButtons={this.props.shareButtons}
|
||||
permissions={this.props.permissions}
|
||||
thermal={isThermal}
|
||||
/>
|
||||
</div>
|
||||
</div>);
|
||||
|
|
|
@ -36,7 +36,8 @@ class Map extends React.Component {
|
|||
mapType: "orthophoto",
|
||||
public: false,
|
||||
shareButtons: true,
|
||||
permissions: ["view"]
|
||||
permissions: ["view"],
|
||||
thermal: false
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
|
@ -45,7 +46,8 @@ class Map extends React.Component {
|
|||
mapType: PropTypes.oneOf(['orthophoto', 'plant', 'dsm', 'dtm']),
|
||||
public: PropTypes.bool,
|
||||
shareButtons: PropTypes.bool,
|
||||
permissions: PropTypes.array
|
||||
permissions: PropTypes.array,
|
||||
thermal: PropTypes.bool
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
|
@ -88,7 +90,7 @@ class Map extends React.Component {
|
|||
case "orthophoto":
|
||||
return _("Orthophoto");
|
||||
case "plant":
|
||||
return _("Plant Health");
|
||||
return this.props.thermal ? _("Thermal") : _("Plant Health");
|
||||
case "dsm":
|
||||
return _("DSM");
|
||||
case "dtm":
|
||||
|
@ -102,13 +104,13 @@ class Map extends React.Component {
|
|||
case "orthophoto":
|
||||
return "far fa-image fa-fw"
|
||||
case "plant":
|
||||
return "fa fa-seedling fa-fw";
|
||||
return this.props.thermal ? "fa fa-thermometer-half fa-fw" : "fa fa-seedling fa-fw";
|
||||
case "dsm":
|
||||
case "dtm":
|
||||
return "fa fa-chart-area fa-fw";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
hasBands = (bands, orthophoto_bands) => {
|
||||
if (!orthophoto_bands) return false;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "WebODM",
|
||||
"version": "2.5.2",
|
||||
"version": "2.5.3",
|
||||
"description": "User-friendly, extendable application and API for processing aerial imagery.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
Ładowanie…
Reference in New Issue