mirror of
https://github.com/Esri/offline-editor-js.git
synced 2025-12-15 15:20:05 +00:00
167 lines
7.8 KiB
HTML
Executable File
167 lines
7.8 KiB
HTML
Executable File
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<title>Jasmine Spec Runner</title>
|
|
|
|
<link rel="shortcut icon" type="image/png" href="../vendor/jasmine-1.3.1/jasmine_favicon.png">
|
|
<link rel="stylesheet" type="text/css" href="../vendor/jasmine-1.3.1/jasmine.css">
|
|
<script type="text/javascript" src="../vendor/jasmine-1.3.1/jasmine.js"></script>
|
|
<script type="text/javascript" src="../vendor/jasmine-1.3.1/jasmine-html.js"></script>
|
|
<link rel="stylesheet" href="http://js.arcgis.com/3.6/js/dojo/dijit/themes/claro/claro.css">
|
|
<link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css">
|
|
<script src="http://js.arcgis.com/3.6/"></script>
|
|
|
|
<!-- include source files here... -->
|
|
<script type="text/javascript" src="../lib/edit/OfflineStore.js"></script>
|
|
<script type="text/javascript" src="../lib/tiles/phoneGapConnector.js"></script>
|
|
|
|
<!-- include spec files here... -->
|
|
<script type="text/javascript" src="spec/OfflineStoreSpec.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
var map;
|
|
var offlineStore;
|
|
var phonegap;
|
|
var vertices;
|
|
var landusePointLayer;
|
|
var point, line, polygon;
|
|
var serializedGraphic1,serializedGraphic2,serializedGraphicsArr = [];
|
|
var simplePtGraphic, simplePolygonGraphic, simpleLineGraphic;
|
|
var complexPtGraphic, complexPolygonGraphic, complexLineGraphic;
|
|
var updateFlag = false;
|
|
|
|
require([
|
|
"esri/map",
|
|
"esri/geometry/Point",
|
|
"esri/geometry/Polygon",
|
|
"esri/geometry/Polyline",
|
|
"esri/layers/FeatureLayer",
|
|
"dojo/domReady!"],
|
|
function(Map,Point,Polygon,Polyline,FeatureLayer) {
|
|
|
|
map = new Map("map", {
|
|
basemap: "topo",
|
|
center: [-83.244, 42.581],
|
|
zoom: 13,
|
|
sliderStyle: "small"
|
|
});
|
|
|
|
map.on("layer-add-result", test);
|
|
|
|
landusePointLayer = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/FeatureServer/6", {
|
|
mode: FeatureLayer.MODE_SNAPSHOT,
|
|
outFields: ["*"]
|
|
});
|
|
|
|
landusePointLayer.on("error",function(evt){
|
|
throw("Error loading layer: " + evt.toString());
|
|
})
|
|
|
|
map.addLayer(landusePointLayer);
|
|
|
|
});
|
|
|
|
function initGraphics(){
|
|
|
|
try{
|
|
var wkid = map.spatialReference;
|
|
|
|
serializedGraphic1 = {"layer":6,"enumValue":"delete","geometry":"{\"type\":\"point\",\"x\":-9266721.493065935,\"y\":5248417.656692019,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}","attributes":"{\"objectid\":42749,\"echelon\":null,\"reinforced\":0,\"combateffectiveness\":null,\"higherformation\":null,\"iff_sif\":null,\"direction\":-1,\"speed\":null,\"countrycode\":\"US\",\"staffcomment\":null,\"additionalinformation\":null,\"credibility\":null,\"reliability\":null,\"datetimevalid\":null,\"datetimeexpired\":null,\"uniquedesignation\":null,\"x\":null,\"y\":null,\"z\":null,\"symbolname\":\"Armored Combat BTG\",\"__hydrate_id\":\"0\"}"};
|
|
serializedGraphic2 = {"layer":6,"enumValue":"delete","geometry":"{\"type\":\"point\",\"x\":-9267129.475771423,\"y\":5247671.918014977,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}","attributes":"{\"objectid\":43946,\"echelon\":null,\"reinforced\":0,\"combateffectiveness\":null,\"higherformation\":null,\"iff_sif\":null,\"direction\":-1,\"speed\":null,\"countrycode\":\"US\",\"staffcomment\":null,\"additionalinformation\":null,\"credibility\":null,\"reliability\":null,\"datetimevalid\":null,\"datetimeexpired\":null,\"uniquedesignation\":null,\"x\":null,\"y\":null,\"z\":null,\"symbolname\":\"Armored Combat Battalion\",\"__hydrate_id\":\"0\"}"};
|
|
serializedGraphicsArr[0] = JSON.stringify(serializedGraphic1);
|
|
serializedGraphicsArr[1] = JSON.stringify(serializedGraphic2);
|
|
|
|
var simplePtGeom = new esri.geometry.Point(11111,-111111,map.spatialReference);
|
|
simplePtGraphic = new esri.Graphic(simplePtGeom);
|
|
|
|
var simpleLineGeom = {geometry:{"paths":[[[-91.40625,6.328125],[6.328125,19.3359375]]],
|
|
"spatialReference":{"wkid":wkid}}};
|
|
|
|
simpleLineGraphic = new esri.Graphic(simpleLineGeom);
|
|
|
|
var simplePolygonGeom = {"geometry":{"rings":[[[-115.3125,37.96875],[-111.4453125,37.96875],
|
|
[-99.84375,36.2109375],[-99.84375,23.90625],[-116.015625,24.609375],
|
|
[-115.3125,37.96875]]],"spatialReference":{"wkid":wkid}}};
|
|
|
|
simplePolygonGraphic = new esri.Graphic(simplePolygonGeom);
|
|
|
|
var complexLineGeom ={geometry:{"paths":[[[-91.40625,6.328125],[6.328125,19.3359375]]],
|
|
"spatialReference":{"wkid":wkid}},
|
|
"symbol":{"color":[0,0,0,255],"width":1,"type":"esriSLS","style":"esriSLSSolid"}};
|
|
complexLineGraphic = new esri.Graphic(complexLineGeom);
|
|
|
|
var complexPolygonGeom = {"geometry":{"rings":[[[-115.312,37.96875],[-111.4453125,37.96875],
|
|
[-99.84375,36.2109375],[-99.84375,23.90625],[-116.015625,24.609375],
|
|
[-115.3125,37.96875]]],"spatialReference":{"wkid":wkid}},
|
|
"symbol":{"color":[0,0,0,64],"outline":{"color":[0,0,0,255],
|
|
"width":1,"type":"esriSLS","style":"esriSLSSolid"},
|
|
"type":"esriSFS","style":"esriSFSSolid"}};
|
|
|
|
complexPolygonGraphic = new esri.Graphic(complexPolygonGeom);
|
|
|
|
|
|
var complexPtGeom = {"geometry":{"x":-104.4140625,"y":69.2578125,
|
|
"spatialReference":{"wkid":wkid}},"attributes":{"XCoord":-104.4140625,
|
|
"YCoord":69.2578125,"Plant":"Mesa Mint"},"symbol":{"color":[255,0,0,128],
|
|
"size":12,"angle":0,"xoffset":0,"yoffset":0,"type":"esriSMS",
|
|
"style":"esriSMSSquare","outline":{"color":[0,0,0,255],"width":1,
|
|
"type":"esriSLS","style":"esriSLSSolid"}},
|
|
"infoTemplate":{"title":"Vernal Pool Locations","content":"Latitude: ${YCoord} <br/>Longitude: ${XCoord} <br/> Plant Name:${Plant}"}
|
|
};
|
|
|
|
complexPtGraphic = new esri.Graphic(complexPtGeom);
|
|
}
|
|
catch(err){
|
|
throw("Unable to initialize graphics: " + err.stack);
|
|
}
|
|
}
|
|
|
|
function test(evt){
|
|
|
|
if(evt.layer.hasOwnProperty("type") && evt.layer.type == "Feature Layer"){
|
|
|
|
try{
|
|
initGraphics();
|
|
offlineStore = new OfflineStore(map);
|
|
phonegap = new PhoneGapConnector();
|
|
}
|
|
catch(err){
|
|
console.log("ERROR initializing a library: " + err.toString())
|
|
}
|
|
|
|
|
|
var jasmineEnv = this.jasmine.getEnv();
|
|
jasmineEnv.updateInterval = 1000;
|
|
|
|
var htmlReporter = new jasmine.HtmlReporter();
|
|
|
|
jasmineEnv.addReporter(htmlReporter);
|
|
|
|
jasmineEnv.specFilter = function(spec) {
|
|
return htmlReporter.specFilter(spec);
|
|
};
|
|
|
|
var currentWindowOnload = window.onload;
|
|
|
|
window.onload = function() {
|
|
if (currentWindowOnload) {
|
|
currentWindowOnload();
|
|
}
|
|
execJasmine();
|
|
};
|
|
|
|
function execJasmine() {
|
|
jasmineEnv.execute();
|
|
}
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="map" style=" position: absolute; bottom: 0; right: 0; height:1px; width: 100px;"></div>
|
|
</body>
|
|
</html>
|