POST
|
I did a trial to test which document mode can fire map.on("mouse-drag"); Conclusion: <meta http-equiv="X-UA-Compatible" Content="IE=7"/> <meta http-equiv="X-UA-Compatible" Content="IE=8"/> <meta http-equiv="X-UA-Compatible" Content="IE=9"/> Can Fire <meta http-equiv="X-UA-Compatible" Content="IE=10"/> Can not Fire Code:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible content="IE=10"/> <!--mouseDrag can't be triggered-->
<title>map.disablePan doesn't work immediately.</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.7/js/esri/css/esri.css"/>
<style>
html,body,#mapDiv{
padding:0;
margin:0;
height:100%;
}
#dvBind{
position:absolute;
background:rgb(220,220,220);
cursor:pointer;
z-index:2;
left:100px;
top:100px;
}
</style>
<script src="http://js.arcgis.com/3.7/"></script>
<script>
var map;
var mouseOutHandler=null;
var centerPt=null;
function getDistance(ptB){
var ptA=centerPt.mapPoint;
return Math.sqrt(Math.pow(ptA.x-ptB.x,2)+Math.pow(ptA.y-ptB.y,2));
}
function bindMapDrags(){
map.on("mouse-drag-start",function(evt){
console.log("dragStart triggered");
centerPt=evt;
});
map.on("mouse-drag",function(evt){
console.log("dragging triggered");
var tempRad=getDistance(evt.mapPoint);
console.log("radius is:"+tempRad);
});
}
dojo.ready(function(){
//create map and add a dynamic layer
map = new esri.Map("mapDiv",{
showAttribution: false
});
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "jpeg";
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer", {
"opacity":0.5,
"imageParameters":imageParameters
});
map.addLayer(dynamicMapServiceLayer);
bindMapDrags();
//bind UI events.
document.getElementById("dvBind").onclick=function(){
if(mouseOutHandler==null){
console.log("map.mouseOut is binded");
mouseOutHandler= dojo.connect(map,"onMouseOut",function(){
map.disablePan();
console.log("map.onMouseOut is triggered. map.disablePan() is executed. However, if the left button is not released, pan the map at your will!");
console.log("If you know any way to STOP PAN IMMEDIATELY, leave a message, Thank you!");
});
}
};
});
</script>
<body>
<div id="dvBind" title="Click me to bind map.onMouseOut">Bind map.onMouseOut</div>
<div id="mapDiv"></div>
</body>
</html>
Hey man, you read and you never reply. Can u make a noice here to show that you show that you are not in a cinema, but in a forum to exchange experience?
... View more
10-10-2013
02:08 AM
|
0
|
0
|
580
|
POST
|
Background: Out-of-mapDiv Pan may cause unstoppable Pan in some case. Inside mapDiv Pan is in desperate need. Code below intended to disable pan The moment mouse move out mapDiv. It failed when mouse Left not released.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>map.disablePan doesn't work immediately.</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.7/js/esri/css/esri.css"/>
<style>
html,body,#mapDiv{
padding:0;
margin:0;
height:100%;
}
#dvBind{
position:absolute;
background:rgb(220,220,220);
cursor:pointer;
z-index:2;
left:100px;
top:100px;
}
</style>
<script src="http://js.arcgis.com/3.7/"></script>
<script>
dojo.require("esri.map");
var map;
var mouseOutHandler=null;
dojo.ready(function(){
//create map and add a dynamic layer
map = new esri.Map("mapDiv");
var imageParameters = new esri.layers.ImageParameters();
imageParameters.format = "jpeg";
var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer", {
"opacity":0.5,
"imageParameters":imageParameters
});
map.addLayer(dynamicMapServiceLayer);
//bind UI events.
document.getElementById("dvBind").onclick=function(){
if(mouseOutHandler==null){
console.log("map.mouseOut is binded");
mouseOutHandler= dojo.connect(map,"onMouseOut",function(){
map.disablePan();
console.log("map.onMouseOut is triggered. map.disablePan() is executed. However, if the left button is not released, pan the map at your will!");
console.log("If you know any way to STOP PAN IMMEDIATELY, leave a message, Thank you!");
});
}
};
});
</script>
</head>
<body>
<div id="dvBind" title="Click me to bind map.onMouseOut">Bind map.onMouseOut</div>
<div id="mapDiv"></div>
</body>
</html>
Normal readers in this forum are really quiet,they read, never reply. They ask, never reply. Senior Members are too busy to answer naive question like this. Ok, No one expect a answer with detail here. One clue , one sentence is enough. Could you guys make a noice like Gr......,En.....,Yeah.... to make this place like a forum rather than a Zoo?
... View more
10-09-2013
11:58 PM
|
1
|
1
|
1358
|
POST
|
Map is panned even when mouse is out of the mapDiv. The out-of-box pan was designed pretty nice. However in my case, pan must be disabled when mouse is out of mapDiv. How to do that?
... View more
10-09-2013
07:23 PM
|
0
|
0
|
642
|
POST
|
Yes. var centerPt=null; //description:get distance between ptB and centerPt //return: number function getDistance(ptB){ if(centerPt==null||centerPt.mapPoint==null){ console.log("unexpected para,function getDistance()"); return ""; } var ptA=centerPt.mapPoint; return Math.sqrt(Math.pow(ptA.x-ptB.x,2)+Math.pow(ptA.y-ptB.y,2)); } //onDragStart, record the centerPt dojo.connect(mapAppObj.map,"onMouseDragStart",function(evt){ console.log("dragStart triggered"); centerPt=evt; }); } //onDrag, calculate distance between currentPoint and centerPt dojo.connect(mapAppObj.map,"onMouseDrag",function(evt){ var radius=getDistance(evt.mapPoint); console.log("radius is:"+radius); }
... View more
10-09-2013
06:37 PM
|
1
|
0
|
626
|
POST
|
Subway map published to network analysis service. select A as start station, B as destination station. then routeTask.solve(paras,function(resultRoutes){}); why only one route returned while obviously there are multiple routes? It has been recognized the routeTask.solve() return the route of shortest distance by default. However,in many subway-transfer-route cases, a shortest distance route may cost more time than the second shortest distance route. How to get the second shortest distance route using the ArcGIS Javascript API 3.4? How to get the second shortest distance route using ArcGIS SDK? Any Help would be appreciated. Here is my code snippets var routeTask = new esri.tasks.RouteTask(networkService);
var routeParas = new esri.tasks.RouteParameters();
routeParas.outSpatialReference = map.spatialReference; //outspatialReference of rp
routeParas.returnRoutes = true;
routeParas.stops = new esri.tasks.FeatureSet(); //stops of rp, each stop is a esri.Grahic
routeParas.stops.features.push(tempGra1); //start station
routeParas.stops.features.push(tempGra2);//end station
var routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color([0, 0, 255, 0.5])).setWidth(5);
routeTask.solve(routeParas, function (solveResults) {
alert(solveResults.routeResults.length);//always one route,why?
........
}
... View more
05-13-2013
03:47 PM
|
0
|
0
|
499
|
POST
|
It has been recognized the routeTask.solve() return the route of shortest distance by default. However,in many subway-transfer-route cases, a shortest distance route may cost more time than the second shortest distance route. How to get the second shortest distance route using the ArcGIS Javascript API 3.4? How to get the second shortest distance route using ArcGIS SDK? Any Help with interface name or code snippets would be appreciated. I'm Hinada.
... View more
05-13-2013
06:05 AM
|
0
|
0
|
172
|
POST
|
Subway map published to network analysis service. select A as start station, B as destination station. then routeTask.solve(paras,function(resultRoutes){}); why only one route returned while obviously there are multiple routes? Code snippets: var routeTask = new esri.tasks.RouteTask(networkService); var routeParas = new esri.tasks.RouteParameters(); routeParas.outSpatialReference = map.spatialReference; //outspatialReference of rp routeParas.returnRoutes = true; routeParas.stops = new esri.tasks.FeatureSet(); //stops of rp, each stop is a esri.Grahic routeParas.stops.features.push(tempGra1); //start station routeParas.stops.features.push(tempGra2);//end station var routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color([0, 0, 255, 0.5])).setWidth(5); routeTask.solve(routeParas, function (solveResults) { alert(solveResults.routeResults.length);//always one route,why? ........ } Any help will be appreciated.
... View more
05-12-2013
04:31 AM
|
0
|
1
|
442
|
POST
|
I have got a TIN and a Polygon featureclass. Both have the same spatialreference. The polygon featureclass contains only one polygon feature, which is totally within the extent of TIN. I clipped the TIN with the polygon, using the ArcMap 3D Analyst Tools-->TIN Creation-->Edit TIN Tool.The result TIN is correct. I want to use Geoprocessor and Analyst3DTools. EditTin Class to do the whole work. code sentences are Excuted, but the TIN is still the same, not clipped by the polygon feature class. Here is my code:
public static void GetClippedTinByPolygon()
{
Geoprocessor GP = new Geoprocessor();
GP.OverwriteOutput = true;
EditTin pEditTin = new EditTin();
pEditTin.in_tin = "E:\\CZTinsPCS\\TinSurfaceCopy";
pEditTin.in_features = "E:\\CZShapes\\PolygonRegionPCS.shp";
GP.Execute(pEditTin, null);
}
Anyone succeeded in Edit TinSurface using Geoprocessor and EditTin Class? ---------------------------------- The function did works, just lack one parameter. in ArcMap Toolbox, after select in put feature , set the "SF_Type" parameter to "hardclip", the result TIN will be Clipped by the feature class. I think my problem will be solved, when I send the SF_Type parameter by code.
... View more
05-08-2012
09:38 PM
|
0
|
0
|
847
|
Title | Kudos | Posted |
---|---|---|
1 | 10-09-2013 06:37 PM | |
1 | 10-09-2013 11:58 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|