|
POST
|
I clear attributes and info templates before printing and reset them after. Because graphics are objects you can set all the properties you want. var graphic = new esri.Graphic(evt, app.anno.sym.point);
var gId = new Date().getTime().toString();
var atts = { id: gId };
graphic.setAttributes(atts);
var it = new esri.InfoTemplate();
it.setTitle('Point');
it.setContent(app.anno.itContentPoint(gId));
graphic.setInfoTemplate(it);
graphic.graphic_id = gId;
graphic.graphic_atts = atts;
graphic.graphic_it = it;
graphic.graphic_text = false;
app.map._layers.gl_anno_point.add(graphic) When creating a graphic set the esri attributes and info template as normal but also set them as unique properties on the graphic object. This concept is extremely useful for more than graphics. I set custom properties on layers, the map, etc to accomplish a variety functionalities. graphicsClear: function () {
dojo.forEach(app.map._layers.gl_anno_polygon.graphics, function (g) {
g.setInfoTemplate(null);
g.setAttributes(null);
});
dojo.forEach(app.map._layers.gl_anno_polyline.graphics, function (g) {
g.setInfoTemplate(null);
g.setAttributes(null);
});
dojo.forEach(app.map._layers.gl_anno_point.graphics, function (g) {
g.setInfoTemplate(null);
g.setAttributes(null);
});
dojo.forEach(app.map._layers.gl_anno_marker.graphics, function (g) {
g.setInfoTemplate(null);
g.setAttributes(null);
});
dojo.forEach(app.map._layers.gl_anno_text.graphics, function (g) {
g.setInfoTemplate(null);
g.setAttributes(null);
});
},
graphicsReset: function () {
dojo.forEach(app.map._layers.gl_anno_polygon.graphics, function (g) {
g.setInfoTemplate(g.graphic_it);
g.setAttributes(g.graphic_atts);
});
dojo.forEach(app.map._layers.gl_anno_polyline.graphics, function (g) {
g.setInfoTemplate(g.graphic_it);
g.setAttributes(g.graphic_atts);
});
dojo.forEach(app.map._layers.gl_anno_point.graphics, function (g) {
g.setInfoTemplate(g.graphic_it);
g.setAttributes(g.graphic_atts);
});
dojo.forEach(app.map._layers.gl_anno_marker.graphics, function (g) {
g.setInfoTemplate(g.graphic_it);
g.setAttributes(g.graphic_atts);
});
dojo.forEach(app.map._layers.gl_anno_text.graphics, function (g) {
g.setInfoTemplate(g.graphic_it);
g.setAttributes(g.graphic_atts);
});
} Clear the esri attribute and info template properties before executing the print task. Then reset them at the end of the print task callback function. This takes care of the text symbol print issue, but more important it is reducing the size of the request to the server for the print task. Sending the info template of any graphic, especially one with a custom widget, exponentially increases the request size, and for what? The other option is a custom print task. The problem there is you still need to clear attributes and info templates from the objects you are creating with the print task before creating the json. Six of one, half dozen of the other.
... View more
04-26-2013
10:35 AM
|
0
|
0
|
2197
|
|
POST
|
I'm using the JSAPI and with a default Export Web Map GPServer using custom templates. The application has been deployed and working properly for a while. Then today I started getting the following server error when bing maps are included in the Web Map as JSON: Layer "ve": Unable to connect to Microsoft Bing service. Authentication failed. Failed to execute (ExportWebMap). Failed to execute (Export Web Map). Any ideas on this would be appreciated.
... View more
04-05-2013
01:09 PM
|
0
|
1
|
1904
|
|
POST
|
Unfortunately I do not have a solution for you, but I just wanted to report that I am still able to print Bing Maps, so I don't think it's part of the phasing out or anything. I will note, however, that we deploy a custom Export Web Map Task, so maybe that plays a role? Not sure, just conjecture. Thanks for the report. I'm using a custom client side task with default Export Web Map and custom templates. Tried the API task with same result. I thought it might be that I had updated my templates since Bing Maps stop being available in desktop basemaps, but it had been working fine until early this morning. As a quick and dirty work around I'm hiding bing and loading world imagery before sending off to get processed. I've been having a lot of problems with graphics (specifically points and text), so maybe it's time for a custom print gpserver.
... View more
04-05-2013
12:06 PM
|
0
|
0
|
865
|
|
POST
|
Application has been deployed for some time and printing fine until this morning. Server error: Layer "ve": Unable to connect to Microsoft Bing service. Authentication failed. Failed to execute (ExportWebMap). Failed to execute (Export Web Map). Print task executes fine as long as Bing is off. Is this possibly due to changes in Bing Maps services? Or do I have some other issue? Thanks
... View more
04-05-2013
07:33 AM
|
0
|
2
|
2119
|
|
POST
|
Now that I have unzipped and loaded this example, it isn't doing anything except load the main page. The tools do nothing. I'm not getting any errors. Clicking on bookmarks or map options under the tools drop down doesn't show the floating pane?
... View more
12-10-2012
06:47 PM
|
0
|
0
|
2389
|
|
POST
|
I'm not sure. Zip up you app and post it or send it via a private message and I'll take a look.
... View more
12-05-2012
11:55 AM
|
0
|
0
|
566
|
|
POST
|
After you initialize the map add your graphics layer: var myGraphicsLayer = new esri.layers.GraphicsLayer({ id: 'my_graphics_layer' });
map.addLayer(myGraphicsLayer); Add features: function addResultsToMap(results) {
dojo.forEach(results, function(result) {
var sym = esri.symbol.SimpleFillSymbol('solid', new esri.symbol.SimpleLineSymbol('solid', new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.2]));
var graphic = new esri.Graphic(result.feature.geometry, sym); //create graphic with geometry (result.feature.geometry) and symbol (sym)
map._layers.my_graphics_layer.add(graphic); //add graphic to graphics layer created above
//OR
//map.graphics.add(graphic); //add to map.graphics
});
} I didn't add attributes or an info template to the graphic object; both are optional.
... View more
12-05-2012
10:51 AM
|
0
|
0
|
2979
|
|
POST
|
Graphics layer: var plotGraphics = new esri.layers.GraphicsLayer({ id: 'plot_gl' });
app.map.addLayer(plotGraphics); Notice that I set the id of the layer. You should always set the id of all layers: dynamic, tiled, feature, graphic, etc. It's a lot easier to find a layer when you named it yourself. All layers are located in the map._layers object. The problem with map.graphics is that it isn't a true graphics layer per se. It's built into the map and is always the top most layer. So reordering is a problem. Like I said, I haven't used map.graphics in a while, but I recall having some issues with my apps being unstable, slow or crashing when I used map.graphics. That was pre v2, so it's probably fixed by now. Most of my apps have 6-10 graphics layers and up to 20 or so feature layers. Being able to reorder and have better control over graphics layers is a must in that situation.
... View more
12-05-2012
10:17 AM
|
0
|
0
|
2979
|
|
POST
|
I ran a test and was surprised to find you can create a graphic object that way. The problem I encountered with your method was setting the symbol. Sometimes it didn't take. The graphic was in the map but had no style. It I would create a esri.Graphic as best practice. Also, create your own graphics layer. I had trouble in the past with map.graphics and quit using it some time ago. What does the graphic object look like in the DOM @ map.graphics; is it even present?
... View more
12-05-2012
09:44 AM
|
0
|
0
|
2979
|
|
POST
|
Attached is the example in a zip. It's api v2.8. Looking at it again, it's a bit antiquated, however the principles are there. Two major differences: 1) I only load templated widgets in floating panes now, even if it's just html; 2) I use a different method to add mouse events that change the (X) button on the floating pane, because often times there is a need to connect to the closing of the pane, e.g. clear measure graphics when the pane with a measure widget closes.
... View more
12-05-2012
08:55 AM
|
0
|
1
|
2389
|
|
POST
|
@Tracy - It looks like I accidentally deleted it last time I cleaned up my content on arcgis. I'm away from home base this morning. I'll hunt down the zip and attach here this evening at the latest.
... View more
12-05-2012
05:33 AM
|
0
|
0
|
2389
|
|
POST
|
What do you mean embed in another .net app? When you get the the 'Could not load class 'dijit.layout.BorderContainer' it's usually because of a javascript syntax error, like a missing ;, malformed code, etc. The reason you get the BorderContainer error is because it's the first thing dojo parses in your code. I suspect in your case there is some conflict when you put it all together. Post some code or the stack from the error.
... View more
12-04-2012
12:27 PM
|
0
|
0
|
475
|
|
POST
|
I think its how you are creating the graphic using var graphic = result.feature;. That doesn't create a esri.Graphic object. Here's the execute of an identify task. t.execute(p, function (results) {
if (results[0] != undefined) {
var r = results[0].feature;
var atts = r.attributes;
var sym = app.sym.SimpleFillSymbol('solid', new esri.symbol.SimpleLineSymbol('solid', new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.2]));
var it = new esri.InfoTemplate('My Info Title', 'My Info Content')
var graphic = new esri.Graphic(r.geometry, sym, atts, it);
map._layers.MY_GRAPHICS_LAYER.add(graphic);
}
})
... View more
12-04-2012
12:15 PM
|
0
|
0
|
2979
|
|
POST
|
You don't need to worry about memory leaks on page unload from event handlers. Javascript frameworks like dojo and jquery do clean up, including removal of event handlers, when the page unloads. Of greater concern is performance of the application while it's running. Asynchronous web apps can use up a lot of memory fast. https://developers.google.com/speed/articles/optimizing-javascript Check this out for ways to improve performance and avoid coding that may cause memory leaks.
... View more
10-25-2012
07:38 AM
|
0
|
0
|
955
|
|
POST
|
I'm not sure it's possible to change mouse event behavior in that manner. When the mouse is on the move the click doesn't register as an event. I just did a test in chrome & ff , in a desktop application and on windows desktop. Except for windows desktop, I was unable to register a click on a button, link, etc while moving the mouse. The desktop starts to lasso and then stops on mouse button up. A map seems to be a lot more sensitive to mouse events, possibly because there are some many connects to mouse events. It's similar to erratic zooming when the user gets over zealous with the wheel. If it's an issue accessibility, you could always connect to a key (e.g. ctrl) that fires the operation. I did something similar for a client who for some reason could not double-click close a polygon or end a polyline, to save her life. https://dojotoolkit.org/reference-guide/1.8/dojo/keys.html Cheers
... View more
10-03-2012
12:47 PM
|
0
|
0
|
673
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2013 06:56 AM | |
| 1 | 06-30-2015 09:17 AM | |
| 1 | 10-12-2013 07:14 AM | |
| 1 | 02-05-2014 11:05 AM | |
| 1 | 05-28-2015 11:41 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|