Opened 15 years ago
Closed 15 years ago
#3987 closed defect (fixed)
Recent change in MapView creating problems in projections
Reported by: | pieren | Owned by: | pieren |
---|---|---|---|
Priority: | blocker | Milestone: | |
Component: | Core | Version: | latest |
Keywords: | Cc: |
Description
A recent change in Mapview.java (rev.2450) by "jttt" introduces a
problem with the Lambert projections.
The change is the following in Mapview @Override public void paint(Graphics g) :
(before)
Graphics2D tempG = offscreenBuffer.createGraphics();
tempG.setColor(Main.pref.getColor("background", Color.BLACK));
tempG.fillRect(0, 0, getWidth(), getHeight());
for (Layer l: getVisibleLayersInZOrder()) {
l.paint(tempG, this);
}
for (MapViewPaintable mvp : temporaryLayers) {
mvp.paint(tempG, this);
}
(and after)
Graphics2D tempG = offscreenBuffer.createGraphics();
tempG.setColor(Main.pref.getColor("background", Color.BLACK));
tempG.fillRect(0, 0, getWidth(), getHeight());
Bounds box = getLatLonBounds(g.getClipBounds());
for (Layer l: getVisibleLayersInZOrder()) {
l.paint(tempG, this, box);
}
for (MapViewPaintable mvp : temporaryLayers) {
mvp.paint(tempG, this, box);
}
The problem is this new call of getLatLonBounds() with random east,
north values the first time a new layer is added. It's not exactly random as the values are based on the screen width and height !
The solution is not to ignore those values in the projection implementation when they are outside the box otherwise I cannot warn the user when he is really working outside the projection limits.
This problem is also independent of the subprojection things to do. It is currently blocking the cadastre-fr plugin working only with the concerned projections.
Attachments (1)
Change History (10)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
When the world bounds are fixed to be proper for all the relevant projections, then this code should return valid coordinates.
comment:3 by , 15 years ago
What does the value returned by getWorldBoundsLatLon() means? Is it bbox where projection is valid?
comment:5 by , 15 years ago
In ticket #3989, I added a better support of getWorldBoundsLatLon() in the patches to apply.
by , 15 years ago
Attachment: | NTV2Grid.patch added |
---|
follow-up: 7 comment:6 by , 15 years ago
I've attached a patch file "NTV2Grid.patch". Sorry about that.
comment:7 by , 15 years ago
Replying to pieren:
I've attached a patch file "NTV2Grid.patch". Sorry about that.
Ooops, wrong ticket.
comment:8 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → needinfo |
Can this ticket be closed?
comment:9 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | needinfo → closed |
Should be fixed with #3989
The value is not random (and it's not a bug afaik), it's bbox arount default center, calculated by NavigatableComponent.calculateDefaultCenter(). Default center is calculated as:
Problem here is that first call of MapView.paint is before any data are loaded. As a workaround I can check whether there is any non empty OsmDataLayer and if not then use whole world bounds instead of value calculated by getLatLonBounds().
But that seems a bit hackish, I would preferer if all Projections returned polygon where the projection is valid and center point of that polygon.