Opened 7 years ago

Last modified 5 years ago

#225 new defect

PrintPage does not deal correctly with a layout without a map

Reported by: bartvde Owned by:
Priority: major Milestone: future
Component: GeoExt Version: trunk
Keywords: Cc:
State: Needs Discussion

Description


Attachments (4)

ticket225.patch (2.4 KB) - added by bartvde 7 years ago.
Just to provide an idea of the problems encountered (not a serious patch as yet)
ticket225.jpg (148.3 KB) - added by bartvde 7 years ago.
screendump of the detaching issue
ticket225.2.patch (3.0 KB) - added by bartvde 7 years ago.
ticket225.3.patch (3.0 KB) - added by bartvde 7 years ago.
previous patch had a minor mistake

Download all attachments as: .zip

Change History (18)

Changed 7 years ago by bartvde

Just to provide an idea of the problems encountered (not a serious patch as yet)

comment:1 Changed 7 years ago by bartvde

Example JSON (the last layout "6 - Legenda" has no map):

{"scales":[{"name":"1:3,125","value":"3125"},{"name":"1:6,250","value":"6250"},{"name":"1:12,500","value":"12500"},{"name":"1:25,000","value":"25000"},{"name":"1:50,000","value":"50000"},{"name":"1:100,000","value":"100000"},{"name":"1:200,000","value":"200000"},{"name":"1:500,000","value":"500000"},{"name":"1:1,000,000","value":"1000000"},{"name":"1:2,000,000","value":"2000000"}],"dpis":[{"name":"150","value":"150"}],"layouts":[{"name":"1 - A4 Liggend","map":{"width":600,"height":510},"rotation":true},{"name":"2 - A4 Staand","map":{"width":497,"height":620},"rotation":true},{"name":"3 - A3 Liggend","map":{"width":825,"height":703},"rotation":true},{"name":"4 - A3 Staand","map":{"width":708,"height":882},"rotation":true},{"name":"5 - Kaart zonder legenda","map":{"width":595,"height":842},"rotation":false},{"name":"6 - Legenda","rotation":false}],"printURL":"http://145.50.148.45:8080/print/pdf/print.pdf","createURL":"http://145.50.148.45:8080/print/pdf/create.json"}

comment:2 Changed 7 years ago by bartvde

Answer from Andreas:

Then it should be enough to just change L243-244 in PrintPage.js:

       var w = (size.width || 0) / 72 / unitsRatio * s / 2;
       var h = (size.height || 0) / 72 / unitsRatio * s / 2;

Regards,
Andreas.

comment:3 Changed 7 years ago by bartvde

Hmm this does work partially, but there are still issues after choosing a layout with a map again after having selected a layout without a map.

comment:4 Changed 7 years ago by bartvde

I had to make another change in OpenLayers.Control.TransformFeature since it chokes on a polygon geometry which is actually a point, so I needed to protect in this way:

Index: ../openlayers/lib/OpenLayers/Control/TransformFeature.js
===================================================================
--- ../openlayers/lib/OpenLayers/Control/TransformFeature.js    (revision 2508)
+++ ../openlayers/lib/OpenLayers/Control/TransformFeature.js    (working copy)
@@ -259,6 +259,14 @@
      *     scale and ratio of a feature across multiple transforms.
      */
     setFeature: function(feature, initialParams) {
+
+        if (feature.geometry.getArea() === 0) {
+            this.layer.setVisibility(false);
+            return;
+        } else {
+            this.layer.setVisibility(true);
+        }
+
         initialParams = OpenLayers.Util.applyDefaults(initialParams, {
             rotation: 0,
             scale: 1,

However, I am experiencing situations in which the transform control gets detached from the actual box geometry, and I am not sure if this is caused by my change or not. Andreas?

comment:5 Changed 7 years ago by bartvde

  • State changed from None to Needs Discussion

comment:6 Changed 7 years ago by bartvde

No the detaching of the transform feature control from the actual box geometry happens even without this change. It happens for me when zooming out twice and having the print extent in the map view.

Changed 7 years ago by bartvde

screendump of the detaching issue

comment:7 Changed 7 years ago by bartvde

In the cases of displacement handleMoveFn is not called.

comment:8 Changed 7 years ago by bartvde

Ah, it happens when there are no more scales on the print service available when zooming out. E.g. my largest scale denominator was 2000000, and adding 4000000 in the print service yaml made this problem disappear. So it is a workaround for now, but something is going wrong in the case described. Maybe this points you to the cause Andreas.

comment:9 follow-up: Changed 7 years ago by ahocevar

Bart, I don't think that the OpenLayers TransformFeature control is the right place to fix the issue with pages without a map. Don't you think that pages without a map should have no PrintExtent? Improvements should address that, instead of limiting TransformFeature to polygons (it also works with LineStrings!).

For the other issue (detached transformation box), I created #227 and will investigate.

comment:10 in reply to: ↑ 9 Changed 7 years ago by bartvde

Replying to ahocevar:

Bart, I don't think that the OpenLayers TransformFeature control is the right place to fix the issue with pages without a map. Don't you think that pages without a map should have no PrintExtent? Improvements should address that, instead of limiting TransformFeature to polygons (it also works with LineStrings!).

I agree Andreas, I'll look into that solution tomorrow (I was in a hurry to get this fixed because of a release of our application).

comment:11 Changed 7 years ago by elemoine

  • Milestone changed from 0.7 to 1.0

Changed 7 years ago by bartvde

comment:12 Changed 7 years ago by bartvde

I've just uploaded a new patch which needs some discussion first. It also depends on ticket:294.

Changed 7 years ago by bartvde

previous patch had a minor mistake

comment:13 Changed 7 years ago by ahocevar

  • Milestone changed from 1.0 to 1.1

Last patch still unreviewed, no discussion. Bumping.

comment:14 Changed 5 years ago by bartvde

  • Milestone changed from 1.1 to future

Nothing will happen before the 1.1 release on this so bumping.

Note: See TracTickets for help on using tickets.