⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jitk_redlining.js

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JS
📖 第 1 页 / 共 2 页
字号:
    jitkRedliningRenderPointPreview();
}

function jitkRedliningChangelineType(divid) {
    jitkRedliningRenderLinePreview();
}

function jitkRedliningChangeShapeWidth() {
    jitkRedliningRenderPointPreview();
}

function jitkRedliningChangeLineWidth() {
    jitkRedliningRenderLinePreview();
}

function jitkRedliningChangePolygonBoundaryWidth(divid) {
    jitkRedliningRenderPreview();     
}

function jitkRedliningChangePolygonFillType(divid) {
    jitkRedliningRenderPreview();        
}

function jitkRedliningChangePolygonBoundaryType(divd) {
  	jitkRedliningRenderPreview();
}

function jitkRedliningChangePolygonFillTransparency(divd) {
   	jitkRedliningRenderPreview();
}

function jitkRedliningShowMenu(menu) {
	
	jitkPreviousTool = menu;
	
    if (!document.getElementById('jitkRedliningShape_pointMenu')) return;
    
    document.getElementById('jitkRedliningShape_circleMenu').style.display = "none";
    document.getElementById('jitkRedliningShape_pointMenu').style.display = "none";
    document.getElementById('jitkRedliningShape_lineMenu').style.display = "none";
    document.getElementById('jitkRedliningShape_polyMenu').style.display = "none";
    document.getElementById('shapeRedliningTask_param_shapeColor').style.color = "rgb(" + document.getElementById('shapeRedliningTask_param_shapeColor').value + ")";
    document.getElementById('shapeRedliningTask_param_shapeColor').style.background = "rgb(" + document.getElementById('shapeRedliningTask_param_shapeColor').value + ")";
    document.getElementById('shapeRedliningTask_param_lineColor').style.color = "rgb(" + document.getElementById('shapeRedliningTask_param_lineColor').value + ")";
    document.getElementById('shapeRedliningTask_param_lineColor').style.background = "rgb(" + document.getElementById('shapeRedliningTask_param_lineColor').value + ")";
    document.getElementById('shapeRedliningTask_param_polygonFillColor').style.background = "rgb(" + document.getElementById('shapeRedliningTask_param_polygonFillColor').value + ")";
    document.getElementById('shapeRedliningTask_param_polygonFillColor').style.color = "rgb(" + document.getElementById('shapeRedliningTask_param_polygonFillColor').value + ")";
    document.getElementById('shapeRedliningTask_param_polygonBoundaryColor').style.background = "rgb(" + document.getElementById('shapeRedliningTask_param_polygonBoundaryColor').value + ")";    
    document.getElementById('shapeRedliningTask_param_polygonBoundaryColor').style.color = "rgb(" + document.getElementById('shapeRedliningTask_param_polygonBoundaryColor').value + ")";    
    document.getElementById('shapeRedliningTask_param_arcColor').style.color = "rgb(" + document.getElementById('shapeRedliningTask_param_arcColor').value + ")";  
    document.getElementById('shapeRedliningTask_param_arcColor').style.background = "rgb(" + document.getElementById('shapeRedliningTask_param_arcColor').value + ")";
      
     
    if (menu == 'point'){
        document.getElementById('jitkRedliningShape_pointMenu').style.display = "block";
        jitkRedliningRenderPointPreview();
    }
    
    if (menu == 'line'){
        document.getElementById('jitkRedliningShape_lineMenu').style.display = "block";
        jitkRedliningRenderLinePreview();
    }
    
    if (menu == 'polygon' || menu == 'rectangle'){
        document.getElementById('jitkRedliningShape_polyMenu').style.display = "block";
        if (menu == 'polygon') jitkRedliningRenderPolygonPreview();
        if (menu == 'rectangle') jitkRedliningRenderRectanglePreview();
        //document.getElementById("EsriTaskCell_shapeRedliningTask1").style.overflow = "hidden";
    }
    
    if (menu == 'arc'){
        document.getElementById('jitkRedliningShape_circleMenu').style.display = "block";
        jitkRedliningRenderArcPreview();
    }
    
}

function jitkRedliningSetCurrentMenu(id){
    if (id == 'labelRedliningTask'){
        jitkPreviewDiv = 'jitk_fontPreview';
    }
    if (id == 'shapeRedliningTask'){
        jitkPreviewDiv = 'jitk_shapesPreview';
        jitkRedliningShowMenu('point');
    }
    if (id == 'graphicsRedliningTask'){
        jitkPreviewDiv = 'jitk_graphicsPreview';
    }
}

function jitkGetCSSPositionX(parent) {
	var offset = parent.x ? parseInt(parent.x) : 0;
	offset += parent.style.left ? parseInt(parent.style.left) : 0;
	for(var node = parent; node ; node = node.offsetParent ) { offset += node.offsetLeft; }
	return offset;
}

