|
BLOG
|
Rebecca Strauch I am slowly moving over my advanced draw widget to also be available in the WebApp builder. Here is the link to the document Enhanced Draw Widget
... View more
02-27-2015
10:57 AM
|
1
|
0
|
22085
|
|
DOC
|
Hey everybody, Since I have created an Enhanced Draw widget for the Javascript API, I figured it might be a good idea to enhance the draw widget that ESRI has provided in the WebApp builder. You can check out my blog for the Javascript API HERE. The widget for the WebApp builder is still a work in progress, but I figured I share what I have so far. To see how the right click menu will eventually look out see HERE. At the moment you can right click a graphic once it has been created and do adjustments to them. If you have placed text you can right click it and change what it says, color etc... You can see a live version HERE. V1.2: - Adjusted functionality on Extent to prevent an error. V1.1: - Added the option to add Lat/Long to a point or picturemarker - Cleaned up some of the code Let me know what you think! Tim
... View more
02-27-2015
10:55 AM
|
6
|
39
|
31486
|
|
POST
|
Jodie, I put the document path directly in my feature layer as an attribute and it worked for me. Is there anything you could do like that? Tim
... View more
02-27-2015
05:33 AM
|
0
|
1
|
1215
|
|
DOC
|
Thomas Colson as asked I have added a UTM function, let me know what you think
... View more
02-26-2015
12:42 PM
|
3
|
0
|
24224
|
|
POST
|
Check out my post here: Javascript API - Advanced Draw widget
... View more
02-25-2015
12:47 PM
|
1
|
0
|
3080
|
|
POST
|
Try this: if (this.config.enableAddText) {
if (query("div#TextButton .dijitButton .dijitButtonNode").on('click', lang.hitch (this, function()
{console.log("if query text button accessed")
})))
{
var map = this.map;
console.log("text button was clicked");
var textAdd = query("div#mapDiv").on('click', lang.hitch (this, function (evt){
var map = this.map;
map.graphics.add(
new Graphic(
new Point(evt.mapPoint.x, evt.mapPoint.y, new esri.SpatialReference({ wkid: 102100 })),
new TextSymbol(dojo.byId("tsText").value).setColor(
new Color([0,0,0])).setAlign(esri.symbol.Font.ALIGN_START).setAngle(0).setOffset(0,0).setFont(
new Font("12pt").setWeight(esri.symbol.Font.WEIGHT_BOLD))
)
);
console.log(map);
console.log(evt.mapPoint.x);
console.log(evt.mapPoint.y);
console.log(dojo.byId("tsText").value);
console.log("added text graphic");
textAdd.remove();
}));
}
};
... View more
02-25-2015
12:46 PM
|
0
|
2
|
3080
|
|
POST
|
Anne, Do you have a feature layer with attributes? If so, then you can add two fields , call them Lat and Long. Right click the heading of one of the Fields and choose "Calculate Geometry" in the unit dropdown box should be Decimal. Tim
... View more
02-25-2015
12:32 PM
|
2
|
1
|
2440
|
|
POST
|
Sounds like you want to do something similar like what I did here: http://jsfiddle.net/timw1984/4p7d241v/17/embedded/result/
... View more
02-25-2015
12:19 PM
|
0
|
2
|
3080
|
|
POST
|
This might work? if (this.config.enableAddText) {
if (query("div#TextButton .dijitButton .dijitButtonNode").on('click', lang.hitch (this, function()
{console.log("if query text button accessed")
})))
{
var map = this.map;
console.log("text button was clicked");
query("div#mapDiv").on('click', lang.hitch (this, textClick))
var textMe = function textClick(evt){
var map = this.map;
map.graphics.add(
new Graphic(
new Point(evt.mapPoint.x, evt.mapPoint.y, new esri.SpatialReference({ wkid: 102100 })),
new TextSymbol(dojo.byId("tsText").value).setColor(
new Color([0,0,0])).setAlign(esri.symbol.Font.ALIGN_START).setAngle(0).setOffset(0,0).setFont(
new Font("12pt").setWeight(esri.symbol.Font.WEIGHT_BOLD))
)
);
console.log(map);
console.log(evt.mapPoint.x);
console.log(evt.mapPoint.y);
console.log(dojo.byId("tsText").value);
console.log("added text graphic");
textMe.remove();
};
}
};
... View more
02-25-2015
12:18 PM
|
0
|
4
|
3080
|
|
POST
|
Chris, the following code will run on button click: <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Create Map and add a dynamic layer</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css"/>
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
h3 { margin: 0 0 5px 0; border-bottom: 1px solid #444; }
.shadow {
-moz-box-shadow: 0 0 5px #888;
-webkit-box-shadow: 0 0 5px #888;
box-shadow: 0 0 5px #888;
}
#mapDiv{ margin: 0; padding: 0; }
#leftPanel {
margin:5px;
background: #fff;
color: #444;
font-family: arial;
width: 250px;
border-right: solid 1px #888;
}
#footer{
border-top: solid 1px #888;
height:55px;
}
#status{
background-color:#E0E0E0;
color: #707070;
font-weight:bold;
padding: 3px;
border: solid 1px #707070;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius:5px;
position:absolute;
top:50%;
right:50%;
z-index:100;
display:none;
height:20px;
}
</style>
<script src="http://js.arcgis.com/3.12/"></script>
<script>
var map;
require([
"esri/map",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/ImageParameters",
"esri/dijit/BasemapToggle",
"dojo/on",
"dojo/parser",
"dijit/registry",
"esri/tasks/Geoprocessor",
"dojo/dom",
"dijit/layout/BorderContainer",
"dijit/form/Button",
"dojo/domReady!"
], function (
Map, ArcGISDynamicMapServiceLayer, ImageParameters, BasemapToggle,on, parser,registry, Geoprocessor, dom) {
//parser.parse();
map = new Map("mapDiv", {
basemap: "topo",
center: [-124.5, 44.15],
zoom: 8
});
var toggle = new BasemapToggle({
map: map,
basemap: "satellite"
}, "BasemapToggle");
toggle.startup();
//////////////////////// Geoprocessing
// esri.tasks.gp is required for using Geoprocessor.
// Add it along with other dojo.require statements.
/* Step 1: Initialize Geoprocessing Task as a global variable.
That is, declare the variable outside a function definition
since we will be using gpTask variable in other methods */
var gpTaskUrl="http://bhc.coas.oregonstate.edu:6080/arcgis/rest/services/geoprocessing/RasterPlusModel/GPServer/Model";
var gpTask = new Geoprocessor(gpTaskUrl);
// Set output spatial reference property to map's spatial reference.
// myMap is assumed to be an instance of map container esri.map.
gpTask.outSpatialReference=map.spatialReference;
//Step 2: Setup Parameters of the task
function setupParameters(){
// Get Input Parameter 1 : GPFeatureRecordSetLayer from fLayer.
var Input_raster_or_constant_value_1 = "Cetaceans\\Initial\\suitability";
// Get Input Parameter 2 : GPLinearunit from a dojo UI element
var Input_raster_or_constant_value_2 = "Cetaceans\\Initial\\suitability";
var params= {"Input_raster_or_constant_value_1":Input_raster_or_constant_value_1, "Input_raster_or_constant_value_2":Input_raster_or_constant_value_2};
// Return name-value pairs of parameters
return params;
}
on(dom.byId("hotspotButton"), "click", myGPSubmitJob);
//Step 3: Run the task
function myGPSubmitJob(){
// Get params from setupParameters method described above.
var params=setupParameters();
// Setup event handlers.
dojo.connect(gpTask, "onJobComplete",onTaskComplete);
dojo.connect(gpTask, "onError",onTaskFailure);
dojo.connect(gpTask, "onStatusUpdate",onTaskStatus);
gpTask.submitJob(params);
}
// On Job Complete Callback add a dynamic map service using ResultMapService
function onTaskComplete(jobInfo){
//replace mapservice url with your url and append jobid
var mapurl = "http://bhc.coas.oregonstate.edu:6080/arcgis/rest/services/geoprocessing/RasterPlusModel/MapServer/jobs/" + jobinfo.jobId;
//create a dynamic map service
var gpResultLayer = new esri.layers.ArcGISDynamicMapServiceLayer(mapurl, {
id: "foo",
opacity: 0.5
});
//add to web application.
map.addLayer(gpResultLayer);
}
// Event handler for onStatusUpdate event
function onTaskStatus(jobInfo) {
//write status to console to help debugging
console.log(jobInfo.jobStatus);
}
// Event handler for onError event
function onTaskFailure(error) {
// Report error
alert("Error:"+ error);
}
app = {
myGPSubmitJob: myGPSubmitJob
};
});
</script>
</head>
<body>
<div data-dojo-type="dijit.layout.BorderContainer"
data-dojo-props="design:'headline',gutters:false"
style="width: 100%; height: 100%; margin: 0;">
<div id="mapDiv"></div>
<div id="leftPanel" data-dojo-type="dijit.layout.ContentPane"data-dojo-props="region:'left'">
<div align="center">
<button id="hotspotButton" data-dojo-type="dijit.form.Button" type="button" data-dojo-attach-point="button">Submit Job</button>
</div>
</div>
</div>
</body>
</html> Hope this helps! Tim
... View more
02-25-2015
10:50 AM
|
0
|
9
|
2840
|
|
POST
|
Hey everybody, I am trying to create tabs in my widget.html files but can't seem to get it to work. Did anybody have any success with this? I want it to look like this <div data-dojo-type="dijit/layout/TabContainer" style="width: 100%; height: 100%;"> <div data-dojo-type="dijit/layout/ContentPane" title="My first tab" data-dojo-props="selected:true"> Text here </div> <div data-dojo-type="dijit/layout/ContentPane" title="My second tab"> Text here </div> <div data-dojo-type="dijit/layout/ContentPane" title="My last tab" > Text here </div> </div> Thanks, Tim
... View more
02-24-2015
10:54 AM
|
2
|
8
|
10934
|
|
DOC
|
Hey Thomas, I like your explanation. I was about to add an explanation to my widget but if you don't mind using yours, I would add that. Tim
... View more
02-24-2015
10:11 AM
|
0
|
0
|
906
|
|
BLOG
|
If you just updated it, I didn't get a message. Maybe I have it configured wrong.
... View more
02-24-2015
08:43 AM
|
1
|
0
|
22085
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-06-2015 06:58 AM | |
| 1 | 05-04-2016 07:27 AM | |
| 1 | 07-06-2017 08:12 AM | |
| 1 | 10-26-2015 11:51 AM | |
| 1 | 12-12-2014 12:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|