diff --git a/CHANGELOG.md b/CHANGELOG.md index c7ce442d16..6688b6d4f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +* **v.3.0.6.2** - 2017-07-20 + - Fix create legend URL + - Merge pull request #572 from mapbender/fix/wrong-scaleHint-in-sublayers + - Fix layer instance administration form sizes Closes: #559 + - Merge pull request #545 from mapbender/hotfix/imagepathCommand-530 + - Merge pull request #553 from mapbender/hotfix/featureinfo-print-trans-button + - Add output for better UX + - Revert commit d11dd2fd1bde139225a388ddb6d125cb24562260 + - Merge pull request #570 from mapbender/fix/ruler-unmatching-value-app-backend + - Reverse to old getScaleRecursive-function in WmsLayerSource because of regression bug. Now correct scale and scale hint for sublayer are set + - Change default value for immediate messurment to null and add check if value is set + - Merge pull request #563 from mapbender/hotfix/epsg-code-list + - added EPSG:4839 and EPSG:5243 to the list + - changed trans variable for print button mb.core.featureinfo.popup.btn.print + - changed trans variable for print button mb.core.featureinfo.error.noresult + - Fix FeatureInfo print translations + - Fix initialize search router Closes: #543 + - Added Command to update old imagepath of map element / Fix OpenLayers2 image path #530 + - Merge pull request #551 from mapbender/fix/search-router-autoclose-after-click + - remove 'move' check on click event + - Add spaces behind foreach and if to satisfy code quality standards + - Remove unused element generator code. Add documentation + - Added reverse axis default for EPSG:31466 + * **v.3.0.6.1** - 2017-05-24 - PrintService/ImageExport: Accept all kinds of image/jpeg and image/gif from wms - Refactor print scale bugfix @@ -17,7 +41,6 @@ - Fix WmsLayerSource modificators - Fix save Style, VendorSpecific and WmsLayerSource entities - * **v3.0.6.0** - 2017-05-05 - Fix transalate element titles by import Closes: https://github.com/mapbender/mapbender-starter/issues/46 diff --git a/src/Mapbender/CoreBundle/Command/DatabaseUpgradeCommand.php b/src/Mapbender/CoreBundle/Command/DatabaseUpgradeCommand.php new file mode 100644 index 0000000000..4c25e0d8b1 --- /dev/null +++ b/src/Mapbender/CoreBundle/Command/DatabaseUpgradeCommand.php @@ -0,0 +1,77 @@ +setHelp('The mapbender:database:upgrade command updates the Datesbase to the new schema of mapbender version 3.0.6') + ->setName('mapbender:database:upgrade') + ->setDescription('Updates database scheme'); + } + + + /** + * Execute command + * @Todo Add logic to execute different action depended on the used MB3 Version + * @param InputInterface $input + * @param OutputInterface $output + * @return int|null|void + */ + + protected function execute(InputInterface $input, OutputInterface $output) { + $this->changeMapsImagePath($input, $output); + } + + /** + * Change imagesPath configuration value from all MB3 map elements in the database + * from "bundles/mapbendercore/mapquery/lib/openlayers/img" + * to "components/mapquery/lib/openlayers/img" + */ + protected function changeMapsImagePath(InputInterface $input, OutputInterface $output){ + + /** + * @var EntityManager $em + * @var Element $map + */ + $doctrine=$this->getContainer()->get('doctrine'); + $em = $doctrine->getManager(); + $maps = $em->getRepository('MapbenderCoreBundle:Element')->findBy(array('class'=>'Mapbender\CoreBundle\Element\Map')); + $output->writeln('Updating map elements image path values'); + $output->writeln('Found ' . count($maps) . ' map elements'); + $progressBar = new ProgressBar($output, count($maps) ); + foreach ($maps as $map) { + $config = $map->getConfiguration(); + $progressBar->advance(); + if ($config['imgPath'] == 'bundles/mapbendercore/mapquery/lib/openlayers/img') { + $progressBar->setMessage('Found old image path'); + $config['imgPath']= 'components/mapquery/lib/openlayers/img'; + $map->setConfiguration($config); + $em->persist($map); + $progressBar->setMessage('Old image path successfully changed'); + } else { + $progressBar->setMessage('Map element already up-to-date'); + } + } + $em->flush(); + $progressBar->finish(); + $output->writeln(''); + $output->writeln('All image path values are now up-to-date'); + $output->writeln('Exiting now'); + } +} + diff --git a/src/Mapbender/CoreBundle/Element/FeatureInfo.php b/src/Mapbender/CoreBundle/Element/FeatureInfo.php index e1b7483bd4..bb05103ee9 100644 --- a/src/Mapbender/CoreBundle/Element/FeatureInfo.php +++ b/src/Mapbender/CoreBundle/Element/FeatureInfo.php @@ -110,10 +110,7 @@ public static function listAssets() 'css' => array( '@MapbenderCoreBundle/Resources/public/sass/element/featureinfo.scss' ), - 'trans' => array( - 'MapbenderCoreBundle:Element:featureinfo.json.twig', - 'MapbenderCoreBundle:Element:printclient.json.twig' - ) + 'trans' => array('MapbenderCoreBundle:Element:featureinfo.json.twig') ); } diff --git a/src/Mapbender/CoreBundle/Resources/proj4/proj4js_epsg.txt b/src/Mapbender/CoreBundle/Resources/proj4/proj4js_epsg.txt index a652fde310..51876fbf24 100644 --- a/src/Mapbender/CoreBundle/Resources/proj4/proj4js_epsg.txt +++ b/src/Mapbender/CoreBundle/Resources/proj4/proj4js_epsg.txt @@ -2452,6 +2452,8 @@ EPSG:4812|New Beijing / 3-degree Gauss-Kruger CM 132E|+proj=tmerc +lat_0=0 +lon_0=132 +k=1 +x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs EPSG:4822|New Beijing / 3-degree Gauss-Kruger CM 135E|+proj=tmerc +lat_0=0 +lon_0=135 +k=1 +x_0=500000 +y_0=0 +ellps=krass +units=m +no_defs EPSG:4826|WGS 84 / Cape Verde National|+proj=lcc +lat_1=15 +lat_2=16.66666666666667 +lat_0=15.83333333333333 +lon_0=-24 +x_0=161587.83 +y_0=128511.202 +datum=WGS84 +units=m +no_defs + EPSG:4839|ETRS89 / LCC Germany (N-E)|+proj=lcc +lat_1=48.66666666666666 +lat_2=53.66666666666666 +lat_0=51 +lon_0=10.5 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs + EPSG:5243|ETRS89 / LCC Germany (E-N)|+proj=lcc +lat_1=48.66666666666666 +lat_2=53.66666666666666 +lat_0=51 +lon_0=10.5 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs EPSG:20004|Pulkovo 1995 / Gauss-Kruger zone 4|+proj=tmerc +lat_0=0 +lon_0=21 +k=1 +x_0=4500000 +y_0=0 +ellps=krass +towgs84=24.82,-131.21,-82.66,-0,-0,0.16,-0.12 +units=m +no_defs EPSG:20005|Pulkovo 1995 / Gauss-Kruger zone 5|+proj=tmerc +lat_0=0 +lon_0=27 +k=1 +x_0=5500000 +y_0=0 +ellps=krass +towgs84=24.82,-131.21,-82.66,-0,-0,0.16,-0.12 +units=m +no_defs EPSG:20006|Pulkovo 1995 / Gauss-Kruger zone 6|+proj=tmerc +lat_0=0 +lon_0=33 +k=1 +x_0=6500000 +y_0=0 +ellps=krass +towgs84=24.82,-131.21,-82.66,-0,-0,0.16,-0.12 +units=m +no_defs diff --git a/src/Mapbender/CoreBundle/Resources/public/mapbender.element.featureInfo.js b/src/Mapbender/CoreBundle/Resources/public/mapbender.element.featureInfo.js index 927edd8ff4..74b3261ab5 100644 --- a/src/Mapbender/CoreBundle/Resources/public/mapbender.element.featureInfo.js +++ b/src/Mapbender/CoreBundle/Resources/public/mapbender.element.featureInfo.js @@ -413,7 +413,7 @@ if (options.printResult === true) { widget.popup.addButtons({ 'print': { - label: Mapbender.trans('mb.core.printclient.popup.btn.ok'), + label: Mapbender.trans('mb.core.featureinfo.popup.btn.print'), cssClass: 'button right', callback: function() { widget._printContent(); diff --git a/src/Mapbender/CoreBundle/Resources/public/mapbender.element.ruler.js b/src/Mapbender/CoreBundle/Resources/public/mapbender.element.ruler.js index e1a2928c98..7a9514de27 100644 --- a/src/Mapbender/CoreBundle/Resources/public/mapbender.element.ruler.js +++ b/src/Mapbender/CoreBundle/Resources/public/mapbender.element.ruler.js @@ -7,7 +7,7 @@ icon: undefined, label: true, group: undefined, - immediate: true, + immediate: null, persist: true, type: 'line', precision: 2 @@ -41,7 +41,7 @@ var handler = (this.options.type === 'line' ? OpenLayers.Handler.Path : OpenLayers.Handler.Polygon); - + var immediate = this.options.immediate || false; this.control = new OpenLayers.Control.Measure(handler, { callbacks: { modify: function(point, feature, drawing){ @@ -64,7 +64,7 @@ } }, persist: this.options.persist, - immediate: this.options.immediate, + immediate: immediate, geodesic: this._isGeodesic() }); diff --git a/src/Mapbender/CoreBundle/Resources/translations/messages.de.yml b/src/Mapbender/CoreBundle/Resources/translations/messages.de.yml index bc2429d4ac..ee28296a6a 100644 --- a/src/Mapbender/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Mapbender/CoreBundle/Resources/translations/messages.de.yml @@ -8,6 +8,7 @@ mb: popup: btn: ok: Schließen + print: Drucken class: title: Information description: Information diff --git a/src/Mapbender/CoreBundle/Resources/translations/messages.en.yml b/src/Mapbender/CoreBundle/Resources/translations/messages.en.yml index f7e71923d7..d69eae75c2 100644 --- a/src/Mapbender/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Mapbender/CoreBundle/Resources/translations/messages.en.yml @@ -8,6 +8,7 @@ mb: popup: btn: ok: Close + print: Print class: title: FeatureInfo description: FeatureInfo diff --git a/src/Mapbender/CoreBundle/Resources/translations/messages.es.yml b/src/Mapbender/CoreBundle/Resources/translations/messages.es.yml index 59e5a0eb76..4c5ae7dec2 100644 --- a/src/Mapbender/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Mapbender/CoreBundle/Resources/translations/messages.es.yml @@ -8,6 +8,7 @@ mb: popup: btn: ok: Cerrar + print: Imprimir class: title: FeatureInfo description: FeatureInfo diff --git a/src/Mapbender/CoreBundle/Resources/translations/messages.pt.yml b/src/Mapbender/CoreBundle/Resources/translations/messages.pt.yml index de292d421d..ab3b33cd7b 100644 --- a/src/Mapbender/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Mapbender/CoreBundle/Resources/translations/messages.pt.yml @@ -8,6 +8,7 @@ mb: popup: btn: ok: Fechar + print: Imprimir class: title: Informação description: Informação diff --git a/src/Mapbender/CoreBundle/Resources/translations/messages.ru.yml b/src/Mapbender/CoreBundle/Resources/translations/messages.ru.yml index fb2144d971..2d1813bb83 100644 --- a/src/Mapbender/CoreBundle/Resources/translations/messages.ru.yml +++ b/src/Mapbender/CoreBundle/Resources/translations/messages.ru.yml @@ -8,6 +8,7 @@ mb: popup: btn: ok: Закрыть + print: Печать class: title: Инфосвойства description: Инфосвойства diff --git a/src/Mapbender/CoreBundle/Resources/views/Element/featureinfo.json.twig b/src/Mapbender/CoreBundle/Resources/views/Element/featureinfo.json.twig index ebccf4154e..5250c30b2e 100644 --- a/src/Mapbender/CoreBundle/Resources/views/Element/featureinfo.json.twig +++ b/src/Mapbender/CoreBundle/Resources/views/Element/featureinfo.json.twig @@ -1,6 +1,7 @@ { "mb.core.metadata.popup.title": "{{ "mb.core.metadata.popup.title" | trans }}", "mb.core.featureinfo.popup.btn.ok": "{{ "mb.core.featureinfo.popup.btn.ok" | trans }}", +"mb.core.featureinfo.popup.btn.print": "{{ "mb.core.featureinfo.popup.btn.print" | trans }}", "mb.core.featureinfo.error.nolayer": "{{"mb.core.featureinfo.error.nolayer" | trans}}", "mb.core.featureinfo.error.noresult": "{{"mb.core.featureinfo.error.noresult" | trans}}" } diff --git a/src/Mapbender/ManagerBundle/Resources/public/sass/manager/services.scss b/src/Mapbender/ManagerBundle/Resources/public/sass/manager/services.scss index ea77a5a294..c36642c1e9 100644 --- a/src/Mapbender/ManagerBundle/Resources/public/sass/manager/services.scss +++ b/src/Mapbender/ManagerBundle/Resources/public/sass/manager/services.scss @@ -203,7 +203,26 @@ .checkboxColumn{text-align:center;} .odd{background-color:darken($contentColor, 6%);} - thead .checkboxColumn{padding:0px;} + &.table { + > thead > tr > .checkboxColumn { + padding-left: 2px; + padding-right: 2px; + } + > tbody > tr > td { + &.titleColumn { + width: 260px; + } + &.itemType { + padding-right: 0; + padding-left: 0; + } + &.minScaleColumn, + &.maxScaleColumn { + padding-left: 4px; + } + } + } + tbody{ .dropdown{min-width:100%;} .minScaleColumn, .maxScaleColumn, .styleColumn{width:80px;} diff --git a/src/Mapbender/PrintBundle/Component/PrintService.php b/src/Mapbender/PrintBundle/Component/PrintService.php index 242d53ce4e..a0e09e03dc 100644 --- a/src/Mapbender/PrintBundle/Component/PrintService.php +++ b/src/Mapbender/PrintBundle/Component/PrintService.php @@ -838,8 +838,18 @@ private function getColor($color, $alpha, $image) } } + private function getResizeFactor() + { + if ($this->data['quality'] != 72) { + return $this->data['quality'] / 72; + } else { + return 1; + } + } + private function drawPolygon($geometry, $image) { + $resizeFactor = $this->getResizeFactor(); $style = $this->getStyle($geometry); foreach($geometry['coordinates'] as $ring) { if(count($ring) < 3) { @@ -871,7 +881,7 @@ private function drawPolygon($geometry, $image) $style['strokeColor'], $style['strokeOpacity'], $image); - imagesetthickness($image, $style['strokeWidth']); + imagesetthickness($image, $style['strokeWidth'] * $resizeFactor); imagepolygon($image, $points, count($ring), $color); } } @@ -879,6 +889,7 @@ private function drawPolygon($geometry, $image) private function drawMultiPolygon($geometry, $image) { + $resizeFactor = $this->getResizeFactor(); $style = $this->getStyle($geometry); foreach($geometry['coordinates'] as $element) { foreach($element as $ring) { @@ -911,7 +922,7 @@ private function drawMultiPolygon($geometry, $image) $style['strokeColor'], $style['strokeOpacity'], $image); - imagesetthickness($image, $style['strokeWidth']); + imagesetthickness($image, $style['strokeWidth'] * $resizeFactor); imagepolygon($image, $points, count($ring), $color); } } @@ -920,6 +931,7 @@ private function drawMultiPolygon($geometry, $image) private function drawLineString($geometry, $image) { + $resizeFactor = $this->getResizeFactor(); $style = $this->getStyle($geometry); $color = $this->getColor( $style['strokeColor'], @@ -928,7 +940,7 @@ private function drawLineString($geometry, $image) if ($style['strokeWidth'] == 0) { return; } - imagesetthickness($image, $style['strokeWidth']); + imagesetthickness($image, $style['strokeWidth'] * $resizeFactor); for($i = 1; $i < count($geometry['coordinates']); $i++) { @@ -954,6 +966,7 @@ private function drawLineString($geometry, $image) private function drawMultiLineString($geometry, $image) { + $resizeFactor = $this->getResizeFactor(); $style = $this->getStyle($geometry); $color = $this->getColor( $style['strokeColor'], @@ -962,37 +975,35 @@ private function drawMultiLineString($geometry, $image) if ($style['strokeWidth'] == 0) { return; } - imagesetthickness($image, $style['strokeWidth']); - - foreach($geometry['coordinates'] as $coords) { - - for($i = 1; $i < count($coords); $i++) { - - if($this->rotation == 0){ - $from = $this->realWorld2mapPos( - $coords[$i - 1][0], - $coords[$i - 1][1]); - $to = $this->realWorld2mapPos( - $coords[$i][0], - $coords[$i][1]); - }else{ - $from = $this->realWorld2rotatedMapPos( - $coords[$i - 1][0], - $coords[$i - 1][1]); - $to = $this->realWorld2rotatedMapPos( - $coords[$i][0], - $coords[$i][1]); - } - - imageline($image, $from[0], $from[1], $to[0], $to[1], $color); - } - } + imagesetthickness($image, $style['strokeWidth'] * $resizeFactor); + + foreach($geometry['coordinates'] as $coords) { + for($i = 1; $i < count($coords); $i++) { + if($this->rotation == 0){ + $from = $this->realWorld2mapPos( + $coords[$i - 1][0], + $coords[$i - 1][1]); + $to = $this->realWorld2mapPos( + $coords[$i][0], + $coords[$i][1]); + }else{ + $from = $this->realWorld2rotatedMapPos( + $coords[$i - 1][0], + $coords[$i - 1][1]); + $to = $this->realWorld2rotatedMapPos( + $coords[$i][0], + $coords[$i][1]); + } + imageline($image, $from[0], $from[1], $to[0], $to[1], $color); + } + } } private function drawPoint($geometry, $image) { $style = $this->getStyle($geometry); $c = $geometry['coordinates']; + $resizeFactor = $this->getResizeFactor(); if($this->rotation == 0){ $p = $this->realWorld2mapPos($c[0], $c[1]); @@ -1001,35 +1012,38 @@ private function drawPoint($geometry, $image) } if(isset($style['label'])){ - // draw label with white halo - $color = $this->getColor('#ff0000', 1, $image); - $bgcolor = $this->getColor('#ffffff', 1, $image); + // draw label with halo + $color = $this->getColor($style['fontColor'], 1, $image); + $bgcolor = $this->getColor($style['labelOutlineColor'], 1, $image); $fontPath = $this->resourceDir.'/fonts/'; $font = $fontPath . 'OpenSans-Bold.ttf'; - imagettftext($image, 14, 0, $p[0], $p[1]+1, $bgcolor, $font, $geometry['style']['label']); - imagettftext($image, 14, 0, $p[0], $p[1]-1, $bgcolor, $font, $geometry['style']['label']); - imagettftext($image, 14, 0, $p[0]-1, $p[1], $bgcolor, $font, $geometry['style']['label']); - imagettftext($image, 14, 0, $p[0]+1, $p[1], $bgcolor, $font, $geometry['style']['label']); - imagettftext($image, 14, 0, $p[0], $p[1], $color, $font, $style['label']); - //return; + + $fontSize = 10 * $resizeFactor; + imagettftext($image, $fontSize, 0, $p[0], $p[1]+$resizeFactor, $bgcolor, $font, $geometry['style']['label']); + imagettftext($image, $fontSize, 0, $p[0], $p[1]-$resizeFactor, $bgcolor, $font, $geometry['style']['label']); + imagettftext($image, $fontSize, 0, $p[0]-$resizeFactor, $p[1], $bgcolor, $font, $geometry['style']['label']); + imagettftext($image, $fontSize, 0, $p[0]+$resizeFactor, $p[1], $bgcolor, $font, $geometry['style']['label']); + imagettftext($image, $fontSize, 0, $p[0], $p[1], $color, $font, $style['label']); } - $radius = $style['pointRadius']; + $radius = $resizeFactor * $style['pointRadius']; // Filled circle if($style['fillOpacity'] > 0){ $color = $this->getColor( $style['fillColor'], $style['fillOpacity'], $image); - imagefilledellipse($image, $p[0], $p[1], 2*$radius, 2*$radius, $color); + imagesetthickness($image, 0); + imagefilledellipse($image, $p[0], $p[1], 2 * $radius, 2 * $radius, $color); } // Circle border - if ($style['strokeWidth'] > 0) { + if ($style['strokeWidth'] > 0 && $style['strokeOpacity'] > 0) { $color = $this->getColor( $style['strokeColor'], $style['strokeOpacity'], $image); - imageellipse($image, $p[0], $p[1], 2*$radius, 2*$radius, $color); + imagesetthickness($image, $style['strokeWidth'] * $resizeFactor); + imageellipse($image, $p[0], $p[1], 2 * $radius, 2 * $radius, $color); } } diff --git a/src/Mapbender/WmsBundle/Component/LegendUrl.php b/src/Mapbender/WmsBundle/Component/LegendUrl.php index ca461a4e03..9955e261a1 100644 --- a/src/Mapbender/WmsBundle/Component/LegendUrl.php +++ b/src/Mapbender/WmsBundle/Component/LegendUrl.php @@ -120,7 +120,7 @@ public static function create($width = null, $height = null, $legendURL = null; $onlineResource = $onlineResource === null ? OnlineResource::create() : $onlineResource; - if (!$onlineResource) { + if ($onlineResource) { $legendURL = new LegendUrl(); $legendURL->setWidth($width); $legendURL->setHeight($height); diff --git a/src/Mapbender/WmsBundle/Entity/WmsLayerSource.php b/src/Mapbender/WmsBundle/Entity/WmsLayerSource.php index 51519e5244..f72894c529 100644 --- a/src/Mapbender/WmsBundle/Entity/WmsLayerSource.php +++ b/src/Mapbender/WmsBundle/Entity/WmsLayerSource.php @@ -643,7 +643,7 @@ public function getMinScale($recursive = true) } if ($recursive && $value === null && $this->getParent()) { - $value = $this->getParent()->getMinScale($recursive); + $value = $this->getScaleRecursive()->getMin(); } $value === null ? null : floatval($value); @@ -667,7 +667,7 @@ public function getMaxScale($recursive = true) } if ($recursive && $value === null && $this->getParent()) { - $value = $this->getParent()->getMinScale($recursive); + $value = $this->getScaleRecursive()->getMax(); } $value === null ? null : floatval($value); @@ -682,7 +682,32 @@ public function getMaxScale($recursive = true) */ public function getScaleRecursive() { - return new MinMax($this->getMinScale(), $this->getMaxScale()); + $scale = $this->getScale(); + $parent = $this->getParent(); + + if (!$scale && !$parent) { + return new MinMax(); + } elseif (!$scale && $parent) { + $scale = $parent->getScale(); + } else { + $hasMin = $scale->getMin() !== null; + $hasMax = $scale->getMax() !== null; + if ((!$hasMin || !$hasMax) && $parent) { + $parentScale = $parent->getScale(); + if (!$parentScale) { + return new MinMax( + $hasMin ? $scale->getMin() : null, + $hasMax ? $scale->getMax() : null + ); + } + $scale = new MinMax( + $hasMin ? $scale->getMin() : $parentScale->getMin(), + $hasMax ? $scale->getMax() : $parentScale->getMax() + ); + } + } + //var_dump($scale->getMin() ); + return $scale; } /**