bool CWKSP_Map_Manager::Add(CWKSP_Layer *pLayer) { int iMap; if( (iMap = DLG_Maps_Add()) >= 0 && Add(pLayer, Get_Map(iMap)) ) { Get_Map(iMap)->View_Show(true); return( true ); } return( false ); }
GMC_DCL(tp_FilHdr, ListFilHdr) { tp_FilHdr ElmFilHdr; tp_LocElm LocElm; tp_FilElm FilElm; if (IsViewSpec(FilHdr)) { FilHdr_Error("Illegal view specification argument: %s\n", FilHdr); return; }/*if*/; if (FilHdr_Flag(FilHdr, FLAG_Union)) { return; }/*if*/; Set_Flag(FilHdr, FLAG_Union); if (!IsRef(FilHdr)) { ElmFilHdr = Do_Deriv(Copy_FilHdr(FilHdr), RootFilPrm, FilPrm, FilTyp); /*select*/{ if (ElmFilHdr != ERROR) { LocElm = Make_LocElm(ElmFilHdr, RootFilPrm, ListFilHdr); Chain_LocElms(FirstLEPtr, LastLEPtr, LocElm); Ret_FilHdr(ElmFilHdr); }else{ FilHdr_Error(" from:\n %s.\n", FilHdr); };}/*select*/; return; }/*if*/; for (FilElm = LocElm_FilElm(FilHdr_LocElm(FilHdr)); FilElm != NIL; FilElm = FilElm_NextFilElm(FilElm)) { ElmFilHdr = FilElm_FilHdr(FilElm); Get_Map(FirstLEPtr, LastLEPtr, ElmFilHdr, Append_FilPrm(FilElm_FilPrm(FilElm), FilPrm), FilTyp, ListFilHdr); Ret_FilHdr(ElmFilHdr); }/*for*/; }/*Get_Map*/
//--------------------------------------------------------- bool CWKSP_Map_Graticule::Get_Graticule(const CSG_Rect &Extent) { bool bResult = false; m_Graticule .Create(SHAPE_TYPE_Line ); m_Coordinates.Create(SHAPE_TYPE_Point); CSG_Tool *pTool = SG_Get_Tool_Library_Manager().Get_Tool("pj_proj4", 14); if( pTool && Get_Map()->Get_Projection().is_Okay() ) { SG_UI_Msg_Lock (true); SG_UI_Progress_Lock(true); pTool->Settings_Push(); if( pTool->Set_Parameter("XMIN" , Extent.Get_XMin()) && pTool->Set_Parameter("XMAX" , Extent.Get_XMax()) && pTool->Set_Parameter("YMIN" , Extent.Get_YMin()) && pTool->Set_Parameter("YMAX" , Extent.Get_YMax()) && pTool->Set_Parameter("INTERVAL" , m_Parameters("INTERVAL")) && pTool->Set_Parameter("FIXED" , m_Parameters("FIXED")) && pTool->Set_Parameter("FITTED" , m_Parameters("FITTED")) && pTool->Set_Parameter("RESOLUTION", m_Parameters("RESOLUTION")) && pTool->Set_Parameter("GRATICULE" , &m_Graticule) && pTool->Set_Parameter("COORDS" , &m_Coordinates) && pTool->Set_Parameter("CRS_PROJ4" , Get_Map()->Get_Projection().Get_Proj4()) && pTool->On_Before_Execution() && pTool->Execute() ) { bResult = true; } pTool->Settings_Pop(); SG_UI_Msg_Lock (false); SG_UI_Progress_Lock(false); } return( bResult ); }
GMC_DCL(tp_FilHdr, ListFilHdr) { tp_LocElm FirstLE, LastLE; if (!(IsList(FilHdr) || IsPntr(FilHdr))) { SystemError("Input to :map must be a list.\n"); return ERROR; }/*if*/; FirstLE = NIL; LastLE = NIL; Get_Map(&FirstLE, &LastLE, FilHdr, FilHdr_FilPrm(ListFilHdr), FilTyp_ArgFilTyp(FilHdr_FilTyp(ListFilHdr)), ListFilHdr); Clr_UnionFlags(FilHdr); return FirstLE; }/*Make_MapLocElm*/
//--------------------------------------------------------- bool CWKSP_Map_Manager::Update(CWKSP_Layer *pLayer, bool bMapsOnly) { int i, n; for(i=0, n=0; i<Get_Count(); i++) { if( Get_Map(i)->Update(pLayer, bMapsOnly) ) { n++; } } return( n > 0 ); }
//--------------------------------------------------------- bool CWKSP_Map_Manager::Del(CWKSP_Layer *pLayer) { int i, n; for(i=Get_Count()-1, n=0; i>=0; i--) { if( g_pMap_Ctrl->Del_Item(Get_Map(i), pLayer) ) { n++; } } return( n > 0 ); }
//--------------------------------------------------------- bool CWKSP_Map_Manager::Exists(CWKSP_Map *pMap) { if( pMap ) { for(int i=0; i<Get_Count(); i++) { if( pMap == Get_Map(i) ) { return( true ); } } } return( false ); }
//--------------------------------------------------------- bool CWMS_Import::On_Execute(void) { CSG_String sServer = Parameters("SERVER")->asString(); //----------------------------------------------------- CWMS_Capabilities Capabilities; if( Capabilities.Create(sServer, "1.1.1") == false ) { Message_Add(_TL("Unable to get capabilities.")); return( false ); } //----------------------------------------------------- if( sServer.Find("http://") == 0 ) { sServer = Parameters("SERVER")->asString() + 7; } CSG_String sPath = "/" + sServer.AfterFirst('/'); sServer = sServer.BeforeFirst('/'); wxHTTP Server; Server.SetUser (Parameters("USERNAME")->asString()); Server.SetPassword(Parameters("PASSWORD")->asString()); if( Server.Connect(sServer.c_str()) == false ) { Message_Add(_TL("Unable to connect to server.")); return( false ); } //----------------------------------------------------- if( Get_Map(&Server, sPath, Capabilities) == false ) { Message_Add(_TL("Unable to get map.")); return( false ); } //----------------------------------------------------- return( true ); }
int main() { int ncase; scanf("%d",&ncase); for(int ii=1;ii<=ncase;ii++) { scanf("%d",&n); memset(map,0,sizeof(map)); for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%d",&mp1[i][j]); for(int i=0;i<n;i++) for(int j=0;j<n;j++) scanf("%d",&mp2[i][j]); int maxi=-1; for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { map[i][j]=Get_Map(i,j); if(maxi<map[i][j])maxi=map[i][j]; } } for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { map[i][j]=maxi-map[i][j]; if(map[i][j]>Lx[i])Lx[i]=map[i][j]; //printf("%d ",map[i][j]); } //puts(""); } memset(Ly,0,sizeof(Ly)); int tem = KM_Match(maxi); double ans=tem*0.5/n; printf("Data Set %d, Best average difference: %.6lf\n",ii,ans); for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) map[i][j]=maxi-map[i][j]; memset(yflag,0,sizeof(yflag)); top=1; DFS_Trace(1,0,tem); puts(""); } return 0; }
//--------------------------------------------------------- wxString CWKSP_Map_Graticule::Get_Description(void) { wxString s; //----------------------------------------------------- s += wxString::Format("<h4>%s</h4>", _TL("Graticule")); s += "<table border=\"0\">"; DESC_ADD_STR(_TL("Name" ), m_Parameters("NAME")->asString()); DESC_ADD_STR(_TL("Projection"), Get_Map()->Get_Projection().Get_Description().c_str()); s += wxT("</table>"); //----------------------------------------------------- return( s ); }
//--------------------------------------------------------- void CWKSP_Map_Graticule::Parameters_Changed(void) { CWKSP_Base_Item::Parameters_Changed(); Get_Map()->View_Refresh(true); }