|
POST
|
It looks to me like .remove is not working correctly on the clock. I'm not sure if this is my mistake or a problem in the clock code. Discounting .remove, you should still be able to toggle the clock's visibility and the lighting in the scene. You can just allow the event listener to keep running in the background. Based on your code, something like this should work: let shadowBtn = dom.byId('shadow');
let clock = new Clock({
el: 'clock',
skin: require.toUrl('./third-party/clock.svg'),
time: sceneView.environment.lighting.date.getTime()
});
// start with lighing off as clock starts hidden
sceneView.environment.lighting.directShadowsEnabled = false;
clock.on("time-change", function (time) {
sceneView.environment.lighting.date = time;
});
sceneView.ui.add('clock', 'bottom-left');
clock.el.style.visibility = 'hidden';
shadowBtn.addEventListener('click', function(e){
if (clock.el.style.visibility !== 'hidden'){
clock.el.style.visibility = 'hidden';
sceneView.environment.lighting.directShadowsEnabled = false;
} else {
clock.el.style.visibility = 'visible';
sceneView.environment.lighting.directShadowsEnabled = true;
}
});
... View more
04-28-2017
12:06 PM
|
2
|
1
|
1208
|
|
POST
|
If your polygon has uniform z values you could just edit the geometry engine's output like this: JS Bin - Collaborative JavaScript Debugging If your polygon has varying z values it's a harder problem. I'm not really sure the right way to approach it, but the geometry engine doesn't appear to have a solution built in. Convex hull looks like it respects z values, but it returns the smallest possible enclosing polygon rather than a buffer.
... View more
04-28-2017
08:57 AM
|
0
|
1
|
924
|
|
POST
|
If your goal is to hide/show the clock, you might want to toggle "visibility: hidden" and "visibility: visible" rather than display. If you do it this way, you won't have to remove and re-add the clock each time, you'll just be hiding it. Something like this: let btn = <reference to HTML button to toggle clock>;
let clock = <reference to clock widget>;
btn.addEventListener('click',(e)=>{
// clock.el will be a reference to the widget's element containing
// the clock
if (clock.el.style.visibility === 'visible'){
clock.el.style.visibility = 'hidden';
} else {
clock.el.style.visibility = 'visible';
}
}); In terms of removing the environment settings, you could just use https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#environment to toggle direct shadows on and off. It's also possible that what you want to do is to totally remove the time and environment when the clock is toggled off. In that case, you should remove the clock.on("time-change") event. .on will return a handle which you can remove by calling .remove on the handle. Something like this: let btn = <reference to HTML button to toggle clock>;
let clock = <reference to clock widget>;
let listener = clock.on('time-change', function(...){...});
btn.addEventListener('click',(e)=>{
// clock.el will be a reference to the widget's element containing
// the clock
if (clock.el.style.visibility === 'visible'){
clock.el.style.visibility = 'hidden';
listener.remove();
view.environment.lighting.directShadowsEnabled = false;
} else {
clock.el.style.visibility = 'visible';
listener = clock.on('time-change', function(...){...});
view.environment.lighting.directShadowsEnabled = true;
}
});
... View more
04-28-2017
08:12 AM
|
0
|
0
|
1208
|
|
POST
|
My feeling is that you can probably just add classes/ids to your HTML elements and reference a separate CSS file in your index.html (or whatever the entrypoint to your page is) as in: <link rel="stylesheet" href="xxx.css"> If you want to organize things nicely, you could make a different CSS file for each widget. You could also add a class or an id to your widget's outer-most element and ensure that only children of that element are being affected by the css in each <widget>.css file.
... View more
04-26-2017
10:10 AM
|
0
|
1
|
867
|
|
POST
|
If you want to resize the map when the popup is opened, watching the visible property and manually resizing the map div sounds like a good bet. Another thing to look at would be modifying the pop-up's size via CSS. You can use dev tools to inspect the pop-up and see what classes are on it and then add some CSS to your project targeting those classes to override the esri CSS file. Docking the popup might also help in 4.XX.
... View more
04-26-2017
05:53 AM
|
0
|
0
|
303
|
|
POST
|
To start with, what happens if you remove the zoom: 3? In general, I'm not sure if setting the zoom and the extent makes sense, since they should do the same thing. I would suggest using a center and a zoom rather than an extent for this kind of thing. So you could zoom to the perspective you like, and log the center and zoom and pass those in instead of using an extent. Setting an extent can be a little tricky as I recall (been a while since I worked with 2D). For an extent to be possible to fit exactly to a map, the ratio between its height and width must be the same as the ratio between the map div's height and width. If your map is much wider than it is tall, it may not be possible to fix your xmin, xmax, ymin, ymin as the corners of the map div. In these situations, it would be preferable (in my opinion) if the map guaranteed than the entire extent was fit and never cut anything off. But this may not be done. My bet is that the map takes whichever dimension is longer (in this case, x, or width) and cuts off the other dimension. This would work perfectly if the map div was a square, but if it's not it may cause one dimension to get cut off a bit.
... View more
04-25-2017
08:35 AM
|
1
|
1
|
1260
|
|
POST
|
It seems to me that the only solution to this problem is to re-engineer the API to ensure that nothing that IIS doesn't accept ever gets posted. If the issue here is the HTML strings, then this probably means finding a different way to store infoTemplates. I don't know if this has been considered and rejected, if it has never been considered, or if it's currently in progress. The next-best solution (in my opinion) would just be to prevent the infoTemplate from getting posted during print requests, or any requests that pass through IIS. Like FC Basson mentioned, it looks like the setRequestPreCallback is an ideal way to do this. I agree that ideally the JSON representation of a map should never cause this kind of issue with IIS, but stripping out the infoTemplate seems like a pretty harmless solution to me.
... View more
04-24-2017
08:41 AM
|
1
|
2
|
3006
|
|
POST
|
I'm not sure I understand the issue here. Is .NET request validation preventing the request from being sent because it contains an html string? Is there a reason print needs to know about your infoTemplate? If not, and I understand the issue correctly, I would consider storing the infoTemplate's content in a temp variable, setting it to null on the map, making the print request, and then resetting the content from the temp variable when the request finishes.
... View more
04-24-2017
06:16 AM
|
1
|
6
|
3006
|
|
POST
|
I don't know of a way to have a multicolor extrude symbol. However, you can get this effect by stacking several graphics, each with a different color symbol. The downside here is that you have to keep track of the geometries involved and make sure they line up without any gaps. Here's an example: JS Bin - Collaborative JavaScript Debugging
... View more
04-21-2017
06:47 AM
|
0
|
0
|
911
|
|
POST
|
The reason the .otherwise is always running is because you're invoking the function that you're passing into it: view.hitTest(screenPoint).then(
//callback
function (response) {
alert("hit")
}).otherwise(AddPointGraphic(event))
// ^ AddPointGraphic is being invoked because it
// is followed by ().
.otherwise is like .then, you should pass in a function as an argument, but you shouldn't invoke the function. It's also important to note that .otherwise will get passed the error, not the event. To go a little further, .otherwise (.catch for native JS promises) is triggered in the event of an error or if the promise that it's attached to is rejected. In this case, you don't want to do anything if hitTest throws an error. HitTest throwing an error doesn't mean "I didn't find any graphics," it means "Something broke." As in Robert's example, I think the correct way to handle this functionality is to handle all of this logic in the .then callback. You can check to see if any graphics were found in the .then callback, and decide what to do based on that.
... View more
04-14-2017
06:15 AM
|
1
|
0
|
1021
|
|
POST
|
Yeah, like Robert said, it's not in the SDK documentation, but it is in 4.3. You can pull it in the same way you'd pull in any other module: JS Bin - Collaborative JavaScript Debugging
... View more
04-13-2017
06:02 AM
|
0
|
0
|
1069
|
|
POST
|
I haven't noticed any progress in this area. My advice would be to wrap this functionality in functions. For example: function updateGeometry(view, graphic, newGeometry){
// get layer. either the graphic is in its own layer or it's
// on the view' graphic layer
var lyr = graphic.layer || view.graphics;
// clone old graphic and edit geometry
var newGraphic = graphic.clone();
newGraphic.geometry = newGeometry;
// remove old graphic, add new graphic
lyr.remove(graphic);
lyr.add(newGraphic);
} In terms of updating the popup, I would do that by hand as well. You can programmatically open popups with view.popupManager._showPopup({graphic: <graphic>, mapPoint: <point geometry>}) Using that you could write a function like this: // to be called after your graphic updates and you want
// the updates to be reflected in the pop up
updatePopup(view, graphic){
// assuming this graphic has a point geometry
view.popupManager._showPopup({graphic: graphic, mapPoint: graphic.geometry});
}
... View more
04-12-2017
09:05 AM
|
1
|
0
|
2898
|
|
POST
|
Thanks for digging that up. I think the distinction here is that this map is actually querying the feature service on click, instead (or maybe in addition to) a front-end hitTest. Querying a service has no trouble returning multiple features, which are then used to hydrate the pop-up. Assuming you have a service to query, you should be able to manually perform a query using FeatureLayer.createQuery and FeatureLayer.queryFeatures. One way to set this up would be adding a click event to the view and, on click, firing off a queryFeatures request to the service. You can pass in the point where the user clicked as your query's geometry and I'd try the "intersects" spatial relationship. The service should respond with a list of features which you can use to hydrate the popup like this: view.popup.open({
features: responseFromFeatureService.features, // array of features
location: mapPoint // pop up points to this
}); You may want to call event.stopPropagation() inside your click callback to stop the client-side hitTest from occurring. I'm not sure what exactly happened to cause this issue for you. It does seem like this should be handled automatically and there may be some configuration setting I'm forgetting about that would take care of this.
... View more
04-03-2017
12:46 PM
|
1
|
0
|
1884
|
|
POST
|
You may be able to use a feature layer for this and overwrite the renderer on the feature layer so that it returns whatever symbol you want. If there is some other reason you need to use a graphics layer then you may have to search through the list of graphics added to the map manually based on some unique key rather than using queryFeatures. I'm not sure how to programmatically select something in 3.XX so I can't comment on that. I think map.graphics will have a list of graphics added to the base graphics layer and you should be able to search that list based on the unique key that you used in your table.
... View more
03-31-2017
01:02 PM
|
0
|
2
|
1023
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-03-2017 08:23 AM | |
| 1 | 11-02-2017 08:36 AM | |
| 1 | 11-02-2017 09:23 AM | |
| 1 | 09-20-2017 02:07 PM | |
| 1 | 10-06-2017 05:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|