2022-09-12 13:12:59 +02:00
"use strict" ;
var netgis = netgis || { } ;
netgis . Toolbar = function ( )
{
this . client = null ;
this . toolbars = { } ;
this . searchValue = "" ;
} ;
netgis . Toolbar . prototype . load = function ( )
{
var config = this . client . config ;
this . root = document . createElement ( "section" ) ; // header?
this . root . className = "netgis-toolbars" ;
if ( this . client . editable )
{
2023-01-31 16:26:59 +01:00
var bufferDefaultRadius = 1000 ;
var bufferDefaultSegments = 3 ;
if ( netgis . util . isDefined ( config . tools ) )
{
if ( netgis . util . isDefined ( config . tools . buffer . defaultRadius ) ) bufferDefaultRadius = config . tools . buffer . defaultRadius ;
if ( netgis . util . isDefined ( config . tools . buffer . defaultSegments ) ) bufferDefaultSegments = config . tools . buffer . defaultSegments ;
}
2022-09-12 13:12:59 +02:00
// Draw
this . toolbars [ netgis . Modes . DRAW _POINTS ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _POINTS ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Punkte zeichnen:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _POINTS ] , this . createToolbarCheckbox ( "Einrasten" , this . onSnapChange . bind ( this ) ) ) ;
2023-01-31 16:26:59 +01:00
this . append ( this . toolbars [ netgis . Modes . DRAW _POINTS ] , this . createToolbarCheckbox ( "Puffern" , this . onDrawBufferChange . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _POINTS ] , this . createToolbarInput ( "Radius (Meter):" , bufferDefaultRadius , this . onDrawBufferRadiusChange . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _POINTS ] , this . createToolbarInput ( "Segmente:" , bufferDefaultSegments , this . onDrawBufferSegmentsChange . bind ( this ) ) ) ;
2022-09-12 13:12:59 +02:00
this . root . appendChild ( this . toolbars [ netgis . Modes . DRAW _POINTS ] ) ;
this . toolbars [ netgis . Modes . DRAW _LINES ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _LINES ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Linien zeichnen:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _LINES ] , this . createToolbarCheckbox ( "Einrasten" , this . onSnapChange . bind ( this ) ) ) ;
2023-01-31 16:26:59 +01:00
this . append ( this . toolbars [ netgis . Modes . DRAW _LINES ] , this . createToolbarCheckbox ( "Puffern" , this . onDrawBufferChange . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _LINES ] , this . createToolbarInput ( "Radius (Meter):" , bufferDefaultRadius , this . onDrawBufferRadiusChange . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _LINES ] , this . createToolbarInput ( "Segmente:" , bufferDefaultSegments , this . onDrawBufferSegmentsChange . bind ( this ) ) ) ;
2022-09-12 13:12:59 +02:00
this . root . appendChild ( this . toolbars [ netgis . Modes . DRAW _LINES ] ) ;
2023-01-31 16:26:59 +01:00
this . showDrawBufferOptions ( false ) ;
2022-09-12 13:12:59 +02:00
this . toolbars [ netgis . Modes . DRAW _POLYGONS ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _POLYGONS ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Polygone zeichnen:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . DRAW _POLYGONS ] , this . createToolbarCheckbox ( "Einrasten" , this . onSnapChange . bind ( this ) ) ) ;
2023-01-31 16:26:59 +01:00
this . append ( this . toolbars [ netgis . Modes . DRAW _POLYGONS ] , this . createToolbarCheckbox ( "Tracing" , this . onTracingChange . bind ( this ) ) ) ;
2022-09-12 13:12:59 +02:00
this . root . appendChild ( this . toolbars [ netgis . Modes . DRAW _POLYGONS ] ) ;
// Edit
this . toolbars [ netgis . Modes . CUT _FEATURE _BEGIN ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . CUT _FEATURE _BEGIN ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Feature zum Ausschneiden wählen:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . root . appendChild ( this . toolbars [ netgis . Modes . CUT _FEATURE _BEGIN ] ) ;
this . toolbars [ netgis . Modes . CUT _FEATURE _DRAW ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . CUT _FEATURE _DRAW ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Fläche zum Ausschneiden zeichnen:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . root . appendChild ( this . toolbars [ netgis . Modes . CUT _FEATURE _DRAW ] ) ;
this . toolbars [ netgis . Modes . MODIFY _FEATURES ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . MODIFY _FEATURES ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Features verschieben:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . root . appendChild ( this . toolbars [ netgis . Modes . MODIFY _FEATURES ] ) ;
this . toolbars [ netgis . Modes . DELETE _FEATURES ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . DELETE _FEATURES ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Features löschen:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . root . appendChild ( this . toolbars [ netgis . Modes . DELETE _FEATURES ] ) ;
this . toolbars [ netgis . Modes . BUFFER _FEATURE _BEGIN ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . BUFFER _FEATURE _BEGIN ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Feature zum Puffern wählen:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
this . root . appendChild ( this . toolbars [ netgis . Modes . BUFFER _FEATURE _BEGIN ] ) ;
this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] = this . createToolbar ( ) ;
//var wrapper = document.createElement( "div" );
//this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ].appendChild( wrapper );
this . append ( this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Feature puffern:</span>' , this . onBufferCancel . bind ( this ) ) ) ;
2023-01-31 16:26:59 +01:00
this . append ( this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] , this . createToolbarInput ( "Radius (Meter):" , bufferDefaultRadius , this . onBufferChange . bind ( this ) ) ) ;
2022-09-12 13:12:59 +02:00
this . append ( this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] , this . createToolbarInput ( "Segmente:" , bufferDefaultSegments , this . onBufferChange . bind ( this ) ) ) ;
this . append ( this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] , this . createToolbarButton ( '<i class="fas fa-check"></i><span>OK</span>' , this . onBufferAccept . bind ( this ) ) ) ;
//var self = this;
//setTimeout( function() { self.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ].classList.remove( "netgis-hide" ); }, 100 );
/ *
this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] . appendChild ( this . createToolbarButton ( '<i class="fas fa-times"></i><span>Feature puffern:</span>' , this . onBufferCancel . bind ( this ) ) ) ;
this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] . appendChild ( this . createToolbarInput ( "Radius in Meter:" , this . client . config . tools . buffer . defaultRadius , this . onBufferChange . bind ( this ) ) ) ;
this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] . appendChild ( this . createToolbarInput ( "Segmente:" , this . client . config . tools . buffer . defaultSegments , this . onBufferChange . bind ( this ) ) ) ;
* /
var bufferInputs = this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] . getElementsByTagName ( "input" ) ;
bufferInputs [ 0 ] . addEventListener ( "keyup" , this . onBufferKeyUp . bind ( this ) ) ;
bufferInputs [ 1 ] . addEventListener ( "keyup" , this . onBufferKeyUp . bind ( this ) ) ;
bufferInputs [ 1 ] . setAttribute ( "min" , 1 ) ;
//this.toolbars[ netgis.Modes.BUFFER_FEATURE_EDIT ].appendChild( this.createToolbarButton( '<i class="fas fa-check"></i><span>OK</span>', this.onBufferAccept.bind( this ) ) );
this . root . appendChild ( this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] ) ;
}
// Search
this . toolbars [ netgis . Modes . SEARCH _PLACE ] = this . createToolbar ( ) ;
this . append ( this . toolbars [ netgis . Modes . SEARCH _PLACE ] , this . createToolbarButton ( '<i class="fas fa-times"></i><span>Suche:</span>' , this . onToolbarClose . bind ( this ) ) ) ;
var searchInput = this . createToolbarInputText ( "Adresse..." , "" , null ) ;
searchInput . style . position = "relative" ;
this . searchInput = searchInput . getElementsByTagName ( "input" ) [ 0 ] ;
//this.searchInput.addEventListener( "change", this.onSearchChange.bind( this ) );
//this.searchInput.addEventListener( "keypress", this.onSearchKeyPress.bind( this ) );
this . searchInput . addEventListener ( "keyup" , this . onSearchKeyUp . bind ( this ) ) ;
this . searchInput . addEventListener ( "focus" , this . onSearchFocus . bind ( this ) ) ;
this . searchInput . addEventListener ( "blur" , this . onSearchBlur . bind ( this ) ) ;
/ * v a r s e a r c h C l e a r = d o c u m e n t . c r e a t e E l e m e n t ( " b u t t o n " ) ;
searchClear . innerHTML = "<i class='fas fa-undo-alt'></i>" ;
searchInput . appendChild ( searchClear ) ; * /
this . append ( this . toolbars [ netgis . Modes . SEARCH _PLACE ] , searchInput ) ;
this . searchList = document . createElement ( "ul" ) ;
this . searchList . className = "netgis-dropdown-content netgis-search-list netgis-dialog netgis-shadow netgis-hide" ;
searchInput . appendChild ( this . searchList ) ;
//TODO: search dropdown not working if toolbar has overflow-y hidden
//TODO: refactor search list to abstract dropdown component ( see head menus )
//this.toolbars[ netgis.MapModes.SEARCH_PLACE ].appendChild( this.createToolbarButton( '<i class="fas fa-check"></i>OK', this.onBufferAccept.bind( this ) ) );
this . append ( this . toolbars [ netgis . Modes . SEARCH _PLACE ] , this . createToolbarButton ( '<i class="fas fa-undo"></i>' , this . onSearchClear . bind ( this ) ) ) ;
this . root . appendChild ( this . toolbars [ netgis . Modes . SEARCH _PLACE ] ) ;
this . client . root . appendChild ( this . root ) ;
// Events
this . client . on ( netgis . Events . SET _MODE , this . onSetMode . bind ( this ) ) ;
this . client . on ( netgis . Events . SEARCH _PLACE _RESPONSE , this . onSearchPlaceResponse . bind ( this ) ) ;
} ;
netgis . Toolbar . prototype . createToolbar = function ( )
{
var toolbar = document . createElement ( "div" ) ;
toolbar . className = "netgis-toolbar netgis-dialog netgis-shadow netgis-hide" ;
var wrapper = document . createElement ( "div" ) ;
toolbar . appendChild ( wrapper ) ;
return toolbar ;
} ;
netgis . Toolbar . prototype . append = function ( toolbar , child )
{
var wrapper = toolbar . getElementsByTagName ( "div" ) [ 0 ] ;
wrapper . appendChild ( child ) ;
} ;
netgis . Toolbar . prototype . createToolbarButton = function ( content , callback )
{
var button = document . createElement ( "button" ) ;
button . setAttribute ( "type" , "button" ) ;
button . className = "netgis-hover-light" ;
button . innerHTML = content ;
button . addEventListener ( "click" , callback ) ;
return button ;
} ;
netgis . Toolbar . prototype . createToolbarCheckbox = function ( title , callback )
{
var label = document . createElement ( "label" ) ;
label . className = "netgis-hover-light" ;
var checkbox = document . createElement ( "input" ) ;
checkbox . setAttribute ( "type" , "checkbox" ) ;
checkbox . addEventListener ( "change" , callback ) ;
label . appendChild ( checkbox ) ;
var text = document . createTextNode ( title ) ;
label . appendChild ( text ) ;
return label ;
} ;
netgis . Toolbar . prototype . createToolbarInput = function ( title , value , callback )
{
var label = document . createElement ( "label" ) ;
label . className = "netgis-hover-light" ;
var text = document . createTextNode ( title ) ;
label . appendChild ( text ) ;
var input = document . createElement ( "input" ) ;
input . setAttribute ( "type" , "number" ) ;
input . setAttribute ( "min" , 0 ) ;
input . value = value ;
input . addEventListener ( "change" , callback ) ;
label . appendChild ( input ) ;
return label ;
} ;
netgis . Toolbar . prototype . createToolbarInputText = function ( title , value , callback )
{
var label = document . createElement ( "label" ) ;
label . className = "netgis-hover-light" ;
/ * v a r t e x t = d o c u m e n t . c r e a t e T e x t N o d e ( t i t l e ) ;
label . appendChild ( text ) ; * /
var input = document . createElement ( "input" ) ;
input . setAttribute ( "type" , "text" ) ;
input . setAttribute ( "placeholder" , title ) ;
input . value = value ;
if ( callback ) input . addEventListener ( "change" , callback ) ;
label . appendChild ( input ) ;
return label ;
} ;
netgis . Toolbar . prototype . onSetMode = function ( e )
{
var mode = e ;
// Store old search mode to allow toggling search toolbar
var searchMode = ! this . toolbars [ netgis . Modes . SEARCH _PLACE ] . classList . contains ( "netgis-hide" ) ;
// Toggle Toolbars
netgis . util . foreach
(
this . toolbars ,
function ( index , toolbar )
{
if ( index === mode )
toolbar . classList . remove ( "netgis-hide" ) ;
else
toolbar . classList . add ( "netgis-hide" ) ;
}
) ;
// Mode
switch ( mode )
{
case netgis . Modes . SEARCH _PLACE :
{
//TODO: toggle mode event ?
if ( ! searchMode )
this . searchInput . focus ( ) ;
else
this . client . invoke ( netgis . Events . SET _MODE , netgis . Modes . VIEW ) ;
break ;
}
case netgis . Modes . BUFFER _FEATURE _EDIT :
{
this . updateBuffer ( ) ;
break ;
}
2023-01-31 16:26:59 +01:00
case netgis . Modes . DRAW _POINTS :
case netgis . Modes . DRAW _LINES :
{
var checkbox = this . toolbars [ netgis . Modes . DRAW _POINTS ] . getElementsByTagName ( "input" ) [ 1 ] ;
if ( checkbox . checked )
{
this . client . invoke ( netgis . Events . DRAW _BUFFER _ON , null ) ;
}
break ;
}
2022-09-12 13:12:59 +02:00
}
} ;
netgis . Toolbar . prototype . onToolbarClose = function ( e )
{
this . client . invoke ( netgis . Events . SET _MODE , netgis . Modes . VIEW ) ;
} ;
netgis . Toolbar . prototype . searchRequest = function ( value )
{
value = value . trim ( ) ;
if ( value !== this . searchValue )
{
this . searchValue = value ;
if ( value . length > 0 )
{
this . client . invoke ( netgis . Events . SEARCH _PLACE _REQUEST , { query : value } ) ;
}
}
//TODO: refactor into search module ?
} ;
netgis . Toolbar . prototype . searchClear = function ( )
{
this . searchInput . value = "" ;
this . searchList . innerHTML = "" ;
} ;
netgis . Toolbar . prototype . searchSelectFirst = function ( )
{
var buttons = this . searchList . getElementsByTagName ( "button" ) ;
if ( buttons . length > 0 )
{
this . onSearchItemClick ( { target : buttons [ 0 ] } ) ;
}
} ;
netgis . Toolbar . prototype . onSearchKeyUp = function ( e )
{
var input = e . target ;
var key = e . keyCode ;
// a-z = 65-90
// 0-9 = 48-57
switch ( key )
{
// Enter
case 13 :
{
this . searchSelectFirst ( ) ;
this . searchList . classList . add ( "netgis-hide" ) ;
break ;
}
// Escape
case 27 :
{
this . searchClear ( ) ;
break ;
}
default :
{
this . searchRequest ( input . value ) ;
break ;
}
}
} ;
netgis . Toolbar . prototype . onSearchChange = function ( e )
{
var input = e . target ;
this . searchRequest ( input . value ) ;
/ * t h i s . c l i e n t . i n v o k e ( n e t g i s . E v e n t s . S E A R C H _ P L A C E _ R E Q U E S T , { q u e r y : i n p u t . v a l u e } ) ;
console . info ( "Search Change:" , input . value ) ; * /
} ;
netgis . Toolbar . prototype . onSearchClear = function ( e )
{
this . searchClear ( ) ;
this . searchInput . focus ( ) ;
} ;
netgis . Toolbar . prototype . onSearchFocus = function ( e )
{
this . searchList . classList . remove ( "netgis-hide" ) ;
} ;
netgis . Toolbar . prototype . onSearchBlur = function ( e )
{
this . searchList . classList . add ( "netgis-hide" ) ;
} ;
netgis . Toolbar . prototype . onSearchPlaceResponse = function ( e )
{
this . searchList . innerHTML = "" ;
var results = e . geonames ;
for ( var i = 0 ; i < results . length ; i ++ )
{
var result = results [ i ] ;
var item = document . createElement ( "li" ) ;
item . className = "netgis-hover-light" ;
var button = document . createElement ( "button" ) ;
button . setAttribute ( "type" , "button" ) ;
button . innerHTML = result . title ;
button . dataset . title = result . title ;
button . dataset . minx = result . minx ;
button . dataset . miny = result . miny ;
button . dataset . maxx = result . maxx ;
button . dataset . maxy = result . maxy ;
button . addEventListener ( "mousedown" , this . onSearchItemClick . bind ( this ) ) ;
item . appendChild ( button ) ;
this . searchList . appendChild ( item ) ;
}
} ;
netgis . Toolbar . prototype . onSearchItemClick = function ( e )
{
var button = e . target ;
var title = button . dataset . title ;
var minx = Number . parseFloat ( button . dataset . minx ) ;
var miny = Number . parseFloat ( button . dataset . miny ) ;
var maxx = Number . parseFloat ( button . dataset . maxx ) ;
var maxy = Number . parseFloat ( button . dataset . maxy ) ;
this . client . invoke ( netgis . Events . MAP _SET _EXTENT , { minx : minx , miny : miny , maxx : maxx , maxy : maxy } ) ;
//this.searchInput.value = title;
this . searchValue = title ;
} ;
netgis . Toolbar . prototype . updateBuffer = function ( )
{
var inputs = this . toolbars [ netgis . Modes . BUFFER _FEATURE _EDIT ] . getElementsByTagName ( "input" ) ;
var radius = Number . parseFloat ( inputs [ 0 ] . value ) ;
var segments = Number . parseInt ( inputs [ 1 ] . value ) ;
this . client . invoke ( netgis . Events . BUFFER _CHANGE , { radius : radius , segments : segments } ) ;
} ;
netgis . Toolbar . prototype . onBufferChange = function ( e )
{
this . updateBuffer ( ) ;
} ;
netgis . Toolbar . prototype . onBufferKeyUp = function ( e )
{
var key = e . keyCode ;
// Enter
//if ( key === 13 )
{
this . updateBuffer ( ) ;
}
} ;
netgis . Toolbar . prototype . onBufferAccept = function ( e )
{
this . client . invoke ( netgis . Events . BUFFER _ACCEPT , null ) ;
//this.setMode( netgis.Modes.VIEW );
this . client . invoke ( netgis . Events . SET _MODE , netgis . Modes . VIEW ) ;
} ;
netgis . Toolbar . prototype . onBufferCancel = function ( e )
{
this . client . invoke ( netgis . Events . BUFFER _CANCEL , null ) ;
//this.setMode( netgis.Modes.VIEW );
this . client . invoke ( netgis . Events . SET _MODE , netgis . Modes . VIEW ) ;
} ;
netgis . Toolbar . prototype . onSnapChange = function ( e )
{
var input = e . target ;
var on = input . checked ;
this . toolbars [ netgis . Modes . DRAW _POINTS ] . getElementsByTagName ( "input" ) [ 0 ] . checked = on ;
this . toolbars [ netgis . Modes . DRAW _LINES ] . getElementsByTagName ( "input" ) [ 0 ] . checked = on ;
this . toolbars [ netgis . Modes . DRAW _POLYGONS ] . getElementsByTagName ( "input" ) [ 0 ] . checked = on ;
this . client . invoke ( on ? netgis . Events . SNAP _ON : netgis . Events . SNAP _OFF , null ) ;
2023-01-31 16:26:59 +01:00
} ;
netgis . Toolbar . prototype . onTracingChange = function ( e )
{
var input = e . target ;
var on = input . checked ;
var snapInput = this . toolbars [ netgis . Modes . DRAW _POLYGONS ] . getElementsByTagName ( "input" ) [ 0 ] ;
var snap = snapInput . checked ;
if ( on && ! snap )
{
snapInput . checked = on ;
this . client . invoke ( netgis . Events . SNAP _ON , null ) ;
}
this . client . invoke ( on ? netgis . Events . TRACING _ON : netgis . Events . TRACING _OFF , null ) ;
} ;
netgis . Toolbar . prototype . onDrawBufferChange = function ( e )
{
var input = e . target ;
var on = input . checked ;
this . toolbars [ netgis . Modes . DRAW _POINTS ] . getElementsByTagName ( "input" ) [ 1 ] . checked = on ;
this . toolbars [ netgis . Modes . DRAW _LINES ] . getElementsByTagName ( "input" ) [ 1 ] . checked = on ;
this . client . invoke ( on ? netgis . Events . DRAW _BUFFER _ON : netgis . Events . DRAW _BUFFER _OFF , null ) ;
this . showDrawBufferOptions ( on ) ;
} ;
netgis . Toolbar . prototype . onDrawBufferRadiusChange = function ( e )
{
var input = e . target ;
var radius = Number . parseFloat ( input . value ) ;
this . client . invoke ( netgis . Events . DRAW _BUFFER _RADIUS _CHANGE , radius ) ;
var pointsInput = this . toolbars [ netgis . Modes . DRAW _POINTS ] . getElementsByTagName ( "input" ) [ 2 ] ;
if ( input !== pointsInput ) pointsInput . value = radius ;
var linesInput = this . toolbars [ netgis . Modes . DRAW _LINES ] . getElementsByTagName ( "input" ) [ 2 ] ;
if ( input !== linesInput ) linesInput . value = radius ;
} ;
netgis . Toolbar . prototype . onDrawBufferSegmentsChange = function ( e )
{
var input = e . target ;
var segs = Number . parseInt ( input . value ) ;
this . client . invoke ( netgis . Events . DRAW _BUFFER _SEGMENTS _CHANGE , segs ) ;
var pointsInput = this . toolbars [ netgis . Modes . DRAW _POINTS ] . getElementsByTagName ( "input" ) [ 3 ] ;
if ( input !== pointsInput ) pointsInput . value = segs ;
var linesInput = this . toolbars [ netgis . Modes . DRAW _LINES ] . getElementsByTagName ( "input" ) [ 3 ] ;
if ( input !== linesInput ) linesInput . value = segs ;
} ;
netgis . Toolbar . prototype . showDrawBufferOptions = function ( on )
{
var pointsItems = this . toolbars [ netgis . Modes . DRAW _POINTS ] . children [ 0 ] . children ;
var linesItems = this . toolbars [ netgis . Modes . DRAW _LINES ] . children [ 0 ] . children ;
if ( on )
{
pointsItems [ 3 ] . classList . remove ( "netgis-hide" ) ;
pointsItems [ 4 ] . classList . remove ( "netgis-hide" ) ;
linesItems [ 3 ] . classList . remove ( "netgis-hide" ) ;
linesItems [ 4 ] . classList . remove ( "netgis-hide" ) ;
}
else
{
pointsItems [ 3 ] . classList . add ( "netgis-hide" ) ;
pointsItems [ 4 ] . classList . add ( "netgis-hide" ) ;
linesItems [ 3 ] . classList . add ( "netgis-hide" ) ;
linesItems [ 4 ] . classList . add ( "netgis-hide" ) ;
}
2022-09-12 13:12:59 +02:00
} ;