mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-25 03:44:52 +00:00
74_AutomowerConnect.pm: educe spikes in border region after a hull polygon is set to attribut.
git-svn-id: https://svn.fhem.de/fhem/trunk@28790 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9a242efec7
commit
74079e58eb
@ -1,5 +1,7 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it
|
# Do not insert empty lines here, update check depends on it
|
||||||
|
- feature: 74_AutomowerConnect.pm: reduce spikes in border region after a hull
|
||||||
|
polygon is set to attribut.
|
||||||
- feature: 14_CUL_TCM97001.pm: NX7674, Kuehl- & Gefrierschrank-Thermometer
|
- feature: 14_CUL_TCM97001.pm: NX7674, Kuehl- & Gefrierschrank-Thermometer
|
||||||
(Rosenstein & Söhne), zugefügt
|
(Rosenstein & Söhne), zugefügt
|
||||||
Bei einem modify der DEF wird nun die alte DEF gelöscht
|
Bei einem modify der DEF wird nun die alte DEF gelöscht
|
||||||
|
@ -118,6 +118,9 @@ __END__
|
|||||||
<li>The mower path is shown in the detail view.</li>
|
<li>The mower path is shown in the detail view.</li>
|
||||||
<li>An arbitrary map can be used as background for the mower path.</li>
|
<li>An arbitrary map can be used as background for the mower path.</li>
|
||||||
<li>The map has to be a raster image in webp, png or jpg format.</li>
|
<li>The map has to be a raster image in webp, png or jpg format.</li>
|
||||||
|
<li>The property limits can be registered manually.</li>
|
||||||
|
<li>The mowing area limits can be registered manually.</li>
|
||||||
|
<li>The mowing area limits can be calculated, alternatively.</li>
|
||||||
<li>It's possible to control everything the API offers, e.g. schedule, headlight, cutting height and actions like start, pause, park etc. </li>
|
<li>It's possible to control everything the API offers, e.g. schedule, headlight, cutting height and actions like start, pause, park etc. </li>
|
||||||
<li>Zones are definable. </li>
|
<li>Zones are definable. </li>
|
||||||
<li>Cutting height can be set for each zone differently. </li>
|
<li>Cutting height can be set for each zone differently. </li>
|
||||||
@ -302,6 +305,7 @@ __END__
|
|||||||
hullConnector="1"<br>
|
hullConnector="1"<br>
|
||||||
hullResolution="40"<br>
|
hullResolution="40"<br>
|
||||||
hullCalculate="1"<br>
|
hullCalculate="1"<br>
|
||||||
|
hullSubtract=""<br>
|
||||||
propertyLimitsColor="#33cc33"<br>
|
propertyLimitsColor="#33cc33"<br>
|
||||||
propertyLimitsLineWidth="1"<br>
|
propertyLimitsLineWidth="1"<br>
|
||||||
propertyLimitsConnector="1"<br>
|
propertyLimitsConnector="1"<br>
|
||||||
@ -455,6 +459,10 @@ __END__
|
|||||||
The calculation is done only after site reload.<br>
|
The calculation is done only after site reload.<br>
|
||||||
The calculation of hull is stopped when the attribute ist set and starts again when attribute is deleted.<br>
|
The calculation of hull is stopped when the attribute ist set and starts again when attribute is deleted.<br>
|
||||||
The attribute <code>weekdaysToResetWayPoints</code> should be set to - and also the design attribute <code>mowingPathUseDots</code> should be set to "1" until the hull is sufficient.
|
The attribute <code>weekdaysToResetWayPoints</code> should be set to - and also the design attribute <code>mowingPathUseDots</code> should be set to "1" until the hull is sufficient.
|
||||||
|
If there is a polygon in attribute, it can be changed.<br>
|
||||||
|
The design attribute <code>hullSubtract</code> can be set to a natural number {ℕ}, it depicts the recursion depth in which polygon points removed from way points.<br>
|
||||||
|
This reduces spikes in border region.<br>
|
||||||
|
<code>hullSubtract=""</code> removes the button 'Subtract Hull'.<br>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -551,6 +559,9 @@ __END__
|
|||||||
<li>Der Pfad des Mähroboters wird in der Detailansicht des FHEMWEB Frontends angezeigt.</li>
|
<li>Der Pfad des Mähroboters wird in der Detailansicht des FHEMWEB Frontends angezeigt.</li>
|
||||||
<li>Der Pfad kann mit einer beliebigen Karte hinterlegt werden.</li>
|
<li>Der Pfad kann mit einer beliebigen Karte hinterlegt werden.</li>
|
||||||
<li>Die Karte muss als Rasterbild im webp, png oder jpg Format vorliegen.</li>
|
<li>Die Karte muss als Rasterbild im webp, png oder jpg Format vorliegen.</li>
|
||||||
|
<li>Die Grundstücksgrenze kann manuell eingetragen werden.</li>
|
||||||
|
<li>Die Die Mähflächengrenze kann manuell eingetragen werden.</li>
|
||||||
|
<li>Alternativ kann die Mähflächengrenze berechnet werden.</li>
|
||||||
<li>Es ist möglich alles was die API anbietet zu steuern, z.B. Mähplan,Scheinwerfer, Schnitthöhe und Aktionen wie, Start, Pause, Parken usw. </li>
|
<li>Es ist möglich alles was die API anbietet zu steuern, z.B. Mähplan,Scheinwerfer, Schnitthöhe und Aktionen wie, Start, Pause, Parken usw. </li>
|
||||||
<li>Zonen können selbst definiert werden. </li>
|
<li>Zonen können selbst definiert werden. </li>
|
||||||
<li>Die Schnitthöhe kann je selbstdefinierter Zone eingestellt werden. </li>
|
<li>Die Schnitthöhe kann je selbstdefinierter Zone eingestellt werden. </li>
|
||||||
@ -737,6 +748,7 @@ __END__
|
|||||||
hullConnector="1"<br>
|
hullConnector="1"<br>
|
||||||
hullResolution="40"<br>
|
hullResolution="40"<br>
|
||||||
hullCalculate="1"<br>
|
hullCalculate="1"<br>
|
||||||
|
hullSubtract=""<br>
|
||||||
propertyLimitsColor="#33cc33"<br>
|
propertyLimitsColor="#33cc33"<br>
|
||||||
propertyLimitsLineWidth="1"<br>
|
propertyLimitsLineWidth="1"<br>
|
||||||
propertyLimitsConnector="1"<br>
|
propertyLimitsConnector="1"<br>
|
||||||
@ -893,7 +905,11 @@ __END__
|
|||||||
Das Hüllenpolygon wird berechnet wenn das Designattribute gesetzt ist, <code>hullCalculate="1"</code> und es mehr als 50 Wegpunkte der Aktivität MOWING gibt.<br>
|
Das Hüllenpolygon wird berechnet wenn das Designattribute gesetzt ist, <code>hullCalculate="1"</code> und es mehr als 50 Wegpunkte der Aktivität MOWING gibt.<br>
|
||||||
Die Berechnung wird beim Laden oder Wiederladen der Website ausgeführt.<br>
|
Die Berechnung wird beim Laden oder Wiederladen der Website ausgeführt.<br>
|
||||||
Die Berechnung stopt wenn dieses Attribut gesetzt ist und startet wenn das Attibut gelöscht wird.<br>
|
Die Berechnung stopt wenn dieses Attribut gesetzt ist und startet wenn das Attibut gelöscht wird.<br>
|
||||||
Das Attribut <code>weekdaysToResetWayPoints</code> sollte auf <code>-</code> und das Designattribut <code>mowingPathUseDots</code> sollte auf <code>"1"</code> gesetzt werden, bis das Polygon die Hülle der Mähfläche zufriedenstellend abbildet.
|
Das Attribut <code>weekdaysToResetWayPoints</code> sollte auf <code>-</code> und das Designattribut <code>mowingPathUseDots</code> sollte auf <code>"1"</code> gesetzt werden.<br>
|
||||||
|
Befindet sich ein Polygon im Attribut, besteht die Möglichkeit das Polygon anzupassen.<br>
|
||||||
|
Das Designattribut <code>hullSubtract</code> kann auf eine natürliche Zahl {ℕ} gesetzt werden, die angibt in welcher Rekursionstiefe Polygonpunkte aus der Menge der Wegpunkte entfernt werden.<br>
|
||||||
|
Das reduziert Ausreißer im Randbereich der vom Polygon umschlossenen Fläche.<br>
|
||||||
|
Wenn <code>hullSubtract=""</code> gesetzt wird, dann wird der Button 'Subtract Hull' entfernt.<br>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><a href="disable">disable</a></li>
|
<li><a href="disable">disable</a></li>
|
||||||
|
@ -133,6 +133,7 @@ hullLineWidth="1"
|
|||||||
hullConnector="1"
|
hullConnector="1"
|
||||||
hullResolution="40"
|
hullResolution="40"
|
||||||
hullCalculate="1"
|
hullCalculate="1"
|
||||||
|
hullSubtract=""
|
||||||
propertyLimitsColor="#33cc33"
|
propertyLimitsColor="#33cc33"
|
||||||
propertyLimitsLineWidth="1"
|
propertyLimitsLineWidth="1"
|
||||||
propertyLimitsConnector="1"
|
propertyLimitsConnector="1"
|
||||||
@ -585,6 +586,8 @@ sub FW_detailFn {
|
|||||||
$ret .= "</div>";
|
$ret .= "</div>";
|
||||||
$ret .= "<button title='Sends the hull polygon points to attribute mowingAreaHull.' onclick='AutomowerConnectGetHull( \"$FW_ME/$type/$name/json\" )'>mowingAreaHullToAttribute</button>"
|
$ret .= "<button title='Sends the hull polygon points to attribute mowingAreaHull.' onclick='AutomowerConnectGetHull( \"$FW_ME/$type/$name/json\" )'>mowingAreaHullToAttribute</button>"
|
||||||
if ( -e "$FW_dir/$hash->{helper}{FWEXTA}{path}/$hash->{helper}{FWEXTA}{file}" && !AttrVal( $name,'mowingAreaHull','' ) && $$mapDesign =~ m/hullCalculate="1"/g );
|
if ( -e "$FW_dir/$hash->{helper}{FWEXTA}{path}/$hash->{helper}{FWEXTA}{file}" && !AttrVal( $name,'mowingAreaHull','' ) && $$mapDesign =~ m/hullCalculate="1"/g );
|
||||||
|
$ret .= "<button title='Subtracts hull polygon points from way points. To hide button set hullSubtract=\"\".' onclick='AutomowerConnectSubtractHull( \"$FW_ME/$type/$name/json\" )'>Subtract Hull</button>"
|
||||||
|
if ( -e "$FW_dir/$hash->{helper}{FWEXTA}{path}/$hash->{helper}{FWEXTA}{file}" && AttrVal( $name,'mowingAreaHull','' ) && $$mapDesign =~ m/hullSubtract="\d+"/g );
|
||||||
$ret .= "<br>";
|
$ret .= "<br>";
|
||||||
$hash->{helper}{detailFnFirst} = 1;
|
$hash->{helper}{detailFnFirst} = 1;
|
||||||
my $mid = $hash->{helper}{map_init_delay};
|
my $mid = $hash->{helper}{map_init_delay};
|
||||||
|
@ -397,6 +397,66 @@ function AutomowerConnectGetHull ( path ) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AutomowerConnectSubtractHull ( path ) {
|
||||||
|
$.getJSON( path, function( data, textStatus ) {
|
||||||
|
console.log( 'AutomowerConnectGetHull ( \''+path+'\' ): status '+textStatus );
|
||||||
|
|
||||||
|
if ( textStatus == 'success') {
|
||||||
|
// data.name, data.type, data.picx, data.picy, data.scalx, data.scaly, data.errdesc, data.posxy, data.poserrxy );
|
||||||
|
const div = document.getElementById(data.type+'_'+data.name+'_div');
|
||||||
|
const pos =data.posxy;
|
||||||
|
|
||||||
|
if ( div && div.getAttribute( 'data-hullSubtract' ) && typeof hull === "function" ){
|
||||||
|
const wypts = [];
|
||||||
|
const hsub = div.getAttribute( 'data-hullSubtract' );
|
||||||
|
const wyres = div.getAttribute( 'data-hullResolution' );
|
||||||
|
var hullpts = [];
|
||||||
|
|
||||||
|
for ( let i = 0; i < pos.length; i+=3 ){
|
||||||
|
|
||||||
|
if ( pos[i+2] == "M") wypts.push( [ pos[i], pos[i+1] ] );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( let i = 0; i < hsub; i++ ){
|
||||||
|
|
||||||
|
if ( wypts.length > 50 ) {
|
||||||
|
|
||||||
|
hullpts = hull( wypts, wyres );
|
||||||
|
|
||||||
|
for ( let k = 0; k < hullpts.length; k++ ){
|
||||||
|
|
||||||
|
for ( let m = 0; m < wypts.length; m++ ){
|
||||||
|
|
||||||
|
if ( hullpts[k][0] == wypts[m][0] && hullpts[k][1] == wypts[m][1] ) {
|
||||||
|
|
||||||
|
wypts.splice( m, 1 );
|
||||||
|
break;
|
||||||
|
//~ m--;
|
||||||
|
//~ k++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
hullpts = hull( wypts, wyres );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FW_cmd( FW_root+"?cmd=attr "+data.name+" mowingAreaHull "+JSON.stringify( hullpts )+"&XHR=1",function(data){setTimeout(()=>{window.location.reload()},500)} );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//AutomowerConnectUpdateDetail (<devicename>, <type>, <detailfnfirst>, <imagesize x>, <imagesize y>, <scale x>, <scale y>, <error description>, <path array>, <error array>, <hull array>)
|
//AutomowerConnectUpdateDetail (<devicename>, <type>, <detailfnfirst>, <imagesize x>, <imagesize y>, <scale x>, <scale y>, <error description>, <path array>, <error array>, <hull array>)
|
||||||
function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, scaly, errdesc, pos, erray, hullxy) {
|
function AutomowerConnectUpdateDetail (dev, type, detailfnfirst, picx, picy, scalx, scaly, errdesc, pos, erray, hullxy) {
|
||||||
const colorat = {
|
const colorat = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user