|
POST
|
I sort of hacked layer.renderer._symbols[key].symbol = new PictureMarkerSymbol... That works but there has to be a proper way?
... View more
03-08-2016
07:40 AM
|
0
|
8
|
1478
|
|
POST
|
As a follow up question to this link: https://community.esri.com/message/593549 I select the symbol that I want to change by creating img elements and adding attributes such as index, id, etc. It's the onclick of that image that triggers the iteration through the layer's symbols to match the img.attribute['index'] with the iteration of the symbol loop. Then, I setUrl for that symbol. I couldn't find the proper way to look at a collection of symbols. I noticed that if a layer/service has 1 symbol in the renderer, there is a layer.renderer.symbol object. If there is a collection of symbols, layer.renderer.symbol is undefined but layer.renderer._symbols is an object. I iterate through _symbols with for (key in layer.renderer_symbols). I check the layer.renderer._symbols[key].type for 'picturemarkersymbol' then check to see if the img element (that the user clicked) index attribute matches key (so that I am stopping the loop to setUrl on the correct symbol). I sort of do the same thing if the type is simplemarkersymbol. The difference is that I can't setUrl of a simplemarkersymbol so I try to do layer.renderer._symbols[key].setSymbol(new PictureMarkerSymbol...). However, layer.renderer._symbols[key] does not support 'setSymbol'. I also tried messing with the setRenderer but that affects all of the other symbols on the layer. This particular layer that I'm testing has several symbols of different types. What is the proper way to set the symbol of just one symbol in a collection of symbols? Is there a better way to reference the collection of symbols in lieu of layer.renderer._symbols? I feel like I'm also going to have the same issues when I try to change the simpleline and simplefill symbols? I will be changing their colors and thickness only though. I won't be changing the simpleline to a picture or anything too off the wall. Thank you
... View more
03-08-2016
05:45 AM
|
0
|
9
|
3446
|
|
POST
|
That was it. I was missing the redraw. I didn't know it existed. I am using the setRenderer too if the symbol is a SMS. If the symbol is already a PMS, I just setUrl... both need redraw... apparently. Thanks!
... View more
03-07-2016
12:23 PM
|
0
|
1
|
1378
|
|
POST
|
My UI is set up with 2 lists. The first list shows the symbols of a selected feature layer. The second list shows options of what a symbol can be changed to. For example, if the layer's renderer has a single picturemarkersymbol, the image displays in one list and the second list will show a series of graphics the user can select from. Another example, if the layer's renderer has a collection of symbols (some picturemarkersymbols, some simplemakersymbols), all of the symbols are represented in the first list and the second list shows a series of images. The idea is to select 1 from the first list and 1 from the second list. When the user submits, the new symbols should replace the old symbol. I have everything done except for updating the symbols. Breaking down my code, and simplifying it, I have: var path = jqueryUnorderedList.find('img')[0].attributes['src'].value; map.getLayer(id).renderer.symbol.setUrl(path); Nothing happens. The original PMS still exist on the map. What am I missing? Also, what's the proper way to change renderer's completely? If I have a SMS and want to change to a PMS, do I need to setRenderer on the layer? I tried that too... nothing happens. Nothing on the map changes and nothing shows in the F12 console log. Thank you for the help!
... View more
03-07-2016
11:39 AM
|
0
|
3
|
3315
|
|
POST
|
To highlight a graphic, I create a new graphic with the same geometry but I make the simplelinemarker yellow. Then when you delete the selected graphic, remove both the new yellow graphic and the graphic you selected.
... View more
03-07-2016
03:15 AM
|
1
|
0
|
2300
|
|
POST
|
Edit: I apologize for the crap code blocks. It looked fine when I posted it. This forum always gives me fits when I add code. Please copy and paste to your IDE and add proper line breaks so that the comments don't comment out the code. I'll try to fix it but I assume it'll still look to crap. At a high level, the answer is yes, I think you can use the mixin pattern. I'm not sure if you would be butchering the spirit of mixins, but you could give it a go. Use can use the dojoConfig to package your JavaScript files. Use the defined package's return block as a means of returning your mixins. The dojo packages would simply act as a namespace. dojoConfig (file, or whatever): var basePath = location.pathname.replace(/\/[^/]+$/, "");
var dojoConfig = {
async: true,
packages: [
{
name: "mixins",
location: basePath + "/js/mixins",
main: "mixins"
}
]
}; mixins (file): define(function () {
var fooMixins = {
doThis: function() {
// do something
},
doThat: function() {
// do something else
}
}
var barMixins = {
doThis: function() {
// do something
},
doThat: function() {
// do something else
}
}
return {
fooMixin: function () {
return fooMixins;
},
barMixin: function () {
return barMixins;
}
};
}); mixin usage (file): define(['mixins'], function (mixins) {
return {
fooMixinUsage: function () {
// do stuff and extend foo mixin via mixins.fooMixin()
},
barMixinUsage: function () {
// do stuff and extend bar mixin via mixins.barMixin()
},
};
}); Note: I have no idea if this works. I didn't test this. It might just be using mixins just to use them. This could be a complete hack with no value at all.
... View more
03-01-2016
02:24 PM
|
0
|
0
|
570
|
|
POST
|
Put line 16 above line 1, maybe? I think you'll need to reference the API, on line 16, before dojoConfig. I have the API referenced as my first script element, and I have a separate config.js script element near about the last script referenced. Might not do anything for you, but worth a try?
... View more
03-01-2016
02:00 PM
|
0
|
0
|
500
|
|
POST
|
I am trying to add a buffer to a point that I draw on a map. I went with the example shown on this documentation: https://developers.arcgis.com/javascript/jsapi/geometryservice-amd.html#buffer My actual code is: $('#buttonBufferAdd').click(function (e) { var spatialReference = new SpatialReference(item.Geometry.SpatialReference); returns wkid: 102100 var params = new BufferParameters(); params.geometries = [new Point(item.Geometry.Point.Coordinate.X, item.Geometry.Point.Coordinate.Y, spatialReference)]; params.distances = $('#inputBufferRadius').val(); // returns 5 params.unit = utils.getUnitOfMeasurement(); // returns 9030 params.bufferSpatialReference = spatialReference; params.outSpatialReference = map.spatialReference; var geometryService = new GeometryService(geometryService); // url verified geometryService.buffer(params); }); I get the following error: Object doesn't support property or method 'join'. Why? Thanks! p.s. The code block thing crapped out today, please bear with the sloppy code paste. EDIT: And should I be using GeometryEngine.buffer instead? And is there a way to change the buffer color?
... View more
02-25-2016
11:41 AM
|
0
|
2
|
2812
|
|
POST
|
There are a few ways around it. Here is one http://stackoverflow.com/questions/7530678/javascript-variable-scope-issue-with-jquery-click-event But, what you'll want to googles is javascript event scope issues to get more information on it.
... View more
02-25-2016
11:20 AM
|
0
|
0
|
1599
|
|
POST
|
Yea, I played with that graphic a little bit too. My guess is that it's added to kick start the graphicLayerIds collection. Or maybe they found a bug that was resolved by adding the graphic? I hope to hear about it, too.
... View more
02-23-2016
04:34 AM
|
0
|
0
|
771
|
|
POST
|
The click event occurs after your loop is complete. By the time you click the graphic, the city name that you set for the infoWindow will always be the city name of the last iteration of the loop, 'rwp'.
... View more
02-23-2016
04:29 AM
|
0
|
0
|
1599
|
|
POST
|
This line of code: var URLExtent = this.location.href.split("=")[1].split("&")[0].split(","); ... is expecting an '=' in your URL. For starters, just to be sure, does your URL have values with an '=' in it? Try F12 developer tools and see if any errors/warnings pop up in the console.
... View more
02-23-2016
04:13 AM
|
0
|
1
|
1262
|
|
POST
|
I have noticed this too. You definitely have to keep that in mind if you're maintaining a graphics collection based on length/count. I wonder why they do it too. I've asked before, and received no answer.
... View more
02-23-2016
04:03 AM
|
0
|
2
|
771
|
|
POST
|
Click reply. Click "use advanced editor" on the upper right of your little input window. Click the >>. Select a javascript.
... View more
02-18-2016
09:15 AM
|
1
|
0
|
2288
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-31-2015 06:07 AM | |
| 1 | 09-25-2015 08:35 AM | |
| 1 | 12-07-2015 04:32 AM | |
| 1 | 11-06-2015 07:47 AM | |
| 1 | 03-28-2016 04:19 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|