OpenLayers OpenLayers

Ticket #336 (closed feature: fixed)

Opened 2 years ago

Last modified 2 years ago

create OpenLayers.Layer.Graphic to layers created with simple static images

Reported by: tschaub Assigned to: tschaub
Priority: minor Milestone: 2.2 Release
Component: Layer.Image Version: 2.2 RC1
Keywords: Cc:
State:

Description

For the overview map in particular, it will be useful to be able to create a layer using a simple map graphic. I hope others can find some utility in this.

Source: http://dev.geocartic.com/openlayers/lib/OpenLayers/Layer/Graphic.js

Example: http://dev.geocartic.com/openlayers/examples/graphic-layer.html

Attachments

graphic.patch (5.8 kB) - added by euzuro on 10/10/06 16:10:45.
adding original version as patch
imageLayer.patch (5.4 kB) - added by euzuro on 10/25/06 18:56:51.
final version of patch, this time with update from #376 un-included :-(

Change History

10/10/06 16:10:45 changed by euzuro

  • attachment graphic.patch added.

adding original version as patch

10/21/06 12:04:39 changed by crschmidt

  • milestone set to 2.2 Release.

Committed to trunk in r1712. Will discuss with PSC if this should be pulled up to 2.2 release.

10/24/06 20:27:59 changed by euzuro

  • keywords set to review.

10/24/06 22:05:15 changed by euzuro

I found some things in here that I would like to change. You'll see in my forthcoming patch I have made a lot of small stylistic things that are or are not important. The one thing I do think is important is the changing of the code such that it doesnt create a new tile with every change of zoom, but rather creates one tile from the beginning and then just resizes it with every zoom. I think this should be both faster and (in the end) better for memory management.

see patch.

10/24/06 22:06:41 changed by euzuro

ah sorry. forgot to note that my attachment includes the patch for #376... so it shouldnt be put in wholesale into trunk until the patch for #376 has been put in.

10/24/06 22:10:16 changed by euzuro

Finally, I have to say that I don't quite understand the following snippet of code:

        // If nothing to do with resolutions has been set, assume a single
        //  resolution determined by extent/size
        if(this.shouldCalcResolutions()) {
            this.options.resolutions = [this.extent.getWidth() / this.size.w];
        }

which calls this function:

    /**
     * This is a bad method to have here.  It would be nicer to be able
     * to ask Layer directly.
     */
    shouldCalcResolutions: function() {
        var props = new Array(
            'scales', 'resolutions',
            'maxScale', 'minScale', 
            'maxResolution', 'minResolution', 
            'minExtent', 'maxExtent',
            'numZoomLevels', 'maxZoomLevel'
        );
        for(var i=0; i < props.length; i++) {
            var property = props[i];
            if(this.options[property] != null) {
                return false;
            }
        }
        return true;
    },

do we really need this? I dont quite understand what it does... but I tried removing it and did some basic tests and everything seemed to work ok. There is probably something that I am not understanding, though, so please, someone speak up. I am all ears.

10/24/06 22:19:34 changed by euzuro

oh one other thing, when i took the above code out, i found that the image simply stopped displaying at a certain resolution (zoom level) could this be something to do with trying to display an image at a size greater than the screen or something?

it might be worth it to look into this, to see if there are indeed any imposed limits that the browser is going to drop on us. we could then upgrade the layer such that it automatically knows when it is out of range. there is a function like calculateInRange() or something like that which does this.

10/24/06 22:22:20 changed by euzuro

and if anyone is even still reading at this point, i realize i should have somewhere stuck a "hey thanks" in here to tim for writing this layer in the first place. I hope all my comments and suggestions wont get taken the wrong way. I have a tendency to go overboard with that kind of stuff.

Thanks, Tim!

10/25/06 06:13:20 changed by euzuro

  • owner set to tschaub.
  • component changed from general to Layer.Image.

10/25/06 18:12:08 changed by euzuro

patch ready for another review. I think it is totally good to go now.

feel free to commit if approved

10/25/06 18:56:51 changed by euzuro

  • attachment imageLayer.patch added.

final version of patch, this time with update from #376 un-included :-(

10/26/06 06:11:28 changed by euzuro

committed to trunk by tschaub r1737. thanks tim!

10/26/06 06:20:18 changed by euzuro

  • keywords changed from review to pullup.

marking keyword as "pullup" so that we know to pull it up to the 2.2 branch

10/26/06 06:23:38 changed by euzuro

  • version set to 2.2 RC1.

marking version as 2.2 RC1 so that we know this was a fix made to 2.2 RC1 (for updates to the 2.2 Release Notes and for when we write the 2.2 RC2 announce email)

10/27/06 10:36:58 changed by crschmidt

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to fixed.

pulled up.