function jitkGetCSSPositionY(parent) {
	var offset = parent.y ? parseInt(parent.y) : 0;
	offset += parent.style.top ? parseInt(parent.style.top) : 0;
	for(var node = parent; node ; node = node.offsetParent ) { offset += node.offsetTop; }
	return offset;
}

function jitkRedliningChangeGraphics(divid){
    if (!document.getElementById(divid)) return;
    var idx = document.getElementById(divid).selectedIndex;
    var graphics = document.getElementById(divid).options[idx].value;
    if (graphics == ''){
        document.getElementById('jitk_graphicsPreview').innerHTML = '';
        return;
    }
    if (graphics.indexOf("upload-") < 0){
        var url = graphics;
        if (graphics.toUpperCase().indexOf(".ICO") > -1){
            var serverUrl = jitkRedliningGetUrl();
            url = serverUrl + '/graphicsServlet?fullpath=' + graphics;
        }
        // use of jquery notation here to avoid error when element doesn't exist
        $("#jitk_graphicsPreview").html('<img src="' + url + '"/>');
        //document.getElementById('jitk_graphicsPreview').innerHTML = '<img src="' + url + '"/>';
    }
    else {
        jitkRedliningCustomGraphicsPreview(graphics);
	}
	$("#jitk_graphicsPreview img").ifixpng();
}

function jitkRedliningGetUrl() {
   if(!EsriControls.maps[jitkMapId])  return;
    var map = EsriControls.maps[jitkMapId];
    var formId = map.formId;
    var serverUrl = EsriUtils.getServerUrl(formId);
    var pos = serverUrl.lastIndexOf("/");
    
    return serverUrl.substring(0, pos);
}

function jitkRedliningCustomGraphicsPreview(id, filename){
    var serverUrl = jitkRedliningGetUrl();
    var selopt = document.getElementById("graphicsRedliningTask_param_graphics");
    
    if (filename){ 
        var i = selopt.options.length;
        var fileId = id + '_' + filename;
        selopt.options[i] = new Option(filename, fileId);
        selopt.selectedIndex = i;
        var customList = document.getElementById("graphicsRedliningTask_param_customList").value;
        if (customList.length > 0) customList += ",";
        customList += fileId;
        document.getElementById("graphicsRedliningTask_param_customList").value = customList;
    }
    
    var imgurl = '<img src="' + serverUrl + '/graphicsServlet?id=' + id;
    if (filename) imgurl += '&filename=' + filename;
    imgurl += '"/>';
    document.getElementById("jitk_graphicsPreview").innerHTML = imgurl;
    
}

function jitkHandleUpload(filename, id) {
    //set filename, upload id and click 'Add Points' button
    var t = document.getElementsByTagName("INPUT");
    
    for (var i = 0; i < t.length; i++){
        if (t.item(i).id.indexOf("jitkRedliningGraphicsFilename") > 0)
            document.getElementById(t.item(i).id).value = filename;
        if (t.item(i).id.indexOf("jitkRedliningGraphicsId") > 0)
            document.getElementById(t.item(i).id).value = id;
    }    
    
    var url = jitkRedliningGetUrl() + '/graphicsServlet?id=' + id;
    url += '&filename=' + filename + '&mode=checksize';
    var xml = jitkRedlining_sendRequest(url);
    
    // if no error occurred
    if (xml == 'OK') {
	    JitkHideMessage("win_EsriTaskCell_graphicsRedliningTask");
	    JitkUploadUtil.closeWindow();
	    jitkRedliningCustomGraphicsPreview(id, filename);
    } else {
    	JitkUploadUtil.closeWindow();
        JitkShowMessage("win_EsriTaskCell_graphicsRedliningTask", "error", xml);
    }
}

function jitkReplaceAllSpecialCharacters(str){
    str = str.replace(/</g, "&lt;");
    str = str.replace(/>/g, "&gt;");    
    return str;
}

function jitkRedliningSetFontPreview(){
    if (!document.getElementById("labelRedliningTask_param_labelColor")) return;
    
    var colorVal = document.getElementById("labelRedliningTask_param_labelColor").value;
    var colorArray = colorVal.split(",");
    document.getElementById("labelRedliningTask_param_labelColor").style.color = "rgb(" + colorArray[0] + "," + colorArray[1] + "," + colorArray[2] + ")";
    document.getElementById("labelRedliningTask_param_labelColor").style.backgroundColor = "rgb(" + colorArray[0] + "," + colorArray[1] + "," + colorArray[2] + ")";
    var idx = document.getElementById("labelRedliningTask_param_labelSize").selectedIndex;
    var size = document.getElementById("labelRedliningTask_param_labelSize").options[idx].value;
    idx = document.getElementById("labelRedliningTask_param_font").selectedIndex;
    font = document.getElementById("labelRedliningTask_param_font").options[idx].value;
  
    var style = "border-style: solid; border-width: 1px;" + "font-size:" + size + "pt; font-family:" + font + ";color:" + "rgb(" + colorArray[0] + "," + colorArray[1] + "," + colorArray[2] + ");";    
    var div = document.getElementById('jitk_fontPreview')
        
    var annoTxt = document.getElementById('labelRedliningTask_param_annoText').value;
    if (annoTxt.length <= 0)  style = style + "display:none ;";
    else  style = style + "display:block;width:215px; overflow: auto;";
    
    EsriUtils.setElementStyle(div, style); 
    div.innerHTML = jitkReplaceAllSpecialCharacters(annoTxt);
}

