$( function() {
var queryextent = [-599285, -1156151, -599085, -1155951];
var extent = [-616505, -1184624, -564361, -1142799];
var bbox = queryextent.length > 0 ? queryextent : extent;
var size = [ 250, 201];
var publicUrl = "https://dpp.brno.cz/mapy".replace("\\", "/");
var tooltipPosition = "bottom";
var overview_max_scale = getScale( -616505, -564361, 250 );
var options = extend( {
map: {
services: [],
padding: [ 32, 36, 37, 25 ]
},
controls: {
zoom: {
visible: true,
type: "buttons"
},
basemap: {
visible: false,
labels: {
title: "Změnit mapu",
offline: "Offline režim",
online: "Online režim"
}
},
scale: [
{
type: "graphic",
visible: true,
maxWidth: 150
}
],
attribution: {
visible: true,
prefix: "Powered by Hydrosoft Veleslavín",
showPrefix: true
},
overview: {
visible: true,
width: size[0],
height: size[1],
service: {
id: "overview",
url: "https://dpp.brno.cz/mapy?MAP=6076",
type: "webmap"
},
bbox: extent,
zoom: getZoom( overview_max_scale ),
labels: {
open: "Otevřít přehledku",
close: "Zavřít přehledku"
}
},
position: {
visible: false
},
fullscreen: {
visible: false,
tooltipPosition: tooltipPosition
}
},
widgets: {
legend: {
visible: true,
size: 250,
collapsed: $.hv.util.response().device.type === "Phone" ? true : false,
height: "100%",
hideBorder: true,
labels: {
title: "Legenda"
}
},
results: {
type: "tabs",
visible: true,
size: 228,
collapsed: true,
height: "100%",
itemsPerPage: 5,
hideBorder: true,
labels: {
title: "Výsledky",
table: {
pagerrangestring: " z ",
pagernextbuttonstring: "předchozí",
pagerpreviousbuttonstring: "následující"
},
buttons: {
zoom: "Přiblížit",
pan: "Posunout",
back: "Zpět",
details: "Podrobnosti"
},
loading: "načítá se",
noResults: "Nebyly nalezeny žádné objekty",
introduction: "Kliknutím do mapy získáte informace o objektech",
error: "Při dotazu došlo k chybě. Pokuste se dotaz zopakovat. Pokud problém přetvrvává, kontaktujte prosím administrátora aplikace."
}
},
initialExtent: {
visible: true,
labels: {
title: "Výchozí rozsah"
},
tooltipPosition: tooltipPosition
},
search: {
visible: false,
theme: theme,
width: 250,
tooltipPosition: tooltipPosition
},
info: {
visible: true,
theme: theme,
modes: [
{
type: "point",
title: "Bod"
},
{
type: "rectangle",
title: "Obdélník"
},
{
type: "circle",
title: "Kruh"
},
{
type: "polygon",
title: "Polygon"
},
{
type: "linestring",
title: "Linie"
}
],
tooltipPosition: tooltipPosition
},
link: {
visible: false,
items: [
{
title: "Nahlížení do KN",
icon: "hv-icon hv-icon-cuzk",
url: "http://nahlizenidokn.cuzk.cz/MapaIdentifikace.aspx?&x=<%=Math.round(x)%>&y=<%=Math.round(y)%>",
target: "nahlizenidokn"
}
],
tooltipPosition: tooltipPosition
},
query: {
visible: true,
labels: {
title: "Dotazy"
}
},
measure: {
visible: true,
secondaryCrs: "EPSG:4326",
labels: {
title: "Měření",
length: "Délka",
perimeter: "Obvod",
area: "Plocha",
point: {
description: "Klikněte do mapy pro zjištění souřadnic bodu."
},
line: {
description: "Klikněte do mapy a začnete kreslit čáru. Dvojklik kreslení ukončí."
},
polygon: {
description: "Klikněte do mapy a začnete kreslit polygon. Dvojklik kreslení ukončí."
}
}
},
print: {
visible: true,
defaults: {
name: "Objekty dPP"
},
service: "http://print.hydrosoft.cz",
placeholders: {
name: "Vložte název",
scale: "Zadejte měřítko"
},
labels: {
title: "Tisk",
name: "Název",
format: "Formát",
outputFormat: "Výstupní formát",
landscape: "na šířku",
portrait: "na výšku",
scale: "Měřítko",
edit: "upravit",
other: "Další údaje",
legend: "legenda",
search: "parametry hledání",
comment: "Komentář",
download: "Ke stažení",
print: "Tisknout"
}
},
switchApp: {
visible: true,
items: [],
labels: {
title: "Další mapové aplikace"
}
}
}
}, {
"map": {
"services": [
{
"id": "zm",
"alias": "Základní",
"type": "arcgis",
"url": "https://ags.cuzk.cz/ArcGIS1/rest/services/ZTM/MapServer",
"basemap": true,
"queryable": false,
"inLegend": false,
"style": {
"visibility": "visible",
"opacity": 1
},
"preview": "hvmap/styles/images/preview-zakladni.png",
"attr": "© 2024 ČÚZK",
"tilesType": "base-m",
"offline": {
"type": "arcgis",
"url": "https://ags.cuzk.cz/ArcGIS1/rest/services/ZTM/MapServer",
"attr": "© 2024 ČÚZK"
},
"opacitySlider": true
},
{
"id": "ortofoto",
"alias": "Ortofoto",
"type": "arcgis",
"url": "https://ags.cuzk.cz/ArcGIS1/rest/services/ORTOFOTO/MapServer",
"basemap": true,
"queryable": false,
"inLegend": false,
"style": {
"visibility": "hidden",
"opacity": 0.8
},
"preview": "hvmap/styles/images/preview-ortofoto.png",
"attr": "© 2024 ČÚZK",
"tilesType": "bing",
"offline": {
"type": "arcgis",
"url": "https://ags.cuzk.cz/ArcGIS1/rest/services/ORTOFOTO/MapServer",
"attr": "© 2024 ČÚZK"
},
"opacitySlider": true
},
{
"id": "katastralni",
"alias": "Katastrální",
"type": "wms",
"url": "https://services.cuzk.cz/wms/local-km-wms.asp",
"basemap": true,
"queryable": false,
"inLegend": false,
"visibleLayers": "parcelni_cisla,obrazy_parcel,hranice_parcel,dalsi_p_mapy",
"style": {
"visibility": "hidden"
},
"preview": "hvmap/styles/images/preview-katastr.png",
"attr": "© 2024 ČÚZK",
"offline": {
"type": "wms",
"url": "https://services.cuzk.cz/wms/local-km-wms.asp",
"attr": "© 2024 ČÚZK"
},
"opacitySlider": true
},
{
"id": "parcels",
"alias": "Parcely",
"type": "parcel",
"url": "https://ruian.hydrosoft.cz",
"inLegend": false
}
],
"tilingScheme": {
"tileWidth": 256,
"tileHeight": 256,
"pixelSizes": [
396.875793752,
185.2087037508,
92.6043518754,
52.9167725002,
39.6875793752,
26.4583862501,
19.8437896876,
13.2291931251,
6.6145965625,
5.29167725,
3.9687579375,
2.645838625,
1.9843789688,
1.3229193125,
0.9260435188,
0.529167725,
0.3968757938,
0.2645838625
],
"origin": [
-925000,
-920000
]
},
"theme": "fresh"
},
"controls": {
"basemap": {
"orientation": "horizontal",
"mode": "checkbox",
"labels": {
"offline": "přepnout na mapy ČÚZK",
"online": "přepnout na mapy ČÚZK-online"
}
},
"scale": [
{
"position": "bottom-left",
"type": "graphic"
},
{
"position": "bottom-left",
"type": "select"
}
],
"overview": {
"visible": true,
"theme": "fresh",
"position": "bottom-right",
"labels": {
"open": "Přehledka",
"close": "Zavřít"
}
},
"position": {
"visible": true,
"secondaryCrs": "WGS84"
},
"fullscreen": {
"visible": true
}
},
"widgets": {
"splitter": {
"labels": {
"open": "zobrazit"
}
},
"legend": {
"collapsed": false,
"highlightQueryable": true
},
"results": {
"theme": "fresh",
"type": "tabs",
"mapHighlight": true,
"symbol": {
"color": "rgb(255, 246, 141)",
"fill": "rgb(255, 246, 141)",
"fillOpacity": 0.2,
"stroke": "rgb(255, 246, 141)",
"strokeWidth": 3,
"borderRadius": 3,
"width": 20,
"height": 20,
"opacity": 0.8
},
"symbolHighlight": {
"color": "red",
"fill": "red",
"fillOpacity": 0.2,
"stroke": "red",
"strokeWidth": 4
}
},
"print": {
"visible": true,
"service": "https://print.hydrosoft.cz"
},
"search": {
"visible": true,
"theme": "fresh",
"items": [
{
"title": "Vyhledat obec",
"description": "dle názvu nebo ICOB",
"placeHolder": "Zadat název obce nebo ICOB",
"type": "query",
"layers": "csu_obce_hr",
"query": "NAZ_OBEC_P like '%<%=value%>%' or KOD_OBEC_P = '<%=value%>' ",
"suggest": {
"minLength": 3,
"label": "<%=NAZ_OBEC_P%> (<%=NAZ_ORP%>)",
"value": "NAZ_OBEC_P",
"identifier": "KOD_OBEC_P"
}
},
{
"title": "Fulltextové vyhledávání",
"description": "do všech vrstev v mapě",
"placeHolder": "Zadat hledaný řetězec",
"type": "fulltext"
},
{
"title": "Parcely",
"description": "Vyhledání parcely",
"placeHolder": "Zadejte kat. území a číslo parcely",
"type": "parcel",
"service": "parcels"
},
{
"title": "Vyhledat ohrožený objekt",
"description": "dle názvu nebo toku",
"placeHolder": "Zadat název nebo tok",
"type": "query",
"service": "obj_dpp",
"layers": "ohrozene",
"query": "NM LIKE '%<%=value%>%' OR TOKDS = '<%=value%>'",
"suggest": {
"minLength": 3,
"label": "<%=NM%> ",
"value": "NM",
"identifier": "OBJ_ID"
}
}
],
"width": "350",
"selected": 0,
"hideMenu": "onExecute"
},
"switchApp": {
"visible": true,
"items": [
{
"icon": "glyphicons glyphicons-buoy",
"title": "Hlásné profily",
"url": "?IFRAME=1&TMPL=HVMAP_MAIN&LOGOM=mzp&MAP=hlas_prof&MU=001&CHARSET=utf-8&MIMETYPE=text%2Fhtml%3Bcharset%3Dutf-8&lat=15.5232093&lon=49.800511&z=3870730"
},
{
"icon": "glyphicons glyphicons-open-water",
"title": "Vodní toky a díla",
"url": "?IFRAME=1&TMPL=HVMAP_MAIN&LOGOM=mzp&MAP=toky&MU=001&CHARSET=utf-8&MIMETYPE=text%2Fhtml%3Bcharset%3Dutf-8"
},
{
"icon": "glyphicons glyphicons-flood",
"title": "Záplavová území",
"url": "?IFRAME=1&TMPL=HVMAP_MAIN&LOGOM=mzp&MAP=toky&MU=001&CHARSET=utf-8&MIMETYPE=text%2Fhtml%3Bcharset%3Dutf-8"
},
{
"icon": "glyphicons glyphicons-weather-warning",
"title": "Objekty dPP",
"url": "?IFRAME=1&TMPL=HVMAP_MAIN&LOGOM=mzp&MAP=obj_dpp&MU=001&CHARSET=utf-8&MIMETYPE=text%2Fhtml%3Bcharset%3Dutf-8&lat=15.4284572&lon=49.8823337&z=3870730"
}
],
"onFullscreenOn": "visible",
"onFullscreenOff": "hidden",
"labels": {
"title": "Mapové pohledy"
}
},
"query": {
"visible": true,
"labels": {
"title": "Dotaz"
}
},
"link": {
"visible": true
}
}
});
var services = [];
var hasOffline = false;
$.each( options.map.services, function( index, service ) {
var preview = service.preview ? service.preview.replace("\\", "/") : null;
if (preview && publicUrl) {
if (!publicUrl.endsWith("/") && !preview.startsWith("/")) {
service.preview = publicUrl + "/" + preview;
} else {
service.preview = publicUrl + preview;
}
}
if ( service.offline ) {
hasOffline = true;
}
if ( isOffline ) {
var offlineService = service.offline;
if ( service.offline ) {
services.push( $.extend( true, service, offlineService ) );
}
} else {
services.push( service );
}
} );
options.map.services = services;
options.controls.basemap.offline = {
url: hasOffline ? offlineUrl + "&OFFLINE=<%=status%>" : null,
status: isOffline ? "offline" : "online"
};
var theme = options.map.theme;
var coords;
var arrow = 1;
$( "#hvmap" ).jqxDockPanel( {
width: "100%",
height: "100%",
theme: theme
} );
var mainContainer = $( "#hvmap > .innerContainer > div:last-child" );
var availWidgets = [ "legend", "query", "measure", "print" ];
if ( options.widgets.results.type === "list" ) {
availWidgets.push("results");
}
var navWidgets = [];
$.each( options.widgets, function( name, options ) {
if ( $.inArray( name, availWidgets ) !== -1 && options.visible ) {
navWidgets.push( name );
}
} );
if ( navWidgets.length > 0 ) {
var navigationSplitter = $( "
" ).attr( "id", "navigationSplitter" ).appendTo( mainContainer );
navigationSplitter.append( $( "
" ) );
navigationSplitter.append( $( "
" ) );
if ( options.widgets.results.visible && options.widgets.results.type === "tabs" ) {
var resultsSplitter = addResults( navigationSplitter.find( "div:first-child" ) );
resultsSplitter.find( " > div:first-child" ).attr( "id", "map" );
resultsSplitter.find( " > div:last-child" ).attr( "id", "results" );
}
else {
navigationSplitter.find( " > div:first-child" ).attr( "id", "map" );
if ( options.widgets.results.type === "list" ) {
resultsSplitter = navigationSplitter;
}
}
var mapSize = options.widgets.legend.size ? 100 - options.widgets.legend.size : 90;
navigationSplitter.collapsePanel( $.extend( {}, options.widgets.splitter ? options.widgets.splitter : {}, {
width: "100%",
height: "100%",
display: $.hv.util.response().device.type === "Phone" ? "overlay" : "push",
panels: [
{
collapsible: false
},
$.extend( {}, options.widgets.legend, { collapsible: true } )
],
theme: theme
} ) );
var navigation = $( "
" ).attr( "id", "navigation" ).appendTo( navigationSplitter.find( " > div:last-child" ) );
$.each( navWidgets, function( index, name ) {
navigation.append( $( "
" ).text( options.widgets[ name ].labels.title ) );
var content = $( "
" );
content.append( $( "
" ).attr( "id", name ) );
navigation.append( content );
} );
navigation = $( "#navigation" ).jqxNavigationBar( {
height: "100%",
width: "100%",
expandMode: "singleFitHeight",
theme: theme
} );
if ( options.widgets.results.visible ) {
createResults( resultsSplitter, options.widgets.results );
}
} else if ( options.widgets.results.visible ) {
var resultsSplitter = addResults( mainContainer );
resultsSplitter.find( "div:first-child" ).attr( "id", "map" );
resultsSplitter.find( "div:last-child" ).attr( "id", "results" );
createResults( resultsSplitter, options.widgets.results );
}
var service = {
id: "obj_dpp",
alias: "Objekty dPP",
url: "https://dpp.brno.cz/mapy?IFRAME=1&LOGO=551244&MAP=obj_dpp&CF_ARROW=1&MU=001",
printUrl: undefined,
quality: 100,
type: "webmap",
visibleLayers: "*sekm",
merged: false,
expanded: true,
expandChildren: undefined,
opacitySlider: false
};
//if ( arrow ) {
// service.arrow = arrow;
// service.x = null;
// service.y = null;
//}
options.map.services.push( service );
options.map.crs = "EPSG:5514";
options.map.drawStyle = $.extend( true, {
color: "red",
fill: "black"
}, options.map.drawStyle );
if ( coords ) {
options.map.center = {
type: "Point",
coordinates: coords,
crs: {"type":"name","properties":{"name":"EPSG:5514"}}
};
} else {
options.map.bbox = bbox;
}
var maxScale = 1000;
if ( options.map.tilingScheme ) {
options.map.zoom = getZoom( 0.0002, options.map.tilingScheme, "nearest" );
if ( maxScale ) {
options.map.zoomMax = getZoom( maxScale, options.map.tilingScheme );
}
} else {
options.map.bboxMax = extent;
options.map.zoom = getZoom( 0.0002, null, "nearest" );
if ( maxScale ) {
options.map.zoomMax = getZoom( maxScale );
}
}
var map = $( "#map" ).hvmap( options.map );
var basemapCount = 0;
$.each( options.map.services, function( index, service ) {
if ( service.basemap ) {
basemapCount++;
}
});
if ( basemapCount > 0 ) {
options.controls.basemap.visible = true;
}
if ( options.controls.zoom.visible ) {
$.hv.control.zoom( options.controls.zoom ).addToMap( map );
}
if ( options.controls.fullscreen.visible ) {
$.hv.control.fullscreen( $.extend( options.controls.fullscreen, {
container: navWidgets.length > 0 ? $( "#navigationSplitter" ) : $( "#resultsSplitter" )
} ) ).addToMap( map );
}
if ( options.controls.basemap.visible ) {
$.hv.control.basemap( options.controls.basemap ).addToMap( map );
}
$.each( options.controls.scale, function( index, scale ) {
$.hv.control.scale( scale ).addToMap( map );
} );
if ( options.controls.attribution.visible ) {
if ( !options.controls.attribution.showPrefix ) {
options.controls.attribution.prefix = null;
}
$.hv.control.attribution( options.controls.attribution ).addToMap( map );
}
if ( options.controls.overview.visible ) {
$.hv.control.overview( options.controls.overview ).addToMap( map );
}
if ( options.controls.position.visible ) {
$.hv.control.position( options.controls.position ).addToMap( map );
}
if ( options.widgets.legend.visible ) {
$( "#legend" ).legend( $.extend( options.widgets.legend, {
map: map
} ) );
}
if ( options.widgets.results.visible ) {
$( "#results" ).results( $.extend( options.widgets.results, {
map: map
} ) );
}
var max_scale = Math.max( getScale( -1184624, -1142799, $( "#map" ).height() ), getScale( -616505, -564361, $( "#map" ).width() ) );
if ( options.widgets.initialExtent.visible ) {
var initialExtent = $( "
" );
initialExtent.initialExtent( $.extend( options.widgets.initialExtent, {
map: map,
center: {
type: "Point",
coordinates: [-590433, -1163711.5],
crs: {"type":"name","properties":{"name":"EPSG:5514"}}
},
zoom: options.map.tilingScheme ? getZoom( max_scale, options.map.tilingScheme, "smaller" ) : getZoom( max_scale ),
theme: theme
} ) ).addToMap( map );
}
var toolbar = $( "#toolbar" ).toolbar( {
theme: theme
} ).addToMap( map );
if ( options.widgets.results.visible && options.widgets.info.visible ) {
var info = $( "
" ).attr( "id", "info" ).appendTo( $( "body" ) );
info.info( $.extend( options.widgets.info, {
map: map,
results: $( "#results" )
} ) ).addToToolbar( toolbar );
info.on( "infoexecute", function( e ) {
resultsSplitter.collapsePanel( "expand" );
if ( options.widgets.results.type === "list" ) {
navigation.jqxNavigationBar( "expandAt", navWidgets.indexOf( "results" ) );
}
} );
}
if ( options.widgets.link.visible && options.widgets.link.items.length > 0 ) {
var button = $( "
" ).attr( "id", "link" );
var link = button.appendTo( $( "body" ) );
link.link( $.extend( options.widgets.link, {
map: map,
theme: theme
} ) ).addToToolbar( toolbar );
}
$( "#info" ).on( "infoturnon", function () {
$( "#link" ).link( "turnoff" );
} );
$( "#link" ).on( "linkturnon", function () {
$( "#info" ).info( "turnoff" );
} );
if ( options.widgets.results.visible && options.widgets.search.visible ) {
var search = $( "
" ).attr( "id", "search" ).appendTo( $( "body" ) );
if ( options.widgets.search.items && options.widgets.search.items.length > 0 ) {
for ( var index in options.widgets.search.items ) {
var item = options.widgets.search.items[index];
if ( item.type === "query" ) {
options.widgets.search.items[index] = extend( {
service: "obj_dpp"
}, options.widgets.search.items[index] );
}
}
}
search.search( $.extend( options.widgets.search, {
map: map,
results: $( "#results" )
} ) ).addToToolbar( toolbar );
search.on( "searchexecute", function( e ) {
$( "#info" ).info( "empty" );
resultsSplitter.collapsePanel( "expand" );
if ( options.widgets.results.type === "list" ) {
navigation.jqxNavigationBar( "expandAt", navWidgets.indexOf( "results" ) );
}
} );
search.on( "searchempty", function( e ) {
$( "#results" ).results( "empty" );
resultsSplitter.collapsePanel( "collapse" );
} );
}
if ( options.widgets.query.visible ) {
var icon = $( "
" ).addClass( "hv-icon" ).addClass( "hv-icon-query" );
var text = $( "" ).addClass( "hv-label" ).text( options.widgets.query.labels.title );
var queryButton = $( "" ).addClass( "hv-button" );
queryButton.append( icon );
queryButton.append( text );
queryButton.jqxToggleButton( {
width: "auto",
theme: theme,
toggled: navWidgets.indexOf( "query" ) === 0 ? true : false
} ).addToToolbar( toolbar );
var query = $( "#query" ).query( $.extend( options.widgets.query, {
map: map,
results: $( "#results" )
} ) );
query.on( "queryexecute", function( e ) {
resultsSplitter.collapsePanel( "expand" );
if ( options.widgets.results.type === "list" ) {
navigation.jqxNavigationBar( "expandAt", navWidgets.indexOf( "results" ) );
}
} );
queryButton.on( "click", function() {
toolbar.toolbar( "close" );
if ( navigationSplitter.collapsePanel( "option", "collapsed" ) ) {
navigationSplitter.collapsePanel( "expand" );
}
if ( queryButton.jqxToggleButton( "toggled" ) ) {
navigation.jqxNavigationBar( "expandAt", navWidgets.indexOf( "query" ) );
} else {
navigation.jqxNavigationBar( "expandAt", 0 );
}
} );
navigation.on( "expandingItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "query" ) ) {
queryButton.jqxToggleButton( "toggled", true );
}
} );
navigation.on( "collapsingItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "query" ) ) {
queryButton.jqxToggleButton( "toggled", false );
}
} );
navigation.on( "expandedItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "query" ) ) {
query.query( "refresh" );
}
} );
}
if ( options.widgets.measure.visible ) {
var icon = $( "
" ).addClass( "hv-icon" ).addClass( "hv-icon-measure" );
var text = $( "" ).addClass( "hv-label" ).text( options.widgets.measure.labels.title );
var measureButton = $( "" ).addClass( "hv-button" );
measureButton.append( icon );
measureButton.append( text );
measureButton.jqxToggleButton( {
width: "auto",
theme: theme,
toggled: navWidgets.indexOf( "measure" ) === 0 ? true : false
} ).addToToolbar( toolbar );
var measure = $( "#measure" ).measure( $.extend( options.widgets.measure, {
map: map
} ) );
if ( navWidgets.indexOf( "measure" ) === 0 ) {
measure.measure( "start" );
}
measureButton.on( "click", function() {
toolbar.toolbar( "close" );
if ( navigationSplitter.collapsePanel( "option", "collapsed" ) ) {
navigationSplitter.collapsePanel( "expand" );
}
if ( measureButton.jqxToggleButton( "toggled" ) ) {
navigation.jqxNavigationBar( "expandAt", navWidgets.indexOf( "measure" ) );
} else {
navigation.jqxNavigationBar( "expandAt", 0 );
}
} );
navigation.on( "expandingItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "measure" ) ) {
measureButton.jqxToggleButton( "toggled", true );
measure.measure( "start" );
}
} );
navigation.on( "collapsingItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "measure" ) ) {
measureButton.jqxToggleButton( "toggled", false );
measure.measure( "stop" );
}
} );
}
if ( options.widgets.print.visible ) {
var icon = $( "
" ).addClass( "hv-icon" ).addClass( "hv-icon-print" );
var text = $( "" ).addClass( "hv-label" ).text( options.widgets.print.labels.title );
var printButton = $( "" ).addClass( "hv-button" );
printButton.append( icon );
printButton.append( text );
printButton.jqxToggleButton( {
width: "auto",
theme: theme,
toggled: navWidgets.indexOf( "print" ) === 0 ? true : false
} ).addToToolbar( toolbar );
var print = $( "#print" ).print( $.extend( options.widgets.print, {
map: map
} ) );
if ( navWidgets.indexOf( "print" ) === 0 ) {
print.print( "showPrintArea" );
}
printButton.on( "click", function() {
toolbar.toolbar( "close" );
if ( navigationSplitter.collapsePanel( "option", "collapsed" ) ) {
navigationSplitter.collapsePanel( "expand" );
}
if ( printButton.jqxToggleButton( "toggled" ) ) {
navigation.jqxNavigationBar( "expandAt", navWidgets.indexOf( "print" ) );
} else {
navigation.jqxNavigationBar( "expandAt", 0 );
}
} );
navigation.on( "expandingItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "print" ) ) {
printButton.jqxToggleButton( "toggled", true );
print.print( "showPrintArea" );
}
} );
navigation.on( "collapsingItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "print" ) ) {
printButton.jqxToggleButton( "toggled", false );
print.print( "hidePrintArea" );
}
} );
}
if ( options.widgets.switchApp.visible && options.widgets.switchApp.items.length > 0 ) {
var button = $( "
" ).attr( "id", "switchApp" );
var switchApp = button.appendTo( $( "body" ) );
switchApp.switchApp( $.extend( options.widgets.switchApp, {
map: map,
theme: theme
} ) ).addToToolbar( toolbar );
}
var ts = "sekm";
var qy = "C%5BZATEZ_ID%5DE11646001";
var qi = "-1";
if (ts && qy) {
var mapservices = map.hvmap( "option", "mapservices" );
var layers = mapservices[ service.id ].getLayers();
if ( layers !== undefined ) {
executeQuery( ts, qy, qi );
} else {
mapservices[ service.id ].on( "layersloaded", function() {
executeQuery( ts, qy, qi );
} );
}
}
function executeQuery( ts, qy, qi ) {
var query = $.hv.task.query( {
map: map,
results: $( "#results" ),
autoZoom: false
} );
resultsSplitter.collapsePanel( "expand" );
if ( options.widgets.results.type === "list" ) {
navigation.jqxNavigationBar( "expandAt", navWidgets.indexOf( "results" ) );
}
query.execute( ts, qy, qi );
}
function getZoom( scale, tilingScheme, type ) {
var pixelSize = scale * 0.0002645833;
var zoom;
if ( scale ) {
if ( tilingScheme ) {
var pixelSizes = tilingScheme.pixelSizes;
var index;
for ( index in pixelSizes ) {
if ( pixelSizes[index] < pixelSize ) {
switch ( type ) {
case "nearest":
zoom = pixelSizes[index - 1] - pixelSize < pixelSize - pixelSizes[index] ? index - 1 : index;
break;
case "smaller":
zoom = index - 1;
break;
default:
zoom = index;
break;
}
break;
}
}
if ( zoom === undefined ) {
zoom = pixelSizes.length - 1;
}
} else {
var basePixelSize = 156543.03392799936;
var index;
index = Math.floor( Math.log( basePixelSize / pixelSize ) / Math.log( 2 ) );
switch ( type ) {
case "nearest":
zoom = basePixelSize / Math.pow( 2, index - 1 ) - pixelSize < pixelSize - basePixelSize / Math.pow( 2, index ) ? index - 1 : index;
break;
case "smaller":
zoom = index - 1;
break;
default:
zoom = index;
break;
}
}
}
return typeof zoom === "undefined" ? zoom : parseInt( zoom, 10 );
}
function addResults( container ) {
var resultsSplitter = $( "
" ).attr( "id", "resultsSplitter" ).appendTo( container );
resultsSplitter.append( $( "
" ) );
resultsSplitter.append( $( "
" ) );
return resultsSplitter;
}
function createResults( container, settings ) {
if ( options.widgets.results.type === "tabs" ) {
var mapSize = options.size ? 100 - options.size : 90;
container.collapsePanel( $.extend( {}, options.widgets.splitter ? options.widgets.splitter : {}, {
width: "100%",
height: "100%",
orientation: "horizontal",
panels: [
{
collapsible: false
},
$.extend( {}, settings, { collapsible: true } )
],
theme: theme
} ) );
}
else {
$( "#results" ).css("height", "100%");
navigation.on( "expandedItem", function ( event ) {
if ( event.args.item === navWidgets.indexOf( "results" ) ) {
$( "#results" ).results( "show" );
$( "#info" ).info( "show" );
}
else {
$( "#results" ).results( "hide" );
$( "#info" ).info( "hide" );
}
} );
}
resultsSplitter.on( "collapsepanelcollapsed", function() {
$( "#results" ).results( "hide" );
$( "#info" ).info( "hide" );
});
resultsSplitter.on( "collapsepanelexpanded", function() {
$( "#results" ).results( "show" );
$( "#info" ).info( "show" );
});
}
function getScale( min, max, size ) {
return ( max - min ) / ( size * 0.0002645833 ) * 1;
}
function extend( master, child ) {
$.each( child, function( name, item ) {
if ( $.isPlainObject( item ) && master[ name ] !== undefined ) {
master[ name ] = extend( master[ name ], item );
//} else if ( $.isArray( item ) ) {
// master[ name ] = item;
} else {
master[ name ] = item;
}
} );
return master;
}
function decode( name, dataString ) {
var data = JSON.parse( dataString );
if ( data.map && data.map.services ) {
var services = [];
$.each( data.map.services, function( index, service ) {
services.push( service );
} );
data.map.services = services;
}
if ( $.isEmptyObject( data ) ) {
return data;
} else {
return data[ name ];
}
}
} );
String.prototype.startsWith = function(prefix) {
return this.indexOf(prefix, 0) === 0;
};
String.prototype.endsWith = function(suffix) {
return this.indexOf(suffix, this.length - suffix.length) !== -1;
};