/**
 *查询完毕
 */
dojo.connect("QueryObjectByWhereCompHandle", QueryObjectCompHandle);
dojo.connect("QueryObjectByWhereFaultHandle", QueryObjectFaultHandle);

function QueryObjectCompHandle(resultFeatures,token){
    // alert (resultFeatures.displayFieldName+token);
    if(!resultFeatures.hasOwnProperty("features") || resultFeatures.features.length == 0){
        alert( "无相关查询数据！");
    }
    else {
        var results  = resultFeatures.features;
        var showFeaturesArray = new Array();
        var defaultPointSymbol = GetSymbol_SimpleMarkerSymbol();
        switch (token){
            case "Query":{
                searchProjectResultByMap = convertMapQueryResultToArray(results);
                var whereStr = getWhereInConditionByArray(searchProjectResultByMap,"OBJECTID");
                SearchWhere = whereStr;
                QueryProjectInfo(1,whereStr,500000,"QueryAll");
                // if(bool_pagination == false)
                //     dyCretateTableByArray("table_result",searchProjectResultByMap,["项目名称","项目阶段"],["项目","状态"]);
                // dojo.forEach(results, function (graphic, i){
                //     switch (graphic.geometry.type){
                //         case "point":{
                //             if (graphic.attributes.项目阶段 == "1")
                //                 graphic.setSymbol(symbol_point_qianqi);
                //             else if (graphic.attributes.项目阶段 == "2")
                //                 graphic.setSymbol(symbol_point_zaijian);
                //             else if (graphic.attributes.项目阶段 == "3")
                //                 graphic.setSymbol(symbol_point_jungong);
                //         }
                //     }
                //     graphicShow = graphic;
                //     showFeaturesArray.push(graphic);
                // });
                // dojo.connect(GraphicsLayer_myLayer  ,"onMouseOver",function(evt){
                //     showInfoWind(evt);
                // });
                // dojo.connect(GraphicsLayer_myLayer  ,"onClick",function(evt){
                //     showInfoClick(evt);
                // });
                // map.infoWindow.on("maximize",infowWindowSetMax);
                // map.infoWindow.on("restore",infoWindowSetMin);
                // map.infoWindow.on("hide",closeEvent);
                // AddObjectToMap(map,GraphicsLayer_myLayer,showFeaturesArray,true,false,100,false);
                break;
            }
            case "QueryPaginationCount":{
                searchProjectResultByMap = convertMapQueryResultToArray(results);
                document.getElementById("total_count").innerHTML = searchProjectResultByMap.length;
                var whereStr = getWhereInConditionByArray(searchProjectResultByMap,"OBJECTID");
                SearchWhere = whereStr;
                QueryProjectInfo(1,whereStr);
                break;
            }
            case "QuerySelectDp":{
                var select_component = document.getElementById("combo_district");
                dyCreateSelectOption(results,select_component);
                break;
            }
            case "QueryProjects":{
                dojo.forEach(results, function (graphic, i){
                    switch (graphic.geometry.type){
                        case "point":{
                            graphic.setSymbol(defaultPointSymbol);
                        }
                    }
                    graphicShow = graphic;
                    showFeaturesArray.push(graphic);
                });
                AddObjectToMap(map,GraphicsLayer_myLayer,showFeaturesArray,true,boolZoom,100,true);
                showInfowWindowBreif(showFeaturesArray[0]);
            }
        }
    }
}

function QueryObjectFaultHandle(errorInfo,token){
    alert( "查询不成功！");
}