function jitkRedliningSetGraphicsPreview(){
    jitkRedliningChangeGraphics("graphicsRedliningTask_param_graphics");
}

function jitkRedliningSetShapePreview() {

    if (!EsriControls.maps[jitkMapId]) return;
    
    var tool = EsriControls.maps[jitkMapId].currentTool; 
    if(tool != null) {
    	
    	if (tool.id == 'shapeRedliningTask_tool_placePoint')
        	jitkRedliningShowMenu('point');  
    
    	else if (tool.id == 'shapeRedliningTask_tool_placeLine')
        	jitkRedliningShowMenu('line');
    
    	else if (tool.id == 'shapeRedliningTask_tool_placePolygon')
        	jitkRedliningShowMenu('polygon');
    
    	else if (tool.id == 'shapeRedliningTask_tool_placeRectangle')
        	jitkRedliningShowMenu('rectangle');
    
    	else if (tool.id == 'shapeRedliningTask_tool_placeArc')
        	jitkRedliningShowMenu('arc');
        	
        else jitkRedliningShowMenu(jitkPreviousTool);
        
        return;
    }
    	
	jitkRedliningShowMenu(jitkPreviousTool);
	
	//$("#jitkRedliningShapeSymbolPreviewImage").ifixpng();
	
}

function jitkRedliningTimeoutMessage(delDiv, clearDiv, msg){
    var ans = confirm(msg);
    if (ans) document.getElementById(delDiv).click();
    else document.getElementById(clearDiv).click();
} 

function jitkRedliningCheckSelectFeatures(){   
    jitkRedliningSetFontPreview();
    jitkRedliningSetGraphicsPreview();
    jitkRedliningSetShapePreview();
    

    if (document.getElementById("jitk_selectLabelFeatures")) {
	    var sf = parseInt(document.getElementById("jitk_selectLabelFeatures").innerHTML);
	    
	    if (jitkSelectLabelFeatures != sf){
	        jitkSelectLabelFeatures = sf;
	        
	        if (jitkSelectLabelFeatures > 0){
	            setTimeout("jitkRedliningTimeoutMessage('button_labelRedliningTask_action_deleteSelectLabels', 'button_labelRedliningTask_action_clearSelectLabels', jitkDeleteSelectedLabelMessage);", 500);
	        }
	    }
    }
    
    if (document.getElementById("jitk_selectGraphicsFeatures")) {
	    var sf = parseInt(document.getElementById("jitk_selectGraphicsFeatures").innerHTML);
	    
	    if (jitkSelectGraphicsFeatures != sf){
	        jitkSelectGraphicsFeatures = sf;
	        
	        if (jitkSelectGraphicsFeatures > 0){
	            setTimeout("jitkRedliningTimeoutMessage('button_graphicsRedliningTask_action_deleteSelectGraphics', 'button_graphicsRedliningTask_action_clearSelectGraphics', jitkDeleteSelectedGraphicMessage);", 500);
	        }  
	    }
	}
	
    if (document.getElementById("jitk_selectShapeFeatures")) {
	    var sf = parseInt(document.getElementById("jitk_selectShapeFeatures").innerHTML);
	    
	    if (jitkSelectShapeFeatures != sf){
	        jitkSelectShapeFeatures = sf;
	        
	        if (jitkSelectShapeFeatures > 0){
	            setTimeout("jitkRedliningTimeoutMessage('button_shapeRedliningTask_action_deleteSelectShapes', 'button_shapeRedliningTask_action_clearSelectShapes', jitkDeleteSelectedShapeMessage);", 500);
	        }
	    }
	}
}

function jitkRedlining_deleteAllGraphics(msg){
	var elm = document.getElementById("jitk_numGraphics");
  	var elms = elm.getElementsByTagName("input");
  	var inputElm;
  	for (var i = 0; i < elms.length; i++){
    	if (elms[i].id && elms[i].id.indexOf("numGraphics")){
    		inputElm = elms[i];
    	}
  	}
	if (!inputElm) return;
	if (inputElm.value == '0'){
		alert('No feature found for deletion');
		return false;
	}
	if (!confirm(msg)) return false;
	return true;
}

function jitkRedliningInitializeMenuSelection() {
	if (jitkPreviousTool == 'point') {
		jitkRedliningShowMenu('point');
	}
	$("#jitkRedliningShapeSymbolPreviewImage").bind("load", function() {
		$("#jitkRedliningShapeSymbolPreviewImage").ifixpng();
	});
}

function jitkRedliningInitialize() {
	jitkRedliningMessage = '';
	jitkRedliningCreateColorChooser();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -