Select to view content in your preferred language

Please add constructor options to all esrijs classes.

2472
2
08-15-2014 01:43 PM
BenFousek
Deactivated User

Now:

lang.mixin(new ImageParameters(), {dpi: 96, format: 'PNG32'})

But why not:

new ImageParameters({dpi: 96, format: 'PNG32'})

Please add constructor options to classes such as ImageParameters, FindParameters, etc. Seems like an easy fix. It's literally adding an arg and one line of code to the constructor.

2 Replies
ReneRubalcava
Honored Contributor

Yes please.

Heck, I'd even say most of the *Parameters currently in the library don't even need to be there. Abstract them away in the internals of the Task.

I should just be able to say


var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapSer...", { 
          "opacity" : 0.5, 
          "imageParameters" : {dpi: 96, format: 'PNG32'}
        });

Provide the specs and bam.

BenFousek
Deactivated User

Booya!

Take saving a map for example. You're sure to save the extent as JSON. But when you load it you cannot just pass the saved map JSON as map options. You need to replace the extent JSON with an Extent object.

//this would be nice

var map = new Map('map', {

     basemap: 'topo',

     extent: {xmin: -13715559, ymin: 5756224, xmax: -13709826, ymax: 5759855, 'spatialReference': {'wkid': 102100, 'latestWkid': 3857}}

});

Imagine setting up/executing a query or find task by simply passing JSON!

Another similar situation:

var graphicJson = someGraphic.toJson();

var newGraphic = new Graphic(graphicJson);

//Graphic accepts json containing any or all 4 parameters

//but using individual geometry, symbol and infoTemplate parameters require initiating new objects

//why not also

var anotherGraphic = new Graphic(geomJson, symJson, attributes, itJson);

//can easily create graphic JSON but would be nice if parameters excepted JSON too

//along the same lines

anotherGraphic.setSymbol(newSymJson);