|
POST
|
maybe some hints here http://stackoverflow.com/questions/4940586/can-you-use-html5-local-storage-to-store-a-file-if-not-how writing local storage to text file using the File API
... View more
08-06-2013
06:33 AM
|
0
|
0
|
3045
|
|
POST
|
Hi I have a drawing toolbar that allows my users to add graphics. Using this sample I have added context menu to edit the shapes they have drawn. My users can add textsymbols (which have a point geometry) this part of the code ctxMenuForGraphics.addChild(new dijit.MenuItem({ label: "Rotate/Scale", onClick: function() { if (selected.geometry.type !== "point") { editToolbar.activate(esri.toolbars.Edit.ROTATE | esri.toolbars.Edit.SCALE, selected); } else { alert("Not implemented"); } } })); Prevents the rotate option being enabled for the textsymbol. However my users want to be able to rotate textsymbols. If I remove the check for POINTS in the code above I don't get the "Not implemented" warning, but I also don't get any rotate handles. The TextSymbol does have a rotation property, so I could get that set when it is generated, but the user wil have to be good with angles. Any thoughts? ACM
... View more
08-06-2013
05:55 AM
|
0
|
9
|
4953
|
|
POST
|
Hi I have a SQL database. In this SQL database is a SQL Spatial table, from a NONE Esri source. This table has mixed (ug!) geometries, points, multiponts and polygons. This table is from a third party application and I have NO control over it. I can view the data OK in ArcMap, when I add it on, I have to choose the geometry type and unique field. However, if I try to do anything with layers I get a 99999 error "Invalid Entity type" What I'm trying to do is to take this source, buffer the point features, then merge it with the polygon features to create a single ArcMap friendly layer. Cheers ACM
... View more
08-05-2013
06:41 AM
|
0
|
4
|
1019
|
|
POST
|
Hi I'm not sure if this is a small glitch, but I used to have
{
layer: aerials,
slider: true,
title: "Aerials",
collapsed: true
}
To define a TOC on my aerial service, which is pure rasters, with nothing switched on by default. Using the latest version this gets classed as a un-openable menu item
<img src="http://my server/arcgis_js_api/library/3.5/jsapi/js/dojo/dojo/resources/blank.gif" alt="" data-dojo-attach-point="iconNode" class="dijitTreeExpando dijitTreeExpandoClosed" style="visibility: hidden;">
A very small tweak to my code
{
layer: aerials,
slider: true,
title: "Aerials",
isopen: true,
collapsed: true
}
and all is fine Cheers ACM
... View more
08-05-2013
06:32 AM
|
0
|
0
|
4457
|
|
POST
|
Brilliant! Missed that, I'll take a look at it now and revert to the original code. Nice update - grouped styles work as they do in ArcMap now, rather than being split by the unique values.
... View more
08-05-2013
05:46 AM
|
0
|
0
|
4457
|
|
POST
|
Liu - many thanks for the update. The only non-style based change I make is to this line templateString: '<div class="agsjsTOCNode"><div data-dojo-attach-point="rowNode" data-dojo-attach-event="onclick:_onClick"><span data-dojo-attach-point="contentNode" class="agsjsTOCContent"><span data-dojo-attach-point="checkContainerNode"></span><img class="tocimage" src="${_blankGif}" alt="" data-dojo-attach-point="iconNode" /><span data-dojo-attach-point="labelNode"></span></span></div><div data-dojo-attach-point="containerNode" style="display: none;"> </div></div>',
adding a class to the image - any chance of adding that to your version? It justs gives me a bit more control over style - I add a vertical-algn:bottom to mine. Many thanks ACM
... View more
08-05-2013
05:07 AM
|
0
|
0
|
4457
|
|
POST
|
It will be a great point to start, though what I need is the ability to save the graphics to a external file that can be shared among users. would you share the code?:) OK - here goes - I have this function that is mainly copied from elsewhere
function addToMap(geometry) {
//drawToolbar.deactivate();
a = dijit.byId("tslider").value;
c = hexToRgb(graphicColour, a);
fullcolour = new dojo.Color(c);
// fillStyle = dijit.byId('fillSelect').attr('value');
var psize = dijit.byId("font.size").value;
psize = psize.replace("pt", "");
switch (geometry.type) {
case "point":
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, psize, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color(graphicColour));
if (drawtype == 'Text') {
fullcolour = new dojo.Color([0, 0, 0, 255]);
var font = new esri.symbol.Font(dijit.byId("font.size").value, esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_NORMAL, "verdana");
var symbol = new esri.symbol.TextSymbol(dijit.byId("usertext").value, font, fullcolour).setAngle(0).setOffset(0, 0).setAlign(esri.symbol.TextSymbol.ALIGN_START).setDecoration(esri.symbol.TextSymbol.DECORATION_NONE).setRotated(false).setKerning(true);
}
break;
case "polyline":
var symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, fullcolour, dijit.byId("line.size").value);
break;
case "polygon":
var symbol = new esri.symbol.SimpleFillSymbol(dijit.byId('fillSelect').attr('value'), new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), dijit.byId("line.size").value), fullcolour);
break;
}
console.debug(symbol)
var graphic = new esri.Graphic(geometry, symbol);
// store to local storage graphic added
var now = new Date();
var n = now.getTime();
GraphicName = "storedGraphic" + n;
window.localStorage.setItem(GraphicName, dojo.toJson(graphic.toJson()));
graphic.setAttributes({
newID: GraphicName
});
userGraphics.add(graphic);
//enableID();
}
The important bits are to the end - I generate a unique name for this stored graphic, based on the time. Then save it to local storage. Initially I also deactivated the draw tools and reactivated the ID tool - but as you see I've changed my mind on this - these only get changed when the user closes the floating pane I have the tools in. I then have this, that re-loads it all next session
//graphics stored in local srtorage and display it.
for (var i = 0; i < localStorage.length; i++) {
var n = "SavedGraphic" + i;
var key = localStorage.key(i);
//we use local storage for other things, so only read in storedgraphics
if (Left(key, 8) == 'storedGr') {
saved = dojo.fromJson(localStorage.getItem(localStorage.key(i)));
var graphic = new esri.Graphic(saved);
graphic.setAttributes({
"ID": n,
"LSNo": i
});
userGraphics.add(graphic);
}
}
userGraphics is a graphics layer just for the, well, user graphics! - this means other stuff the system adds, like markers, and highlights, don't get mixed up. Finally the delete from local storage, when a user deletes the graphics. This needs this added to the create toolbar event thingy
function createToolbarAndContextMenu(map) {
map.enableSnapping({
snapKey: dojo.keys.copyKey
});
// Create and setup editing tools
editToolbar = new esri.toolbars.Edit(map);
dojo.connect(editToolbar, "onDeactivate", function(tool, graphic, info) {
//we need to remove the version in local storage as we will be saving a new version
//if Graphics has newID it has been added this session
//If not it has been loaded from localstorage
//if from LS the attribute LSNo will equal the index no in localstorage
if (graphic.attributes.newID) {
localStorage.removeItem(graphic.attributes.newID);
} else {
localStorage.removeItem(localStorage.key(graphic.attributes.LSNo));
}
//save a new version with name time stamped so it can be referred to in future edits/deletes this session
var now = new Date();
var n = now.getTime();
GraphicName = "storedGraphic" + n;
window.localStorage.setItem(GraphicName, dojo.toJson(graphic.toJson()));
});
dojo.connect(map, "onClick", function(evt) {
editToolbar.deactivate();
});
createMapMenu();
createGraphicsMenu();
}
I think the comments say enough - basically we need a common naming system for the graphics so they can be deleted. Finally, as I use the right click context menu form an example, I alter the delete part of that.
function createGraphicsMenu() {
// Creates right-click context menu for GRAPHICS
ctxMenuForGraphics = new dijit.Menu({});
ctxMenuForGraphics.addChild(new dijit.MenuItem({
label: "Edit",
onClick: function() {
if (selected.geometry.type !== "point") {
editToolbar.activate(esri.toolbars.Edit.EDIT_VERTICES, selected);
} else {
alert("Not implemented");
}
}
}));
ctxMenuForGraphics.addChild(new dijit.MenuItem({
label: "Move",
onClick: function() {
editToolbar.activate(esri.toolbars.Edit.MOVE, selected);
}
}));
ctxMenuForGraphics.addChild(new dijit.MenuItem({
label: "Rotate/Scale",
onClick: function() {
if (selected.geometry.type !== "point") {
editToolbar.activate(esri.toolbars.Edit.ROTATE | esri.toolbars.Edit.SCALE, selected);
} else {
alert("Not implemented");
}
}
}));
ctxMenuForGraphics.addChild(new dijit.MenuSeparator());
ctxMenuForGraphics.addChild(new dijit.MenuItem({
label: "Delete",
onClick: function() {
userGraphics.remove(selected);
if (selected.attributes.newID) {
localStorage.removeItem(selected.attributes.newID);
} else {
localStorage.removeItem(localStorage.key(selected.attributes.LSNo));
}
}
}));
ctxMenuForGraphics.startup();
dojo.connect(userGraphics, "onMouseOver", function(evt) {
// We'll use this "selected" graphic to enable editing tools
// on this graphic when the user click on one of the tools
// listed in the menu.
selected = evt.graphic;
// Let's bind to the graphic underneath the mouse cursor
ctxMenuForGraphics.bindDomNode(evt.graphic.getDojoShape().getNode());
});
dojo.connect(userGraphics, "onMouseOut", function(evt) {
ctxMenuForGraphics.unBindDomNode(evt.graphic.getDojoShape().getNode());
});
}
Looking at it now, I am not too sure how it all works!! It was a few months ago I did it and my memory isn't as good as it used to be. So please take it as it is. Cheers ACM
... View more
08-05-2013
02:19 AM
|
0
|
0
|
3045
|
|
POST
|
Hi I have code that writes all stuff created with the draw toolbar to HTML5 local storage, and then reads it back next time a user uses the site. Is that the sort of thing you are after? As mine is for an internal site I have control over browser versions, so this works OK. ACM
... View more
08-03-2013
11:36 PM
|
0
|
0
|
3045
|
|
POST
|
Whilst it is nice you got my hack working, I should have reposted here earlier to say I got nliu's method working fine, and now don't have any changes to the stock code (apart from one tiny style change, but that is just cosmetic) - so it'll be worth trying the developer's method again, if you haven't already done so. It'll make it much easier when new code is released (like it just has been) ACM
... View more
08-02-2013
11:03 PM
|
0
|
0
|
2413
|
|
POST
|
Many thanks - I did that first, but must have got it wrong somewhere, as trying again and it all worked.
... View more
07-26-2013
06:44 AM
|
0
|
0
|
1284
|
|
POST
|
SORTED - This was SO simple when discovered by Zoltan/Esri(inc), although logged as an official bug - NIM093153 - Tile Package Added as a Basemap to ArcGIS for Windows Mobile Project Center Not Rendering Correctly on Specific Windows 8 tablet devices. NIM093153 - Tile Package Added as a Basemap to ArcGIS for Windows Mobile Project Center Not Rendering Correctly on Specific Windows 8 tablet devices. Fix for these is to ensure the screen DPI is set to 100% in the Win 8 display setting - on our tablet it was set (even stating it was a default) to 125% ACM
... View more
07-24-2013
01:52 AM
|
1
|
0
|
3763
|
|
POST
|
Hi Whilst I've got this working, I can't seem to hook anything up to the "close" button - which is really a dock button. Which event works? I'm using a floating pane for my draw tools, so want it to deactivate the draw tools totally when "closed" Cheers ACM Doh! it was there all the time, needed adding some code dojo.forEach(dojo.query('.dojoxFloatingMinimizeIcon'), function (i) { dojo.attr(i, 'onmouseover', 'dojo.style(this, "backgroundPosition", "-21px 50%")');
dojo.attr(i, 'onmouseout', 'dojo.style(this, "backgroundPosition", "0 0")');
dojo.attr(i, 'onmousedown', 'dojo.style(this, "backgroundPosition", "-42px 50%")')
dojo.attr(i, 'onClick','alert("This floating pane has been docked")' )
});
... View more
07-23-2013
01:22 AM
|
0
|
0
|
1524
|
|
POST
|
This still seems to be the case at 3.5 - is that really the case?? Amazing oversight surely? Any work a-rounds? Cheers ACM
... View more
07-22-2013
05:41 AM
|
0
|
0
|
4723
|
|
POST
|
Apparently IE10 doesn't do DXImageTransform - so has anyone got any ideas how to do this in IE10 ? Cheers ACM
... View more
07-19-2013
05:56 AM
|
0
|
0
|
2859
|
|
POST
|
Tim - does it work for you using 10.1.1 when run on an XP PC? Zoltan's been looking after my call too 🙂 Although not sure this is the same as I did save the PBK file as WGS84 and that failed too Maybe I should download an earlier version.
... View more
07-18-2013
09:06 AM
|
0
|
0
|
3763
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-19-2026 12:29 AM | |
| 1 | 08-28-2025 01:14 AM | |
| 1 | 12-01-2023 06:07 AM | |
| 2 | 11-29-2024 04:32 AM | |
| 1 | 05-28-2024 12:50 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|