|
POST
|
I don't know how you trigger the view switch. Here is an sample code to toggle the two views. function switchView(viewName) {
var divMap = dojo.byId("map"); // map is DIV id for the map view
var divOther = dojo.byId("other"); // other is the DIV id for the other view
dojo.style(divMap, "display", viewName === "map" ? "block" : "none");
dojo.style(divOther , "display", viewName === "map" ? "none" : "block");
}
... View more
08-30-2013
05:12 AM
|
0
|
0
|
1248
|
|
POST
|
Try to move setFeatures and show inside the callback of identify task. Otherwise, the code may hit the setFeatures when identify task not complete. That may explain you may get nothing returned sometime. var evtCopy = evt;
userConfig.identifyTask.execute(userConfig.identifyParams, function(response) {
// Response is array of identify result objects
// Return an array of features.
var features = dojo.map(response, function (result) {
var feature = result.feature;
var attribution = feature.attributes;
var infoTemplate = new esri.InfoTemplate();
var templateString = "";
//Parse and print the key-value pairs in the attribution object
for (prop in attribution) {
templateString = templateString + "<b>" + prop + "</b>: " + attribution[prop] + "<br>";
}
infoTemplate.setTitle("Identify Results");
infoTemplate.setContent(templateString);
feature.setInfoTemplate(infoTemplate);
return feature;
});
userConfig.map.infoWindow.setFeatures(features);
userConfig.map.infoWindow.show(evtCopy.mapPoint);
});
... View more
08-29-2013
08:15 PM
|
0
|
0
|
1100
|
|
POST
|
No need to set z-index for button here. What makes you want to set z-index? In addition, just learnt today that z-index only works for positioned elements. Please refer to http://coding.smashingmagazine.com/2009/09/15/the-z-index-css-property-a-comprehensive-look/. <button id="locate" data-dojo-type="dijit/form/Button">Locate</button> I can display the button without any problem. See http://jsfiddle.net/4Dm7y/.
... View more
08-29-2013
02:24 PM
|
0
|
0
|
1234
|
|
POST
|
Can you post the portion of your html? Normally, buttons should resize themselves automatically unless you specifically set their width and height.
... View more
08-29-2013
01:04 PM
|
0
|
0
|
1234
|
|
POST
|
z-index is very tricky. Button's z-index only works within the scope of its container, which is div.floating-layerMenu in your case. Is div.floating-layerMenu visible?
... View more
08-29-2013
12:24 PM
|
0
|
0
|
1234
|
|
POST
|
data-dojo-props is used to set the properties for dijit/form/Button, not for style settings. Use style to set css rules. Try: <button id="locate" data-dojo-type="dijit/form/Button" style="z-index: 900">Locate</button>
... View more
08-29-2013
12:02 PM
|
0
|
0
|
1234
|
|
POST
|
Yes, you can. An info window is just a popup to display information. You can use infoWindow.setContent to define whatever you like. However, when you define an infoTemplate for a layer, be careful though since the default behavior would be to display the info window for the feature you clicked on. Better not to revise the default behavior. If you really like to modify it, then define an onClick event handler to define the custom behavior.
... View more
08-29-2013
11:47 AM
|
0
|
0
|
577
|
|
POST
|
Create a module named as FloatingPane, and place it under some folder where other custom dijits saved, like myProject/dijits/. In the main html page, <script>
var dojoConfig = {
parseOnLoad: false,
async: true,
packages: [{
name: "dijits",
location: "myProject/dijits" // may need to revise it based on your project file structure
}]
};
</script>
<script src="http://js.arcgis.com/3.6/"></script> Then in the code where you need to use the custom FloatingPane module, load it as AMD: define(["dijits/FloatingPane",...], function(FloatingPane, ...) {}); non-AMD: dojo.require("dijits.FloatingPane"); Used in HTML: <div data-dojo-type="dijits.FloatingPane" data-dojo-props="put floatingpane properties here"></div> Used in JS: var floatPane = new dijits.FloatingPane(...); Here is the complete code of the custom FloatingPane. /**
* Base widget for all tool windows. Behave like the floating title pane with hide feature.
* @class
* @extends dojox/layout/FloatingPane
* @features
* 1. minimize to hide content area.
* 2. click close button to hide instead of destroy.
* 3. change the default close, minimize and restore icons.
* 4. fixed the buggy resize function.
*/
define([
"dojo/_base/declare",
"dojo/_base/lang",
"dojo/dom-construct",
"dojo/dom-geometry",
"dojo/dnd/move",
"dojo/on",
"dojox/layout/FloatingPane"
], function(declare, lang, domConstruct, domGeom, dndMove, on, FloatingPane){
return declare(FloatingPane, {
resize: function(/* Object */dim){
// override: do nothing if passing no dim.
if (!dim) return;
// summary:
// Size the FloatingPane and place accordingly
dim = dim || this._naturalState;
this._currentState = dim;
// Variables used for the issue corrections
// calculate the offset due to the border width
// borderOffset = borderWidth * 2
// @see http://www.w3schools.com/jsref/dom_obj_all.asp
var borderOffset = this.domNode.offsetWidth - this.domNode.clientWidth;
// get offsetParent node and its location values
var offsetParent = this.domNode.offsetParent;
var offsetLocation = {x: 0, y: 0};
if (offsetParent) {
var offsetParentLoc = domGeom.position(offsetParent);
offsetLocation = {x: offsetParentLoc.x, y: offsetParentLoc.y};
}
// From the ResizeHandle we only get width and height information
var dns = this.domNode.style;
if("t" in dim){ dns.top = dim.t + "px"; }
else if("y" in dim){ dns.top = (dim.y - offsetLocation.y) + "px"; } // correction of issue #1.
if("l" in dim){ dns.left = dim.l + "px"; }
else if("x" in dim){ dns.left = (dim.x - offsetLocation.x) + "px"; } // correction of issue #1.
dns.width = (dim.w - borderOffset) + "px"; // correction of issue #2
dns.height = (dim.h - borderOffset) + "px"; // correction of issue #2
// Now resize canvas
var mbCanvas = { l: 0, t: 0, w: (dim.w - borderOffset), h: (dim.h - this.focusNode.offsetHeight - borderOffset) };
domGeom.setMarginBox(this.canvas, mbCanvas);
// If the single child can resize, forward resize event to it so it can
// fit itself properly into the content area
this._checkIfSingleChild();
if(this._singleChild && this._singleChild.resize){
this._singleChild.resize(mbCanvas);
}
},
// override
// Called when clicking the close button (X) located on the right side of the title bar.
// The original implementation is to destroy the widget. It should hide instead.
close: function() {
this.hide();
},
// override
// Enable the user to create custom onHide event handler
hide: function() {
this.inherited(arguments);
this.onHide();
},
// event added
onHide: function() {
// stub method for event
}
});
});
... View more
08-29-2013
10:58 AM
|
1
|
0
|
2738
|
|
POST
|
There is no easy solution for what you need. One option I can think of is like the following workflow. Create a feature layer Set its renderer to blank symbol so that no features will be displayed. setSelectionSymbol to symbols for the selected features. Use selectFeatures to apply the criteria defined by both attributes and geometries. This way, it will only display the features filtered by attributes and geometries.
... View more
08-29-2013
10:40 AM
|
0
|
0
|
1575
|
|
POST
|
No. There are two options left. Search for a street map service that meets your need on ArcGIS.com. Or Host a street data locally, design how the street should display in ArcMap, and then publish it as a map service.
... View more
08-29-2013
10:30 AM
|
0
|
0
|
1509
|
|
POST
|
I like to echo Ken. It's not only the samples need to have both versions, but to provide a way to access all released API as well. Lots of projects were developed under old versions, and when something goes wrong, there is no way to look at the API under which the project was developed. Many organizations aren't willing to take the effort to upgrade to the most recent version as long as the project still works.
... View more
08-29-2013
10:17 AM
|
0
|
0
|
1712
|
|
POST
|
You can turn on/off layers of a dynamic map service, but not for a tiled map service. Think of displaying a tiled map service as aligning a set of images together. These images are prebuilt. You cannot make any adjustment. You only have two options: use or not to use. For dynamic map services, it's like you can make a custom order, and the GIS server will generate the images on the fly to meet your requirements. Hope it makes better sense to you.
... View more
08-29-2013
10:09 AM
|
0
|
0
|
1509
|
|
POST
|
Unfortunately, it is not possible since, as mentioned in my previous post, the world street map is a tiles map service, which means it serves the map requests with prebuilt tiled images. Unless ESRI has built two sets of world street map services, one with the street labels, and one without. But I don't think so.
... View more
08-29-2013
09:45 AM
|
0
|
0
|
1509
|
|
POST
|
The issue is a known issue recognized by the DOJO team. To my understanding, the cause is actually pretty simple. floatingPane.show will call resize method every time, which will increase its width and height by the floatingpane border width. What I did is to create a subclass of FloatingPane, and overwrite the resize method. Here is the code. /**
* resize the floating pane
* @override The original one is buggy. That's why for the override.
*
* @issue
* #1) Each time when the default resize() is called, the location of the floatingPane is
* changed to a new location with an offset added to its top and left.
*
* #2) Each time when the default resize() is called, the size of the floatingPane is
* increased with a small amount in both width and height.
*
* @cause
* #1) The issue is caused by the below two commented out else-if statements, where
* if x/y is included in dim, the given new dimension, the left/top will be set to the x/y value.
* The problem is x/y is the absolute value related to the viewport or document root, while
* top/left is the offset value relative to the closest positioned ancestor, or its offsetParent.
* If the offsetParent is not the viewport or document root, the result will end up with top/left
* value increased with the x/y value of its offsetParent each time.
*
* #2) The issue is caused by the below two commented out dns.width/dns.height statements.
* Per the dojo source v1.8, dim is one of the two results based on startup(), show() and
* maxmimize(): the result of domGeom.position(this.domNode) and window.getBox(). The
* domGeom.position returns the width and height that include the border, but dns.width/dns.height
* does not. So set dns.width = dim.w actually increase the width by borderWidth * 2.
* @solution
* #1) top = dim.y - offsetParent.y; left = dim.x - offsetParent.x;
* #2) dns.width = dim.w - borderWidth * 2
*
* @see http://bugs.dojotoolkit.org/ticket/5849
* @see http://www.w3schools.com/jsref/dom_obj_all.asp
*
* @comment
* The above issue is with dojo 1.8 and below. Hopefully it can be fixed in the future release.
*
*/
resize: function(/* Object */dim){
// override: do nothing if passing no dim.
if (!dim) return;
// summary:
// Size the FloatingPane and place accordingly
dim = dim || this._naturalState;
this._currentState = dim;
// Variables used for the issue corrections
// calculate the offset due to the border width
// borderOffset = borderWidth * 2
// @see http://www.w3schools.com/jsref/dom_obj_all.asp
var borderOffset = this.domNode.offsetWidth - this.domNode.clientWidth;
// get offsetParent node and its location values
var offsetParent = this.domNode.offsetParent;
var offsetLocation = {x: 0, y: 0};
if (offsetParent) {
var offsetParentLoc = domGeom.position(offsetParent);
offsetLocation = {x: offsetParentLoc.x, y: offsetParentLoc.y};
}
// From the ResizeHandle we only get width and height information
var dns = this.domNode.style;
if("t" in dim){ dns.top = dim.t + "px"; }
// else if("y" in dim){ dns.top = dim.y + "px"; } // original line that causes issue #1. DON'T uncomment this line!!!
else if("y" in dim){ dns.top = (dim.y - offsetLocation.y) + "px"; } // correction of issue #1.
if("l" in dim){ dns.left = dim.l + "px"; }
// else if("x" in dim){ dns.left = dim.x + "px"; } // original line that causes issue #1. DON'T uncomment this line!!!
else if("x" in dim){ dns.left = (dim.x - offsetLocation.x) + "px"; } // correction of issue #1.
// dns.width = dim.w + "px"; // original line that causes the issue #2
// dns.height = dim.h + "px"; // original line that causes the issue #2
dns.width = (dim.w - borderOffset) + "px"; // correction of issue #2
dns.height = (dim.h - borderOffset) + "px"; // correction of issue #2
// Now resize canvas
var mbCanvas = { l: 0, t: 0, w: (dim.w - borderOffset), h: (dim.h - this.focusNode.offsetHeight - borderOffset) };
domGeom.setMarginBox(this.canvas, mbCanvas);
// If the single child can resize, forward resize event to it so it can
// fit itself properly into the content area
this._checkIfSingleChild();
if(this._singleChild && this._singleChild.resize){
this._singleChild.resize(mbCanvas);
}
}
... View more
08-29-2013
09:00 AM
|
0
|
0
|
2738
|
|
POST
|
This is a more HTML, CSS and Javascript question. What I would do is to create two DIVs, one for each screen as you call it. Both DIVs will occupy the same space every single moment. So when you switch to the map view, show map DIV and hide the other; and vice versa. This way, you only need to initialize the map once.
... View more
08-29-2013
07:01 AM
|
0
|
0
|
1248
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-17-2013 05:16 AM | |
| 1 | 11-06-2013 04:34 AM | |
| 1 | 08-29-2013 10:58 AM | |
| 6 | 10-20-2020 02:09 PM | |
| 1 | 11-20-2013 06:09 AM |
| Online Status |
Offline
|
| Date Last Visited |
10-17-2024
08:41 AM
|